/* ==========================================================================
   Thunderboost — visual theme
   Storm-dark by default, light available through [data-theme="light"].
   ========================================================================== */

:root {
  /* --- dark (default) --- */
  --bg: #0c0a07;                     /* deep charcoal, warm */
  --bg-glow-1: rgba(245, 192, 74, .19);
  --bg-glow-2: rgba(201, 138, 30, .12);
  --ray-line: rgba(240, 185, 60, .075);
  --surface: rgba(23, 18, 8, .82);
  --surface-solid: #171208;
  --surface-2: rgba(255, 225, 160, .045);
  --surface-3: rgba(255, 225, 160, .075);
  --border: rgba(240, 185, 60, .13);
  --border-strong: rgba(240, 185, 60, .26);

  --text: #f3ece0;
  --muted: #b3a58c;
  --faint: #877a63;

  --accent: #f0b93c;                 /* gold */
  --accent-2: #f5c04a;               /* lighter gold */
  --spark: #ffe08a;                  /* bright spark */
  --accent-soft: rgba(240, 185, 60, .14);
  --accent-border: rgba(240, 185, 60, .38);
  --accent-hover: #ffcb55;
  --accent-grad: linear-gradient(135deg, #f5c04a 0%, #e0a52e 50%, #c98a1e 100%);
  --on-accent: #2a1d05;              /* text that sits on gold */

  --green: #34d399;
  --green-soft: rgba(52, 211, 153, .13);
  --green-border: rgba(52, 211, 153, .3);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, .13);
  --amber-border: rgba(251, 191, 36, .3);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, .13);
  --red-border: rgba(248, 113, 113, .32);

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .75);
  --ring: 0 0 0 3px rgba(240, 185, 60, .28);
  --sidebar: 256px;
  --topbar: 64px;

  --font: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

[data-theme="light"] {
  --bg: #faf7f0;
  --bg-glow-1: rgba(201, 138, 30, .13);
  --bg-glow-2: rgba(240, 185, 60, .10);
  --ray-line: rgba(140, 100, 20, .06);
  --surface: rgba(255, 255, 255, .94);
  --surface-solid: #ffffff;
  --surface-2: rgba(60, 45, 10, .035);
  --surface-3: rgba(60, 45, 10, .06);
  --border: rgba(60, 45, 10, .12);
  --border-strong: rgba(60, 45, 10, .2);

  --text: #1b1509;
  --muted: #6b5c40;
  --faint: #9a8c72;

  --accent: #a8760c;
  --accent-2: #c98a1e;
  --spark: #d99b00;
  --accent-soft: rgba(168, 118, 12, .1);
  --accent-border: rgba(168, 118, 12, .3);
  --accent-hover: #8c6108;
  --accent-grad: linear-gradient(135deg, #e0a52e 0%, #c98a1e 55%, #a8760c 100%);
  --on-accent: #2a1d05;

  --green: #0d9f6e;
  --green-soft: rgba(13, 159, 110, .1);
  --green-border: rgba(13, 159, 110, .26);
  --amber: #b45309;
  --amber-soft: rgba(180, 83, 9, .09);
  --amber-border: rgba(180, 83, 9, .24);
  --red: #dc4b4b;
  --red-soft: rgba(220, 75, 75, .09);
  --red-border: rgba(220, 75, 75, .26);

  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px -10px rgba(16, 24, 40, .18);
  --shadow-lg: 0 24px 60px -24px rgba(16, 24, 40, .3);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Shafts of gold light falling from the top — the brand backdrop.
   Two layers: the rays themselves, faded out with a mask, and a warm pool of light. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: repeating-linear-gradient(115deg, var(--ray-line) 0 2px, transparent 2px 46px);
  -webkit-mask-image: radial-gradient(78% 62% at 50% -4%, #000 18%, transparent 78%);
  mask-image: radial-gradient(78% 62% at 50% -4%, #000 18%, transparent 78%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 380px at 50% -12%, var(--bg-glow-1), transparent 68%),
    radial-gradient(620px 380px at 92% 104%, var(--bg-glow-2), transparent 70%);
}

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-hover); }

::selection { background: var(--accent-soft); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; }

/* ------------------------------- layout ---------------------------------- */

.layout { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--surface-2), transparent 60%);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 22px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -.35px;
}
.brand .mark {
  width: 36px; height: 36px;
  border-radius: 12px;
  background: var(--accent-grad);
  display: grid; place-items: center;
  color: var(--on-accent);
  flex: 0 0 36px;
  box-shadow: 0 6px 20px -6px rgba(240, 185, 60, .8), inset 0 1px 0 rgba(255, 255, 255, .35);
  position: relative;
}
.brand .mark svg { width: 20px; height: 20px; display: block; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25)); }
/* a faint charge ring around the mark */
.brand .mark::after {
  content: ""; position: absolute; inset: -3px; border-radius: 15px;
  background: var(--accent-grad); opacity: .25; filter: blur(7px); z-index: -1;
}
.brand .word { font-weight: 800; letter-spacing: -.4px; }
.brand .word b { font-weight: 800; }
.brand .word i {
  font-style: normal; font-weight: 800;
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

.nav-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--faint);
  padding: 18px 12px 7px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 11px;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 14px;
  font-family: inherit;
  position: relative;
  transition: background .16s, color .16s, border-color .16s, transform .16s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--text);
  font-weight: 600;
}
.nav-item.active::before {
  content: "";
  position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0;
  background: var(--accent-grad);
}
.nav-item .ico { width: 18px; text-align: center; opacity: .9; font-size: 15px; }
.nav-item .badge { margin-left: auto; }

