/* Lab Tracker — single stylesheet. Tokens from docs/mockups/README.md.
   No inline styles anywhere: the Content-Security-Policy blocks them. */

/* Colors follow macOS system colors (Golden Gate). Every rule uses these
   tokens, so dark mode only redefines them below. */
:root {
    color-scheme: light dark;
    --bg: #F5F5F7;
    --card: #FFFFFF;
    --surface-2: #FAFAFC;
    --surface-hover: #F7F7F9;
    --well: #EDEDF0;
    --fill: #F0F0F3;
    --fill-2: #E5E5EA;
    --fill-hover: #EAEAEE;
    --hairline: #EBEBEF;
    --border: #E3E3E8;
    --border-strong: #D1D1D6;
    --border-hover: #B8B8BF;
    --text: #1D1D1F;
    --text-2: #48484C;
    --text-3: #6E6E73;
    --placeholder: #8E8E93;
    --accent: #0071E3;
    --accent-rgb: 0, 113, 227;
    --accent-hover: #0062C4;
    --accent-light: #E8F1FD;
    --accent-wash: #F3F8FE;
    --accent-border: #B9D4F7;
    --accent-soft: #9CC3F3;
    --link: #0066CC;
    --on-accent: #FFFFFF;
    --inverse-bg: #1D1D1F;
    /* QR codes stay black on white in both appearances so cameras can read them. */
    --qr-paper: #FFFFFF;
    --inverse-text: #FFFFFF;
    --knob: #FFFFFF;
    --switch-off: #D1D1D6;
    --warn: #B24A00;
    --warn-text: #8A3B00;
    --warn-light: #FFF0DE;
    --warn-wash: #FFF8EF;
    --warn-border: #F5C99B;
    --orange: #FF9500;
    --ok: #1E7B34;
    --ok-light: #E3F5E8;
    --danger: #D70015;
    --danger-light: #FFECEC;
    --danger-wash: #FFF6F6;
    --danger-border: #F4B4B0;
    --purple: #AF52DE;
    --purple-text: #6B2FA0;
    --purple-tint: #F3ECFB;
    --sys-blue: #007AFF;
    --sys-indigo: #5856D6;
    --sys-red: #FF3B30;
    --sys-green: #34C759;
    --sys-gray: #8E8E93;
    --sidebar-bg: rgba(236, 236, 240, 0.78);
    --sidebar-sel: rgba(0, 0, 0, 0.07);
    --thumb: #FFFFFF;
    --glass-bg: rgba(250, 250, 252, 0.72);
    --glass-blur: saturate(180%) blur(20px);
    --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 -1px 0 rgba(0, 0, 0, 0.06);
    --shadow-rgb: 0, 0, 0;
    --radius: 8px;
    --radius-card: 12px;
    --radius-badge: 6px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.06);
    --ring: 0 0 0 4px rgba(var(--accent-rgb), 0.3);
    --font: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
    --ease: 160ms cubic-bezier(0.25, 0.1, 0.25, 1);
    /* Spacing scale (0.14.1): use these for gaps between and inside boxes. */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    background: var(--bg);
    color: var(--text);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #161617;
        --card: #1F1F21;
        --surface-2: #262628;
        --surface-hover: #29292B;
        --well: #1A1A1C;
        --fill: #2C2C2E;
        --fill-2: #3A3A3C;
        --fill-hover: #333336;
        --hairline: #2E2E31;
        --border: #38383A;
        --border-strong: #48484A;
        --border-hover: #5A5A5E;
        --text: #F5F5F7;
        --text-2: #D1D1D6;
        --text-3: #A1A1A6;
        --placeholder: #8E8E93;
        --accent: #0A84FF;
        --accent-rgb: 10, 132, 255;
        --accent-hover: #409CFF;
        --accent-light: rgba(10, 132, 255, 0.2);
        --accent-wash: rgba(10, 132, 255, 0.1);
        --accent-border: rgba(10, 132, 255, 0.45);
        --accent-soft: rgba(10, 132, 255, 0.55);
        --link: #4DA3FF;
        --on-accent: #FFFFFF;
        --inverse-bg: #F5F5F7;
        --inverse-text: #1D1D1F;
        --knob: #FFFFFF;
        --switch-off: #48484A;
        --warn: #FF9F0A;
        --warn-text: #FFB547;
        --warn-light: rgba(255, 159, 10, 0.16);
        --warn-wash: rgba(255, 159, 10, 0.08);
        --warn-border: rgba(255, 159, 10, 0.4);
        --orange: #FF9F0A;
        --ok: #30D158;
        --ok-light: rgba(48, 209, 88, 0.16);
        --danger: #FF453A;
        --danger-light: rgba(255, 69, 58, 0.16);
        --danger-wash: rgba(255, 69, 58, 0.08);
        --danger-border: rgba(255, 69, 58, 0.45);
        --purple: #BF5AF2;
        --purple-text: #DDB0FF;
        --purple-tint: rgba(191, 90, 242, 0.18);
        --sys-blue: #0A84FF;
        --sys-indigo: #5E5CE6;
        --sys-red: #FF453A;
        --sys-green: #30D158;
        --sys-gray: #98989D;
        --sidebar-bg: rgba(40, 40, 43, 0.72);
        --sidebar-sel: rgba(255, 255, 255, 0.1);
        --thumb: #636366;
        --glass-bg: rgba(32, 32, 34, 0.66);
        --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -1px 0 rgba(0, 0, 0, 0.4);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.25);
        --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
    }
}
@media (prefers-contrast: more) {
    :root { --border: var(--border-strong); --hairline: var(--border-strong); --text-3: var(--text-2); }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 16px; }
@media (max-width: 900px) { html { scroll-padding-top: 16px; } }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.47;
    letter-spacing: -0.005em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Links: no underline in the interface, underline on hover; text in
   messages and descriptions (.prose) keeps it so links stand out in prose. */
a {
    color: var(--link); text-decoration: none; border-radius: 4px;
    transition: color var(--ease), background-color var(--ease);
}
a:hover { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible { outline: none; box-shadow: var(--ring); }
.prose a { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(var(--accent-rgb), 0.4); }
.prose a:hover { text-decoration-color: currentColor; }
::selection { background: rgba(var(--accent-rgb), 0.18); }
h1 { margin: 0 0 12px; font-size: 26px; font-weight: 600; letter-spacing: -0.022em; line-height: 1.2; }
.muted { color: var(--text-2); margin: 0 0 16px; }
.mono { font-family: var(--mono); }

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
    width: 32px; height: 32px; border-radius: var(--radius);
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    box-shadow: 0 2px 6px rgba(var(--accent-rgb), 0.35);
    display: flex; align-items: center; justify-content: center;
}
.brand-name { font-weight: 650; font-size: 16px; letter-spacing: -0.01em; }
a.brand, .brand a { color: var(--text); text-decoration: none; }

/* Top bar (docs/mockups/Main) */

.page { max-width: 1280px; margin: 0 auto; padding: 24px; }

/* Phone-sized pages: sign in, setup, errors (docs/mockups/Login) */
.plain-main {
    max-width: 440px; min-height: 100vh; margin: 0 auto;
    padding: 56px 24px 32px;
    display: flex; flex-direction: column; gap: 24px;
}
.plain-main .card { margin-top: 24px; }
.plain-footer { margin-top: auto; font-size: 13px; color: var(--text-2); text-align: center; }
.card-link { margin: 16px 0 0; text-align: center; font-size: 14px; }

