/* ==========================================================================
   mindHub CRM — design system
   Night-navy canvas, serif editorial headlines, tracked small-caps labels,
   warm gold accents. Mirrors the mindHub blog aesthetic.
   ========================================================================== */

:root {
  --bg: #0f1b2c;
  --bg-deep: #0b1422;
  --surface: #14233a;
  --surface-2: #192b45;
  --line: rgba(232, 226, 212, 0.09);
  --line-strong: rgba(232, 226, 212, 0.18);
  --text: #ece8df;
  --text-2: #b9bcc2;
  --muted: #858c97;
  --label: #b8a37c;
  --gold: #c9a96a;
  --gold-soft: rgba(201, 169, 106, 0.14);
  --pill: #e9e7e3;
  --pill-text: #121b28;
  --ok: #7fbf9a;
  --ok-soft: rgba(127, 191, 154, 0.14);
  --warn: #e0b45c;
  --warn-soft: rgba(224, 180, 92, 0.14);
  --err: #e38a7f;
  --err-soft: rgba(227, 138, 127, 0.14);
  --info: #8fb0d8;
  --info-soft: rgba(143, 176, 216, 0.14);
  --footer: #000;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.55);
  --radius: 10px;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --mark-filter: none;
  --hero-fade: linear-gradient(180deg, rgba(15, 27, 44, 0.0) 0%, rgba(15, 27, 44, 0.35) 55%, var(--bg) 100%);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f6f3ec;
  --bg-deep: #efeadf;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --line: rgba(15, 27, 44, 0.09);
  --line-strong: rgba(15, 27, 44, 0.18);
  --text: #142033;
  --text-2: #3f4a5a;
  --muted: #747b86;
  --label: #8c7446;
  --gold: #9a7b3f;
  --gold-soft: rgba(154, 123, 63, 0.12);
  --pill: #0f1b2c;
  --pill-text: #f6f3ec;
  --ok: #2f7d55; --ok-soft: rgba(47, 125, 85, 0.1);
  --warn: #a8761a; --warn-soft: rgba(168, 118, 26, 0.1);
  --err: #b4483b; --err-soft: rgba(180, 72, 59, 0.1);
  --info: #3d6595; --info-soft: rgba(61, 101, 149, 0.1);
  --shadow: 0 24px 60px -28px rgba(15, 27, 44, 0.3);
  --mark-filter: invert(1) brightness(0.25);
  --hero-fade: linear-gradient(180deg, rgba(246, 243, 236, 0.45) 0%, rgba(246, 243, 236, 0.75) 60%, var(--bg) 100%);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.6 var(--sans); -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; }
a { color: inherit; }
::selection { background: var(--gold-soft); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

/* ---------- type ---------- */
.serif { font-family: var(--serif); }
.eyebrow {
  font: 600 11px/1 var(--sans); letter-spacing: 0.22em; text-transform: uppercase; color: var(--label);
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.005em; margin: 0; }
h1 { font-size: clamp(28px, 3.2vw, 38px); line-height: 1.15; }
h2 { font-size: 22px; line-height: 1.25; }
h3 { font-size: 17px; }
.lede { font-family: var(--serif); font-style: italic; font-size: clamp(24px, 2.4vw, 30px); line-height: 1.22; color: var(--text); opacity: .92; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 40; height: 64px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  text-decoration: none; color: var(--text-2); font-size: 13px; padding: 7px 12px; border-radius: 8px;
}
.nav-links a:hover { color: var(--text); background: var(--line); }
.nav-links a.active { color: var(--text); }
.nav-links a.active::after { content: ""; display: block; height: 1px; background: var(--gold); margin-top: 3px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; justify-self: center; }
.brand img { height: 20px; filter: var(--mark-filter); }
.brand span { font: 800 17px/1 "Nunito", var(--sans); letter-spacing: -0.01em; }
.brand em { font: italic 400 15px/1 var(--serif); color: var(--label); margin-left: 2px; }
.nav-right { display: flex; gap: 10px; align-items: center; justify-self: end; }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%;
  background: none; border: 0; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--line); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }

