/* ============================================================================
   TwoAP Design System — brand: "Two Perspectives. A Better Path."
   Palette: Deep Plum #4B0E2C · Seduction Pink #E91E63 · Passion Rose #FF5E8A
            Soft Blush #FFC1D6 · Cream #FFF2F5 · Obsidian #0D0D12
   Typography: Playfair Display (headings) · Inter (body) — self-hosted.
   Dark-first: obsidian is the default theme; data-theme="light" opts into
   the cream theme. Zero external dependencies.
   ========================================================================== */

/* ----------------------------- Fonts ------------------------------------- */
@font-face {
  font-family: "Playfair Display"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/playfair-display-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Playfair Display"; font-style: normal; font-weight: 800; font-display: swap;
  src: url("../fonts/playfair-display-latin-800-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/inter-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../fonts/inter-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/inter-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/inter-latin-700-normal.woff2") format("woff2");
}

/* ----------------------------- Tokens ----------------------------------- */
:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  /* Brand constants */
  --plum: #4B0E2C;
  --pink: #E91E63;
  --rose: #FF5E8A;
  --blush: #FFC1D6;
  --cream: #FFF2F5;
  --obsidian: #0D0D12;

  --accent: var(--pink);
  --accent-hover: #FF3D74;
  --accent-soft: rgba(233, 30, 99, .14);
  --grad: linear-gradient(100deg, #E91E63, #FF5E8A);
  --good: #34c98e;
  --warn: #e8a13c;
  --bad: #ff5470;

  --radius: 14px;
  --radius-sm: 9px;
  --transition: .16s ease;

  /* Dark (default — brand is dark-first) */
  --bg: #0D0D12;
  --surface: #16111A;
  --surface-2: #1E1522;
  --surface-3: #2A1B2E;
  --border: #2B1E30;
  --border-strong: #432C46;
  --ink: #F6ECF1;
  --ink-2: #C9B3BF;
  --ink-3: #8D7787;
  --ink-invert: #0D0D12;
  --code-bg: #1A1320;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 28px rgba(0, 0, 0, .45);
  --shadow-lg: 0 6px 16px rgba(0, 0, 0, .55), 0 30px 70px rgba(75, 14, 44, .45);
  --glow: 0 0 44px rgba(233, 30, 99, .18);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #FFF7F9;
  --surface: #FFFFFF;
  --surface-2: #FBEFF3;
  --surface-3: #F6E2E9;
  --border: #F0DCE4;
  --border-strong: #DDBCCA;
  --ink: #2E1020;
  --ink-2: #6E4A5C;
  --ink-3: #A48492;
  --ink-invert: #FFFFFF;
  --code-bg: #FBEFF3;
  --shadow: 0 1px 2px rgba(75, 14, 44, .07), 0 8px 24px rgba(75, 14, 44, .08);
  --shadow-lg: 0 6px 14px rgba(75, 14, 44, .12), 0 28px 64px rgba(75, 14, 44, .16);
  --glow: 0 0 44px rgba(233, 30, 99, .10);
  --accent-soft: rgba(233, 30, 99, .10);
  --good: #14894e;
  --warn: #b0680a;
  --bad: #d1244a;
  color-scheme: light;
}