.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: 18px; padding: 28px 24px; box-shadow: var(--shadow);
}

/* Forms */
.stack { display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; }
.field input, .field select, .field textarea {
    height: 46px; font: inherit; color: inherit;
    border: 1px solid var(--border-strong); border-radius: var(--radius);
    padding: 0 12px; background: var(--card); box-shadow: var(--shadow-sm);
    transition: border-color var(--ease), box-shadow var(--ease);
}
.field select {
    -webkit-appearance: none; appearance: none; padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235B616E' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}
.field textarea { height: auto; min-height: 96px; padding: 10px 12px; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--border-hover); }
.field input::placeholder, .field textarea::placeholder { color: var(--placeholder); }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: var(--ring);
}
.btn:focus-visible, .link-button:focus-visible, summary:focus-visible {
    outline: none; box-shadow: var(--ring);
}

/* Buttons: at least 44 px tall */
.btn {
    min-height: 44px; padding: 0 18px;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border-radius: var(--radius); border: 1px solid transparent;
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: background-color var(--ease), border-color var(--ease), box-shadow var(--ease), transform 80ms ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--accent); color: var(--on-accent); height: 46px;
    box-shadow: 0 1px 2px rgba(var(--shadow-rgb), 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-secondary { background: var(--card); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border-hover); color: var(--text); }
.btn-block { width: 100%; }

/* Messages */
.alert {
    border-radius: var(--radius); padding: 12px 14px 12px 16px; font-size: 14px; margin-bottom: 16px;
    border: 1px solid transparent; border-left-width: 4px;
}
.alert-error { background: var(--warn-light); color: var(--warn); border-color: var(--warn-border); border-left-color: var(--orange); }
.alert-notice { background: var(--accent-light); color: var(--text); border-color: var(--accent-border); border-left-color: var(--accent); }

.demo-banner {
    background: var(--warn-light); color: var(--warn);
    text-align: center; font-size: 14px; font-weight: 600; padding: 8px 16px;
}

@media (max-width: 600px) {
    .page { padding-left: 16px; padding-right: 16px; }
}

/* Shared bits */
h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.012em; }
h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; letter-spacing: -0.008em; }
.hint { font-size: 13px; line-height: 1.55; color: var(--text-3); }
.is-hidden { display: none !important; }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crumb { margin: 0 0 8px; font-size: 14px; }
.crumb a, .back-link {
    display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px 4px 4px; margin-left: -4px;
    color: var(--text-2); font-weight: 500; border-radius: 8px;
}
.crumb a:hover, .back-link:hover { color: var(--text); background: var(--fill-hover); text-decoration: none; }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-danger { background: var(--card); color: var(--danger); border-color: var(--danger-border); }
.btn-danger:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger-border); }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; cursor: pointer; min-height: 44px; }
.check input { width: 18px; height: 18px; margin: 0; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px 20px; }
.done-mark {
    width: 48px; height: 48px; border-radius: 24px; margin-bottom: 12px;
    background: var(--ok-light); color: var(--ok);
    display: flex; align-items: center; justify-content: center;
}

/* Badges */
.badge {
    display: inline-block; font-size: 12px; font-weight: 600; line-height: 1.6;
    padding: 1px 9px; border-radius: 999px; vertical-align: middle; white-space: nowrap;
}
.badge-ok { background: var(--ok-light); color: var(--ok); }
.badge-info { background: var(--accent-light); color: var(--accent-hover); }
.badge-warn { background: var(--warn-light); color: var(--warn-text); }
.badge-muted { background: var(--fill); color: var(--text-2); }
.badge-dark { background: var(--inverse-bg); color: var(--inverse-text); font-size: 11px; letter-spacing: 0.04em; margin-left: 6px; }

/* Settings layout (docs/mockups/Settings) */
.settings { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.subnav { display: flex; flex-direction: column; gap: 2px; }
.subnav a {
    min-height: 44px; padding: 0 12px; border-radius: var(--radius);
    display: flex; align-items: center; text-decoration: none; color: var(--text-2);
}
.subnav a:hover { background: var(--fill-hover); color: var(--text); text-decoration: none; }
.subnav a[aria-current="page"] { background: var(--card); color: var(--accent-hover); font-weight: 600; box-shadow: var(--shadow); }
.subnav-note { font-size: 13px; color: var(--text-3); padding: 8px 12px; margin: 0; }
.settings-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius-card); padding: 20px; box-shadow: var(--shadow);
}
.panel .muted:last-child { margin-bottom: 0; }
.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1 1 240px; }
.copy-row { display: flex; gap: 8px; margin-bottom: 12px; }
.copy-row input {
    flex: 1; min-width: 0; height: 44px; font-size: 14px;
    border: 1px solid var(--border-strong); border-radius: var(--radius);
    padding: 0 12px; background: var(--bg);
}
.quote { background: var(--bg); border-radius: var(--radius); padding: 10px 12px; font-size: 14px; color: var(--text-2); }

/* Tables */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); overflow-x: auto; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3);
    text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 16px;
    border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.table tbody tr { transition: background-color var(--ease); }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.person { display: flex; align-items: center; gap: 10px; }
.person > span:last-child { display: flex; flex-direction: column; }
.person-name { font-weight: 600; }
.person-user { font-size: 13px; color: var(--text-3); font-weight: 400; }
.person-email { overflow-wrap: anywhere; }
.outbox-mail { border-top: 1px solid var(--border); padding-top: 12px; }
.outbox-mail p { margin: 0 0 4px; }
.outbox-text { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 13px; color: var(--text-2); }
.avatar {
    width: 36px; height: 36px; border-radius: 18px; flex-shrink: 0;
    background: var(--accent-light); color: var(--accent-hover);
    font-size: 13px; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
}

/* Group pills */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills a {
    min-height: 40px; padding: 0 14px; border-radius: 20px;
    display: inline-flex; align-items: center; text-decoration: none;
    border: 1px solid var(--border-strong); background: var(--card); color: var(--text); font-size: 14px; font-weight: 500;
    transition: background-color var(--ease), border-color var(--ease);
}
.pills a:hover { background: var(--fill-hover); color: var(--text); text-decoration: none; }
.pills a[aria-current="page"] { border-color: var(--inverse-bg); background: var(--inverse-bg); color: var(--inverse-text); font-weight: 600; }

/* Segmented radio */
.segmented { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0; }
.segmented legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; }
.segmented span {
    min-height: 44px; padding: 0 14px; display: inline-flex; align-items: center;
    border: 1px solid var(--border-strong); background: var(--card); color: var(--text); font-size: 14px;
    transition: background-color var(--ease), color var(--ease);
}
.segmented label:hover span { background: var(--fill-hover); }
.segmented label:first-of-type span { border-radius: var(--radius) 0 0 var(--radius); }
.segmented label:last-of-type span { border-radius: 0 var(--radius) var(--radius) 0; border-left: 0; }
.segmented input:checked + span { background: var(--inverse-bg); color: var(--inverse-text); font-weight: 600; border-color: var(--inverse-bg); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Permission switches */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.perm-section { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 8px 16px; margin: 0; }
.perm-section legend {
    font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text-3); padding: 0 6px;
}
.switch-row {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    min-height: 44px; font-size: 14px; cursor: pointer;
}
.switch-row + .switch-row { border-top: 1px solid var(--hairline); }
.switch {
    appearance: none; -webkit-appearance: none; flex-shrink: 0; margin: 0;
    width: 44px; height: 28px; border-radius: 14px; background: var(--switch-off);
    position: relative; cursor: pointer; transition: background 0.15s;
}
.switch::after {
    content: ''; position: absolute; top: 3px; left: 3px;
    width: 22px; height: 22px; border-radius: 11px; background: var(--knob);
    transition: transform 0.15s;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 800px) {
    .settings { grid-template-columns: 1fr; }
    .subnav { flex-direction: row; flex-wrap: wrap; }
    .subnav-note { display: none; }
}

