:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-main);
  background: #f5f6f2;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --text-main: #192321;
  --text-quiet: #52605b;
  --surface-card: #ffffff;
  --line: #d7dfda;
  --accent: #1e5548;
  --focus: #a43e2e;
  --page: #f5f6f2;
  --accent-hover: #16483c;
  --accent-link: #174c40;
  --tag-text: #35443e;
  --control-border: #718179;
  --input-border: #9aa9a1;
  --soft-surface: #edf3f0;
  --notice-bg: #fff8f4;
}
:root[data-theme="night"] { background:#121816; color-scheme: dark; --page:#121816; --text-main:#f0f4f1; --text-quiet:#c0cbc4; --surface-card:#1c2521; --line:#46534c; --accent:#9bd3bd; --accent-hover:#b4e3d0; --accent-link:#b5e6d1; --tag-text:#d6e2da; --control-border:#899990; --input-border:#899990; --soft-surface:#293630; --notice-bg:#392721; --focus:#ffca66; }
:root[data-theme="day"] { color-scheme: light; }

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--text-main); font-size: 16px; line-height: 1.55; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.page { width: min(100% - 32px, 760px); margin: 32px auto 80px; }
.skip-link { position: absolute; left: 8px; top: -100px; z-index: 10; padding: 10px 14px; background: var(--surface-card); color: var(--text-main); border: 2px solid var(--focus); border-radius: 6px; }
.skip-link:focus { top: 8px; }
.page-header { margin-bottom: 28px; }
.eyebrow { color: var(--text-quiet); font-size: 14px; letter-spacing: .04em; margin: 0 0 5px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(28px, 5vw, 38px); line-height: 1.2; margin-bottom: 0; letter-spacing: -.025em; }
h2 { font-size: 24px; line-height: 1.25; margin-bottom: 12px; }
h3 { font-size: 20px; line-height: 1.3; margin-bottom: 12px; }
.panel, .problem-card { background: var(--surface-card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.panel { margin-bottom: 24px; }
.quiet { color: var(--text-quiet); }
.account-row, .week-heading, .button-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-row { margin-bottom: 18px; }
.main-navigation { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 20px; }
.main-navigation button { min-height: 44px; border: 1px solid var(--control-border); border-radius: 8px; padding: 7px 12px; color: var(--accent); background: var(--surface-card); font: inherit; }
.main-navigation button:hover { background: var(--soft-surface); }
.account-row p { margin: 0; }
.week-heading { margin: 30px 0 18px; }
.week-heading h2, .week-heading p { margin-bottom: 3px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; border: 2px solid var(--accent); border-radius: 8px; padding: 9px 16px; background: var(--accent); color: var(--page); font-weight: 650; }
.button:hover { background: var(--accent-hover); }
.button:disabled { cursor: not-allowed; opacity: .6; }
.button-quiet { background: transparent; color: var(--accent); }
.button-quiet:hover { background: var(--soft-surface); }
label { display: block; font-weight: 650; margin-bottom: 8px; }
textarea, input, select { display: block; width: 100%; min-height: 46px; border: 1px solid var(--input-border); border-radius: 7px; padding: 10px 12px; margin: 6px 0 16px; background: var(--surface-card); color: var(--text-main); line-height: 1.5; }
textarea { resize: vertical; }
input[type=range] { min-height: 24px; padding: 0; }
#graph-weight { display: inline-block; width: 20px; min-height: 20px; margin: 0 8px 0 0; padding: 0; vertical-align: middle; accent-color: var(--accent); }
.option-row input[type=radio] { display: inline-block; width: 24px; height: 24px; min-height: 24px; margin: 0 12px 0 0; padding: 0; flex: 0 0 24px; }
.intent-picker label { display: flex; align-items: center; gap: 8px; }
.intent-picker input[type=checkbox] { display: inline-block; width: 24px; height: 24px; min-height: 24px; margin: 0; padding: 0; flex: 0 0 24px; }
.appearance-control { display:flex; align-items:center; gap:8px; margin:0; font-size:14px; }
.appearance-control select { width:auto; min-height:40px; margin:0; }
#appearance-settings .button-row label { display:flex; align-items:center; gap:8px; }
#appearance-settings input[type=radio] { width:20px; min-height:20px; margin:0; padding:0; }
#settings-saved { margin: 10px 0 0; }
textarea:focus, input:focus, select:focus, button:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 20px 0; padding: 18px 0 0; }
legend { font-size: 18px; font-weight: 700; padding-right: 10px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.geography-grid { grid-template-columns: repeat(3, 1fr); }
.button-row { justify-content: flex-start; flex-wrap: wrap; }
.notice { border-left: 4px solid var(--focus); padding: 10px 14px; background: var(--notice-bg); border-radius: 4px; }
.notice:empty { margin: 0; padding: 0; border: 0; background: transparent; }
.cards { display: grid; grid-template-columns: 1fr; gap: 16px; }
.problem-card h3 { margin-bottom: 12px; }
.problem-card p { max-width: 70ch; margin-bottom: 14px; }
.gate-line { border-left: 3px solid var(--accent); padding: 4px 0 4px 12px; }
.source-line { color: var(--text-quiet); font-size: 15px; }
.source-line a { color: var(--accent-link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.tag { border: 1px solid var(--line); padding: 3px 9px; border-radius: 999px; color: var(--tag-text); font-size: 14px; }
.marks { display: flex; gap: 8px; flex-wrap: wrap; color: var(--text-quiet); font-size: 14px; }
.rating { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 16px; }
.rating-label { display: block; font-weight: 650; margin-bottom: 8px; }
.rating-buttons { display: flex; gap: 8px; }
.rating-button { width: 48px; min-height: 48px; border: 1px solid var(--control-border); border-radius: 8px; background: var(--surface-card); color: var(--text-main); font-weight: 700; }
.rating-button[aria-pressed="true"] { background: var(--accent); color: var(--page); border-color: var(--accent); }
.report { font-size: 15px; }
.profile-proposal, .profile-history-entry { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 16px; }
.profile-proposal input { max-width: 70ch; }
#profile-current h4 { margin: 16px 0 6px; }
#profile-current p, #profile-history p { margin: 4px 0 10px; }
.tool-row, .tool-add-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.tool-row > span { min-width: 12ch; }
.tool-add-form input { max-width: 32ch; }
.option-tool { color: var(--text-quiet); font-size: 14px; }
.report p { margin-bottom: 6px; }
.report details { margin-top: 12px; }
.report summary { cursor: pointer; font-weight: 650; }
.report ul { padding-left: 22px; overflow-wrap: anywhere; }
.setup-state { margin-top: 20px; }
#clerk-sign-in { margin-top: 20px; }
.choice-block, .sources-block { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.choice-block h4, .sources-block h4 { font-size: 17px; margin: 0 0 12px; }
.option-group { border: 0; margin: 0; padding: 0; }
.option-group legend { font-size: 15px; margin-bottom: 8px; }
.option-row { display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 8px 0; cursor: pointer; }
.option-row:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.option-row input { width: 20px; min-height: 20px; margin: 3px 0 0; flex: 0 0 auto; accent-color: var(--accent); }
.option-details { display: grid; gap: 4px; }
.option-text { line-height: 1.45; }
.option-tags { color: var(--text-quiet); font-size: 14px; }
.option-cue { display: block; color: var(--text-quiet); font-size: 14px; }
.option-muted { cursor: default; opacity: .62; }
.choice-actions, .reason-chips, .idea-clusters { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.choice-actions > .button { flex: 1; }
.chip-button, .idea-cluster { border: 1px solid var(--control-border); background: var(--surface-card); color: var(--text-main); border-radius: 999px; padding: 7px 12px; min-height: 40px; }
.chip-button[aria-pressed="true"], .idea-cluster[aria-pressed="true"] { background: var(--accent); color: var(--page); }
.own-form, .edit-form { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.own-form textarea, .edit-form textarea { max-width: 100%; }
.decision-state { font-weight: 650; margin-top: 10px; }
.sources-block .source-line { margin-bottom: 7px; }
.idea-clusters { margin: 16px 0; }
.tag-option { display: flex; align-items: center; gap: 8px; padding: 4px 8px; }
.tag-option input { width: 20px; min-height: 20px; margin: 0; }
#idea-tag-picker { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 16px; }
#idea-tag-picker summary, .gauge-section > summary, .gauge-row > summary { cursor: pointer; font-weight: 650; }
.gauge-section { background: var(--surface-card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 12px; }
.gauge-row { padding: 12px; margin: 10px 0; }
.ideas-list { display: grid; gap: 12px; }
.idea-card { background: var(--surface-card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.gauge-link { color: inherit; text-decoration: none; }
.idea-card h3 { font-size: 18px; margin-bottom: 8px; }
.idea-card p { margin-bottom: 8px; }
.idea-problem-title { font-weight: 650; }
.graph-list { display: grid; gap: 10px; }
.graph-row { background: var(--surface-card); border: 1px solid var(--line); border-radius: 8px; padding: 0 14px; }
.graph-row summary { min-height: 52px; display: flex; align-items: center; cursor: pointer; }
.graph-title-button { border: 0; background: transparent; color: var(--text-main); padding: 4px 0; text-align: left; font-weight: 700; }
.graph-title-button:hover { text-decoration: underline; }
.graph-row-body { padding: 8px 4px 18px; }
.graph-row-body ul { padding-left: 22px; }
.graph-row-body li { margin: 7px 0; }
#graph-tags { min-height: 100px; }
.edited-mark { display: inline-block; color: var(--text-quiet); font-size: 14px; }
[hidden] { display: none !important; }

@media (max-width: 600px) {
  .page { width: min(100% - 24px, 760px); margin-top: 24px; }
  .panel, .problem-card { padding: 18px; }
  .field-grid, .geography-grid { grid-template-columns: 1fr; }
  .week-heading { align-items: flex-start; flex-direction: column; }
  .week-heading .button { width: 100%; }
}
