/* ============================================================
   Short Links — unified stylesheet
   Shared tokens + auth page + dashboard
   ============================================================ */

:root {
  --bg: #f7f7f9;
  --bg-soft: #ffffff;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --surface-3: #f4f4f5;
  --surface-elev: rgba(255, 255, 255, 0.8);
  --border: #e7e7ea;
  --border-strong: #d4d4d8;
  --text: #09090b;
  --text-2: #3f3f46;
  --muted: #71717a;
  --muted-2: #a1a1aa;

  --brand: #ea580c;
  --brand-strong: #c2410c;
  --brand-soft: rgba(234, 88, 12, 0.1);
  --brand-ink: #7c2d12;

  --teal: #0d9488;
  --teal-soft: rgba(13, 148, 136, 0.1);
  --violet: #6d28d9;
  --violet-soft: rgba(109, 40, 217, 0.1);
  --indigo: #4f46e5;
  --indigo-soft: rgba(79, 70, 229, 0.1);
  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, 0.1);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);

  --ring: 0 0 0 3px rgba(234, 88, 12, 0.2);
  --shadow-sm: 0 1px 2px rgba(9, 9, 11, 0.05);
  --shadow-md: 0 4px 16px rgba(9, 9, 11, 0.06), 0 2px 4px rgba(9, 9, 11, 0.04);
  --shadow-lg: 0 24px 48px -12px rgba(9, 9, 11, 0.18);
  --shadow-xl: 0 40px 80px -20px rgba(9, 9, 11, 0.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 28px;

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

html[data-theme='dark'] {
  --bg: #0a0a0b;
  --bg-soft: #111113;
  --surface: #111113;
  --surface-2: #18181b;
  --surface-3: #27272a;
  --surface-elev: rgba(24, 24, 27, 0.8);
  --border: #27272a;
  --border-strong: #3f3f46;
  --text: #fafafa;
  --text-2: #d4d4d8;
  --muted: #a1a1aa;
  --muted-2: #71717a;

  --brand-soft: rgba(234, 88, 12, 0.18);
  --teal-soft: rgba(45, 212, 191, 0.16);
  --violet-soft: rgba(167, 139, 250, 0.16);
  --indigo-soft: rgba(129, 140, 248, 0.16);
  --success-soft: rgba(34, 197, 94, 0.18);
  --danger-soft: rgba(248, 113, 113, 0.18);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 40px 80px -20px rgba(0, 0, 0, 0.75);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.dash-body {
  background:
    radial-gradient(circle at top left, rgba(234, 88, 12, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(79, 70, 229, 0.07), transparent 24%),
    var(--bg);
}

html[data-theme='dark'] .dash-body {
  background:
    radial-gradient(circle at top left, rgba(249, 115, 22, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(129, 140, 248, 0.14), transparent 24%),
    var(--bg);
}

a { color: inherit; }

code, .mono { font-family: var(--mono); }
.inline-code {
  font-family: var(--mono);
  font-size: 0.85em;
  padding: 2px 6px;
  background: var(--surface-3);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.hidden { display: none !important; }

button { font: inherit; color: inherit; }
input, textarea { font: inherit; color: inherit; }

/* ========================
   Shared: branding
   ======================== */
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 1.05rem;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand) 0%, #f97316 100%);
  color: white;
  box-shadow: 0 6px 16px -4px rgba(234, 88, 12, 0.5);
}
.brand-logo-sm { font-size: 0.98rem; }
.brand-logo-sm .brand-mark { width: 30px; height: 30px; border-radius: 9px; }

/* ========================
   Shared: buttons
   ======================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-sm { padding: 7px 12px; font-size: 0.85rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 13px 20px; font-size: 0.98rem; }
.btn-block { width: 100%; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: white;
  box-shadow: 0 8px 20px -6px rgba(234, 88, 12, 0.5);
}
.btn-primary:hover {
  box-shadow: 0 12px 24px -8px rgba(234, 88, 12, 0.6);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }

.btn-subtle {
  background: var(--surface-3);
  color: var(--text-2);
}
.btn-subtle:hover { background: var(--border); }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #b91c1c; }

.btn-wa {
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: white;
  box-shadow: 0 8px 20px -6px rgba(18, 140, 126, 0.5);
}
.btn-wa:hover {
  box-shadow: 0 12px 24px -8px rgba(18, 140, 126, 0.6);
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========================
   Shared: segmented control
   ======================== */
.segmented {
  position: relative;
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin: 18px 0 20px;
}
.segmented-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: calc(var(--radius-md) - 4px);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.18s ease;
  z-index: 1;
}
.segmented-btn svg { width: 15px; height: 15px; }
.segmented-btn.is-active { color: var(--text); }
.segmented-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / 2);
  background: var(--surface);
  border-radius: calc(var(--radius-md) - 4px);
  box-shadow: var(--shadow-sm);
  transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}
