/* Related tools — subtle internal links row inside footer (discovery + SEO) */
.related-tools {
    padding-bottom: 7px;
    margin-bottom: 7px;
    border-bottom: 1px solid var(--color-border, #e2e8f0);
    line-height: 1.3;
}
.related-tools-label {
    color: var(--color-text-light, #718096);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-size: 0.7rem;
    margin-right: 12px;
    vertical-align: middle;
}
.related-tools .footer-link {
    color: var(--color-text-medium, #4a5568);
    font-weight: 400;
    font-size: 0.85rem;
    border-bottom: none;
    vertical-align: middle;
}
.related-tools .footer-link:hover {
    color: var(--color-accent, #00a8e8);
    border-bottom: none;
}

/* ============================================================
   CHECKLIST — Try Swiss Knife
   ── "The pre-flight card" ──────────────────────────────────
   A checklist in a cockpit is a printed card read top to bottom:
   the item on the left, a dotted leader, the response on the
   right. That row is this tool's signature and nothing else on
   the page competes with it.

   Ink is ballpoint ultramarine, because ticks are made in pen.
   Done is a filled box; partly done is the same ink, hatched —
   a flavour of done, not a different colour, which is exactly
   what the spec says it is. Open is an empty box.

   Yellow means one thing only: pinned. It is a highlighter swipe
   behind the name, the way you mark the one line on a page that
   matters this week.

   Archivo (condensed via its width axis) sets the card-like
   parts — tabs, titles, percentages. Atkinson Hyperlegible sets
   the items, which are read at a glance, mid-task.

   Chrome — header, menu shape, footer — is the platform standard.
   ============================================================ */

:root {
    /* Ink */
    --ink:        #2a36d1;
    --ink-deep:   #1e2799;
    --ink-wash:   #eceefd;
    --ink-line:   #c6cbf6;

    /* Paper */
    --graphite:   #161a24;
    --slate:      #545c70;   /* 6.3:1 on white */
    --slate-soft: #6b7285;   /* 4.8:1 on white — captions only */
    --paper:      #eef0f6;
    --card:       #ffffff;
    --rule:       #e1e4ee;
    --rule-strong:#c4cad9;
    --open-line:  #a2a9bc;

    /* Highlighter — pinned, and nothing else */
    --hi:         #ffe14d;
    --hi-edge:    #e9c500;

    --danger:      #bf3328;
    --danger-wash: #fdefee;
    --danger-line: #f1cdca;

    --maroon:      #8c1d2f;   /* N/A — 9.6:1 on white */
    --maroon-line: #e8c3c9;

    --font-display: 'Archivo', 'Arial Narrow', 'Helvetica Neue', Arial, sans-serif;
    --font-body:    'Atkinson Hyperlegible', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-chrome:  -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    --radius-sm: 6px; --radius-md: 10px; --radius-lg: 14px; --radius-xl: 18px;
    --shadow-card: 0 1px 0 rgba(22,26,36,0.04), 0 1px 3px rgba(22,26,36,0.06);
    --shadow-lift: 0 1px 0 rgba(22,26,36,0.04), 0 12px 28px -12px rgba(30,39,153,0.28);
    --shadow-lg:   0 18px 48px -16px rgba(22,26,36,0.35);

    /* The names the platform dialog and shared modules theme themselves from */
    --color-primary:     var(--ink);
    --color-accent:      var(--ink);
    --color-accent-hover:var(--ink-deep);
    --color-error:       var(--danger);
    --color-text-dark:   var(--graphite);
    --color-text-medium: var(--slate);
    --color-text-light:  var(--slate-soft);
    --color-border:      var(--rule);
    --color-background:  var(--paper);
    --tsk-note-main:     var(--danger);   /* the samples in the shared formatting hint */
    --tsk-note-alt:      var(--ink);

    /* Platform chrome — pinned to the shared TSK values */
    --chrome-white: #ffffff;
    --chrome-border: #e0e6ed;
    --chrome-bg: #f5f7fa;
    --chrome-text: #555f6d;
    --chrome-radius: 8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-body);
    background: var(--paper);
    color: var(--graphite);
    font-size: 1rem;
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    padding-bottom: env(safe-area-inset-bottom);
}

.hidden { display: none !important; }

.seo-h1, .sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: 0;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
button, input, select, textarea { font-family: inherit; }
.ic { width: 16px; height: 16px; flex-shrink: 0; }

/* ─────────────────────────────── HEADER (platform chrome) ─────────────────────────────── */
.header {
    width: 100%;
    background-color: #ffffff;
    border-bottom: 1px solid var(--chrome-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    font-family: var(--font-chrome);
}
.header-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0.5rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.header-logo-link { display: flex; align-items: center; text-decoration: none; transition: opacity 0.2s ease; }
.header-logo-link:hover { opacity: 0.85; }
.logo-image { height: 36px; width: auto; display: block; flex-shrink: 0; }
.tool-name-btn {
    font-size: 1.5rem; font-weight: 600; color: #1a2332;
    white-space: nowrap; line-height: 1.2; letter-spacing: -0.015em;
    background: none; border: none; padding: 0; cursor: pointer; transition: color 0.15s;
    font-family: var(--font-chrome);
}
.tool-name-btn:hover { color: var(--ink); }
.header-icons { display: flex; align-items: center; gap: 8px; flex-shrink: 0; position: relative; }
.header-icon-btn {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; padding: 0;
    background: var(--chrome-white); border: 1px solid var(--chrome-border);
    border-radius: var(--chrome-radius); cursor: pointer; transition: all 0.2s ease; color: var(--chrome-text);
}
.header-icon-btn:hover { border-color: var(--ink); background: var(--chrome-bg); color: var(--ink); }
.header-icon-btn svg { width: 20px; height: 20px; }
.lang-short { font-size: 0.875rem; font-weight: 600; color: var(--chrome-text); letter-spacing: 0.02em; font-family: var(--font-chrome); }
.header-icon-btn:hover .lang-short { color: var(--ink); }

/* Language dropdown — in the menu; `.active` is the contract with i18n.js */
.language-selector { position: relative; }
.language-dropdown {
    position: absolute; top: calc(100% + 6px); right: 0; min-width: 150px;
    background: var(--chrome-white); border: 1px solid var(--chrome-border);
    border-radius: var(--chrome-radius); box-shadow: var(--shadow-lg); overflow: hidden; display: none; z-index: 1100;
}
.language-dropdown.active { display: block; }
.lang-option {
    display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.6rem 1rem;
    background: none; border: none; font-size: 0.875rem; color: var(--graphite); text-align: left; cursor: pointer;
}
.lang-option:hover { background: var(--paper); }
.lang-option.active { background: var(--ink-wash); color: var(--ink); }
.lang-check { font-size: 0.75rem; opacity: 0; }
.lang-option.active .lang-check { opacity: 1; }

/* ─────────────────────────────── LAYOUT ─────────────────────────────── */
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 20px 20px 0; }

.info-banner {
    display: flex; align-items: flex-start; gap: 8px;
    background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-lg);
    padding: 8px 12px; margin-bottom: 12px;
    font-size: 0.8125rem; line-height: 1.45; color: var(--slate);
}
.info-icon { flex-shrink: 0; font-size: 0.875rem; line-height: 1.4; }
.info-text strong { color: var(--graphite); margin-right: 4px; }
.info-close { margin-left: auto; background: none; border: none; font-size: 1.15rem; line-height: 1; color: var(--slate-soft); cursor: pointer; padding: 0 4px; flex-shrink: 0; min-width: 24px; min-height: 24px; }
.info-close:hover { color: var(--graphite); }
/* The install tip only matters on a phone. */
@media (min-width: 900px) and (hover: hover) { .info-banner-tip { display: none; } }

.eyebrow {
    font-family: var(--font-display); font-stretch: 80%; font-weight: 750;
    font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink);
}

/* ─────────────────────────────── BUTTONS & FIELDS ─────────────────────────────── */
.btn-primary, .btn-ghost, .btn-quiet {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 0 18px; border-radius: 12px;
    font-size: 0.95rem; font-weight: 700; cursor: pointer; text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}
.btn-primary { background: var(--ink); color: #fff; border: 1.5px solid var(--ink); }
.btn-primary:hover { background: var(--ink-deep); border-color: var(--ink-deep); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.6; cursor: progress; }
.btn-primary .ic { width: 18px; height: 18px; }
.btn-ghost { background: var(--card); color: var(--graphite); border: 1.5px solid var(--rule-strong); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn-quiet { background: transparent; color: var(--slate); border: 1.5px solid transparent; }
.btn-quiet:hover { color: var(--graphite); background: var(--paper); }

.link-btn {
    background: none; border: none; padding: 0; cursor: pointer;
    color: var(--ink); font-weight: 700; font-size: 0.9rem;
    text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px;
    display: inline-flex; align-items: center; gap: 4px;
}
.link-btn:hover { color: var(--ink-deep); }

.field-label { display: block; font-size: 0.8125rem; font-weight: 700; color: var(--graphite); margin: 14px 0 5px; }
.modal-body > .field-label:first-child, .modal-sub + .field-label { margin-top: 0; }
/* Formatting help beside the Item and Why fields: a small circle, with a 44px tap area around it */
.fmt-label-row { display: flex; align-items: center; gap: 6px; }
.fmt-hint {
    position: relative; width: 16px; height: 16px; padding: 0;
    border: 1px solid var(--rule-strong); border-radius: 50%; background: transparent;
    font: italic 700 0.66rem/14px Georgia, serif; color: var(--slate); cursor: pointer;
}
/* Short of the field below, so a tap on the field never lands on the icon */
.fmt-hint::before { content: ''; position: absolute; inset: -14px -14px -5px; }
.fmt-hint:hover { border-color: var(--ink); color: var(--ink); }
.fmt-hint:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.input {
    width: 100%; min-height: 44px; padding: 0 12px;
    border: 1.5px solid var(--rule-strong); border-radius: var(--radius-md);
    background: #fff; color: var(--graphite); font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { padding: 10px 12px; resize: vertical; line-height: 1.45; }
select.input { cursor: pointer; }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ink-wash); }
.input::placeholder { color: var(--slate-soft); }
.input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-wash); }
.input-date { max-width: 200px; }

