/* =============================================================
   RoadBR — Design System mobile-first (espelha roadbr-android)
   ============================================================= */

:root {
  /* Brand */
  --brand-50:  #f0f9ff;
  --brand-100: #e0f2fe;
  --brand-200: #bae6fd;
  --brand-300: #7dd3fc;
  --brand-400: #38bdf8;
  --brand:     #0ea5e9;
  --brand-500: #0ea5e9;
  --brand-600: #0284c7;
  --brand-700: #0369a1;
  --brand-800: #075985;
  --brand-900: #0c4a6e;

  /* Surface (dark) */
  --surface:         #161b22;
  --surface-overlay: #21262d;
  --surface-card:    #2d333b;
  --surface-border:  #444c56;
  --border:          #444c56;

  /* Text */
  --text-primary:   #e6edf3;
  --text-secondary: #8b949e;
  --text-muted:     #6e7681;

  /* Semantic */
  --success: #3fb950;
  --warning: #d29922;
  --danger:  #f85149;
  --info:    #58a6ff;

  /* Layout */
  --radius:     0.75rem;
  --radius-2xl: 1rem;
  --radius-3xl: 1.5rem;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.35);

  /* Safe area */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Light mode (caso usuário tenha modo_escuro=False) */
html[data-theme="light"] {
  --surface:         #ffffff;
  --surface-overlay: #f3f4f6;
  --surface-card:    #ffffff;
  --surface-border:  #e5e7eb;
  --border:          #e5e7eb;
  --text-primary:    #11181c;
  --text-secondary:  #4b5563;
  --text-muted:      #6b7280;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.05);
}

/* =============================================================
   Reset / base
   ============================================================= */
html, body {
  margin: 0;
  padding: 0;
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
html { height: 100%; }
body { min-height: 100%; }

* { box-sizing: border-box; }

a { color: var(--brand-400); text-decoration: none; }
a:hover { color: var(--brand-300); }

h1,h2,h3,h4,h5,h6 { color: var(--text-primary); margin: 0; font-weight: 600; }

p { margin: 0; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-border); border-radius: 2px; }