.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.user-chip {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px;
  border-radius: 12px; transition: background .16s;
}
.user-chip:hover { background: var(--surface-2); text-decoration: none; }
.avatar {
  width: 34px; height: 34px; border-radius: 11px;
  background: var(--accent-grad); color: var(--on-accent);
  display: grid; place-items: center; font-weight: 700; font-size: 13.5px;
  flex: 0 0 34px;
  box-shadow: 0 4px 14px -5px rgba(240, 185, 60, .7);
}
.user-chip .meta { min-width: 0; }
.user-chip .name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .role { font-size: 12px; color: var(--faint); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 16px; font-weight: 750; margin: 0; letter-spacing: -.2px; }
.topbar .spacer { flex: 1; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.pill b { color: var(--text); font-weight: 650; }

/* "live" tag in the header: lit while the update channel is connected. */
.live-dot {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--green); padding: 4px 10px 4px 8px; border-radius: 999px;
  background: var(--green-soft); border: 1px solid var(--green-border);
  transition: color .2s, background .2s, border-color .2s;
}
.live-dot::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 8px -1px currentColor;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.live-dot.off {
  color: var(--faint); background: var(--surface-2); border-color: var(--border);
}
.live-dot.off::before { animation: none; box-shadow: none; }
@media (max-width: 860px) { .live-dot { display: none; } }

.theme-toggle {
  width: 36px; height: 36px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--muted); cursor: pointer; font-size: 15px;
  display: grid; place-items: center; transition: all .16s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }

.content { padding: 26px 28px 60px; max-width: 1560px; width: 100%; animation: rise .32s cubic-bezier(.22,1,.36,1); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
}

/* -------------------------------- cards ---------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  overflow: hidden;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(180deg, var(--surface-2), transparent);
}
.card-head h2 {
  margin: 0; font-size: 12px; font-weight: 750;
  text-transform: uppercase; letter-spacing: .09em; color: var(--text);
}
.card-head .spacer { flex: 1; }
.card-body { padding: 20px; }

.grid { display: grid; gap: 16px; }
.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)); }
@media (max-width: 1180px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .grid.cols-3 { grid-template-columns: 1fr; } }
@media (max-width: 780px)  { .grid.cols-2, .grid.cols-4 { grid-template-columns: 1fr; } }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* stat cards get a quiet gradient sheen and a big number */
.stat { position: relative; }
.stat::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(340px 90px at 100% 0%, var(--accent-soft), transparent 70%);
}
.stat .label {
  font-size: 11.5px; color: var(--faint); font-weight: 650;
  text-transform: uppercase; letter-spacing: .07em;
}
.stat .value {
  font-size: 28px; font-weight: 800; letter-spacing: -1px; margin-top: 6px;
  font-variant-numeric: tabular-nums; line-height: 1.15;
}
.stat .sub { font-size: 12px; color: var(--faint); margin-top: 4px; }

