/* Shared design kit (docs/engineering/UI-KIT.md): the page-level patterns the Board rules redesign (#272) introduced,
   made generic for every redesigned page (storage/ops/ux-design/DESIGN-DIRECTION.md). Loaded by the application
   layout before each page's own stylesheets, so a page refines a kit piece with a selector of equal or higher
   specificity. Existing tokens only; moon-soft and mint-soft are the two derived tints the direction allows, and the
   "needs action" tint is the existing warning badge tint. Contrast: the pill text #2f3fa8 on #eef0ff is 7.7:1, the
   tag and done pill #0d5c2e on #e7fbef 7.5:1, the action pill #7a5a26 on #f6eddd 5.6:1 (dark 9.5:1, 10.0:1 and
   9.1:1); the dark highlight keeps 4.7:1 under ink text. */
:root { --moon-soft:#eef0ff; --moon-ink:#2f3fa8; --mint-soft:#e7fbef; --mint-ink:#0d5c2e; --mint-mark:var(--mint); --warn-soft:#f6eddd; --warn-ink:#7a5a26; }
:root[data-theme=dark] { --moon-soft:#2c2d4a; --moon-ink:#d4d8ff; --mint-soft:#1f3a2a; --mint-ink:#b8f5cf; --mint-mark:#2f7a4f; --warn-soft:#3d321c; --warn-ink:#ead2a3; }

/* Page head (UiKitHelper#page_head): the body's name, a large title and the status pill. */
.page-head { display:flex; justify-content:space-between; align-items:flex-end; gap:16px 24px; flex-wrap:wrap; margin:6px 0 28px; }
.page-head > div { min-width:0; }
.page-head-body { font-size:15px; color:var(--muted); margin:0 0 4px; }
.page-head h1 { font-size:46px; line-height:1.05; letter-spacing:-.02em; margin:0; color:var(--ink); }
html[lang=ar] .page-head h1 { font-size:42px; letter-spacing:0; font-weight:600; line-height:1.3; }

/* Status pill (UiKitHelper#status_pill): the words say the state; the tone only repeats it. */
.status-pill { display:inline-flex; align-items:center; gap:8px; margin:0; padding:7px 14px; border-radius:999px; background:var(--moon-soft); color:var(--moon-ink); font-size:13px; font-weight:500; max-width:100%; }
.status-pill-dot { width:8px; height:8px; flex:0 0 8px; border-radius:50%; background:var(--blue); }
.status-pill-done { background:var(--mint-soft); color:var(--mint-ink); }
.status-pill-done .status-pill-dot { background:var(--mint-ink); }
.status-pill-action { background:var(--warn-soft); color:var(--warn-ink); }
.status-pill-action .status-pill-dot { background:var(--warn-ink); }

/* Decision card (UiKitHelper#decide_card): where things stand, what changed, and at most one primary action. */
.decide-card { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); display:grid; grid-template-columns:minmax(0,1fr) auto; gap:16px 24px; align-items:center; padding:24px 28px; margin:0 0 36px; }
.decide-card h2 { font-size:19px; margin:0; color:var(--ink); }
.decide-card p { margin:0; }
.decide-card-text { display:grid; gap:6px; min-width:0; }
.decide-card-text > p { color:var(--muted); font-size:14px; max-width:62ch; }
.decide-card-actions { display:flex; flex-wrap:wrap; align-items:center; gap:10px 16px; justify-content:flex-end; margin:0; }
.decide-card-actions .button { min-height:44px; white-space:normal; }
.decide-card .text-link { min-height:44px; }
/* Below the text and actions (card.below): what else is waiting, across the card under a hairline. */
.decide-card-below { grid-column:1 / -1; display:grid; gap:20px; padding-top:18px; border-top:1px solid var(--line); min-width:0; }
.decide-card-below:empty { display:none; }
/* "Changed since draft N": one line under a hairline, in the card or in a notice. */
.change-line { margin:0; padding-top:14px; border-top:1px solid var(--line); font-size:14px; color:var(--ink); max-width:70ch; overflow-wrap:anywhere; }
.change-line b, .change-line strong { font-weight:600; }

/* Content with a history rail beside it; on phones the rail moves below. */
.rail-layout { display:grid; grid-template-columns:minmax(0,1fr) 260px; gap:40px; align-items:start; }
.rail-layout-main { min-width:0; }

/* Book panel and sentence rows (UiKitHelper#book_panel, #sentence_row): one white panel per topic, a muted label
   and one plain sentence per row, the key fact highlighted (.say strong), secondary facts muted below. */
.book-heading { display:flex; flex-wrap:wrap; align-items:baseline; gap:4px 12px; margin:0 0 12px; }
.book-heading h2 { font-size:17px; color:var(--ink); overflow-wrap:anywhere; }
.book-heading p { font-size:13px; color:var(--muted); margin:0; }
.book-panel { margin:0; background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; }
.sentence-row { display:grid; grid-template-columns:150px minmax(0,1fr); gap:28px; padding:26px 30px; border-top:1px solid var(--line); }
.sentence-row:first-child { border-top:0; }
.book-panel dt { font-size:14px; color:var(--muted); padding-top:4px; }
.book-panel dd { margin:0; min-width:0; }
.book-panel .say { font-size:21px; line-height:1.45; margin:0; max-width:38ch; color:var(--ink); overflow-wrap:anywhere; }
html[lang=ar] .book-panel .say { font-size:20px; line-height:1.65; max-width:40ch; }
.say strong { font-weight:600; background:linear-gradient(transparent 62%, var(--mint-mark) 62% 92%, transparent 92%); padding:0 2px; color:var(--ink); }
.book-panel .also { margin:10px 0 0; padding:0; list-style:none; color:var(--muted); font-size:14px; line-height:1.6; }
.book-panel .also li { margin-top:4px; padding-inline-start:14px; position:relative; }
.book-panel .also li::before { content:""; position:absolute; inset-inline-start:0; top:.7em; width:5px; height:5px; border-radius:50%; background:var(--moonlight); }
/* "New" or "Changed" beside a sentence or heading (UiKitHelper#change_tag). */
.change-tag { display:inline-block; margin-inline-start:6px; font-size:13px; line-height:1.5; font-weight:500; color:var(--mint-ink); background:var(--mint-soft); border-radius:999px; padding:1px 9px; vertical-align:3px; white-space:nowrap; }

/* Closed details at the bottom: "Source and reason", "For auditors" (UiKitHelper#auditor_details). */
.details-stack { margin-top:18px; display:grid; gap:10px; }
.auditor-details { background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:0 22px; font-size:14px; }
.auditor-details > summary { cursor:pointer; font-weight:500; color:var(--ink); padding:15px 0; line-height:1.5; }
.auditor-details > summary small { font-weight:400; font-size:13px; color:var(--muted); margin-inline-start:4px; }
.auditor-details[open] { padding-bottom:18px; }
.auditor-details h3 { font-size:14px; margin:12px 0 4px; color:var(--ink); }
.auditor-details .minute-draft-section { padding-inline:0; }
/* Change panel (ChangePanelHelper): the setting's sentence and a visible Change button; the unchanged form opens inline
   below. Not a disclosure: actions never sit in auditor details (UX audit 18 November 2026, rule 5). */
.change-panel { background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:14px 22px; min-width:0; }
.change-panel-head { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px 20px; min-width:0; }
.change-panel-text { flex:1 1 280px; min-width:0; display:grid; gap:4px; }
.change-panel-title { font-size:16px; margin:0; color:var(--ink); }
.change-panel-say.say { margin:0; font-size:15px; line-height:1.55; color:var(--ink); overflow-wrap:anywhere; }
.change-panel-button.button { min-height:44px; white-space:normal; flex:0 0 auto; }
.change-panel-body { margin-top:14px; padding-top:14px; border-top:1px solid var(--line); min-width:0; }
.change-panel-body[hidden] { display:none; }
.change-panel-body h3 { font-size:14px; margin:12px 0 4px; color:var(--ink); }
.change-panel-body .button { min-height:44px; white-space:normal; }
/* A panel whose sentence is in the row around it (Workspace settings) is only its button and form, without a box. */
.change-panel:not(:has(.change-panel-text)) { background:none; border:0; padding:0; }
.change-panel:not(:has(.change-panel-text)) .change-panel-head { justify-content:flex-start; }
.change-panel:not(:has(.change-panel-text)) .change-panel-body { border-top:0; padding-top:0; margin-top:10px; }
/* The last, separated place for a destructive step (danger button, confirmed, never primary). */
.danger-zone { margin:28px 0 0; padding-top:18px; border-top:1px solid var(--line); display:grid; gap:10px; }
.danger-zone > h2 { font-size:16px; margin:0; color:var(--ink); }
.danger-zone > p { margin:0; color:var(--muted); font-size:14px; max-width:70ch; }
.danger-zone .button { min-height:44px; white-space:normal; justify-self:start; }

/* History rail (UiKitHelper#history_rail, #history_entry): a quiet timeline, the shown version with the blue dot. */
.history-rail { min-width:0; }
.history-rail h2 { font-size:15px; margin:4px 0 14px; color:var(--ink); }
.history-list { list-style:none; padding:0; margin:0; border-inline-start:2px solid var(--line); }
.history-list li { position:relative; padding-inline-start:18px; padding-bottom:8px; }
.history-list li::before { content:""; position:absolute; inset-inline-start:-6px; top:17px; width:10px; height:10px; border-radius:50%; background:var(--line); }
.history-list li.is-current::before { background:var(--blue); }
.history-list a { display:flex; align-items:center; min-height:44px; font-weight:500; color:var(--ink); }
.history-list a[aria-current=page] { text-decoration:underline; text-underline-offset:3px; }
.history-list span { display:block; color:var(--muted); font-size:13px; overflow-wrap:anywhere; }
.history-rail-link { min-height:44px; margin-top:4px; text-decoration:underline; text-underline-offset:3px; }

/* Quiet step tabs (UiKitHelper#step_tabs): the steps of one task as plain links; the current one underlined. */
.step-tabs ol { display:flex; flex-wrap:wrap; gap:4px 20px; list-style:none; margin:0 0 24px; padding:0; border-bottom:1px solid var(--line); }
.step-tabs a { display:inline-flex; align-items:center; min-height:44px; font-size:14px; font-weight:500; color:var(--muted); border-bottom:2px solid transparent; margin-bottom:-1px; }
.step-tabs a:hover { color:var(--ink); }
.step-tabs a[aria-current] { color:var(--ink); border-bottom-color:var(--ink); }

/* Answer panel with large choice cards (shared/_choice_cards), grown from the interest statement choices. */
.choice-cards { border:0; padding:0; margin:0 0 20px; min-width:0; }
.choice-cards > legend { padding:0; margin-block-end:12px; font-size:15px; font-weight:600; line-height:1.6; }
.choice-cards-options { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:10px; }
.choice-card { display:flex; align-items:center; gap:12px; min-height:56px; padding:12px 14px; border:1.5px solid var(--line); border-radius:12px; background:var(--surface); cursor:pointer; font-size:15px; font-weight:500; line-height:1.5; }
.choice-card input { flex:0 0 20px; width:20px; height:20px; margin:0; accent-color:var(--ink); }
.choice-card > span { min-width:0; overflow-wrap:anywhere; }
.choice-card small { display:block; font-weight:400; color:var(--muted); }
.choice-card:hover { background:var(--hover); }
.choice-card:has(input:checked) { border-color:var(--ink); background:var(--hover); box-shadow:0 0 0 1px var(--ink); }
.choice-card:has(input:focus-visible) { outline:2px solid var(--blue); outline-offset:3px; }

/* Phone action bar (UiKitHelper#phone_action_bar): holds the page's one next step; sticks to the bottom on phones. */
.phone-action-bar { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-top:24px; }
.phone-action-bar .button { min-height:44px; white-space:normal; }

/* People rows and list rows (UiKitHelper#people_row, #list_row). */
.people-rows, .list-rows { list-style:none; margin:0; padding:0; }
.people-row { display:flex; align-items:center; gap:12px; min-height:44px; padding:8px 0; border-top:1px solid var(--line); min-width:0; }
.people-row:first-child { border-top:0; }
.people-row-text { display:grid; min-width:0; }
.people-row-name { font-size:14px; font-weight:500; color:var(--ink); overflow-wrap:anywhere; }
.people-row-detail { font-size:13px; color:var(--muted); overflow-wrap:anywhere; }
.list-row { display:flex; align-items:center; justify-content:space-between; gap:12px 20px; min-height:56px; padding:12px 0; border-top:1px solid var(--line); min-width:0; }
.list-row:first-child { border-top:0; }
.list-row-text { display:grid; gap:2px; min-width:0; }
.list-row-title { font-size:15px; font-weight:500; color:var(--ink); overflow-wrap:anywhere; }
a.list-row-title { display:inline-flex; align-items:center; min-height:44px; }
a.list-row-title:hover { text-decoration:underline; text-underline-offset:3px; }
.list-row-meta { font-size:13px; color:var(--muted); margin:0; overflow-wrap:anywhere; }
.list-row-end { flex:0 0 auto; display:flex; align-items:center; gap:10px; }
/* Dated rows (UiKitHelper#date_row): the day and short month as a block on the start side, about 72px high. */
.date-rows { list-style:none; margin:0; padding:0 22px; background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); }
.date-row { display:flex; align-items:center; gap:10px 18px; min-height:72px; padding:12px 0; border-top:1px solid var(--line); min-width:0; }
.date-row:first-child { border-top:0; }
.date-row-date { flex:0 0 46px; display:grid; justify-items:center; gap:2px; line-height:1.1; color:var(--ink); }
.date-row-day { font-size:22px; font-weight:600; }
.date-row-month { font-size:13px; color:var(--muted); white-space:nowrap; }
.date-row .list-row-text { flex:1 1 auto; }