/* ---------- buttons ---------- */
.btn {
  --b-bg: transparent; --b-fg: var(--text); --b-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--b-bd);
  background: var(--b-bg); color: var(--b-fg); font: 500 13.5px/1 var(--sans);
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .08s, background .15s, opacity .15s;
}
.btn:hover { background: color-mix(in srgb, var(--b-bg) 85%, var(--text) 15%); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary { --b-bg: var(--pill); --b-fg: var(--pill-text); --b-bd: transparent; font-weight: 600; }
.btn-primary:hover { background: color-mix(in srgb, var(--pill) 88%, var(--gold) 12%); }
.btn-gold { --b-bg: var(--gold); --b-fg: #14110a; --b-bd: transparent; font-weight: 600; }
.btn-danger { --b-fg: var(--err); --b-bd: color-mix(in srgb, var(--err) 40%, transparent); }
.btn-ghost { --b-bd: transparent; color: var(--text-2); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn svg { width: 15px; height: 15px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- hero ---------- */
.hero {
  position: relative; height: 300px; overflow: hidden; margin-bottom: -96px;
  background: url("/static/img/hero.jpg") center 30% / cover no-repeat, var(--bg-deep);
}
.hero::after { content: ""; position: absolute; inset: 0; background: var(--hero-fade); }
:root[data-theme="light"] .hero { filter: saturate(.75); }
.hero.slim { height: 180px; margin-bottom: -70px; }

/* ---------- layout ---------- */
.wrap { position: relative; z-index: 1; max-width: 1160px; margin: 0 auto; padding: 0 28px; }
.split { display: grid; grid-template-columns: 300px 1fr; gap: 72px; }
.split > aside { position: sticky; top: 96px; align-self: start; }
.page-pad { padding-bottom: 96px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap-row { flex-wrap: wrap; }
.spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 920px) {
  .split { grid-template-columns: 1fr; gap: 32px; }
  .split > aside { position: static; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .nav { grid-template-columns: auto 1fr; height: auto; padding: 10px 16px 6px; row-gap: 6px; }
  .brand { justify-self: start; grid-row: 1; grid-column: 1; }
  .nav-right { grid-row: 1; grid-column: 2; }
  .nav-links { grid-row: 2; grid-column: 1 / -1; overflow-x: auto; margin: 0 -8px; }
  .wrap { padding: 0 16px; }
  .post { grid-template-columns: 1fr; }
  .post-actions { order: 2; margin-left: -12px; }
}

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
}
.card.flat { background: transparent; }
.card-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.card-head h2, .card-head h3 { flex: 1; }
.divider { height: 1px; background: var(--line); margin: 24px 0; border: 0; }

/* ---------- tabs (blog "NEWEST · OLDEST" style) ---------- */
.tabs { display: flex; gap: 22px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.tab {
  background: none; border: 0; padding: 0 0 12px; cursor: pointer; color: var(--muted);
  font: 600 11px/1 var(--sans); letter-spacing: 0.2em; text-transform: uppercase; position: relative;
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--label); }
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--gold); }
.tab .count { color: var(--muted); font-weight: 500; margin-left: 6px; letter-spacing: .05em; }

.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--line); gap: 2px; }
.seg button {
  border: 0; background: none; color: var(--text-2); padding: 7px 14px; border-radius: 999px; cursor: pointer;
  font: 500 13px/1 var(--sans); display: inline-flex; gap: 7px; align-items: center;
}
.seg button svg { width: 14px; height: 14px; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.25); }

