/* Question register — plain, readable, phone-first. No external fonts or assets. */
:root {
  --bg: #f7f6f2;
  --panel: #ffffff;
  --ink: #1f2421;
  --muted: #5f6763;
  --line: #dcdad2;
  --accent: #2f5d50;
  --accent-ink: #ffffff;
  --warn: #8a4b00;
  --danger: #a12a2a;
  --radius: 10px;
  --focus: #1d6fd6;
  /* status colours — always paired with a text label and an icon */
  --st-not_started: #ececec; --st-not_started-ink: #333;
  --st-open: #e8e6ff;        --st-open-ink: #3b3486;
  --st-accepted: #dcf1e5;    --st-accepted-ink: #1e5a3a;
  --st-rejected: #f8e3e3;    --st-rejected-ink: #7a2525;
  --st-concluded: #e3eefb;   --st-concluded-ink: #1f4b7a;
  --st-withdrawn: #f6efdc;   --st-withdrawn-ink: #6a5216;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161917; --panel: #1f2421; --ink: #e9ece9; --muted: #a2aaa5; --line: #36403b;
    --accent: #7fc4ad; --accent-ink: #0f1a16; --warn: #f0b35e; --danger: #f08a8a; --focus: #7db4ff;
    --st-not_started: #2e2e2e; --st-not_started-ink: #ddd;
    --st-open: #2e2b55; --st-open-ink: #d6d2ff;
    --st-accepted: #1e3b2c; --st-accepted-ink: #bfead1;
    --st-rejected: #462424; --st-rejected-ink: #f5c7c7;
    --st-concluded: #1e3048; --st-concluded-ink: #c6dcf6;
    --st-withdrawn: #3d3420; --st-withdrawn-ink: #f0dfae;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px;
}
h1 { font-size: 1.5rem; line-height: 1.25; margin: .3rem 0 .6rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: .6rem 0 .4rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.warn { color: var(--warn); }
.error { color: var(--danger); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--panel); padding: 8px; z-index: 10; }
.loading { padding: 2rem; color: var(--muted); }
.site-footer { max-width: 920px; margin: 0 auto; padding: 16px 12px 32px; text-align: center; font-size: .85rem; color: var(--muted); }
.site-footer a { color: inherit; }

#app { max-width: 920px; margin: 0 auto; padding: 0 12px 24px; }
main { display: block; }
.home { max-width: 640px; margin: 10vh auto; padding: 0 16px; }

/* header */
.top { position: sticky; top: 0; background: var(--bg); z-index: 5; padding-top: 8px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.space-name { font-weight: 700; font-size: 1.1rem; text-decoration: none; color: var(--ink); }
.who { display: flex; gap: 8px; align-items: center; font-size: .9rem; }

/* panels and forms */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 14px; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.row.wrap { flex-wrap: wrap; }
button, .button {
  font: inherit; font-size: .95rem; padding: 8px 14px; min-height: 40px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); text-decoration: none; display: inline-flex; align-items: center;
}
button:hover, .button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
button.danger-link { color: var(--danger); }
button.link { background: none; border: none; padding: 0; min-height: 0; color: var(--accent); text-decoration: underline; }
button:disabled { opacity: .6; cursor: progress; }
input[type=text], input[type=url], input[type=search], input[type=number], input[type=datetime-local], select, textarea {
  font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink);
}
input.num { width: 6rem; }
textarea { resize: vertical; }
.field { display: block; margin: 10px 0; }
.field .label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.field .hint, .hint { display: block; color: var(--muted); font-size: .85rem; margin-top: 4px; }
label.inline { display: inline-flex; gap: 6px; align-items: baseline; margin: 6px 12px 6px 0; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 10px 0; padding: 8px 12px; }
legend { font-weight: 600; font-size: .9rem; padding: 0 4px; }
.inline-form { background: var(--panel); border: 2px solid var(--accent); border-radius: var(--radius); padding: 14px; margin: 0 0 14px; }
.inline-form h3 { margin-top: 0; }

/* composer */
.composer input#composer-input, .composer > input { font-size: 1.1rem; padding: 12px; }
.composer-panel:not(:empty) { margin-top: 10px; }
.composer-prompt { margin: 0 0 8px; }
.composer textarea { margin-top: 8px; }
.link-preview { padding: 8px 10px; background: var(--bg); border-radius: 8px; }
.notice { background: var(--bg); border-left: 4px solid var(--warn); padding: 8px 12px; border-radius: 6px; }
.tool-hints summary { cursor: pointer; }
.tool-hints ul { margin: 4px 0 0; padding-left: 18px; }
.tool-hints li { margin: 2px 0; }
.hints .hint-list { margin: 4px 0 0; padding-left: 18px; }
.hints:not(:empty) { margin: 8px 0; }

