/* ────────────────────────────────────────────────────────────────────────────
   SB Corp Elite Access — Theme
   Palette: midnight navy + champagne gold + deep glass
   ──────────────────────────────────────────────────────────────────────────── */

:root {
  /* Surfaces */
  --bg-base:       #07090F;
  --bg-elevated:   #0E1322;
  --bg-card:       rgba(20, 26, 44, 0.72);
  --bg-card-solid: #131A2C;
  --bg-input:      #0B1120;
  --bg-hover:      rgba(200, 168, 90, 0.06);

  /* Borders / dividers */
  --border:        rgba(200, 168, 90, 0.14);
  --border-strong: rgba(200, 168, 90, 0.28);
  --divider:       rgba(255, 255, 255, 0.06);

  /* Brand gold */
  --gold:          #C8A85A;
  --gold-bright:   #E5C56F;
  --gold-deep:     #8E7634;
  --gold-glow:     rgba(200, 168, 90, 0.35);

  /* Text */
  --text:          #ECEFF7;
  --text-muted:    #8A93A8;
  --text-faded:    #5B6377;

  /* Status */
  --ok:            #4ADE80;
  --warn:          #F4C77B;
  --err:           #F87171;
  --info:          #7DB3FF;

  /* Layout */
  --sidebar-w:     264px;
  --topbar-h:      62px;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow-glow:   0 0 0 1px var(--border), 0 12px 40px rgba(0,0,0,.45);

  --serif:         'Cormorant Garamond', 'Garamond', 'Times New Roman', serif;
  --sans:          'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono:          'JetBrains Mono', 'SF Mono', Menlo, monospace;
}

/* ── Reset + base ─────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-base);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body::before {
  /* subtle radial vignette + gold dust */
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(200,168,90,.07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(125,179,255,.05), transparent 60%);
  pointer-events: none; z-index: 0;
}

a { color: var(--gold-bright); text-decoration: none; }
a:hover { color: var(--gold); }

h1, h2, h3, h4 { color: var(--text); margin: 0 0 .6rem; font-weight: 600; letter-spacing: .2px; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 .8rem; color: var(--text); }

code, pre {
  font-family: var(--mono);
  font-size: .85rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}
pre { padding: 12px; overflow: auto; }

::selection { background: var(--gold-glow); color: var(--text); }

/* ── Layout shell ─────────────────────────────────────────────────────────── */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  background: linear-gradient(180deg, #0A0F1C 0%, #060912 100%);
  border-right: 1px solid var(--border);
  padding: 18px 14px 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 18px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 14px;
}
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep));
  display: grid; place-items: center;
  color: #0A0F1C; font-family: var(--serif); font-weight: 700; font-size: 22px;
  box-shadow: 0 4px 14px rgba(200,168,90,.35), inset 0 0 0 1px rgba(255,255,255,.18);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--serif); font-size: 1.15rem; color: var(--gold-bright); letter-spacing: .5px; }
.brand-sub  { font-size: .68rem; color: var(--text-faded); letter-spacing: 2px; text-transform: uppercase; }

.nav-section-label {
  font-size: .65rem; letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-faded);
  padding: 16px 12px 6px;
}

.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .9rem;
  margin-bottom: 2px;
  transition: background .15s, color .15s, transform .15s;
}
.nav a:hover { background: var(--bg-hover); color: var(--text); }
.nav a.active {
  background: linear-gradient(90deg, rgba(200,168,90,.16), rgba(200,168,90,.04));
  color: var(--gold-bright);
  box-shadow: inset 2px 0 0 var(--gold);
}
.nav .icon { width: 18px; text-align: center; opacity: .85; }
.nav .badge {
  margin-left: auto;
  font-size: .7rem;
  background: var(--gold-glow);
  color: var(--gold-bright);
  border-radius: 4px;
  padding: 1px 6px;
}

.main {
  display: flex; flex-direction: column;
  min-width: 0; /* prevents grid blowout */
}

.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 9, 15, 0.7);
  backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.topbar .breadcrumb { color: var(--text-faded); font-size: .85rem; }
.topbar .topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar .user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .85rem;
  color: var(--text-muted);
}
.topbar .user-chip .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 8px var(--ok);
}