/* Installer and update screens */
.danger-banner {
    background: var(--warn); color: var(--on-accent);
    text-align: center; font-size: 14px; font-weight: 600; padding: 10px 16px;
}
.step-label { font-size: 13px; color: var(--text-3); margin-bottom: 4px; }
.checklist { list-style: none; margin: 0 0 16px; padding: 0; font-size: 14px; }
.checklist li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--hairline); }
.checklist li:last-child { border-bottom: 0; }
.check-mark { width: 20px; flex-shrink: 0; font-weight: 700; text-align: center; }
.checklist .is-ok .check-mark { color: var(--ok); }
.checklist .is-bad .check-mark { color: var(--warn); }
.checklist .is-bad { color: var(--text); }
.check-fix { display: block; margin-top: 2px; }
.summary { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 16px; font-size: 14px; }
.summary dt { color: var(--text-3); }
.summary dd { margin: 0; overflow-wrap: anywhere; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.steps .copy-row { margin: 8px 0 4px; }
.pending { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.pending li { display: flex; flex-direction: column; padding: 6px 0; }
.alert ul { margin: 6px 0; padding-left: 18px; }
progress { width: 100%; height: 8px; accent-color: var(--accent); }
.plain-main .stack > h1, .plain-main .card.stack > h1 { margin-bottom: 0; }

/* Page head and toolbar (docs/mockups/Board) */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 8px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 8px 0 12px; }
.search { flex: 1 1 260px; max-width: 420px; }
.search input {
    width: 100%; height: 44px; font: inherit; border: 1px solid var(--border-strong);
    border-radius: var(--radius); padding: 0 12px 0 38px; box-shadow: var(--shadow-sm);
    background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A909C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center;
    transition: border-color var(--ease), box-shadow var(--ease);
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.toggle {
    min-height: 40px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px;
    text-decoration: none; font-size: 14px; font-weight: 500; color: var(--text); background: var(--card);
    border: 1px solid var(--border-strong); border-radius: 999px;
    transition: background-color var(--ease), border-color var(--ease), color var(--ease);
}
.toggle:hover { background: var(--fill-hover); color: var(--text); text-decoration: none; }
.toggle[aria-pressed="true"] { background: var(--inverse-bg); color: var(--inverse-text); border-color: var(--inverse-bg); font-weight: 600; }
/* Segmented links: a soft track with the chosen option raised. */
.seg-links { display: inline-flex; gap: 2px; padding: 3px; background: var(--fill-2); border-radius: 12px; }
.seg-links a {
    min-height: 38px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: 9px;
    text-decoration: none; font-size: 14px; font-weight: 500; color: var(--text-2);
    transition: background-color var(--ease), color var(--ease), box-shadow var(--ease);
}
.seg-links a:hover { color: var(--text); text-decoration: none; }
.seg-links a[aria-pressed="true"], .seg-links a[aria-current="page"] {
    background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(var(--shadow-rgb), 0.12);
}
.legend { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 0 0 16px; }

/* Due and priority badges */
.badge.due-over { background: var(--warn); color: var(--on-accent); font-size: 11px; font-weight: 700; }
.badge.due-soon { background: var(--warn-light); color: var(--warn-text); font-size: 11px; font-weight: 700; }
.badge.due-done { background: var(--ok-light); color: var(--ok); font-size: 11px; font-weight: 700; }
.badge.due-plain { background: var(--fill); color: var(--text); font-size: 11px; }
.badge-high { background: var(--warn-light); color: var(--warn); font-size: 11px; font-weight: 700; box-shadow: inset 0 0 0 1px var(--orange); }

/* Board columns */
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.column { background: var(--well); border-radius: var(--radius-card); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 240px; }
.column-head { display: flex; justify-content: space-between; align-items: center; }
.column-head h2 { font-size: 15px; }
.count { color: var(--text-3); font-weight: 500; margin-left: 4px; }
.icon-btn {
    width: 36px; height: 36px; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center;
    text-decoration: none; color: var(--text-2); font-size: 20px; line-height: 1;
}
.icon-btn:hover { background: var(--card); color: var(--text); text-decoration: none; }
.entry-card {
    display: flex; flex-direction: column; gap: 8px; padding: 14px;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm);
    transition: box-shadow var(--ease), border-color var(--ease), transform var(--ease);
}
.entry-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-lg); color: var(--text); text-decoration: none; transform: translateY(-1px); }
.entry-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badges:empty { display: none; }
.entry-title { font-weight: 600; line-height: 1.35; }
.entry-people { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.avatar-small { width: 26px; height: 26px; border-radius: 13px; font-size: 11px; }
.empty { margin: 0; padding: 8px 4px; }
.row-link { font-weight: 600; text-decoration: none; }
.row-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Entry form and page (docs/mockups/NewEntry, Entry) */
.form-page { display: flex; flex-direction: column; gap: 16px; max-width: 880px; }
.form-actions { padding-bottom: 24px; gap: var(--space-3); }
.people-picker { border: 0; padding: 0; margin: 0; }
.people-picker legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; }
.chip > span {
    min-height: 40px; padding: 0 12px 0 6px; border-radius: 20px; display: inline-flex; align-items: center; gap: 8px;
    border: 1px solid var(--border-strong); background: var(--card); font-size: 14px;
}
.chip input:checked + span { border-color: var(--accent); background: var(--accent-light); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.entry-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin: 8px 0 16px; }
.fact { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.fact-label { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.status-form { display: flex; gap: 6px; margin: 0; }
.status-form select { height: 36px; font: inherit; font-size: 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 0 8px; background: var(--card); }
.person-chip { display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; }
.prose { font-size: 15px; overflow-wrap: anywhere; }

@media (max-width: 1000px) {
    .board { grid-template-columns: repeat(4, 260px); }
}

/* Shown only when app.js runs */
[data-js-only] { display: none; }
.js [data-js-only] { display: inline-flex; }

/* Templates (docs/mockups/Settings, Templates) */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.template-card {
    display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: var(--radius-card);
    background: var(--card); border: 1px solid var(--border); text-decoration: none; color: var(--text);
}
.template-card:hover { border-color: var(--border-strong); color: var(--text); }
.template-card.is-selected { border: 2px solid var(--accent); padding: 13px; }
.template-name { font-weight: 600; }
.kind-tag {
    align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
    padding: 2px 8px; border-radius: 6px; background: var(--accent-light); color: var(--accent-hover);
}
.kind-tag.kind-work { background: var(--purple-tint); color: var(--purple-text); }
.template-detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; margin-bottom: 16px; }
.template-detail h4 { margin: 0 0 8px; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.field-line { display: flex; justify-content: space-between; gap: 12px; }
.vis { font-size: 12px; font-weight: 600; color: var(--text-2); }
.vis-public { color: var(--accent-hover); }
.field-editor { display: flex; flex-direction: column; gap: 12px; }
.field-def {
    display: grid; grid-template-columns: 2fr 1fr 1fr 2fr 2fr auto; gap: 10px; align-items: end;
    border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin: 0;
}
@media (max-width: 900px) { .field-def { grid-template-columns: 1fr 1fr; } }

/* Stage editor */
.stage-editor { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.stage-row { display: flex; align-items: center; gap: 8px; }
.stage-num {
    width: 28px; height: 28px; flex-shrink: 0; border-radius: 14px; background: var(--fill);
    display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: var(--text-2);
}
.stage-row input[type=text] {
    flex: 1; min-width: 0; height: 44px; font: inherit; border: 1px solid var(--border-strong);
    border-radius: var(--radius); padding: 0 12px; background: var(--card);
}
.stage-tools { gap: 2px; }
.stage-tools .icon-btn { border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 18px; }

/* Items on the entry page (docs/mockups/Entry, Progress) */
.progress { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.item-card { display: flex; flex-direction: column; gap: 12px; }
.item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.item-head h3 { margin: 6px 0 2px; }
.item-head .hint { margin: 0; }
.lot { font-size: 14px; font-weight: 500; color: var(--text-2); margin-left: 6px; }
.stages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.stage { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--hairline); }
.stage:first-child { border-top: 0; }
.stage-mark {
    width: 28px; height: 28px; flex-shrink: 0; border-radius: 14px;
    display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
    background: var(--fill); color: var(--text-2);
}
.stage-done .stage-mark { background: var(--ok-light); color: var(--ok); }
.stage-now .stage-mark { background: var(--accent); color: var(--on-accent); }
.stage-now .stage-name { font-weight: 600; }
.stage-text { flex: 1; display: flex; flex-direction: column; }
.stage form { margin: 0; }
.stages-details summary { font-size: 14px; }
.field-values { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin: 0; }
.field-values dt { font-size: 13px; color: var(--text-3); }
.field-values dd { margin: 0; font-weight: 500; }
.field-value { gap: 4px; }
.check-small { min-height: 28px; font-size: 13px; }
.check-small input { width: 16px; height: 16px; }
.entry-progress { font-size: 13px; }

/* Entry tabs (docs/mockups/Entry) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 20px 0 16px; overflow-x: auto; }
.tabs a {
    min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; white-space: nowrap;
    text-decoration: none; color: var(--text-2); border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs a { transition: color var(--ease), border-color var(--ease); }
.tabs a:hover { color: var(--text); border-bottom-color: var(--border-strong); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }

/* Documents */
.documents { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.doc-list { list-style: none; margin: 0; padding: 4px 20px; }
.doc { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--hairline); }
.doc:first-child { border-top: 0; }
.doc-icon {
    width: 36px; height: 36px; flex-shrink: 0; border-radius: var(--radius); background: var(--fill); color: var(--text-2);
    display: flex; align-items: center; justify-content: center;
}
.doc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.doc-title { font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.doc-title:hover { text-decoration: underline; }
.doc-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.doc-actions form { margin: 0; }
.doc-actions .icon-btn { border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 20px; }
.pill-toggle {
    min-height: 36px; padding: 0 14px; border-radius: 999px; transition: background-color var(--ease), border-color var(--ease); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
    border: 1px solid var(--border-strong); background: var(--card); color: var(--text-2);
}
.pill-toggle[aria-pressed="true"] { border-color: var(--accent-border); background: var(--accent-light); color: var(--accent-hover); }
.doc-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.dropzone { border: 2px dashed var(--border-strong); display: flex; flex-direction: column; gap: 8px; }
.dropzone.is-over { border-color: var(--accent); background: var(--accent-light); }
.dropzone-label { font-size: 15px; cursor: pointer; }
.link-like { color: var(--accent); font-weight: 600; }
.js-only-text { display: none; }
.js .js-only-text { display: inline; }
.js .dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 600px) {
    .doc { flex-wrap: wrap; }
    .doc-actions { width: 100%; justify-content: flex-end; }
}

/* Sharing tab */
.panel-highlight { border: 2px solid var(--accent); }
.choice-list { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.choice-list legend { font-weight: 600; font-size: 14px; margin-bottom: 4px; padding: 0; }
.access-log li { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--hairline); padding-top: 6px; }
.access-log li:first-child { border-top: 0; padding-top: 0; }
.badge-shared { background: var(--purple-tint); color: var(--purple-text); font-size: 11px; font-weight: 700; }

/* Public share page (docs/mockups/Public, Gate) */
.public-header { background: var(--glass-bg); border-bottom: 1px solid var(--border); }
.public-inner { max-width: 880px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.public-header-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.shared-with {
    display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600;
    padding: 4px 10px; border-radius: 16px; background: var(--accent-light); color: var(--accent-hover);
}
.public-main { display: flex; flex-direction: column; gap: 16px; padding-top: 28px; padding-bottom: 40px; }
.public-hero h1 { font-size: 26px; margin: 8px 0 4px; }
.public-section { display: flex; flex-direction: column; gap: 12px; }
.public-item { display: flex; flex-direction: column; gap: 12px; }
.public-item h3 { margin: 0; }
.callout { border-left: 4px solid var(--accent); background: linear-gradient(90deg, var(--accent-wash), var(--card) 40%); }
.callout h2 { font-size: 16px; margin-bottom: 6px; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tl { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; min-height: 40px; position: relative; }
.tl:not(:last-child)::after {
    content: ''; position: absolute; left: 13px; top: 32px; width: 2px; height: calc(100% - 24px); background: var(--border-strong);
}
.tl-done:not(:last-child)::after { background: var(--accent); }
.tl-mark {
    width: 28px; height: 28px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; border: 2px solid var(--border-strong); background: var(--card); color: var(--text-2);
}
.tl-done .tl-mark { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tl-now .tl-mark { border-color: var(--accent); color: var(--accent); font-size: 20px; }
.tl-now .tl-label { font-weight: 600; }
.public-footer { text-align: center; padding-top: 8px; }
.contact { font-size: 14px; }
.lock-mark {
    width: 48px; height: 48px; border-radius: 24px; background: var(--accent-light); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
}
.field-error { font-size: 14px; color: var(--warn); }
input[aria-invalid="true"] { border-color: var(--warn) !important; }
@media (max-width: 600px) { .public-inner { padding-left: 16px; padding-right: 16px; } }

/* Audit log */
.audit-list li { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-top: 1px solid var(--hairline); }
.audit-list li:first-child { border-top: 0; }
.audit-list .hint { white-space: nowrap; }
@media (max-width: 700px) { .audit-list li { flex-direction: column; gap: 2px; } }

/* Notifications (the bell) */

.notif-list { list-style: none; margin: 0; padding: 4px 8px; }
.notif + .notif { border-top: 1px solid var(--hairline); }
.notif form { margin: 0; }
.notif-button {
    width: 100%; min-height: 52px; display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    border: 0; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; border-radius: var(--radius);
}
.notif-button:hover { background: var(--bg); }
.notif-text { flex: 1; }
.is-unread .notif-text { font-weight: 600; }
.notif-dot { width: 8px; height: 8px; border-radius: 4px; background: var(--accent); flex-shrink: 0; }

/* Discussion (docs/mockups/Entry) */
.discussion { margin-bottom: 16px; }
.thread { display: flex; flex-direction: column; gap: 12px; }
.thread-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.thread-head h3 { margin: 0; }
.thread-head form { margin: 0; }
.thread details > summary { cursor: pointer; list-style: none; }
.thread details > summary::-webkit-details-marker { display: none; }
.thread details[open] > summary { margin-bottom: 12px; }
.comments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.comment { display: flex; gap: 10px; }
.comment-body { flex: 1; min-width: 0; }
.comment-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 14px; }
.comment-body .prose p { margin: 4px 0; }
.comment-body .prose ul { margin: 4px 0; padding-left: 20px; }
.prose code { font-family: var(--mono); font-size: 13px; background: var(--fill); padding: 1px 4px; border-radius: 4px; }
.mention { color: var(--accent-hover); background: var(--accent-light); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.reply-form { display: flex; gap: 8px; align-items: flex-end; }
.reply-form textarea {
    flex: 1; min-height: 44px; font: inherit; border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 10px 12px;
}
.inline-form-plain { display: inline; margin: 0; }
/* Small text actions (Remove, Undo, Pin…): quiet until hovered. */
.link-button {
    display: inline-flex; align-items: center; gap: 4px;
    border: 0; background: none; padding: 4px 8px; margin: -4px 0; border-radius: 8px;
    font: inherit; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; min-height: 28px;
    transition: background-color var(--ease), color var(--ease);
}
.link-button:hover { background: var(--fill); color: var(--text); }
.link-button.link-danger:hover { background: var(--danger-light); color: var(--danger); }
.field textarea { font: inherit; }
@media (max-width: 600px) { .reply-form { flex-direction: column; align-items: stretch; } }

/* Dashboard (docs/mockups/Main) */
.dashboard { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.feed { display: flex; flex-direction: column; gap: 14px; }
.feed-hello h1 { margin-bottom: 0; }
.feed-hello .hint { margin: 2px 0 0; }
.composer { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.composer textarea {
    width: 100%; min-height: 64px; font: inherit; border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 10px 12px; resize: vertical;
    transition: border-color var(--ease), box-shadow var(--ease);
}
.composer textarea:focus, .reply-form textarea:focus, .reply-form input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.composer-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.feed-card { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; }
.feed-card.is-pinned { border: 2px solid var(--orange); background: var(--warn-wash); }
.pin-label { font-size: 12px; font-weight: 700; color: var(--warn); text-transform: uppercase; letter-spacing: 0.04em; display: flex; align-items: center; gap: 4px; }
.feed-head { display: flex; align-items: center; gap: 10px; }
.feed-head > span:last-child { display: flex; flex-direction: column; }
.feed-body p { margin: 0 0 6px; }
.feed-body p:last-child { margin-bottom: 0; }
.feed-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.feed-actions form { margin: 0; }
.feed-comments { border-top: 1px solid var(--hairline); padding-top: 10px; }
.activity-line { display: flex; gap: 12px; align-items: flex-start; }
.activity-line > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.activity-icon {
    width: 32px; height: 32px; flex-shrink: 0; border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
    font-weight: 700; background: var(--accent-light); color: var(--accent-hover);
}
.icon-receipt { background: var(--ok-light); color: var(--ok); }
.icon-updates { background: var(--purple-tint); color: var(--purple-text); }
.activity-detail { font-size: 14px; color: var(--text-2); }
.activity-meta { font-size: 13px; }
.activity-list { margin: 4px 0; padding-left: 18px; font-size: 14px; color: var(--text-2); }
.side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px; }
.side h2 { font-size: 16px; }
.work-list { list-style: none; margin: 8px 0 0; padding: 0; }
.work-list li + li { border-top: 1px solid var(--hairline); }
.work-list a { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; text-decoration: none; color: var(--text); }
.work-list a:hover .work-title { text-decoration: underline; }
.work-title { font-weight: 600; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
@media (max-width: 900px) {
    .dashboard { grid-template-columns: 1fr; }
    .side { position: static; order: -1; }
}

/* Calendar (docs/mockups/Calendar) */
.cal-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.cal-filter { gap: 8px; }
.cal-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--text-3); }
.cal-deadline .cal-swatch { background: var(--orange); }
.cal-filter[aria-pressed="false"] { opacity: 0.6; }
.cal { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; margin-bottom: 12px; box-shadow: var(--shadow); }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-row + .cal-row { border-top: 1px solid var(--border); }
.cal-head { background: var(--surface-2); }
.cal-dow { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.cal-day { min-height: 112px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-day + .cal-day { border-left: 1px solid var(--border); }
.cal-day.is-other { background: var(--surface-hover); }
.cal-day.is-other .cal-date { color: var(--text-3); }
.cal-date { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; padding: 0 2px; }
.is-today .cal-date span[aria-current] { background: var(--accent); color: var(--on-accent); border-radius: 12px; min-width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.cal-day:hover { background: var(--surface-hover); }
.cal-add { visibility: hidden; text-decoration: none; color: var(--text-3); width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; }
.cal-day:hover .cal-add, .cal-add:focus-visible { visibility: visible; }
.cal-add:hover { background: var(--accent-light); color: var(--accent); }
.cal-item {
    display: block; font-size: 12px; line-height: 1.35; padding: 3px 6px; border-radius: 6px; text-decoration: none;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--fill); color: var(--text);
}
.cal-item { transition: filter var(--ease); }
.cal-item:hover { text-decoration: none; filter: brightness(0.95); }
.cal-item.cal-deadline { background: var(--warn-light); color: var(--warn-text); }
.cal-item.type-seminar { background: var(--purple-tint); color: var(--purple-text); }
.cal-item.type-deadline.cal-event { background: var(--warn-light); color: var(--warn-text); }
@media (max-width: 760px) {
    .cal-day { min-height: 72px; padding: 3px; }
    .cal-item { font-size: 11px; padding: 2px 4px; }
    .cal-dow { padding: 6px 4px; font-size: 11px; }
}

/* Dashboard: This week */
.week-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.week-list li { display: flex; gap: 12px; }
.week-day { width: 40px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; border-radius: var(--radius); background: var(--bg); padding: 4px 0; font-size: 11px; color: var(--text-3); }
.week-day strong { font-size: 17px; color: var(--text); }
.week-items { display: flex; flex-direction: column; min-width: 0; }
.week-items a { font-weight: 600; text-decoration: none; color: var(--text); }
.week-items a:hover { text-decoration: underline; }

/* Disclosure headings such as “+ Add shipment” */
.add-summary {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    font-size: 17px; font-weight: 600; cursor: pointer; margin: -4px; padding: 4px; border-radius: 8px;
}
.add-summary::after {
    content: ''; width: 9px; height: 9px; margin-right: 6px; flex-shrink: 0;
    border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3);
    transform: rotate(45deg) translateY(-3px); transition: transform var(--ease);
}
details[open] > .add-summary::after { transform: rotate(225deg) translate(-2px, 0); }
details[open] > .add-summary { margin-bottom: 16px; }

/* Shipments */
.shipments { margin-top: 24px; }
.shipment .item-head p { margin: 0; }
.tracking-row { margin: 0; align-items: center; }
.tracking-row input { max-width: 280px; }
.ship-events { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--border); }
.ship-events li { position: relative; padding: 4px 0 10px 8px; font-size: 14px; }
.ship-events li::before {
    content: ''; position: absolute; left: -23px; top: 9px; width: 10px; height: 10px; border-radius: 50%;
    background: var(--card); border: 2px solid var(--border-strong);
}
.ship-events li.is-latest::before { background: var(--accent); border-color: var(--accent); }
.ship-events .hint { display: block; }
.ship-form { margin-top: 4px; }
.ship-form form { margin-top: 12px; }
.ship-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 0; }
.cal-item.cal-ship { background: var(--accent-light); color: var(--accent-hover); }
.cal-ship .cal-swatch { background: var(--accent); }
.ship-out li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 6px 0; }
.ship-out .hint { flex-basis: 100%; }

/* Disclosures: no browser triangles. .disclosure is a small text action
   with a chevron that turns when open. */
summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
.disclosure {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; margin-left: -8px;
    border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--accent);
    transition: background-color var(--ease);
}
.disclosure:hover { background: var(--accent-light); }
.disclosure::before {
    content: ''; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(-45deg); transition: transform var(--ease);
}
details[open] > .disclosure::before { transform: rotate(45deg); }
details[open] > .disclosure { margin-bottom: 8px; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}

/* Grids (partials/grid.php): spreadsheet-style entry */
.js-only { display: none !important; }
.js .js-only { display: inline-flex !important; }
.grid-box { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.grid-scroll { max-height: 70vh; overflow: auto; }
.grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
.grid thead th {
    position: sticky; top: 0; z-index: 2; background: var(--surface-2); text-align: left; white-space: nowrap;
    font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em;
    padding: 8px 6px; border-bottom: 1px solid var(--border);
}
.grid td, .grid tbody th { padding: 0; border-bottom: 1px solid var(--hairline); border-right: 1px solid var(--hairline); vertical-align: middle; }
.grid td:last-child { border-right: 0; }
.grid .grid-num {
    position: sticky; left: 0; z-index: 1; width: 40px; min-width: 40px; text-align: center;
    background: var(--surface-2); color: var(--text-3); font-size: 12px; font-weight: 500;
}
.grid thead .grid-num { z-index: 3; }
.grid input, .grid select {
    width: 100%; height: 38px; border: 0; border-radius: 0; background: transparent;
    font: inherit; font-size: 14px; color: inherit; padding: 0 8px; box-shadow: none;
}
.grid select {
    -webkit-appearance: none; appearance: none; padding-right: 24px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238A909C' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center;
}
.grid input:focus, .grid select:focus { outline: none; background-color: var(--accent-wash); box-shadow: inset 0 0 0 2px var(--accent); }
.grid input::placeholder { color: var(--placeholder); }
.grid .is-unmatched { background-color: var(--warn-light); box-shadow: inset 0 0 0 2px var(--warn-border); }
.grid .grid-s { min-width: 90px; width: 110px; }
.grid .grid-m { min-width: 140px; }
.grid .grid-l { min-width: 220px; }
.grid .grid-label { padding: 0 10px; font-weight: 600; white-space: nowrap; }
.grid .grid-tool { width: 36px; min-width: 36px; text-align: center; }
.grid-del {
    width: 28px; height: 28px; border: 0; border-radius: 6px; background: none; cursor: pointer;
    color: var(--text-3); font-size: 18px; line-height: 1;
}
.grid-del:hover { background: var(--danger-light); color: var(--danger); }
.grid tr.is-invalid th, .grid tr.is-invalid td { background: var(--danger-wash); }
.grid tr.is-invalid .grid-num { box-shadow: inset 3px 0 0 var(--danger); }
.grid .grid-error td { padding: 4px 8px 8px; font-size: 13px; color: var(--danger); background: var(--danger-wash); border-right: 0; }
.grid-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.grid-shared { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.batch-bar {
    position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
    padding: 12px 16px; margin-top: 4px; background: var(--glass-bg); border: 1px solid var(--border);
    border-radius: var(--radius-card); box-shadow: var(--shadow-lg);
}

.pick-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pick-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 0; border-top: 1px solid var(--hairline); }
.pick-list li:first-child { border-top: 0; padding-top: 0; }
.pick-name { flex: 1 1 220px; font-weight: 600; }
.pick-name .hint { font-weight: 400; margin-left: 6px; }
.item-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.item-pick input { width: 18px; height: 18px; margin: 0; }
.bulk-stages { position: sticky; top: 72px; bottom: auto; margin: 0 0 12px; justify-content: space-between; }
@media (max-width: 900px) { .bulk-stages { top: 0; } }

.all-links { width: 100%; font-size: 13px; border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 10px 12px; background: var(--surface-2); }
@media (max-width: 600px) {
    .batch-bar { padding: 8px 10px; gap: 8px; }
    .batch-bar .btn { min-height: 40px; height: 40px; padding: 0 12px; font-size: 14px; }
    .grid-scroll { max-height: 60vh; }
}

/* ------------------------------------------------------------------
   Spacing and grouping (0.14.1)
   Page rhythm: 24 px between the blocks of a page. Inside a box:
   .panel-head, then .panel-section blocks split by thin dividers, then
   a .panel-foot strip for actions. dl.facts for label/value pairs.
   ------------------------------------------------------------------ */
.page > * { margin-top: 0; margin-bottom: 0; }
.page > * + * { margin-top: var(--space-5); }
.page > .crumb + * { margin-top: var(--space-1); }
.page > h1 + .muted, .page > h1 + p { margin-top: calc(-1 * var(--space-3)); }
.page > .tabs { margin-top: var(--space-6); }
.page > .tabs + * { margin-top: var(--space-5); }
.page-head h1 { margin-bottom: var(--space-1); }
.page-head .muted { margin: 0; }
.page > .page-head + .alert, .page > .alert + * { margin-top: var(--space-4); }
.alert { margin-bottom: 0; }
.panel { padding: var(--space-5); }
.form-page { gap: var(--space-5); }
.settings-body { gap: var(--space-5); }
.section-head { margin-bottom: var(--space-4); }
.section-head h2, .section-head h3 { margin: 0; }

.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { margin: 0; }
.panel-head .hint { margin: var(--space-1) 0 0; }
.panel-section { border-top: 1px solid var(--border); padding-top: var(--space-4); margin-top: var(--space-4); }
.panel-head + .panel-section { margin-top: var(--space-4); }
.section-label {
    display: block; margin: 0 0 var(--space-3); font-size: 12px; font-weight: 600; color: var(--text-3);
    text-transform: uppercase; letter-spacing: 0.05em;
}
.panel-foot {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3);
    margin: var(--space-5) calc(-1 * var(--space-5)) calc(-1 * var(--space-5));
    padding: var(--space-3) var(--space-5);
    background: var(--surface-2); border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius-card) var(--radius-card);
}
.panel-foot form { margin: 0; }
.panel-foot .spacer { flex: 1; }
.panel-foot details { flex-basis: 100%; }
.panel-foot details + details { margin-top: calc(-1 * var(--space-1)); }
.panel-foot details[open] > form.stack {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); margin-bottom: var(--space-2);
}
dl.facts {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-4) var(--space-5); margin: 0;
}
dl.facts > div { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
dl.facts dt { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
dl.facts dd { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
dl.facts.facts-stack { grid-template-columns: 1fr; }
fieldset legend, .segmented legend, .choice-list legend { margin-bottom: var(--space-2); }
.check-small { margin-top: 6px; min-height: 28px; }
@media (max-width: 600px) {
    .panel { padding: var(--space-4); }
    .panel-foot { margin: var(--space-4) calc(-1 * var(--space-4)) calc(-1 * var(--space-4)); padding: var(--space-3) var(--space-4); }
    .page > * + * { margin-top: var(--space-4); }
}

/* Item cards on the entry page */
.item-card { display: block; }
.progress { gap: var(--space-4); margin-bottom: 0; }
.progress > .section-head { margin-bottom: 0; }
.shipments { margin-top: var(--space-6); }
.item-card .stage { padding: 10px 0; }
.item-card .stage:first-child { border-top: 0; padding-top: 0; }
.item-card .stages-details[open] > summary { margin-bottom: var(--space-3); }
.item-card .field-row { gap: var(--space-4) var(--space-5); }
.field-value { gap: var(--space-2); }

/* Shipment cards */
.shipments > .section-head { margin-bottom: var(--space-4); }
.shipments > .panel + .panel, .shipments > .panel + details { margin-top: var(--space-4); }
.ship-events li { padding: 2px 0 14px 10px; }
.ship-events li:last-child { padding-bottom: 2px; }
.ship-form { margin-top: 0; }
.panel-foot details > summary { padding-top: 4px; padding-bottom: 4px; }

/* Feed (dashboard) */
.feed { gap: var(--space-4); }
.feed-card { display: block; padding: 20px var(--space-5); }
.feed-card .feed-body { margin-top: var(--space-3); }
.feed-card .feed-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.feed-card .feed-comments { border-top: 0; padding-top: 0; margin-bottom: var(--space-4); }
.feed-thread .reply-form { margin: 0; }
.activity-line { align-items: flex-start; gap: var(--space-3); }
.activity-line > span:last-child { display: block; min-width: 0; line-height: 1.55; }
.activity-line .activity-detail, .activity-line .activity-meta { display: block; margin-top: var(--space-1); }
.activity-list { margin: var(--space-2) 0 0; }
.pin-label { margin-bottom: var(--space-2); }

/* Dashboard side boxes: one divided row per item */
.side { gap: var(--space-5); }
.side .panel { padding: 20px; }
.side .section-head { margin-bottom: var(--space-3); }
.side .work-list, .side .week-list, .side .ship-out { gap: 0; margin: 0; }
.side .work-list > li, .side .week-list > li, .side .ship-out > li { padding: var(--space-3) 0; border-top: 1px solid var(--hairline); }
.side .work-list > li:first-child, .side .week-list > li:first-child, .side .ship-out > li:first-child { border-top: 0; padding-top: 0; }
.side .work-list > li:last-child, .side .week-list > li:last-child, .side .ship-out > li:last-child { padding-bottom: 0; }
.side h2 { margin: 0; }

/* Forms: a heading per panel, more room between fields */
.form-page > .panel > h2:first-child { padding-bottom: var(--space-3); border-bottom: 1px solid var(--border); }
.form-page .field label { margin-bottom: 2px; }
.form-page .segmented legend { margin-bottom: var(--space-2); }
.form-page .people-picker { margin-top: calc(-1 * var(--space-2)); }

/* Settings */
.perm-grid { gap: var(--space-4); }
.perm-section { padding: var(--space-3) var(--space-4) var(--space-2); }
.perm-section legend { padding: 0 6px; margin-left: -6px; }
.switch-row { padding: 10px 0; }
.settings .pills, .settings .tabs-groups { margin-bottom: var(--space-2); }
.settings .table td { padding-top: 14px; padding-bottom: 14px; }
.subnav { gap: var(--space-1); }
/* Fieldsets size to their content by default; let them shrink on small screens. */
fieldset { min-width: 0; }

/* Dark variants of inline SVG arrows and icons (they can't use currentColor). */
@media (prefers-color-scheme: dark) {
    .field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23A1A1A6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
    .search input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A1A1A6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); }
    .grid select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23A1A1A6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
}

/* Glass falls back to solid when the system asks for less transparency
   (like Golden Gate's Liquid Glass slider at its opaque end) or when the
   browser can't blur. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    :root { --glass-bg: var(--card); --sidebar-bg: var(--surface-2); }
}
@media (prefers-reduced-transparency: reduce) {
    :root { --glass-bg: var(--card); --sidebar-bg: var(--surface-2); --glass-blur: none; }
}

/* ------------------------------------------------------------------
   App shell (0.15.0): an edge-to-edge glass sidebar with colored icons,
   as in macOS Golden Gate. Icon rail on tablets, tab bar on phones.
   ------------------------------------------------------------------ */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.content { min-width: 0; display: flex; flex-direction: column; }
.content > .page { width: 100%; }
.sidebar {
    position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 20;
    display: flex; flex-direction: column; gap: var(--space-4); padding: 16px 10px 12px;
    background: var(--sidebar-bg); border-right: 1px solid var(--border);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.35);
}
.sidebar .brand { padding: 2px 8px 6px; }
.sidebar .brand-name { font-size: 14px; }
.sidebar .brand-mark { width: 28px; height: 28px; border-radius: 7px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 5px 10px;
    border: 0; border-radius: var(--radius); background: none; cursor: pointer;
    font: inherit; font-size: 14px; font-weight: 500; color: var(--text); text-align: left; text-decoration: none;
    transition: background-color var(--ease);
}
.side-link:hover { background: var(--sidebar-sel); color: var(--text); text-decoration: none; }
.side-link[aria-current="page"] { background: var(--sidebar-sel); font-weight: 600; }
.side-link:focus-visible { outline: none; box-shadow: var(--ring); }
.side-icon { width: 22px; height: 22px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--tint, var(--sys-blue)); }
.tint-blue { --tint: var(--sys-blue); }
.tint-indigo { --tint: var(--sys-indigo); }
.tint-red { --tint: var(--sys-red); }