/* =============================================================
   Utilities
   ============================================================= */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; } .gap-4 { gap: 1rem; }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.truncate { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.text-xs { font-size: .75rem; }
.text-sm { font-size: .875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: .05em; }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-brand { color: var(--brand-400); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-info    { color: var(--info); }
.bg-surface { background: var(--surface); }
.bg-overlay { background: var(--surface-overlay); }
.bg-card { background: var(--surface-card); }
.mb-1 { margin-bottom: .25rem; } .mb-2 { margin-bottom: .5rem; } .mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; } .mb-5 { margin-bottom: 1.25rem; } .mb-6 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; } .mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; } .mt-8 { margin-top: 2rem; }
.p-2 { padding: .5rem; } .p-3 { padding: .75rem; } .p-4 { padding: 1rem; } .p-6 { padding: 1.5rem; }
.px-2 { padding-left:.5rem; padding-right:.5rem; }
.px-3 { padding-left:.75rem; padding-right:.75rem; }
.px-4 { padding-left:1rem; padding-right:1rem; }
.py-2 { padding-top:.5rem; padding-bottom:.5rem; }
.py-3 { padding-top:.75rem; padding-bottom:.75rem; }
.py-4 { padding-top:1rem; padding-bottom:1rem; }
.rounded { border-radius: .5rem; }
.rounded-xl  { border-radius: var(--radius); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-3xl { border-radius: var(--radius-3xl); }
.rounded-full { border-radius: 9999px; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.hidden { display: none !important; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.inset-0 { top:0; right:0; bottom:0; left:0; }
.z-10 { z-index: 10; }
.z-30 { z-index: 30; }
.z-50 { z-index: 50; }
.z-100 { z-index: 100; }
.block { display: block; }
.inline-block { display: inline-block; }
.inline-flex { display: inline-flex; }
.cursor-pointer { cursor: pointer; }
.opacity-60 { opacity: .6; }
.opacity-80 { opacity: .8; }
.divide-y > * + * { border-top: 1px solid var(--border); }
.no-print { }
@media print { .no-print { display: none !important; } }

/* =============================================================
   App layout (mobile-first)
   ============================================================= */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--surface);
}
/* Body é o scroll container — não criamos um container interno (evita conteúdo
   escondido quando o conteúdo é maior que a viewport). */
.app-main {
  flex: 1;
  width: 100%;
}
.app-container {
  /* max-width: 720px; */
  margin: 0 auto;
  width: 100%;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.safe-top    { height: var(--sat); }
.safe-bottom { height: var(--sab); }
.nav-spacer  { height: calc(var(--sab) + 5rem); }
.pb-safe     { padding-bottom: max(1rem, var(--sab)); }
.pt-safe     { padding-top: max(0.5rem, var(--sat)); }

/* =============================================================
   Header
   ============================================================= */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(22, 27, 34, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--surface-border);
  padding-top: var(--sat);
}
html[data-theme="light"] .app-header {
  background: rgba(255, 255, 255, 0.92);
}
.app-header__inner {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  min-height: 56px;
  max-width: 720px;
  margin: 0 auto;
}
.app-header__title {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-header__subtitle {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.app-header__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-2xl);
  background: transparent;
  color: var(--text-primary);
  border: none;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.app-header__back:hover { background: var(--surface-overlay); }
.app-header__back:active { transform: scale(0.94); }

/* =============================================================
   Bottom nav + FAB
   ============================================================= */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  background: rgba(22, 27, 34, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-bottom: var(--sab);
  /* FAB é absoluto relativo a esta nav, não ao .bottom-nav__row */
  /* (assim não interfere com grid auto-placement). */
}
html[data-theme="light"] .bottom-nav {
  background: rgba(255, 255, 255, 0.95);
  border-top-color: rgba(0,0,0,.05);
}
/* 5 colunas: 1 item | gap | 1 item. FAB flutua absolutamente no centro. */
.bottom-nav__row {
  display: grid;
  grid-template-columns: 1fr 2fr 2fr 2fr 1fr;
  grid-template-areas: "a . . . d";
  align-items: stretch;
  height: 4.25rem;
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 max(env(safe-area-inset-left, 0px), .25rem) 0 max(env(safe-area-inset-right, 0px), .25rem);
}
.bottom-nav__row > .bottom-nav__item:nth-child(1) { grid-area: a; }
.bottom-nav__row > .bottom-nav__item:nth-child(2) { grid-area: d; }
.bottom-nav__item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 100%;
  color: var(--text-muted);
  font-size: 11px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: color .15s;
  padding: .25rem 0;
  min-width: 0;
}
.bottom-nav__item i { font-size: 18px; line-height: 1; }
.bottom-nav__item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bottom-nav__item.is-active { color: var(--brand-500); }
.bottom-nav__item:hover { color: var(--brand-500); }

/* FAB: filho direto de .bottom-nav, absoluto relativo a ela */
.bottom-nav .fab {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -45%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  border: 4px solid var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(2,132,199,.45);
  transition: transform .25s cubic-bezier(.22,1.4,.4,1), box-shadow .2s;
  z-index: 5;
  padding: 0;
}
html[data-theme="light"] .bottom-nav .fab { border-color: #ffffff; }
.bottom-nav .fab:hover { transform: translate(-50%, -45%) scale(1.05); }
.bottom-nav .fab.is-open { transform: translate(-50%, -45%) rotate(45deg); }

.fab-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.fab-overlay.is-open { opacity: 1; pointer-events: auto; }

.fab-menu {
  position: fixed;
  left: 1rem; right: 1rem;
  bottom: calc(5.5rem + var(--sab));
  z-index: 70;
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-3xl);
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform .22s cubic-bezier(.22,1.4,.4,1), opacity .2s ease;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.fab-menu.is-open { transform: translateY(0); opacity: 1; pointer-events: auto; }
.fab-menu__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  padding: .75rem .25rem;
  border-radius: var(--radius-2xl);
  color: var(--text-primary);
  text-decoration: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 11px;
  text-align: center;
  transition: background .15s, transform .1s;
}
.fab-menu__item:hover { background: var(--surface-overlay); }
.fab-menu__item:active { transform: scale(.96); }
.fab-menu__item i {
  font-size: 18px;
  color: var(--brand-400);
  width: 44px; height: 44px;
  border-radius: var(--radius-2xl);
  background: var(--surface-overlay);
  border: 1px solid rgba(255,255,255,.05);
  display: inline-flex; align-items: center; justify-content: center;
}

/* =============================================================
   Cards
   ============================================================= */
.card {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-2xl);
  padding: 1rem;
  box-shadow: var(--shadow-card);
}
.card + .card { margin-top: .75rem; }
.card-clickable { cursor: pointer; transition: transform .1s, border-color .15s; }
.card-clickable:hover { border-color: rgba(14,165,233,.4); }
.card-clickable:active { transform: scale(.99); }

.list-item {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-2xl);
  padding: 1rem;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
  display: flex;
  align-items: center;
  gap: .75rem;
}
.list-item:hover { border-color: rgba(14,165,233,.4); }
.list-item:active { transform: scale(.99); }
.list-item + .list-item { margin-top: .5rem; }