/* ----------------------------- Base -------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}
a { color: var(--rose); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { font-family: inherit; }
::selection { background: rgba(233, 30, 99, .35); }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; font-weight: 700; letter-spacing: 0; }
h4, h5 { line-height: 1.3; font-weight: 700; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: .92em; }
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-pink { color: var(--pink); }

/* ----------------------------- Buttons ----------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
  text-decoration: none !important;
}
.btn-primary { background: var(--pink); color: #fff; box-shadow: 0 4px 18px rgba(233, 30, 99, .35); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 24px rgba(233, 30, 99, .5); }
.btn-secondary { background: transparent; color: var(--rose); border-color: var(--pink); }
.btn-secondary:hover { background: var(--accent-soft); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: rgba(255, 84, 112, .1); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 14px 30px; font-size: 16px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-block { width: 100%; }

/* ----------------------------- Forms -------------------------------------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 14px 0 5px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="url"], input[type="search"], select, textarea {
  width: 100%; padding: 10px 14px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--pink); box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 90px; }
input[type="range"] { width: 100%; accent-color: var(--pink); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--pink); width: 16px; height: 16px; }
.field-hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); font-weight: 400; margin: 8px 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 999px; cursor: pointer;
  background: var(--surface-3); border: 1px solid var(--border-strong); transition: var(--transition);
}
.switch .slider::before {
  content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: var(--transition);
}
.switch input:checked + .slider { background: var(--pink); border-color: var(--pink); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ----------------------------- Cards & layout ----------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.card + .card { margin-top: 16px; }
.card-title { font-size: 17px; margin-bottom: 4px; font-family: var(--font-display); }
.card-sub { font-size: 13px; color: var(--ink-3); margin-bottom: 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-tile .label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }
.stat-tile .value { font-size: 28px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-tile .delta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border);
}
.badge-accent { background: var(--accent-soft); color: var(--rose); border-color: transparent; }
.badge-good { background: rgba(52, 201, 142, .14); color: var(--good); border-color: transparent; }
.badge-warn { background: rgba(232, 161, 60, .16); color: var(--warn); border-color: transparent; }
.badge-bad { background: rgba(255, 84, 112, .14); color: var(--bad); border-color: transparent; }

/* Chips (brand tag style) */
.chip-tag {
  display: inline-flex; padding: 4px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--border-strong); color: var(--ink-2); background: transparent;
}

/* Flash messages */
.flash { padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; border: 1px solid; }
.flash-success { background: rgba(52, 201, 142, .1); border-color: rgba(52, 201, 142, .35); color: var(--good); }
.flash-error { background: rgba(255, 84, 112, .09); border-color: rgba(255, 84, 112, .32); color: var(--bad); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; padding: 10px 14px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: var(--surface-2); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(13, 13, 18, .72); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 100; overflow-y: auto;
}
.modal {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px;
  width: 100%; max-width: 680px; padding: 28px; box-shadow: var(--shadow-lg);
}
.modal h3 { margin-bottom: 4px; }

/* Toast */
#toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--pink); color: #fff; padding: 10px 20px; border-radius: 999px; font-size: 14px;
  box-shadow: var(--shadow-lg); animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ============================ Marketing =================================== */
.mk-header {
  position: sticky; top: 0; z-index: 50; backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 80%, transparent); border-bottom: 1px solid var(--border);
}
.mk-header .inner { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 21px; color: var(--ink); text-decoration: none !important; font-family: var(--font-display); }
.logo .ap { color: var(--pink); }
.logo svg { flex-shrink: 0; }
.mk-nav { display: flex; align-items: center; gap: 6px; }
.mk-nav a.nav-link { color: var(--ink-2); font-size: 14px; font-weight: 500; padding: 8px 12px; border-radius: 8px; }
.mk-nav a.nav-link:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }

.hero { text-align: center; padding: 96px 0 64px; position: relative; }
.hero::before {
  content: ""; position: absolute; inset: -120px 0 auto; height: 480px; pointer-events: none;
  background: radial-gradient(560px 300px at 50% 10%, rgba(233, 30, 99, .16), transparent 70%);
}
.hero > * { position: relative; }
.hero .eyebrow { display: inline-block; font-size: 13px; font-weight: 600; color: var(--rose); background: var(--accent-soft); padding: 6px 16px; border-radius: 999px; margin-bottom: 24px; }
.hero h1 { font-size: clamp(36px, 6.2vw, 62px); max-width: 820px; margin: 0 auto 18px; font-weight: 800; }
.hero h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 18px; color: var(--ink-2); max-width: 600px; margin: 0 auto 34px; }
.hero .cta-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero .trust-row { display: flex; gap: 26px; justify-content: center; flex-wrap: wrap; margin-top: 40px; font-size: 13px; color: var(--ink-3); }
.hero .trust-row span { display: inline-flex; align-items: center; gap: 7px; }
.hero .trust-row svg { color: var(--rose); }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; padding: 24px 0 72px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 28px; transition: border-color var(--transition), transform var(--transition); }
.feature:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.feature .icon { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--rose); display: grid; place-items: center; margin-bottom: 16px; }
.feature h3 { font-size: 17px; margin-bottom: 6px; }
.feature p { font-size: 14px; color: var(--ink-2); }

