/* ============================================================
   Conveyance — modern SaaS UI
   ============================================================ */

:root,
:root[data-theme="light"] {
  --bg:           #f6f7f9;
  --surface:      #ffffff;
  --surface-2:    #f2f4f7;
  --surface-3:    #e8ebf0;
  --border:       #e3e6eb;
  --border-strong:#d0d5dd;
  --text:         #0f172a;
  --text-muted:   #64748b;
  --text-faint:   #94a3b8;
  --accent:       #6366f1;
  --accent-2:     #4f46e5;
  --accent-soft:  #eef2ff;
  --ok:           #059669;
  --ok-soft:      #ecfdf5;
  --err:          #dc2626;
  --err-soft:     #fef2f2;
  --warn:         #d97706;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05);
  --shadow:    0 4px 12px rgba(15,23,42,.06);
  --shadow-lg: 0 12px 32px rgba(15,23,42,.10);
  --radius:    10px;
  --radius-lg: 14px;
}

:root[data-theme="dark"] {
  --bg:           #0b0d12;
  --surface:      #12151c;
  --surface-2:    #171b24;
  --surface-3:    #1e232e;
  --border:       #232833;
  --border-strong:#2f3745;
  --text:         #e7e9ee;
  --text-muted:   #8b93a7;
  --text-faint:   #5f677a;
  --accent:       #7c83ff;
  --accent-2:     #6366f1;
  --accent-soft:  rgba(124,131,255,.14);
  --ok:           #34d399;
  --ok-soft:      rgba(52,211,153,.12);
  --err:          #f87171;
  --err-soft:     rgba(248,113,113,.12);
  --warn:         #fbbf24;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 4px 14px rgba(0,0,0,.5);
  --shadow-lg: 0 12px 36px rgba(0,0,0,.6);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg:           #0b0d12;
    --surface:      #12151c;
    --surface-2:    #171b24;
    --surface-3:    #1e232e;
    --border:       #232833;
    --border-strong:#2f3745;
    --text:         #e7e9ee;
    --text-muted:   #8b93a7;
    --text-faint:   #5f677a;
    --accent:       #7c83ff;
    --accent-2:     #6366f1;
    --accent-soft:  rgba(124,131,255,.14);
    --ok:           #34d399;
    --ok-soft:      rgba(52,211,153,.12);
    --err:          #f87171;
    --err-soft:     rgba(248,113,113,.12);
    --warn:         #fbbf24;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow:    0 4px 14px rgba(0,0,0,.5);
    --shadow-lg: 0 12px 36px rgba(0,0,0,.6);
  }
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.mono, td.num, .stat-value, .chart-value, .rc-value, .live-rate {
  font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

h1, h2, h3 { margin: 0; letter-spacing: -0.015em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 13px; font-weight: 600; }

.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.right { text-align: right; }
.strong { font-weight: 700; }
.inline { display: inline-flex; gap: 8px; align-items: center; }

/* -----------------------------------------------------------
   App shell
   ----------------------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 20px 8px;
}
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #a5b4fc);
  box-shadow: 0 4px 12px rgba(99,102,241,.35);
  flex-shrink: 0;
}
.brand-mark.big { width: 44px; height: 44px; border-radius: 12px; margin-bottom: 20px; }
.brand-text { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px; font-weight: 500;
  transition: all .12s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.subtle { color: var(--text-faint); font-size: 12px; }
.nav-icon { width: 16px; text-align: center; opacity: .9; }

.sidebar-foot { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.theme-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); font-size: 12px; font-weight: 500;
  cursor: pointer; font-family: inherit;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 32px 0 32px;
}
.page-title { font-size: 20px; font-weight: 700; }

.topbar-right .user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #a5b4fc);
  color: #fff; font-weight: 700; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.user-name { font-weight: 500; }

.content { padding: 20px 32px 40px 32px; max-width: 1200px; width: 100%; }

/* -----------------------------------------------------------
   Panels & headings
   ----------------------------------------------------------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}

.hero { margin-bottom: 22px; }
.hero-greeting { font-size: 24px; font-weight: 700; margin-bottom: 4px; }

/* -----------------------------------------------------------
   Stats
   ----------------------------------------------------------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.stat-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.stat-value { font-size: 24px; font-weight: 700; margin: 6px 0 2px; }
.stat-value.accent { color: var(--accent); }
.stat-sub { font-size: 11px; color: var(--text-faint); }

/* -----------------------------------------------------------
   Chart
   ----------------------------------------------------------- */
.chart {
  display: flex; gap: 18px; align-items: flex-end;
  height: 180px; padding: 12px 0 0 0;
}
.chart-col {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
  height: 100%;
}
.chart-bar {
  width: 100%; max-width: 60px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: opacity .15s;
}
.chart-col:hover .chart-bar { opacity: .85; }
.chart-label { font-size: 11px; color: var(--text-muted); margin-top: 8px; text-transform: uppercase; letter-spacing: .06em; }
.chart-value { font-size: 11px; color: var(--text-faint); margin-top: 2px; }

/* -----------------------------------------------------------
   Buttons
   ----------------------------------------------------------- */
button, .btn-primary, .btn-ghost, .btn-danger {
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 9px 14px; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer;
  transition: all .12s ease; display: inline-flex;
  align-items: center; gap: 6px; line-height: 1;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,.3); }
