/* =====================================================================
   AskProf design system
   Brand: bright blue + energetic orange. Fonts: Outfit (display) / Lexend.
   ===================================================================== */

:root {
  --primary: #1f7ae0;
  --primary-600: #1668c4;
  --primary-700: #0f5099;
  --primary-soft: #e9f2fd;
  --accent: #f7901e;
  --accent-600: #e07d0c;
  --accent-soft: #fef1e0;

  --ink: #16202c;
  --ink-soft: #475569;
  --muted: #8190a3;
  --line: #e4e9f0;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f1f5fa;

  --danger: #e23b4e;
  --danger-soft: #fdecee;
  --success: #18a558;
  --warn: #e8a317;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16, 32, 52, .06), 0 1px 3px rgba(16, 32, 52, .08);
  --shadow: 0 8px 30px rgba(16, 32, 52, .10);
  --shadow-lg: 0 18px 50px rgba(16, 32, 52, .18);

  --font-display: 'Outfit', system-ui, sans-serif;
  --font-body: 'Lexend', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .display { font-family: var(--font-display); font-weight: 700; line-height: 1.2; color: var(--ink); }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ----------------------------- Buttons ----------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: 15px;
  padding: 11px 20px; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; transition: transform .05s ease, background .15s ease, box-shadow .15s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); text-decoration: none; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-600); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.95); text-decoration: none; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ----------------------------- Brand ----------------------------- */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand img { height: 38px; width: auto; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 22px; }
.brand-name .ask { color: var(--primary); }
.brand-name .prof { color: var(--accent); }

/* ----------------------------- Top nav ----------------------------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.nav .brand img { height: 48px; }
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-links a.link { padding: 8px 12px; border-radius: 8px; color: var(--ink-soft); font-weight: 500; }
.nav-links a.link:hover { background: var(--surface-2); text-decoration: none; }

/* ----------------------------- Hero ----------------------------- */
.hero { padding: 84px 0 56px; text-align: center; }
.hero h1 { font-size: clamp(34px, 6vw, 60px); letter-spacing: -.02em; }
.hero .tagline { color: var(--accent-600); font-weight: 600; font-family: var(--font-display); font-size: clamp(18px, 3vw, 24px); margin: 6px 0 0; }
.hero p.lead { color: var(--ink-soft); font-size: clamp(16px, 2.2vw, 20px); max-width: 640px; margin: 18px auto 28px; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-art { margin: 44px auto 0; max-width: 320px; }

.badge-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px;
  background: var(--primary-soft); color: var(--primary-700); border-radius: 999px;
  font-weight: 600; font-size: 14px; margin-bottom: 18px;
}

/* Feature cards */
.features { padding: 30px 0 80px; }
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow-sm);
}
.card .ic {
  width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); font-size: 22px; margin-bottom: 14px;
}
.card.accent .ic { background: var(--accent-soft); color: var(--accent-600); }
.card h3 { font-size: 19px; margin: 0 0 6px; }
.card p { color: var(--ink-soft); margin: 0; }

.section-head { text-align: center; max-width: 620px; margin: 0 auto 36px; }
.section-head h2 { font-size: clamp(26px, 4vw, 38px); }
.section-head p { color: var(--ink-soft); }

