/* Match dev's contextbio.css theme when served by the standalone worker.
   On the hub site (<html class="cb-app">) contextbio.css loads after this file and redefines the shared tokens;
   html:root.cb-app keeps AURORA's colours for the page body (buttons, fields, panels — byoung, 2026-11-07).
   The header band tokens are kept apart below so the hub's navy band still wins there. */
:root,
html:root.cb-app {
  --bg: #f8fafc;
  --cover-bg:
    radial-gradient(40% 60% at 18% 40px, rgba(99, 102, 241, 0.10) 0%, transparent 70%),
    radial-gradient(45% 70% at 82% 50px, rgba(16, 185, 129, 0.10) 0%, transparent 70%),
    radial-gradient(35% 50% at 50% 20px, rgba(56, 189, 248, 0.14) 0%, transparent 80%),
    radial-gradient(120% 80% at 50% -10%, #e0f2fe 0%, #f1f5f9 45%, #f8fafc 100%);
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --sub-bg: #f7f9fc;
  --guide-bg: #f7f9fc;
  --ink: #0f1a2e;
  --ink-2: #475569;
  --ink-3: var(--muted);
  --muted: #62738a;
  --line: #e2e5ea;
  --line-2: #d3dbe4;
  --accent: #2c7be5;
  --accent-in: #ffffff;
  --info: #526f99;
  --info-bg: #eff4fa;
  --info-line: #d2deed;
  --ok: #0f766e;
  --ok-bg: #ebf6f4;
  --ok-line: #c2e2dc;
  --warn: #96621f;
  --warn-bg: #fcf5e9;
  --warn-line: #ead8b6;
  --danger: #af4b58;
  --danger-bg: #fbf0f1;
  --danger-line: #ebcfd4;
  --btn-bg: #2867c7;
  --btn-bg-hover: #1e56b0;
  --btn-fg: #ffffff;
  --btn-outline: var(--btn-bg);
  --field-bg: #ffffff;
  --field-line: #cbd5e1;
  --notice-bg: #f4f7fb;
  --rule-bg: #f5f2fa;
  --rule-line: #ded5ed;
  --rule-heading: #624c84;
  --selection-bg: color-mix(in srgb, var(--btn-bg) 8%, var(--panel));
  --selection-line: color-mix(in srgb, var(--btn-bg) 55%, var(--panel));
  --selection-ink: var(--btn-bg);
  --table-head-bg: #eef2f7;
  --table-head-ink: #334155;
  --subtitle-size: 13.5px;
  --label-size: 12.5px;
  --radius: 10px;
  --radius-sm: 4px;
  --shadow: 0 1px 2px rgba(15,26,46,.04);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Noto Sans KR", "Pretendard", "Apple SD Gothic Neo", sans-serif;
  --font-display: "Newsreader", "Nanum Myeongjo", Georgia, "Times New Roman", serif;
  --font-mono: "Fira Code", ui-monospace, SFMono-Regular, Menlo, "DejaVu Sans Mono",
               "Noto Sans KR", monospace;
}

:root[data-theme="dark"],
html:root.cb-app[data-theme="dark"] {
  --bg: #090d16;
  --cover-bg:
    radial-gradient(40% 60% at 18% 40px, rgba(129, 140, 248, 0.14) 0%, transparent 70%),
    radial-gradient(45% 70% at 82% 50px, rgba(16, 185, 129, 0.12) 0%, transparent 70%),
    radial-gradient(35% 50% at 50% 20px, rgba(56, 189, 248, 0.14) 0%, transparent 80%),
    radial-gradient(100% 70% at 50% -5%, #132238 0%, #0c1322 45%, #090d16 100%);
  --panel: #111827;
  --panel-2: #1a2333;
  --sub-bg: #141c2c;
  --guide-bg: #141c2c;
  --table-head-bg: #1e293b;
  --table-head-ink: #cbd5e1;
  --ink: #f8fafc;
  --ink-2: #cbd5e1;
  --ink-3: var(--muted);
  --muted: #8fa0ba;
  --line: #222f44;
  --line-2: #334460;
  --accent: #3b82f6;
  --accent-in: #090d16;
  --btn-outline: var(--accent);
  --info: #9ab8df;
  --info-bg: #19263a;
  --info-line: #344a67;
  --ok: #7fcfc2;
  --ok-bg: #132a28;
  --ok-line: #2e5651;
  --warn: #dfba7c;
  --warn-bg: #30281d;
  --warn-line: #5f4c30;
  --danger: #e5a0aa;
  --danger-bg: #322129;
  --danger-line: #62404b;
  --field-bg: #0f1726;
  --field-line: #334460;
  --notice-bg: #14223d;
  --rule-bg: #252237;
  --rule-line: #4a405f;
  --rule-heading: #cfbee8;
  --selection-ink: var(--accent);
  --shadow: 0 1px 2px rgba(0,0,0,.5);
}

/* Header band tokens: standalone worker only. On the hub site contextbio.css (loaded later, same specificity)
   replaces them, so the header is the hub's navy band like the other ContextBio apps. */
:root {
  --app-header-bg:
    radial-gradient(40% 70% at 18% 20%, rgba(99, 102, 241, 0.12) 0%, transparent 70%),
    radial-gradient(45% 80% at 82% 25%, rgba(16, 185, 129, 0.12) 0%, transparent 70%),
    radial-gradient(35% 60% at 50% 10%, rgba(56, 189, 248, 0.16) 0%, transparent 80%),
    radial-gradient(120% 90% at 50% -10%, #e0f2fe 0%, #f1f5f9 45%, #f8fafc 100%);
  --app-header-fg: #0f172a;
  --app-header-muted: #64748b;
  --app-header-line: #e2e8f0;
}
:root[data-theme="dark"] {
  --app-header-bg:
    radial-gradient(40% 70% at 18% 20%, rgba(129, 140, 248, 0.15) 0%, transparent 70%),
    radial-gradient(50% 80% at 82% 25%, rgba(16, 185, 129, 0.12) 0%, transparent 70%),
    radial-gradient(35% 60% at 50% 10%, rgba(56, 189, 248, 0.15) 0%, transparent 80%),
    radial-gradient(100% 70% at 50% -5%, #132238 0%, #0c1322 45%, #090d16 100%);
  --app-header-fg: #f8fafc;
  --app-header-muted: #8fa0ba;
  --app-header-line: #222f44;
}

body { font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
code, pre, kbd, samp { font-family: var(--font-mono); }
a { color: var(--accent); }

.app-header-wrap { background: var(--app-header-bg); color: var(--app-header-fg); border-bottom: 1px solid var(--app-header-line); }
.hero { background: transparent; color: var(--app-header-fg); border-bottom: none; }
.hero-brand-name { margin: 0; line-height: 1; }
#aurora-home {
  text-decoration: none;
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--ink) 30%, #2563eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}
:root[data-theme="dark"] #aurora-home {
  background: linear-gradient(135deg, #ffffff 40%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .lede {
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
}
.hero button, .hero .btn-ghost { border-color: var(--app-header-line); color: var(--app-header-fg); }
.hero .supported-data-types li {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  color: var(--ink-2);
  border-radius: 6px;
}
:root[data-theme="dark"] .hero .supported-data-types li {
  background: rgba(26, 35, 51, 0.8);
}
.hero .theme-switch {
  display: flex;
  background: rgba(241, 245, 249, 0.88);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}
:root[data-theme="dark"] .hero .theme-switch {
  background: rgba(26, 35, 51, 0.88);
}
.hero .theme-switch button {
  background: transparent;
  border: none;
  border-radius: 7px;
  padding: 3px 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s ease;
}
.hero .theme-switch button:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}
:root[data-theme="dark"] .hero .theme-switch button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
}
.hero .theme-switch button.on {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  font-weight: 600;
}
.hero #lang {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--field-line);
  color: var(--ink);
  border-radius: 8px;
}
:root[data-theme="dark"] .hero #lang {
  background: rgba(15, 23, 38, 0.85);
}
.hero .who { color: var(--ink-2); }
.hero .ver {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: #2563eb;
  padding: 2px 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  letter-spacing: 0.02em;
}
:root[data-theme="dark"] .hero .ver {
  color: #3b82f6;
  background: #14223d;
  border-color: #1e3a8a;
}
.hero .btn-ghost { background: rgba(255, 255, 255, 0.7); border-color: var(--line); color: var(--ink); }
:root[data-theme="dark"] .hero .btn-ghost { background: rgba(26, 35, 51, 0.7); }
.hero .btn-ghost:hover:not(:disabled) { background: var(--panel-2); border-color: var(--accent); color: var(--accent); }
input, select, textarea { font-family: var(--font-sans); background: var(--field-bg); border-color: var(--field-line); border-radius: var(--radius-sm); }
.run-picker { background: var(--panel); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(44,123,229,.15); }