@media (max-width:820px) {
  .page-head { flex-direction:column; align-items:flex-start; gap:12px; }
  .page-head h1, html[lang=ar] .page-head h1 { font-size:34px; }
  .decide-card { grid-template-columns:minmax(0,1fr); padding:20px; }
  .decide-card-actions { justify-content:stretch; }
  .decide-card-actions .button { flex:1 1 140px; width:auto; }
  .rail-layout { grid-template-columns:minmax(0,1fr); gap:32px; }
  .sentence-row { grid-template-columns:minmax(0,1fr); gap:6px; padding:20px; }
  .book-panel .say, html[lang=ar] .book-panel .say { font-size:18px; }
  .auditor-details { padding:0 16px; }
  .change-panel { padding:12px 16px; }
  .phone-action-bar { position:sticky; bottom:0; z-index:5; padding:12px 0 calc(12px + env(safe-area-inset-bottom)); background:var(--canvas); border-top:1px solid var(--line); }
  .phone-action-bar .button { flex:1 1 140px; }
  .list-row { flex-wrap:wrap; }
  .date-rows { padding:0 16px; }
  .date-row { flex-wrap:wrap; }
  .date-row .list-row-text { flex-basis:calc(100% - 64px); }
  .date-row .list-row-end { padding-inline-start:64px; }
}

/* Phones: a change panel's button and a danger-zone button take the full width. */
@media (max-width:640px) {
  .change-panel-head .change-panel-button.button, .danger-zone .button { flex:1 1 100%; justify-self:stretch; width:100%; }
}

/* A panel opened only from the page's card (no button of its own) is not shown until it opens. */
.change-panel:not(.is-open):not(:has(.change-panel-button)) { display:none; }

/* Action rules (UX audit 18 November 2026): a small button inside a sentence or a list row sits on the text's line. */
p > .button.small-button, .meeting-day-meta .button.small-button { vertical-align:middle; }
.preparation-links .button.small-button, .file-states .button.small-button { min-height:44px; }

/* A form that opens from a button (change_panel) in its own card, under the block above it: minutes rounds, circulars and
   conflict settings. The kit's panel without a title has no card of its own. */
.change-panel.round-panel:not(:has(.change-panel-text)) { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:20px 28px; margin:36px 0 0; }
.change-panel.round-panel .change-panel-body .field-note { margin:0 0 8px; }
@media (max-width:820px) { .change-panel.round-panel:not(:has(.change-panel-text)) { padding:18px; } }