.tint-gray { --tint: var(--sys-gray); }
.side-count {
    margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--sys-red); color: #FFFFFF; font-size: 11px; font-weight: 700;
}
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--border); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 4px 6px 0 10px; font-size: 13px; color: var(--text-2); }
.side-user form { margin: 0 0 0 auto; }
.side-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-signout { width: 32px; height: 32px; color: var(--text-3); }
.side-signout:hover { background: var(--sidebar-sel); color: var(--text); }
.content > .demo-banner, .content > .danger-banner { position: sticky; top: 0; z-index: 15; }

/* Tablet: icon rail */
@media (max-width: 999px) and (min-width: 700px) {
    .shell { grid-template-columns: 68px minmax(0, 1fr); }
    .sidebar { padding: 14px 10px; align-items: center; }
    .sidebar .brand { padding: 0 0 6px; }
    .sidebar .brand-name, .sidebar .side-label, .side-user .avatar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .side-link { justify-content: center; width: 44px; min-height: 40px; padding: 0; position: relative; }
    .side-link .side-count { position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
    .side-user { padding: 0; justify-content: center; }
    .side-user form { margin: 0; }
}

/* Phones: tab bar at the bottom, More holds the rest */
.tabbar { display: none; }
@media (max-width: 699px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar { display: none; }
    .page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
    .tabbar {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
        display: grid; grid-template-columns: repeat(5, 1fr);
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
        background: var(--glass-bg); border-top: 1px solid var(--border);
        -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    }
    .tab {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
        min-height: 48px; padding: 2px; border-radius: var(--radius);
        font-size: 11px; font-weight: 500; color: var(--text-3); text-decoration: none; cursor: pointer; list-style: none;
    }
    .tab::-webkit-details-marker { display: none; }
    .tab .side-icon { color: var(--text-3); }
    .tab .side-icon .icon { width: 22px; height: 22px; }
    .tab[aria-current="page"], .tab[aria-current="page"] .side-icon { color: var(--accent); }
    .tab:hover { text-decoration: none; color: var(--text); }
    .tab .side-count { margin: 0; height: 16px; min-width: 16px; font-size: 10px; padding: 0 4px; }
    .tab-more[open] > .tab { color: var(--accent); }
    .more-sheet {
        position: fixed; left: 8px; right: 8px; bottom: calc(68px + env(safe-area-inset-bottom));
        display: flex; flex-direction: column; gap: 2px; padding: 8px;
        background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
    }
    .more-sheet form { margin: 0; }
    .batch-bar { bottom: calc(68px + env(safe-area-inset-bottom)); }
}

/* ------------------------------------------------------------------
   Toolbars and controls (0.15.0), after macOS Golden Gate: one corner
   radius, push buttons, segmented controls with a raised thumb, green
   switches, accent focus halos. Touch screens keep 44 px targets.
   ------------------------------------------------------------------ */
input[type="checkbox"], input[type="radio"], progress { accent-color: var(--accent); }

/* Toolbar: the title row of a page stays in view on wide screens. */
@media (min-width: 1000px) {
    .page > .page-head {
        position: sticky; top: 0; z-index: 12;
        margin-left: -24px; margin-right: -24px; padding: 14px 24px 12px;
        background: var(--glass-bg); border-bottom: 1px solid var(--border);
        -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
        box-shadow: var(--glass-edge);
    }
    .page > .crumb + .page-head { margin-top: 0; }
    .page > .page-head .muted { font-size: 13px; color: var(--text-3); }
    html { scroll-padding-top: 96px; }
}
.page-head { align-items: center; }
.page-head .actions, .page-head > .btn { flex-shrink: 0; }

/* Push buttons */
.btn {
    min-height: 32px; height: auto; padding: 0 14px; border-radius: var(--radius);
    font-size: 14px; font-weight: 500; letter-spacing: -0.005em;
}
.btn-small { min-height: 28px; padding: 0 11px; font-size: 13px; }
.btn-primary {
    height: auto; background: var(--accent); color: var(--on-accent); border-color: transparent;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-secondary {
    background: var(--card); color: var(--text); border-color: var(--border-strong);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border-hover); color: var(--text); }
.btn-danger { background: var(--card); color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger-border); }
.btn:focus-visible { box-shadow: var(--ring); }
.btn[disabled] { opacity: 0.5; cursor: default; }

