/* ===================================================
   It Means — Mockup Design System · Dark Edition
   =================================================== */

/* ── Scrollbar ───────────────────────────────────── */
::-webkit-scrollbar              { width: 6px; height: 6px; }
::-webkit-scrollbar-track        { background: #07090f; }
::-webkit-scrollbar-thumb        { background: rgba(255,255,255,0.10); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover  { background: rgba(20,184,166,0.4); }
::-webkit-scrollbar-corner       { background: #07090f; }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.10) #07090f; }

:root {
  /* Brand */
  --primary:       #14b8a6;
  --primary-hover: #0d9488;
  --primary-dim:   rgba(20,184,166,0.12);
  --primary-mid:   rgba(20,184,166,0.22);
  --amber:         #e8a020;
  --amber-dim:     rgba(232,160,32,0.14);

  /* Surfaces */
  --bg:       #07090f;
  --bg2:      #0b0f1a;
  --surface:  #111827;
  --surface2: #141c2b;
  --surface3: #1a2235;

  /* Borders */
  --border:       rgba(255,255,255,0.07);
  --border-soft:  rgba(255,255,255,0.04);
  --border-hover: rgba(255,255,255,0.14);

  /* Text */
  --text:       rgba(255,255,255,0.92);
  --text-2:     rgba(255,255,255,0.72);
  --text-3:     rgba(255,255,255,0.50);
  --text-4:     rgba(255,255,255,0.32);

  /* Semantic colours */
  --green:      #10b981;
  --green-dim:  rgba(16,185,129,0.14);
  --red:        #ef4444;
  --red-dim:    rgba(239,68,68,0.14);
  --blue:       #60a5fa;
  --blue-dim:   rgba(96,165,250,0.14);
  --purple:     #a78bfa;
  --purple-dim: rgba(167,139,250,0.14);
  --orange:     #fb923c;

  /* Legacy compat (used in some inline styles) */
  --slate-50:   #111827;
  --slate-100:  #141c2b;
  --slate-200:  rgba(255,255,255,0.07);
  --slate-300:  rgba(255,255,255,0.12);
  --slate-400:  rgba(255,255,255,0.32);
  --slate-500:  rgba(255,255,255,0.45);
  --slate-600:  rgba(255,255,255,0.60);
  --slate-700:  rgba(255,255,255,0.72);
  --slate-800:  rgba(255,255,255,0.85);
  --slate-900:  rgba(255,255,255,0.95);

  --emerald-50:  rgba(16,185,129,0.08);
  --emerald-100: rgba(16,185,129,0.18);
  --emerald-200: rgba(16,185,129,0.28);
  --emerald-600: #10b981;
  --emerald-700: #059669;
  --amber-100:   rgba(232,160,32,0.18);
  --amber-600:   #e8a020;
  --blue-100:    rgba(96,165,250,0.18);
  --blue-600:    #60a5fa;
  --red-100:     rgba(239,68,68,0.18);
  --red-600:     #ef4444;
  --purple-100:  rgba(167,139,250,0.18);
  --purple-600:  #a78bfa;

  --sidebar-width: 240px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow:    0 2px 8px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.6);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.7);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;
  color: var(--text-2);
  background: var(--bg);
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ===== Sidebar layout ===== */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg2);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
}