/* toolbar, filters */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 8px; }
.search { display: flex; gap: 6px; flex: 1 1 260px; }
.search-btn { padding: 8px 12px; }
@media (max-width: 560px) {
  .toolbar { gap: 8px; }
  /* the view toggle and the search field share the first row, the lanes take the next one (as on wider screens) */
  .search { flex: 1 1 0; min-width: 0; }
  .search input { width: 100%; min-width: 0; }
  .search-btn { padding: 8px 10px; }
  .toolbar .sublanes { gap: 4px; }
  .toolbar .sublane { padding: 4px 9px; font-size: .85rem; }
}
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border-radius: 999px; padding: 4px 12px; min-height: 34px; font-size: .88rem; }
.chip-btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip-btn.on::before { content: "✓ "; }
.filters { margin: 0 0 12px; }
.filters summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
/* Multi-select filters: a button per filter that opens a list of boxes */
.dd-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 10px; }
/* Order and Children share the line with the dropdowns (and wrap with them): label and select side by side */
.dd-row .field { display: flex; align-items: center; gap: 6px; margin: 0 0 0 6px; }
.dd-row .field .label { margin: 0; font-weight: 400; font-size: .88rem; color: var(--muted); white-space: nowrap; }
.dd-row .field select { width: auto; min-height: 34px; padding: 3px 8px; font-size: .88rem; }
.dd { position: relative; }
.dd-btn { gap: 6px; max-width: 100%; }
.dd-btn.on::before { content: none; }
.dd-btn.on { background: var(--bg); color: var(--ink); border-color: var(--accent); border-width: 2px; padding: 3px 11px; font-weight: 600; }
.dd-caret { font-size: .8em; opacity: .7; }
.dd-panel { position: absolute; left: 0; top: calc(100% + 4px); z-index: 8; min-width: 13rem; max-width: min(22rem, calc(100vw - 24px)); max-height: 60vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,.15); padding: 4px; }
.dd-panel[hidden] { display: none; }
.dd-opt { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: .95rem; }
.dd-opt:hover { background: var(--bg); }
.dd-opt input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--accent); }
.dd-panel > .link { margin: 4px 10px 6px; }

/* cards */
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.card.is-changed { border-left: 4px solid var(--accent); }
.card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card-title { font-weight: 600; font-size: 1.02rem; color: var(--ink); text-decoration: none; }
.card-title:hover { text-decoration: underline; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .88rem; margin-top: 6px; align-items: center; }
.card-criteria { font-size: .88rem; color: var(--muted); margin-top: 4px; }
.card-links { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: .85rem; color: var(--muted); margin-top: 4px; }
.card-links a { color: inherit; text-decoration-color: var(--line); }
/* Children sit under their parent, with a discreet branch: a line down the side and a tick to each card. */
.cards.children { margin: 8px 0 0 12px; padding-left: 16px; border-left: 2px solid var(--line); }
.cards.children > .node > .card::before { content: ""; position: absolute; left: -18px; top: 22px; width: 16px; border-top: 2px solid var(--line); }
.cards.children > .node.is-duplicate > .card::before { border-top-style: dashed; }
.card-tag { font-size: .8rem; font-weight: 600; color: var(--muted); }
/* Related questions kept together: a dotted line across the gap between their cards. */
.node.cluster-prev { position: relative; }
.node.cluster-prev::before { content: ""; position: absolute; left: 22px; top: -10px; height: 10px; border-left: 2px dotted var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }

