/* NurturEd Know card review tool. Card styles follow type-system/_preview_v14.html
   and nurtured-app/app/config/theme.js. */
:root {
	--paper: #fefbf8;
	--sage: #e8f4ef;
	--clay: #f9f0e2;
	--forest: #00725f;
	--ink: #3d434c;
	--ink-soft: #5c6168;
	--green-accent: #35a895;
	--clay-accent: #e55f71;
	--on-dark: #fefbf8;
	--accent-on-dark: #ffaf66;
	--t-xs: 11px;
	--t-s: 16px;
	--t-m: 18px;
	--t-l: 23px;
	--t-xl: 29px;
	--t-xxl: 38px;

	--ui-bg: #e9e6dc;
	--ui-panel: #fbfaf6;
	--ui-line: #dcd8cc;
	--ui-text: #2f3338;
	--ui-muted: #6b6e72;
	--ui-err: #c4384b;
	--ui-warn: #b7791f;
	--ui-ok: #2f8f7e;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
	background: var(--ui-bg);
	color: var(--ui-text);
	font-family: 'Inter', system-ui, sans-serif;
	font-size: 14px;
	line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--forest); }

/* ------------------------------------------------------------------ app shell */
.topbar {
	position: sticky; top: 0; z-index: 20;
	display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
	padding: 10px 18px;
	background: rgba(251, 250, 246, 0.94);
	backdrop-filter: blur(6px);
	border-bottom: 1px solid var(--ui-line);
}
.brandmark { font-family: 'Fraunces', serif; font-weight: 600; font-size: 18px; letter-spacing: -0.01em; }
.brandmark small { font-family: 'Inter', sans-serif; font-weight: 500; font-size: 12px; color: var(--ui-muted); margin-left: 8px; letter-spacing: 0; }
.tabs { display: flex; gap: 2px; background: #eceae2; padding: 3px; border-radius: 10px; }
.tabs button { border: 0; background: transparent; padding: 6px 14px; border-radius: 8px; font-weight: 500; color: var(--ui-muted); }
.tabs button.on { background: #fff; color: var(--ui-text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.spacer { flex: 1; }
.field { display: flex; align-items: center; gap: 6px; color: var(--ui-muted); font-size: 13px; }
.field input[type=text] { border: 1px solid var(--ui-line); border-radius: 8px; padding: 5px 9px; width: 130px; background: #fff; }
.toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ui-muted); user-select: none; cursor: pointer; }
.btn { border: 1px solid var(--ui-line); background: #fff; border-radius: 8px; padding: 6px 12px; font-weight: 500; }
.btn:hover { border-color: #bdb8a8; }
.btn.primary { background: var(--forest); border-color: var(--forest); color: #fff; }

.main { display: grid; grid-template-columns: 280px minmax(360px, 1fr) 380px; min-height: calc(100vh - 60px); }
.main.compare, .main.results, .main.help, .main.sheet { display: block; }
.sheet-wrap { padding: 20px 24px 60px; }
.sheet-item { margin-bottom: 26px; }
.sheet-item h4 { font-size: 14px; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; }
.sheet-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.sheet-cell { flex: 0 0 auto; zoom: .42; }

/* sidebar */
.sidebar { border-right: 1px solid var(--ui-line); background: var(--ui-panel); overflow-y: auto; max-height: calc(100vh - 60px); position: sticky; top: 60px; }
.filters { padding: 12px 14px; display: grid; gap: 8px; border-bottom: 1px solid var(--ui-line); }
.filters select { width: 100%; border: 1px solid var(--ui-line); border-radius: 8px; padding: 5px 8px; background: #fff; }
.group-h { padding: 12px 14px 4px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; color: var(--ui-muted); }
.item { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; padding: 7px 14px; cursor: pointer; border-left: 3px solid transparent; }
.item:hover { background: #f1efe7; }
.item.on { background: #eaf3ef; border-left-color: var(--forest); }
.item .t { font-size: 13px; line-height: 1.3; }
.item .t small { display: block; color: var(--ui-muted); font-size: 11.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #cfcabb; }
.dot.approve { background: var(--ui-ok); }
.dot.edit { background: var(--ui-warn); }
.dot.reject { background: var(--ui-err); }
.badge { font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 6px; background: #eee; color: var(--ui-muted); }
.badge.err { background: #fbe3e6; color: var(--ui-err); }
.badge.warn { background: #fbf0dc; color: var(--ui-warn); }

/* stage */
.stage { display: flex; flex-direction: column; align-items: center; padding: 14px 16px 14px; gap: 10px; min-width: 0; }
.stage-meta { text-align: center; max-width: 100%; min-width: 0; width: 100%; }
.stage-meta h2 { font-family: 'Fraunces', serif; font-weight: 600; font-size: 18px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-meta h2 span { font-family: 'Inter', sans-serif; font-weight: 500; font-size: 14px; color: var(--ui-muted); }
.stage-meta p { color: var(--ui-muted); font-size: 12.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pager-nav { display: flex; gap: 8px; align-items: center; color: var(--ui-muted); font-size: 12.5px; }
.pager-nav .btn { padding: 4px 10px; }
.hint { font-size: 12px; color: var(--ui-muted); text-align: center; }
kbd { font-family: ui-monospace, Menlo, monospace; font-size: 11px; background: #fff; border: 1px solid var(--ui-line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; }

/* right panel */
.panel-r { border-left: 1px solid var(--ui-line); background: var(--ui-panel); overflow-y: auto; max-height: calc(100vh - 60px); position: sticky; top: 60px; }
.ptabs { display: flex; border-bottom: 1px solid var(--ui-line); position: sticky; top: 0; background: var(--ui-panel); z-index: 2; }
.ptabs button { flex: 1; border: 0; background: transparent; padding: 10px 0; font-weight: 500; color: var(--ui-muted); border-bottom: 2px solid transparent; }
.ptabs button.on { color: var(--ui-text); border-bottom-color: var(--forest); }
.psec { padding: 14px 16px; border-bottom: 1px solid var(--ui-line); }
.psec h3 { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ui-muted); font-weight: 600; margin-bottom: 8px; }
.score-row { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 8px; margin: 6px 0; }
.score-row label { font-weight: 500; }
.score-row label span { display: block; font-size: 11px; color: var(--ui-muted); font-weight: 400; line-height: 1.2; }
.pips { display: flex; gap: 4px; }
.pips button { width: 32px; height: 28px; border-radius: 7px; border: 1px solid var(--ui-line); background: #fff; font-weight: 600; color: var(--ui-muted); }
.pips button.on { background: var(--forest); border-color: var(--forest); color: #fff; }
.verdicts { display: flex; gap: 6px; }
.verdicts button { flex: 1; border: 1px solid var(--ui-line); background: #fff; border-radius: 8px; padding: 7px 0; font-weight: 600; }
.verdicts button.on.approve { background: var(--ui-ok); border-color: var(--ui-ok); color: #fff; }
.verdicts button.on.edit { background: var(--ui-warn); border-color: var(--ui-warn); color: #fff; }
.verdicts button.on.reject { background: var(--ui-err); border-color: var(--ui-err); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--ui-line); background: #fff; border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.chips button.on { background: #2f3338; border-color: #2f3338; color: #fff; }
textarea { width: 100%; min-height: 76px; border: 1px solid var(--ui-line); border-radius: 8px; padding: 8px 10px; background: #fff; resize: vertical; }
.slide-note-h { font-size: 12px; color: var(--ui-muted); margin-bottom: 4px; }
.saved { font-size: 11.5px; color: var(--ui-muted); margin-top: 6px; }

.claim { margin: 0 0 10px; padding: 8px 10px; background: #fff; border: 1px solid var(--ui-line); border-radius: 8px; }
.claim.active { border-color: var(--forest); box-shadow: 0 0 0 2px rgba(0,114,95,.12); }
.claim .cid { font-size: 11px; font-weight: 700; color: var(--forest); margin-right: 4px; }
.claim .conf { font-size: 10.5px; color: var(--ui-muted); }
.claim .srcs { margin-top: 5px; display: grid; gap: 3px; }
.claim .srcs a { font-size: 12px; word-break: break-word; }
.claim blockquote { font-size: 11.5px; color: var(--ui-muted); border-left: 2px solid var(--ui-line); padding-left: 8px; margin-top: 3px; }
.vmsg { font-size: 12.5px; margin: 3px 0; }
.vmsg.err { color: var(--ui-err); }
.vmsg.warn { color: var(--ui-warn); }
.vmsg.ok { color: var(--ui-ok); }
pre.json { font-family: ui-monospace, Menlo, monospace; font-size: 11px; background: #1e1e1c; color: #d6d3c8; padding: 12px; border-radius: 8px; overflow: auto; max-height: 420px; white-space: pre-wrap; word-break: break-word; }
.caution { font-size: 12px; color: #6b5a2e; background: #fbf5e6; border: 1px solid #efe2bf; border-radius: 8px; padding: 6px 9px; margin-bottom: 6px; }

/* compare */
.compare-wrap { padding: 12px 24px 12px; }
.compare-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.compare-head h2 { font-family: 'Fraunces', serif; font-size: 18px; font-weight: 600; white-space: nowrap; }
.compare-head p { color: var(--ui-muted); font-size: 13px; max-width: 70ch; }
.compare-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; justify-items: center; }
.ccol { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ccol-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.ccol h4 { font-size: 13px; font-weight: 600; }
.ccol h4 small { font-weight: 400; color: var(--ui-muted); }
.pick { border: 1px solid var(--ui-line); background: #fff; border-radius: 999px; padding: 5px 14px; font-weight: 600; font-size: 12.5px; }
.pick.on { background: var(--forest); border-color: var(--forest); color: #fff; }
.mini-scores { display: flex; gap: 10px; font-size: 11.5px; color: var(--ui-muted); }

/* results */
.results-wrap { padding: 24px 28px 60px; max-width: 1100px; }
.results-wrap h2 { font-family: 'Fraunces', serif; font-size: 24px; font-weight: 600; margin-bottom: 4px; }
.results-wrap > p { color: var(--ui-muted); margin-bottom: 18px; }
table.rt { border-collapse: collapse; width: 100%; background: #fff; border: 1px solid var(--ui-line); border-radius: 10px; overflow: hidden; margin-bottom: 26px; }
table.rt th, table.rt td { padding: 8px 12px; text-align: left; border-bottom: 1px solid #eeebe2; font-size: 13px; }
table.rt th { background: #f5f3ec; font-weight: 600; font-size: 12px; color: var(--ui-muted); }
table.rt td.num { font-variant-numeric: tabular-nums; }
table.rt tr.best td { background: #eef7f3; }
.bar { display: inline-block; height: 8px; border-radius: 4px; background: var(--green-accent); vertical-align: middle; margin-left: 6px; }
.help-wrap { padding: 28px; max-width: 760px; }
.help-wrap h2 { font-family: 'Fraunces', serif; font-size: 24px; margin: 0 0 8px; }
.help-wrap h3 { font-size: 15px; margin: 18px 0 6px; }
.help-wrap p, .help-wrap li { color: #45494e; margin-bottom: 6px; }
.help-wrap ul { padding-left: 18px; }

/* ------------------------------------------------------------------ phone screen (mirrors the app) */
/* Metrics from nurtured-app: config/theme.js (type, cardThemes, tabBar), KnowledgeCard, KnowPanel,
   CardPip, CardHeader, Dots. Screen = iPhone 393 x 852, safe areas 59 / 34. */
.screen {
	--fg: var(--ink); --muted: var(--ink-soft); --accent: var(--green-accent); --pip-bg: rgba(61, 67, 76, .08); --pip-fg: var(--ink-soft); --hair: rgba(61, 67, 76, .12);
	width: 393px; height: 852px; flex: 0 0 auto; position: relative; overflow: hidden; border-radius: 48px;
	background: var(--bg); color: var(--fg); user-select: none; touch-action: pan-y;
	box-shadow: 0 0 0 8px #1d1f22, 0 24px 60px rgba(30, 30, 25, .22);
	margin: 8px; isolation: isolate;
}
.th-paper { --bg: #fefbf8; --fg: #3d434c; --muted: #5c6168; --accent: #35a895; --pip-bg: rgba(61,67,76,.08); --pip-fg: #5c6168; --hair: rgba(61,67,76,.12); }
.th-sage { --bg: #e8f4ef; --fg: #00725f; --muted: #00725f; --accent: #35a895; --pip-bg: rgba(0,114,95,.12); --pip-fg: #00725f; --hair: rgba(61,67,76,.12); }
.th-clay { --bg: #f9f0e2; --fg: #3d434c; --muted: #5c6168; --accent: #e55f71; --pip-bg: rgba(61,67,76,.08); --pip-fg: #5c6168; --hair: rgba(61,67,76,.12); }
.th-forest { --bg: #00725f; --fg: #fefbf8; --muted: rgba(254,251,248,.72); --accent: #ffaf66; --pip-bg: rgba(254,251,248,.14); --pip-fg: #fefbf8; --hair: rgba(254,251,248,.18); }
.th-sky { --bg: linear-gradient(158deg, #ffffff 0%, #eaf6fc 45%, #c3e6f7 100%); --fg: #3d434c; --muted: #5c6168; --accent: #2AA4DD; --pip-bg: rgba(61,67,76,.08); --pip-fg: #5c6168; --hair: rgba(61,67,76,.12); }
.th-bloom { --bg: #fefbf8; --fg: #3d434c; --muted: #5c6168; --accent: #35a895; --pip-bg: rgba(61,67,76,.08); --pip-fg: #5c6168; --hair: rgba(61,67,76,.12); }
/* bloom: two soft watercolor blooms fixed behind the slides (like the app's CardAtmosphere) */
.screen.th-bloom::before, .screen.th-bloom::after { content: ''; position: absolute; z-index: 0; filter: blur(8px); pointer-events: none; }
.screen.th-bloom::before { width: 300px; height: 280px; top: 210px; left: -52px; background: #3bbba6; opacity: .22; border-radius: 52% 48% 43% 57% / 55% 42% 58% 45%; }
.screen.th-bloom::after { width: 280px; height: 270px; top: 430px; right: -64px; background: #94d2ee; opacity: .28; border-radius: 44% 56% 62% 38% / 47% 55% 45% 53%; }
.screen.th-bloom .track { position: relative; z-index: 1; }
.screen.th-bloom .panel, .screen.th-bloom .band.top { background: transparent; }
.screen .track { display: flex; height: 100%; transition: transform 300ms cubic-bezier(.2,.7,.2,1); }
.screen.dragging .track { transition: none; }

/* chrome: header icons, type pip, dots, tab bar (fixed; slides move underneath) */
.hdr { position: absolute; top: 65px; left: 28px; right: 28px; height: 26px; display: flex; justify-content: space-between; align-items: center; color: var(--fg); z-index: 3; pointer-events: none; }
.hdr span { display: block; width: 26px; height: 26px; }
.pip-wrap { position: absolute; top: var(--pip-top); left: 0; right: 0; display: flex; justify-content: center; z-index: 3; pointer-events: none; }
.pip { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--pip-bg); max-width: 86%; font-size: 12px; line-height: 16px; }
.pip .pk { font-weight: 600; text-transform: uppercase; letter-spacing: 1.6px; color: var(--accent); flex-shrink: 0; }
.pip .ps { color: var(--pip-fg); opacity: .45; flex-shrink: 0; }
.pip .pm.age { flex-shrink: 0; }
.pip .pm { font-weight: 500; letter-spacing: .2px; color: var(--pip-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dots-wrap { position: absolute; left: 0; right: 0; bottom: var(--dots-bottom); min-height: 36px; display: flex; align-items: center; justify-content: center; z-index: 3; pointer-events: none; }
.dots { display: flex; align-items: center; gap: 7px; }
.dots i { display: block; height: 6px; width: 6px; border-radius: 3px; background: var(--fg); transition: width 160ms, opacity 160ms; }
.screen.dragging .dots i { transition: none; }
.tabbar { position: absolute; left: 20px; right: 20px; bottom: var(--tab-bottom); height: 56px; border-radius: 28px; background: rgba(255,255,255,.9); box-shadow: 0 8px 24px rgba(30,30,25,.14); display: flex; justify-content: space-around; align-items: center; z-index: 3; pointer-events: none; }
.tabbar i { display: block; width: 22px; height: 22px; border-radius: 7px; background: rgba(61,67,76,.16); }

/* panel: the page area between pip and dots; content centered as one stack (KnowPanel) */
.panel { background: var(--bg); flex: 0 0 393px; width: 393px; height: 852px; padding: var(--pad-top) 32px var(--pad-bottom); display: flex; flex-direction: column; justify-content: center; position: relative; }
.panel.align-left { align-items: flex-start; text-align: left; }
.panel.align-center { align-items: center; text-align: center; }
.panel .stack { display: flex; flex-direction: column; gap: 16px; width: 100%; position: relative; z-index: 1; }
.panel.align-center .stack { align-items: center; }
.panel .group { display: flex; flex-direction: column; gap: 16px; width: 100%; }
.panel.align-center .group { align-items: center; }
.panel.tpl-numeral .stack { margin-top: 80px; }
.panel.tpl-diagram .stack { gap: 36px; } /* diagram, text group and list need air between them */

.r-eyebrow { font-size: 12px; line-height: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.6px; color: var(--muted); margin-bottom: 4px; }
.r-lead { font-family: 'Fraunces', Georgia, serif; font-weight: 500; color: var(--fg); }
.r-body, .r-attr, .r-aside { color: var(--muted); }
.r-attr { margin-top: 4px; }
.r-caption { color: var(--fg); font-weight: 500; }
.sz-xs { font-size: 12px; line-height: 16px; } .sz-s { font-size: 16px; line-height: 24px; } .sz-m { font-size: 19px; line-height: 26px; }
.sz-l { font-size: 26px; line-height: 34px; } .sz-xl { font-size: 34px; line-height: 42px; } .sz-xxl { font-size: 44px; line-height: 50px; }
em.accent { font-style: normal; color: var(--accent); }
em.accent.serif-it { font-family: 'Fraunces', serif; font-style: italic; font-weight: 400; }
em.accent.size-jump { font-size: 1.3em; line-height: 1; }

.ghost { position: absolute; top: calc(var(--pad-top) + 44px); right: 8px; font-family: 'Fraunces', serif; font-weight: 600; font-size: 220px; line-height: 1; color: var(--fg); opacity: .07; white-space: nowrap; pointer-events: none; z-index: 0; }

.r-list { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.r-list .li { display: flex; align-items: center; gap: 14px; padding: 14px 0; text-align: left; }
.r-list.ruled .li:not(:last-child) { border-bottom: 1px solid var(--hair); }
.r-list .num { font-family: 'Fraunces', serif; font-weight: 600; font-size: 26px; line-height: 26px; width: 22px; text-align: right; color: var(--accent); flex-shrink: 0; }
.r-list .dash { width: 14px; height: 2px; background: var(--accent); flex-shrink: 0; }
.r-list .lt { flex: 1; font-size: 16px; line-height: 24px; color: var(--fg); }
.inline-list { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 10px; font-size: 12px; line-height: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.6px; color: var(--muted); width: 100%; }
.inline-list b { opacity: .45; }

.stat-fig { font-family: 'Fraunces', serif; font-weight: 600; font-size: 140px; line-height: .9; letter-spacing: -0.03em; white-space: nowrap; color: var(--fg); display: flex; align-items: baseline; }
.stat-fig .unit { font-size: 30px; font-weight: 500; letter-spacing: 0; margin-left: 8px; color: var(--muted); }

.panel-box { width: 100%; border-radius: 18px; padding: 24px 22px; text-align: left; background: var(--bg); color: var(--fg); }
.panel-box .plabel { font-size: 11px; line-height: 14px; letter-spacing: 1.6px; text-transform: uppercase; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.panel-box .ptext { font-family: 'Fraunces', serif; font-weight: 500; font-size: 26px; line-height: 34px; }

.panel.contrast { padding: 0; display: flex; flex-direction: column; }
.band { flex: 1 1 50%; padding: 0 32px 28px; display: flex; flex-direction: column; justify-content: center; text-align: left; background: var(--bg); color: var(--fg); min-height: 0; }
.band.top { padding-top: var(--contrast-top); }
.band.bottom { padding-bottom: var(--contrast-bottom); }
.band .r-lead { margin-top: 16px; }

.dgm { width: 100%; display: flex; justify-content: center; color: var(--fg); }
.dgm svg { width: 200px; height: auto; display: block; overflow: visible; }

.figure { width: 100%; height: 132px; margin: 4px 0; border-radius: 14px; border: 1.5px dashed var(--muted); color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 10px; font-size: 11px; }
.figure b { letter-spacing: .12em; text-transform: uppercase; }
.figure img { max-width: 100%; max-height: 100%; }
.figure.has-img { border: 0; padding: 0; }

/* overflow flag */
.panel.overflow::after { content: 'Text overflows'; position: absolute; top: 160px; right: 20px; z-index: 9; background: var(--ui-err); color: #fff; font: 600 11px/1 Inter, sans-serif; padding: 5px 7px; border-radius: 5px; }
.panel.overflow { box-shadow: inset 0 0 0 4px var(--ui-err); }

@media (max-width: 1100px) {
	.main { grid-template-columns: 220px 1fr; }
	.panel-r { grid-column: 1 / -1; position: static; max-height: none; border-left: 0; border-top: 1px solid var(--ui-line); }
}
@media (max-width: 720px) {
	.main { grid-template-columns: 1fr; }
	.sidebar { position: static; max-height: 260px; }
}
@media (max-width: 1320px) { .brandmark small { display: none; } }