/* Stats */
.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-2xl);
  padding: .85rem 1rem;
  display: flex; flex-direction: column; gap: .15rem;
  min-width: 0; /* permite truncar números longos */
}
.stat-label {
  font-size: .68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Section header */
.section-label {
  font-size: .68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .75rem;
  font-weight: 500;
}

/* =============================================================
   Buttons
   ============================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .75rem 1rem;
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 500;
  font-family: inherit;
  font-size: .95rem;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s, color .15s;
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  background: var(--brand-600);
  color: #fff;
  border-color: var(--brand-600);
}
.btn-primary:hover { background: var(--brand-500); border-color: var(--brand-500); }
.btn-primary:active { background: var(--brand-700); }
.btn-secondary {
  background: var(--surface-card);
  color: var(--text-primary);
  border-color: var(--surface-border);
}
.btn-secondary:hover { background: var(--surface-overlay); border-color: var(--brand-600); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--surface-overlay); }
.btn-danger {
  background: rgba(248,81,73,.12);
  color: var(--danger);
  border-color: rgba(248,81,73,.30);
}
.btn-danger:hover { background: rgba(248,81,73,.20); }
.btn-success {
  background: rgba(63,185,80,.12);
  color: var(--success);
  border-color: rgba(63,185,80,.30);
}
.btn-success:hover { background: rgba(63,185,80,.20); }
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--surface-overlay);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, transform .08s, border-color .15s;
  font-size: 1rem;
  line-height: 1;
}
.btn-icon:hover { background: var(--surface-card); border-color: var(--brand-600); }
.btn-icon:active { transform: scale(.94); }
.btn-icon i { color: inherit; }
.btn-block { width: 100%; }
.btn-sm { padding: .45rem .75rem; min-height: 36px; font-size: .85rem; }

/* =============================================================
   Forms
   ============================================================= */
.input-group { margin-bottom: 1rem; }
.input-label {
  display: block;
  font-size: .8rem;
  color: var(--text-secondary);
  margin-bottom: .35rem;
}
.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="tel"],
input[type="search"],
input[type="url"],
select,
textarea {
  width: 100%;
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: .75rem 1rem;
  font-size: .95rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder, input::placeholder, textarea::placeholder { color: var(--text-muted); }
.input:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 1px var(--brand-500);
}
.input.has-error { border-color: var(--danger); }
select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 2.5rem;
}
.input-error {
  display: block;
  color: var(--danger);
  font-size: .78rem;
  margin-top: .25rem;
}

/* Checkbox / switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle__slider {
  position: absolute; inset: 0;
  background: var(--surface-overlay);
  border: 1px solid var(--surface-border);
  border-radius: 9999px;
  transition: background .15s;
}
.toggle__slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 2px; top: 2px;
  background: var(--text-primary);
  border-radius: 50%;
  transition: transform .15s;
}
.toggle input:checked + .toggle__slider {
  background: var(--brand-600);
  border-color: var(--brand-600);
}
.toggle input:checked + .toggle__slider::before {
  transform: translateX(18px);
  background: #fff;
}

/* =============================================================
   Badges
   ============================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: .7rem;
  font-weight: 500;
  background: var(--surface-overlay);
  color: var(--text-secondary);
  border: 1px solid var(--surface-border);
}
.badge-success { background: rgba(63,185,80,.10); color: var(--success); border-color: rgba(63,185,80,.30); }
.badge-warning { background: rgba(210,153,34,.10); color: var(--warning); border-color: rgba(210,153,34,.30); }
.badge-danger  { background: rgba(248,81,73,.10); color: var(--danger);  border-color: rgba(248,81,73,.30); }
.badge-info    { background: rgba(88,166,255,.10); color: var(--info);   border-color: rgba(88,166,255,.30); }

/* =============================================================
   Avatar
   ============================================================= */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--brand-600);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: .9rem;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.25rem; }
.avatar-sm { width: 32px; height: 32px; font-size: .75rem; }

/* =============================================================
   Empty state
   ============================================================= */