.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.st-not_started { background: var(--st-not_started); color: var(--st-not_started-ink); }
.st-open { background: var(--st-open); color: var(--st-open-ink); }
.st-accepted { background: var(--st-accepted); color: var(--st-accepted-ink); }
.st-rejected { background: var(--st-rejected); color: var(--st-rejected-ink); }
.st-concluded { background: var(--st-concluded); color: var(--st-concluded-ink); }
.st-withdrawn { background: var(--st-withdrawn); color: var(--st-withdrawn-ink); }
/* process states: outlined, so they read as "the platform says…" next to the question's filled pill */
.ps-not_started, .ps-unknown { border-color: var(--line); color: var(--muted); font-weight: 500; }
.ps-open { border-color: var(--st-open-ink); color: var(--st-open-ink); font-weight: 500; }
.ps-accepted { border-color: var(--st-accepted-ink); color: var(--st-accepted-ink); }
.ps-rejected { border-color: var(--st-rejected-ink); color: var(--st-rejected-ink); }
.ps-concluded { border-color: var(--st-concluded-ink); color: var(--st-concluded-ink); }
.ps-withdrawn { border-color: var(--st-withdrawn-ink); color: var(--st-withdrawn-ink); }
.chip { display: inline-flex; flex-wrap: wrap; gap: 3px; align-items: center; padding: 2px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.chip-tool { font-weight: 600; }
.chip-filter { color: inherit; text-decoration: none; border-radius: 4px; padding: 0 3px; }
.chip-filter:hover, .chip-filter:focus-visible { text-decoration: underline; }
.chip-filter.on { background: var(--accent); color: var(--accent-ink); }
.badge { display: inline-block; font-size: .8rem; padding: 2px 8px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); }
.badge.changed { border-style: dashed; }

/* question page */
.back { display: inline-block; margin-bottom: 4px; text-decoration: none; }
.q-head { margin-bottom: 14px; }
.why { font-size: 1.02rem; margin: .5rem 0; white-space: pre-wrap; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 8px 0 0; font-size: .92rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
blockquote { margin: 6px 0; padding: 4px 10px; border-left: 3px solid var(--line); white-space: pre-wrap; }
details summary { cursor: pointer; }
.radios label { display: block; margin: 4px 0; }
input.wide { width: 100%; }
.rel-list { list-style: none; padding-left: 0; }
.rel-list li { margin: 4px 0; }
.rel-kind { font-size: .85rem; color: var(--muted); }
.rel-hint { margin: 0 0 10px; }
.activity { list-style: none; padding: 0; margin: 0; }
.act { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .92rem; overflow-wrap: anywhere; }
.act:last-child { border-bottom: none; }
.act-actor { font-weight: 600; }
.act-detail { color: var(--muted); }

/* rules */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.disabled td { color: var(--muted); }
.md h2 { font-size: 1.25rem; } .md h3 { font-size: 1.05rem; margin-top: 1rem; }

/* overlay, toast */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 20; padding: 16px; }
.modal { max-width: 440px; width: 100%; }
dialog.modal-dialog { border: 0; padding: 0; background: transparent; color: inherit; max-width: 440px; width: calc(100% - 32px); }
dialog.modal-dialog::backdrop { background: rgba(0,0,0,.45); }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(120%); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 8px; max-width: calc(100% - 32px); transition: transform .2s; z-index: 30; }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); color: #fff; display: flex; align-items: center; gap: 12px; }
.toast:not(.show) { visibility: hidden; }
.toast-close { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; min-width: 24px; min-height: 24px; }
.toast.ok { background: var(--accent); color: var(--accent-ink); }

@media (max-width: 560px) {
  h1 { font-size: 1.3rem; }
  .card-head { flex-direction: column; gap: 4px; }
  .meta { grid-template-columns: 1fr; }
  .meta dt { margin-top: 6px; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* label → category editor (tool states, status labels) */
.map-editor { margin: 6px 0 10px; }
.map-head, .map-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 12rem) auto; gap: 6px; align-items: center; }
.map-head { grid-template-columns: minmax(0, 1fr) minmax(0, 12rem); padding-right: 2rem; }
.map-row { margin: 4px 0; }
.map-row input, .map-row select { width: 100%; }
.notice-existing { border-left: 4px solid var(--warn); padding: 6px 10px; background: var(--bg); border-radius: 6px; margin: 6px 0; }
.removed-banner { border: 2px dashed var(--danger); border-radius: 8px; padding: 8px 12px; margin: 10px 0; }

/* external link on process chips */
.chip-ext { text-decoration: none; font-weight: 600; padding: 0 3px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; min-width: 24px; min-height: 24px; }
.hint-list a.muted, .rel-list a.muted { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; min-height: 24px; }
.map-row button.link { min-width: 24px; min-height: 24px; }
.chip-ext:hover, .chip-ext:focus-visible { background: var(--line); }

/* drag and drop a link anywhere */
body.dropping::after {
  content: "Drop the link to add it";
  position: fixed; inset: 10px; z-index: 50; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  border: 3px dashed var(--accent); border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 85%, transparent);
  font-size: 1.4rem; font-weight: 600; color: var(--accent);
}