.segmented[data-active='whatsapp'] .segmented-indicator,
.segmented[data-active='register'] .segmented-indicator {
  transform: translateX(calc(100% + 4px));
}

/* ========================
   Shared: form fields
   ======================== */
.field { display: grid; gap: 6px; }
.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
}
.field-hint { color: var(--muted); font-size: 0.82rem; }
.field-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.85rem;
}
.field-note svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; color: var(--brand); }

.field-group { display: grid; gap: 14px; }

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrap .input-icon {
  position: absolute;
  left: 14px;
  width: 16px;
  height: 16px;
  color: var(--muted-2);
  pointer-events: none;
}
.input-wrap .input-btn {
  position: absolute;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.input-wrap .input-btn:hover { color: var(--text); background: var(--surface-3); }
.input-wrap .input-btn svg { width: 16px; height: 16px; }
.input-wrap .input-btn.is-on { color: var(--brand); }

input[type='text'], input[type='password'], input[type='email'],
input[type='url'], input[type='search'], textarea {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
textarea {
  padding: 12px 14px;
  resize: vertical;
  min-height: 96px;
  font-family: var(--sans);
}
.input-wrap input[type='text'],
.input-wrap input[type='password'],
.input-wrap input[type='url'] {
  padding-left: 40px;
}
.input-wrap:has(.input-btn) input { padding-right: 44px; }

input:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
  background: var(--surface);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }

/* Password strength */
.strength-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 6px;
}
.strength-bar::before,
.strength-bar span,
.strength-bar::after {
  content: '';
  height: 4px;
  border-radius: 999px;
  background: var(--surface-3);
}
.strength-bar[data-score='1']::before { background: var(--danger); }
.strength-bar[data-score='2']::before,
.strength-bar[data-score='2'] span { background: #f59e0b; }
.strength-bar[data-score='3']::before,
.strength-bar[data-score='3'] span,
.strength-bar[data-score='3']::after { background: #eab308; }
.strength-bar[data-score='4']::before,
.strength-bar[data-score='4'] span,
.strength-bar[data-score='4']::after,
.strength-bar[data-score='4']::before { background: var(--success); }
.strength-bar[data-score='4'] { position: relative; }
.strength-bar[data-score='4']::before { grid-column: 1 / -1; }

/* Switch */
.switch-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  cursor: pointer;
}
.switch-row strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.switch-row em {
  display: block;
  font-style: normal;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
}
.switch-row code {
  font-size: 0.78em;
  padding: 1px 5px;
  background: var(--surface-3);
  border-radius: 4px;
  border: 1px solid var(--border);
}
.switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-track {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: 999px;
  transition: background 0.18s ease;
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 0.18s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:disabled + .switch-track { opacity: 0.5; }

/* ========================
   Toasts
   ======================== */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  z-index: 100;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  min-width: 220px;
  animation: toast-in 0.24s ease;
}
.toast.is-leaving { animation: toast-out 0.24s ease forwards; }
.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.toast-success .toast-dot { background: var(--success); }
.toast-error .toast-dot { background: var(--danger); }
.toast-info .toast-dot { background: var(--indigo); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px); }
}

/* ========================
   Auth page (minimalist)
   ======================== */
