/* ─────────────────────────────────────────────────────────────────────────────
   AI Health Assistant Study: visual design
   One fixed light theme on purpose: every participant must see an identical
   interface (experimental control), regardless of their OS dark-mode setting.
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  color-scheme: light;
  --bg: #f4f5fb;
  --bg-glow: #e9e7ff;
  --surface: #ffffff;
  --surface-2: #f8f8fd;
  --ink: #1b1d3a;
  --ink-2: #3a3e63;
  --muted: #6a6f93;
  --line: #e3e5f1;
  --line-strong: #cfd2e6;

  --brand: #4f46e5;
  --brand-ink: #3730a3;
  --brand-soft: #eef0ff;
  --teal: #0d9488;

  --night-1: #14123a;
  --night-2: #23206a;
  --night-3: #3b36a8;
  --moon: #c7d2fe;

  --good: #0f9f6e;
  --attention: #e07a2f;

  --warn-ink: #8a4b06;
  --warn-bg: #fff8eb;
  --warn-line: #f3cf8e;

  --danger: #c2410c;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(27, 29, 58, .06);
  --shadow: 0 1px 2px rgba(27, 29, 58, .05), 0 8px 24px -8px rgba(27, 29, 58, .12);
  --shadow-lg: 0 24px 60px -12px rgba(20, 18, 58, .35);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --topbar-h: 58px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 85% -10%, var(--bg-glow), transparent 60%),
    radial-gradient(900px 400px at -10% 0%, #e3f6f4, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; letter-spacing: -0.01em; }
h1 { font-size: 1.7rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 700; margin-top: 1.4em; }
p { margin: 0 0 .9em; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; border-radius: 6px; }

/* ── Boot loader ─────────────────────────────────────────────────────────── */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; color: var(--muted); gap: 14px; }
.boot-moon { width: 46px; height: 46px; border-radius: 50%; box-shadow: inset -12px -6px 0 0 var(--brand); animation: spin 1.6s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Top bar & progress ─────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 clamp(16px, 3vw, 28px);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); }
.brand-dot {
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff 0 18%, transparent 19%), linear-gradient(135deg, var(--night-3), var(--night-1));
  box-shadow: inset -7px -3px 0 0 var(--moon), 0 0 0 3px var(--brand-soft);
}
.test-badge { font-size: .75rem; font-weight: 700; letter-spacing: .04em; background: #fde68a; color: #713f12; padding: 4px 10px; border-radius: 999px; }
.progress { height: 4px; background: var(--line); position: sticky; top: var(--topbar-h); z-index: 19; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--teal), var(--brand)); border-radius: 0 4px 4px 0; transition: width .5s ease; }