.app-tabs button { border-radius: 9px 9px 0 0; border-bottom-width: 2.5px; }
.app-tabs button.on { background: linear-gradient(180deg, rgba(44, 123, 229, 0.11) 0%, rgba(44, 123, 229, 0.04) 100%); }
:root[data-theme="dark"] .app-tabs button.on { background: linear-gradient(180deg, rgba(59, 130, 246, 0.18) 0%, rgba(59, 130, 246, 0.06) 100%); }
.card h2 { font-size: 15.5px; letter-spacing: -.01em; color: var(--ink); }
/* The resize gutter is the guide's only divider; no extra border beside it. */
.guide { background: var(--guide-bg); border: 0; padding: 14px 16px; line-height: 1.65; }

/* Shared settings and guidance across every data type and workflow page. */
.btn.btn-ghost {
  background: transparent; border-color: var(--btn-outline); color: var(--btn-outline);
}
.btnset button { border-color: var(--line-2); border-radius: var(--radius-sm); }
.btnset button.on,
#hidden-axes .hidden-axis-pick.on,
.sample-checks label:has(input:checked) {
  background: var(--selection-bg); border-color: var(--selection-line); color: var(--selection-ink);
}
/* Message colour follows meaning in both the dashboard and chat. */
.msg, .chat-turn.bot, .hint.note-usage, .hint.note-caution,
#sva-axes .sva-axis, :root[data-theme] .run-view-bar {
  background: var(--notice-bg); color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.chat-turn.bot { background: var(--panel); }
