:root {
  --primary: #E63946;      /* red — urgent money */
  --primary-dark: #c1121f;
  --bg: #F8F9FA;
  --card: #FFFFFF;
  --text: #212529;
  --muted: #6C757D;
  --border: #E9ECEF;
  --success: #2D6A4F;
  --success-bg: #D8F3DC;
  --warning: #E76F51;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 16px rgba(0,0,0,0.07);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Layout */
.page-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
}

.landing-card {
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.setup-card {
  max-width: 440px;
  width: 100%;
  text-align: center;
}

/* Logo & Headings */
.logo {
  font-size: 48px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}

h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}

.tagline {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 32px;
}

p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.hint {
  font-size: 13px;
  color: var(--muted);
  margin-top: 16px;
}

/* Forms */
input[type="text"],
input[type="tel"],
input[type="email"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.15s;
  background: #fff;
}

input:focus,
select:focus {
  border-color: var(--primary);
}

/* Buttons */
button,
.btn {
  display: inline-block;
  padding: 13px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  width: 100%;
}

button:hover,
.btn:hover {
  background: var(--primary-dark);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  width: auto;
}

.btn-ghost {
  background: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  background: #dee2e6;
}

/* Dashboard layout */
.dash-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-header .brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.dash-body {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* Stat cards */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
}

.stat-card.accent .stat-value {
  color: var(--primary);
}

/* Connection status */
.connections {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.conn-badge {
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg);
  border: 1px solid var(--border);
}

.conn-ok {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success);
}

.conn-no {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FCCAC1;
}

/* Actions row */
.actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.actions button {
  width: auto;
}

/* Table */
.table-wrap {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: #F8F9FA;
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

td {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}

tr:hover td {
  background: #FAFAFA;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-pending {
  background: #FEF3C7;
  color: #92400E;
}

.badge-paid {
  background: var(--success-bg);
  color: var(--success);
}

.badge-partial {
  background: #E0F2FE;
  color: #0369A1;
}

/* QR wrap */
#qr-wrap {
  margin: 24px auto;
  display: flex;
  justify-content: center;
}

#qr-box {
  background: #F8F9FA;
  border-radius: 12px;
  padding: 24px;
  min-width: 220px;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
}

code {
  background: #F8F9FA;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

/* Responsive */
@media (max-width: 640px) {
  .stats {
    grid-template-columns: 1fr;
  }
  .dash-body {
    padding: 16px;
  }
  .card {
    padding: 24px;
  }
  .actions {
    flex-direction: column;
  }
  .actions button {
    width: 100%;
  }
}