.btn-primary.wide { width: 100%; justify-content: center; }
.btn-primary.lg { padding: 12px 18px; font-size: 14px; }
.btn-primary.sm { padding: 6px 11px; font-size: 12px; }

.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost.sm { padding: 6px 11px; font-size: 12px; }

.btn-danger { background: transparent; color: var(--err); border-color: transparent; }
.btn-danger:hover { background: var(--err-soft); }
.btn-danger.sm { padding: 6px 10px; font-size: 12px; }

/* -----------------------------------------------------------
   Tables
   ----------------------------------------------------------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.tbl th {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  background: var(--surface-2);
  position: sticky; top: 0;
}
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.num { text-align: right; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.tbl.data tbody tr:nth-child(odd) { background: color-mix(in srgb, var(--surface-2) 40%, transparent); }

/* Vehicle dots */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-car  { background: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.dot-bike { background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.15); }

/* Pills */
.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--surface-3); color: var(--text-muted);
}
.pill-admin { background: linear-gradient(135deg, #a855f7, #6366f1); color: #fff; }

/* -----------------------------------------------------------
   Empty state
   ----------------------------------------------------------- */
.empty { padding: 48px 20px; text-align: center; color: var(--text-muted); }
.empty-icon { font-size: 36px; margin-bottom: 12px; opacity: .6; }
.empty p { margin: 0 0 16px; }

/* -----------------------------------------------------------
   Forms
   ----------------------------------------------------------- */
.stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span {
  font-size: 12px; color: var(--text-muted); font-weight: 500;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

input, select, textarea {
  font: inherit; font-size: 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder { color: var(--text-faint); }

/* Segmented control (vehicle / fuel) */
.seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--surface-2);
  padding: 4px; border-radius: 10px;
  border: 1px solid var(--border);
}
.seg-item {
  display: flex; align-items: center; justify-content: center;
  padding: 9px 8px; border-radius: 7px;
  cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  transition: all .12s;
  position: relative;
}
.seg-item input { position: absolute; opacity: 0; pointer-events: none; }
.seg-item:hover { color: var(--text); }
.seg-item:has(input:checked) {
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.seg.locked { opacity: .6; pointer-events: none; }

/* Day chips */
.daychips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  cursor: pointer; user-select: none; font-size: 12px;
  transition: all .12s;
}
.chip input { width: auto; margin: 0; accent-color: var(--accent); }
.chip:hover { border-color: var(--accent); }
.chip:has(input:checked) {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
}

/* Grid form for bulk */
.grid-form {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
}
.grid-form .span-2 { grid-column: span 2; }
.grid-form .span-4 { grid-column: span 4; }
.form-actions { display: flex; justify-content: flex-end; }

/* -----------------------------------------------------------
   Entry layout (form + live card)
   ----------------------------------------------------------- */
.entry-layout {
  display: grid; grid-template-columns: 1.4fr 1fr;
  gap: 18px; margin-bottom: 20px;
}
.entry-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--shadow-sm);
}
.entry-form h2 { margin-bottom: 4px; }