.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}
.empty-state__icon {
  width: 64px; height: 64px;
  border-radius: var(--radius-3xl);
  background: var(--surface-overlay);
  border: 1px solid var(--surface-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-muted);
  margin-bottom: .5rem;
}
.empty-state__title { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.empty-state__subtitle { color: var(--text-muted); font-size: .85rem; max-width: 28ch; }

/* =============================================================
   Toasts
   ============================================================= */
.toast-container {
  position: fixed;
  top: calc(var(--sat) + .5rem);
  left: .75rem; right: .75rem;
  z-index: 100;
  display: flex; flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.toast {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  color: var(--text-primary);
  padding: .75rem 1rem;
  border-radius: var(--radius);
  display: flex; align-items: center; gap: .65rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  pointer-events: auto;
  font-size: .9rem;
  animation: toast-in .25s ease;
}
.toast.is-success { border-color: rgba(63,185,80,.40); }
.toast.is-success i { color: var(--success); }
.toast.is-error,
.toast.is-danger { border-color: rgba(248,81,73,.40); }
.toast.is-error i,
.toast.is-danger i { color: var(--danger); }
.toast.is-warning { border-color: rgba(210,153,34,.40); }
.toast.is-warning i { color: var(--warning); }
.toast.is-info { border-color: rgba(88,166,255,.40); }
.toast.is-info i { color: var(--info); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =============================================================
   Modal sheet (bottom-sheet)
   ============================================================= */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 80;
  display: none;
}
.modal-backdrop.is-open { display: block; }

.modal-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 90;
  background: var(--surface-card);
  border-top-left-radius: var(--radius-3xl);
  border-top-right-radius: var(--radius-3xl);
  border-top: 1px solid var(--surface-border);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .25s cubic-bezier(.22,1.4,.4,1);
  padding-bottom: var(--sab);
}
.modal-sheet.is-open { transform: translateY(0); }
.modal-sheet__handle {
  width: 36px; height: 4px;
  background: var(--surface-border);
  border-radius: 9999px;
  margin: .75rem auto;
  flex-shrink: 0;
}
.modal-sheet__header {
  padding: .25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--surface-border);
}
.modal-sheet__body {
  overflow-y: auto;
  padding: 1rem 1.25rem;
}
.modal-sheet__footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--surface-border);
  display: flex;
  gap: .5rem;
}

/* =============================================================
   Page transitions
   ============================================================= */
.page-enter { animation: pageIn .15s ease both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* =============================================================
   Loading spinner
   ============================================================= */
.spinner {
  display: inline-block;
  width: 1.5rem; height: 1.5rem;
  border: 2px solid var(--surface-border);
  border-top-color: var(--brand-400);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.spinner-sm { width: 1rem; height: 1rem; border-width: 2px; }
.spinner-lg { width: 3rem; height: 3rem; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================================
   Offline indicator
   ============================================================= */
.offline-banner {
  position: fixed;
  top: var(--sat);
  left: 0; right: 0;
  z-index: 110;
  background: var(--warning);
  color: #fff;
  padding: .35rem .75rem;
  font-size: .78rem;
  text-align: center;
  display: none;
  font-weight: 500;
}
body.is-offline .offline-banner { display: block; }
body.is-offline .app-header { top: 1.65rem; }

/* =============================================================
   Login (LoginView.vue equivalent)
   ============================================================= */
.login-shell {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--surface);
  padding-top: var(--sat);
  padding-bottom: max(1rem, var(--sab));
}
.login-shell__content {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}
.login-logo {
  width: 80px; height: 80px;
  border-radius: var(--radius-2xl);
  background: radial-gradient(135deg, #1c2430 0%, #0d1117 100%);
  border: 1px solid rgba(255,255,255,.05);
  box-shadow: 0 10px 40px rgba(0,0,0,.4);
  display: inline-flex;
  align-items: center; justify-content: center;
  margin-bottom: 1rem;
}
.login-logo img { width: 56px; height: 56px; }
.login-form { width: 100%; max-width: 360px; }

/* =============================================================
   Misc helpers used across pages
   ============================================================= */
.divider {
  display: flex; align-items: center; gap: .75rem;
  margin: 1.25rem 0;
  color: var(--text-muted);
  font-size: .75rem;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--surface-border);
}

.kv-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .65rem 0;
  gap: .75rem;
  min-width: 0;
}
.kv-row .kv-key {
  color: var(--text-muted);
  font-size: .85rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  flex: 0 1 auto;
  min-width: 0;
}
.kv-row .kv-key i { font-size: .75rem; opacity: .8; }
.kv-row .kv-val {
  color: var(--text-primary);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* Small icon button overlap fix */
.icon-tile {
  width: 40px; height: 40px;
  border-radius: var(--radius-2xl);
  background: rgba(14, 165, 233, 0.10);
  border: 1px solid rgba(14, 165, 233, 0.20);
  color: var(--brand-400);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.icon-tile-lg { width: 48px; height: 48px; font-size: 22px; }
.icon-tile-muted {
  background: var(--surface-overlay);
  border-color: var(--surface-border);
  color: var(--text-muted);
}

/* =============================================================
   Reset existing pico/bundler gotchas (so pages still work)
   ============================================================= */
.app-shell main.container { max-width: none; padding: 0; }
.app-shell article { padding: 5px; background: transparent; border: 0; }
