/* AI 保研导师工作台 — shadcn/ui-inspired tokens, plain CSS, light + dark */

:root {
  color-scheme: light;
  --bg: #fafafa;
  --card: #ffffff;
  --fg: #09090b;
  --fg-soft: #3f3f46;
  --muted: #71717a;
  --muted-bg: #f4f4f5;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --primary: #0f766e;
  --primary-fg: #ffffff;
  --primary-soft: #ccfbf1;
  --primary-line: #5eead4;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 1180px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #09090b;
    --card: #111113;
    --fg: #fafafa;
    --fg-soft: #d4d4d8;
    --muted: #a1a1aa;
    --muted-bg: #18181b;
    --border: #27272a;
    --border-strong: #3f3f46;
    --primary: #2dd4bf;
    --primary-fg: #042f2e;
    --primary-soft: #134e4a;
    --primary-line: #2dd4bf;
    --ok: #4ade80;
    --ok-soft: #052e16;
    --warn: #fbbf24;
    --warn-soft: #422006;
    --danger: #f87171;
    --danger-soft: #450a0a;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.02em; }
h1 { font-size: clamp(26px, 4vw, 38px); }
h2 { font-size: 18px; }
p { margin: 0; }
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.danger-text { color: var(--danger); font-style: normal; }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 18px; height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); font-weight: 650; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: var(--primary-fg); flex: none; }
.brand-mark svg { width: 17px; height: 17px; }
.brand small { display: block; font-family: var(--mono); font-size: 10px; font-weight: 400; color: var(--muted); letter-spacing: 0.06em; line-height: 1.3; }
.nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: block; padding: 6px 9px; border-radius: 7px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.nav a:hover { background: var(--muted-bg); color: var(--fg); text-decoration: none; }
.nav a.active { background: var(--muted-bg); color: var(--fg); font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); color: var(--fg);
  font-family: var(--font); font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--muted-bg); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: var(--primary); filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--muted-bg); color: var(--fg); }
.btn-sm { height: 31px; padding: 0 10px; font-size: 12.5px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 11.5px; }
.btn-block { width: 100%; }
.btn.danger:hover { color: var(--danger); background: var(--danger-soft); }

/* Main */
.main { padding-block: 34px 56px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-head .lead { margin-top: 8px; max-width: 70ch; color: var(--muted); font-size: 14.5px; }
.eyebrow { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head a { font-size: 12.5px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 16px; min-width: 0; }
.stat-card span { display: block; font-size: 12px; color: var(--muted); }
.stat-card b { display: block; margin-top: 2px; font-size: 30px; line-height: 1.15; letter-spacing: -0.04em; }
.stat-card b small { font-size: 15px; color: var(--muted); font-weight: 400; }
.stat-card > small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.badge-muted { background: var(--muted-bg); color: var(--muted); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap.card { padding: 0; }
table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 13.5px; }
table.wide { min-width: 1040px; }
th { text-align: left; padding: 10px 14px; background: var(--muted-bg); color: var(--muted); font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.07em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--border); }
td { padding: 12px 14px; border-top: 1px solid var(--border); vertical-align: top; color: var(--fg-soft); }
tbody tr:first-child td { border-top: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--muted-bg) 55%, transparent); }
.cell-sub { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.fit { display: inline-block; min-width: 30px; padding: 1px 7px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); font-family: var(--mono); font-size: 12px; text-align: center; }
.actions { display: flex; gap: 2px; align-items: center; white-space: nowrap; }
.actions form { display: inline; }
.inline-form { display: inline; }
.inline-form select { height: 30px; padding: 0 6px; font-size: 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--fg); }

/* Lists */
.task-list, .follow-list, .version-list, .list { list-style: none; margin: 0; padding: 0; }
.task-list li { display: flex; align-items: flex-start; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.task-list li:last-child { border-bottom: 0; }
.task-list.big li { padding: 13px 0; }
.task-main { flex: 1; min-width: 0; }
.task-main b { display: block; font-size: 13.5px; color: var(--fg); font-weight: 550; }
.task-main span { display: block; font-size: 11.5px; color: var(--muted); }
.task-check { width: 18px; height: 18px; margin-top: 2px; border: 1.5px solid var(--border-strong); border-radius: 50%; background: transparent; cursor: pointer; flex: none; }
.task-check:hover { border-color: var(--primary); }
.task-check.checked { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); font-size: 11px; line-height: 1; }
.task-list.done .task-main b { color: var(--muted); text-decoration: line-through; }