.msg.info, .chat-turn.bot.info, .chat-turn.bot.step-wait, .hint.note-usage {
  background: var(--info-bg); color: var(--ink);
  border-color: var(--info-line);
}
.msg.ok, .chat-turn.bot.ok, #sva-axes .sva-axis.rule-keep {
  background: var(--ok-bg); color: var(--ink);
  border-color: var(--ok-line);
}
.msg.warn, .chat-turn.bot.warn, .hint.note-caution,
#sva-axes .sva-axis.rule-correct, :root[data-theme] .run-view-bar {
  background: var(--warn-bg); color: var(--ink);
  border-color: var(--warn-line);
}
.msg.err, .chat-turn.bot.err {
  background: var(--danger-bg); color: var(--ink);
  border-color: var(--danger-line);
}
.hint.note-usage::before { color: var(--info); }
.chat-check.ok .chat-check-mark { color: var(--ok); }
.chat-check.warn .chat-check-mark { color: var(--warn); }
.chat-check.err .chat-check-mark { color: var(--danger); }
/* The analysis tab's AI readings (종합해석) on amber (byoung, 2026-11-14; neutral from 2026-11-12): a model's reading is to
   be checked against the results, as the report's yellow AI box. */
:root[data-theme] .ai-desc {
  background: var(--warn-bg); color: var(--ink); border-color: var(--warn-line);
}
:root[data-theme] .ai-desc h4 { color: var(--warn); border-bottom-color: var(--warn-line); }
:root[data-theme] .ai-desc .ai-summary { color: var(--ink); }
/* Rule explanations are violet; an axis's verdict above takes precedence. */
.rule-suggest:not(.outlier-rule) {
  background: var(--rule-bg); border: 1px solid var(--rule-line);
  border-radius: 8px;
}
.rule-suggest:not(.outlier-rule) h4 { color: var(--rule-heading); border-bottom-color: var(--rule-line); }
/* The QC rule's group-difference note under its title, on the rule box's amber (byoung 11-15). */
:root[data-theme] .qc-rule .qc-group-shift {
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  border-radius: 6px; color: var(--ink); padding: 8px 10px; margin: 0 0 10px;
}
/* Selected axes have a thicker blue border on all four sides. */
#sva-axes .sva-axis.sva-axis-chosen {
  border: 2px solid var(--selection-line);
}
/* An excluded sample in the outlier box (a box of its own until 2026-10-22) takes the warning amber on its name. */
:is(#cluster-samples, .qc-samples) .outlier-excluded > dt strong { color: var(--warn); }

/* Match the title-to-description gap used by the other settings sections. */
#step-note { margin: 6px 0 10px; }

/* Let variant header actions wrap below the title on narrow screens. */
#variant-step .subheading-text, #variant-cnv-step .subheading-text { flex-basis: 240px; }
#variant-actions, #variant-cnv-actions { margin-left: auto; }

/* Center figure sets while keeping their headings and notes left-aligned. */
#main-analysis .pca-plot,
#main-analysis .heatmap-plot,
#main-analysis .go-figure { margin-inline: auto; }
#main-analysis :is(.pca-plot, .heatmap-plot, .go-figure) > img { display: block; margin-inline: auto; }
#main-analysis .pca-with-stats:not(.side) > .cluster-group-stats > table { margin-inline: auto; }

/* The cover keeps its pipeline lanes and uses the same surfaces and type. */
#main-home {
  --bg: var(--cover-bg);
  --sans: var(--font-sans);
  --mono: var(--font-mono);
  color-scheme: normal;
  background: var(--cover-bg);
}
:root[data-theme="dark"] #main-home .home-cover-tile,
:root[data-theme="dark"] #main-home .home-type-card {
  background: var(--panel);
}
:root[data-theme="dark"] #main-home .home-type-card {
  border-color: color-mix(in srgb, var(--type-accent) 35%, var(--line));
}