/* ─────────────────────────────── WELCOME ─────────────────────────────── */
.welcome {
    display: grid; gap: 32px; align-items: center;
    padding: 28px 4px 12px;
}
@media (min-width: 860px) {
    .welcome { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 56px; padding: 40px 8px 20px; }
}
.welcome-title {
    font-family: var(--font-display); font-stretch: 72%; font-weight: 850;
    font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 0.96; letter-spacing: -0.01em;
    color: var(--graphite); margin: 10px 0 14px; text-wrap: balance;
}
.welcome-sub { color: var(--slate); font-size: 1.05rem; max-width: 34em; }

.concepts { margin: 22px 0 10px; display: grid; gap: 10px; }
.concept { display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: 12px; align-items: baseline; }
.concept dt {
    display: contents;
}
.concept-glyph {
    grid-row: span 2; align-self: start;
    width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
    background: var(--ink-wash); color: var(--ink); font-size: 1.1rem; line-height: 1;
}
.concept dt > span:last-child { font-family: var(--font-display); font-stretch: 85%; font-weight: 750; font-size: 1.05rem; color: var(--graphite); line-height: 1.2; }
.concept dd { grid-column: 2; color: var(--slate); font-size: 0.925rem; line-height: 1.4; }
.concept-test {
    font-style: italic; color: var(--graphite); font-size: 0.95rem;
    border-left: 3px solid var(--ink-line); padding: 2px 0 2px 12px; margin: 16px 0 22px; max-width: 34em;
}
.welcome-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.welcome-more { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--slate-soft); font-size: 0.9rem; }
.welcome-more + .welcome-more { margin-top: 6px; }   /* the "Create it with your AI" line (TSK-232) */

.demo-wrap { position: relative; }
.demo-card {
    padding: 22px 22px 18px; box-shadow: var(--shadow-lg);
    max-width: 440px; margin: 0 auto;
}
@media (min-width: 860px) { .demo-card { transform: rotate(1.25deg); } }
.demo-head { display: flex; flex-direction: column; gap: 4px; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 2px solid var(--graphite); }
.demo-title {
    font-family: var(--font-display); font-stretch: 70%; font-weight: 850;
    font-size: 1.55rem; text-transform: uppercase; letter-spacing: 0.02em; line-height: 1.05;
}
.demo-card .tally-bar { margin-top: 14px; }