/* Timeline */
.timeline { margin-top: 8px; }
.tl-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin: 4px 0 10px; color: var(--muted); }
.tl-key { display: inline-block; width: 18px; height: 10px; vertical-align: middle; }
.tl-key.ongoing { background: var(--st-open); border: 1px solid var(--st-open-ink); border-right: 2px dashed var(--st-open-ink); border-radius: 5px 0 0 5px; }
.tl-key.planned { border: 1px dashed var(--muted); border-left: none; border-radius: 0 5px 5px 0; }
.tl-key.today { width: 0; height: 14px; border-left: 2px solid var(--accent); }
.tl-scroll { overflow-x: auto; }
.tl-chart { --tl-label: 15rem; min-width: 640px; }
.tl-row { display: grid; grid-template-columns: var(--tl-label) 1fr; align-items: center; }
.tl-rows { list-style: none; margin: 0; padding: 0; }
.tl-rows .tl-row:hover { background: var(--panel); }
.tl-body { position: relative; }
.tl-label { min-width: 0; padding-right: 10px; font-size: .9rem; }
.tl-label.tl-child { display: flex; align-items: baseline; }
.tl-label.tl-child a { flex: 1; min-width: 0; }
.tl-branch { color: var(--muted); margin-right: 4px; flex: none; }
.tl-label a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-track { position: relative; height: 26px; }
.tl-axis .tl-track { height: 1.7em; }
.tl-tick { position: absolute; top: 0; padding-left: 4px; font-size: .75rem; color: var(--muted); white-space: nowrap; border-left: 1px solid var(--line); }
.tl-grid { position: absolute; top: 0; bottom: 0; left: var(--tl-label); right: 0; pointer-events: none; }
.tl-gridline { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); opacity: .6; }
.tl-today { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--accent); }
.tl-bar, .tl-planned { position: absolute; top: 6px; height: 14px; }
.tl-bar { min-width: 8px; border-radius: 7px; border: 1px solid currentColor; }
.tl-bar.ongoing { border-radius: 7px 0 0 7px; border-right: 2px dashed currentColor; }
.tl-bar.scheduled { background: transparent; border-style: dashed; border-radius: 7px; min-width: 12px; }
.tl-bar.unknown-end { width: 36px; border-right: none; border-radius: 7px 0 0 7px; background-image: linear-gradient(to right, transparent 30%, var(--bg)); }
.tl-planned { border: 1px dashed var(--muted); border-left: none; border-radius: 0 7px 7px 0; }
.tl-key.unknown-end { background: var(--st-concluded); background-image: linear-gradient(to right, transparent 30%, var(--bg)); border: 1px solid var(--st-concluded-ink); border-right: none; border-radius: 5px 0 0 5px; }
.dates-field { border: 0; padding: 0; margin: 0 0 10px; }
.dates-field legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
.date-choice { display: block; margin: 4px 0; }
.date-choice input[type=date], .date-choice input[type=time] { width: auto; display: inline-block; }
@media (max-width: 560px) { .tl-chart { --tl-label: 9rem; } }