/* ---------- campaign list (blog post rows) ---------- */
.post { padding: 26px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; }
.post:last-child { border-bottom: 0; }
.post-title { font: 600 21px/1.3 var(--serif); text-decoration: none; color: var(--text); }
.post-title:hover { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px; }
.post-sub { color: var(--text-2); font-size: 14.5px; margin: 6px 0 12px; max-width: 62ch; }
.post-meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.post-meta b { color: var(--text); font-weight: 600; }
.post-actions { display: flex; gap: 6px; align-items: start; }
.post .eyebrow { margin-bottom: 10px; display: flex; gap: 10px; align-items: center; }
.empty { text-align: center; padding: 64px 24px; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 6px; font-size: 22px; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px;
  font: 600 10.5px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase;
  background: var(--line); color: var(--text-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.draft { color: var(--muted); }
.badge.sending, .badge.queued { color: var(--info); background: var(--info-soft); }
.badge.sending::before { animation: pulse 1.4s ease-in-out infinite; }
.badge.paused { color: var(--warn); background: var(--warn-soft); }
.badge.completed { color: var(--ok); background: var(--ok-soft); }
.badge.cancelled, .badge.failed { color: var(--err); background: var(--err-soft); }
@keyframes pulse { 50% { opacity: .25; } }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.kpi { background: var(--surface); padding: 18px 20px; }
.kpi .eyebrow { font-size: 10px; }
.kpi .v { font: 600 30px/1.1 var(--serif); margin-top: 10px; font-variant-numeric: tabular-nums; }
.kpi .s { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.kpis.six { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 920px) { .kpis, .kpis.six { grid-template-columns: repeat(2, 1fr); } }

.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #e6cf9c); border-radius: 99px; transition: width .6s ease; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label, .label { font: 600 11px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--label); }
.hint { color: var(--muted); font-size: 12.5px; }
.input, .select, .textarea {
  width: 100%; background: var(--bg-deep); border: 1px solid var(--line-strong); color: var(--text);
  border-radius: 8px; padding: 10px 12px; font: 14.5px/1.4 var(--sans); transition: border .15s, box-shadow .15s;
}
:root[data-theme="light"] .input, :root[data-theme="light"] .select, :root[data-theme="light"] .textarea { background: #fff; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.input.lg { font: 500 18px/1.3 var(--serif); padding: 12px 14px; }
.textarea { resize: vertical; min-height: 120px; }
.code { font: 12.5px/1.55 var(--mono); tab-size: 2; white-space: pre; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23999' stroke-width='1.6'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px dashed var(--line-strong); background: none; color: var(--text-2); border-radius: 6px;
  padding: 3px 8px; font: 12px/1.4 var(--mono); cursor: pointer;
}
.chip:hover { border-color: var(--gold); color: var(--gold); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 99px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.switch input:checked { background: var(--gold); }
.switch input:checked::after { transform: translateX(16px); background: #fff; }

/* ---------- dropzone ---------- */
.drop {
  display: block;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 40px 24px; text-align: center;
  cursor: pointer; transition: border .15s, background .15s; background: var(--surface-2);
}
.drop:hover, .drop.over { border-color: var(--gold); background: var(--gold-soft); }
.drop svg { width: 30px; height: 30px; color: var(--gold); margin-bottom: 10px; }
.drop strong { display: block; font: 600 17px/1.3 var(--serif); margin-bottom: 4px; }
.drop input { display: none; }

/* ---------- wizard step rail ---------- */
.steps { list-style: none; margin: 28px 0 0; padding: 0; counter-reset: s; }
.steps li { position: relative; padding: 0 0 22px 44px; cursor: pointer; }
.steps li::before {
  counter-increment: s; content: "0" counter(s); position: absolute; left: 0; top: 1px;
  font: 600 11px/1 var(--sans); letter-spacing: .14em; color: var(--muted);
  width: 30px; height: 22px; display: grid; place-items: center; border-radius: 6px; border: 1px solid var(--line-strong);
}
.steps li::after { content: ""; position: absolute; left: 15px; top: 28px; bottom: 4px; width: 1px; background: var(--line); }
.steps li:last-child::after { display: none; }
.steps li .t { font: 500 16px/1.3 var(--serif); color: var(--text-2); }
.steps li .d { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.steps li.active::before { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }
.steps li.active .t { color: var(--text); font-style: italic; }
.steps li.done::before { content: "✓"; color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }

/* ---------- editor ---------- */
.editor-shell { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-height: 560px; }
.editor-shell > * { min-width: 0; }
.editor-pane { display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface); }
.preview-pane { background: #e9e5dc; position: relative; }
.preview-pane iframe { width: 100%; height: 100%; border: 0; display: block; min-height: 560px; background: #fff; }
.toolbar { display: flex; gap: 2px; padding: 8px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--surface-2); }
.toolbar button { border: 0; background: none; color: var(--text-2); min-width: 30px; height: 30px; border-radius: 6px; cursor: pointer; font: 600 13px/1 var(--sans); padding: 0 8px; }
.toolbar button:hover { background: var(--line); color: var(--text); }
.toolbar .sep { width: 1px; background: var(--line); margin: 4px 4px; }
.rte { flex: 1; padding: 28px 32px; outline: none; overflow: auto; font: 17px/1.65 var(--serif); color: var(--text); }
.rte:empty::before { content: attr(data-placeholder); color: var(--muted); font-style: italic; }
.rte h1 { font-size: 28px; font-weight: 500; } .rte h2 { font-size: 21px; font-weight: 500; }
.rte a { color: var(--gold); }
.rte img { max-width: 100%; }
.rte blockquote { border-left: 2px solid var(--gold); margin-left: 0; padding-left: 16px; font-style: italic; }
.code-area { flex: 1; border: 0; border-radius: 0; background: var(--bg-deep); min-height: 520px; resize: none; padding: 18px; }
.code-area:focus { box-shadow: none; }
@media (max-width: 1100px) { .editor-shell { grid-template-columns: 1fr; } .editor-pane { border-right: 0; border-bottom: 1px solid var(--line); } }

/* ---------- lint ---------- */
.score { display: flex; align-items: center; gap: 18px; }
.ring { --p: 0; --c: var(--ok); width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0); position: relative; flex: none; }
.ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.ring b { position: relative; font: 600 22px/1 var(--serif); }
.checks { list-style: none; padding: 0; margin: 16px 0 0; }
.checks li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.checks .ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.checks .error .ic { background: var(--err-soft); color: var(--err); }
.checks .warn .ic { background: var(--warn-soft); color: var(--warn); }
.checks .info .ic { background: var(--info-soft); color: var(--info); }
.checks .pass .ic { background: var(--ok-soft); color: var(--ok); }
.checks .t { font-weight: 600; font-size: 14px; }
.checks .d { color: var(--text-2); font-size: 13px; }
.checks .f { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font: 600 10.5px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--label); padding: 12px 12px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
table.t td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:hover td { background: color-mix(in srgb, var(--surface) 60%, var(--line)); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--muted); vertical-align: 1px; }
.dot.ok { background: var(--ok); } .dot.err { background: var(--err); } .dot.warn { background: var(--warn); } .dot.info { background: var(--info); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 14px; color: var(--muted); font-size: 13px; }

/* ---------- stat summary tiles ---------- */
.tally { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tally > div { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; background: var(--surface-2); }
.tally .n { font: 600 24px/1.1 var(--serif); }
.tally .l { font-size: 12px; color: var(--muted); margin-top: 3px; }
.tally .ok .n { color: var(--ok); } .tally .err .n { color: var(--err); } .tally .warn .n { color: var(--warn); }
@media (max-width: 720px) { .tally { grid-template-columns: repeat(2, 1fr); } }

/* ---------- chart ---------- */
.chart { width: 100%; height: 200px; }
.chart .bar-o { fill: var(--gold); }
.chart .bar-c { fill: var(--info); }
.chart text { fill: var(--muted); font: 10.5px var(--sans); }
.chart line { stroke: var(--line); }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; font-size: 13px; margin-bottom: 12px; }
.hbar .track { grid-column: 1 / -1; height: 4px; background: var(--line); border-radius: 9px; overflow: hidden; }
.hbar .track span { display: block; height: 100%; background: var(--gold); }
.hbar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- callouts ---------- */
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 8px; border: 1px solid; font-size: 13.5px; }
.callout.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.callout.err { background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 30%, transparent); }
.callout.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.callout.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }

/* ---------- modal / preview window ---------- */
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(5, 10, 18, .72); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 24px; animation: fade .18s ease; }
.modal { background: var(--bg); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow); width: min(560px, 100%); max-height: calc(100vh - 48px); overflow: auto; animation: rise .22s cubic-bezier(.2,.8,.2,1); }
.modal.xl { width: min(1240px, 100%); height: calc(100vh - 48px); display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { flex: 1; }
.modal-body { padding: 22px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.985); } }