/* Text fields and pop-up buttons */
.field input, .field select, .field textarea, .search input, .composer textarea, .reply-form textarea, .copy-row input, .all-links {
    min-height: 34px; height: auto; border-radius: var(--radius); border: 1px solid var(--border-strong);
    background-color: var(--card); color: var(--text); font-size: 14px; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.03);
}
.field input, .field select { height: 36px; }
.copy-row input { height: 34px; background-color: var(--surface-2); }
.search input { height: 34px; }
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus,
.composer textarea:focus, .reply-form textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: var(--ring);
}
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }

/* Segmented controls: a track with the chosen segment raised */
.segmented span {
    min-height: 32px; padding: 0 14px; border: 0; background: var(--fill-2); color: var(--text);
    font-size: 13px; font-weight: 500;
}
.segmented label:first-of-type span { border-radius: var(--radius) 0 0 var(--radius); }
.segmented label:last-of-type span { border-radius: 0 var(--radius) var(--radius) 0; border-left: 0; }
.segmented label:hover span { background: var(--fill-hover); }
.segmented input:checked + span {
    background: var(--thumb); color: var(--text); font-weight: 600; border-color: transparent;
    box-shadow: inset 0 0 0 2px var(--fill-2), 0 1px 2px rgba(0, 0, 0, 0.12);
}
.seg-links { background: var(--fill-2); border-radius: 9px; padding: 2px; }
.seg-links a { min-height: 28px; border-radius: 7px; font-size: 13px; }
.seg-links a[aria-pressed="true"], .seg-links a[aria-current="page"] { background: var(--thumb); color: var(--text); }