/* CTA band */
.cta-band {
  background: linear-gradient(120deg, var(--primary), var(--primary-700));
  color: #fff; border-radius: 22px; padding: 48px; text-align: center; margin: 0 0 70px;
}
.cta-band h2 { color: #fff; font-size: clamp(24px, 4vw, 34px); }
.cta-band p { color: rgba(255, 255, 255, .85); max-width: 520px; margin: 8px auto 22px; }

footer.site { border-top: 1px solid var(--line); background: var(--surface); }
footer.site .container { padding-top: 26px; padding-bottom: 26px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 14px; }

/* Sponsor credit (ABICS) */
.sponsor-credit { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.sponsor-credit img { height: 34px; width: auto; display: block; }
.sponsor-credit b { color: var(--ink-soft); font-weight: 600; }
.sponsor-link {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: inherit;
  transition: opacity .15s;
}
.sponsor-link:hover { opacity: .7; }
.sponsor-link:hover b { text-decoration: underline; }

/* Sponsor band on the landing page (below the hero) */
.sponsor-band { padding: 6px 0 44px; text-align: center; }
.sponsor-band .label {
  display: block; font-size: 13px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 14px;
}
.sponsor-band .sponsor-row {
  display: inline-flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center;
  padding: 16px 28px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
a.sponsor-row { text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s; }
a.sponsor-row:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.sponsor-band img { height: 62px; width: auto; display: block; }
.sponsor-band .sponsor-name { text-align: left; }
.sponsor-band .sponsor-name b { display: block; font-family: var(--font-display); font-size: 17px; color: var(--ink); }
.sponsor-band .sponsor-name span { font-size: 14px; color: var(--ink-soft); }
@media (max-width: 560px) {
  .sponsor-band .sponsor-name { text-align: center; }
}
.auth-sponsor { text-align: center; margin-top: 22px; justify-content: center; font-size: 13px; }
.side-sponsor {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-top: 1px solid rgba(255,255,255,.08);
  font-size: 11px; color: #8296a9;
}
.side-sponsor b { color: #cdd8e4; font-weight: 600; }
.side-sponsor img { height: 18px; width: auto; display: block; background: #fff; border-radius: 4px; padding: 2px 5px; }
.side-sponsor .sponsor-link:hover { opacity: .85; }
.side-sponsor .sponsor-link:hover b { text-decoration: none; }

/* ----------------------------- Auth pages ----------------------------- */
.auth-wrap { min-height: 100%; display: grid; place-items: center; padding: 40px 20px; }
.auth-card {
  width: 100%; max-width: 430px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow); padding: 34px;
}
.auth-card h1 { font-size: 26px; margin: 14px 0 4px; }
.auth-card .sub { color: var(--ink-soft); margin: 0 0 22px; }
.auth-card .brand { margin-bottom: 6px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.input, textarea, select {
  width: 100%; font-family: var(--font-body); font-size: 15px; color: var(--ink);
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); transition: border .15s, box-shadow .15s;
}
.input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.auth-alt { text-align: center; margin-top: 18px; color: var(--ink-soft); font-size: 14px; }
.form-note { font-size: 13px; color: var(--muted); margin-top: 6px; }

.auth-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 16px; color: var(--muted); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.oauth-row { display: flex; gap: 10px; }
.oauth-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); font-weight: 600; font-size: 14px; color: var(--ink);
  font-family: var(--font-body); cursor: pointer; transition: background .15s, border-color .15s;
}
.oauth-btn:hover { background: var(--surface-2); border-color: var(--muted); }
.oauth-btn.loading { opacity: .6; pointer-events: none; }
@media (max-width: 420px) { .oauth-row { flex-direction: column; } }

/* Alerts / toasts */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; display: none; }
.alert.show { display: block; }
.alert-error { background: var(--danger-soft); color: #a3263a; border: 1px solid #f4c9cf; }
.alert-success { background: #e7f7ee; color: #137a43; border: 1px solid #bfe9d1; }

.toast-host { position: fixed; bottom: 22px; right: 22px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px;
  box-shadow: var(--shadow-lg); font-size: 14px; max-width: 320px; animation: pop .2s ease;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ----------------------------- Chat ----------------------------- */
.chat-shell { display: grid; grid-template-columns: 290px 1fr; height: 100dvh; }
.chat-side {
  background: #0e2233; color: #cdd8e4; display: flex; flex-direction: column; min-height: 0;
}
.chat-side .side-top { padding: 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.chat-side .brand-name { color: #fff; }
.chat-side .brand-name .ask { color: #6db1f5; }
.side-new {
  display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 14px;
  background: var(--primary); color: #fff; border: none; border-radius: 10px;
  padding: 11px; font-weight: 600; cursor: pointer; font-family: var(--font-body);
}
.side-new:hover { background: var(--primary-600); }
.side-list { flex: 1; overflow-y: auto; padding: 10px; min-height: 0; }
.side-list .empty { color: #6b8198; font-size: 13px; padding: 16px; text-align: center; }
.convo-item {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 10px 12px; border-radius: 9px; cursor: pointer; color: #c8d4e1;
  font-size: 14px; margin-bottom: 3px;
}
.convo-item:hover { background: rgba(255,255,255,.06); }
.convo-item.active { background: rgba(31,122,224,.22); color: #fff; }
.convo-item .ttl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.convo-del { opacity: 0; background: none; border: none; color: #9fb2c6; cursor: pointer; font-size: 15px; padding: 2px 4px; border-radius: 6px; }
.convo-item:hover .convo-del { opacity: 1; }
.convo-del:hover { color: #fff; background: rgba(255,255,255,.1); }
.side-foot { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-foot a { color: #9fc6f4; }

.chat-main { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.chat-topbar { display: none; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.hamburger { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; cursor: pointer; font-size: 16px; }

.messages { flex: 1; overflow-y: auto; padding: 26px 0; min-height: 0; }
.messages .container { max-width: 820px; }
.msg { display: flex; gap: 14px; margin-bottom: 26px; }
.msg .avatar { width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center; font-weight: 700; color: #fff; }
.msg.user .avatar { background: var(--accent); }
.msg.assistant .avatar { background: var(--primary); padding: 4px; }
.msg.assistant .avatar img { width: 100%; height: 100%; object-fit: contain; }
.msg .body { padding-top: 4px; min-width: 0; }
.msg .who { font-weight: 700; font-family: var(--font-display); margin-bottom: 2px; }
.msg .content { color: var(--ink); white-space: pre-wrap; word-wrap: break-word; }
.msg .content p { margin: 0 0 10px; }
.msg .content pre { background: #0e2233; color: #e6edf3; padding: 14px; border-radius: 10px; overflow-x: auto; font-size: 13px; }
.msg .content code { font-family: ui-monospace, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 13.5px; }
.msg .content pre code { background: none; padding: 0; }

/* User turns sit as a bubble on the right; assistant stays left, full-width
   for readability on long tutoring answers with code/math. */
.msg.user { flex-direction: row-reverse; }
.msg.user .body { max-width: 78%; }
.msg.user .who { text-align: right; }
.msg.user .content {
  display: inline-block; background: var(--primary-soft); color: var(--ink);
  padding: 10px 16px; border-radius: 16px 16px 4px 16px;
}
.msg.user .content p:last-child { margin-bottom: 0; }
.source-label { margin-top: 8px; font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.source-label .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.welcome { text-align: center; padding: 50px 16px; max-width: 640px; margin: 0 auto; }
.welcome img { width: 90px; margin: 0 auto 14px; }
.welcome h2 { font-size: 26px; }
.welcome p { color: var(--ink-soft); }
.suggest { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 26px; text-align: left; }
.suggest button {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  cursor: pointer; font-family: var(--font-body); font-size: 14px; color: var(--ink); transition: border .15s, box-shadow .15s;
}
.suggest button:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.suggest button b { display: block; font-family: var(--font-display); margin-bottom: 2px; }

.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing span { width: 7px; height: 7px; background: var(--muted); border-radius: 50%; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .3; } 40% { opacity: 1; } }

.composer { border-top: 1px solid var(--line); background: var(--surface); padding: 14px 0; }
.composer .container { max-width: 820px; }
.composer-box { display: flex; gap: 10px; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 8px 8px 8px 16px; box-shadow: var(--shadow-sm); }
.composer-box textarea { border: none; resize: none; padding: 8px 0; max-height: 180px; box-shadow: none; }
.composer-box textarea:focus { box-shadow: none; }
.send-btn { flex: none; width: 44px; height: 44px; border-radius: 12px; border: none; background: var(--primary); color: #fff; cursor: pointer; font-size: 18px; display: grid; place-items: center; }
.send-btn:hover { background: var(--primary-600); }
.send-btn:disabled { opacity: .5; cursor: not-allowed; }
.composer .hint { text-align: center; color: var(--muted); font-size: 12px; margin: 8px 0 0; }

/* sidebar overlay (mobile) */
.side-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 45; }

/* ----------------------------- Profile ----------------------------- */
.page { padding: 40px 0 80px; }
.page h1 { font-size: 30px; margin-bottom: 4px; }
.page .sub { color: var(--ink-soft); margin-bottom: 28px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; margin-bottom: 22px; box-shadow: var(--shadow-sm); }
.panel h2 { font-size: 19px; margin: 0 0 4px; }
.panel .panel-sub { color: var(--ink-soft); font-size: 14px; margin: 0 0 18px; }
.panel.danger { border-color: #f4c9cf; }

/* ----------------------------- Legal pages ----------------------------- */
.legal { max-width: 760px; }
.legal .updated { color: var(--muted); font-size: 14px; margin-bottom: 32px; }
.legal h2 { font-size: 20px; margin: 34px 0 10px; }
.legal h2:first-of-type { margin-top: 0; }
.legal p { margin: 0 0 14px; color: var(--ink-soft); line-height: 1.7; }
.legal ul { margin: 0 0 14px; padding-left: 22px; color: var(--ink-soft); line-height: 1.7; }
.legal li { margin-bottom: 6px; }
.legal a { color: var(--primary); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ----------------------------- Admin ----------------------------- */
.admin-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100dvh; }
.admin-side { background: #0e2233; color: #c4d2e0; display: flex; flex-direction: column; }
.admin-side .a-top { padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.admin-side .a-top .tag { font-size: 12px; color: var(--accent); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.admin-nav { padding: 12px; flex: 1; }
.admin-nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: none; color: #b7c6d6; padding: 11px 13px; border-radius: 9px;
  cursor: pointer; font-family: var(--font-body); font-size: 14.5px; margin-bottom: 2px;
}
.admin-nav button:hover { background: rgba(255,255,255,.06); color: #fff; }
.admin-nav button.active { background: var(--primary); color: #fff; }
.admin-side .a-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.admin-side .a-foot a { color: #9fc6f4; }

.admin-main { background: var(--bg); min-height: 100dvh; overflow-x: hidden; }
.admin-bar { background: var(--surface); border-bottom: 1px solid var(--line); padding: 16px 28px; display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 20; }
.admin-bar h1 { font-size: 21px; }
.admin-content { padding: 28px; }

.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 26px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.stat .k { color: var(--ink-soft); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-family: var(--font-display); font-size: 34px; font-weight: 800; margin-top: 6px; }
.stat .v.blue { color: var(--primary); }
.stat .v.orange { color: var(--accent-600); }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .input { max-width: 320px; }
.spacer { flex: 1; }

table.tbl { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.tbl th, table.tbl td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
table.tbl th { background: var(--surface-2); font-family: var(--font-display); font-size: 13px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: var(--surface-2); }
.tbl-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.tag-chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag-chip.ok { background: #e7f7ee; color: #137a43; }
.tag-chip.bad { background: var(--danger-soft); color: #a3263a; }
.tag-chip.warn { background: var(--accent-soft); color: var(--accent-600); }
.tag-chip.muted { background: var(--surface-2); color: var(--ink-soft); }
.tag-chip.blue { background: var(--primary-soft); color: var(--primary-700); }

.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); margin-bottom: 26px; }
.chart-card h3 { margin: 0 0 16px; font-size: 17px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 200px; }
.bars .bar { flex: 1; background: linear-gradient(var(--primary), #5aa2ee); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; transition: opacity .15s; }
.bars .bar:hover { opacity: .8; }
.bars .bar .tip { display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 11px; padding: 3px 7px; border-radius: 6px; white-space: nowrap; margin-bottom: 4px; }
.bars .bar:hover .tip { display: block; }
.bars-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 8px; }

.empty-state { text-align: center; color: var(--muted); padding: 50px 20px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Modal */
.modal-host { position: fixed; inset: 0; background: rgba(10,20,32,.5); z-index: 90; display: none; place-items: center; padding: 20px; }
.modal-host.show { display: grid; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 640px; max-height: 86vh; overflow: auto; }
.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; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.x-btn { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
@media (max-width: 480px) {
  .modal-foot { flex-direction: column; align-items: stretch; }
  .modal-foot .btn { width: 100%; }
}

.transcript .t-msg { margin-bottom: 16px; }
.transcript .t-role { font-weight: 700; font-family: var(--font-display); font-size: 13px; margin-bottom: 3px; }
.transcript .t-role.user { color: var(--accent-600); }
.transcript .t-role.assistant { color: var(--primary); }
.transcript .t-content { white-space: pre-wrap; background: var(--surface-2); padding: 12px 14px; border-radius: 10px; font-size: 14px; }

.toggle { position: relative; display: inline-block; width: 46px; height: 26px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .track { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: .2s; cursor: pointer; }
.toggle .track::before { content: ''; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: var(--shadow-sm); }
.toggle input:checked + .track { background: var(--success); }
.toggle input:checked + .track::before { transform: translateX(20px); }

.coming-soon { position: relative; }
.coming-soon::after { content: 'Coming Soon'; position: absolute; top: 18px; right: 18px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px; }

.loading-row { text-align: center; color: var(--muted); padding: 30px; }

/* ----------------------------- Responsive ----------------------------- */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: 1fr 1fr; }

  .chat-shell { grid-template-columns: 1fr; }
  .chat-side {
    position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 50;
    transform: translateX(-100%); transition: transform .25s ease;
  }
  .chat-side.open { transform: translateX(0); }
  .side-overlay.show { display: block; }
  .chat-topbar { display: flex; }

  .admin-shell { grid-template-columns: 1fr; }
  .admin-side {
    position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 50;
    transform: translateX(-100%); transition: transform .25s ease;
  }
  .admin-side.open { transform: translateX(0); }
  .admin-content { padding: 18px; }
  .admin-bar { padding: 14px 18px; }
}

@media (max-width: 560px) {
  .nav-links a.link { display: none; }
  .stat-cards { grid-template-columns: 1fr; }
  .suggest { grid-template-columns: 1fr; }
  .cta-band { padding: 32px 20px; }
  table.tbl { font-size: 13px; }
  table.tbl th, table.tbl td { padding: 10px; }
}

/* ----------------------------- Feature: search ----------------------------- */
.side-search { padding: 8px 12px 4px; }
.side-search-input { width: 100%; font-size: 13px; padding: 7px 11px; border-radius: 8px; }

/* ----------------------------- Feature: share ----------------------------- */
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }
.topbar-btn {
  display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px; font-size: 13px;
  font-family: var(--font-body); font-weight: 600; cursor: pointer; color: var(--ink-soft);
  transition: background .15s;
}
.topbar-btn:hover { background: var(--line); color: var(--ink); }
.share-link-row { display: flex; gap: 8px; }
.share-link-row .input { flex: 1; font-size: 13px; }
.convo-shared-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); flex: none; margin-right: 2px; }

/* ----------------------------- Feature: feedback ----------------------------- */
.feedback-row { display: flex; gap: 6px; margin-top: 8px; }
.thumb-btn {
  background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 10px; font-size: 14px; cursor: pointer; transition: background .12s, border-color .12s;
  color: var(--ink-soft); line-height: 1.4;
}
.thumb-btn:hover { background: var(--surface-2); }
.thumb-btn.up.active  { background: #e7f7ee; border-color: #a3d9b8; }
.thumb-btn.down.active { background: var(--danger-soft); border-color: #f4b8c0; }

/* ----------------------------- Feature: follow-up chips ----------------------------- */
.followup-chips { padding: 8px 0 4px; display: flex; flex-wrap: wrap; gap: 8px; max-width: 820px; margin: 0 auto; }
.followup-chip {
  background: var(--primary-soft); color: var(--primary-700); border: 1px solid #c5ddf7;
  border-radius: 999px; padding: 6px 14px; font-size: 13px; font-family: var(--font-body);
  cursor: pointer; transition: background .12s;
}
.followup-chip:hover { background: #d6eafb; }

/* ----------------------------- Feature: image upload ----------------------------- */
.img-btn {
  flex: none; background: none; border: none; cursor: pointer; padding: 6px;
  color: var(--muted); border-radius: 8px; display: grid; place-items: center;
  transition: color .15s, background .15s;
}
.img-btn:hover { color: var(--primary); background: var(--primary-soft); }
.img-preview-wrap { padding: 0 0 8px; }
.img-preview-inner { position: relative; display: inline-block; }
.img-preview-inner img { max-height: 140px; max-width: 260px; border-radius: 10px; border: 1px solid var(--line); display: block; }
.img-remove {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px;
  background: var(--ink); color: #fff; border: none; border-radius: 50%;
  font-size: 14px; cursor: pointer; display: grid; place-items: center; line-height: 1;
}

/* ----------------------------- Feature: subject profile ----------------------------- */
.subject-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.subject-tag {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft);
  border-radius: 999px; padding: 6px 14px; font-size: 13px; font-family: var(--font-body);
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.subject-tag:hover { border-color: var(--primary); color: var(--primary); }
.subject-tag.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-700); font-weight: 600; }

/* ----------------------------- Feature: shared page ----------------------------- */
.shared-transcript { margin-bottom: 36px; }
.shared-msg { display: flex; gap: 14px; margin-bottom: 22px; }
.shared-avatar { font-size: 24px; flex: none; padding-top: 2px; }
.shared-body { flex: 1; min-width: 0; }
.shared-who { font-family: var(--font-display); font-size: 13px; font-weight: 700; margin-bottom: 4px; color: var(--ink-soft); }
.shared-msg.user .shared-who { color: var(--accent-600); }
.shared-msg.assistant .shared-who { color: var(--primary); }
.shared-content { font-size: 15px; line-height: 1.7; }
.shared-cta { text-align: center; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.shared-cta p { color: var(--ink-soft); margin-bottom: 18px; }

.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.muted { color: var(--muted); }
.show-mobile { display: none; }
@media (max-width: 900px) { .show-mobile { display: inline-flex; } }
