/* =====================================================================
   JUP Buddy v3.5 — iPadOS look
   Loaded after styles.css. It re-points the design tokens to Apple's
   system colours and restyles the shared components to follow the Human
   Interface Guidelines: system font, grouped backgrounds, 44pt targets,
   filled fields, switches, segmented controls, form sheets, a sidebar on
   iPad and a tab bar on phones. Layout and behaviour are unchanged.
   ===================================================================== */

/* ---------- tokens: light (default) ---------- */
:root, body.theme-light {
    color-scheme: light;
    --acc: #047857; --acc-rgb: 4,120,87; --acc-strong: #065f46; --acc-ink: #ffffff;
    --tint-text: #047857;
    --ore: #ff9500; --ore-rgb: 255,149,0;
    --vein: #007aff; --vein-rgb: 0,122,255;
    --safe: #248a3d; --safe-rgb: 52,199,89;
    --hazard: #d70015; --hazard-rgb: 255,59,48;
    --caution: #c93400; --caution-rgb: 255,149,0;
    --good: #34c759; --red: #ff3b30;

    --bg: #f2f2f7; --bg-image: none;
    --card-bg: #ffffff; --card-border: transparent;
    --inner-bg: #f2f2f7; --inner-border: rgba(60,60,67,0.13);
    --input-bg: rgba(118,118,128,0.12); --input-border: transparent;
    --fill: rgba(118,118,128,0.12); --fill-2: rgba(118,118,128,0.20);
    --sidebar-bg: #f2f2f7; --sidebar-border: rgba(60,60,67,0.18);
    --material: rgba(249,249,251,0.80);
    --hover: rgba(118,118,128,0.10);
    --line: rgba(60,60,67,0.18);
    --text: #1c1c1e; --text-strong: #000000; --text-2: #6c6c70; --text-3: #7c7c80;
    --blur: none;
    --shadow: 0 10px 40px rgba(0,0,0,0.16);
    --sidebar-w: 268px; --sidebar-w-collapsed: 76px;
    --radius: 12px;
    --ease-sheet: cubic-bezier(.32,.72,0,1);
}
/* ---------- tokens: dark ---------- */
body.theme-dark {
    color-scheme: dark;
    --acc: #30c48d; --acc-rgb: 48,196,141; --acc-strong: #26a878; --acc-ink: #00170e;
    --tint-text: #3ddc9f;
    --ore: #ff9f0a; --ore-rgb: 255,159,10;
    --vein: #0a84ff; --vein-rgb: 10,132,255;
    --safe: #30d158; --safe-rgb: 48,209,88;
    --hazard: #ff453a; --hazard-rgb: 255,69,58;
    --caution: #ff9f0a; --caution-rgb: 255,159,10;
    --good: #30d158; --red: #ff453a;

    --bg: #000000; --bg-image: none;
    --card-bg: #1c1c1e; --card-border: transparent;
    --inner-bg: #2c2c2e; --inner-border: rgba(84,84,88,0.45);
    --input-bg: rgba(118,118,128,0.24); --input-border: transparent;
    --fill: rgba(118,118,128,0.24); --fill-2: rgba(118,118,128,0.32);
    --sidebar-bg: #1c1c1e; --sidebar-border: rgba(84,84,88,0.6);
    --material: rgba(30,30,32,0.78);
    --hover: rgba(118,118,128,0.18);
    --line: rgba(84,84,88,0.55);
    --text: #f2f2f7; --text-strong: #ffffff; --text-2: #a1a1a8; --text-3: #8e8e93;
    --shadow: 0 10px 40px rgba(0,0,0,0.6);
}