.auth-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 10%, rgba(234, 88, 12, 0.08), transparent 45%),
    radial-gradient(circle at 80% 90%, rgba(79, 70, 229, 0.07), transparent 45%),
    var(--bg);
  overflow-x: hidden;
}
html[data-theme='dark'] .auth-body {
  background:
    radial-gradient(circle at 20% 10%, rgba(234, 88, 12, 0.18), transparent 45%),
    radial-gradient(circle at 80% 90%, rgba(129, 140, 248, 0.15), transparent 45%),
    var(--bg);
}

.auth-shell-min {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 40px 20px;
}

.brand-logo-center {
  justify-content: center;
  margin: 0 auto 22px;
  font-size: 1.15rem;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.auth-brand {
  position: relative;
  overflow: hidden;
  padding: 48px 56px;
  background: radial-gradient(ellipse at top left, #1c1917 0%, #0a0a0b 60%);
  color: #fafafa;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.brand-bg { position: absolute; inset: 0; pointer-events: none; }
.brand-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.6;
}
.brand-orb-a {
  width: 420px;
  height: 420px;
  top: -120px;
  right: -120px;
  background: rgba(234, 88, 12, 0.5);
}
.brand-orb-b {
  width: 380px;
  height: 380px;
  bottom: -100px;
  left: -120px;
  background: rgba(79, 70, 229, 0.35);
}
.brand-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
}

.brand-content {
  position: relative;
  z-index: 1;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 36px;
  height: 100%;
}
.auth-brand .brand-logo { color: #fafafa; }
.auth-brand .brand-logo .brand-mark {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--brand-soft);
  color: var(--brand);
}
.pill-outline {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-copy h1 {
  margin: 14px 0 12px;
  font-size: clamp(2rem, 3.4vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 800;
}
.brand-copy p {
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.6;
  max-width: 40ch;
  margin: 0;
}

.brand-sample {
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
}
.sample-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}
.sample-tag {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  margin-right: auto;
}
.sample-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
}
.sample-dot:first-of-type { background: rgba(234, 88, 12, 0.6); }
.sample-url {
  font-family: var(--mono);
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  word-break: break-all;
}
.sample-scheme { color: rgba(255, 255, 255, 0.4); }
.sample-host { color: #fafafa; }
.sample-foot {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.78rem;
}

.brand-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.92rem;
}
.brand-features li {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-features svg {
  width: 16px;
  height: 16px;
  color: var(--brand);
  flex-shrink: 0;
  padding: 3px;
  background: var(--brand-soft);
  border-radius: 6px;
  box-sizing: content-box;
}

.auth-main {
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
}
.auth-card-head { margin-bottom: 20px; }
.auth-card-label {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 10px;
}
.auth-card-head h2 {
  margin: 0 0 8px;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.auth-card-head p { margin: 0; color: var(--muted); }

.auth-form { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.auth-form .btn { margin-top: 4px; }

.auth-alert {
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid var(--danger-soft);
  background: var(--danger-soft);
  color: var(--danger);
}
.auth-alert-success {
  border-color: var(--success-soft);
  background: var(--success-soft);
  color: var(--success);
}

.auth-card-foot {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--muted);
}
.link-btn {
  background: none;
  border: 0;
  color: var(--brand);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover { text-decoration: underline; }

.auth-legal {
  margin-top: 24px;
  font-size: 0.8rem;
  color: var(--muted);
}

.field-row { display: flex; justify-content: space-between; align-items: center; }

/* ========================
   Dashboard
   ======================== */
.dash-body { background: var(--bg); }
.app { position: relative; min-height: 100vh; }
.app[aria-busy='true'] .dash-main { opacity: 0; }
.app-loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: grid;
  place-items: center;
  z-index: 50;
}
.app-loader .spinner {
  width: 28px;
  height: 28px;
  border-width: 3px;
  border-color: var(--surface-3);
  border-top-color: var(--brand);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(247, 247, 249, 0.85);
  backdrop-filter: saturate(1.5) blur(12px);
  border-bottom: 1px solid var(--border);
}
html[data-theme='dark'] .topbar { background: rgba(10, 10, 11, 0.8); }
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 28px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
}
.topbar-nav { display: flex; gap: 4px; justify-content: center; }
.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: color 0.18s ease, background 0.18s ease;
}
.nav-link:hover { color: var(--text); background: var(--surface-3); }
.nav-link.is-active { color: var(--text); background: var(--surface-3); }

.topbar-actions { display: flex; gap: 8px; align-items: center; }

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn .icon-sun { display: none; }
html[data-theme='dark'] .icon-btn .icon-sun { display: block; }
html[data-theme='dark'] .icon-btn .icon-moon { display: none; }

.user-menu { position: relative; }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
  transition: border-color 0.18s ease, background 0.18s ease;
}
.user-chip:hover { border-color: var(--border-strong); }
.user-chip svg { width: 14px; height: 14px; color: var(--muted); }
.user-avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #f97316);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.user-avatar-lg { width: 42px; height: 42px; font-size: 0.95rem; }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 10;
}
.user-dropdown-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.user-dropdown-name { font-size: 0.92rem; font-weight: 700; color: var(--text); }
.user-dropdown-meta { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

.dropdown-item {
  width: 100%;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.dropdown-item:hover { background: var(--surface-3); color: var(--text); }
.dropdown-item svg { width: 15px; height: 15px; color: var(--muted); }
.dropdown-item-danger { color: var(--danger); }
.dropdown-item-danger:hover { background: var(--danger-soft); }
.dropdown-item-danger svg { color: var(--danger); }

.dash-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 28px 64px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  transition: opacity 0.3s ease;
}

.dash-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.dash-hero-text { flex: 1; min-width: 280px; }
.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
}
.dash-hero-text h1 {
  margin: 10px 0 6px;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}