/* Fields: retrieved or typed */
.field-cell { display: inline; }
.q-head .field-cell { display: block; }
.q-head .field-cell h1 { display: inline; margin-right: 8px; }
.field-meta { white-space: nowrap; }
.src { display: inline-block; margin-left: 8px; padding: 0 6px; border-radius: 4px; font-size: .75rem; letter-spacing: .02em; vertical-align: middle; }
.src-retrieved { color: var(--accent); border: 1px solid var(--accent); }
.src-typed { color: var(--warn); border: 1px dashed var(--warn); }
.src-empty { color: var(--muted); border: 1px dotted var(--line); }
button.edit-field { margin-left: 4px; font-size: .9rem; min-width: 24px; min-height: 24px; }
.field-retrieved { font-size: .85rem; color: var(--muted); margin-top: 2px; }
.field-editor { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.field-editor input[type=text], .field-editor input[type=url] { min-width: 16rem; }
.field-editor .row { margin: 0; }
.field-list dd { margin-bottom: 4px; }
[title="Double-click to type a value"] { cursor: text; }


/* Details shown while creating a question */
.create-fields { margin: 10px 0; }
.create-fields .field { margin: 8px 0; }
.create-fields input[type=text], .create-fields select { width: 100%; max-width: 32rem; }

/* Lanes under the List / Timeline tabs */
.sublanes { display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; }
.sublane { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.sublane:hover { border-color: var(--muted); }
.sublane.current { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
.space-name:hover { text-decoration: underline; }

/* Dashboard */
/* Widgets flow in a 4-column grid. Row heights follow the content — no fixed
   cells and no inner scrollbars: every row is as tall as its tallest widget and
   the others in that row stretch to match, so nothing gets clipped. Each widget
   spans 1, 2 or 4 columns (c1/c2/c4); on narrower screens the grid drops to 2
   then 1 column and the spans collapse. */
.dash-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: auto; grid-auto-flow: row dense; gap: 12px; align-items: stretch; }
.widget { margin: 0; display: flex; flex-direction: column; min-height: 0; }
.widget[hidden] { display: none; }
.widget-body { flex: 1; min-width: 0; }
.c1 { grid-column: span 1; } .c2 { grid-column: span 2; } .c3 { grid-column: span 3; } .c4 { grid-column: span 4; }
@media (max-width: 1024px) {
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .c1 { grid-column: span 1; } .c2, .c3, .c4 { grid-column: span 2; }
}
@media (max-width: 640px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .c1, .c2, .c3, .c4 { grid-column: 1 / -1; }
}
.widget-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.widget-head h2 { margin: 0; }
.widget-hide { min-height: 0; padding: 0 4px; opacity: .7; }
.widget:hover .widget-hide, .widget-hide:focus-visible { opacity: 1; }
.widget-choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 2px 12px; }
.widget-choice label { align-items: flex-start; }

/* Big numbers and tiles (At a glance, Your impact) */
.big { font-size: 1.8rem; font-weight: 700; line-height: 1.15; margin: 0; display: block; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr)); gap: 8px; }
.tiles.compact .big { font-size: 1.4rem; }
.tile { display: flex; flex-direction: column; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); text-decoration: none; color: var(--ink); }
a.tile:hover { border-color: var(--muted); }

/* Lists shared by the widgets */
.bar-rows, .plain, .checks, .legend, .badges-grid { list-style: none; margin: 0; padding: 0; }

/* A labelled bar: name and count on one line, the bar across the full width below. */
.bar-rows li { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; row-gap: 3px; align-items: baseline; margin: 8px 0; font-size: .92rem; }
.bar-rows li:first-child { margin-top: 0; }
.bar-label { min-width: 0; overflow-wrap: anywhere; }
.bar-label a { text-decoration: none; }
.bar-label a:hover { text-decoration: underline; }
.bar-n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.bar { grid-column: 1 / -1; display: block; height: 8px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); }
.bar-fill.muted-fill { background: var(--muted); opacity: .45; }
.bar-fill.done { background: var(--st-accepted-ink); }

/* Status strip and its legend */
.stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.seg { display: block; flex-basis: 0; min-width: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 0 0; font-size: .9rem; }
.legend li { display: inline-flex; align-items: center; gap: 5px; }
.legend a { text-decoration: none; }
.legend strong { font-variant-numeric: tabular-nums; }

/* Momentum bars, one group per week */
.momentum { display: flex; align-items: flex-end; gap: 4px; height: 96px; border-bottom: 1px solid var(--line); }
.mweek { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.mcol { display: block; width: 42%; max-width: 14px; border-radius: 3px 3px 0 0; }
.mcol.added, .key.added { background: var(--muted); opacity: .6; }
.mcol.answered, .key.answered { background: var(--accent); }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: baseline; }
.axis { display: flex; justify-content: space-between; margin-top: 3px; }
.mlabels { display: flex; flex-wrap: wrap; gap: 2px 18px; margin: 8px 0 0; }

/* Needs attention */
.checks li { padding: 4px 0; font-size: .92rem; }
.checks .todo span { color: var(--warn); }
.checks .ok { color: var(--muted); }

/* Recently answered */
.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.plain li:first-child { padding-top: 0; }
.plain li:last-child { border-bottom: none; }

/* Milestones */
.badges-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 8px; }
.ms { display: flex; gap: 8px; align-items: center; padding: 7px 10px; border: 1px dashed var(--line); border-radius: 8px; opacity: .65; font-size: .9rem; }
.ms.done { opacity: 1; border-style: solid; border-color: var(--accent); background: var(--bg); }
.ms .muted { margin-left: auto; }
.ms-icon { font-size: 1.1rem; }