.section-title { text-align: center; padding: 44px 0 8px; }
.section-title h2 { font-size: clamp(26px, 4vw, 38px); }
.section-title h2 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.section-title p { color: var(--ink-2); margin-top: 10px; max-width: 560px; margin-inline: auto; }

.demo-panel {
  max-width: 780px; margin: 40px auto 84px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 20px; box-shadow: var(--shadow-lg), var(--glow); overflow: hidden;
}
.demo-panel .bar { display: flex; gap: 6px; padding: 13px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); align-items: center; }
.demo-panel .bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.demo-panel .bar .t { margin-left: 10px; font-size: 12.5px; color: var(--ink-3); }
.demo-panel .body { padding: 24px; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.persp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 620px) { .persp-grid { grid-template-columns: 1fr; } }
.persp {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px; font-size: 13.5px; color: var(--ink-2);
  background: var(--surface-2);
}
.persp b { display: flex; gap: 8px; align-items: center; color: var(--ink); font-size: 13px; margin-bottom: 6px; }
.persp b .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pink); }
.persp.theirs b .dot { background: var(--blush); }
.insight-row { border-left: 3px solid var(--pink); background: var(--surface-2); border-radius: 0 10px 10px 0; padding: 11px 14px; font-size: 13.5px; color: var(--ink-2); }
.insight-row b { color: var(--rose); }

.prose { max-width: 760px; margin: 0 auto; padding: 48px 0 80px; }
.prose h1 { font-size: 34px; margin-bottom: 8px; }
.prose h2 { font-size: 21px; margin: 32px 0 10px; }
.prose p, .prose li { color: var(--ink-2); margin-bottom: 12px; }
.prose ul { padding-left: 22px; }

.mk-footer { border-top: 1px solid var(--border); padding: 38px 0; margin-top: 20px; }
.mk-footer .inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink-3); }
.mk-footer a { color: var(--ink-3); margin-left: 16px; }

/* ============================ Auth pages ================================== */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; position: relative; }
.auth-wrap::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(480px 320px at 50% 0%, rgba(233, 30, 99, .12), transparent 70%);
}
.auth-card { width: 100%; max-width: 404px; position: relative; }
.auth-card .card { padding: 32px; border-radius: 20px; box-shadow: var(--shadow-lg); }
.auth-card .logo { justify-content: center; margin-bottom: 24px; }
.auth-card h1 { font-size: 22px; text-align: center; margin-bottom: 4px; }
.auth-card .sub { text-align: center; font-size: 14px; color: var(--ink-3); margin-bottom: 18px; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 12px; margin: 18px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-foot { text-align: center; font-size: 14px; color: var(--ink-2); margin-top: 18px; }
.btn-google { width: 100%; background: var(--surface-2); border-color: var(--border-strong); color: var(--ink); border-radius: 999px; }
.btn-google:hover { background: var(--surface-3); }

/* ============================ App shell =================================== */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 292px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh;
}
.sidebar-head { padding: 16px 16px 10px; display: flex; align-items: center; justify-content: space-between; }
.sidebar-section { padding: 4px 10px 10px; overflow-y: auto; flex: 1; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }
.new-chat-btn { margin: 6px 16px 10px; }

.conv-filters { display: flex; gap: 4px; padding: 0 16px 10px; flex-wrap: wrap; }
.conv-filters button {
  border: 0; background: transparent; color: var(--ink-3); font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
}
.conv-filters button.active { background: var(--accent-soft); color: var(--rose); }
.conv-search { padding: 0 16px 10px; }