.hero-accent {
  background: linear-gradient(135deg, var(--brand), #f97316);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.dash-hero-text p { margin: 0; color: var(--muted); max-width: 60ch; }
.dash-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.metric {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.metric:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.metric-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.metric-icon svg { width: 18px; height: 18px; }
.metric-orange .metric-icon { background: var(--brand-soft); color: var(--brand); }
.metric-teal .metric-icon { background: var(--teal-soft); color: var(--teal); }
.metric-indigo .metric-icon { background: var(--indigo-soft); color: var(--indigo); }
.metric-violet .metric-icon { background: var(--violet-soft); color: var(--violet); }
.metric-body { flex: 1; min-width: 0; }
.metric-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.metric-value {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.metric-delta {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--muted-2);
}

/* Workspace grid */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.card {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 4px;
}
.card-head h2 {
  margin: 6px 0 4px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.card-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.card-sub code {
  font-family: var(--mono);
  font-size: 0.82em;
  padding: 1px 5px;
  background: var(--surface-3);
  border-radius: 4px;
}

.count-badge {
  display: inline-grid;
  place-items: center;
  padding: 2px 10px;
  height: 24px;
  min-width: 36px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
}

/* Editor */
.card-editor { position: sticky; top: 90px; }
.editor-form { display: flex; flex-direction: column; gap: 14px; }
.editor-actions { display: flex; gap: 10px; margin-top: 6px; }
.editor-actions .btn { flex: 1; }

.form-alert {
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid transparent;
}
.form-alert-success { background: var(--success-soft); color: var(--success); }

/* Toolbar */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 18px 0 16px;
  flex-wrap: wrap;
}
.toolbar-search {
  position: relative;
  flex: 1;
  min-width: 220px;
}
.toolbar-search svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  color: var(--muted-2);
  pointer-events: none;
}
.toolbar-search input {
  padding-left: 36px;
  height: 38px;
}
.chip-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 7px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.18s ease;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* Routes list */
.links-list { display: flex; flex-direction: column; gap: 8px; }

.route {
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.route:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.route-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.route-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.route-avatar {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.route-avatar svg { width: 17px; height: 17px; }
.route-avatar.is-std { background: var(--brand-soft); color: var(--brand); }
.route-avatar.is-wa { background: var(--teal-soft); color: var(--teal); }
.route-title-block { min-width: 0; flex: 1; }
.route-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
}
.route-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.route-url {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.route-url:hover { color: var(--brand); }
.route-url svg { width: 12px; height: 12px; opacity: 0.7; }

.route-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-start;
  flex-shrink: 0;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.tag-std { background: var(--brand-soft); color: var(--brand); }
.tag-wa { background: var(--teal-soft); color: var(--teal); }
.tag-on { background: var(--success-soft); color: var(--success); }
.tag-off { background: var(--surface-3); color: var(--muted); }
.tag .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.route-detail-inline {
  min-width: 0;
  color: var(--muted);
  font-size: 0.85rem;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.35;
  max-height: calc(1.35em * 2);
}
.route-detail-inline .mono { color: var(--text-2); }

.route-summary {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  flex-wrap: wrap;
}
.route-summary-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.route-summary-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.route-summary-value {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.action svg { width: 14px; height: 14px; }
.action:hover { background: var(--surface-3); color: var(--text); }
.action-info { color: var(--brand); }
.action-info:hover { background: var(--brand-soft); color: var(--brand); }
.action-danger { color: var(--danger); margin-left: auto; }
.action-danger:hover { background: var(--danger-soft); color: var(--danger); }

.modal-card-details { max-width: 720px; }
.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.details-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  min-width: 0;
}
.details-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.details-value {
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.45;
  min-width: 0;
}
.details-link {
  color: var(--brand);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.details-break {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Empty state */
.empty {
  padding: 48px 24px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.empty-icon {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  margin-bottom: 14px;
  background: var(--surface-3);
  color: var(--muted);
}
.empty-icon svg { width: 22px; height: 22px; }
.empty h4 {
  margin: 0 0 6px;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
}
.empty p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.dash-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
}

/* Modal (generic) */
body.modal-open { overflow: hidden; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 9, 11, 0.55);
  backdrop-filter: blur(6px);
  animation: fade-in 0.2s ease;
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  animation: pop-in 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.modal-card-lg { max-width: 520px; padding: 28px; }

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 4px;
}
.modal-head h2 {
  margin: 4px 0 0;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.modal-head .icon-btn { border: 0; background: transparent; }
.modal-head .icon-btn:hover { background: var(--surface-3); }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  justify-content: flex-end;
}
.modal-actions .btn { min-width: 120px; }
.modal-actions-center { justify-content: center; }
.modal-actions-center .btn { flex: 1; }

.modal-card-confirm {
  max-width: 420px;
  text-align: center;
  padding: 28px;
}
.modal-card-confirm h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 700;
}
.modal-card-confirm p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.9rem;
}
.confirm-icon {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  margin: 0 auto 14px;
  background: var(--danger-soft);
  color: var(--danger);
}
.confirm-icon svg { width: 22px; height: 22px; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ========================
   FAB speed-dial (mobile)
   ======================== */
.icon-btn-mobile { display: none; }

.fab-dial {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(22px, calc(env(safe-area-inset-bottom) + 14px));
  z-index: 40;
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
}
.fab-dial > * { pointer-events: auto; }

.fab-main {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(135deg, var(--brand) 0%, #f97316 100%);
  color: white;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 18px 38px -10px rgba(234, 88, 12, 0.55), 0 4px 10px rgba(9, 9, 11, 0.2);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease;
}
.fab-main:active { transform: scale(0.94); }
.fab-main svg { width: 26px; height: 26px; transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1); }
.fab-dial[data-open='true'] .fab-main svg { transform: rotate(135deg); }
.fab-dial[data-open='true'] .fab-main {
  box-shadow: 0 22px 48px -10px rgba(234, 88, 12, 0.7), 0 6px 14px rgba(9, 9, 11, 0.28);
}

.fab-options {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  opacity: 0;
  transform: translateY(14px) scale(0.92);
  transform-origin: bottom right;
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}
.fab-dial[data-open='true'] .fab-options {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.fab-option {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: 0 16px 30px -14px rgba(9, 9, 11, 0.3);
  transition: transform 0.14s ease, background 0.18s ease;
}
.fab-option:active { transform: scale(0.96); }
.fab-option-label { white-space: nowrap; letter-spacing: -0.005em; }
.fab-option-icon {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}
.fab-option-icon svg { width: 17px; height: 17px; }
.fab-option-icon-std { background: linear-gradient(135deg, var(--brand), #f97316); color: white; }
.fab-option-icon-wa { background: linear-gradient(135deg, #25d366, #128c7e); color: white; }

.fab-scrim {
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(9, 9, 11, 0.32);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.fab-scrim:not([hidden]) { opacity: 1; }

/* Responsive */
@media (max-width: 1120px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { padding: 40px 32px; min-height: auto; }
  .brand-content { max-width: 640px; margin: 0 auto; }
  .auth-main { padding: 40px 24px; }

  .workspace { grid-template-columns: 1fr; }
  .card-editor { position: static; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .route {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .route-actions { justify-content: flex-start; }
}

@media (max-width: 820px) {
  .dash-body {
    background:
      radial-gradient(circle at top left, rgba(234, 88, 12, 0.14), transparent 40%),
      radial-gradient(circle at top right, rgba(79, 70, 229, 0.1), transparent 36%),
      var(--bg);
  }
  html[data-theme='dark'] .dash-body {
    background:
      radial-gradient(circle at top left, rgba(249, 115, 22, 0.22), transparent 40%),
      radial-gradient(circle at top right, rgba(129, 140, 248, 0.18), transparent 36%),
      var(--bg);
  }
  .topbar-nav { display: none; }
  .topbar {
    background: rgba(247, 247, 249, 0.82);
    backdrop-filter: blur(22px) saturate(1.6);
    -webkit-backdrop-filter: blur(22px) saturate(1.6);
    border-bottom: 1px solid rgba(9, 9, 11, 0.06);
    box-shadow: 0 10px 28px -24px rgba(9, 9, 11, 0.5);
  }
  html[data-theme='dark'] .topbar {
    background: rgba(10, 10, 11, 0.78);
    border-bottom-color: rgba(255, 255, 255, 0.06);
  }
  .topbar-inner {
    grid-template-columns: auto 1fr;
    padding: max(10px, env(safe-area-inset-top)) 14px 10px;
    gap: 8px;
    align-items: center;
  }

  /* Brand: tighter, crisper */
  .topbar .brand-logo-sm { gap: 8px; font-weight: 700; letter-spacing: -0.01em; }
  .topbar .brand-logo-sm span:last-child { font-size: 0.94rem; }
  .topbar .brand-logo-sm .brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    box-shadow: 0 6px 14px -4px rgba(234, 88, 12, 0.55);
  }

  /* Actions: right-aligned, tight */
  .topbar-actions {
    justify-self: end;
    gap: 2px;
    padding-left: 4px;
  }
  .icon-btn-mobile { display: inline-grid; }

  /* Utility icon buttons: borderless on mobile for a cleaner bar */
  .topbar .icon-btn {
    width: 40px;
    height: 40px;
    min-height: 40px;
    border-color: transparent;
    background: transparent;
    color: var(--muted);
    border-radius: 12px;
  }
  .topbar .icon-btn svg { width: 18px; height: 18px; }
  .topbar .icon-btn:hover,
  .topbar .icon-btn:active {
    background: var(--surface-3);
    color: var(--text);
    border-color: transparent;
  }

  /* Divider between utility icons and the user avatar */
  .topbar .user-menu {
    position: relative;
    margin-left: 6px;
    padding-left: 8px;
  }
  .topbar .user-menu::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 20px;
    background: var(--border);
  }

  /* User avatar: circular button with subtle ring */
  .topbar .user-chip {
    padding: 3px;
    border-radius: 999px;
    background: transparent;
    border-color: transparent;
    min-height: 40px;
    gap: 0;
    transition: background 0.18s ease;
  }
  .topbar .user-chip:hover,
  .topbar .user-chip[aria-expanded='true'] {
    background: var(--surface-3);
  }
  .topbar .user-chip > svg { display: none; }
  .topbar .user-chip .user-avatar {
    width: 34px;
    height: 34px;
    font-size: 0.82rem;
    box-shadow: 0 0 0 2px var(--surface), 0 2px 6px -1px rgba(234, 88, 12, 0.45);
  }
  html[data-theme='dark'] .topbar .user-chip .user-avatar {
    box-shadow: 0 0 0 2px var(--surface), 0 2px 8px -1px rgba(249, 115, 22, 0.5);
  }

  /* Dropdown: anchor right, fit viewport */
  .topbar .user-dropdown {
    right: 0;
    width: min(268px, calc(100vw - 28px));
  }

  .dash-main {
    padding: 16px 14px calc(108px + env(safe-area-inset-bottom));
    gap: 18px;
  }

  /* HERO: compact, no action buttons (FAB handles it) */
  .dash-hero {
    padding: 2px 2px 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }
  .dash-hero-text { min-width: 0; width: 100%; }
  .dash-hero-text h1 {
    font-size: 1.75rem;
    line-height: 1.15;
    margin: 6px 0 4px;
  }
  .dash-hero-text p { font-size: 0.9rem; max-width: none; color: var(--muted); }
  .dash-hero-actions { display: none; }

  /* METRICS: 2x2 grid, compact cards, always visible */
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .metric {
    padding: 14px;
    gap: 10px;
    min-height: 92px;
    border-radius: 18px;
    flex-direction: column;
    align-items: flex-start;
    background: var(--surface);
  }
  .metric-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }
  .metric-icon svg { width: 16px; height: 16px; }
  .metric-body { width: 100%; }
  .metric-label { font-size: 0.72rem; }
  .metric-value { font-size: 1.35rem; margin-top: 2px; }
  .metric-delta { font-size: 0.72rem; margin-top: 2px; }

  /* LINKS card */
  #links {
    padding: 16px 14px;
    border-radius: 22px;
  }
  .card-head { margin-bottom: 8px; }
  .card-head h2 { font-size: 1.1rem; }
  .card-head .eyebrow { font-size: 0.68rem; }
  .card-sub { font-size: 0.82rem; }

  /* TOOLBAR: tight sticky filter */
  .toolbar {
    position: sticky;
    top: calc(52px + env(safe-area-inset-top));
    z-index: 5;
    margin: 0 -14px 12px;
    padding: 10px 14px 8px;
    background: linear-gradient(180deg, var(--bg) 0%, rgba(247,247,249,0.7) 100%);
    backdrop-filter: blur(12px);
    gap: 10px;
    flex-direction: column;
    align-items: stretch;
  }
  html[data-theme='dark'] .toolbar {
    background: linear-gradient(180deg, var(--bg) 0%, rgba(10,10,11,0.7) 100%);
  }
  .toolbar-search { min-width: 100%; }
  .toolbar-search input {
    height: 42px;
    border-radius: 12px;
    background: var(--surface);
    font-size: 0.92rem;
  }
  .chip-filters {
    width: calc(100% + 14px);
    margin-right: -14px;
    padding-right: 14px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .chip-filters::-webkit-scrollbar { display: none; }
  .chip {
    flex: 0 0 auto;
    padding: 8px 14px;
    font-size: 0.82rem;
  }

  /* ROUTE CARDS: cleaner vertical layout */
  .links-list { gap: 10px; }
  .route-main { grid-template-columns: 1fr; }
  .route {
    padding: 14px;
    gap: 12px;
    border-radius: 18px;
    background: var(--surface);
    border-color: var(--border);
    grid-template-columns: 1fr;
  }
  .route:hover { transform: none; }
  .route-identity { gap: 10px; }
  .route-avatar { width: 36px; height: 36px; }
  .route-title { font-size: 0.98rem; }
  .route-title-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
  }
  .route-url { font-size: 0.8rem; }
  .route-tags { gap: 5px; }
  .tag { font-size: 0.68rem; padding: 3px 8px; }
  .route-detail-inline {
    font-size: 0.82rem;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    -webkit-line-clamp: 3;
    max-height: calc(1.45em * 3);
  }
  .route-summary {
    gap: 6px;
    padding: 8px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    justify-content: space-between;
  }
  .route-summary-item {
    padding: 0;
    background: transparent;
    border: 0;
    flex: 1;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .route-summary-label { font-size: 0.62rem; }
  .route-summary-value { font-size: 0.86rem; }

  .route-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding-top: 4px;
    border-top: 1px solid var(--border);
    margin-top: 2px;
  }
  .action, .action-danger { margin-left: 0; }
  .action {
    min-height: 40px;
    padding: 8px;
    justify-content: center;
    border-radius: 10px;
    background: transparent;
    border-color: transparent;
    font-size: 0.78rem;
    color: var(--text-2);
  }
  .action:hover, .action:active { background: var(--surface-3); }
  .action svg { width: 15px; height: 15px; }
  .action-info { color: var(--brand); }
  .action-danger { color: var(--danger); }

  /* FAB: activate on mobile */
  .fab-dial { display: flex; }

  /* MODAL: bottom-sheet style */
  .modal { padding: 0; align-items: flex-end; }
  .modal-backdrop { background: rgba(9, 9, 11, 0.6); }
  .modal-card, .modal-card-lg {
    max-width: 100%;
    width: 100%;
    padding: 18px 18px calc(22px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    max-height: 92vh;
    animation: sheet-up 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .modal-card::before {
    content: '';
    display: block;
    width: 44px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-strong);
    margin: -6px auto 14px;
    opacity: 0.6;
  }
  .modal-card-confirm {
    border-radius: 24px;
    margin: 0 16px calc(16px + env(safe-area-inset-bottom));
    width: calc(100% - 32px);
    animation: pop-in 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .modal-card-confirm::before { display: none; }
  .modal-actions { flex-direction: column-reverse; gap: 8px; }
  .modal-actions .btn { width: 100%; min-width: 0; min-height: 46px; }
  .modal-actions-center { flex-direction: row; }

  .details-grid { grid-template-columns: 1fr; margin-top: 14px; }
  .user-name { display: none; }
  .auth-card { padding: 28px; }
  .auth-brand { padding: 32px 24px; }
  .brand-copy h1 { font-size: 2rem; }
  .dash-footer { flex-direction: column; gap: 6px; align-items: center; text-align: center; }

  /* TOASTS: adjust for FAB */
  .toast-stack {
    right: 16px;
    left: 16px;
    bottom: calc(96px + env(safe-area-inset-bottom));
  }
  .toast { min-width: 0; width: 100%; justify-content: center; }
}

@keyframes sheet-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 520px) {
  .topbar-inner {
    padding-left: 12px;
    padding-right: 12px;
  }
  .dash-main {
    padding-left: 12px;
    padding-right: 12px;
  }
  .dash-hero-text h1 { font-size: 1.55rem; }
  .metric-value { font-size: 1.25rem; }
  #links { padding: 14px 12px; border-radius: 20px; }
  .toolbar { margin-left: -12px; margin-right: -12px; padding-left: 12px; padding-right: 12px; }
  .chip-filters { width: calc(100% + 12px); margin-right: -12px; padding-right: 12px; }
  .action span { display: none; }
  .action { padding: 8px; min-height: 42px; }
  .route-actions { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
  .route-actions .action { border-radius: 10px; background: var(--surface-2); }
  .route { padding: 12px; gap: 10px; border-radius: 16px; }
  .route-detail-inline { font-size: 0.8rem; }
}

@media (max-width: 380px) {
  .metrics-grid { gap: 8px; }
  .metric { padding: 12px; min-height: 86px; }
  .metric-value { font-size: 1.15rem; }
  .metric-icon { width: 30px; height: 30px; }
  .fab-option-label { display: none; }
  .fab-option { padding: 6px; }
}