.content {
  padding: 26px 28px 60px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
}

/* ── Cards / panels ──────────────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-glow);
}
.card + .card { margin-top: 18px; }
.card-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--gold-bright);
  margin-bottom: 14px;
  letter-spacing: .5px;
  display: flex; align-items: center; justify-content: space-between;
}
.card-sub { color: var(--text-muted); font-size: .85rem; margin-top: -8px; margin-bottom: 14px; }

.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
}

/* ── Stat tiles ──────────────────────────────────────────────────────────── */

.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute; top: 0; right: 0;
  width: 60px; height: 60px;
  background: radial-gradient(circle at top right, var(--gold-glow), transparent 70%);
  pointer-events: none;
}
.stat-label { font-size: .75rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-faded); }
.stat-value { font-family: var(--serif); font-size: 1.8rem; color: var(--gold-bright); margin-top: 6px; }
.stat-delta { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.stat-delta.up { color: var(--ok); }
.stat-delta.down { color: var(--err); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: .88rem; font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
  font-family: inherit;
}
.btn:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.btn-primary {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  border: none;
  color: #0A0F1C;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(200,168,90,.35);
}
.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 22px rgba(200,168,90,.45);
}
.btn-danger { border-color: rgba(248,113,113,.4); color: var(--err); }
.btn-danger:hover { background: rgba(248,113,113,.08); }
.btn-ghost  { border: 1px dashed var(--border-strong); color: var(--text-muted); }

/* ── Forms ───────────────────────────────────────────────────────────────── */

.field { margin-bottom: 14px; }
.field label { display: block; font-size: .8rem; color: var(--text-muted); margin-bottom: 6px; letter-spacing: .3px; }
input, select, textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .9rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
textarea { min-height: 100px; resize: vertical; }

.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

/* ── Tables ──────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table.data {
  width: 100%; border-collapse: collapse;
  font-size: .87rem;
}
table.data th {
  text-align: left;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-weight: 600;
  font-size: .72rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
table.data td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
  color: var(--text);
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--bg-hover); }

/* ── Pills / badges ──────────────────────────────────────────────────────── */

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .72rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
  letter-spacing: .3px;
}
.pill-gold { background: var(--gold-glow); color: var(--gold-bright); }
.pill-ok   { background: rgba(74,222,128,.12); color: var(--ok); }
.pill-warn { background: rgba(244,199,123,.12); color: var(--warn); }
.pill-err  { background: rgba(248,113,113,.12); color: var(--err); }
.pill-mute { background: rgba(255,255,255,.04); color: var(--text-muted); }

/* ── Auth (login) page ──────────────────────────────────────────────────── */

.auth-shell {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 30px;
  position: relative; z-index: 1;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.auth-brand {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 22px;
}
.auth-title {
  font-family: var(--serif);
  font-size: 1.6rem; color: var(--gold-bright);
  margin-bottom: 4px;
}
.auth-sub {
  font-size: .8rem; color: var(--text-faded);
  letter-spacing: 2px; text-transform: uppercase;
  margin-bottom: 22px;
}
.auth-card .btn-primary { width: 100%; justify-content: center; padding: 12px; }

/* ── Flashes / toasts ────────────────────────────────────────────────────── */

.flash {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  border: 1px solid var(--border);
  font-size: .88rem;
}
.flash.error   { border-color: rgba(248,113,113,.3); color: var(--err); background: rgba(248,113,113,.06); }
.flash.success { border-color: rgba(74,222,128,.3);  color: var(--ok);  background: rgba(74,222,128,.06); }
.flash.info    { border-color: rgba(125,179,255,.3); color: var(--info); background: rgba(125,179,255,.06); }

/* ── Footer ──────────────────────────────────────────────────────────────── */

.footer {
  border-top: 1px solid var(--divider);
  padding: 18px 28px;
  font-size: .75rem;
  color: var(--text-faded);
  display: flex; justify-content: space-between;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */

.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty .empty-icon { font-size: 2.4rem; opacity: .35; margin-bottom: 8px; }
.empty .empty-msg  { font-family: var(--serif); font-size: 1.1rem; }