.sidebar-logo {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.logo-mark {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
  color: #07090f; font-weight: 900;
}
.logo-text { font-size: 16px; font-weight: 700; letter-spacing: -0.3px; color: var(--text); }

.sidebar-nav { flex: 1; padding: 12px 8px; }

.nav-section {
  padding: 16px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-4);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--text-3);
  border-radius: 6px;
  transition: all 0.12s;
  cursor: pointer;
  margin-bottom: 1px;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-item.active { color: #07090f; background: var(--primary); font-weight: 600; }
.nav-item.active .nav-icon { filter: none; }
.nav-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #07090f;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}
.nav-item.active .nav-badge { background: rgba(0,0,0,0.2); color: #07090f; }

.phase-tag {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--amber-dim);
  color: var(--amber);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #07090f; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.2; }
.user-role { font-size: 11px; color: var(--text-4); }
.sign-out { font-size: 12px; color: var(--text-4); }
.sign-out:hover { color: var(--red); }

/* ===== Main ===== */
.main { flex: 1; display: flex; flex-direction: column; overflow-y: auto; }

.page-header {
  padding: 20px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.page-header-left h1 {
  font-size: 20px; font-weight: 700;
  color: var(--text); letter-spacing: -0.3px;
}
.page-subtitle { font-size: 13px; color: var(--text-4); margin-top: 2px; }

.page-body { padding: 28px 32px; flex: 1; }

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text); }
.card-subtitle { font-size: 12px; color: var(--text-4); margin-top: 2px; }

/* ===== Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s;
}
.stat-card:hover { border-color: var(--border-hover); }
.stat-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-4); margin-bottom: 8px;
}
.stat-value {
  font-size: 30px; font-weight: 800;
  color: var(--text); letter-spacing: -1px; line-height: 1;
}
.stat-unit { font-size: 13px; font-weight: 500; color: var(--text-4); }
.stat-sub { font-size: 12px; color: var(--text-4); margin-top: 6px; }
.stat-up { color: var(--green); }
.stat-down { color: var(--red); }
.text-amber { color: var(--amber); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius); font-size: 14px; font-weight: 500;
  cursor: pointer; border: none; transition: all 0.12s;
  line-height: 1; white-space: nowrap; text-decoration: none;
}
.btn-primary   { background: var(--primary); color: #07090f; font-weight: 700; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface2); color: var(--text-2); border: 1px solid var(--border-hover); }
.btn-secondary:hover { background: var(--surface3); border-color: var(--primary); }
.btn-ghost     { background: transparent; color: var(--text-3); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); border-color: var(--border-hover); }
.btn-danger    { background: var(--red); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-success   { background: var(--green); color: #07090f; font-weight: 700; }
.btn-sm  { padding: 6px 12px; font-size: 13px; }
.btn-lg  { padding: 12px 24px; font-size: 15px; }
.btn-xl  { padding: 14px 32px; font-size: 16px; font-weight: 600; }
.btn-full { width: 100%; justify-content: center; }

/* ===== Badges ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 100px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.2px;
}
.badge-green   { background: var(--green-dim);  color: #34d399; }
.badge-amber   { background: var(--amber-dim);  color: var(--amber); }
.badge-blue    { background: var(--blue-dim);   color: var(--blue); }
.badge-red     { background: var(--red-dim);    color: #f87171; }
.badge-slate   { background: rgba(255,255,255,0.06); color: var(--text-3); }
.badge-purple  { background: var(--purple-dim); color: var(--purple); }
.badge-teal    { background: var(--primary-dim);color: var(--primary); }

.phase-badge { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 700; letter-spacing: 0.3px; }
.p1 { background: var(--green-dim); color: #34d399; }
.p2 { background: var(--amber-dim); color: var(--amber); }
.p3 { background: var(--blue-dim);  color: var(--blue); }

/* ===== Forms ===== */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text-2); margin-bottom: 6px;
}
.form-label .req { color: var(--red); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border-hover); border-radius: var(--radius);
  font-size: 14px; color: var(--text); background: var(--surface2);
  transition: border-color 0.12s, box-shadow 0.12s; outline: none;
}
.form-input::placeholder { color: var(--text-4); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(20,184,166,0.15);
}
.form-select option { background: var(--surface2); color: var(--text); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--text-4); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left; padding: 10px 16px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-4); background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 13px 16px; border-bottom: 1px solid var(--border-soft);
  color: var(--text-2);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface2); }
.td-main { font-weight: 500; color: var(--text); }
.td-mono { font-family: monospace; font-size: 12px; color: var(--text-4); }