/* ─────────────────────────────── TABS ─────────────────────────────── */
.workspace { padding-top: 6px; }
.tabbar {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
    border-bottom: 1.5px solid var(--rule-strong); margin-bottom: 4px;
}
.tabs { display: flex; gap: 4px; min-width: 0; }
.tab {
    position: relative; display: inline-flex; align-items: center; gap: 8px;
    min-height: 48px; padding: 0 14px; background: none; border: none; cursor: pointer;
    font-family: var(--font-display); font-stretch: 78%; font-weight: 750; font-size: 1.05rem;
    letter-spacing: 0.06em; text-transform: uppercase; color: var(--slate);
    transition: color 0.15s;
}
.tab::after {
    content: ''; position: absolute; left: 8px; right: 8px; bottom: -1.5px; height: 4px;
    border-radius: 4px 4px 0 0; background: transparent; transition: background 0.15s;
}
.tab:hover { color: var(--graphite); }
.tab.is-on { color: var(--ink); }
.tab.is-on::after { background: var(--ink); }
.tab-count {
    font-family: var(--font-body); font-weight: 700; font-size: 0.75rem; letter-spacing: 0;
    min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
    display: inline-grid; place-items: center; background: var(--rule); color: var(--slate);
    font-variant-numeric: tabular-nums;
}
.tab.is-on .tab-count { background: var(--ink); color: #fff; }
.tab-actions { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; position: relative; }
.tab-new { min-height: 40px; padding: 0 14px; font-size: 0.9rem; }

/* List search. Desktop: always there, before New. */
.list-search {
    position: relative; display: flex; align-items: center; width: 220px; height: 40px;
    background: #fff; border: 1.5px solid var(--rule-strong); border-radius: 10px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.list-search:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px var(--ink-wash); }
.list-search-ic { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--slate-soft); pointer-events: none; }
.list-search-input {
    flex: 1; min-width: 0; height: 100%; padding: 0 4px 0 34px;
    background: none; border: none; outline: none; font: inherit; font-size: 0.9rem; color: var(--graphite);
}
.list-search-input::placeholder { color: var(--slate-soft); }
.list-search-clear {
    display: none; place-items: center; width: 34px; height: 100%; flex-shrink: 0;
    background: none; border: none; cursor: pointer; font-size: 1.2rem; line-height: 1; color: var(--slate);
}
.list-search-clear:hover { color: var(--ink); }
.list-search.has-query .list-search-clear { display: grid; }
.tab-search-btn {
    display: none; place-items: center; width: 44px; height: 44px; flex-shrink: 0; padding: 0;
    background: #fff; border: 1.5px solid var(--rule-strong); border-radius: 10px; color: var(--slate); cursor: pointer;
}
.tab-search-btn .ic { width: 20px; height: 20px; }
.tab-search-btn:hover { border-color: var(--ink); color: var(--ink); }
.no-match .btn-ghost { margin-top: 4px; }

.stage { padding-bottom: 8px; animation: stageIn 0.2s ease; }
@keyframes stageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ─────────────────────────────── LISTS ─────────────────────────────── */
.list-section { margin-top: 22px; }
.section-title {
    display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
    font-family: var(--font-display); font-stretch: 82%; font-weight: 750; font-size: 0.82rem;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--slate);
}
.section-count {
    font-family: var(--font-body); letter-spacing: 0; font-size: 0.72rem; font-weight: 700;
    color: var(--slate); background: var(--rule); border-radius: 999px; padding: 0 7px; line-height: 20px;
}
.is-pinned-section > .section-title > span:first-child {
    background: linear-gradient(transparent 50%, var(--hi) 50%, var(--hi) 92%, transparent 92%);
    padding: 0 3px; margin: 0 -3px; color: var(--graphite);
}
.list-finished > summary { cursor: pointer; list-style: none; min-height: 32px; }
.list-finished > summary::-webkit-details-marker { display: none; }
.summary-caret {
    width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(-45deg); transition: transform 0.15s; margin-left: 2px;
}
.list-finished[open] .summary-caret { transform: rotate(45deg); }
.all-finished { margin-top: 20px; color: var(--slate); }

.card-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.is-wide .card-grid, .list-finished:has(.goal-card) .card-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); }

.empty-tab {
    margin-top: 22px; padding: 40px 24px; text-align: center;
    border: 2px dashed var(--rule-strong); border-radius: var(--radius-xl); background: rgba(255,255,255,0.55);
}
.empty-title { font-family: var(--font-display); font-stretch: 78%; font-weight: 850; font-size: 1.6rem; line-height: 1.1; }
.empty-sub { color: var(--slate); margin: 6px auto 18px; max-width: 30em; }