/* ── 머리글 · 프로젝트 줄 · 탭 줄: BioWrit 과 같은 허브 기본형 (byoung, 2026-11-07) ──────────────────────────
   머리글은 점 · 제목, 제목 바로 밑에 한 줄 소개(BioWrit 의 .dot · .titleblock · .tagline 과 같은 배치)이고, 프로젝트 줄과
   탭 줄은 그 아래 밝은 바탕이다. contextbio.ai 아래에 실릴 때는 사이트 공용 CSS(contextbio.css, 이 파일 뒤에 실림)가
   머리글을 다른 앱과 같은 남색 띠 · 세리프 제목 · 하늘색 점으로 칠하고 .app-meta 는 감춰진다(허브 build_subapp.py) —
   허브 main 과 dev 의 contextbio.css 가 같아 두 사이트에서 같은 얼굴이다. 제목 크기 · 굵기 · 글꼴은 그 공용 CSS 가
   정하도록 여기서 세게 걸지 않는다. 이 파일 앞쪽 · app.css 의 .hero-* 규칙(10-17 이후의 큰 제목 머리)은 이 블록이
   덮는다. 본문 칸은 그대로다. */
.app-header-wrap { background: none; color: inherit; border-bottom: 0; }
.hero {
  background: linear-gradient(135deg, var(--hero1, #192e49), var(--hero2, #315576));
  color: #fff; padding: 28px 24px 14px; border-bottom: 0;
}
.hero-inner { position: relative; display: flex; align-items: flex-start; gap: 12px; max-width: none; margin: 0; }
.hero .dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: #8fb4ff; }
.hero .titleblock { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; flex: 1 1 auto; }
.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 0; border: 0; }
.brand h1 { margin: 0; font-size: 18px; line-height: 1.25; }
/* 제목은 홈으로 가는 링크지만 링크 색이 아니라 제목 색으로 선다(BioWrit 의 제목처럼). */
:root[data-theme] .brand h1 #aurora-home, :root[data-theme] .brand h1 #aurora-home:hover {
  font: inherit; letter-spacing: inherit; line-height: inherit; display: inline; color: inherit;
  background: none; -webkit-text-fill-color: currentColor; text-decoration: none !important;
}
.hero .tag { color: #aebfd6; font-size: 12.5px; }
/* 허브 사이트: 공용 CSS 의 .brand .tag 규칙이 이제 닿지 않으므로(제목 줄 밖) 같은 띠 보조색을 직접 준다. */
html.cb-app .hero .tag { color: var(--app-header-muted); }
.hero .lede { max-width: 780px; margin: 0; color: #d7e0ee; font-size: 13px; font-weight: 400; line-height: 1.65; }
/* 계정·언어·테마. 사이트가 얹는 오른쪽 위 줄이 이 안의 것을 가져가면 남는 것만 보인다. */
.app-meta {
  position: absolute; top: 0; right: 0; max-width: 640px;
  display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
}
.hero .theme-switch, :root[data-theme="dark"] .hero .theme-switch { display: flex; gap: 4px; background: none; border: 0; padding: 0; }
.hero .theme-switch button, .hero .theme-switch button:hover, :root[data-theme="dark"] .hero .theme-switch button:hover {
  padding: 4px 7px; border: 1px solid rgba(255,255,255,.24); background: rgba(255,255,255,.08);
  color: #e8eef8; border-radius: 7px; cursor: pointer; font-size: 13px; box-shadow: none;
}
.hero .theme-switch button.on { border-color: #fff; color: #fff; font-weight: inherit; }
.hero #lang, :root[data-theme="dark"] .hero #lang {
  padding: 4px 7px; max-width: 150px; height: auto; min-width: 0; border: 1px solid rgba(255,255,255,.24); border-radius: 7px;
  background: rgba(255,255,255,.08); color: #e8eef8; font: inherit;
}
.hero .who { font-size: 11.5px; color: #cfdcee; word-break: break-all; max-width: 220px; white-space: normal; }
.hero .ver, :root[data-theme="dark"] .hero .ver {
  font-family: inherit; font-size: 10.5px; font-weight: 400; color: #9fb3cd;
  padding: 0; background: none; border: 0; letter-spacing: normal;
}
.hero .btn-ghost, :root[data-theme="dark"] .hero .btn-ghost { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.24); color: #e8eef8; }

/* 프로젝트 줄 — 머리글과 탭 줄 사이, 밝은 바탕. */
.project-bar {
  padding: 14px max(24px, calc((100% - 1432px) / 2)); min-height: 0;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.project-principle { color: var(--muted); }
/* 홈처럼 프로젝트 칸이 감춰지면 원칙 문구가 탭 줄 오른쪽에 붙는다(app.css) — 밑줄을 탭 줄과 이어 준다. */
.app-header-wrap:has(#project-controls[hidden]) > .project-bar { border-bottom: 1px solid var(--line); }

/* 탭 줄 — 머리글 아래에 붙고, 스크롤해도 따라온다. */
.app-tabs {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  gap: 6px; padding: 6px max(24px, calc((100% - 1432px) / 2)) 0;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.app-tabs button {
  padding: 13px 20px; border-bottom: 3px solid transparent; border-radius: 8px 8px 0 0;
  color: var(--ink-2); font-weight: 600; letter-spacing: normal;
}
.app-tabs button:hover, :root[data-theme="dark"] .app-tabs button:hover { color: var(--ink); background: var(--panel-2); }
.app-tabs button.on, :root[data-theme="dark"] .app-tabs button.on {
  color: var(--accent); border-bottom-color: var(--accent); background: var(--info-bg); font-weight: 600;
}
@media (max-width: 760px) {
  .hero { padding: 22px 16px 12px; }
  .app-meta { position: static; justify-content: flex-start; margin-top: 12px; }
  .project-bar { padding: 12px 16px; }
  .app-tabs { padding-left: 8px; padding-right: 8px; gap: 0; }
  .app-tabs button { padding: 10px 12px; font-size: 13px; }
}