/* ===== Public pages (no sidebar) ===== */
.public-nav {
  background: var(--bg2); padding: 0 40px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid var(--border);
}
.public-nav .logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 16px; font-weight: 700; }
.logo-dot { width: 30px; height: 30px; background: var(--primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; color: #07090f; font-weight: 900; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a { color: var(--text-4); font-size: 14px; font-weight: 500; transition: color 0.12s; }
.nav-links a:hover { color: var(--text); }
.nav-links .cta { background: var(--primary); color: #07090f; padding: 8px 16px; border-radius: 8px; font-weight: 700; }
.nav-links .cta:hover { background: var(--primary-hover); }

.hero {
  background: linear-gradient(135deg, var(--bg) 0%, #0a1628 100%);
  color: var(--text); padding: 96px 40px; text-align: center;
  border-bottom: 1px solid var(--border);
}
.hero h1 { font-size: 52px; font-weight: 800; letter-spacing: -1.5px; line-height: 1.1; margin-bottom: 18px; }
.hero .tagline { font-size: 13px; letter-spacing: 1px; text-transform: uppercase; color: var(--primary); font-weight: 600; margin-bottom: 16px; }
.hero p { font-size: 18px; color: var(--text-3); max-width: 560px; margin: 0 auto 36px; line-height: 1.6; }
.hero-actions { display: flex; gap: 12px; justify-content: center; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 40px; }
.section { padding: 72px 0; }
.section-title { font-size: 28px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; margin-bottom: 8px; }
.section-sub { font-size: 16px; color: var(--text-4); margin-bottom: 40px; }

/* ===== Auth ===== */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: 32px;
}
.auth-card {
  background: var(--surface); border-radius: var(--radius-xl);
  padding: 40px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.auth-logo-mark { width: 40px; height: 40px; background: var(--primary); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; color: #07090f; font-weight: 900; }
.auth-logo-text { font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; }
.auth-title { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.auth-sub { font-size: 14px; color: var(--text-4); margin-bottom: 28px; }

/* ===== Divider ===== */
.divider { height: 1px; background: var(--border); margin: 24px 0; }
.divider-label {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: var(--text-4); margin: 20px 0;
}
.divider-label::before, .divider-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ===== Grids ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ===== Flex utilities ===== */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.flex-1 { flex: 1; }

/* ===== Spacing ===== */
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.ml-auto { margin-left: auto; }

/* ===== Typography ===== */
.text-xs   { font-size: 11px; }
.text-sm   { font-size: 13px; }
.text-base { font-size: 14px; }
.text-lg   { font-size: 16px; }
.text-xl   { font-size: 18px; }
.text-muted   { color: var(--text-4); }
.text-primary { color: var(--primary); }
.text-success { color: var(--green); }
.text-danger  { color: var(--red); }
.font-medium  { font-weight: 500; }
.font-semi    { font-weight: 600; }
.font-bold    { font-weight: 700; }
.text-900 { color: var(--text); }
.text-center { text-align: center; }

/* ===== Alerts ===== */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 13px; display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px; line-height: 1.5;
}
.alert-info    { background: var(--blue-dim);  color: var(--blue);  border: 1px solid rgba(96,165,250,0.2); }
.alert-success { background: var(--green-dim); color: #34d399;      border: 1px solid rgba(16,185,129,0.2); }
.alert-warning { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(232,160,32,0.2); }
.alert-danger  { background: var(--red-dim);   color: #f87171;      border: 1px solid rgba(239,68,68,0.2); }

/* ===== Phase notice ===== */
.phase-notice {
  background: var(--amber-dim); border: 1px dashed rgba(232,160,32,0.4);
  border-radius: var(--radius); padding: 12px 16px;
  font-size: 13px; color: var(--amber);
  display: flex; align-items: center; gap: 8px; margin-bottom: 20px;
}

/* ===== Step indicator ===== */
.step-bar { display: flex; align-items: center; margin-bottom: 32px; }
.step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface2); color: var(--text-4);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; position: relative; z-index: 1; flex-shrink: 0;
  border: 1px solid var(--border-hover);
}
.step-dot.active { background: var(--primary); color: #07090f; border-color: var(--primary); }
.step-dot.done   { background: var(--green); color: #07090f; border-color: var(--green); }
.step-label { font-size: 12px; color: var(--text-4); margin-top: 4px; white-space: nowrap; }
.step-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.step-line { flex: 1; height: 2px; background: var(--border-hover); }
.step-line.done { background: var(--green); }

/* ===== Unit selector ===== */
.unit-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid var(--border-soft); }
.unit-row:last-child { border-bottom: none; }
.unit-name { font-size: 15px; font-weight: 600; color: var(--text); }
.unit-rate { font-size: 12px; color: var(--text-4); margin-top: 2px; }
.unit-controls { display: flex; align-items: center; gap: 12px; }
.unit-btn {
  width: 32px; height: 32px; border-radius: var(--radius); border: 1px solid var(--border-hover);
  background: var(--surface2); font-size: 18px; cursor: pointer; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; transition: all 0.12s;
}
.unit-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-dim); }
.unit-count { font-size: 18px; font-weight: 700; min-width: 28px; text-align: center; color: var(--text); }

/* ===== QR ===== */
.qr-wrap {
  background: var(--surface); padding: 28px;
  border-radius: var(--radius-xl); display: inline-flex;
  flex-direction: column; align-items: center; gap: 16px;
  box-shadow: var(--shadow-lg); text-align: center;
  border: 1px solid var(--border);
}
.qr-code {
  width: 192px; height: 192px;
  background-image:
    repeating-linear-gradient(0deg,   transparent 0 6px, rgba(20,184,166,0.8) 6px 8px),
    repeating-linear-gradient(90deg,  transparent 0 6px, rgba(20,184,166,0.8) 6px 8px);
  border: 3px solid var(--surface); outline: 2px solid var(--primary);
  position: relative; background-color: var(--surface2);
}
.qr-code::before, .qr-code::after {
  content: ''; position: absolute;
  width: 48px; height: 48px;
  background: var(--surface2);
  border: 3px solid var(--primary);
}
.qr-code::before { top: 8px; left: 8px; }
.qr-code::after  { bottom: 8px; right: 8px; }
.qr-name    { font-size: 17px; font-weight: 700; color: var(--text); }
.qr-balance { font-size: 13px; color: var(--text-4); }

/* ===== Scan viewfinder ===== */
.scan-area {
  background: var(--surface); border-radius: var(--radius-xl);
  padding: 40px; text-align: center; color: var(--text);
  border: 1px solid var(--border);
}
.viewfinder {
  width: 220px; height: 220px; margin: 0 auto 24px;
  border: 2px solid var(--border-hover);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  position: relative; background: var(--surface2);
  font-size: 48px;
}
.viewfinder-corner {
  position: absolute; width: 28px; height: 28px; border-color: var(--primary); border-style: solid;
}
.vc-tl { top: -2px; left: -2px; border-width: 3px 0 0 3px; border-radius: 8px 0 0 0; }
.vc-tr { top: -2px; right: -2px; border-width: 3px 3px 0 0; border-radius: 0 8px 0 0; }
.vc-bl { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; border-radius: 0 0 0 8px; }
.vc-br { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; border-radius: 0 0 8px 0; }
.scan-prompt { font-size: 14px; color: var(--text-4); }

/* ===== Merchant card ===== */
.merchant-card {
  display: flex; align-items: center; gap: 16px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  cursor: pointer; transition: all 0.12s;
}
.merchant-card:hover { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.merchant-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--primary-dim); display: flex; align-items: center;
  justify-content: center; font-size: 22px; flex-shrink: 0;
  border: 1px solid rgba(20,184,166,0.2);
}
.merchant-name { font-size: 15px; font-weight: 600; color: var(--text); }
.merchant-meta { font-size: 12px; color: var(--text-4); margin-top: 2px; }

/* ===== Avatar ===== */
.avatar {
  border-radius: 50%; background: var(--primary); color: #07090f;
  display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-xl { width: 80px; height: 80px; font-size: 28px; }

/* ===== Progress ===== */
.progress { height: 6px; background: var(--surface2); border-radius: 100px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 100px; }

/* ===== Timeline / steps ===== */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: flex; gap: 16px; padding-bottom: 24px; position: relative; }
.tl-item:not(:last-child)::after {
  content: ''; position: absolute; left: 15px; top: 32px;
  width: 2px; height: calc(100% - 32px); background: var(--border-hover);
}
.tl-dot {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary);
  color: #07090f; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0; position: relative; z-index: 1;
}
.tl-dot.pending { background: var(--surface2); color: var(--text-4); border: 1px solid var(--border-hover); }
.tl-content { flex: 1; padding-top: 5px; }
.tl-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.tl-desc  { font-size: 13px; color: var(--text-4); }

/* ===== Balance display ===== */
.balance-display {
  background: linear-gradient(135deg, #0a1628 0%, #0d2137 100%);
  border-radius: var(--radius-xl); padding: 28px; color: var(--text);
  border: 1px solid rgba(20,184,166,0.2);
}
.balance-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-4); margin-bottom: 12px; }
.balance-services { font-size: 20px; font-weight: 700; line-height: 1.4; }
.balance-note { font-size: 12px; color: var(--text-4); margin-top: 8px; }
.balance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.balance-item { background: rgba(255,255,255,0.05); border-radius: 10px; padding: 12px; border: 1px solid var(--border); }
.balance-item-val { font-size: 28px; font-weight: 800; line-height: 1; color: var(--primary); }
.balance-item-lbl { font-size: 12px; color: var(--text-4); margin-top: 4px; }

/* ===== Cardholder result card ===== */
.cardholder-result {
  border: 2px solid var(--primary); border-radius: var(--radius-xl);
  padding: 20px; background: var(--primary-dim);
  display: flex; align-items: center; gap: 16px;
}

/* ===== Ledger numbers ===== */
.ledger-big { font-size: 48px; font-weight: 900; letter-spacing: -2px; color: var(--text); line-height: 1; }
.ledger-unit { font-size: 14px; color: var(--text-4); margin-top: 4px; font-weight: 500; }

/* ===== Status dot ===== */
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.green  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.amber  { background: var(--amber); }
.status-dot.red    { background: var(--red); }
.status-dot.slate  { background: var(--text-4); }

/* ===== Upload area ===== */
.upload-area {
  border: 2px dashed var(--border-hover); border-radius: var(--radius-lg);
  padding: 32px; text-align: center; cursor: pointer; transition: all 0.12s;
  background: var(--surface2);
}
.upload-area:hover { border-color: var(--primary); background: var(--primary-dim); }
.upload-icon { font-size: 32px; margin-bottom: 8px; }
.upload-text { font-size: 14px; font-weight: 500; color: var(--text-2); }
.upload-hint { font-size: 12px; color: var(--text-4); margin-top: 4px; }

/* ===== Health indicator ===== */
.health-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border-soft);
}
.health-row:last-child { border-bottom: none; }
.health-name { font-size: 14px; font-weight: 500; color: var(--text-2); flex: 1; }
.health-val  { font-size: 13px; color: var(--text-4); }