/* ── Content pages ──────────────────────────────────────────────────────── */
.page { max-width: 820px; margin: 0 auto; padding: clamp(20px, 4vw, 48px) 16px 80px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 44px);
}
.lead { font-size: 1.05rem; color: var(--ink-2); }
.prose ul { padding-left: 1.2em; }
.prose li { margin: .35em 0; }
.placeholder-flag { background: #fef3c7; color: #78350f; border-radius: 8px; padding: 8px 12px; font-size: .88rem; font-weight: 600; }
.consent-statement { margin-top: 1.6em; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.checklist { list-style: none; padding: 0 !important; }
.checklist li { position: relative; padding: 12px 14px 12px 46px; margin: 10px 0 !important; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.checklist li::before {
  content: ""; position: absolute; left: 14px; top: 15px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3 3 7-7' stroke='white' stroke-width='2.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat;
}

.actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.error-banner { margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: #fff1ec; color: var(--danger); border: 1px solid #fbc9b3; font-weight: 600; font-size: .95rem; }

/* ── Buttons & inputs ───────────────────────────────────────────────────── */
.btn {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  font: inherit; font-weight: 700; font-size: .98rem;
  padding: 12px 22px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
  transition: transform .08s ease, box-shadow .2s ease, background .2s ease, opacity .2s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--brand), #6d5df6); color: #fff; box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .6); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 22px -8px rgba(79, 70, 229, .75); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line-strong); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-sm { padding: 8px 14px; font-size: .88rem; border-radius: 10px; }
.btn-block { width: 100%; }
.linklike { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--brand); cursor: pointer; }
.linklike:hover { text-decoration: underline; }

.input {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 12px;
  padding: 11px 14px; transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.input-short { max-width: 180px; }
textarea.input { resize: vertical; min-height: 90px; }
.field { display: block; margin-top: 18px; }
.field-label { display: block; font-weight: 700; margin-bottom: 6px; }

/* ── Survey items ───────────────────────────────────────────────────────── */
.survey { margin-top: 8px; }
.q { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 20px; margin: 0 0 16px; background: var(--surface); transition: border-color .2s, box-shadow .2s; }
.q.missing { border-color: #f4a582; box-shadow: 0 0 0 4px #fff1ec; }
.q-label { font-weight: 700; padding: 0; margin-bottom: 12px; float: left; width: 100%; }
.q-label + * { clear: both; }
.req { color: var(--danger); }

.options { display: grid; gap: 8px; }
.option {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface-2);
  transition: border-color .15s, background .15s;
}
.option:hover { border-color: var(--line-strong); }
.option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.option input { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; flex: none; }

.likert-wrap { display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "scale scale" "left right"; gap: 6px 12px; max-width: 560px; }
.likert-wrap .likert { grid-area: scale; }
.likert-wrap .anchor { font-size: .8rem; color: var(--muted); font-weight: 600; line-height: 1.3; }
.likert-wrap .anchor:first-child { grid-area: left; }
.likert-wrap .anchor:last-child { grid-area: right; text-align: right; }
.likert { display: flex; gap: 6px; justify-content: space-between; }
.likert-opt { position: relative; cursor: pointer; }
.likert-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.likert-opt span {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1.5px solid var(--line-strong); background: var(--surface-2); font-weight: 700; color: var(--ink-2);
  transition: all .15s;
}
.likert-opt:hover span { border-color: var(--brand); }
.likert-opt input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 12px -4px rgba(79, 70, 229, .7); }
.likert-opt input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }

.matrix { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.matrix-head, .matrix-row { display: grid; grid-template-columns: minmax(200px, 2.4fr) repeat(var(--cols), minmax(52px, 1fr)); align-items: center; }
.matrix-head { background: var(--surface-2); font-size: .74rem; font-weight: 700; color: var(--muted); text-align: center; line-height: 1.25; }
.matrix-head span { padding: 10px 4px; }
.matrix-row { border-top: 1px solid var(--line); transition: background .15s; }
.matrix-row:nth-child(odd) { background: #fbfbfe; }
.matrix-row:hover { background: var(--brand-soft); }
.matrix-row.missing { background: #fff1ec; }
.matrix-label { padding: 12px 14px; font-size: .95rem; }
.matrix-cell { display: grid; place-items: center; padding: 10px 0; cursor: pointer; height: 100%; }
.matrix-cell input { width: 20px; height: 20px; accent-color: var(--brand); cursor: pointer; margin: 0; }
.matrix-cell .cell-text { display: none; }

@media (max-width: 720px) {
  .matrix-head { display: none; }
  .matrix-row { grid-template-columns: 1fr; padding: 12px; }
  .matrix-label { padding: 0 0 8px; font-weight: 600; }
  .matrix-cell { display: flex; gap: 10px; justify-items: start; padding: 6px 4px; }
  .matrix-cell .cell-text { display: inline; font-size: .9rem; }
  .likert { gap: 3px; }
  .likert-opt span { width: 36px; height: 36px; }
}

.completion { margin-top: 24px; padding: 20px; border-radius: var(--radius); background: linear-gradient(135deg, var(--night-2), var(--night-3)); color: #fff; text-align: center; }
.completion .code { font-size: 1.7rem; font-weight: 800; letter-spacing: .12em; margin-top: 6px; font-variant-numeric: tabular-nums; }

/* ── Task: three-pane AI interface ──────────────────────────────────────── */
body.task-mode { overflow: hidden; }
.task-layout {
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr) minmax(270px, 330px);
  gap: 16px;
  padding: 16px;
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
}
.pane { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); min-height: 0; }
.pane-left, .pane-right { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; }
.pane-title { font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); margin-bottom: 10px; }

.task-text { font-size: .93rem; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.task-text p:last-child { margin: 0; }

.timer { margin: 18px 0 14px; padding: 16px; border-radius: 16px; text-align: center; background: linear-gradient(160deg, var(--night-1), var(--night-3)); color: #fff; position: relative; overflow: hidden; }
.timer::after { content: ""; position: absolute; right: -18px; top: -18px; width: 70px; height: 70px; border-radius: 50%; box-shadow: inset -16px -8px 0 0 rgba(199, 210, 254, .35); }
.timer-label { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; opacity: .8; font-weight: 700; }
.timer-val { font-size: 2.4rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; margin: 4px 0; }
.timer-val.timer-low { color: #fdba74; }
.timer-hint { font-size: .8rem; opacity: .85; }

/* center */
.pane-center { display: flex; flex-direction: column; overflow: hidden; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 18px 18px 8px; scroll-behavior: smooth; }
.report-wrap { transition: opacity .2s; }
.report-wrap.collapsed { display: none; }
.thread-divider { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 4px 8px; font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.thread-divider .linklike { text-transform: none; letter-spacing: 0; font-size: .85rem; }

/* report: night-sky card */
.report {
  position: relative; overflow: hidden;
  border-radius: 18px; padding: 20px;
  color: #eef0ff;
  background:
    radial-gradient(1.2px 1.2px at 34% 4%, #fff 99%, transparent),
    radial-gradient(1px 1px at 52% 7%, #fff9 99%, transparent),
    radial-gradient(1.4px 1.4px at 61% 3%, #fff 99%, transparent),
    radial-gradient(1px 1px at 70% 9%, #fffa 99%, transparent),
    radial-gradient(1.2px 1.2px at 80% 5%, #fff 99%, transparent),
    radial-gradient(1px 1px at 44% 10%, #fff9 99%, transparent),
    radial-gradient(500px 220px at 100% 0%, rgba(129, 140, 248, .45), transparent 70%),
    linear-gradient(160deg, var(--night-1) 0%, var(--night-2) 55%, var(--night-3) 100%);
}
.report::before { content: ""; position: absolute; right: 22px; top: 18px; width: 44px; height: 44px; border-radius: 50%; box-shadow: inset -12px -6px 0 0 var(--moon); opacity: .9; }
.report-head h2 { color: #fff; margin-bottom: 2px; font-size: 1.15rem; padding-right: 60px; }
.report-head .muted { color: #b9bde8; font-size: .82rem; }
.report-top { display: grid; grid-template-columns: auto auto 1fr; gap: 18px; align-items: center; margin: 16px 0; }
.score { display: flex; align-items: center; gap: 12px; }
.ring { position: relative; width: 78px; height: 78px; flex: none; }
.ring svg { width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, .14); stroke-width: 8; }
.ring-fg { fill: none; stroke: #a5b4fc; stroke-width: 8; stroke-linecap: round; }
.score:nth-child(2) .ring-fg { stroke: #5eead4; }
.ring-val { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1; }
.ring-val b { font-size: 1.45rem; font-weight: 800; color: #fff; }
.ring-val span { font-size: .7rem; color: #b9bde8; }
.score-label { font-size: .78rem; color: #b9bde8; font-weight: 600; }
.score-sub { font-size: 1.05rem; font-weight: 800; color: #fff; }
.week { background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); border-radius: 14px; padding: 10px 12px 8px; min-width: 0; }
.week-title { font-size: .74rem; color: #b9bde8; font-weight: 600; margin-bottom: 4px; }
.legend-today { color: #fed7aa; white-space: nowrap; }
.legend-today::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: #f97316; margin-right: 4px; vertical-align: 0; }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 92px; align-items: end; }
.bar { display: grid; grid-template-rows: auto 1fr auto; height: 100%; text-align: center; min-width: 0; }
.bar-val { font-size: .62rem; color: #c7cbf3; }
.bar-fill { align-self: end; width: 100%; max-width: 22px; justify-self: center; border-radius: 6px 6px 3px 3px; background: rgba(165, 180, 252, .45); min-height: 4px; }
.bar-today .bar-fill { background: linear-gradient(180deg, #fdba74, #f97316); }
.bar-day { font-size: .62rem; color: #b9bde8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-today .bar-day, .bar-today .bar-val { color: #fed7aa; font-weight: 700; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.metric { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .1); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.metric-label { font-size: .72rem; color: #b9bde8; font-weight: 600; line-height: 1.3; }
.metric-value { font-size: 1.05rem; font-weight: 800; color: #fff; margin: 2px 0; line-height: 1.25; }
.metric-note { font-size: .72rem; display: flex; align-items: center; gap: 6px; line-height: 1.3; }
.metric-note::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none; }
.metric-normal .metric-note { color: #a7f3d0; }
.metric-normal .metric-note::before { background: #34d399; }
.metric-good .metric-note { color: #a7f3d0; }
.metric-good .metric-note::before { background: #34d399; }
.metric-attention .metric-note { color: #fed7aa; }
.metric-attention .metric-note::before { background: #fb923c; }

.reco { margin-top: 14px; background: #fff; color: var(--ink); border-radius: 14px; padding: 14px 16px 12px; border-left: 5px solid #818cf8; }
.reco-tag { display: inline-flex; align-items: center; gap: 6px; font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--brand); }
.reco-tag::before { content: "✦"; font-size: .85rem; }
.reco-headline { font-weight: 800; margin: 4px 0 6px; }
.reco ul { margin: 0; padding-left: 1.1em; font-size: .93rem; color: var(--ink-2); }
.reco li { margin: 2px 0; }

/* chat thread */
.thread { display: flex; flex-direction: column; gap: 14px; padding: 4px 2px 8px; }
.msg { display: flex; gap: 10px; align-items: flex-start; max-width: 100%; animation: rise .25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.msg-user { justify-content: flex-end; }
.msg-user .bubble {
  background: linear-gradient(135deg, var(--brand), #6d5df6); color: #fff;
  border-radius: 18px 18px 4px 18px; padding: 10px 16px; max-width: min(78%, 560px);
  white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 4px 12px -6px rgba(79, 70, 229, .6);
}
.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-size: .72rem; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--brand));
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.msg-ai .bubble {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 4px 18px 18px 18px; padding: 12px 16px; max-width: min(86%, 640px);
  box-shadow: var(--shadow-sm); overflow-wrap: anywhere;
}
.answer p { margin: 0 0 .6em; }
.answer p:last-child, .answer ul:last-child { margin-bottom: 0; }
.answer ul { margin: .3em 0 .6em; padding-left: 1.2em; }
.answer.gated { filter: blur(7px); user-select: none; pointer-events: none; max-height: 5.2em; overflow: hidden; opacity: .55; }

.dots { display: inline-flex; gap: 4px; padding: 4px 0; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.msg-error { align-self: center; font-size: .88rem; color: var(--danger); background: #fff1ec; border-radius: 999px; padding: 6px 14px; }

/* limitation communication (cognitive forcing function) */
.limits { background: var(--warn-bg); border: 1.5px solid var(--warn-line); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; color: var(--warn-ink); }
.limits-head { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: .92rem; margin-bottom: 6px; }
.limits-icon { width: 20px; height: 20px; border-radius: 50%; background: #f59e0b; color: #fff; display: grid; place-items: center; font-size: .8rem; font-weight: 900; flex: none; }
.limits ul { margin: 0 0 8px; padding-left: 1.2em; font-size: .92rem; }
.limits li { margin: 3px 0; }
.reflect { font-size: .92rem; margin: 0 0 10px; padding: 8px 10px; background: rgba(255, 255, 255, .7); border-radius: 10px; }
.ack { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; font-size: .92rem; padding: 8px 12px; background: #fff; border: 1.5px solid var(--warn-line); border-radius: 10px; width: fit-content; max-width: 100%; transition: background .15s; }
.ack:hover { background: #fffdf7; }
.ack input { width: 20px; height: 20px; accent-color: #d97706; margin: 0; flex: none; cursor: pointer; }
.ack:has(input:checked) { opacity: .7; cursor: default; }
.ack:has(input:not(:checked)) { animation: nudge 2.4s ease-in-out 1s 2; }
@keyframes nudge { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 0 5px rgba(245, 158, 11, .25); } }

/* confidence communication */
.conf { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); --c: var(--brand); }
.conf-high { --c: #0f9f6e; }
.conf-moderate { --c: #d97706; }
.conf-low { --c: #dc4c2b; }
.conf-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.conf-label { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.conf-val { font-weight: 800; color: var(--c); font-variant-numeric: tabular-nums; }
.meter { height: 8px; border-radius: 999px; background: var(--line); margin: 6px 0; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 999px; background: var(--c); }
.conf-basis { font-size: .85rem; color: var(--ink-2); }

/* composer */
.composer { padding: 10px 16px 14px; border-top: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.6), #fff); border-radius: 0 0 20px 20px; }
.composer-box { display: flex; align-items: flex-end; gap: 8px; background: var(--surface-2); border: 1.5px solid var(--line-strong); border-radius: 18px; padding: 6px 6px 6px 16px; transition: border-color .15s, box-shadow .15s; }
.composer-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); background: #fff; }
.composer-input { flex: 1; border: 0; background: transparent; resize: none; font: inherit; color: var(--ink); padding: 8px 0; max-height: 160px; outline: none; }
.composer-input:disabled { cursor: not-allowed; }
.btn-send { width: 42px; height: 42px; padding: 0; border-radius: 13px; background: linear-gradient(135deg, var(--brand), #6d5df6); color: #fff; flex: none; }
.composer-hint { min-height: 1.2em; font-size: .82rem; color: var(--warn-ink); margin-top: 6px; padding-left: 4px; font-weight: 600; }

/* notes */
.note-box { display: flex; align-items: flex-start; gap: 10px; background: var(--surface-2); border: 1.5px solid var(--line-strong); border-radius: 18px; padding: 10px 14px; margin-top: 6px; transition: border-color .15s, box-shadow .15s; }
.note-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); background: #fff; }
.note-icon { color: var(--muted); padding-top: 3px; }
.note-input { flex: 1; border: 0; background: transparent; resize: vertical; font: inherit; font-size: .95rem; min-height: 48px; max-height: 260px; outline: none; color: var(--ink); }
.note-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.note-status { font-size: .85rem; color: var(--good); font-weight: 700; min-height: 1.4em; margin-top: 4px; }
.note-list-title { font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 10px; padding-top: 14px; border-top: 1px dashed var(--line-strong); }
.note-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 10px; }
.note { background: #fffdf5; border: 1px solid #f1e6c4; border-radius: 12px; padding: 10px 12px; animation: rise .25s ease; }
.note-meta { display: flex; justify-content: space-between; align-items: center; font-size: .75rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.note-text { font-size: .92rem; white-space: pre-wrap; overflow-wrap: anywhere; }

/* modal */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(20, 18, 58, .55); backdrop-filter: blur(3px); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.dialog { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: 22px; padding: 26px; box-shadow: var(--shadow-lg); animation: rise .25s ease; }
.dialog .q { padding: 14px 16px; }
.peek-btn { position: fixed; top: calc(var(--topbar-h) + 12px); left: 50%; transform: translateX(-50%); z-index: 51; background: #fff; padding: 8px 16px; border-radius: 999px; box-shadow: var(--shadow); }
.overlay-peek.peeking { background: transparent; backdrop-filter: none; pointer-events: none; }
.overlay-peek.peeking .dialog { display: none; }
.overlay-peek.peeking .peek-btn { pointer-events: auto; }

/* responsive task layout */
@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-top { grid-template-columns: auto auto; }
  .week { grid-column: 1 / -1; }
}
@media (max-width: 980px) {
  body.task-mode { overflow: auto; }
  .task-layout { grid-template-columns: 1fr; height: auto; }
  .pane-center { height: 78vh; height: 78dvh; }
  .pane-left { order: 0; }
  .pane-center { order: 1; }
  .pane-right { order: 2; }
  .timer { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; }
  .timer-val { font-size: 1.7rem; }
}
@media (max-width: 520px) {
  .report-top { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .chat-scroll { padding: 12px 10px; }
  .msg-ai .bubble { max-width: 100%; }
  .avatar { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