/* ------------------------------ controls --------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: background .16s, border-color .16s, transform .12s, box-shadow .16s, opacity .16s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary {
  background: var(--accent-grad);
  border-color: transparent;
  color: var(--on-accent);
  box-shadow: 0 8px 22px -10px rgba(240, 185, 60, .85);
  text-transform: uppercase; letter-spacing: .04em; font-size: 12.5px; font-weight: 750;
}
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 12px 30px -10px rgba(240, 185, 60, .95); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--red); border-color: var(--red-border); background: var(--red-soft); }
.btn.danger:hover { background: var(--red-soft); filter: brightness(1.15); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }

.seg {
  display: inline-flex; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 12px; padding: 4px; gap: 3px;
}
.seg button {
  border: none; background: none; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--muted); padding: 6px 13px; border-radius: 9px; cursor: pointer;
  transition: all .16s;
}
.seg button:hover { color: var(--text); }
.seg button.active {
  background: var(--surface-solid); color: var(--accent);
  box-shadow: var(--shadow);
}

label.field { display: block; }
label.field > span {
  display: block; font-size: 12px; font-weight: 650; color: var(--muted);
  margin-bottom: 6px; letter-spacing: .01em;
}
input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--ring); background: var(--surface-3);
}
input:disabled { opacity: .55; }
textarea { min-height: 76px; resize: vertical; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }

/* The list a native <select> drops down, and the calendar a date input opens, are
   drawn by the operating system, not by this stylesheet. "color-scheme" is the one
   switch that tells it which palette to use — without it both come out white on a
   dark page. The option colours below are for the browsers that do honour them. */
:root { color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }
select { appearance: none; background-image: none; cursor: pointer; }
select option, select optgroup {
  background: var(--surface-solid);
  color: var(--text);
}
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; color: var(--muted); }
.check:hover { color: var(--text); }
input[type="date"], input[type="datetime-local"] { color-scheme: dark; }
[data-theme="light"] input[type="date"], [data-theme="light"] input[type="datetime-local"] { color-scheme: light; }

/* -------------------------------- table ---------------------------------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--faint);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
  backdrop-filter: blur(10px);
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr { transition: background .14s; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* A buyer who never answered and was passed over — the row should be impossible
   to miss when the lead scans the list during an invite. */
tbody tr.row-skipped { background: var(--red-soft); }
tbody tr.row-skipped:hover { background: color-mix(in srgb, var(--red) 18%, transparent); }
tbody tr.row-skipped td { border-bottom-color: var(--red-border); }
tbody tr.row-skipped td:first-child { box-shadow: inset 3px 0 0 var(--red); }

.empty { padding: 56px 20px; text-align: center; color: var(--faint); }
.empty .big { font-size: 30px; margin-bottom: 10px; opacity: .8; }

/* -------------------------------- badges --------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 8px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .01em;
  background: var(--surface-3); color: var(--muted); border: 1px solid var(--border);
  white-space: nowrap;
}
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.badge.green  { background: var(--green-soft); color: var(--green); border-color: var(--green-border); }
.badge.amber  { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-border); }
.badge.red    { background: var(--red-soft); color: var(--red); border-color: var(--red-border); }

.slots { display: inline-flex; align-items: center; gap: 9px; min-width: 104px; }
.slots .bar { flex: 1; height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.slots .bar i { display: block; height: 100%; background: var(--accent-grad); border-radius: 999px; transition: width .3s; }
.slots .txt { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }

.cls { font-weight: 650; }
.cls-Warrior{color:#C69B6D}.cls-Paladin{color:#F48CBA}.cls-Hunter{color:#AAD372}.cls-Rogue{color:#FFF468}
.cls-Priest{color:#c9ccd4}.cls-Shaman{color:#3B9CFF}.cls-Mage{color:#3FC7EB}.cls-Warlock{color:#8788EE}
.cls-Monk{color:#00FF98}.cls-Druid{color:#FF7C0A}.cls-Demon\ Hunter{color:#A330C9}.cls-Evoker{color:#33937F}
.cls-Death\ Knight{color:#C41E3A}
[data-theme="light"] .cls-Rogue{color:#b39100}
[data-theme="light"] .cls-Priest{color:#6b7280}
[data-theme="light"] .cls-Monk{color:#00a865}

/* --------------------------------- tiers --------------------------------- */

.tier {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px; border-radius: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  color: var(--tier);
  background: color-mix(in srgb, var(--tier) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tier) 40%, transparent);
  white-space: nowrap;
}
.tier i {
  width: 8px; height: 8px; border-radius: 3px; display: block;
  background: linear-gradient(135deg, var(--tier), color-mix(in srgb, var(--tier) 45%, #ffffff));
  box-shadow: 0 0 8px -1px var(--tier);
}
.tier-sm { padding: 1px 7px 1px 6px; font-size: 10.5px; gap: 5px; }
.tier-sm i { width: 6px; height: 6px; border-radius: 2px; }

.tier-tile {
  flex: 1 1 190px; min-width: 180px;
  padding: 14px; border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--tier) 26%, transparent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--tier) 9%, transparent), transparent 70%);
}
.tier-count {
  font-size: 26px; font-weight: 750; letter-spacing: -.8px;
  margin: 8px 0 2px; font-variant-numeric: tabular-nums;
}