/* ---------- base ---------- */
html { -webkit-tap-highlight-color: transparent; }
body {
    background: var(--bg); background-image: none;
    font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, "Segoe UI", Roboto, sans-serif;
    letter-spacing: -0.01em; text-rendering: optimizeLegibility;
}
h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; }
h2, .h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 17px; font-weight: 600; }
a, .acc { color: var(--tint-text); }
.big { font-weight: 700; }
code { background: var(--fill); border: none; border-radius: 6px; }
.muted { color: var(--text-2); }
.small { font-size: 14px; } .xsmall { font-size: 12px; }
.mono { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace; }
button, .btn, .side-item, .bn-item, .tab, .list-row, .mini-row { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
:focus-visible { outline: 3px solid rgba(var(--acc-rgb),0.45); outline-offset: 2px; }
::selection { background: rgba(var(--acc-rgb),0.25); }
* { scrollbar-width: thin; scrollbar-color: var(--fill-2) transparent; }

/* ---------- iPad sidebar ---------- */
#sidebar {
    background: var(--sidebar-bg); border-right: 0.5px solid var(--sidebar-border);
    padding: calc(18px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
    gap: 2px; backdrop-filter: none; -webkit-backdrop-filter: none;
}
.side-brand { padding: 0 6px 4px; }
.side-logo { width: 38px; height: 38px; border-radius: 9px; box-shadow: none; }
.brand-name { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.brand-name .acc { color: var(--tint-text); }
.brand-sub { text-transform: none; letter-spacing: 0; font-size: 11px; }
.ver { background: var(--fill); border-radius: 6px; }
.side-site { font-size: 13px; padding: 2px 8px 14px; color: var(--text-2); }
.side-item {
    min-height: 44px; padding: 10px 12px; border-radius: 10px; border: none;
    color: var(--text-strong); font-size: 17px; font-weight: 400; gap: 14px;
    transition: background .12s;
}
.side-icon { width: 24px; }
.side-icon .ic { width: 22px; height: 22px; color: var(--tint-text); }
.side-item:hover { background: var(--hover); color: var(--text-strong); }
.side-item:active { background: var(--fill-2); }
.side-item.active { background: var(--acc); color: var(--acc-ink); border: none; font-weight: 600; }
.side-item.active .side-icon .ic { color: var(--acc-ink); }
.side-logout .side-icon .ic { color: var(--hazard); }
.side-logout:hover { color: var(--hazard); }
.side-divider { background: var(--sidebar-border); height: 0.5px; margin: 10px 6px; }
.side-user-name { font-size: 15px; font-weight: 600; }
.side-user-role { font-size: 13px; color: var(--text-2); }
.nav-badge { background: var(--red); color: #fff; font-weight: 600; }
.side-item.active .nav-badge { background: #fff; color: var(--acc); }
.dot-new { background: var(--red); }

/* ---------- content area ---------- */
#view { max-width: none; padding: calc(30px + env(safe-area-inset-top)) 32px calc(60px + env(safe-area-inset-bottom)); gap: 20px; }
.page-head { align-items: flex-end; padding: 0 4px; }
.page-head .muted { font-size: 15px; margin-top: 4px; }

/* ---------- avatar ---------- */
.avatar { background: linear-gradient(180deg, #a1a1a6, #858589); color: #fff; border: none; font-weight: 600; }

/* ---------- inset grouped sections ---------- */
.card { border: none; border-radius: var(--radius); padding: 16px 18px; box-shadow: none;
    backdrop-filter: none; -webkit-backdrop-filter: none; }
.card-title { font-size: 17px; font-weight: 600; margin-bottom: 12px; }
.card-title .ic { color: var(--tint-text); }

/* ---------- buttons ---------- */
.btn { min-height: 44px; padding: 10px 18px; border-radius: 12px; border: none; font-size: 16px; font-weight: 600;
    transition: opacity .12s, background .12s; letter-spacing: -0.01em; }
.btn:active { transform: none; opacity: .55; }
.btn:disabled { opacity: .35; }
.btn-acc, body[class] .btn-acc { background: var(--acc); color: var(--acc-ink); }
.btn-acc:hover:not(:disabled) { background: var(--acc-strong); }
.btn-ghost { background: var(--fill); color: var(--tint-text); border: none; }
.btn-ghost:hover { background: var(--fill-2); color: var(--tint-text); }
.btn-soft, body[class] .btn-soft { background: rgba(var(--acc-rgb),0.14); color: var(--tint-text); border: none; }
.btn-soft:hover { background: rgba(var(--acc-rgb),0.22); }
.btn-danger, body[class] .btn-danger { background: rgba(var(--hazard-rgb),0.13); color: var(--hazard); border: none; }
.btn-danger:hover { background: rgba(var(--hazard-rgb),0.2); }
.btn-warn, body[class] .btn-warn { background: rgba(var(--caution-rgb),0.16); color: var(--caution); border: none; }
.btn-lg { min-height: 52px; border-radius: 14px; font-size: 17px; }
.btn-sm { min-height: 36px; padding: 7px 13px; font-size: 15px; border-radius: 10px; }
.btn-xs { min-height: 34px; min-width: 34px; padding: 5px 8px; border-radius: 9px; }
.btn-xs svg { width: 17px; height: 17px; }
.link-btn { color: var(--tint-text); font-weight: 400; min-height: 32px; }
.link-btn:hover { text-decoration: none; opacity: .7; }
.chip-btn { background: var(--fill); border: none; color: var(--text-strong); border-radius: 18px; padding: 7px 14px; font-size: 15px; font-weight: 500; min-height: 34px; }
.chip-btn:hover { background: var(--fill-2); color: var(--text-strong); }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; color: var(--tint-text); }
.icon-btn:hover { background: var(--hover); color: var(--tint-text); }

/* ---------- badges: tinted capsules, sentence case ---------- */
.badge { border: none; border-radius: 7px; padding: 3px 8px; font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; }
.badge-good, body[class] .badge-good { background: rgba(var(--safe-rgb),0.16); color: var(--safe); }
.badge-warn, body[class] .badge-warn, .badge-day, body[class] .badge-day { background: rgba(var(--caution-rgb),0.16); color: var(--caution); }
.badge-danger, body[class] .badge-danger { background: rgba(var(--hazard-rgb),0.14); color: var(--hazard); }
.badge-info, body[class] .badge-info, .badge-night, body[class] .badge-night { background: rgba(var(--vein-rgb),0.14); color: var(--vein); }
.badge-acc { background: rgba(var(--acc-rgb),0.15); color: var(--tint-text); }
.badge-muted { background: var(--fill); color: var(--text-2); }

/* ---------- sync pill ---------- */
.db-pill { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 500; }

/* ---------- fields: filled, borderless, 17pt (stops iOS zooming on focus) ---------- */
.lbl { font-size: 13px; font-weight: 400; text-transform: uppercase; letter-spacing: 0; color: var(--text-2); margin: 0 0 6px 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=datetime-local], select, textarea {
    background: var(--input-bg); border: none; border-radius: 10px; color: var(--text-strong);
    font-size: 17px; min-height: 44px; padding: 10px 13px;
}
input:focus, select:focus, textarea:focus { border: none; box-shadow: 0 0 0 3px rgba(var(--acc-rgb),0.35); }
select { -webkit-appearance: none; appearance: none; padding-right: 34px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='16' viewBox='0 0 12 16' fill='none' stroke='%238e8e93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 6L6 2.5 9.5 6M2.5 10L6 13.5 9.5 10'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; background-size: 11px 15px; }
select option { background: var(--card-bg); }
.pin-input { font-size: 24px !important; }
.form-err { color: var(--hazard); font-weight: 500; }
.secnum-field { border: none; border-radius: 10px; background: var(--input-bg); }
.secnum-field:focus-within { box-shadow: 0 0 0 3px rgba(var(--acc-rgb),0.35); }
.secnum-prefix { background: rgba(var(--acc-rgb),0.14); color: var(--tint-text); border-right: none; }
.search-box .ic { left: 11px; color: var(--text-2); }
.search-box input { padding-left: 36px; border-radius: 10px; }

/* Checkboxes: an iOS switch where a tick turns something on (lists of options),
   a round check everywhere else, where a 51pt switch would break a tight row. */
input[type=checkbox] {
    -webkit-appearance: none; appearance: none; margin: 0; flex-shrink: 0; cursor: pointer; position: relative;
    width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--text-3); background: transparent;
    transition: background .15s, border-color .15s;
}
input[type=checkbox]:checked { background: var(--acc); border-color: var(--acc); }
input[type=checkbox]:checked::after { content: ''; position: absolute; left: 6.5px; top: 3px; width: 5px; height: 10px;
    border: solid var(--acc-ink); border-width: 0 2.2px 2.2px 0; transform: rotate(45deg); }
input[type=checkbox]:disabled { opacity: .4; cursor: not-allowed; }
.check-row input[type=checkbox], .data-input.bool input[type=checkbox], .switch {
    width: 51px; height: 31px; border-radius: 16px; border: none; background: var(--fill-2);
}
.check-row input[type=checkbox]::after, .data-input.bool input[type=checkbox]::after {
    content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; border: none;
    background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,0.15), 0 1px 1px rgba(0,0,0,0.16); transform: none;
    transition: transform .22s var(--ease-sheet);
}
.check-row input[type=checkbox]:checked, .data-input.bool input[type=checkbox]:checked { background: #34c759; }
.check-row input[type=checkbox]:checked::after, .data-input.bool input[type=checkbox]:checked::after {
    left: 2px; top: 2px; width: 27px; height: 27px; border: none; transform: translateX(20px);
}
input[type=radio] { accent-color: var(--acc); width: 20px; height: 20px; }

/* option rows read as one grouped table: label left, switch right */
.check-row { flex-direction: row-reverse; justify-content: space-between; min-height: 48px; padding: 8px 14px;
    border: none; border-radius: 0; background: var(--card-bg); }
.check-row:hover { border: none; background: var(--card-bg); }
.check-list, .check-grid { gap: 0; border-radius: 10px; overflow-y: auto; background: var(--card-bg); }
.check-list > .check-row + .check-row, .check-grid > .check-row { box-shadow: inset 0 0.5px 0 var(--line); }
.modal .check-list, .modal .check-grid, .card .check-list, .card .check-grid { background: var(--inner-bg); }
.modal .check-row, .card .check-row { background: var(--inner-bg); }
.check-row.plain { background: none; padding: 6px 0; flex-direction: row; justify-content: flex-start; min-height: 0; }

/* ---------- segmented control (Settings tabs and similar) ---------- */
.tabs { display: inline-flex; gap: 2px; padding: 2px; border-radius: 10px; background: var(--fill); max-width: 100%; align-self: flex-start; overflow-x: auto; flex-shrink: 0; }
.tab { flex-shrink: 0; }
.tab { min-height: 34px; padding: 6px 14px; border-radius: 8px; border: none; color: var(--text-strong); font-size: 14px; font-weight: 500; }
.tab:hover { background: transparent; color: var(--text-strong); }
.tab .ic { width: 16px; height: 16px; color: var(--text-2); }
.tab.active { background: var(--card-bg); color: var(--text-strong); border: none; font-weight: 600;
    box-shadow: 0 3px 8px rgba(0,0,0,0.12), 0 3px 1px rgba(0,0,0,0.04); }
body.theme-dark .tab.active { background: #636366; }
.tab.active .ic { color: var(--tint-text); }
body.theme-dark .tab.active .ic { color: #fff; }
.tab-count { background: var(--red); }
.res-tab.on { color: var(--tint-text); border-bottom-color: var(--acc); }

/* ---------- grouped list rows ---------- */
.list-toolbar { border-bottom: 0.5px solid var(--line); padding: 12px 16px; }
.list-row { min-height: 52px; padding: 10px 16px; border-bottom: 0.5px solid var(--line); }
.list-row:last-child { border-bottom: none; }
.list-row:hover:not(.static) { background: var(--hover); }
.list-row:active:not(.static) { background: var(--fill-2); }
.list-row > .ic:last-child { color: var(--text-3); width: 16px; height: 16px; }
.list-group-title { font-size: 13px; font-weight: 400; text-transform: uppercase; letter-spacing: 0; color: var(--text-2); padding: 18px 16px 6px; }
.tile-ic { border-radius: 9px; background: var(--acc); color: var(--acc-ink); }
.tile-ic.sm { border-radius: 7px; }
.log-row { min-height: 56px; border-bottom: 0.5px solid var(--line); }
.log-row:hover:not(.log-head) { background: var(--hover); }
.log-head { font-size: 13px; font-weight: 400; text-transform: uppercase; letter-spacing: 0; color: var(--text-2); }
.kv { border-bottom: 0.5px solid var(--line); padding: 11px 0; font-size: 16px; }
.kv > b { font-weight: 500; color: var(--text-2); }
.data-row { border-bottom: 0.5px solid var(--line); min-height: 52px; }
.data-name { font-weight: 400; font-size: 16px; }
.data-input input { font-weight: 500; }
.data-group-title, .mini-title { font-size: 13px; font-weight: 400; text-transform: uppercase; letter-spacing: 0; color: var(--text-2); }
.info-grid { border: none; border-radius: 12px; }
.info-grid span { font-size: 12px; font-weight: 400; text-transform: uppercase; letter-spacing: 0; color: var(--text-2); }
.picker-btn { border: none; background: var(--input-bg); border-radius: 10px; min-height: 44px; font-weight: 500; }
.picker-btn .ic { color: var(--text-2); }

/* ---------- tiles, stats, rows inside a section ---------- */
.mini-row, .stat, .plod-tile, .setup-opt, .summary-head, .sched-edit, .blast-ask, .notes-text, .data-chip, .person-chip, .signoff, .res {
    border: none;
}
.mini-row { min-height: 52px; border-radius: 10px; }
.mini-row:hover:not(.static) { border: none; background: var(--hover); }
.stat { border-radius: 12px; }
.stat-num { font-weight: 700; letter-spacing: -0.02em; }
.stat-lbl { font-size: 13px; }
.stat-btn:hover { border: none; background: var(--hover); }
.plod-tile { border-radius: 14px; font-weight: 600; font-size: 16px; }
.plod-tile .ic { color: var(--tint-text); }
.plod-tile:hover { border: none; background: var(--hover); }
.plod-tile.active { background: var(--acc); color: var(--acc-ink); box-shadow: none; }
.plod-tile.active .ic { color: var(--acc-ink); }
.data-chip { border-left: 3px solid var(--text-3); border-radius: 8px; }
.shift-chip { border: none; border-radius: 12px; }
.tracker.running { box-shadow: 0 0 0 2px rgba(var(--acc-rgb),0.6); border: none; }
.trk-clock { font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.trk-plod { font-weight: 700; }
.trk-grid { border-top: 0.5px solid var(--line); }
.live-tag { letter-spacing: .04em; font-weight: 600; }
.ghost-empty { border: 1.5px dashed var(--line); border-radius: 12px; color: var(--text-2); min-height: 48px; }
.ghost-empty:hover { color: var(--tint-text); border-color: var(--acc); }
.seg-opt, .blast-opt { border: 2px solid transparent; background: var(--input-bg); border-radius: 12px; }
.seg-opt:has(input:checked) { border-color: var(--acc); background: rgba(var(--acc-rgb),0.10); }
.theme-opt { border: 2px solid transparent; background: var(--input-bg); border-radius: 12px; color: var(--text-strong); font-weight: 500; min-height: 48px; }
.theme-opt.active { border-color: var(--acc); background: rgba(var(--acc-rgb),0.10); color: var(--text-strong); }
.sw-auto { background: linear-gradient(135deg, #ffffff 50%, #1c1c1e 50%); }
.sw-light { background: #ffffff; }
.sw-dark { background: #1c1c1e; }

/* ---------- notes and alerts: tinted, borderless ---------- */
.note { border: none; border-radius: 12px; font-size: 15px; padding: 12px 14px; }
.alert-bar { border: none; border-radius: 12px; border-left: none; min-height: 52px; }
.alert-danger { background: rgba(var(--hazard-rgb),0.12); }
.alert-warn { background: rgba(var(--caution-rgb),0.13); }
.alert-info { background: rgba(var(--acc-rgb),0.10); }
.declaration { border-left: none; border-radius: 12px; }
.empty-title { font-size: 17px; font-weight: 600; }
.empty-text { font-size: 15px; }
.empty .ic-lg { color: var(--text-3); }

/* ---------- planner and capture boards ---------- */
.board-card { padding: 0; }
.board-bar { border-bottom: 0.5px solid var(--line); }
.board-side, .imp-row.imp-head, .cap-head, .edge-mark, .res { background: var(--card-bg); }
.board-row, .board-side, .board-day, .board-shift, .slot, .sb-hour, .alane + .alane, .board-foot, .aboard-legend, .res-panel, .res-head, .res-tabs, .res-foot {
    border-color: var(--line);
}
.cyc, .tsk { border-radius: 8px; }
.cyc.dragging, .tsk.dragging { box-shadow: 0 12px 30px rgba(0,0,0,0.25); }
.now-line, .now-line::before { background: var(--red); }
.cap-row { border-bottom: 0.5px solid var(--line); grid-template-columns: 304px 1fr; }
.cap-board { min-width: 1020px; }
.cap-side { border-right: 0.5px solid var(--line); padding: 10px 12px; gap: 5px; }
.cap-title b { font-weight: 600; }
.cap-op { min-height: 34px; font-size: 15px; padding: 4px 30px 4px 10px; border-radius: 8px; }
.cap-ctl { flex-wrap: wrap; row-gap: 6px; }
.cap-op { min-width: 130px; }
.cap-btns { gap: 6px; }
.cap-btns .btn-xs { min-width: 40px; min-height: 40px; border-radius: 20px; }
.cap-hour { border-left: 0.5px solid var(--line); font-size: 12px; color: var(--text-2); }
.cap-cell.hr { border-left-color: var(--line); }
.cap-lane { min-height: 68px; }
.cap-plan { background: rgba(var(--acc-rgb),0.22); border: 1px solid rgba(var(--acc-rgb),0.55); }
.cap-work { background: var(--good); opacity: 1; border-radius: 7px; }
.cap-work.running { background: var(--acc); }
.cap-work.draft { background: repeating-linear-gradient(135deg, var(--good) 0 8px, rgba(var(--safe-rgb),0.5) 8px 16px); }
.cap-sel { border-radius: 7px; background: rgba(var(--vein-rgb),0.14); border: 2px dashed var(--vein); color: var(--vein); }

/* ---------- form sheets ---------- */
.modal-overlay { background: rgba(0,0,0,0.38); backdrop-filter: none; -webkit-backdrop-filter: none; animation: fadeIn .25s ease; }
.modal { border: none; border-radius: 14px; background: var(--card-bg); box-shadow: 0 20px 70px rgba(0,0,0,0.3);
    backdrop-filter: none; -webkit-backdrop-filter: none; animation: sheetUp .38s var(--ease-sheet); }
body[class] .modal { background: var(--card-bg); }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-sm { max-width: 520px; } .modal-md { max-width: min(920px, 92vw); } .modal-lg { max-width: min(1240px, 94vw); }
/* v4.1: the sheets use the screen. A wide sheet lays its checklists out in more columns
   rather than stretching each tick across it. */
.modal { max-height: calc(100vh - 40px); }
.modal-lg .check-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.modal-head { position: relative; justify-content: center; min-height: 56px; padding: 12px 56px; border-bottom: 0.5px solid var(--line); }
.modal-head h3 { font-size: 17px; font-weight: 600; justify-content: center; text-align: center; }
.modal-head h3 .ic { color: var(--tint-text); }
.modal-head .icon-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; background: none; color: var(--text-2); }
.modal-head .icon-btn::before { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: var(--fill); z-index: -1; }
.modal-head .icon-btn { isolation: isolate; }
.modal-head .icon-btn .ic { width: 14px; height: 14px; stroke-width: 3; }
.modal-body { padding: 18px 20px; }
.modal-foot { border-top: 0.5px solid var(--line); padding: 12px 16px; gap: 10px; }
.modal-foot .btn { min-width: 100px; }

/* ---------- toast: a floating material banner ---------- */
.toast { border: none; border-radius: 16px; background: var(--material) !important; color: var(--text-strong);
    backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2); font-weight: 500; font-size: 15px; padding: 14px 16px; }
.toast-error > .ic { color: var(--hazard) !important; } .toast-success > .ic { color: var(--safe) !important; }
.toast-warning > .ic { color: var(--caution) !important; } .toast-info > .ic { color: var(--vein) !important; }

/* ---------- sign-in ---------- */
.auth-logo { border-radius: 16px; box-shadow: 0 6px 20px rgba(0,0,0,0.18); }
.auth-brand h1 { font-size: 34px; }
.auth-card { border-radius: 16px; box-shadow: none; padding: 24px; }
.setup-opt { border-radius: 12px; min-height: 64px; }
.setup-opt:hover { border: none; background: var(--hover); }
.setup-opt > .ic { color: var(--tint-text); }

/* ---------- what's new ---------- */
.wn-release li { font-size: 15px; }

/* ======================= phones and narrow iPad windows ======================= */
@media (max-width: 860px) {
    #topbar { background: var(--material); border-bottom: 0.5px solid var(--line);
        backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
        min-height: calc(50px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0 12px; }
    body[class] #topbar, body[class] #bottom-nav { background: var(--material); }
    .topbar-title { font-size: 17px; font-weight: 600; }
    .topbar-logo { width: 28px; height: 28px; border-radius: 7px; }
    #bottom-nav { background: var(--material); border-top: 0.5px solid var(--line);
        backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
        padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
    .bn-item { min-height: 49px; gap: 2px; padding: 5px 2px; color: var(--text-3); font-size: 10.5px; font-weight: 500; border-radius: 0; }
    .bn-item .ic { width: 26px; height: 26px; }
    .bn-item.active { color: var(--tint-text); background: none; }
    .bn-item .nav-badge { background: var(--red); color: #fff; }
    #view { padding: 18px 16px calc(100px + env(safe-area-inset-bottom)); }
    h1 { font-size: 30px; }
    .card { padding: 14px 16px; }
    .modal { border-radius: 14px 14px 0 0; animation: sheetUp .38s var(--ease-sheet); }
    .modal-head::before { content: ''; position: absolute; top: 6px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--fill-2); }
    .tabs { display: flex; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
    body { background: #fff; }
}

/* ======================= capture views (v3.6) ======================= */
.cap-views { margin-bottom: -4px; }
.tabs-sm .tab { min-height: 30px; padding: 4px 14px; font-size: 13px; }
.chip-btn.on { background: var(--acc); color: var(--acc-ink); }
.chip-btn.on .muted { color: inherit; opacity: .75; }
.st-dot, .kb-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.kb-planned { background: var(--text-3); } .kb-progress { background: var(--good); }
.kb-paused { background: var(--ore); } .kb-done { background: var(--acc); }

/* list */
.cap-list-bar { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 0.5px solid var(--line); }
.cap-list { overflow-x: auto; }
.cap-li { display: grid; grid-template-columns: minmax(170px, 2fr) minmax(100px, 1.1fr) 136px 150px 112px 140px; gap: 10px; align-items: center;
    min-height: 60px; padding: 8px 16px; border-bottom: 0.5px solid var(--line); min-width: 860px; font-size: 15px; }
.cap-li > span { min-width: 0; }
.cap-li .nowrap-t { white-space: nowrap; font-size: 14px; }
.cap-li:last-child { border-bottom: none; }
.cap-li-head { min-height: 36px; font-size: 13px; text-transform: uppercase; color: var(--text-2); }
.cap-li:not(.cap-li-head) { cursor: pointer; }
.cap-li:not(.cap-li-head):hover { background: var(--hover); }
.cap-li-acts { display: flex; gap: 6px; justify-content: flex-end; }
.cap-li-acts .btn { min-width: 40px; min-height: 40px; padding: 6px; border-radius: 20px; }
.cap-li.st-running { background: rgba(var(--safe-rgb),0.06); } .cap-li.st-paused { background: rgba(var(--ore-rgb),0.07); }
.cap-li-none { padding: 18px 16px; }

/* calendar: day */
.cal-untimed { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 16px; border-bottom: 0.5px solid var(--line); }
.cal-day-scroll { max-height: 70vh; overflow-y: auto; }
.cal-day { position: relative; margin: 10px 16px 14px 0; }
.cal-hour { position: absolute; left: 0; right: 0; border-top: 0.5px solid var(--line); }
.cal-hour span { position: absolute; left: 0; width: 62px; top: -8px; text-align: right; padding-right: 10px; font-size: 12px; color: var(--text-2); background: var(--card-bg); }
.cal-lane { position: absolute; left: 68px; right: 0; top: 0; bottom: 0; }
.cal-ev { position: absolute; overflow: hidden; text-align: left; display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; border: none; border-left: 4px solid var(--text-3); border-radius: 6px; padding: 4px 8px;
    background: var(--fill); color: var(--text-strong); font: inherit; font-size: 13px; line-height: 1.3; cursor: pointer; }
.cal-ev:active { opacity: .6; }
.cal-ev b { font-weight: 600; }
.cal-ev span { color: var(--text-2); font-size: 12px; }
.cal-ev.plan { opacity: .75; border-left-style: dashed; }
.cal-ev.st-running { background: rgba(var(--safe-rgb),0.2); border-left-color: var(--good); }
.cal-ev.st-paused { background: rgba(var(--ore-rgb),0.2); border-left-color: var(--ore); }
.cal-ev.st-draft { background: rgba(var(--vein-rgb),0.15); border-left-color: var(--vein); }
.cal-ev.st-done { background: rgba(var(--acc-rgb),0.16); border-left-color: var(--acc); }
.cal-ev-when { margin-top: 2px; }
.cal-now { position: absolute; left: -6px; right: 0; height: 2px; background: var(--red); z-index: 3; pointer-events: none; }
.cal-now::before { content: ''; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.cal-now span { position: absolute; left: -64px; top: -9px; font-size: 11px; font-weight: 600; color: var(--red); background: var(--card-bg); padding: 0 4px; }
.cal-chip { border: none; border-left: 3px solid var(--text-3); border-radius: 6px; background: var(--fill); color: var(--text-strong); font: inherit;
    font-size: 12.5px; padding: 5px 8px; text-align: left; cursor: pointer; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 30px; }
.cal-chip.st-running { border-left-color: var(--good); } .cal-chip.st-paused { border-left-color: var(--ore); }
.cal-chip.st-draft { border-left-color: var(--vein); } .cal-chip.st-done { border-left-color: var(--acc); }

/* calendar: week */
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(112px, 1fr)); min-width: 790px; }
.cal-wday { border-right: 0.5px solid var(--line); display: flex; flex-direction: column; }
.cal-wday:last-child { border-right: none; }
.cal-wdate { padding: 10px 10px 6px; font-size: 13px; font-weight: 600; color: var(--text-2); border-bottom: 0.5px solid var(--line); }
.cal-wday.today .cal-wdate { color: var(--red); }
.cal-wcell { display: flex; flex-direction: column; gap: 4px; padding: 8px; min-height: 150px; border-bottom: 0.5px solid var(--line); }
.cal-wcell.now { background: rgba(var(--acc-rgb),0.06); }
.cal-wcell.sel { box-shadow: inset 0 0 0 2px rgba(var(--acc-rgb),0.5); }
.cal-wshift { display: flex; align-items: center; justify-content: space-between; border: none; background: none; padding: 2px 0 4px; cursor: pointer; font: inherit; min-height: 30px; }

/* kanban */
.kb-board { display: grid; grid-template-columns: repeat(4, minmax(186px, 1fr)); gap: 12px; padding: 14px; overflow-x: auto; }
.kb-col { background: var(--inner-bg); border-radius: 12px; display: flex; flex-direction: column; min-height: 360px; transition: box-shadow .15s, background .15s; }
.kb-col.kb-over { box-shadow: inset 0 0 0 2px var(--acc); background: rgba(var(--acc-rgb),0.08); }
.kb-col-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; font-size: 15px; }
.kb-col-body { display: flex; flex-direction: column; gap: 8px; padding: 4px 10px 12px; flex: 1; }
.kb-empty { border: 1.5px dashed var(--line); border-radius: 10px; padding: 18px; text-align: center; }
.kb-card { background: var(--card-bg); border-radius: 10px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(0,0,0,0.08); cursor: grab;
    transition: box-shadow .12s;
    border-left: 4px solid var(--text-3); touch-action: pan-x pan-y; -webkit-user-select: none; user-select: none; }
.kb-card.st-running { border-left-color: var(--good); } .kb-card.st-paused { border-left-color: var(--ore); }
.kb-card.st-draft { border-left-color: var(--vein); } .kb-card.st-done { border-left-color: var(--acc); cursor: pointer; }
.kb-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.kb-card-top { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.kb-card-top b { font-weight: 600; }
.kb-sub { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.kb-sub .ic { width: 13px; height: 13px; }
.kb-sub > span:not(.sep) { white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.kb-sub .sep { display: none; }
.kb-when { margin-top: 6px; }
.kb-acts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.kb-acts .btn { min-width: 40px; min-height: 40px; padding: 6px; border-radius: 20px; }
.kb-lifted { opacity: .35; }
.kb-ghost { position: fixed; left: 0; top: 0; z-index: 9999; pointer-events: none; box-shadow: 0 16px 40px rgba(0,0,0,0.28); opacity: .96; }
body.kb-dragging, body.kb-dragging * { cursor: grabbing !important; }

/* form */
.cap-form { padding: 18px; }
.cap-form-card { background: var(--inner-bg); border-radius: 12px; padding: 14px; }
.cap-form-card .summary-head { background: var(--card-bg); }
.cap-form-acts { display: flex; gap: 10px; flex-wrap: wrap; }
.cap-sheet-acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* by operator / by heading */
.cap-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; padding: 14px; }
.cap-group { background: var(--inner-bg); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.cap-group-head { display: flex; align-items: center; gap: 10px; padding: 4px 4px 2px; font-size: 16px; }
.cap-group .kb-card { cursor: pointer; }

/* ---------- v4.1: Settings groups and filters ---------- */
.sub-tabs { margin-bottom: -6px; }
.tab-n { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; margin-left: 4px; }
.tab.active .tab-n { color: inherit; opacity: .75; }
.list-note { padding: 0 16px 10px; }
.set-filters { border-top: 0.5px solid var(--line); flex-wrap: wrap; }
.set-filters select { width: auto; min-width: 180px; flex: 0 1 auto; }
.set-group { border-top: 0.5px solid var(--line); }
.set-group-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; cursor: pointer; list-style: none; font-size: 16px; min-height: 48px; }
.set-group-head::-webkit-details-marker { display: none; }
.set-group-head > .ic:first-child { width: 14px; height: 14px; color: var(--text-2); transition: transform .2s; flex-shrink: 0; }
.set-group[open] > .set-group-head > .ic:first-child { transform: rotate(90deg); }
.set-group-head:hover { background: var(--fill); }
.set-group-body > .list-row { padding-left: 40px; }
.modal .set-group:first-of-type { border-top: none; }
@media (max-width: 860px) {
    .modal-sm, .modal-md, .modal-lg { max-width: 100%; }
    .modal { max-height: 92vh; }
    .set-filters select { flex: 1 1 140px; min-width: 0; }
}
.secnum-prefix:empty { display: none; }
input.input-lg { font-size: 24px !important; letter-spacing: .15em; font-weight: 700; min-height: 56px; }

/* ---------- v4.2: type-to-search picker ---------- */
.picker { position: fixed; z-index: 2000; display: flex; flex-direction: column; background: var(--card-bg, #fff);
    border: 0.5px solid var(--line); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.22); overflow: hidden; }
.picker-search { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 0.5px solid var(--line); }
.picker-search .ic { width: 18px; height: 18px; color: var(--text-2); flex-shrink: 0; }
.picker-search input { border: 0 !important; box-shadow: none !important; background: transparent !important; padding: 4px 0 !important; min-height: 0 !important; font-size: 17px; width: 100%; outline: none; }
.picker-list { overflow-y: auto; overscroll-behavior: contain; padding: 4px 0; -webkit-overflow-scrolling: touch; }
.picker-opt { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 14px; font-size: 16px; cursor: pointer; min-height: 44px; }
.picker-opt .ic { width: 16px; height: 16px; color: var(--acc); flex-shrink: 0; }
.picker-opt.hi { background: var(--fill); }
.picker-opt.sel { font-weight: 600; }
.picker-opt.dis { opacity: .4; cursor: default; }
.picker-group { padding: 10px 14px 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.picker-none { padding: 16px 14px; color: var(--text-2); }
.picker-sheet { left: 0 !important; right: 0; bottom: 0 !important; top: auto !important; width: auto !important; max-height: 72vh !important;
    border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
.tick-search { margin-bottom: 8px; max-width: 420px; }
.check-grid[data-none="1"]::after { content: 'Nothing matches'; color: var(--text-2); font-size: 14px; padding: 6px 2px; }

/* ---------- v4.3: board heading rows ---------- */
.board-addrow { display: grid; grid-template-columns: var(--side-w) 1fr; border-top: 0.5px solid var(--line); }
.board-addrow .board-side { padding: 8px 10px; }
.board-side .icon-btn.xs { width: 26px; height: 26px; min-width: 26px; padding: 0; opacity: .6; }
.board-side .icon-btn.xs:hover { opacity: 1; }

/* ---------- v4.3: colours for plod types (--pc) and cycles (--cc) ---------- */
.cyc[style*="--cc"] { background: color-mix(in srgb, var(--cc) 20%, var(--card-bg)); border-color: color-mix(in srgb, var(--cc) 65%, transparent); border-left: 4px solid var(--cc); }
.cyc[style*="--cc"]:hover { background: color-mix(in srgb, var(--cc) 30%, var(--card-bg)); }
.tsk[style*="--cc"] { background: color-mix(in srgb, var(--cc) 16%, var(--card-bg)); border-color: color-mix(in srgb, var(--cc) 55%, transparent); border-left: 4px solid var(--pc, var(--cc)); }
.tsk[style*="--cc"]:hover { background: color-mix(in srgb, var(--cc) 26%, var(--card-bg)); }
.cyc.ghost[style*="--cc"], .tsk.ghost[style*="--cc"] { background: transparent; }
.cap-row[style*="--pc"] > .cap-side { box-shadow: inset 4px 0 0 var(--pc); }
.cap-li[style*="--pc"]:not(.cap-li-head) { box-shadow: inset 4px 0 0 var(--pc); }
.cal-ev[style*="--pc"] { border-left: 4px solid var(--pc) !important; }
.kb-card[style*="--pc"] { border-left: 4px solid var(--pc); }
.pdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--pc); margin-right: 7px; vertical-align: 1px; flex-shrink: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.swatch { width: 32px; height: 32px; border-radius: 50%; background: var(--sw); border: 2px solid transparent; box-shadow: inset 0 0 0 2px var(--card-bg); padding: 0; display: grid; place-items: center; }
.swatch.on { border-color: var(--sw); box-shadow: inset 0 0 0 3px var(--card-bg); }
.swatch.inherit { background: var(--fill); color: var(--sw); border: 2px dashed var(--sw); }
.swatch.inherit.on { border-style: solid; }
.swatch.inherit .ic { width: 16px; height: 16px; }

/* ---------- v4.4: task menu, waits, chained drag ---------- */
.task-menu { position: fixed; z-index: 1500; background: var(--card-bg); border: 0.5px solid var(--line); border-radius: 14px;
    box-shadow: 0 10px 32px rgba(0,0,0,.22); padding: 8px; }
.task-menu-title { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 2px 6px 6px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.task-menu-title .ic { width: 14px; height: 14px; }
.task-menu-row { display: flex; gap: 4px; }
.task-menu-row button { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 68px; padding: 8px 6px; border-radius: 10px;
    background: transparent; border: 0; color: var(--text); font-size: 12px; cursor: pointer; }
.task-menu-row button:hover, .task-menu-row button:active { background: var(--fill); }
.task-menu-row button .ic { width: 22px; height: 22px; color: var(--acc); }
.task-menu-row button.danger .ic, .task-menu-row button.danger { color: #dc2626; }
.tsk.wait { background: repeating-linear-gradient(135deg, var(--fill) 0 6px, transparent 6px 12px) !important;
    border: 1px dashed color-mix(in srgb, var(--text-2) 60%, transparent) !important; color: var(--text-2); }
.tsk.wait .tsk-name .ic { width: 13px; height: 13px; margin-right: 3px; }
.tsk.moving { transition: transform .08s ease-out; z-index: 4; box-shadow: 0 6px 18px rgba(0,0,0,.18); opacity: .92; }
.tsk.dragging { z-index: 5; }
.res-search { margin: 8px 10px 4px; }
.res-search input { font-size: 15px; }
.res-list .res[hidden] { display: none; }
.cap-sel.erase { background: rgba(220,38,38,0.12); border-color: #dc2626; color: #dc2626; }

/* ----- call-outs (v4.5) ----- */
.card.callout { border-color: rgba(var(--hazard-rgb),0.45); background: rgba(var(--hazard-rgb),0.06); }
.card.callout .card-title > .ic { color: var(--hazard); }
.callout-row { gap: 8px; align-items: center; }
.callout-tag { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; margin-left: 6px; color: var(--hazard); }
.cap-row.overdue .cap-side { box-shadow: inset 3px 0 0 var(--hazard); }