.live-card {
  background: linear-gradient(160deg, var(--accent-soft), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm);
  position: sticky; top: 20px;
  height: fit-content;
}
.live-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.live-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 600; }
.live-pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-faint);
  transition: background .3s;
}
.live-pulse.loading { background: var(--warn); animation: pulse 1s infinite; }
.live-pulse.ok { background: var(--ok); }
.live-pulse.err { background: var(--err); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

.live-rate {
  font-size: 32px; font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}
.live-eff { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }

.live-divider { height: 1px; background: var(--border); margin: 8px 0 14px; }

.live-row {
  display: flex; justify-content: space-between;
  padding: 8px 0; font-size: 13px;
  color: var(--text-muted);
}
.live-row .mono { color: var(--text); font-weight: 500; }

.live-total {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; padding-top: 14px;
  border-top: 2px solid var(--accent);
  font-size: 15px; font-weight: 600;
}
.live-total .mono { font-size: 20px; color: var(--accent); }

/* -----------------------------------------------------------
   Two column layout for profile
   ----------------------------------------------------------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.two-col .panel { margin-bottom: 0; }

/* -----------------------------------------------------------
   Admin rate cards
   ----------------------------------------------------------- */
.rate-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.rate-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.rc-label {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
  margin-bottom: 6px;
}
.rc-value { font-size: 18px; font-weight: 700; }

/* -----------------------------------------------------------
   Auth split layout
   ----------------------------------------------------------- */
.auth-split {
  display: grid; grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}
.auth-art {
  background: linear-gradient(160deg, #6366f1 0%, #4f46e5 50%, #4338ca 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 48px;
  position: relative; overflow: hidden;
}
.auth-art::before {
  content: ""; position: absolute; inset: -50%;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.15), transparent 40%),
    radial-gradient(circle at 70% 80%, rgba(255,255,255,.10), transparent 40%);
  pointer-events: none;
}
.auth-art-inner { position: relative; max-width: 400px; }
.auth-art h1 { font-size: 32px; font-weight: 700; margin-bottom: 12px; }
.auth-art p { font-size: 15px; opacity: .9; line-height: 1.6; margin-bottom: 28px; }
.art-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.art-list li { font-size: 14px; opacity: .92; }

.auth-form-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 48px 32px;
  background: var(--bg);
}
.auth-form {
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 16px;
}
.auth-form h2 { font-size: 24px; margin-bottom: 4px; }
.auth-form .muted { margin-bottom: 8px; }

@media (max-width: 860px) {
  /* Stack columns */
  .auth-split {
    grid-template-columns: 1fr;
    min-height: 100dvh;          /* fixes the "cut in half" — dvh, not vh */
    min-height: 100vh;           /* fallback for old browsers */
  }

  /* Keep the art panel but shrink it to a compact header */
  .auth-art {
    display: flex;
    min-height: 180px;
    padding: 28px 24px;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
  }
  .auth-art-inner {
    max-width: 100%;
    align-items: center;
    text-align: center;
  }
  .auth-art h1 {
    font-size: 22px;
    margin: 0 0 4px 0;
  }
  .auth-art .tagline {
    font-size: 13px;
  }
  .auth-art .logo-lg {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    margin-bottom: 14px;
  }

  /* Form sits below the header, scrollable, no clipped top */
  .auth-form-wrap {
    padding: 32px 20px calc(32px + env(safe-area-inset-bottom, 0px));
    align-items: flex-start;      /* don't vertically center — natural top flow */
    min-height: 0;
  }
  .auth-form {
    max-width: 100%;
  }
  .auth-form h2 {
    font-size: 20px;
  }
  .auth-form input {
    font-size: 16px;              /* prevents iOS zoom-on-focus */
    padding: 12px 14px;
  }
  .auth-form .btn-primary {
    min-height: 48px;
    font-size: 15px;
  }
}

/* -----------------------------------------------------------
   Toasts
   ----------------------------------------------------------- */
