/* FORTIS Admin — dark back-office theme */
:root {
  --bg: #060708;
  --panel: #0d0f12;
  --panel-2: #131619;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #eceef0;
  --muted: #98a0a8;
  --muted-2: #5f676e;
  --accent: #9ad7ff;      /* FORTIS ice-blue */
  --ice: #dff3ff;         /* near-white ice — CTAs */
  --accent-ink: #0a0c0e;
  --gold: #c9a96a;        /* FORTIS gold */
  --good: #38d39f;
  --warn: #f2b338;
  --info: #9ad7ff;
  --bad: #ff5d5d;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --glow: 0 0 24px rgba(159, 216, 255, 0.28);
  --font-display: "Bebas Neue", "Arial Narrow", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, rgba(159,216,255,0.06), transparent 60%), var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; letter-spacing: 0.03em; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---- Layout ---- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--bg));
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 20px; }
.brand__mark {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
  font-family: var(--font-body);
  background: var(--ice); color: var(--accent-ink); box-shadow: var(--glow);
}
.brand__name { font-family: var(--font-display); font-weight: 400; letter-spacing: 0.14em; font-size: 22px; line-height: 0.9; }
.brand__sub { font-size: 10px; color: var(--muted); letter-spacing: 0.18em; text-transform: uppercase; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 10px; color: var(--muted);
  font-weight: 600; font-size: 13px; border: 1px solid transparent;
}
.nav-item svg { width: 17px; height: 17px; opacity: 0.85; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--panel-2); color: var(--text); border-color: var(--line-2); }
.nav-item.active svg { color: var(--accent); opacity: 1; }
.sidebar__foot { margin-top: auto; font-size: 11px; color: var(--muted-2); padding: 12px 8px 0; border-top: 1px solid var(--line); }
.demo-pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(242,179,56,0.12); color: var(--warn); padding: 3px 9px; border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 10px; }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 30px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  background: rgba(6,7,8,0.82); backdrop-filter: blur(10px);
}
.topbar h1 { font-size: 26px; margin: 0; font-weight: 400; text-transform: uppercase; letter-spacing: 0.04em; line-height: 1; }
.topbar .sub { color: var(--muted); font-size: 12.5px; }
.spacer { flex: 1; }
.search {
  display: flex; align-items: center; gap: 8px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; width: 260px;
}
.search input { background: none; border: 0; color: var(--text); outline: none; width: 100%; font-size: 13px; }
.search svg { width: 15px; height: 15px; color: var(--muted); }

.content { padding: 26px 30px 60px; max-width: 1240px; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.16); background: rgba(255,255,255,0.02); color: var(--text); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; transition: 0.15s; }
.btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.btn--primary { background: var(--ice); color: var(--accent-ink); border-color: var(--ice); box-shadow: var(--glow); }
.btn--primary:hover { color: var(--accent-ink); box-shadow: 0 0 40px rgba(159,216,255,0.5); transform: translateY(-1px); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { transform: none; }
.btn--sm { padding: 7px 12px; font-size: 11px; letter-spacing: 0.08em; }
.btn svg { width: 15px; height: 15px; }

/* ---- Cards / grid ---- */
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, 1fr); margin-bottom: 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.kpi__label { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; display: flex; align-items: center; gap: 7px; }
.kpi__value { font-family: var(--font-display); font-size: 38px; font-weight: 400; margin-top: 6px; letter-spacing: 0.02em; line-height: 1; }
.kpi__delta { font-size: 11.5px; margin-top: 6px; color: var(--muted); }
.kpi__delta.up { color: var(--good); } .kpi__delta.down { color: var(--bad); }
.kpi__dot { width: 8px; height: 8px; border-radius: 50%; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 14px; }
.section-head h2 { font-size: 18px; margin: 0; font-weight: 400; text-transform: uppercase; letter-spacing: 0.05em; }
.section-head a { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.section-head a:hover { color: var(--accent); }

.cols-2 { grid-template-columns: 1.55fr 1fr; align-items: start; }

/* ---- Chart ---- */
.chart { display: flex; align-items: flex-end; gap: 8px; height: 170px; padding-top: 10px; }
.bar { flex: 1; background: linear-gradient(180deg, var(--accent), rgba(159,216,255,0.18)); border-radius: 5px 5px 3px 3px; min-height: 4px; position: relative; transition: 0.2s; }
.bar:hover { filter: brightness(1.12); }
.bar span { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); white-space: nowrap; opacity: 0; transition: 0.15s; }
.bar:hover span { opacity: 1; }
.bar small { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--muted-2); }