.follow-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.follow-list li:last-child { border-bottom: 0; }
.follow-list b { display: block; font-size: 13.5px; color: var(--fg); }
.follow-list span { font-size: 11.5px; color: var(--muted); }
.follow-meta { display: flex; align-items: center; gap: 8px; flex: none; }

.version-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.version-list li:last-child { border-bottom: 0; }
.version-list a { font-size: 13.5px; font-weight: 550; }
.version-list span { display: block; font-size: 11.5px; color: var(--muted); }
.version-list.big li { padding: 12px 0; }

/* Deadlines */
.deadline-list { display: flex; flex-direction: column; }
.deadline { display: grid; grid-template-columns: 96px minmax(0, 1fr) 66px; gap: 14px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border); }
.deadline:last-child { border-bottom: 0; }
.deadline-date { font-size: 12px; color: var(--muted); }
.deadline-main b { display: block; font-size: 13.5px; color: var(--fg); }
.deadline-main span { display: block; font-size: 11.5px; color: var(--muted); }
.deadline-days { text-align: right; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.deadline.urgent .deadline-days { color: var(--danger); font-weight: 600; }
.deadline.urgent .deadline-date { color: var(--danger); }

/* Progress */
.progress-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.progress-row b { font-size: 22px; letter-spacing: -0.03em; }
.progress-row span { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.bar { height: 8px; border-radius: 999px; background: var(--muted-bg); border: 1px solid var(--border); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--primary); }

/* Pipeline */
.pipeline { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pipe-item { display: flex; align-items: baseline; gap: 8px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--card); font-size: 12px; color: var(--muted); }
.pipe-item b { font-family: var(--mono); font-size: 14px; color: var(--fg); }
.pipe-item.active { border-color: var(--primary-line); background: var(--primary-soft); }
.pipe-item.active b { color: var(--primary); }

/* Forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field-grow { flex: 1; }
label { font-size: 12px; font-weight: 600; color: var(--fg); }
input, select, textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--fg);
  font-family: var(--font); font-size: 13.5px; line-height: 1.5;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { resize: vertical; }
.form-actions { display: flex; gap: 8px; }
.form-inline { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.form-inline .field { flex: 0 0 auto; }
.form-inline .field-grow { flex: 1 1 240px; }

/* Documents */
.doc-card h2 { font-size: 18px; margin-bottom: 6px; }
.doc-card h2 a { color: var(--fg); text-decoration: none; }
.doc-card h2 a:hover { color: var(--primary); }
.doc-card p { min-height: 2.6em; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.doc-body { overflow-x: auto; line-height: 1.8; }
.doc-body h1, .doc-body h2, .doc-body h3 { color: var(--fg); line-height: 1.3; text-wrap: balance; }
.doc-body h1 { font-size: 24px; margin: 0 0 12px; }
.doc-body h2 { font-size: 19px; margin: 26px 0 8px; padding-top: 4px; border-top: 1px solid var(--border); }
.doc-body h3 { font-size: 16px; margin: 18px 0 6px; }
.doc-body p, .doc-body li { color: var(--fg-soft); font-size: 14px; }
.doc-body p { margin: 8px 0; }
.doc-body ul, .doc-body ol { margin: 8px 0; padding-left: 22px; }
.doc-body li { margin: 4px 0; }
.doc-body blockquote { margin: 12px 0; padding: 8px 14px; border-left: 3px solid var(--primary); background: var(--muted-bg); color: var(--muted); }
.doc-body blockquote p { color: var(--muted); }
.doc-body a { color: var(--primary); overflow-wrap: anywhere; }
.doc-body code { padding: 1px 5px; border-radius: 4px; background: var(--muted-bg); font-family: var(--mono); font-size: 0.92em; }
.doc-body pre { overflow-x: auto; padding: 12px; border-radius: var(--radius-sm); background: var(--muted-bg); }
.doc-body pre code { padding: 0; background: transparent; }
.doc-body table { min-width: 560px; }
.doc-body th, .doc-body td { white-space: normal; }
.doc-body hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.doc-edit textarea { min-height: 60vh; font-family: var(--mono); font-size: 12.5px; line-height: 1.65; }

/* Empty state */
.empty { padding: 22px 0; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--fg); font-size: 14px; margin-bottom: 4px; }
.empty p { max-width: 46ch; margin: 0 auto 12px; font-size: 13px; }
.empty.big { padding: 46px 20px; }
.empty-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* Callout / list / phases */
.callout { border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: var(--radius-sm); background: var(--card); padding: 14px 16px; margin-bottom: 18px; }
.callout b { display: block; margin-bottom: 3px; }
.callout p { color: var(--muted); font-size: 13.5px; }
.list { display: flex; flex-direction: column; gap: 9px; }
.list li { position: relative; padding-left: 15px; font-size: 13.5px; color: var(--fg-soft); }
.list li::before { content: ""; position: absolute; left: 0; top: 9px; width: 5px; height: 5px; border-radius: 50%; background: var(--primary); }
.list.compact { gap: 6px; }
.list.compact li { font-size: 13px; }
.num-list { counter-reset: n; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.num-list li { counter-increment: n; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 9px; font-size: 13.5px; color: var(--fg-soft); }
.num-list li::before { content: counter(n); display: grid; place-items: center; width: 21px; height: 21px; border-radius: 6px; background: var(--muted-bg); border: 1px solid var(--border); font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

.phase-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.phase { display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 14px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.phase.done { opacity: 0.72; }
.phase.active { border-color: var(--primary-line); box-shadow: 0 0 0 1px var(--primary-line) inset; }
.phase-no { font-family: var(--mono); font-size: 12px; color: var(--muted); padding-top: 3px; }
.phase-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.phase-body p { color: var(--muted); font-size: 13.5px; margin-bottom: 8px; }
.phase-kpi { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 12.5px; color: var(--primary); }

/* Flashes */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash { padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; border: 1px solid var(--border); }
.flash-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.flash-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

/* Prose */
.prose { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: var(--font); font-size: 14px; line-height: 1.85; color: var(--fg-soft); }

/* Footer */
.foot { display: flex; justify-content: space-between; gap: 12px; padding-block: 20px 34px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11.5px; }
.areas-cell { max-width: 340px; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; }
.clamp-1 { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0 8px; }

/* Student profile */
.profile-form { display: flex; flex-direction: column; gap: 16px; }
.profile-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 16px; }
.choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); cursor: pointer; font-size: 13px; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.choice input { accent-color: var(--primary); }
.profile-prompt { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.ai-card { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; border-color: var(--primary-line); }
.ai-card > div { flex: 1; }
.ai-card b { font-size: 16px; }
.ai-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); margin-top: 6px; animation: pulse 1.2s infinite; flex: none; }
.ai-done .ai-dot { animation: none; background: var(--ok); }
@keyframes pulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
@media (max-width: 640px) { .profile-prompt { flex-direction: column; align-items: flex-start; } .profile-actions { justify-content: flex-start; } }
.optional-card { padding: 0; }
.optional-card summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; cursor: pointer; }
.optional-card summary::-webkit-details-marker { display: none; }
.optional-card summary b { display: block; font-size: 15px; }
.optional-card summary small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.optional-card[open] summary { border-bottom: 1px solid var(--border); }
.details-body { padding: 16px 18px; }
.unlock-card { border-color: var(--primary-line); }
.unlock-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.unlock-item { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--muted-bg); }
.unlock-item b { display: block; margin-bottom: 4px; }
.unlock-item span { color: var(--muted); font-size: 13px; }
.unlock-ready { margin-top: 12px; font-size: 13px; }
.ai-dot-idle { animation: none; background: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pick { width: 38px; text-align: center; }
.export-card .form-inline { margin-bottom: 6px; }
.mono-input { font-family: var(--mono); font-size: 12.5px; line-height: 1.7; min-height: 260px; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
[hidden] { display: none !important; }

/* Login */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left, 0px)) 24px max(16px, env(safe-area-inset-right, 0px)); background: var(--bg); }
.login-card { width: 100%; max-width: 380px; padding: 28px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); box-shadow: 0 18px 50px -30px rgba(9, 9, 11, 0.35); }
.login-mark { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 18px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.login-mark svg { width: 20px; height: 20px; }
.login-card h1 { font-size: 24px; margin-bottom: 8px; }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.login-card form { display: flex; flex-direction: column; gap: 5px; }
.login-card input { height: 42px; margin-bottom: 4px; }
.login-card .btn { margin-top: 8px; }
.login-error { margin: 8px 0 0; padding: 8px 10px; border-radius: 7px; background: var(--danger-soft); color: var(--danger); font-size: 12.5px; }
.login-foot { margin-top: 18px; color: var(--muted); font-size: 11.5px; }

/* Docs layout */
.docs-page-head { margin-bottom: 14px; }
.docs-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.docs-nav { position: sticky; top: 82px; max-height: calc(100vh - 100px); overflow: auto; padding: 14px; }
.docs-nav nav { display: flex; flex-direction: column; gap: 2px; }
.docs-nav a { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; color: var(--fg-soft); }
.docs-nav a b { font-size: 13px; font-weight: 600; }
.docs-nav a span { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.docs-nav a:hover { background: var(--muted-bg); text-decoration: none; }
.docs-nav a.active { background: var(--primary-soft); color: var(--primary); }
.docs-nav a.active span { color: var(--primary); }
.docs-main { min-width: 0; }
.docs-title { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 14px; }
.docs-title h2 { font-size: 22px; margin: 2px 0 4px; }

/* Email workbench */
.email-group { margin-bottom: 22px; }
.email-group .section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 8px; }
.email-group .section-head h2 { font-size: 18px; }
.email-card h2 { font-size: 18px; margin-bottom: 4px; }
.email-card h2 small { font-size: 12px; color: var(--muted); font-weight: 400; }
.email-address { font-family: var(--mono); font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.email-subject { font-size: 13px; color: var(--fg-soft); }
.email-layout { align-items: start; }
.email-body-head { margin-top: 16px; }
.email-body { white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12.5px; line-height: 1.75; background: var(--muted-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; max-height: 60vh; overflow: auto; }
.attachment-list { display: flex; flex-direction: column; gap: 8px; }
.attachment { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--fg-soft); }
.attachment b { font-size: 13px; color: var(--fg); }
.attachment span { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.attachment:hover { border-color: var(--primary); text-decoration: none; }

@media (max-width: 860px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-nav { position: static; max-height: none; }
  .docs-nav nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
}

/* Responsive */
@media (max-width: 900px) {
  .page-head { flex-direction: column; align-items: flex-start; }
  .topbar-inner { flex-wrap: wrap; height: auto; padding-block: 9px; row-gap: 4px; }
  .nav { order: 3; width: 100%; margin-left: 0; }
  .topbar-inner > .btn { margin-left: auto; }
  .form-inline .field { flex: 1 1 100%; }
}
@media (max-width: 560px) {
  body { font-size: 14px; }
  .main { padding-block: 24px 40px; }
  .deadline { grid-template-columns: 1fr; gap: 4px; }
  .deadline-days { grid-column: auto; text-align: left; }
  .topbar-inner { height: 54px; gap: 10px; }
  .brand small { display: none; }
  .foot { flex-direction: column; }
}

@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top); }
  .foot { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  body { overscroll-behavior-y: contain; }
}

/* Supervisor communication */
.sup-now { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; }
.meeting-list { display: flex; flex-direction: column; gap: 2px; }
.meeting-row { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--border); color: var(--fg); }
.meeting-row:last-child { border-bottom: 0; }
.meeting-row:hover { text-decoration: none; }
.meeting-row:hover .meeting-who b { color: var(--primary); }
.meeting-when { flex: none; width: 96px; }
.meeting-when b { display: block; font-size: 13px; color: var(--fg); }
.meeting-when span { display: block; font-size: 11px; color: var(--muted); }
.meeting-who { flex: 1; min-width: 0; }
.meeting-who b { display: block; font-size: 13.5px; }
.meeting-who span { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-stats { margin-bottom: 16px; }
.sup-ops { align-items: start; }
.touch-form { border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 6px; }
.meeting-history { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--border); }
.meeting-history-row { display: grid; grid-template-columns: 130px 64px minmax(0, 1fr); gap: 10px; padding: 6px 0; font-size: 12px; color: var(--muted); }
.meeting-history-row span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline { list-style: none; margin: 12px 0 0; padding: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 10px; padding-bottom: 14px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline-dot { width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.timeline-main { min-width: 0; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.timeline li:last-child .timeline-main { border-bottom: 0; padding-bottom: 0; }
.timeline-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.timeline-head b { font-size: 13px; }
.timeline-main p { margin: 4px 0; font-size: 13px; color: var(--fg-soft); white-space: pre-wrap; }
.docs-nav-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }

@media (max-width: 640px) {
  .meeting-row { align-items: flex-start; flex-wrap: wrap; }
  .meeting-when { width: 100%; display: flex; gap: 8px; align-items: baseline; }
  .meeting-history-row { grid-template-columns: 1fr; gap: 2px; }
}

@media print {
  .topbar, .foot, .page-head .actions, .sup-stats, .sup-ops,
  .docs-nav, .docs-title .actions, .flashes { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  .wrap { max-width: none; }
  .main { padding: 0; }
  .docs-layout { display: block; }
  .card { border: 0; padding: 0; }
  .doc-body h2 { break-after: avoid; }
  .doc-body table, .doc-body tr { break-inside: avoid; }
}
.meeting-callout { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.meeting-callout .eyebrow { margin-bottom: 2px; }
.meeting-callout p { margin-top: 2px; }
@media (max-width: 640px) {
  .meeting-callout { flex-direction: column; align-items: flex-start; }
}