.toasts {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9999;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 260px; max-width: 400px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 500;
  animation: slideIn .25s ease-out;
}
.toast-success { border-left: 3px solid var(--ok); }
.toast-success .toast-icon { color: var(--ok); }
.toast-error { border-left: 3px solid var(--err); }
.toast-error .toast-icon { color: var(--err); }
.toast-icon { font-weight: 700; font-size: 14px; }
.toast.fade-out { animation: fadeOut .25s ease-out forwards; }
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes fadeOut {
  to { transform: translateX(20px); opacity: 0; }
}

/* -----------------------------------------------------------
   Responsive
   ----------------------------------------------------------- */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .entry-layout { grid-template-columns: 1fr; }
  .live-card { position: static; }
  .rate-cards { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
}
/* -----------------------------------------------------------
   Mobile menu button (hidden on desktop)
   ----------------------------------------------------------- */
.mobile-menu-btn {
  display: none;
  position: fixed; top: 14px; left: 14px; z-index: 200;
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 0;
  flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  box-shadow: var(--shadow-sm);
}
.mobile-menu-btn span {
  display: block; width: 18px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .15s, opacity .15s;
}
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 90;
  opacity: 0;
  transition: opacity .2s;
}
.sidebar-backdrop.show {
  display: block;
  opacity: 1;
}

/* -----------------------------------------------------------
   Small screens
   ----------------------------------------------------------- */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .entry-layout { grid-template-columns: 1fr; }
  .live-card { position: static; }
  .rate-cards { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  /* --- app shell --- */
  .app { grid-template-columns: 1fr; }
  .mobile-menu-btn { display: flex; }

  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 260px; z-index: 100;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.35);
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }

  /* --- topbar --- */
  .topbar {
    padding: 14px 16px 0 64px;   /* leave room for the menu button */
    min-height: 52px;
  }
  .page-title { font-size: 17px; }
  .topbar-right .user-chip {
    padding: 4px 10px 4px 4px;
    font-size: 12px;
  }
  .user-name { display: none; }   /* avatar only on tiny screens */

  /* --- content spacing --- */
  .content { padding: 16px 14px 32px; }
  .panel { padding: 16px; border-radius: 12px; }
  h1 { font-size: 20px; }
  h2 { font-size: 14px; }

  /* --- stats --- */
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 18px; }

  /* --- forms --- */
  .field-row { grid-template-columns: 1fr; gap: 10px; }
  .grid-form { grid-template-columns: 1fr; }
  .grid-form .span-2,
  .grid-form .span-4 { grid-column: span 1; }
  input, select, textarea {
    font-size: 16px;             /* prevents iOS zoom-on-focus */
    padding: 12px 12px;
  }
  .btn-primary, .btn-ghost, .btn-danger {
    min-height: 44px;             /* tap-friendly */
    padding: 11px 16px;
  }
  .btn-primary.sm, .btn-ghost.sm, .btn-danger.sm {
    min-height: 34px;
    padding: 8px 12px;
  }

  /* --- entry layout --- */
  .entry-layout { grid-template-columns: 1fr; }
  .live-card { padding: 16px; }
  .live-rate { font-size: 26px; }
  .claim-total .mono { font-size: 16px; }

  /* --- tables: turn into cards --- */
  .table-wrap { overflow: visible; margin: 0; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
    padding: 12px 14px;
  }
  .tbl tr:hover td { background: transparent; }
  .tbl td {
    border: none; padding: 4px 0;
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    text-align: right;
  }
  .tbl td::before {
    content: attr(data-label);
    flex: 0 0 40%;
    text-align: left;
    font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted); font-weight: 600;
  }
  .tbl td.num, .tbl td.right { text-align: right; }
  /* Empty cells still take a row; hide ones with no label to keep cards clean */
  .tbl td:empty { display: none; }

  /* --- filters row --- */
  .panel-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .panel-head .inline { flex-wrap: wrap; }
  .panel-head form { width: 100%; }
  .panel-head select { width: 100%; }

  /* --- charts --- */
  .chart { gap: 6px; height: 140px; }
  .chart-value { display: none; }
  .chart-bar { max-width: 32px; }
  .chart-label { font-size: 10px; }

  /* --- day chips --- */
  .daychips .chip { padding: 8px 12px; font-size: 13px; }
}