/* Menu (top right) and view toggle */
.menu { position: relative; }
.menu-btn { display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; min-height: 36px; }
.menu-btn[aria-expanded="true"] { border-color: var(--muted); }
.burger { display: inline-flex; flex-direction: column; gap: 3px; }
.burger i { display: block; width: 14px; height: 2px; background: currentColor; border-radius: 1px; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); min-width: 12rem; z-index: 10; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,.15); padding: 4px; display: flex; flex-direction: column; gap: 2px; }
.menu-list[hidden] { display: none; }
.menu-list a, .menu-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px; min-height: 0; border-radius: 6px; color: var(--ink); text-decoration: none; font: inherit; font-size: .95rem; cursor: pointer; }
.menu-list a:hover, .menu-list button:hover, .menu-list a:focus-visible, .menu-list button:focus-visible { background: var(--bg); }
.menu-list a[aria-current] { font-weight: 600; }
.view-toggle { display: inline-flex; flex: none; align-self: stretch; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.view-btn { display: inline-flex; align-items: center; justify-content: center; width: 42px; min-height: 40px; color: var(--muted); background: var(--panel); text-decoration: none; }
.view-btn + .view-btn { border-left: 1px solid var(--line); }
.view-btn:hover { color: var(--ink); }
.view-btn.current { background: var(--ink); color: var(--bg); }
/* The two view symbols share one 18×15 box and three 3px rows, so they weigh the same and neither looks like the burger:
   the list is a bulleted one (dot + line), the timeline three bars shifted along the time axis. */
.ico { display: grid; grid-template-rows: repeat(3, 3px); gap: 3px; width: 18px; height: 15px; }
.ico i { display: block; position: relative; height: 3px; border-radius: 1px; }
.ico-list i::before { content: ""; position: absolute; left: 0; top: 0; width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.ico-list i::after { content: ""; position: absolute; left: 6px; right: 0; top: 0; height: 3px; border-radius: 1px; background: currentColor; }
.ico-timeline i { background: currentColor; }
.ico-timeline i:nth-child(1) { width: 60%; margin-left: 0; }
.ico-timeline i:nth-child(2) { width: 60%; margin-left: 30%; }
.ico-timeline i:nth-child(3) { width: 50%; margin-left: 50%; }
.more-btn { min-width: 36px; justify-content: center; font-size: 1.2rem; line-height: 1; }
.row .menu { margin-left: auto; position: relative; }

/* Long-form static pages (privacy) */
.prose { margin-top: 5vh; }
.prose h2 { margin-top: 1.6rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin: .35rem 0; }
.help-states { list-style: none; padding-left: 0; } .help-states li { margin: 4px 0; }
.help h2, .about h2 { font-size: 1.1rem; margin: 1.2rem 0 .3rem; } .help h2:first-child, .about h2:first-child { margin-top: 0; }
.about textarea { width: 100%; }

/* Tool icons: logo (bundled or the site's favicon, served from here) or a monogram. Always next to the tool's name. */
.tool-icon { display: inline-block; width: 16px; height: 16px; flex: none; vertical-align: -3px; border-radius: 3px; object-fit: contain; }
.monogram {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700; line-height: 1; font-style: normal;
  background: hsl(var(--hue) 40% 86%); color: hsl(var(--hue) 45% 26%);
}
.hue-0 { --hue: 0; } .hue-1 { --hue: 35; } .hue-2 { --hue: 85; } .hue-3 { --hue: 150; }
.hue-4 { --hue: 190; } .hue-5 { --hue: 225; } .hue-6 { --hue: 270; } .hue-7 { --hue: 320; }
.tool-name { display: inline-flex; align-items: center; gap: 6px; }
.tool-cell { min-width: 14rem; }
.nowrap { white-space: nowrap; }
.handles summary { cursor: pointer; }
.handles-detail { margin-top: 6px; }
.handles-type { margin-bottom: 6px; }
.handles-type code { word-break: break-all; }
.tool-hints li .tool-icon { margin-right: 2px; }
@media (prefers-color-scheme: dark) {
  .monogram { background: hsl(var(--hue) 25% 28%); color: hsl(var(--hue) 50% 86%); }
  /* Single-colour logos are black: draw them light. Others sit on a light tile so dark logos stay visible. */
  img.tool-icon.mono { filter: invert(1); }
  img.tool-icon:not(.mono) { background: #f4f4f1; padding: 1px; }
}