/* ===== Role selector ===== */
.role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 24px; }
.role-btn {
  padding: 14px 10px; border: 2px solid var(--border-hover); border-radius: var(--radius-lg);
  background: var(--surface2); cursor: pointer; text-align: center; transition: all 0.12s; color: var(--text-2);
}
.role-btn:hover { border-color: var(--primary); background: var(--primary-dim); color: var(--text); }
.role-btn.selected { border-color: var(--primary); background: var(--primary-dim); color: var(--text); }
.role-emoji { font-size: 24px; margin-bottom: 4px; }
.role-name { font-size: 12px; font-weight: 600; }

/* ===== Mockup index grid ===== */
.mockup-link {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--surface2);
  transition: border-color 0.15s, background 0.15s;
  text-decoration: none;
}
.mockup-link:hover { border-color: var(--primary); background: var(--primary-dim); }
.mockup-link-icon { font-size: 22px; }
.mockup-link-name { font-size: 13px; font-weight: 600; color: var(--text); }
.mockup-link-sub  { font-size: 11px; color: var(--text-4); }

/* =================================================================
   CARDHOLDER MOBILE LAYOUT
   ================================================================= */

/* On mobile (≤680px), cardholder pages switch to:
   - No sidebar (hidden)
   - Bottom tab bar
   - Full-width scrollable content
   - Extra bottom padding to clear the tab bar
*/