/* View switcher tabs on the entry page: a segmented control */
.tabs {
    display: inline-flex; gap: 2px; padding: 2px; border: 0; border-radius: 9px;
    background: var(--fill-2); max-width: 100%; overflow-x: auto;
}
.tabs a {
    min-height: 30px; padding: 0 16px; border: 0; margin: 0; border-radius: 7px;
    font-size: 13px; font-weight: 500; color: var(--text-2);
}
.tabs a:hover { color: var(--text); border-bottom-color: transparent; }
.tabs a[aria-current="page"] {
    background: var(--thumb); color: var(--text); font-weight: 600; border-bottom-color: transparent;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}

/* Filter chips (categories, feed filters) and toggles */
.pills a, .toggle {
    min-height: 30px; padding: 0 12px; border: 1px solid transparent; border-radius: 15px;
    background: var(--fill); color: var(--text); font-size: 13px; font-weight: 500;
}
.pills a:hover, .toggle:hover { background: var(--fill-hover); }
.pills a[aria-current="page"], .toggle[aria-pressed="true"] {
    background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600;
}
.pills a[aria-current="page"] .count { color: inherit; opacity: 0.85; }

/* Switches: macOS size, green when on */
.switch { width: 38px; height: 22px; border-radius: 11px; background: var(--switch-off); }
.switch::after { width: 18px; height: 18px; border-radius: 9px; top: 2px; left: 2px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.switch:checked { background: var(--sys-green); }
.switch:checked::after { transform: translateX(16px); }

/* Badges: small rounded tags */
.badge { border-radius: var(--radius-badge); padding: 1px 7px; font-size: 11.5px; font-weight: 600; letter-spacing: 0; }
.kind-tag { border-radius: var(--radius-badge); }

/* Cards, tables and lists */
.panel, .table-wrap, .cal, .card { border-radius: var(--radius-card); border-color: var(--border); }
.table th {
    text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; color: var(--text-3);
    background: var(--surface-2);
}
.table tbody tr:hover td { background: var(--surface-hover); }

.alert { border-radius: 10px; }

/* Settings source list, like the sidebar */
.subnav a { min-height: 34px; padding: 0 10px; font-size: 14px; font-weight: 500; color: var(--text); }
.subnav a:hover { background: var(--fill-hover); }
.subnav a[aria-current="page"] { background: var(--sidebar-sel); color: var(--text); font-weight: 600; box-shadow: none; }

/* Touch screens: keep 44 px targets */
@media (pointer: coarse) {
    .btn, .side-link, .seg-links a, .tabs a, .pills a, .toggle { min-height: 44px; }
    .btn-small { min-height: 36px; }
    .field input, .field select { height: 44px; }
}
@media (min-width: 1000px) {
    /* Stay clear of the sticky toolbar. */
    .side { top: 132px; }
    .bulk-stages { top: 112px; }
}
.side-signout { background: transparent; border: 0; border-radius: var(--radius); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
/* Hidden labels inside sideways-scrolling areas must stay inside them,
   or they widen the page on phones. */
.board, .table-wrap, .grid-scroll, .tabs { position: relative; }
.visually-hidden { margin: -1px; padding: 0; border: 0; }

/* Share link with its QR code (Sharing tab) */
.share-copy { display: grid; grid-template-columns: minmax(0, 1fr) 176px; gap: var(--space-5); align-items: start; }
.share-copy-main .copy-row { margin: 0; }
.share-qr { margin: 0; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.share-qr svg {
    width: 176px; height: 176px; display: block; padding: 6px; border-radius: var(--radius);
    background: var(--qr-paper); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.share-qr figcaption { text-align: center; }
@media (max-width: 600px) {
    .share-copy { grid-template-columns: minmax(0, 1fr); }
    .share-qr { order: -1; }
}