/* ─────────────────────────────── CARDS ─────────────────────────────── */
.card {
    position: relative; background: var(--card); border: 1px solid var(--rule);
    border-radius: var(--radius-lg); padding: 14px 16px 14px; box-shadow: var(--shadow-card);
    transition: border-color 0.15s, box-shadow 0.2s, transform 0.2s;
}
.run-card:hover, .tpl-card:hover, .goal-card:hover { border-color: var(--ink-line); box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.card:focus-within { border-color: var(--ink-line); }

.card-top { display: flex; align-items: center; gap: 8px; min-height: 24px; margin-bottom: 6px; font-size: 0.78rem; }
.card-top-end { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.pin-mark {
    position: relative; z-index: 1;               /* above .card-link::after, which covers the card */
    display: inline-grid; place-items: center; width: 36px; height: 36px; margin: -7px -8px -7px -4px;
    padding: 0; background: none; border: none; border-radius: 10px; cursor: pointer;
}
.pin-mark-face {
    display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px;
    background: transparent; color: var(--open-line); box-shadow: inset 0 0 0 1.5px var(--rule-strong);
    transition: background 0.15s, box-shadow 0.15s, color 0.15s;
}
.pin-mark .ic { width: 13px; height: 13px; }
.pin-mark:hover .pin-mark-face { color: var(--graphite); background: #fff7c2; box-shadow: inset 0 0 0 1.5px var(--hi-edge); }
.pin-mark.is-on .pin-mark-face { background: var(--hi); color: var(--graphite); box-shadow: none; }
.pin-mark.is-on:hover .pin-mark-face { background: var(--hi-edge); box-shadow: 0 0 0 2px var(--graphite); }

.goal-chip {
    display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 60%;
    background: var(--ink-wash); color: var(--ink-deep); border-radius: 999px; padding: 1px 9px 1px 6px;
    font-weight: 700; font-size: 0.75rem; line-height: 20px;
}
.goal-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal-chip .ic { width: 13px; height: 13px; }
.goal-chip-link { border: none; cursor: pointer; max-width: 100%; }
.goal-chip-link:hover { background: var(--ink-line); }

.card-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-title {
    font-family: var(--font-display); font-stretch: 84%; font-weight: 750; font-size: 1.25rem;
    line-height: 1.15; color: var(--graphite); min-width: 0; overflow-wrap: anywhere;
}
.card-link { all: unset; cursor: pointer; }
.card-link::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.card-link:focus-visible { outline: none; }
.card-link:focus-visible::after { outline: 2px solid var(--ink); outline-offset: 2px; }
.card .hl { padding: 0 2px; margin: 0 -2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.is-pinned .hl { background: linear-gradient(transparent 52%, var(--hi) 52%, var(--hi) 94%, transparent 94%); }

.card-pct {
    font-family: var(--font-display); font-stretch: 66%; font-weight: 850; font-size: 2.1rem;
    line-height: 0.9; color: var(--ink); font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.card-pct small { font-size: 0.95rem; font-weight: 750; margin-left: 1px; }
.card-origin { font-size: 0.82rem; color: var(--slate-soft); margin-top: 2px; }
.card-meta { font-size: 0.85rem; color: var(--slate); margin-top: 2px; }
.card-why { font-style: italic; color: var(--slate); font-size: 0.92rem; margin-top: 4px; }
.card .tally-bar { margin-top: 12px; }

.is-stopped .card-pct, .is-stopped .big-num, .is-stopped .big-unit { color: var(--slate-soft); }
.is-stopped .seg-done { background: var(--slate-soft); }
.is-stopped .seg-partial { background: repeating-linear-gradient(-45deg, var(--slate-soft) 0 2.5px, #e7e9f0 2.5px 5.5px); }
.is-stopped .seg-na { background: repeating-linear-gradient(-45deg, var(--slate-soft) 0 2.5px, #e7e9f0 2.5px 5.5px); }

/* Status — a rubber stamp. Active is never printed. */
.stamp {
    display: inline-block; font-family: var(--font-display); font-stretch: 75%; font-weight: 850;
    font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; line-height: 1;
    padding: 4px 6px 3px; border: 2px solid currentColor; border-radius: 4px; transform: rotate(-3deg);
}
.stamp-completed { color: var(--ink); }
.stamp-stopped { color: var(--slate); border-style: dashed; }

/* Template preview — the first lines of the card, unticked */
.tpl-preview { list-style: none; margin: 10px 0 2px; }
.tpl-preview li { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--slate); min-height: 26px; }
.tpl-preview li > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tpl-preview .leader { height: 4px; }
.mini-box { width: 13px; height: 13px; border: 1.5px solid var(--open-line); border-radius: 3px; flex-shrink: 0; }
.tpl-preview .tpl-more { font-size: 0.8rem; color: var(--slate-soft); }
.card-foot { position: relative; z-index: 1; margin-top: 12px; display: flex; }
.card-action { min-height: 36px; }

/* Goal card tree */
.tree { position: relative; z-index: 1; list-style: none; margin: 12px 0 0 6px; border-left: 2px solid var(--rule-strong); }
.tree-row { position: relative; }
.tree-row::before { content: ''; position: absolute; left: 0; top: 50%; width: 10px; border-top: 2px solid var(--rule-strong); }
.tree-link {
    width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto 64px 3.2em; align-items: center; gap: 10px;
    min-height: 40px; padding: 6px 8px 6px 18px; background: none; border: none; border-radius: 8px;
    font-size: 0.9rem; color: var(--graphite); text-align: left; cursor: pointer;
}
.tree-link:hover { background: var(--paper); }
.tree-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; grid-column: 1; }
.tree-status { grid-column: 2; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--slate); font-family: var(--font-display); font-stretch: 80%; font-weight: 750; }
.tree-link .tally-bar { grid-column: 3; margin: 0; }
.tree-pct { grid-column: 4; text-align: right; font-family: var(--font-display); font-stretch: 80%; font-weight: 750; color: var(--ink); font-variant-numeric: tabular-nums; }
.tree-row.is-stopped .tree-pct, .tree-row.is-stopped .tree-name { color: var(--slate-soft); }
.tree-add .tree-link { display: flex; gap: 6px; color: var(--ink); font-weight: 700; }
.tree-flat { margin-left: 0; border-left: none; }
.tree-flat .tree-row::before { display: none; }
.tree-flat .tree-link { padding-left: 8px; }

/* ─────────────────────────────── TALLY ─────────────────────────────── */
.tally-bar {
    display: flex; gap: 2px; height: 10px; border-radius: 999px; overflow: hidden; background: var(--rule);
}
.tally-bar.is-thin { height: 6px; gap: 1.5px; }
.seg { display: block; min-width: 3px; transition: flex-grow 0.3s ease; }
.seg-done { background: var(--ink); }
.seg-partial { background: repeating-linear-gradient(-45deg, var(--ink) 0 2.5px, var(--ink-line) 2.5px 5.5px); }
.seg-na { background: repeating-linear-gradient(-45deg, var(--maroon) 0 2.5px, var(--maroon-line) 2.5px 5.5px); }
.seg-open { background: #dde1ec; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 0.82rem; color: var(--slate); }
.lg { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.lg b { color: var(--graphite); font-variant-numeric: tabular-nums; }
.lg i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.lg-done i { background: var(--ink); }
.lg-partial i { background: repeating-linear-gradient(-45deg, var(--ink) 0 2px, var(--ink-line) 2px 4px); }
.lg-na i { background: repeating-linear-gradient(-45deg, var(--maroon) 0 2px, var(--maroon-line) 2px 4px); }
.lg-open i { border: 1.5px solid var(--open-line); }
.legend-empty { font-style: italic; }

/* ─────────────────────────────── THE ITEM ROW — the signature ─────────────────────────────── */
.items { list-style: none; }
.item { display: flex; align-items: center; gap: 10px; min-height: 50px; }
.item-label { flex: 0 1 auto; min-width: 0; font-size: 1.0625rem; line-height: 1.35; color: var(--graphite); overflow-wrap: anywhere; padding: 6px 0; }
/* A label typed with the platform's note rules: [Label] in red, {Label} as an ink chip, links in ink */
.lbl-tag { color: var(--danger); font-weight: 700; }
.lbl-tag-alt { display: inline-block; padding: 0 6px; border-radius: 4px; background: var(--ink); color: #fff; line-height: 1.35; }
.lbl-link { color: var(--ink); text-decoration: underline; overflow-wrap: anywhere; }
.lbl-link:hover { color: var(--ink-deep); }
.leader {
    flex: 1 1 20px; min-width: 20px; height: 4px; align-self: center;
    background-image: radial-gradient(circle, var(--open-line) 1.15px, transparent 1.4px);
    background-size: 7px 4px; background-repeat: repeat-x; background-position: left center;
}
/* The group as a tag, when a record keeps one sequence instead of sections */
.item-tag {
    flex-shrink: 0; font-family: var(--font-display); font-stretch: 80%; font-weight: 750;
    font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--slate);
    background: var(--paper); border: 1px solid var(--rule); border-radius: 999px; padding: 0 8px; line-height: 18px;
    max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item-flag {
    font-family: var(--font-display); font-stretch: 75%; font-weight: 800; font-size: 0.72rem;
    letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); flex-shrink: 0;
}
.tick {
    flex-shrink: 0; width: 44px; height: 44px; margin-right: -8px; padding: 0;
    display: grid; place-items: center; background: none; border: none; border-radius: 12px; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.tick:not(.tick-auto):hover { background: var(--ink-wash); }
.tick-box {
    width: 28px; height: 28px; border-radius: 7px; border: 2px solid var(--open-line); background: #fff;
    display: grid; place-items: center; transition: background 0.15s, border-color 0.15s;
}
.tick-box svg { width: 20px; height: 20px; overflow: visible; }
.tick-check {
    fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
    stroke-dasharray: 22; stroke-dashoffset: 22;
}
.tick:not(.tick-auto):hover .tick-box { border-color: var(--ink); }

.is-done .tick-box { background: var(--ink); border-color: var(--ink); }
.is-done .tick-check { stroke-dashoffset: 0; }
.is-done .item-label { color: var(--slate); }
.is-done .leader { background-image: radial-gradient(circle, var(--ink-line) 1.15px, transparent 1.4px); }

.is-partial .tick-box {
    border-color: var(--ink);
    background: repeating-linear-gradient(-45deg, var(--ink) 0 2.5px, #fff 2.5px 6px);
}
.is-partial .leader { background-image: radial-gradient(circle, var(--ink-line) 1.15px, transparent 1.4px); }

/* N/A — the partial hatch in maroon: closed, but not by doing it */
.is-na .tick-box {
    border-color: var(--maroon);
    background: repeating-linear-gradient(-45deg, var(--maroon) 0 2.5px, #fff 2.5px 6px);
}
.is-na .tick:hover .tick-box { border-color: var(--maroon); }
.is-na .item-label { color: var(--slate); }
.is-na .item-flag { color: var(--maroon); }
.is-na .leader { background-image: radial-gradient(circle, var(--maroon-line) 1.15px, transparent 1.4px); }

/* Only the box that was just tapped animates — a re-render must not replay them all */
.is-just .tick-box { animation: tickPop 0.24s ease-out; }
.is-just.is-done .tick-check { animation: tickDraw 0.3s ease-out 0.04s both; }
@keyframes tickPop { 0% { transform: scale(0.82); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes tickDraw { from { stroke-dashoffset: 22; } to { stroke-dashoffset: 0; } }

/* Sub-items: one level, indented under their parent, with a rule down the left.
   The parent's box follows them and is not pressable. */
.item.is-child { margin-left: 14px; padding-left: 14px; border-left: 1.5px solid var(--rule); min-height: 46px; }
.item.is-child .item-label { font-size: 1rem; }
.tick-auto { cursor: default; }

.tick[aria-disabled="true"] { cursor: not-allowed; }
.tick[aria-disabled="true"] .tick-box { opacity: 0.55; }
.tick[aria-disabled="true"]:hover { background: none; }

.group-head {
    display: flex; align-items: center; gap: 10px; margin: 16px 0 2px;
    font-family: var(--font-display); font-stretch: 80%; font-weight: 750; font-size: 0.8rem;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--slate);
}
.group-head::after { content: ''; flex: 1; border-top: 1.5px solid var(--graphite); opacity: 0.85; }
.items > .group-head:first-child { margin-top: 4px; }
/* A section heading that folds its items away: the whole row is the button, 44px tall,
   with the margin given back so the heading sits where it did */
.group-head.is-toggle { margin: 6px 0 -8px; }
.group-head.is-toggle::after { content: none; }
.items > .group-head.is-toggle:first-child { margin-top: -6px; }
.group-toggle {
    flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 8px;
    padding: 0; background: none; border: none; cursor: pointer; text-align: left;
    font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit;
    -webkit-tap-highlight-color: transparent;
}
.group-toggle:hover { color: var(--graphite); }
.group-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.group-chev { display: grid; place-items: center; width: 16px; height: 16px; flex-shrink: 0; margin-left: -2px; transition: transform 0.15s; }
.group-chev .ic { width: 16px; height: 16px; }
.is-shut .group-chev { transform: rotate(-90deg); }
.group-name { min-width: 0; overflow-wrap: anywhere; }
.group-rule { flex: 1; min-width: 12px; border-top: 1.5px solid var(--graphite); opacity: 0.85; }
.group-count { flex-shrink: 0; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.group-head.is-closed .group-count { color: var(--ink); }
/* Folded shut, the rule turns dotted so the section reads as holding more */
.is-shut .group-rule { border-top-style: dashed; }
@media (prefers-reduced-motion: reduce) { .group-chev { transition: none; } }

/* Editing rows */
.item-edit {
    display: grid; grid-template-columns: minmax(0, 1fr) 9.5rem auto; gap: 6px; align-items: center;
    padding: 5px 0; border-bottom: 1px dashed var(--rule);
}
.item-edit .input { min-height: 40px; font-size: 0.95rem; }
.item-tools { display: inline-flex; gap: 2px; }
.icon-btn {
    width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px;
    background: none; border: 1px solid transparent; color: var(--slate); cursor: pointer;
}
.icon-btn:hover:not(:disabled) { background: var(--paper); color: var(--graphite); border-color: var(--rule); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn-danger:hover:not(:disabled) { color: var(--danger); background: var(--danger-wash); border-color: var(--danger-line); }
.items-editing .group-head { margin-top: 14px; }
.item-edit.is-child { margin-left: 28px; }

.items-empty { color: var(--slate); font-style: italic; padding: 10px 0 2px; }

/* ─────────────────────────────── DETAIL SHEET ─────────────────────────────── */
.stage.is-detail { max-width: 860px; margin: 0 auto; }
.back-link {
    display: inline-flex; align-items: center; gap: 6px; margin: 14px 0 10px; min-height: 36px; padding: 0 10px 0 6px;
    background: none; border: none; border-radius: 8px; cursor: pointer;
    font-family: var(--font-display); font-stretch: 80%; font-weight: 750; font-size: 0.9rem;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--slate);
}
.back-link:hover { color: var(--ink); background: rgba(255,255,255,0.7); }
.back-link .ic { width: 18px; height: 18px; }
.back-link { max-width: 100%; }
.back-link span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-link .ic { flex-shrink: 0; }

.sheet {
    background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-xl);
    padding: 22px 26px 26px; box-shadow: var(--shadow-card);
}
.sheet-eyebrow {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    font-family: var(--font-display); font-stretch: 80%; font-weight: 750; font-size: 0.8rem;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--slate);
}
.sheet-eyebrow .stamp { margin-left: 4px; }
.title-input {
    display: block; width: 100%; margin: 6px 0 2px; padding: 2px 6px; margin-left: -6px; width: calc(100% + 12px);
    font-family: var(--font-display); font-stretch: 74%; font-weight: 850;
    font-size: clamp(1.8rem, 4.6vw, 2.6rem); line-height: 1.08; letter-spacing: -0.005em; color: var(--graphite);
    background: transparent; border: none; border-radius: 8px; border-bottom: 2px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}
.title-input:hover { background: var(--paper); }
.title-input:focus { outline: none; background: var(--paper); border-bottom-color: var(--ink); border-radius: 8px 8px 0 0; }
.sheet-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 0.9rem; color: var(--slate); }
.meta-link {
    background: none; border: none; padding: 0; cursor: pointer; color: var(--slate); font-size: inherit;
    text-decoration: underline dotted; text-underline-offset: 3px;
}
.meta-link:hover { color: var(--ink); }

.sheet-stats {
    display: flex; align-items: center; gap: 20px; margin: 18px 0 0; padding: 16px 0;
    border-top: 1.5px solid var(--graphite); border-bottom: 1px solid var(--rule);
}
.big-pct { display: flex; align-items: flex-start; line-height: 0.8; flex-shrink: 0; color: var(--ink); }
.big-num { font-family: var(--font-display); font-stretch: 62%; font-weight: 900; font-size: 4.4rem; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.big-unit { font-family: var(--font-display); font-stretch: 70%; font-weight: 800; font-size: 1.6rem; margin: 4px 0 0 2px; }
.stats-body { flex: 1; min-width: 0; }
.stats-body .tally-bar { height: 14px; }
.stats-body .legend { font-size: 0.9rem; }
.stats-note { font-size: 0.8rem; color: var(--slate-soft); margin-top: 4px; }

.act {
    display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 13px 0 11px;
    background: #fff; border: 1.5px solid var(--rule-strong); border-radius: 999px; cursor: pointer;
    font-size: 0.875rem; font-weight: 700; color: var(--graphite); white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.act:hover { border-color: var(--ink); color: var(--ink); }
.act-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.act-primary:hover { background: var(--ink-deep); border-color: var(--ink-deep); color: #fff; }
.act-danger { color: var(--danger); border-color: var(--danger-line); }
.act-danger:hover { background: var(--danger-wash); border-color: var(--danger); color: var(--danger); }
.act.is-on { background: var(--hi); border-color: var(--hi-edge); color: var(--graphite); }
.act.is-on:hover { color: var(--graphite); border-color: var(--graphite); }

.notice { margin: 12px 0 0; padding: 10px 14px; border-radius: var(--radius-md); background: var(--ink-wash); color: var(--ink-deep); font-size: 0.9rem; }
.notice-quiet { background: var(--paper); color: var(--slate); }

.items-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 22px 0 4px; }
.items-title {
    font-family: var(--font-display); font-stretch: 80%; font-weight: 750; font-size: 0.85rem;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--slate);
}
.runs-link {
    display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; margin-top: 14px; padding: 0 8px;
    background: none; border: none; border-top: 1px solid var(--rule); cursor: pointer; text-align: left; color: var(--slate);
}
.runs-link .ic { width: 18px; height: 18px; margin-left: auto; }
.runs-link:hover { background: var(--paper); color: var(--ink); }
.runs-list { margin-top: 0; }

/* ── Running mode: pin + kebab on the card head, beside the eyebrow ── */
.items-head { align-items: center; margin: 18px 0 2px; min-height: 40px; }
.sheet-head-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.sheet-head-top .sheet-eyebrow { min-width: 0; }
.sheet-tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tool-btn {
    width: 40px; height: 40px; display: grid; place-items: center; padding: 0;
    background: #fff; border: 1.5px solid var(--rule-strong); border-radius: 10px;
    color: var(--slate); cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.tool-btn .ic { width: 18px; height: 18px; }
.tool-btn:hover { border-color: var(--ink); color: var(--ink); }
.tool-btn[aria-pressed="true"] { background: var(--hi); border-color: var(--hi-edge); color: var(--graphite); }
.tool-launch[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.tool-launch[aria-pressed="true"]:hover { background: var(--ink-deep); color: #fff; }
.tool-btn[aria-expanded="true"] { background: var(--ink-wash); border-color: var(--ink); color: var(--ink); }

.kebab { position: relative; }
.kebab-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 60;
    min-width: 230px; max-width: calc(100vw - 32px);
    background: #fff; border: 1px solid var(--rule); border-radius: 14px;
    box-shadow: var(--shadow-lg); padding: 6px; animation: kebabIn 0.12s ease-out;
}
.kebab-menu[hidden] { display: none; }
@keyframes kebabIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.kebab-item {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px;
    background: none; border: none; border-radius: 10px; cursor: pointer;
    font-size: 0.95rem; font-weight: 700; color: var(--graphite); text-align: left; white-space: nowrap;
}
.kebab-item .ic { width: 18px; height: 18px; color: var(--slate); }
.kebab-item:hover, .kebab-item:focus-visible { background: var(--paper); color: var(--ink); outline: none; }
.kebab-item:hover .ic, .kebab-item:focus-visible .ic { color: var(--ink); }
.kebab-item.is-danger, .kebab-item.is-danger .ic { color: var(--danger); }
.kebab-item.is-danger:hover, .kebab-item.is-danger:focus-visible { background: var(--danger-wash); color: var(--danger); }
.kebab-sep { height: 1px; background: var(--rule); margin: 5px 6px; }

.items-empty-run { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 6px 0 4px; }

/* ── Editing mode: a different surface, so it never reads as the ticking view ── */
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 0.9rem; }
.items-head.is-editing { margin-bottom: 8px; }
.edit-badge {
    display: inline-flex; align-items: center; gap: 7px; color: var(--ink);
}
.edit-badge::before {
    content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ink);
    box-shadow: 0 0 0 4px var(--ink-wash);
}
.sheet.is-editing .items-editing {
    background: #f8f9ff; border: 1.5px dashed var(--ink-line); border-radius: var(--radius-lg);
    padding: 2px 10px 6px;
}
.sheet.is-editing .item-edit:last-child { border-bottom: none; }

/* ── Add items popup ── */
.mi-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.mi-added { list-style: none; margin-top: 14px; }
.mi-added:empty { display: none; }
.mi-added li {
    display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 0;
    border-top: 1px dashed var(--rule); font-size: 0.95rem; animation: kebabIn 0.18s ease-out;
}
.mi-tick { width: 20px; height: 20px; border-radius: 5px; background: var(--ink); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.mi-tick .ic { width: 14px; height: 14px; stroke-width: 3; }
.mi-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-group {
    margin-left: auto; flex-shrink: 0; font-family: var(--font-display); font-stretch: 80%; font-weight: 750;
    font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--slate);
    background: var(--paper); border-radius: 999px; padding: 0 8px; line-height: 20px;
}
#modal-items .modal-actions { align-items: center; justify-content: space-between; }
.mi-count { font-size: 0.875rem; font-weight: 700; color: var(--ink); }

/* Template running view: the items as they will be run, boxes not pressable */
.item.is-template { min-height: 44px; }
.tick-static { width: 44px; height: 44px; margin-right: -8px; display: grid; place-items: center; flex-shrink: 0; }
.sheet-cta { margin-top: 14px; }

/* Goal running view: date and reason read as text; the inputs live in editing mode */
.sheet-why { font-style: italic; color: var(--slate); margin-top: 6px; max-width: 42em; }
/* A goal's "why", line by line: a "- " line is a bullet with a hanging indent */
.note-line { display: block; }
.note-item { position: relative; padding-left: 1.1em; }
.note-item::before { content: '\2022'; position: absolute; left: 0.15em; color: var(--ink); font-weight: 700; font-style: normal; }
.sheet-meta .due { font-size: 0.9rem; }
.goal-edit { background: #f8f9ff; border: 1.5px dashed var(--ink-line); border-radius: var(--radius-lg); padding: 14px; }
.goal-edit .goal-fields { margin-top: 0; }
.is-editing > .notice-quiet { margin: 0 0 10px; }
/* The goal's checklists while editing it — order and membership only */
.run-edit-label { margin-top: 14px; }
.run-edit-list { list-style: none; }
.run-edit {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center;
    padding: 4px 0; border-bottom: 1px dashed var(--rule);
}
.run-edit:last-child { border-bottom: none; }
.run-edit-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

/* Goal detail */
.goal-fields { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 14px; align-items: end; margin-top: 12px; }
.goal-field .field-label { margin-top: 0; }
.goal-field-why { grid-column: 1 / -1; margin-top: 12px; }
.why-input { font-style: italic; }
.goal-due { padding-bottom: 10px; }
.due { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--slate); white-space: nowrap; }
.due-date { font-weight: 700; }
.due-rel { background: var(--paper); border-radius: 999px; padding: 0 8px; line-height: 20px; }
.due.is-late .due-rel { background: var(--danger-wash); color: var(--danger); font-weight: 700; }
.goal-due .due { font-size: 0.9rem; }

.goal-tree { position: relative; display: grid; gap: 10px; padding-left: 22px; margin-top: 8px; }
.goal-tree::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 30px; border-left: 2px solid var(--rule-strong); }
.goal-tree > .card::before { content: ''; position: absolute; left: -17px; top: 30px; width: 16px; border-top: 2px solid var(--rule-strong); }

/* ─────────────────────────────── MENU ─────────────────────────────── */
:root {
    --tsk-menu-align: 1080px;
    --tsk-menu-z: 1400;
    --tsk-menu-scrim: rgba(22,26,36,0.45);
    --tsk-menu-bg: #ffffff;
}
.menu-header { flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.85rem; gap: 8px; }
.menu-header h3 { margin: 0; color: var(--graphite); font-family: var(--font-display); font-stretch: 80%; font-weight: 800; font-size: 1.2rem; letter-spacing: 0.04em; text-transform: uppercase; }
.menu-header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.close-menu {
    background: var(--chrome-bg); border: 1px solid var(--chrome-border); border-radius: var(--chrome-radius);
    font-size: 1.25rem; color: var(--chrome-text); cursor: pointer; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center; line-height: 1;
}
.close-menu:hover { background: var(--danger-wash); color: var(--danger); border-color: var(--danger-line); }
.menu-action {
    width: 100%; background: var(--paper); border: 1px solid var(--rule); padding: 11px 14px;
    border-radius: 12px; margin-bottom: 8px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 12px;
    font-size: 0.95rem; font-family: inherit; color: var(--graphite); font-weight: 700; text-align: left;
    text-decoration: none;
}
.menu-action:hover { background: #fff; border-color: var(--ink); transform: translateY(-1px); box-shadow: var(--shadow-card); }
.menu-action.danger { color: var(--danger); border-color: var(--danger-line); }
.menu-action.danger:hover { background: var(--danger-wash); border-color: var(--danger); }
.action-icon { font-size: 1.35rem; flex-shrink: 0; }
.action-content { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.action-hint { font-size: 0.75rem; color: var(--slate-soft); font-weight: 400; }
.menu-divider { height: 1px; background: var(--rule); margin: 2px 0 10px; }

/* ─────────────────────────────── MODALS ─────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(22,26,36,0.45); z-index: 1500;
    display: flex; align-items: flex-start; justify-content: center; padding: 72px 16px 24px; overflow-y: auto;
}
/* Capped to the viewport so the actions row is never pushed out of reach. The
   number is the overlay's own vertical padding — keep the two in step. */
.modal {
    width: 100%; max-width: 460px; background: #fff; border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg); animation: modalIn 0.16s ease; display: flex; flex-direction: column;
    max-height: calc(100dvh - 96px);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 8px; flex-shrink: 0; }
.modal-head-text { min-width: 0; }
.modal-eyebrow { font-family: var(--font-display); font-stretch: 80%; font-weight: 750; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink); margin-bottom: 2px; }
.modal-title { font-family: var(--font-display); font-stretch: 76%; font-weight: 850; font-size: 1.6rem; line-height: 1.1; color: var(--graphite); }
.modal-x { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--rule-strong); background: #fff; font-size: 1.25rem; line-height: 1; color: var(--slate); cursor: pointer; flex-shrink: 0; }
.modal-x:hover { color: var(--danger); border-color: var(--danger-line); }
.modal-body { padding: 8px 20px 18px; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.modal-sub { font-size: 0.9rem; color: var(--slate); line-height: 1.5; margin-bottom: 12px; }
.modal-actions {
    display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; flex-shrink: 0;
    padding: 12px 20px; border-top: 1px solid var(--rule); background: var(--paper); border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ── Export PDF picker ── */
.pdf-mode { border: none; padding: 0; margin: 0 0 6px; }
.pdf-mode .field-label { margin-top: 0; }
.pdf-mode-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pdf-pill { position: relative; cursor: pointer; }
.pdf-pill input { position: absolute; opacity: 0; pointer-events: none; }
.pdf-pill span {
    display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px;
    border: 1.5px solid var(--rule-strong); border-radius: 999px; background: #fff;
    font-size: 0.9rem; font-weight: 700; color: var(--graphite);
}
.pdf-pill input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.pdf-pill input:focus-visible + span { box-shadow: 0 0 0 3px var(--ink-wash); }
.pdf-hint { font-size: 0.8rem; color: var(--slate-soft); margin-top: 6px; }
.pdf-group { margin-top: 16px; }
.pdf-group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 4px; border-bottom: 1.5px solid var(--graphite); }
.pdf-all { font-size: 0.85rem; }
.pdf-list { list-style: none; margin: 0; padding: 0; }
.pdf-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 4px; border-bottom: 1px solid var(--rule); cursor: pointer; }
.pdf-row:hover { background: var(--paper); }
.pdf-row input { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--ink); margin: 0; }
.pdf-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pdf-row-name { font-weight: 700; color: var(--graphite); overflow-wrap: anywhere; }
.pdf-row-sub { font-size: 0.8rem; color: var(--slate); }
.pdf-row-status { flex-shrink: 0; font-family: var(--font-display); font-stretch: 80%; font-weight: 750; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--slate-soft); }
#modal-pdf .modal-actions { align-items: center; }
.pdf-foot { margin-right: auto; display: flex; flex-direction: column; min-width: 0; }
.pdf-note { font-size: 0.85rem; font-weight: 700; color: var(--danger); }

/* ─────────────────────────────── TOAST ─────────────────────────────── */
.toast {
    position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 16px); max-width: min(420px, 90vw);
    padding: 10px 16px; background: var(--graphite); color: #fff; border-radius: 12px;
    box-shadow: var(--shadow-lg); font-size: 0.9rem; font-weight: 700; opacity: 0; pointer-events: none;
    transition: opacity 0.2s, transform 0.2s; z-index: 1800;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

/* ─────────────────────────────── ABOUT SECTION ─────────────────────────────── */
/* Kept quiet, as on every other tool: one small grey line, a card only once opened. */
.about-section { margin: 32px 0 20px; }
.about-toggle {
    display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 9px 1.5rem;
    background: none; border: none; border-top: 1px dotted var(--rule-strong);
    font-family: inherit; font-size: 0.8rem; font-weight: 500; color: #94a3b8; text-align: left; cursor: pointer;
    transition: color 0.2s;
}
.about-toggle[aria-expanded="true"] { justify-content: flex-start; }
.about-toggle:not([aria-expanded="true"]) .about-title { flex: 0 1 auto; }
.about-toggle:hover { color: #64748b; }
.about-icon { font-size: 0.8rem; flex-shrink: 0; }
.about-title { flex: 1; }
.toggle-icon { font-size: 0.65rem; transition: transform 0.2s; flex-shrink: 0; }
.about-toggle[aria-expanded="true"] .toggle-icon { transform: rotate(180deg); }
.about-content {
    padding: 4px 20px 20px; margin-top: 4px;
    background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-lg);
}
.about-content h2 { font-family: var(--font-display); font-stretch: 80%; font-weight: 800; font-size: 1.35rem; color: var(--graphite); margin: 20px 0 12px; }
.about-content h3 { font-size: 1.05rem; font-weight: 700; color: var(--graphite); margin: 20px 0 8px; }
.about-content p { font-size: 0.9rem; line-height: 1.55; color: var(--slate); margin-bottom: 8px; }
.about-content ul, .about-content ol { margin: 0 0 12px 18px; }
.about-content li { font-size: 0.9rem; line-height: 1.55; color: var(--slate); margin-bottom: 5px; }
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 20px; }
.how-to-steps li { margin-bottom: 8px; }
.how-to-steps p { margin: 2px 0 0; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.feature-item { padding: 12px; background: var(--paper); border-radius: var(--radius-lg); }
.feature-item strong { display: block; font-size: 0.9rem; color: var(--graphite); margin-bottom: 2px; }
.feature-item p { font-size: 0.82rem; margin: 0; }
.keywords-section { margin-top: 20px; color: var(--slate-soft); }

/* ─────────────────────────────── FOOTER (platform chrome) ─────────────────────────────── */
.app-footer { padding: 16px 0 32px; text-align: center; font-size: 0.8125rem; color: var(--slate-soft); font-family: var(--font-chrome); }
.app-footer p { margin-bottom: 3px; }
.footer-link { color: var(--slate); text-decoration: none; border-bottom: 1px solid transparent; }
.footer-link:hover { color: var(--ink); border-bottom-color: var(--ink); }
.footer-separator { margin: 0 8px; color: var(--rule-strong); }
.version-badge { background: none; border: none; padding: 0; font-size: 0.8125rem; color: var(--slate); cursor: pointer; border-bottom: 1px solid transparent; font-family: var(--font-chrome); }
.version-badge:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* ─────────────────────────────── RESPONSIVE ─────────────────────────────── */
@media (max-width: 768px) {
    .header-inner { padding: 0.5rem 1rem; }
    .tool-name-btn { font-size: 1.25rem; }
    .logo-image { height: 34px; }
}
@media (max-width: 640px) {
    .tabbar { flex-wrap: wrap; align-items: stretch; gap: 0; }
    /* One row that scrolls sideways, like the dashboard's category capsules —
       never wider than the screen, never wrapping in FR/DE/ES. The rule is an
       inset shadow because a scroller clips the underline's -1.5px overhang. */
    .tabs {
        width: 100%; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
        -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
    }
    .tabs::-webkit-scrollbar { display: none; }
    .tab { flex: 0 0 auto; white-space: nowrap; padding: 0 10px; font-size: 0.95rem; gap: 6px; }
    .tab::after { bottom: 0; }
    .tab-actions { order: 2; width: 100%; margin: 12px 0 4px; }
    .tab-new { flex: 1; min-height: 44px; }
    /* Phone: New + a search icon; the field slides over the row when opened. */
    .tab-search-btn { display: grid; }
    .list-search {
        display: none; position: absolute; inset: 0; width: auto; height: auto; z-index: 2;
        border-color: var(--ink); animation: kebabIn 0.15s ease-out;
    }
    .tab-actions.is-searching .list-search { display: flex; }
    .tab-actions.is-searching .list-search-clear { display: grid; width: 44px; }
    .list-search-input { font-size: 1rem; }           /* 16px: iOS does not zoom the page on focus */
    .tabbar { border-bottom: none; }
    .tabs { border-bottom: none; box-shadow: inset 0 -1.5px 0 var(--rule-strong); }

    .sheet { padding: 16px 16px 20px; border-radius: var(--radius-lg); }
    .sheet-stats { gap: 14px; }
    .big-num { font-size: 3.4rem; }
    .big-unit { font-size: 1.3rem; }

    /* Two boxed fields per item read as a wall of inputs on a phone. Each item is
       its own small card instead: the name looks like text until tapped, and the
       group shrinks to a tag beside the move/remove buttons. */
    .sheet.is-editing .items-editing { background: none; border: none; padding: 0; }
    .item-edit {
        grid-template-columns: minmax(0, 1fr) auto; gap: 2px 6px;
        padding: 6px 6px 4px 8px; margin-bottom: 8px;
        background: #fff; border: 1px solid var(--rule); border-radius: var(--radius-md);
    }
    .sheet.is-editing .item-edit:last-child { border-bottom: 1px solid var(--rule); }
    .item-edit .item-label-input {
        grid-column: 1 / -1; min-height: 40px; padding: 0 6px;
        border-color: transparent; background: transparent; font-weight: 600;
    }
    .item-edit .item-label-input:focus { border-color: var(--ink); background: #fff; }
    .item-edit .item-group-input {
        justify-self: start; width: 100%; max-width: 10rem; min-width: 0; min-height: 32px; padding: 0 12px; margin-left: 2px;
        border: 1px dashed var(--rule-strong); border-radius: 999px; background: var(--paper);
        font-size: 0.8rem; font-weight: 600; color: var(--slate);
    }
    .item-edit .item-group-input::-webkit-calendar-picker-indicator { display: none !important; }
    .item-edit .item-group-input:focus { border-style: solid; border-color: var(--ink); background: #fff; }
    .item-edit .item-tools { justify-self: end; }

    .goal-fields { grid-template-columns: minmax(0, 1fr); }
    .goal-due { padding-bottom: 0; margin-top: 6px; }
    .input-date { max-width: none; }
    .tree-link { grid-template-columns: minmax(0, 1fr) auto 44px 3em; gap: 8px; }
    .goal-tree { padding-left: 16px; }
    .goal-tree::before { left: 3px; }
    .goal-tree > .card::before { left: -13px; width: 12px; }
}
@media (max-width: 480px) {
    .header-inner { padding: 0.4rem 0.75rem; }
    .logo-image { height: 30px; }
    .header-icon-btn svg { width: 18px; height: 18px; }
    .container { padding: 12px 12px 0; }
    .welcome { padding-top: 16px; }
    .welcome-actions > * { flex: 1 1 auto; }
    .demo-card { padding: 16px 16px 14px; }
    .card { padding: 12px 14px; }
    .card-pct { font-size: 1.85rem; }
    .item-label { font-size: 1rem; }
    .modal-overlay { padding: 56px 8px 16px; }
    .modal { max-height: calc(100dvh - 72px); }   /* 56 + 16, as above */
    .modal-head, .modal-body, .modal-actions { padding-left: 16px; padding-right: 16px; }
    .act { padding: 0 11px 0 9px; }
}

/* Touch devices get full-size hit areas regardless of viewport width. */
@media (hover: none) and (pointer: coarse) {
    .act { min-height: 44px; }
    .link-btn { min-height: 44px; }
    .tree-link { min-height: 44px; }
    .icon-btn, .tool-btn { width: 44px; height: 44px; }
    .pin-mark { width: 44px; height: 44px; margin: -10px -10px -10px -6px; }
    .run-card:hover, .tpl-card:hover, .goal-card:hover { transform: none; }
}

/* ─────────────────────────────── ACCESSIBILITY ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ─────────────────────────────── PRINT — the card, on paper ─────────────────────────────── */
@media print {
    body { background: #fff; }
    .header, .info-banner, .tabbar, .back-link, .sheet-cta, .kebab-menu,
    .about-section, .app-footer, .menu-overlay, .modal-overlay, .toast, .welcome, .notice, .sheet-tools { display: none !important; }
    .sheet, .card { box-shadow: none; border-color: #999; }
    .item { break-inside: avoid; }
    .title-input { border: none; }
}
