/* Equity Estates Lifeboat: Seatbelt's design tokens on a Bootstrap 5.3 base (plan section 13.1).
   Tokens switch with [data-theme="dark"] on <html>; Bootstrap's own variables are mapped onto the
   tokens below, so Bootstrap components and Lifeboat's shell share one palette in both themes. */

:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #e3e8ef;
  --border-strong: #cfd7e3;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;
  --accent: #4f46e5;
  --accent-rgb: 79, 70, 229;
  --accent-2: #6366f1;
  --accent-soft: #eef2ff;
  --accent-text: #ffffff;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --info: #0369a1;
  --info-soft: #f0f9ff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar: #ffffff;
  --sidebar-text: #334155;
  --sidebar-active: #eef2ff;
  --c1: #4f46e5; --c2: #0ea5e9; --c3: #10b981; --c4: #f59e0b; --c5: #ef4444;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b1020;
  --surface: #121829;
  --surface-2: #161d31;
  --surface-3: #1d2540;
  --border: #242d47;
  --border-strong: #33405f;
  --text: #e6e9f2;
  --text-2: #b4bccf;
  --text-3: #8a94ab;
  --accent: #818cf8;
  --accent-rgb: 129, 140, 248;
  --accent-2: #a5b4fc;
  --accent-soft: #1f2347;
  --accent-text: #0b1020;
  --success: #34d399;
  --success-soft: #0f2a22;
  --warning: #fbbf24;
  --warning-soft: #2b2210;
  --danger: #f87171;
  --danger-soft: #2d1416;
  --info: #38bdf8;
  --info-soft: #0c2231;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.25);
  --sidebar: #0f1526;
  --sidebar-text: #b4bccf;
  --sidebar-active: #1f2347;
  --c1: #818cf8; --c2: #38bdf8; --c3: #34d399; --c4: #fbbf24; --c5: #f87171;
  color-scheme: dark;
}

/* Bootstrap variables → Lifeboat tokens (specificity beats Bootstrap's :root/[data-bs-theme]). */
:root[data-bs-theme] {
  --bs-body-font-family: var(--font);
  --bs-font-monospace: var(--mono);
  --bs-body-font-size: 0.875rem;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-emphasis-color: var(--text);
  --bs-secondary-color: var(--text-3);
  --bs-tertiary-color: var(--text-3);
  --bs-secondary-bg: var(--surface-2);
  --bs-tertiary-bg: var(--surface-3);
  --bs-border-color: var(--border);
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-lg: var(--radius);
  --bs-primary: var(--accent);
  --bs-primary-rgb: var(--accent-rgb);
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: var(--accent-rgb);
  --bs-link-hover-color: var(--accent-2);
  --bs-link-decoration: none;
  --bs-focus-ring-color: rgba(var(--accent-rgb), 0.25);
  --bs-card-bg: var(--surface);
}

body { -webkit-font-smoothing: antialiased; background: var(--bg); color: var(--text); }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.375rem; font-weight: 650; letter-spacing: -0.01em; }
code { font-family: var(--mono); color: var(--accent); }

.btn-primary {
  --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-color: var(--accent-text);
  --bs-btn-hover-bg: var(--accent-2); --bs-btn-hover-border-color: var(--accent-2); --bs-btn-hover-color: var(--accent-text);
  --bs-btn-active-bg: var(--accent-2); --bs-btn-active-border-color: var(--accent-2);
  --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent);
}
.btn-icon {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border-radius: var(--radius-sm); color: var(--text-2); background: transparent; border: 0;
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon svg { width: 20px; height: 20px; }

/* ── Shell: sidebar + main (Seatbelt layout) ───────────────────── */
.shell { min-height: 100vh; }
@media (min-width: 992px) {
  .shell { display: grid; grid-template-columns: 232px 1fr; }
}
.sidebar { background: var(--sidebar); border-right: 1px solid var(--border); }
.sidebar-inner { display: flex; flex-direction: column; gap: 4px; padding: 18px 12px; height: 100%; }
@media (min-width: 992px) {
  .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
@media (max-width: 991.98px) {
  .sidebar.offcanvas-lg { --bs-offcanvas-width: 264px; --bs-offcanvas-bg: var(--sidebar); }
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--c2)); color: #fff;
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--text-3); }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); padding: 14px 10px 6px; }
.nav-list a, .nav-list .nav-disabled {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--sidebar-text); font-weight: 500; min-height: 40px;
}
.nav-list a:hover { background: var(--surface-3); text-decoration: none; }
.nav-list a.active { background: var(--sidebar-active); color: var(--accent); }
.nav-list .nav-disabled { opacity: 0.5; cursor: default; }
.nav-list svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; font-size: 11px; color: var(--text-3); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 28px; padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 1020;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.env-badge { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--warning-soft); color: var(--warning); font-weight: 600; }
.content { padding: 24px 28px 48px; max-width: 1400px; width: 100%; padding-bottom: max(48px, env(safe-area-inset-bottom)); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-3); margin: 4px 0 0; }

/* Cards and tables */
.lb-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.lb-card-head { background: transparent; border-bottom: 1px solid var(--border); padding: 14px 16px; }
.lb-table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--border); }
.lb-table th { color: var(--text-3); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.lb-table td, .lb-table th { padding: 10px 16px; }

/* ── Phones ─────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .content { padding: 18px 16px 40px; }
  .topbar { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 767.98px) {
  /* Tables become stacked label/value cards (Seatbelt's data-label pattern). */
  .lb-table.stack-mobile thead { display: none; }
  .lb-table.stack-mobile tr { display: block; border-bottom: 1px solid var(--border); padding: 8px 0; }
  .lb-table.stack-mobile td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 16px; text-align: right; }
  .lb-table.stack-mobile td::before { content: attr(data-label); color: var(--text-3); font-size: 12px; text-align: left; }
}