@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr; }
  .content { padding: 12px 10px 28px; }
  .topbar { padding-left: 58px; }
}
/* ---- Glitter credit ---- */
.dev-credit {
  margin-top: 14px;
  padding: 14px 8px 4px 8px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
  position: relative;
}
.dev-credit .dev-label {
  display: block;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 600;
  font-size: 10px;
  color: var(--text-faint);
  opacity: .8;
  margin-bottom: 4px;
}
.dev-credit .dev-name {
  display: inline-block;
  position: relative;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .01em;
  background: linear-gradient(
    100deg,
    var(--accent) 0%,
    var(--accent) 35%,
    #f5d1ff 45%,
    #ffffff 50%,
    #f5d1ff 55%,
    var(--accent) 65%,
    var(--accent) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: shimmer 3.2s linear infinite;
  filter: drop-shadow(0 0 6px rgba(99,102,241,.45));
}
.dev-credit .dev-name::after {
  content: "";
  position: absolute;
  inset: -6px -10px;
  background: radial-gradient(circle, rgba(99,102,241,.35), transparent 70%);
  z-index: -1;
  filter: blur(8px);
  animation: glowPulse 3.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shimmer {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}
@keyframes glowPulse {
  0%, 100% { opacity: .35; }
  50%      { opacity: .75; }
}

/* Respect users who hate motion */
@media (prefers-reduced-motion: reduce) {
  .dev-credit .dev-name { animation: none; }
  .dev-credit .dev-name::after { animation: none; }
}
/* ---- Logo ---- */
.logo {
  display: inline-block;
  flex-shrink: 0;
  border-radius: 8px;
  filter: drop-shadow(0 4px 14px rgba(99,102,241,.35));
}
.logo-sm { width: 26px; height: 26px; border-radius: 8px; }
.logo-lg { width: 64px; height: 64px; border-radius: 16px; margin-bottom: 24px; }

/* Sidebar brand tweak — logo now provides the color, so remove the old square */
.sidebar-brand .brand-mark { display: none; }

/* Login split — refined */
.auth-art {
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.10), transparent 45%),
    radial-gradient(circle at 80% 90%, rgba(255,255,255,.08), transparent 45%),
    linear-gradient(160deg, #1e1b4b 0%, #312e81 45%, #4338ca 100%);
}
.auth-art-inner {
  position: relative; max-width: 340px;
  text-align: left;
  display: flex; flex-direction: column; align-items: flex-start;
}
.auth-art h1 {
  font-size: 34px; font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 8px 0;
  color: #fff;
}
.auth-art .tagline {
  font-size: 15px;
  color: rgba(255,255,255,.72);
  font-weight: 400;
  letter-spacing: -0.005em;
  margin: 0;
}
/* Hide the old list / paragraph if any older template still uses them */
.auth-art .art-list,
.auth-art p { display: none; }
/* ---------- Claim mode: cost rows, file list, total ---------- */
.cost-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.cost-row input { flex: 1; }
.claim-total {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px; padding-top: 12px;
  border-top: 2px solid var(--accent);
  font-weight: 600; font-size: 15px;
}
.claim-total .mono { font-size: 18px; color: var(--accent); }
.file-list { margin-top: 8px; }
.file-ul { list-style: none; padding: 0; margin: 0; }
.file-ul li { font-size: 12px; color: var(--text-muted); padding: 2px 0; }
.file-ul li::before { content: "📎 "; }
/* ============================================================
   MOBILE NAV • AVATAR MENU • FAB SHEET
   (append block — desktop unaffected)
   ============================================================ */

.mobile-nav { display: none; }
.mn-sheet, .mn-sheet-backdrop { display: none; }

/* --- Avatar button (the chip is now clickable) --- */
.avatar-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.avatar-btn:hover { border-color: var(--border-strong); }
.avatar-btn[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* --- Liquid glass dropdown --- */
.avatar-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 230px;
  padding: 8px;
  border-radius: 16px;
  z-index: 300;
  background:
    linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.02)),
    color-mix(in oklab, var(--surface) 88%, transparent);
  border: 1px solid color-mix(in oklab, var(--border-strong) 70%, transparent);
  box-shadow:
    0 20px 50px rgba(0,0,0,.35),
    0 4px 14px rgba(0,0,0,.25),
    inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: saturate(160%) blur(24px);
  -webkit-backdrop-filter: saturate(160%) blur(24px);
  animation: amPop .16s cubic-bezier(.2,.7,.2,1);
}
@keyframes amPop {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.am-head { padding: 10px 12px 8px; }
.am-name { font-weight: 700; font-size: 13px; }
.am-email { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.am-divider { height: 1px; background: var(--border); margin: 6px 4px; }
.am-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background .12s, color .12s;
}
.am-item:hover { background: var(--surface-2); color: var(--text); }
.am-item.am-danger { color: var(--err); }
.am-item.am-danger:hover { background: var(--err-soft); }
.am-ic { width: 16px; text-align: center; opacity: .9; }

/* Topbar-right needs relative positioning for the menu */
.topbar-right { position: relative; display: flex; align-items: center; }

/* ============================================================
   MOBILE (≤ 900px)
   ============================================================ */
@media (max-width: 900px) {
  .desktop-only { display: none !important; }

  html, body { overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
  .app { display: block; min-height: 100dvh; }
  .main {
    display: block;
    min-height: 100dvh;
    padding-bottom: calc(130px + env(safe-area-inset-bottom, 0px));
  }

  .topbar {
    position: sticky; top: 0; z-index: 40;
    padding: max(14px, env(safe-area-inset-top)) 16px 12px;
    background: color-mix(in oklab, var(--bg) 82%, transparent);
    backdrop-filter: saturate(140%) blur(18px);
    -webkit-backdrop-filter: saturate(140%) blur(18px);
    border-bottom: 1px solid rgba(127,127,127,.12);
  }
  .topbar-right { position: relative; }
  .user-name { display: none; }         /* chip = avatar only on mobile */
  .user-chip { padding: 4px; border-radius: 999px; }
  .avatar-btn { box-shadow: 0 4px 12px rgba(0,0,0,.18); }

  .content { padding: 14px 14px 0; }
  .panel, .stat-card, .live-card, .hero { border-radius: 18px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)) !important; gap: 10px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ---------- Floating glass nav ---------- */
  .mobile-nav {
    display: block;
    position: fixed;
    left: 50%;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 100;
    width: min(420px, calc(100vw - 24px));
    transition: transform .28s cubic-bezier(.2,.7,.2,1), opacity .2s ease;
  }
  .mobile-nav.nav-hidden {
    transform: translateX(-50%) translateY(140%);
    opacity: 0;
    pointer-events: none;
  }

  .mobile-nav-pill {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 items, FAB floats separately */
    align-items: center;
    height: 62px;
    padding: 6px 10px;
    border-radius: 999px;
    background:
      linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.03)),
      color-mix(in oklab, var(--surface) 78%, transparent);
    border: 1px solid color-mix(in oklab, var(--border-strong) 60%, transparent);
    box-shadow:
      0 10px 30px rgba(0,0,0,.35),
      0 2px 8px rgba(0,0,0,.25),
      inset 0 1px 0 rgba(255,255,255,.08);
    backdrop-filter: saturate(160%) blur(22px);
    -webkit-backdrop-filter: saturate(160%) blur(22px);
  }
  /* admin variant: 3 items, wider */
  .mobile-nav-pill.no-fab { grid-template-columns: repeat(3, 1fr); }

  .mobile-nav-pill a {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10px; font-weight: 600; letter-spacing: .02em;
    padding: 6px 0; border-radius: 14px;
    transition: color .15s, transform .12s;
  }
  .mobile-nav-pill a:active { transform: scale(.94); }
  .mobile-nav-pill a .mn-icon { font-size: 18px; line-height: 1; }
  .mobile-nav-pill a .mn-label { opacity: .85; }
  .mobile-nav-pill a.is-active { color: var(--accent); }
  .mobile-nav-pill a.is-active .mn-icon {
    filter: drop-shadow(0 0 10px color-mix(in oklab, var(--accent) 60%, transparent));
  }

  /* Floating center FAB — sits ABOVE the pill, independent */
  .mn-fab {
    position: absolute;
    left: 50%;
    top: -26px;
    transform: translateX(-50%);
    width: 58px; height: 58px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.25);
    background: linear-gradient(180deg, #a5b4fc 0%, #6366f1 45%, #4338ca 100%);
    color: #fff;
    font-size: 26px; font-weight: 300; line-height: 1;
    display: grid; place-items: center;
    cursor: pointer;
    box-shadow:
      0 12px 28px rgba(99,102,241,.55),
      0 4px 10px rgba(0,0,0,.45),
      inset 0 1px 0 rgba(255,255,255,.35);
    transition: transform .15s ease;
  }
  .mn-fab:active { transform: translateX(-50%) scale(.93); }

  /* ---------- FAB Bottom Sheet ---------- */
  .mn-sheet-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.42);
    z-index: 200;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: fadeIn .18s ease;
  }
  .mn-sheet-backdrop[hidden] { display: none; }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

  .mn-sheet {
    display: block;
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%) translateY(0);
    z-index: 210;
    width: min(460px, 100vw);
    padding: 8px 14px calc(20px + env(safe-area-inset-bottom, 0px));
    background:
      linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.02)),
      color-mix(in oklab, var(--surface) 96%, transparent);
    border-top-left-radius: 22px;
    border-top-right-radius: 22px;
    border: 1px solid color-mix(in oklab, var(--border-strong) 55%, transparent);
    border-bottom: none;
    box-shadow: 0 -18px 40px rgba(0,0,0,.45);
    backdrop-filter: saturate(160%) blur(26px);
    -webkit-backdrop-filter: saturate(160%) blur(26px);
    animation: sheetUp .22s cubic-bezier(.2,.7,.2,1);
  }
  .mn-sheet[hidden] { display: none; }
  @keyframes sheetUp {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
  }

  .mn-sheet-grabber {
    width: 40px; height: 4px; border-radius: 4px;
    background: var(--border-strong);
    margin: 6px auto 12px;
    opacity: .7;
  }
  .mn-sheet-title {
    font-size: 13px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-muted);
    padding: 0 6px 10px;
  }
  .mn-sheet-opt {
    display: grid;
    grid-template-columns: 44px 1fr 16px;
    gap: 12px;
    align-items: center;
    padding: 14px 12px;
    border-radius: 14px;
    text-decoration: none;
    color: var(--text);
    transition: background .12s;
    margin-bottom: 4px;
  }
  .mn-sheet-opt:hover, .mn-sheet-opt:active { background: var(--surface-2); }
  .mso-ic {
    width: 44px; height: 44px; border-radius: 12px;
    background: var(--accent-soft);
    display: grid; place-items: center;
    font-size: 22px;
  }
  .mso-main { display: flex; flex-direction: column; gap: 2px; }
  .mso-main b { font-size: 15px; font-weight: 600; }
  .mso-main small { font-size: 12px; color: var(--text-muted); }
  .mso-arrow { color: var(--text-muted); font-size: 20px; text-align: right; }

  /* Toasts sit above the nav */
  .toasts { bottom: calc(130px + env(safe-area-inset-bottom, 0px)) !important; }
}

@media (max-width: 380px) {
  .mobile-nav { width: calc(100vw - 16px); }
  .mobile-nav-pill { height: 58px; }
  .mn-fab { width: 54px; height: 54px; font-size: 24px; top: -22px; }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-nav, .mn-fab, .mn-sheet, .mn-sheet-backdrop, .avatar-menu, .mobile-nav-pill a { animation: none; transition: none; }
}
.mobile-credit { display: none; }

@media (max-width: 900px) {
  .mobile-credit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 28px 0 14px;
    margin-top: 12px;
    opacity: .75;
  }
  .mobile-credit .dev-label {
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-faint);
  }
  .mobile-credit .dev-name {
    font-weight: 700;
    font-size: 13px;
    background: linear-gradient(100deg,
      var(--accent) 0%, var(--accent) 35%,
      #f5d1ff 45%, #ffffff 50%, #f5d1ff 55%,
      var(--accent) 65%, var(--accent) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3.2s linear infinite;
  }
}
.dev-credit .dev-name { display: block; margin: 2px 0; line-height: 1.3; }
.mobile-credit .dev-name { display: block; margin: 2px 0; line-height: 1.3; }