.mobile-tab-bar { display: none; }

@media (max-width: 680px) {
  /* Body adjustment */
  body.cardholder { background: var(--bg); }

  /* Hide the desktop sidebar */
  body.cardholder .sidebar { display: none; }

  /* Make layout block instead of flex */
  body.cardholder .layout {
    display: block;
    height: auto;
    overflow: visible;
  }

  /* Main becomes full screen */
  body.cardholder .main {
    min-height: 100vh;
    padding-bottom: 84px; /* clear the tab bar */
    overflow-y: auto;
  }

  /* Page header */
  body.cardholder .page-header {
    padding: 16px 20px;
    flex-direction: column;
    gap: 10px;
  }
  body.cardholder .page-header h1 { font-size: 22px; }

  /* Page body */
  body.cardholder .page-body { padding: 16px 20px; }

  /* Grids stack */
  body.cardholder .grid-2,
  body.cardholder .grid-3,
  body.cardholder .grid-4 { grid-template-columns: 1fr; }
  body.cardholder .stats-grid { grid-template-columns: 1fr 1fr; }
  body.cardholder .form-row,
  body.cardholder .form-row-3 { grid-template-columns: 1fr; }

  /* Show mobile tab bar */
  .mobile-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 72px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    z-index: 100;
    align-items: center;
    padding: 0 4px;
    gap: 2px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-4);
    transition: color 0.12s, background 0.12s;
    min-width: 0;
  }
  .tab-item:hover { color: var(--text-2); background: rgba(255,255,255,0.04); }
  .tab-item.active { color: var(--primary); }

  .tab-icon { font-size: 26px; line-height: 1; }
  .tab-label {
    font-size: 9px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.3px;
    white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; max-width: 100%;
  }

  /* SOS tab — prominent red */
  .tab-sos { color: #f87171; }
  .tab-sos.active { color: #ef4444; }
  .tab-sos .tab-icon { font-size: 30px; }

  /* Badge on tab icon */
  .tab-badge {
    position: absolute;
    top: 4px; right: 8px;
    background: var(--primary); color: #07090f;
    font-size: 9px; font-weight: 800;
    padding: 1px 5px; border-radius: 10px;
    line-height: 1.4;
  }
  .tab-item { position: relative; }

  /* Mobile-specific card tweaks */
  body.cardholder .card { padding: 16px; border-radius: 10px; }
  body.cardholder .stat-card { padding: 14px 16px; }
  body.cardholder .stat-value { font-size: 26px; }
}

/* Desktop: hide mobile-only tab bar always */
@media (min-width: 681px) {
  .mobile-tab-bar { display: none !important; }
}

/* ===== Responsive (non-cardholder) ===== */
@media (max-width: 768px) {
  body:not(.cardholder) .layout { flex-direction: column; height: auto; overflow: visible; }
  body:not(.cardholder) .sidebar { width: 100%; min-width: 0; height: auto; }
  body:not(.cardholder) .main { overflow-y: visible; }
  .form-row, .form-row-3, .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-body { padding: 16px; }
  .page-header { padding: 16px; }
  .hero h1 { font-size: 32px; }
  .hero { padding: 60px 24px; }
}