.conv-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px;
  color: var(--ink-2); font-size: 14px; cursor: pointer; text-decoration: none !important;
  border: 1px solid transparent;
}
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--accent-soft); color: var(--ink); }
.conv-item .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .pin { color: var(--rose); font-size: 11px; }
.conv-item .kebab { opacity: 0; border: 0; background: transparent; color: var(--ink-3); cursor: pointer; font-size: 16px; padding: 0 4px; border-radius: 6px; }
.conv-item:hover .kebab { opacity: 1; }
.folder-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); padding: 12px 10px 4px; display: flex; justify-content: space-between; align-items: center; }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
.user-chip:hover { background: var(--surface-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 700; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

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

/* Chat area */
.chat-main { flex: 1; display: flex; flex-direction: column; height: 100vh; }
.chat-topbar { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--surface); }
.chat-topbar .title { font-weight: 600; font-size: 15px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-scroll { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.chat-inner { max-width: 820px; margin: 0 auto; padding: 28px 20px 10px; display: flex; flex-direction: column; gap: 22px; }

.msg { display: flex; gap: 12px; }
.msg .who { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.msg.user .who { background: var(--surface-3); color: var(--ink-2); }
.msg.assistant .who { background: var(--grad); color: #fff; }
.msg .bubble { min-width: 0; flex: 1; }
.msg .meta { font-size: 12px; color: var(--ink-3); margin-bottom: 3px; display: flex; gap: 10px; align-items: center; }
.msg.user .content { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px; white-space: pre-wrap; word-wrap: break-word; }
.msg .content img.att { max-height: 220px; border-radius: 10px; border: 1px solid var(--border); margin-top: 8px; display: block; }
.msg .actions { display: flex; gap: 4px; margin-top: 6px; opacity: 0; transition: opacity var(--transition); }
.msg:hover .actions { opacity: 1; }
.msg .actions button { border: 0; background: transparent; color: var(--ink-3); cursor: pointer; font-size: 13px; padding: 3px 7px; border-radius: 6px; }
.msg .actions button:hover { background: var(--surface-2); color: var(--ink); }
.msg .actions button.on { color: var(--rose); }

.typing-dots { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--rose); animation: bounce 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Markdown content */
.md { word-wrap: break-word; }
.md p { margin-bottom: 10px; }
.md h1, .md h2, .md h3 { margin: 16px 0 8px; font-size: 16px; font-family: var(--font); font-weight: 700; }
.md h1 { font-size: 18px; }
.md strong { font-weight: 700; color: var(--ink); }
.md ul, .md ol { padding-left: 22px; margin-bottom: 10px; }
.md li { margin-bottom: 3px; }
.md blockquote { border-left: 3px solid var(--pink); padding: 4px 14px; color: var(--ink-2); background: var(--surface-2); border-radius: 0 8px 8px 0; margin-bottom: 10px; }
.md code { font-family: var(--mono); font-size: .88em; background: var(--code-bg); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
.md pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; padding: 14px; overflow-x: auto; margin-bottom: 12px; }
.md pre code { border: 0; background: transparent; padding: 0; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.md table { border-collapse: collapse; margin-bottom: 12px; font-size: 14px; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; }

/* Composer */
.composer-wrap { border-top: 1px solid var(--border); background: var(--surface); padding: 14px 20px 10px; }
.composer { max-width: 820px; margin: 0 auto; }
.composer .box {
  display: flex; flex-direction: column; background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 18px; padding: 10px 14px; transition: border-color var(--transition), box-shadow var(--transition);
}
.composer .box:focus-within { border-color: var(--pink); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea {
  border: 0; background: transparent; padding: 4px 2px; min-height: 24px; max-height: 220px;
  font-size: 15px; box-shadow: none !important; outline: none !important;
}
.composer .row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.composer .row .spacer { flex: 1; }
.icon-btn {
  border: 0; background: transparent; color: var(--ink-3); width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; cursor: pointer; font-size: 17px;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.send-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--pink); color: #fff; display: grid; place-items: center; cursor: pointer; font-size: 16px; box-shadow: 0 3px 14px rgba(233, 30, 99, .4); }
.send-btn:hover { background: var(--accent-hover); }
.send-btn[disabled] { opacity: .4; cursor: not-allowed; box-shadow: none; }
.composer .foot { text-align: center; font-size: 11.5px; color: var(--ink-3); padding-top: 8px; }
.attach-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.attach-preview .chip { position: relative; }
.attach-preview img { height: 56px; border-radius: 8px; border: 1px solid var(--border); display: block; }
.attach-preview .x { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--pink); color: #fff; border: 0; font-size: 11px; cursor: pointer; line-height: 1; }

/* Memory suggestion chips */
.memory-suggest { max-width: 820px; margin: 0 auto 8px; display: flex; flex-direction: column; gap: 6px; }
.memory-suggest .chip {
  display: flex; align-items: center; gap: 10px; background: var(--accent-soft); border: 1px solid transparent;
  border-radius: 12px; padding: 9px 14px; font-size: 13px; color: var(--ink);
}
.memory-suggest .chip b { color: var(--rose); }
.memory-suggest .chip .grow { flex: 1; }
.memory-suggest .chip button { font-size: 12px; }

/* Empty state */
.empty-state { max-width: 660px; margin: 7vh auto 0; text-align: center; padding: 0 20px; }
.empty-state h2 { font-size: 30px; margin-bottom: 10px; }
.empty-state h2 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.empty-state p { color: var(--ink-2); margin-bottom: 26px; }
.starter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: left; }
@media (max-width: 600px) { .starter-grid { grid-template-columns: 1fr; } }
.starter {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 15px;
  font-size: 13.5px; color: var(--ink-2); cursor: pointer; transition: border-color var(--transition), transform var(--transition);
}
.starter:hover { border-color: var(--pink); transform: translateY(-1px); }
.starter b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 3px; }
.starter b .ico { color: var(--rose); margin-right: 6px; }

/* ============================ Settings / Admin ============================ */
.page-shell { flex: 1; }
.page-head { padding: 26px 0 14px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 26px; }
.subnav { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; }
.subnav a {
  padding: 9px 14px; font-size: 14px; font-weight: 500; color: var(--ink-3); border-bottom: 2px solid transparent;
  white-space: nowrap; text-decoration: none !important;
}
.subnav a:hover { color: var(--ink); }
.subnav a.active { color: var(--rose); border-bottom-color: var(--pink); }

.admin-shell { display: flex; min-height: 100vh; }
.admin-nav {
  width: 234px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
  padding: 16px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-nav .logo { padding: 0 8px 14px; font-size: 17px; }
.admin-nav .group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); padding: 14px 10px 4px; }
.admin-nav a.item {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 9px;
  color: var(--ink-2); font-size: 13.5px; font-weight: 500; text-decoration: none !important;
}
.admin-nav a.item:hover { background: var(--surface-2); color: var(--ink); }
.admin-nav a.item.active { background: var(--accent-soft); color: var(--rose); }
.admin-main { flex: 1; min-width: 0; padding: 0 28px 60px; }

/* Charts (in-house SVG, brand pink series) */
.chart-box { position: relative; }
.chart-box svg { display: block; width: 100%; height: auto; }
.chart-box .grid-line { stroke: var(--border); stroke-width: 1; }
.chart-box .axis-label { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.chart-box .series-line { fill: none; stroke: var(--pink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart-box .series-area { fill: rgba(233, 30, 99, .12); }
.chart-box .hover-dot { fill: var(--pink); stroke: var(--surface); stroke-width: 2; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--plum); color: #FFF2F5;
  font-size: 12px; padding: 5px 10px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, -130%);
  display: none; z-index: 5; border: 1px solid var(--pink);
}
.hbar-row { display: grid; grid-template-columns: 150px 1fr 52px; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 7px; }
.hbar-row .name { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-row .track { background: var(--surface-2); border-radius: 4px; height: 14px; overflow: hidden; }
.hbar-row .fill { background: var(--pink); height: 100%; border-radius: 4px; min-width: 2px; }
.hbar-row .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* Live dashboard */
.pulse { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--good); margin-right: 7px; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52,201,142,.5);} 70% { box-shadow: 0 0 0 8px rgba(52,201,142,0);} 100% { box-shadow: 0 0 0 0 rgba(52,201,142,0);} }
.live-feed { max-height: 420px; overflow-y: auto; font-size: 13px; }
.live-feed .row { display: flex; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--border); }
.live-feed .t { color: var(--ink-3); font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* Question builder */
.qb-list { display: flex; flex-direction: column; gap: 8px; }
.qb-item {
  display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px;
}
.qb-item.dragging { opacity: .5; }
.qb-item .drag { cursor: grab; color: var(--ink-3); font-size: 16px; }
.qb-item .info { flex: 1; min-width: 0; }
.qb-item .info .l1 { font-weight: 600; font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qb-item .info .l2 { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qb-item.disabled-q { opacity: .55; }
.qb-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.qb-toolbar input[type="search"] { max-width: 260px; }

/* Print view */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; color: #000; }
}

/* Responsive app shell */
.sidebar-toggle { display: none; }
@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 60; left: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: grid; }
  .admin-nav { position: fixed; z-index: 60; transform: translateX(-100%); transition: transform .2s ease; }
  .admin-nav.open { transform: translateX(0); }
  .admin-main { padding: 0 16px 60px; }
}