.pv { display: grid; grid-template-columns: 280px 1fr; flex: 1; min-height: 0; }
.pv-side { border-right: 1px solid var(--line); padding: 18px; overflow: auto; display: flex; flex-direction: column; gap: 18px; }
.pv-main { display: flex; flex-direction: column; min-height: 0; background: var(--bg-deep); }
.inbox { padding: 16px 22px; background: var(--surface); border-bottom: 1px solid var(--line); }
.inbox .from { display: flex; gap: 12px; align-items: center; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--gold-soft); color: var(--gold); display: grid; place-items: center; font: 600 15px/1 var(--serif); flex: none; }
.inbox .subj { font: 600 19px/1.3 var(--serif); margin: 12px 0 2px; }
.inbox .pre { color: var(--muted); font-size: 13px; }
.stage { flex: 1; overflow: auto; display: flex; justify-content: center; padding: 24px; }
.stage iframe { border: 0; background: #fff; width: 100%; max-width: 100%; height: 100%; min-height: 600px; border-radius: 6px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.4); transition: width .25s ease; }
.stage.mobile iframe { width: 390px; border-radius: 28px; border: 10px solid #1d2430; }
.stage pre { width: 100%; max-width: 720px; white-space: pre-wrap; background: var(--surface); padding: 24px; border-radius: 8px; font: 13px/1.6 var(--mono); color: var(--text); margin: 0; }
.rlist { display: flex; flex-direction: column; gap: 2px; max-height: 360px; overflow: auto; }
.rlist button { text-align: left; border: 0; background: none; color: var(--text-2); padding: 8px 10px; border-radius: 6px; cursor: pointer; font: 13px/1.35 var(--sans); }
.rlist button:hover { background: var(--line); }
.rlist button.active { background: var(--gold-soft); color: var(--text); }
.rlist button small { display: block; color: var(--muted); font-size: 11.5px; }
@media (max-width: 860px) { .pv { grid-template-columns: 1fr; } .pv-side { display: none; } }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--pill); color: var(--pill-text); padding: 11px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow); animation: rise .2s ease; max-width: 90vw; }
.toast.err { background: var(--err); color: #fff; }

/* ---------- footer ---------- */
.footer { background: var(--footer); padding: 64px 24px 40px; text-align: center; margin-top: 64px; }
.footer img { height: 54px; max-width: 80vw; }
.footer p { color: #6b7380; font-size: 12.5px; margin: 22px 0 0; letter-spacing: .02em; }

/* ---------- auth / public ---------- */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(400px, 100%); }
.public { background: #f3efe6; color: #142033; }
.public .card { background: #fff; border-color: rgba(15, 27, 44, .08); box-shadow: 0 30px 60px -30px rgba(15,27,44,.25); }

.kbd { font: 11px var(--mono); padding: 2px 6px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--muted); }
.link { color: var(--gold); text-decoration: none; }
.link:hover { text-decoration: underline; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