/* ---- Donut / plan mix ---- */
.mix-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); }
.mix-row:last-child { border-bottom: 0; }
.mix-left { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.swatch { width: 10px; height: 10px; border-radius: 3px; }
.mix-bar { height: 6px; border-radius: 4px; background: var(--panel-2); overflow: hidden; margin-top: 3px; }
.mix-bar > i { display: block; height: 100%; border-radius: 4px; }

/* ---- Tables ---- */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table-tools { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
.chip.active { background: var(--text); color: #0b0c0d; border-color: var(--text); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted-2); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line); }
td { padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
tbody tr { transition: 0.12s; cursor: pointer; }
tbody tr:hover td { background: rgba(255,255,255,0.025); }
tbody tr:last-child td { border-bottom: 0; }
.who { display: flex; align-items: center; gap: 11px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--accent); flex-shrink: 0; }
.who b { font-weight: 650; } .who small { color: var(--muted); display: block; font-size: 11.5px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 650; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.good { color: var(--good); background: rgba(56,211,159,0.1); }
.pill.warn { color: var(--warn); background: rgba(242,179,56,0.1); }
.pill.info { color: var(--info); background: rgba(99,179,255,0.1); }
.pill.muted { color: var(--muted); background: rgba(255,255,255,0.05); }
.pill.bad { color: var(--bad); background: rgba(255,93,93,0.1); }

.mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; }

/* ---- Member detail ---- */
.detail { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.back { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-weight: 600; font-size: 13px; margin-bottom: 16px; }
.back:hover { color: var(--text); }
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 6px; }
.profile-head .avatar { width: 58px; height: 58px; font-size: 20px; }
.profile-head h2 { margin: 0; font-size: 28px; text-transform: uppercase; letter-spacing: 0.03em; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 10px 14px; padding: 4px 0; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; font-weight: 600; }
.kv dd.editable:hover { color: var(--accent); cursor: text; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 18px; }
.tl-item::before { content: ""; position: absolute; left: -22px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--panel); border: 2px solid var(--muted-2); }
.tl-item.paid::before { border-color: var(--good); } .tl-item.failed::before { border-color: var(--bad); } .tl-item.email::before { border-color: var(--info); }
.tl-item b { font-weight: 650; } .tl-item small { color: var(--muted); display: block; font-size: 11.5px; }

/* ---- Comms / automations ---- */
.flow { display: flex; gap: 14px; align-items: stretch; }
.flow__list { display: flex; flex-direction: column; gap: 10px; width: 320px; flex-shrink: 0; }
.flow-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; transition: 0.15s; }
.flow-card:hover, .flow-card.active { border-color: var(--line-2); background: var(--panel-2); }
.flow-card h3 { margin: 0 0 3px; font-size: 14px; }
.flow-card .meta { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 11.5px; margin-top: 8px; }
.flow-preview { flex: 1; }
.email-mock { background: #fff; color: #1a1d21; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.email-mock__bar { background: #f2f3f5; padding: 12px 18px; border-bottom: 1px solid #e2e4e8; font-size: 12px; color: #555; }
.email-mock__body { padding: 22px 24px; white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; min-height: 220px; }
.email-mock__subject { font-weight: 700; font-size: 16px; margin-bottom: 14px; color: #14161a; }
.token { background: rgba(159,216,255,0.28); color: #1c5372; border-radius: 4px; padding: 0 3px; font-weight: 600; }

.toggle { width: 40px; height: 22px; border-radius: 999px; background: var(--good); position: relative; border: 0; flex-shrink: 0; }
.toggle::after { content: ""; position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; }

/* ---- Modal ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; width: 460px; max-width: 100%; box-shadow: var(--shadow); }
.modal__head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal__head h3 { margin: 0; font-size: 16px; }
.modal__body { padding: 20px 22px; display: grid; gap: 14px; }
.modal__foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.field { display: grid; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 9px; padding: 10px 12px; color: var(--text); font-size: 13.5px; outline: none; font-family: inherit; }
.field input:focus, .field select:focus { border-color: var(--accent); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.empty { text-align: center; color: var(--muted); padding: 50px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: #0b0c0d; padding: 11px 20px; border-radius: 10px; font-weight: 650; font-size: 13px; box-shadow: var(--shadow); z-index: 200; animation: pop 0.2s; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .sidebar__foot { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .cols-2, .detail, .flow { grid-template-columns: 1fr; }
  .flow__list { width: 100%; }
}