/* -------------------------------- modal ---------------------------------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5, 7, 14, .62);
  display: grid; place-items: center; z-index: 100; padding: 20px;
  backdrop-filter: blur(6px);
  animation: fade .18s;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 640px; max-height: 88vh; overflow: auto;
  animation: pop .22s cubic-bezier(.22,1,.36,1);
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal.wide { max-width: 900px; }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.3px; }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 24px; }
.modal-foot { padding: 18px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ------------------------------- toasts ---------------------------------- */

#toasts { position: fixed; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast {
  background: var(--surface-solid); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 13px 18px;
  font-size: 13.5px; max-width: 400px; animation: slide .24s cubic-bezier(.22,1,.36,1);
  transition: opacity .25s;
}
.toast.err { border-left-color: var(--red); }
.toast.ok  { border-left-color: var(--green); }
@keyframes slide { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* -------------------------------- notes ---------------------------------- */

.note {
  background: var(--amber-soft); border: 1px solid var(--amber-border); color: var(--amber);
  padding: 13px 16px; border-radius: 12px; font-size: 13px;
}
.note b { color: inherit; }
.note.info { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
[data-theme="light"] .note { color: #8a5a06; }

/* ---------------------------------- chat --------------------------------- */

.chat-layout { display: grid; grid-template-columns: 270px 1fr; gap: 20px; }
@media (max-width: 960px) { .chat-layout { grid-template-columns: 1fr; } }

.chat-threads {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 440px; overflow-y: auto;
  border-right: 1px solid var(--border); padding-right: 14px;
}
@media (max-width: 960px) { .chat-threads { border-right: none; border-bottom: 1px solid var(--border); padding-bottom: 14px; } }

.chat-thread {
  display: flex; align-items: center; gap: 11px; text-align: left;
  padding: 10px 11px; border: 1px solid transparent; border-radius: 12px;
  background: none; font: inherit; cursor: pointer; width: 100%;
  transition: background .16s, border-color .16s;
}
.chat-thread:hover { background: var(--surface-2); }
.chat-thread.active { background: var(--accent-soft); border-color: var(--accent-border); }
.chat-thread .meta { min-width: 0; flex: 1; }
.chat-thread .name { display: block; font-weight: 650; font-size: 13px; }
.chat-thread .preview {
  display: block; font-size: 12px; color: var(--faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.chat-title { font-size: 13px; color: var(--muted); margin-bottom: 12px; display: flex; gap: 8px; align-items: center; }

.chat-log { display: flex; flex-direction: column; gap: 12px; max-height: 400px; overflow-y: auto; padding: 4px; }
.msg { max-width: 76%; align-self: flex-start; animation: rise .2s; }
.msg.mine { align-self: flex-end; }
.msg-head { font-size: 11px; color: var(--faint); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.msg.mine .msg-head { justify-content: flex-end; }
.msg-body {
  background: var(--surface-3); border: 1px solid var(--border);
  padding: 10px 14px; border-radius: 14px 14px 14px 5px;
  font-size: 13.5px; white-space: pre-wrap; word-break: break-word;
}
.msg.mine .msg-body {
  background: var(--accent-soft); border-color: var(--accent-border);
  border-radius: 14px 14px 5px 14px; color: var(--text);
}

.chat-form { display: flex; gap: 10px; align-items: flex-end; margin-top: 16px; }
.chat-form textarea { flex: 1; min-height: 46px; }

/* A message that has been shown but not yet acknowledged by the server. */
.msg.pending { opacity: .55; }
.msg-body a { text-decoration: underline; word-break: break-all; }

/* --------------------------------- auth ---------------------------------- */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; z-index: 1; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { justify-content: center; font-size: 22px; padding-bottom: 8px; }
.auth-sub { text-align: center; color: var(--muted); margin-bottom: 24px; font-size: 13.5px; }
.auth-tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin-bottom: 22px; }
.auth-tabs button {
  flex: 1; border: none; background: none; font: inherit; font-weight: 600;
  padding: 8px; border-radius: 9px; cursor: pointer; color: var(--muted); transition: all .16s;
}
.auth-tabs button.active { background: var(--surface-solid); color: var(--accent); box-shadow: var(--shadow); }

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
