/* =====================================================================
   JUP Buddy — styles
   Same design family as Lamproom Command (shaft palette, four themes,
   cards, sidebar, sync pill) with JUP Buddy's emerald accent.
   No CSS framework: plain CSS so the app loads fully offline.
   ===================================================================== */
:root {
    --acc: #10b981; --acc-rgb: 16,185,129; --acc-strong: #059669; --acc-ink: #04120c;
    --ore: #f0a93a; --ore-rgb: 240,169,58;
    --vein: #7ea3ff; --vein-rgb: 91,140,255;
    --safe: #6fcf8a; --safe-rgb: 78,179,107;
    --hazard: #ef847d; --hazard-rgb: 224,87,79;
    --caution: #e0b341; --caution-rgb: 224,179,65;

    --bg: #0d1117;
    --bg-image: radial-gradient(ellipse at 20% 20%, rgba(16,185,129,0.05) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 80%, rgba(91,140,255,0.04) 0%, transparent 60%);
    --card-bg: #161b22; --card-border: rgba(255,255,255,0.07);
    --inner-bg: #0d1117; --inner-border: rgba(255,255,255,0.06);
    --input-bg: #0f141b; --input-border: #3d4654;
    --sidebar-bg: #161b22; --sidebar-border: rgba(255,255,255,0.07);
    --hover: rgba(255,255,255,0.05);
    --text: #e6e9ee; --text-strong: #ffffff; --text-2: #9aa3ae; --text-3: #6b7480;
    --blur: none;
    --shadow: 0 16px 40px rgba(0,0,0,0.45);
    --sidebar-w: 232px; --sidebar-w-collapsed: 68px;
    --radius: 14px;
}
body.theme-glass {
    --bg: #0b0f16;
    --bg-image: radial-gradient(ellipse at 15% 10%, rgba(16,185,129,0.18) 0%, transparent 55%),
                radial-gradient(ellipse at 85% 90%, rgba(91,140,255,0.18) 0%, transparent 55%),
                radial-gradient(ellipse at 60% 40%, rgba(240,169,58,0.08) 0%, transparent 60%);
    --card-bg: rgba(30,37,48,0.55); --card-border: rgba(255,255,255,0.14);
    --inner-bg: rgba(15,20,28,0.45); --inner-border: rgba(255,255,255,0.10);
    --input-bg: rgba(20,26,35,0.6); --input-border: rgba(255,255,255,0.18);
    --sidebar-bg: rgba(22,27,34,0.55); --sidebar-border: rgba(255,255,255,0.12);
    --blur: blur(16px) saturate(140%);
}
body.theme-light {
    --bg: #eef1f5;
    --bg-image: radial-gradient(ellipse at 20% 15%, rgba(16,185,129,0.06) 0%, transparent 55%),
                radial-gradient(ellipse at 85% 85%, rgba(91,140,255,0.06) 0%, transparent 55%);
    --card-bg: #ffffff; --card-border: rgba(15,23,42,0.10);
    --inner-bg: #f4f6f9; --inner-border: rgba(15,23,42,0.07);
    --input-bg: #ffffff; --input-border: #cbd3dd;
    --sidebar-bg: #ffffff; --sidebar-border: rgba(15,23,42,0.10);
    --hover: rgba(15,23,42,0.05);
    --text: #28313f; --text-strong: #111827; --text-2: #556170; --text-3: #7a8593;
    --shadow: 0 16px 40px rgba(15,23,42,0.18);
    --acc: #059669; --acc-strong: #047857;
}
body.theme-light-glass {
    --bg: #e7ecf3;
    --bg-image: radial-gradient(ellipse at 15% 10%, rgba(16,185,129,0.20) 0%, transparent 55%),
                radial-gradient(ellipse at 85% 90%, rgba(91,140,255,0.20) 0%, transparent 55%),
                radial-gradient(ellipse at 55% 45%, rgba(240,169,58,0.12) 0%, transparent 60%);
    --card-bg: rgba(255,255,255,0.58); --card-border: rgba(255,255,255,0.7);
    --inner-bg: rgba(255,255,255,0.45); --inner-border: rgba(15,23,42,0.07);
    --input-bg: rgba(255,255,255,0.7); --input-border: rgba(15,23,42,0.16);
    --sidebar-bg: rgba(255,255,255,0.58); --sidebar-border: rgba(255,255,255,0.6);
    --hover: rgba(15,23,42,0.05);
    --text: #28313f; --text-strong: #111827; --text-2: #556170; --text-3: #7a8593;
    --blur: blur(18px) saturate(150%);
    --shadow: 0 16px 40px rgba(15,23,42,0.18);
    --acc: #059669; --acc-strong: #047857;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
body {
    margin: 0; min-height: 100vh; color: var(--text);
    background: var(--bg); background-image: var(--bg-image); background-attachment: fixed;
    font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
body.modal-open { overflow: hidden; }
h1, h2, h3 { margin: 0; color: var(--text-strong); line-height: 1.25; }
h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
h2, .h2 { font-size: 19px; font-weight: 700; color: var(--text-strong); }
h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
p { margin: 6px 0 0; }
a { color: var(--acc); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--inner-bg); border: 1px solid var(--inner-border); padding: 1px 5px; border-radius: 5px; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }

.ic { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; }
.ic-lg { width: 40px; height: 40px; }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1.2s linear infinite; }

/* utilities */
.muted { color: var(--text-2); } .small { font-size: 13px; } .xsmall { font-size: 11.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.big { font-size: 22px; font-weight: 800; color: var(--text-strong); }
.block { display: block; } .grow { flex: 1; } .min-w-0 { min-width: 0; }
.ellipsis { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.right { text-align: right; } .nowrap { white-space: nowrap; } .center { text-align: center; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 18px; } .mb-3 { margin-bottom: 12px; } .mb-0 { margin-bottom: 0; }
.ml-auto { margin-left: auto; } .mr-auto { margin-right: auto; }
.row { display: flex; align-items: center; } .row-end { display: flex; justify-content: flex-end; gap: 8px; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px 14px; }
/* v2.1: the heading form assembles a name from four parts, so they want to sit on one line */
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 14px; }
@media (max-width: 640px) { .grid4 { grid-template-columns: 1fr 1fr; } }
.p-0 { padding: 0 !important; }
.text-danger { color: var(--hazard) !important; } .text-warn { color: var(--caution) !important; }
.acc { color: var(--acc); }
.center-col { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 12px 0; }
.center-col .ic-lg { color: var(--acc); }

/* ---------- shell ---------- */
#app-shell { display: flex; align-items: flex-start; min-height: 100vh; }
#sidebar {
    width: var(--sidebar-w); flex-shrink: 0; position: sticky; top: 0; height: 100vh;
    background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border);
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    display: flex; flex-direction: column; padding: 16px 12px; gap: 4px; overflow-y: auto;
    transition: width .22s ease; z-index: 40;
}
body.sidebar-collapsed #sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .side-label { display: none !important; }
.side-brand { display: flex; align-items: center; gap: 11px; padding: 0 4px 6px; }
.side-logo { width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.brand-name { font-size: 17px; font-weight: 800; color: var(--text-strong); letter-spacing: -0.01em; }
.brand-sub { display: flex; align-items: center; gap: 6px; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin-top: 3px; }
.redpath { height: 12px; width: auto; opacity: .95; }
.ver { margin-left: auto; font-weight: 700; background: var(--hover); padding: 1px 5px; border-radius: 4px; color: var(--text-2); }
.side-site { font-size: 12px; color: var(--text-3); padding: 0 6px 12px; }
.side-item {
    position: relative; display: flex; align-items: center; gap: 13px; width: 100%;
    padding: 11px 12px; border-radius: 10px; border: 1px solid transparent; background: none;
    color: var(--text-2); cursor: pointer; white-space: nowrap; text-align: left; font-size: 14px; font-weight: 600;
    transition: background .15s, color .15s;
}
.side-icon { width: 20px; display: flex; justify-content: center; flex-shrink: 0; }
.side-icon .ic { width: 20px; height: 20px; }
.side-item:hover { background: var(--hover); color: var(--text-strong); }
.side-item.active { background: rgba(var(--acc-rgb),0.14); color: var(--acc); border-color: rgba(var(--acc-rgb),0.35); }
.side-logout:hover { color: var(--hazard); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.side-divider { height: 1px; background: var(--sidebar-border); margin: 8px 4px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; }
.side-user-name { font-weight: 700; font-size: 13.5px; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-role { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--caution); color: #1a1405; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
body.sidebar-collapsed .nav-badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; font-size: 9.5px; padding: 0 4px; }
.dot-new { position: absolute; left: 28px; top: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--ore); }

#main-area { flex: 1; min-width: 0; }
#topbar { display: none; }
#view { max-width: 1180px; margin: 0 auto; padding: 28px 28px 60px; display: flex; flex-direction: column; gap: 18px; }
#bottom-nav { display: none; }

.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: none; background: transparent; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--text-strong); }

/* ---------- avatar ---------- */
.avatar { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
    background: rgba(var(--acc-rgb),0.16); color: var(--acc); font-weight: 800; font-size: 13.5px; border: 1px solid rgba(var(--acc-rgb),0.3); }
.avatar.sm { width: 30px; height: 30px; font-size: 11.5px; } .avatar.xs { width: 22px; height: 22px; font-size: 9.5px; }
.avatar.lg { width: 60px; height: 60px; font-size: 20px; }

/* ---------- cards ---------- */
.card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 18px;
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); min-width: 0; }
.card-title { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--text-strong); margin-bottom: 14px; font-size: 15px; width: 100%; }
.card-title .ic { color: var(--acc); }
.card-title.collapsible { background: none; border: none; padding: 0; cursor: pointer; text-align: left; margin-bottom: 0; }
.card-title.collapsible + * { margin-top: 14px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: 9px; font-size: 14px; font-weight: 700;
    cursor: pointer; border: 1px solid transparent; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-acc { background: var(--acc); color: var(--acc-ink); }
body.theme-light .btn-acc, body.theme-light-glass .btn-acc { color: #fff; }
.btn-acc:hover:not(:disabled) { background: var(--acc-strong); }
.btn-ghost { background: var(--hover); color: var(--text); border-color: var(--card-border); }
.btn-ghost:hover { border-color: rgba(var(--acc-rgb),0.4); color: var(--text-strong); }
.btn-soft { background: rgba(var(--vein-rgb),0.12); color: var(--vein); border-color: rgba(var(--vein-rgb),0.3); }
.btn-soft:hover { background: rgba(var(--vein-rgb),0.2); }
body.theme-light .btn-soft, body.theme-light-glass .btn-soft { color: #2f5bd1; }
.btn-danger { background: rgba(var(--hazard-rgb),0.16); color: var(--hazard); border-color: rgba(var(--hazard-rgb),0.4); }
.btn-danger:hover { background: rgba(var(--hazard-rgb),0.26); }
body.theme-light .btn-danger, body.theme-light-glass .btn-danger { color: #b42318; }
.btn-warn { background: rgba(var(--caution-rgb),0.16); color: var(--caution); border-color: rgba(var(--caution-rgb),0.4); }
body.theme-light .btn-warn, body.theme-light-glass .btn-warn { color: #8a6100; }
.btn.danger, .link-btn.danger { color: var(--hazard); }
.btn-lg { padding: 14px 20px; font-size: 15.5px; border-radius: 11px; min-height: 52px; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: none; padding: 0; color: var(--acc); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.link-btn:hover { text-decoration: underline; }
.chip-btn { background: var(--hover); border: 1px solid var(--card-border); color: var(--text-2); border-radius: 20px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip-btn:hover { color: var(--text-strong); border-color: rgba(var(--acc-rgb),0.4); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; border: 1px solid; vertical-align: middle; }
.badge .ic { width: 12px; height: 12px; }
.badge-good { background: rgba(var(--safe-rgb),0.15); color: var(--safe); border-color: rgba(var(--safe-rgb),0.3); }
.badge-warn { background: rgba(var(--caution-rgb),0.15); color: var(--caution); border-color: rgba(var(--caution-rgb),0.3); }
.badge-danger { background: rgba(var(--hazard-rgb),0.15); color: var(--hazard); border-color: rgba(var(--hazard-rgb),0.3); }
.badge-muted { background: var(--hover); color: var(--text-2); border-color: var(--card-border); }
.badge-acc { background: rgba(var(--acc-rgb),0.15); color: var(--acc); border-color: rgba(var(--acc-rgb),0.3); }
.badge-info { background: rgba(var(--vein-rgb),0.15); color: var(--vein); border-color: rgba(var(--vein-rgb),0.3); }
.badge-day { background: rgba(var(--caution-rgb),0.12); color: var(--caution); border-color: rgba(var(--caution-rgb),0.3); }
.badge-night { background: rgba(var(--vein-rgb),0.12); color: var(--vein); border-color: rgba(var(--vein-rgb),0.3); }
body.theme-light .badge-good, body.theme-light-glass .badge-good { color: #15803d; }
body.theme-light .badge-warn, body.theme-light-glass .badge-warn, body.theme-light .badge-day, body.theme-light-glass .badge-day { color: #8a6100; }
body.theme-light .badge-danger, body.theme-light-glass .badge-danger { color: #b42318; }
body.theme-light .badge-info, body.theme-light-glass .badge-info, body.theme-light .badge-night, body.theme-light-glass .badge-night { color: #2f5bd1; }

/* ---------- sync pill (Lamproom DB indicator) ---------- */
.db-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); white-space: nowrap; }
.db-dot { position: relative; width: 9px; height: 9px; border-radius: 50%; background: #5b6470; display: inline-block; }
.db-ring { position: absolute; inset: 0; border-radius: 50%; }
@keyframes pulse-ring { 0% { transform: scale(.85); opacity: 1; } 70%, 100% { transform: scale(2.4); opacity: 0; } }
.db-online .db-dot { background: #4eb36b; } .db-online .db-label { color: var(--safe); }
.db-online .db-ring { background: rgba(78,179,107,.45); animation: pulse-ring 1.8s ease-out infinite; }
.db-pending .db-dot { background: #e0b341; } .db-pending .db-label { color: var(--caution); }
.db-pending .db-ring { background: rgba(224,179,65,.45); animation: pulse-ring .9s ease-out infinite; }
.db-error .db-dot { background: #e0574f; } .db-error .db-label { color: var(--hazard); }
.db-local .db-dot { background: var(--vein); } .db-local .db-label { color: var(--vein); }
.queue-badge { background: rgba(var(--caution-rgb),0.18); color: var(--caution); border: 1px solid rgba(var(--caution-rgb),0.3); border-radius: 20px; padding: 0 7px; font-size: 10.5px; }

/* ---------- forms ---------- */
.lbl { display: block; font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], select, textarea {
    width: 100%; background: var(--input-bg); border: 1px solid var(--input-border); color: var(--text-strong);
    border-radius: 9px; padding: 11px 13px; font: inherit; font-size: 15.5px; outline: none; transition: border-color .15s, box-shadow .15s; min-height: 46px;
}
textarea { resize: vertical; min-height: 80px; line-height: 1.45; }
.mono, textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
input:focus, select:focus, textarea:focus { border-color: rgba(var(--acc-rgb),0.7); box-shadow: 0 0 0 3px rgba(var(--acc-rgb),0.18); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
select option { background: var(--card-bg); color: var(--text); }
body.theme-dark input[type=date], body.theme-dark input[type=datetime-local], body.theme-glass input[type=date], body.theme-glass input[type=datetime-local] { color-scheme: dark; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--acc); cursor: pointer; flex-shrink: 0; }
.pin-input { letter-spacing: .5em; text-align: center; font-size: 22px !important; font-weight: 700; }
.form-err { color: var(--hazard); font-size: 13.5px; font-weight: 600; min-height: 0; margin-top: 8px; }
.form-err:empty { margin: 0; }

.secnum-field { display: flex; align-items: stretch; border: 1px solid var(--input-border); border-radius: 9px; overflow: hidden; background: var(--input-bg); transition: border-color .15s, box-shadow .15s; }
.secnum-field:focus-within { border-color: rgba(var(--acc-rgb),0.7); box-shadow: 0 0 0 3px rgba(var(--acc-rgb),0.18); }
.secnum-prefix { display: flex; align-items: center; padding: 0 12px; background: rgba(var(--acc-rgb),0.12); color: var(--acc); font-weight: 800; font-family: ui-monospace, monospace; border-right: 1px solid rgba(var(--acc-rgb),0.25); user-select: none; }
.secnum-field input { border: none !important; box-shadow: none !important; border-radius: 0 !important; background: transparent !important; flex: 1; min-width: 0; }
.secnum-lg .secnum-prefix { font-size: 24px; padding: 0 16px; }
.secnum-lg input { font-size: 24px !important; letter-spacing: .15em; font-weight: 700; min-height: 56px; }

.search-box { position: relative; display: flex; align-items: center; }
.search-box.grow { flex: 1 1 240px; }
.search-box .ic { position: absolute; left: 12px; color: var(--text-3); pointer-events: none; }
.search-box input { padding-left: 38px; }

.check-row { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px; cursor: pointer; border: 1px solid var(--inner-border); background: var(--inner-bg); }
.check-row:hover { border-color: rgba(var(--acc-rgb),0.35); }
.check-row.plain { border: none; background: none; padding: 6px 0; }
.check-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.disabled { opacity: .4; pointer-events: none; }

/* ---------- notes, alerts, empty ---------- */
.note { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 10px; font-size: 13.5px; border: 1px solid; }
.note .ic { margin-top: 1px; }
.note-acc { background: rgba(var(--acc-rgb),0.1); border-color: rgba(var(--acc-rgb),0.3); display: block; }
.note-warn { background: rgba(var(--caution-rgb),0.1); border-color: rgba(var(--caution-rgb),0.35); color: var(--text); }
.note-warn .ic { color: var(--caution); }
.note-info { background: rgba(var(--vein-rgb),0.1); border-color: rgba(var(--vein-rgb),0.3); }
.note-info .ic { color: var(--vein); }
.note-danger { background: rgba(var(--hazard-rgb),0.1); border-color: rgba(var(--hazard-rgb),0.35); }
.note-danger .ic { color: var(--hazard); }
.alert-bar { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 13px 16px; border-radius: 12px; border: 1px solid; border-left-width: 4px; cursor: pointer; animation: slideIn .3s ease; }
.alert-bar > span { flex: 1; }
.alert-danger { background: rgba(var(--hazard-rgb),0.1); border-color: rgba(var(--hazard-rgb),0.45); color: var(--text); }
.alert-danger > .ic:first-child { color: var(--hazard); }
.alert-warn { background: rgba(var(--caution-rgb),0.08); border-color: rgba(var(--caution-rgb),0.4); cursor: default; }
.alert-info { background: rgba(var(--acc-rgb),0.08); border-color: rgba(var(--acc-rgb),0.4); cursor: default; }
.alert-info > .ic:first-child { color: var(--acc); }
.alert-warn > .ic:first-child { color: var(--caution); }
@keyframes slideIn { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 34px 18px; color: var(--text-3); gap: 6px; }
.empty-title { font-weight: 700; color: var(--text-2); font-size: 15px; }
.empty-text { font-size: 13.5px; max-width: 360px; }

/* ---------- dashboard ---------- */
.shift-chip { display: flex; align-items: center; gap: 11px; padding: 9px 14px; border-radius: 12px; border: 1px solid; }
.shift-chip .ic { width: 22px; height: 22px; }
.shift-chip b { display: block; color: var(--text-strong); font-size: 14px; }
.shift-chip span { font-size: 12px; color: var(--text-2); }
.shift-chip.day { background: rgba(var(--caution-rgb),0.1); border-color: rgba(var(--caution-rgb),0.35); color: var(--caution); }
.shift-chip.night { background: rgba(var(--vein-rgb),0.1); border-color: rgba(var(--vein-rgb),0.35); color: var(--vein); }

.tracker.running { border-color: rgba(var(--acc-rgb),0.45); box-shadow: 0 0 0 1px rgba(var(--acc-rgb),0.15), 0 10px 40px rgba(var(--acc-rgb),0.08); }
.plod-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.plod-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; min-height: 92px; border-radius: 12px; cursor: pointer; text-align: left;
    background: var(--inner-bg); border: 1px solid var(--inner-border); color: var(--text); font-weight: 700; font-size: 14.5px; transition: border-color .15s, background .15s; }
.plod-tile .ic { width: 24px; height: 24px; color: var(--text-3); }
.plod-tile:hover { border-color: rgba(var(--acc-rgb),0.4); }
.plod-tile.active { background: rgba(var(--acc-rgb),0.13); border-color: var(--acc); color: var(--text-strong); box-shadow: 0 0 0 1px var(--acc) inset; }
.plod-tile.active .ic { color: var(--acc); }
.trk-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.live-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 800; letter-spacing: .12em; color: var(--acc); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--acc); display: inline-block; box-shadow: 0 0 0 0 rgba(var(--acc-rgb),.6); animation: live 1.6s infinite; flex-shrink: 0; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(var(--acc-rgb),.55); } 70% { box-shadow: 0 0 0 9px rgba(var(--acc-rgb),0); } 100% { box-shadow: 0 0 0 0 rgba(var(--acc-rgb),0); } }
.trk-plod { font-size: 24px; font-weight: 800; color: var(--text-strong); margin: 4px 0 2px; line-height: 1.2; }
/* whichever field the admin ticked as the headline — the heading, in practice */
.trk-sub { font-size: 13.5px; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; gap: 5px; }
.trk-sub svg { width: 14px; height: 14px; }
.trk-clock-wrap { text-align: right; }
.trk-clock { font-size: 46px; font-weight: 800; color: var(--text-strong); letter-spacing: .02em; line-height: 1; }
.trk-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.trk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--card-border); }
.mini-title { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 8px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.data-chip { display: inline-flex; gap: 8px; align-items: baseline; padding: 6px 10px; border-radius: 9px; background: var(--inner-bg); border: 1px solid var(--inner-border); border-left: 3px solid var(--text-3); font-size: 13px; }
.data-chip b { color: var(--text-strong); }
.data-chip.cat-c0 { border-left-color: var(--acc); }    .data-chip.cat-c1 { border-left-color: var(--ore); }
.data-chip.cat-c2 { border-left-color: var(--hazard); } .data-chip.cat-c3 { border-left-color: var(--vein); }
.data-chip.cat-c4 { border-left-color: #4f9ad8; }       .data-chip.cat-c5 { border-left-color: #b07cd8; }
.data-chip.cat-c6 { border-left-color: #3fae96; }       .data-chip.cat-c7 { border-left-color: var(--text-3); }
.person-chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 6px 4px 4px; border-radius: 20px; background: var(--inner-bg); border: 1px solid var(--inner-border); font-size: 13px; font-weight: 600; }
.person-chip button { background: none; border: none; color: var(--text-3); cursor: pointer; padding: 2px; display: inline-flex; }
.person-chip button .ic { width: 14px; height: 14px; }
.person-chip button:hover { color: var(--hazard); }
.ghost-empty { width: 100%; padding: 12px; border-radius: 10px; border: 1px dashed var(--input-border); background: none; color: var(--text-3); cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.ghost-empty:hover { color: var(--acc); border-color: var(--acc); }
.notes-text { background: var(--inner-bg); border: 1px solid var(--inner-border); border-radius: 9px; padding: 10px 12px; font-size: 14px; white-space: pre-wrap; }
.trk-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.trk-foot .ic { width: 14px; height: 14px; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; }
.stat-row-4 { grid-template-columns: repeat(4, 1fr); }
.stat { background: var(--inner-bg); border: 1px solid var(--inner-border); border-radius: 11px; padding: 12px 14px; }
.stat.card { background: var(--card-bg); }
.stat-num { font-size: 22px; font-weight: 800; color: var(--text-strong); font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-lbl { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 2px; }
.stat-lbl .ic { width: 13px; height: 13px; }
.stat-btn { cursor: pointer; text-align: left; } .stat-btn:hover { border-color: rgba(var(--acc-rgb),0.4); }
.mini-list { display: flex; flex-direction: column; gap: 6px; }
.mini-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--inner-bg); border: 1px solid var(--inner-border); cursor: pointer; text-align: left; width: 100%; }
.mini-row:hover:not(.static) { border-color: rgba(var(--acc-rgb),0.4); }
.mini-row.static { cursor: default; }
.mini-row b { color: var(--text-strong); }

.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 7px 0; border-bottom: 1px solid var(--inner-border); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv > span { color: var(--text-2); } .kv > b { color: var(--text-strong); text-align: right; font-weight: 700; }

/* ---------- data entry ---------- */
.data-group + .data-group { margin-top: 16px; }
.data-group-title { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); margin-bottom: 6px; display: flex; align-items: center; gap: 7px; }
/* Categories are admin-made from v1.3, so colour comes from the slot a category sits in
   (cat-c0 … cat-c7, assigned by catClass()) rather than from its name. */
.data-group-title[class*="cat-c"]::before,
.list-group-title::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--text-3); }
.cat-c0::before { background: var(--acc) !important; }    .cat-c1::before { background: var(--ore) !important; }
.cat-c2::before { background: var(--hazard) !important; } .cat-c3::before { background: var(--vein) !important; }
.cat-c4::before { background: #4f9ad8 !important; }       .cat-c5::before { background: #b07cd8 !important; }
.cat-c6::before { background: #3fae96 !important; }       .cat-c7::before { background: var(--text-3) !important; }
.data-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--inner-border); }
.data-name { font-weight: 600; font-size: 14.5px; }
.data-row > input[type=text] { max-width: 60%; }
.data-input { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.data-input input { width: 120px; text-align: right; font-weight: 700; }
.data-input .unit { width: 58px; font-size: 13px; color: var(--text-2); }
/* v1.2 field types. Date and time pickers need their own width — the browser draws the
   calendar/clock button inside the box and 120px clips it on small phones. */
.data-row input[type=date] { width: 150px; text-align: left; }
.data-row input[type=time] { width: 118px; text-align: left; }
.data-row input[type=date], .data-row input[type=time] { font-weight: 700; }
.data-input.bool { gap: 10px; }
.data-input.bool input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--acc); }
.data-input.bool .unit { width: auto; font-weight: 600; }
.req { color: var(--hazard); font-weight: 800; margin-left: 2px; }
/* The list picker's button. Looks like an input, opens a modal of choices. */
.picker-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px;
    min-width: 170px; max-width: 58vw; padding: 9px 11px; border-radius: 9px; cursor: pointer;
    font: inherit; font-weight: 700; text-align: left; color: var(--text);
    background: var(--inner-bg); border: 1px solid var(--inner-border); }
.picker-btn:hover { border-color: rgba(var(--acc-rgb),0.45); }
.picker-btn .ic { flex-shrink: 0; color: var(--text-3); }
.picker-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-text.muted { font-weight: 600; }

/* ---------- Admin → Lists: editable item rows ---------- */
.item-rows { display: flex; flex-direction: column; gap: 6px; max-height: 44vh; overflow-y: auto; padding: 1px; }
.item-row { display: flex; align-items: center; gap: 8px; }
.item-row > input[type=text] { flex: 1; min-width: 0; }
.item-row .btn { flex: 0 0 auto; }
/* up / down, stacked tight so a row stays one line on a phone */
.item-move { display: flex; flex-direction: column; gap: 1px; flex: 0 0 auto; }
.item-move .btn { padding: 1px 4px; min-height: 0; line-height: 1; }
.item-move .btn svg { width: 13px; height: 13px; }
.item-move .btn:disabled { opacity: .3; }
.item-row.off { opacity: .62; }

/* ---------- planner: week board ----------
   A grid of shift columns with a sticky heading column down the left. Cycles are bars
   placed by grid-column; overlapping ones get their own lane (grid-row). */
.board-card { overflow: hidden; }
.board-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--inner-border); }
.board-when { font-size: 14px; }
.board-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
.board { --side-w: 150px; --slot-w: 46px; --lane-h: 42px; min-width: calc(var(--side-w) + var(--slots) * var(--slot-w)); }
.board-head-row, .board-row { display: grid; grid-template-columns: var(--side-w) 1fr; align-items: stretch; position: relative; }
.board-row { border-top: 1px solid var(--inner-border); }
.board-side { position: sticky; left: 0; z-index: 3; display: flex; align-items: center; padding: 8px 10px; gap: 6px;
    background: var(--card-bg); border-right: 1px solid var(--inner-border); font-size: 13px; font-weight: 700;
    color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-days { display: grid; grid-template-columns: repeat(var(--slots), minmax(var(--slot-w), 1fr)); }
.board-day { grid-row: 1; display: flex; align-items: center; justify-content: center; padding: 7px 4px; font-size: 11.5px;
    color: var(--text-2); border-left: 1px solid var(--inner-border); white-space: nowrap; }
.board-day.today { color: var(--acc); }
.board-day.today b { position: relative; }
.board-day.today b::after { content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 2px; background: var(--acc); border-radius: 2px; }
.board-shift { display: flex; align-items: center; justify-content: center; padding: 3px 0 5px; font-size: 10px; font-weight: 800;
    letter-spacing: .05em; color: var(--text-3); border-left: 1px solid var(--inner-border); }
.board-shift.ns { color: var(--text-3); background: var(--inner-bg); }

.board-lanes { position: relative; display: grid; grid-template-columns: repeat(var(--slots), minmax(var(--slot-w), 1fr));
    gap: 4px 0; padding: 4px 0; }
.slot { border-left: 1px solid var(--inner-border); }
.slot.ns { background: rgba(127,127,127,0.05); }
.board-row.drop-target .board-lanes { background: rgba(var(--acc-rgb), 0.1); }

/* a planned cycle */
.cyc { position: relative; z-index: 2; margin: 0 2px; display: flex; flex-direction: column; justify-content: center; gap: 1px;
    min-width: 0; padding: 5px 9px; border: 1px solid rgba(var(--acc-rgb), 0.5); border-radius: 9px;
    background: rgba(var(--acc-rgb), 0.16); color: var(--text-strong); text-align: left; cursor: grab;
    touch-action: none; /* let the pointer handlers own the gesture instead of scrolling */ }
.cyc:hover { background: rgba(var(--acc-rgb), 0.24); }
.cyc.dragging { cursor: grabbing; z-index: 5; box-shadow: 0 8px 20px rgba(0,0,0,0.35); opacity: .92; }
.cyc.moving-row { outline: 2px dashed var(--acc); }
.cyc-name { display: flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cyc-name svg { width: 13px; height: 13px; flex: 0 0 auto; color: var(--caution); }
.cyc-meta { font-size: 10.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cyc.narrow { padding: 5px 6px; } .cyc.narrow .cyc-meta { display: none; }
/* a cycle that started before this week, or runs past the end of it */
.cyc.clip-l { border-left-style: dashed; border-top-left-radius: 3px; border-bottom-left-radius: 3px; margin-left: 0; }
.cyc.clip-r { border-right-style: dashed; border-top-right-radius: 3px; border-bottom-right-radius: 3px; margin-right: 0; }

/* cycles parked in the week before or after */
.edge-mark { position: absolute; top: 50%; transform: translateY(-50%); z-index: 4; display: inline-flex; align-items: center; gap: 2px;
    padding: 3px 5px; border: 1px solid var(--inner-border); border-radius: 20px; background: var(--card-bg);
    color: var(--text-2); font-size: 10.5px; font-weight: 800; cursor: pointer; }
.edge-mark:hover { color: var(--acc); border-color: var(--acc); }
.edge-mark svg { width: 13px; height: 13px; }
.edge-mark.before { left: calc(var(--side-w) + 2px); }
.edge-mark.after { right: 2px; }
.board-foot { padding: 10px 14px 12px; margin: 0; border-top: 1px solid var(--inner-border); }
.fire-tag { color: var(--hazard); } .fire-tag svg { width: 13px; height: 13px; vertical-align: -2px; }

@media (max-width: 860px) {
    .board { --side-w: 104px; --slot-w: 40px; }
    .board-when { flex-basis: 100%; order: 3; }
}

/* ---------- the spreadsheet importer ---------- */
.imp-cols { display: flex; flex-direction: column; gap: 4px; max-height: 46vh; overflow-y: auto; padding: 1px; }
.imp-row { display: grid; grid-template-columns: 28px minmax(130px, 1.5fr) 128px 120px 120px; gap: 8px; align-items: center; }
.imp-row.imp-head { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); position: sticky; top: 0; background: var(--card-bg); padding-bottom: 4px; z-index: 2; }
.imp-row.empty { opacity: .5; }
.imp-row select { min-width: 0; }
.imp-row b { font-size: 13.5px; }
.imp-ops .kv svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 5px; }
@media (max-width: 860px) {
    .imp-row { grid-template-columns: 24px 1fr 1fr; grid-template-areas: "tick name name" ". role type" ". grp grp"; row-gap: 5px; padding: 8px; border: 1px solid var(--inner-border); border-radius: 10px; }
    .imp-row.imp-head { display: none; }
    .imp-row > label { grid-area: tick; } .imp-row > span { grid-area: name; }
    .imp-row [data-ir] { grid-area: role; } .imp-row [data-it] { grid-area: type; } .imp-row [data-ig] { grid-area: grp; }
}

/* ---------- planner: the three-month schedule ---------- */
.sched-row { align-items: center; gap: 12px; }
.prio { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
    border-radius: 8px; background: var(--inner-bg); border: 1px solid var(--inner-border);
    font-size: 12px; font-weight: 800; color: var(--text-2); }
.sched-num { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; font-size: 15px; font-weight: 800; color: var(--text-strong); line-height: 1.15; }
.sched-num small { font-size: 10px; font-weight: 600; color: var(--text-3); }
/* a thin progress bar under each heading */
.bar { display: block; height: 5px; margin-top: 6px; border-radius: 3px; background: var(--inner-bg); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--acc); border-radius: 3px; }
.bar-fill.warn { background: var(--caution); }
/* the editor: one block per heading, its sections inside */
.sched-edit { padding: 10px; border: 1px solid var(--inner-border); border-radius: 11px; background: var(--inner-bg); }
.sched-edit + .sched-edit { margin-top: 8px; }
.sched-edit .data-input input { width: 58px; }
.sched-edit .sect-row .data-input input { width: 76px; }
.sched-edit select { min-width: 0; }
/* where the heading already stands: the opening cut and chainage the counting runs from */
.data-input .unit.pre { width: auto; font-weight: 700; color: var(--text-3); text-transform: uppercase;
    font-size: 10.5px; letter-spacing: .06em; }
.open-row { align-items: center; border-top: 1px dashed var(--inner-border); padding-top: 8px; }
.open-row .lbl { font-size: 11px; color: var(--text-3); }
.sched-edit .open-row .data-input input { width: 74px; }
@media (max-width: 860px) {
    .sched-row { flex-wrap: wrap; }
    .sched-edit .row { flex-wrap: wrap; row-gap: 6px; }
    .sched-edit select { flex: 1 1 100%; }
}

/* ---------- what the planner issued, on a crew's dashboard ---------- */
.task-list { display: flex; flex-direction: column; }
.task-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--inner-border); }
.task-item:last-child { border-bottom: none; }
.task-item.fires b svg { color: var(--hazard); width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.task-item b { color: var(--text-strong); font-size: 14.5px; }
.task-item .block svg { width: 12px; height: 12px; vertical-align: -2px; margin-right: 3px; opacity: .7; }
/* the planner's note is worth reading in full, unlike the one-line meta above it */
.task-note { white-space: normal; color: var(--text-2) !important; margin-top: 2px; }
.task-time { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; font-size: 13px; font-weight: 700; color: var(--text-strong); line-height: 1.25; }
.task-time small { font-size: 11px; font-weight: 600; color: var(--text-3); }
.task-item .btn { flex: 0 0 auto; }
.plan-row { align-items: center; }
@media (max-width: 860px) { .plan-row { flex-wrap: wrap; row-gap: 8px; } .plan-row .row { flex-basis: 100%; } }

/* ---------- planner: shift board ---------- */
.sboard { --slot-w: 20px; --lane-h: 40px; }
.sb-hour { grid-row: 1; display: flex; align-items: center; justify-content: flex-start; padding: 7px 0 7px 5px;
    font-size: 11px; color: var(--text-2); border-left: 1px solid var(--inner-border); white-space: nowrap; }
.sboard .slot { border-left: none; }
.sboard .slot.hr { border-left: 1px solid var(--inner-border); }

.tsk { position: relative; z-index: 2; margin: 0 1px; display: flex; flex-direction: column; justify-content: center; gap: 1px;
    min-width: 0; padding: 4px 7px; border: 1px solid rgba(var(--acc-rgb), 0.5); border-radius: 8px;
    background: rgba(var(--acc-rgb), 0.16); color: var(--text-strong); text-align: left; cursor: grab; touch-action: none; }
.tsk:hover { background: rgba(var(--acc-rgb), 0.24); }
.tsk.dragging { cursor: grabbing; z-index: 5; box-shadow: 0 8px 20px rgba(0,0,0,0.35); opacity: .92; }
.tsk-name { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; line-height: 1.15;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tsk-name svg { width: 13px; height: 13px; flex: 0 0 auto; }
.tsk-meta { font-size: 10px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tsk.narrow { padding: 4px; } .tsk.narrow .tsk-meta { display: none; }
.tsk.fires { border-color: rgba(220,80,70,0.55); }
.tsk.fires .tsk-name svg:first-child { color: var(--hazard); }
.tsk.clash { border-color: var(--caution); background: rgba(var(--caution-rgb),0.18); }
.tsk.clash .tsk-name svg:last-child { color: var(--caution); }
.tsk.clip-l { border-left-style: dashed; border-top-left-radius: 3px; border-bottom-left-radius: 3px; margin-left: 0; }
.tsk.clip-r { border-right-style: dashed; border-top-right-radius: 3px; border-bottom-right-radius: 3px; margin-right: 0; }

@media (max-width: 860px) { .sboard { --slot-w: 17px; } }

/* ---------- v2.0: neighbouring shift or week, taken into view as context ----------
   Dimmed rather than hidden, and never moved by looking at it. */
.ghost { opacity: .45; }
.cyc.ghost, .tsk.ghost { border-style: dashed; background: transparent; }
.cyc.ghost:hover, .tsk.ghost:hover { opacity: .8; background: var(--inner-bg); }
.slot.out { background: rgba(127,127,127,0.09); }
.sboard .slot.out { background: rgba(127,127,127,0.07); }
.edge-mark.on { color: var(--acc); border-color: var(--acc); background: var(--card-bg); }

/* cut number and chainage carried on the bar */
.cyc-meta .pos, .tsk-meta .pos { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text-2); }
.cyc-meta .pos.done, .tsk-meta .pos.done { color: var(--acc); }
.cyc-meta .pos.pops, .tsk-meta .pos.pops { color: var(--hazard); }

/* ---------- v2.0: the resources panel ---------- */
.sboard-wrap { display: flex; align-items: stretch; min-width: 0; }
.sboard-wrap > .board-scroll { flex: 1 1 auto; min-width: 0; }
.res-panel { flex: 0 0 196px; display: flex; flex-direction: column; min-width: 0;
    border-left: 1px solid var(--inner-border); background: var(--inner-bg); }
.res-head { display: flex; align-items: center; gap: 7px; padding: 9px 11px; border-bottom: 1px solid var(--inner-border); font-size: 13px; }
.res-head svg { width: 15px; height: 15px; color: var(--text-3); flex: 0 0 auto; }
.res-tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--inner-border); }
.res-tab { flex: 0 0 auto; padding: 7px 11px; border: 0; background: transparent; color: var(--text-2);
    font-size: 11.5px; font-weight: 700; cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; }
.res-tab:hover { color: var(--text-strong); }
.res-tab.on { color: var(--acc); border-bottom-color: var(--acc); }
.res-list { flex: 1 1 auto; overflow-y: auto; max-height: 420px; padding: 5px; display: flex; flex-direction: column; gap: 3px; }
.res { display: flex; align-items: center; gap: 7px; width: 100%; padding: 6px 8px; border: 1px solid transparent;
    border-radius: 9px; background: var(--card-bg); color: var(--text-strong); text-align: left;
    font-size: 12.5px; cursor: grab; touch-action: none; }
.res:hover { border-color: var(--acc); }
.res.dragging { opacity: .4; }
.res-n { flex: 0 0 auto; min-width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 6px; background: rgba(var(--acc-rgb),0.18); color: var(--acc);
    font-size: 10.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.res.busy b { color: var(--text-2); }
.res-foot { padding: 7px 11px; border-top: 1px solid var(--inner-border); }
/* the label that follows the finger */
.res-ghost { position: fixed; top: 0; left: 0; z-index: 90; pointer-events: none; margin: -14px 0 0 12px;
    padding: 5px 9px; border-radius: 8px; border: 1px solid var(--acc); background: var(--card-bg);
    color: var(--text-strong); font-size: 12px; font-weight: 700; box-shadow: 0 8px 20px rgba(0,0,0,0.35); }
.tsk.res-over { outline: 2px solid var(--acc); outline-offset: 1px; }
/* a task this resource is already busy against, flagged before the drop rather than after */
.tsk.would-clash { border-color: var(--caution); background: rgba(var(--caution-rgb),0.22); }
.tsk.would-clash::after { content: '!'; position: absolute; top: -5px; right: -3px; width: 14px; height: 14px;
    display: flex; align-items: center; justify-content: center; border-radius: 50%;
    background: var(--caution); color: #fff; font-size: 10px; font-weight: 800; }
@media (max-width: 860px) {
    /* On a phone the board needs the full width: assigning is done by tapping a task,
       which opens the same tick-lists the panel feeds. */
    .sboard-wrap { display: block; }
    .res-panel { display: none; }
}

/* ---------- planner: cycle template editor ---------- */
.task-row { display: flex; align-items: center; gap: 8px; }
.task-row > input[type=text] { flex: 1 1 40%; min-width: 0; }
.task-row > select { flex: 0 1 150px; min-width: 0; }
.task-row .data-input input { width: 74px; }
.task-row .data-input .unit { min-width: 52px; font-size: 11.5px; color: var(--text-3); }
.task-row .btn { flex: 0 0 auto; }
/* the one task that fires the round — a radio drawn as a flame */
.fire-pick { position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
    border: 1px solid var(--inner-border); border-radius: 9px; cursor: pointer; color: var(--text-3); background: var(--inner-bg); }
/* the radio fills the button rather than being shrunk to nothing, so the whole flame is
   the hit target and it still takes keyboard focus */
.fire-pick input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.fire-pick svg { width: 17px; height: 17px; pointer-events: none; }
.fire-pick:hover { color: var(--text-2); }
.fire-pick:focus-within { outline: 2px solid var(--acc); outline-offset: 2px; }
.fire-pick.on { color: var(--hazard); border-color: var(--hazard); background: rgba(220,80,70,0.12); }
@media (max-width: 860px) {
    /* One task becomes a small card: name on top, everything else on one line under it.
       Without the card the rows run together and it's hard to see where a task ends. */
    .task-row { flex-wrap: wrap; row-gap: 8px; gap: 6px; padding: 10px; border: 1px solid var(--inner-border);
        border-radius: 11px; background: var(--inner-bg); }
    .task-row .item-count { order: 0; }
    .task-row > input[type=text] { flex: 1 1 auto; order: 1; min-width: 0; }
    /* a zero-height flex item that always wraps: keeps the number beside the task name on
       line one and drops the controls onto line two, whatever their widths add up to */
    .task-row::after { content: ''; flex-basis: 100%; height: 0; order: 2; }
    .task-row > select { flex: 1 1 90px; order: 3; min-width: 0; }
    .task-row .data-input { order: 4; gap: 4px; }
    .task-row .data-input input { width: 58px; }
    .task-row .data-input .unit { display: none; }     /* the number is enough on a phone */
    .fire-pick { order: 5; width: 34px; height: 34px; }
    .task-row .item-move { order: 6; }
    .task-row > .btn.danger { order: 7; padding: 4px 7px; }
}
.item-use { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--text-2);
    white-space: nowrap; cursor: pointer; text-transform: uppercase; letter-spacing: .04em; }
.item-use input { width: 18px; height: 18px; accent-color: var(--acc); }
.item-count { color: var(--text-3); font-size: 12px; font-weight: 700; width: 22px; text-align: right; flex: 0 0 auto; }

/* ---------- sign-off ---------- */
.summary-head { display: flex; justify-content: space-between; gap: 14px; padding: 14px; border-radius: 12px; background: var(--inner-bg); border: 1px solid var(--inner-border); }
.summary-title { font-size: 18px; font-weight: 800; color: var(--text-strong); }
.declaration { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; background: rgba(var(--caution-rgb),0.08); border-left: 3px solid var(--caution); font-size: 14px; font-weight: 600; }
.declaration .ic { color: var(--caution); margin-top: 2px; }
.sig-preview { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.sig-img { background: #fff; border-radius: 8px; padding: 6px 10px; max-height: 70px; max-width: 220px; border: 1px solid var(--inner-border); }
.sig-wrap { position: relative; background: #fff; border-radius: 12px; border: 1px solid var(--input-border); overflow: hidden; }
.sig-canvas { display: block; width: 100%; height: 190px; touch-action: none; cursor: crosshair; }
.sig-line { position: absolute; left: 24px; right: 24px; bottom: 44px; border-bottom: 1.5px dashed #c5ccd6; pointer-events: none; }
.sig-hint { position: absolute; left: 24px; bottom: 18px; font-size: 12px; color: #8a94a3; pointer-events: none; }

/* ---------- plod log ---------- */
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.quick-ranges { display: flex; gap: 6px; flex-wrap: wrap; }
.log-list { display: flex; flex-direction: column; }
/* v1.3 dropped the Heading column: the admin's headline field now sits under the plod name. */
.log-row { display: grid; grid-template-columns: 140px minmax(190px,1.9fr) minmax(120px,1fr) 90px 130px; align-items: center; gap: 12px;
    padding: 12px 18px; border: none; border-bottom: 1px solid var(--inner-border); background: none; text-align: left; cursor: pointer; width: 100%; }
.log-row:last-child { border-bottom: none; }
.log-row:hover:not(.log-head) { background: var(--hover); }
.log-head { cursor: default; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding-top: 14px; padding-bottom: 10px; }
.c-date { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.c-plod { min-width: 0; }
.c-plod b { display: block; color: var(--text-strong); }
.c-plod .ellipsis { display: block; }
.c-dur { font-weight: 700; }
.totals-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px 26px; }

.info-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 14px; border-radius: 12px; background: var(--inner-bg); border: 1px solid var(--inner-border); }
.info-grid span { display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.info-grid b { display: block; color: var(--text-strong); }
.info-grid em { display: block; font-style: normal; font-size: 12.5px; color: var(--text-2); }
.signoff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.signoff { padding: 14px; border-radius: 12px; border: 1px solid var(--inner-border); background: var(--inner-bg); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--text-2); font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap; }
.tab:hover { background: var(--hover); color: var(--text-strong); }
.tab.active { background: rgba(var(--acc-rgb),0.14); color: var(--acc); border-color: rgba(var(--acc-rgb),0.35); }
.list-toolbar { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--card-border); flex-wrap: wrap; }
.list-row { display: flex; align-items: center; gap: 13px; width: 100%; padding: 12px 16px; background: none; border: none; border-bottom: 1px solid var(--inner-border); text-align: left; cursor: pointer; }
.list-row:last-child { border-bottom: none; }
.list-row:hover:not(.static) { background: var(--hover); }
.list-row.static { cursor: default; }
.list-row b { color: var(--text-strong); }
.list-row > .ic:last-child { color: var(--text-3); }
.list-group-title { display: flex; align-items: center; gap: 8px; padding: 14px 16px 6px; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); }
.tile-ic { width: 40px; height: 40px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; background: rgba(var(--acc-rgb),0.12); color: var(--acc); flex-shrink: 0; }
.tile-ic.sm { width: 32px; height: 32px; border-radius: 9px; } .tile-ic.sm .ic { width: 16px; height: 16px; }
.logo-preview { height: 56px; max-width: 200px; padding: 6px 10px; border-radius: 10px; background: #fff; border: 1px solid var(--inner-border); object-fit: contain; }
.logo-preview.empty { display: flex; align-items: center; color: #8a94a3; font-size: 13px; width: 140px; justify-content: center; }

.profile-head { display: flex; align-items: center; gap: 14px; }
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.theme-opt { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--text-2); font-weight: 700; cursor: pointer; }
.theme-opt.active { border-color: var(--acc); color: var(--acc); background: rgba(var(--acc-rgb),0.1); }
.sw { width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(0,0,0,0.2); }
.sw-dark { background: linear-gradient(135deg, #0d1117 40%, #262d38 100%); }
.sw-glass { background: linear-gradient(135deg, rgba(91,140,255,0.6), rgba(16,185,129,0.55)), #0b0f16; }
.sw-light { background: linear-gradient(135deg, #ffffff 40%, #e7ebf1 100%); }
.sw-light-glass { background: linear-gradient(135deg, rgba(91,140,255,0.4), rgba(255,255,255,0.85)), #e7ecf3; }

/* ---------- auth ---------- */
.auth-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 16px; gap: 18px; }
.auth-brand { text-align: center; }
.auth-logo { width: 72px; height: 72px; border-radius: 18px; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.auth-brand h1 { font-size: 32px; margin-top: 10px; }
.auth-brand p { color: var(--text-2); margin-top: 2px; }
.auth-card { width: 100%; max-width: 440px; padding: 24px; box-shadow: var(--shadow); }
.auth-card h2 { margin-bottom: 6px; }
.auth-foot { display: flex; align-items: center; gap: 14px; }
.setup-opts { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.setup-opt { display: flex; gap: 14px; align-items: flex-start; padding: 15px; border-radius: 12px; border: 1px solid var(--inner-border); background: var(--inner-bg); text-align: left; cursor: pointer; }
.setup-opt:hover { border-color: rgba(var(--acc-rgb),0.5); }
.setup-opt > .ic { width: 26px; height: 26px; color: var(--acc); margin-top: 2px; }
.setup-opt b { display: block; color: var(--text-strong); }
.setup-opt span { font-size: 13.5px; color: var(--text-2); }

/* ---------- modal ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(4,7,12,0.72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { width: 100%; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 16px; box-shadow: var(--shadow);
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
body.theme-glass .modal { background: rgba(22,27,34,0.92); }
body.theme-light-glass .modal { background: rgba(255,255,255,0.94); }
.modal-sm { max-width: 420px; } .modal-md { max-width: 560px; } .modal-lg { max-width: 780px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--card-border); }
.modal-head .ic { color: var(--acc); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--card-border); }

/* ---------- toast ---------- */
#toast-root { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; width: min(520px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 13px 14px; border-radius: 12px; border: 1px solid; box-shadow: var(--shadow); font-weight: 600; font-size: 14px; animation: slideIn .2s ease; color: #f3f4f6; }
.toast > span { flex: 1; }
.toast button { background: none; border: none; color: inherit; opacity: .6; cursor: pointer; padding: 0; }
.toast-error { background: #2a0f0f; border-color: rgba(224,87,79,0.5); } .toast-error > .ic { color: #ef847d; }
.toast-success { background: #0b2017; border-color: rgba(16,185,129,0.5); } .toast-success > .ic { color: #34d399; }
.toast-warning { background: #261d09; border-color: rgba(224,179,65,0.5); } .toast-warning > .ic { color: #e0b341; }
.toast-info { background: #0f1830; border-color: rgba(91,140,255,0.5); } .toast-info > .ic { color: #7ea3ff; }

/* ---------- what's new ---------- */
.wn-release + .wn-release { margin-top: 18px; }
.wn-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.wn-release ul { margin: 0; padding-left: 20px; } .wn-release li { margin: 5px 0; font-size: 14px; }

/* ======================= RESPONSIVE ======================= */
@media (max-width: 1020px) {
    .log-row { grid-template-columns: 120px minmax(150px,1.8fr) minmax(110px,1fr) 80px 120px; }
}
@media (max-width: 860px) {
    #sidebar { display: none; }
    #topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; z-index: 30;
        padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: var(--sidebar-bg); border-bottom: 1px solid var(--sidebar-border);
        backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
    .topbar-title { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--text-strong); }
    .topbar-logo { width: 30px; height: 30px; border-radius: 8px; }
    .topbar-right { display: flex; align-items: center; gap: 6px; }
    #view { padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); gap: 14px; }
    #bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--sidebar-bg); border-top: 1px solid var(--sidebar-border);
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
    body.theme-glass #bottom-nav, body.theme-glass #topbar { background: rgba(16,20,27,0.9); }
    body.theme-light-glass #bottom-nav, body.theme-light-glass #topbar { background: rgba(255,255,255,0.9); }
    .bn-item { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 4px; border: none; background: none; color: var(--text-3); font-size: 11px; font-weight: 700; border-radius: 10px; cursor: pointer; }
    .bn-item .ic { width: 23px; height: 23px; }
    .bn-item.active { color: var(--acc); background: rgba(var(--acc-rgb),0.1); }
    .bn-item .nav-badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; height: 17px; font-size: 10px; padding: 0 4px; }
    h1 { font-size: 22px; }
    .card { padding: 15px; }
    .grid-2 { grid-template-columns: 1fr; }
    .stat-row-4 { grid-template-columns: 1fr 1fr; }
    .trk-actions { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .trk-actions .btn-soft { flex-direction: column; gap: 4px; padding: 10px 6px; font-size: 13px; min-height: 64px; }
    .trk-actions .btn-danger { grid-column: 1 / -1; }
    .trk-grid { grid-template-columns: 1fr; }
    .trk-clock { font-size: 40px; }
    .log-head { display: none !important; }
    .log-row { grid-template-columns: 1fr auto; grid-template-areas: "plod status" "user dur" "date date"; gap: 4px 12px; padding: 13px 15px; }
    .log-row .c-plod { grid-area: plod; } .log-row .c-status { grid-area: status; justify-self: end; }
    .log-row .c-user { grid-area: user; font-size: 13.5px; color: var(--text-2); } .log-row .c-dur { grid-area: dur; justify-self: end; }
    .log-row .c-date { grid-area: date; font-size: 12.5px; color: var(--text-2); }
    .info-grid { grid-template-columns: 1fr 1fr; }
    .hide-sm { display: none; }
    #toast-root { bottom: calc(84px + env(safe-area-inset-bottom)); }
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal { border-radius: 18px 18px 0 0; max-height: 92vh; padding-bottom: env(safe-area-inset-bottom); }
    .modal-md, .modal-lg, .modal-sm { max-width: 100%; }
}
@media (max-width: 520px) {
    .grid2 { grid-template-columns: 1fr; }
    .grid3 { grid-template-columns: 1fr 1fr; }
    .item-use span { display: none; }
    .signoff-grid { grid-template-columns: 1fr; }
    .plod-tiles { grid-template-columns: 1fr 1fr; }
    .trk-top { flex-direction: column; }
    .trk-clock-wrap { text-align: left; }
    .data-input input { width: 96px; }
    .data-input .unit { width: 48px; }
    .shift-chip { width: 100%; }
    .page-head { align-items: stretch; }
    .modal-foot .btn { flex: 1; }
    .modal-foot .mr-auto { flex: 0 0 auto; }
}
@media print { #sidebar, #bottom-nav, #topbar { display: none !important; } }

/* ---------- shared device chip (login) ---------- */
.device-chip { display: inline-flex; align-items: center; gap: 7px; margin: 4px 0 12px; padding: 6px 11px; border-radius: 20px; font-size: 13px;
    background: rgba(var(--vein-rgb),0.12); border: 1px solid rgba(var(--vein-rgb),0.3); color: var(--text); }
.device-chip .ic { width: 15px; height: 15px; color: var(--vein); }
.p-4 { padding: 16px; }

/* v2.1: somebody on a task who isn't signed off for the plod it runs. Amber like a clash,
   dashed rather than solid so the two are told apart at a glance. */
.tsk.unqual { border-color: var(--caution); border-style: dashed; background: rgba(var(--caution-rgb),0.12); }
.tsk.unqual .tsk-name svg:last-child { color: var(--caution); }

/* ---------- v2.2: delays inside a running plod ----------
   The card turns amber while any delay is open. The clock is deliberately left alone —
   what the crew lost is recorded against the shift, not deducted from it. */
.tracker.running.delayed { border-color: rgba(var(--caution-rgb), 0.55); background:
    linear-gradient(180deg, rgba(var(--caution-rgb),0.10), transparent 120px), var(--card-bg); }
.live-tag.held { display: inline-flex; align-items: center; gap: 5px; color: var(--caution); }
.live-tag.held svg { width: 13px; height: 13px; }
.delay-live { border: 1px solid rgba(var(--caution-rgb),0.4); border-radius: 12px;
    background: rgba(var(--caution-rgb),0.08); padding: 10px 12px; }
.delay-row { display: flex; align-items: center; gap: 8px; }
.delay-row + .delay-row { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(var(--caution-rgb),0.25); }
.delay-mins { flex: 0 0 auto; font-weight: 800; color: var(--caution); font-size: 14px; }
.data-chip.delay { border-color: rgba(var(--caution-rgb),0.35); }
.data-chip.delay b { color: var(--caution); }
@media (max-width: 560px) {
    .delay-row { flex-wrap: wrap; row-gap: 6px; }
    .delay-row .grow { flex: 1 1 100%; }
}

.m-3 { margin: 12px; }

/* ---------- v2.3: the sign-off chain on a plod ----------
   Every tier shows, including the ones a plod doesn't need, so what it is waiting on is
   never a matter of inference. */
.chain { display: flex; flex-direction: column; gap: 2px; }
.chain-step { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 10px;
    border: 1px solid transparent; }
.chain-ic { flex: 0 0 auto; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--inner-bg); border: 1px solid var(--inner-border); color: var(--text-3); }
.chain-ic svg { width: 14px; height: 14px; }
.chain-step.done .chain-ic { background: rgba(var(--acc-rgb),0.15); border-color: rgba(var(--acc-rgb),0.4); color: var(--acc); }
.chain-step.now { background: rgba(var(--caution-rgb),0.08); border-color: rgba(var(--caution-rgb),0.35); }
.chain-step.now .chain-ic { background: rgba(var(--caution-rgb),0.16); border-color: rgba(var(--caution-rgb),0.4); color: var(--caution); }
.chain-step.na { opacity: .45; }
.chain-step.na .chain-ic { border-style: dashed; }

/* ---------- v2.4: the blast question ---------- */
.blast-ask { border: 1px solid var(--inner-border); border-radius: var(--radius); padding: 12px; background: var(--inner-bg); }
.blast-opts { display: grid; gap: 8px; margin-top: 6px; }
.blast-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 2px solid var(--input-border);
    border-radius: var(--radius); background: var(--input-bg); cursor: pointer; }
.blast-opt input { margin-top: 3px; flex: 0 0 auto; }
.blast-opt small { display: block; color: var(--text-2); font-weight: 500; margin-top: 2px; }
.blast-opt.on.ok { border-color: var(--acc); background: rgba(var(--acc-rgb),0.08); }
.blast-opt.on.bad { border-color: var(--hazard); background: rgba(var(--hazard-rgb),0.08); }
/* ---------- v2.4: the pops list ---------- */
.pops-row { border-left: 4px solid var(--hazard); }
.pops-row.recovering { border-left-color: var(--caution); }
.pops-why { color: var(--text-2); font-style: italic; }
.tab-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-flex; align-items: center;
    justify-content: center; background: var(--hazard); color: #fff; font-size: 11px; font-weight: 800; }

/* ---------- v2.6: the actuals board ----------
   One heading, two lanes: the plan above, what happened below. The pair is a grid row of
   its own so the two lanes always share the same columns and nothing can drift apart. */
.aboard { --slot-w: 20px; --lane-h: 34px; }
.aboard .slot { border-left: none; }
.aboard .slot.hr { border-left: 1px solid var(--inner-border); }
.board-row.arow { display: block; }
.alane { display: grid; grid-template-columns: var(--side-w) 1fr; align-items: stretch; position: relative; }
.alane + .alane { border-top: 1px dashed var(--inner-border); }
.alane .board-side { gap: 8px; }
.aside-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alane-tag { margin-left: auto; font-size: 8.5px; font-weight: 800; letter-spacing: .06em;
    text-transform: uppercase; color: var(--text-3); }
.alane-tag.act { color: var(--acc); }
.aboard .board-lanes { gap: 3px 0; padding: 3px 0; }

.abar { position: relative; z-index: 2; margin: 0 1px; display: flex; flex-direction: column; justify-content: center;
    min-width: 0; padding: 3px 6px; border-radius: 7px; text-align: left; cursor: pointer; overflow: hidden; }
.abar-name { display: flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; line-height: 1.15;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.abar-name svg { width: 12px; height: 12px; flex: 0 0 auto; }
.abar.narrow { padding: 3px 3px; }
.abar.narrow .abar-sub { display: none; }
.abar.narrow .abar-name { font-size: 10.5px; }
.abar-sub { font-size: 9.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the plan: outlined, so it reads as the intention rather than the record */
.abar.plan { border: 1px dashed var(--input-border); background: transparent; color: var(--text-2); }
.abar.plan.fires { border-color: rgba(220,80,70,0.5); }
.abar.plan.fires svg:first-child { color: var(--hazard); }
.abar.plan.miss { border-color: var(--caution); border-style: solid; background: rgba(var(--caution-rgb),0.14); color: var(--text-strong); }
/* the actual: solid, because it happened */
.abar.act { border: 1px solid rgba(var(--acc-rgb),0.55); background: rgba(var(--acc-rgb),0.2); color: var(--text-strong); }
.abar.act:hover { background: rgba(var(--acc-rgb),0.3); }
.abar.act.late { border-color: var(--caution); background: rgba(var(--caution-rgb),0.2); }
.abar.act.off { border-style: dashed; border-color: var(--text-3); background: rgba(127,127,127,0.14); }
.abar.act.run { border-color: var(--acc); background: rgba(var(--acc-rgb),0.34); animation: abar-pulse 2.4s ease-in-out infinite; }
@keyframes abar-pulse { 0%,100% { opacity: 1 } 50% { opacity: .72 } }

/* the current time, on the actual lane of every row */
.now-line { position: absolute; top: -3px; bottom: -3px; width: 2px; z-index: 6; background: var(--hazard);
    pointer-events: none; box-shadow: 0 0 0 1px rgba(0,0,0,0.12); }
.now-line::before { content: ''; position: absolute; left: -3px; top: -2px; width: 8px; height: 8px;
    border-radius: 50%; background: var(--hazard); }

.aboard-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 8px 14px;
    border-top: 1px solid var(--inner-border); font-size: 11px; color: var(--text-2); }
.aboard-legend span { display: flex; align-items: center; gap: 5px; }
.aboard-legend .key { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.key.plan { border: 1px dashed var(--input-border); }
.key.act { border: 1px solid rgba(var(--acc-rgb),0.55); background: rgba(var(--acc-rgb),0.2); }
.key.run { border: 1px solid var(--acc); background: rgba(var(--acc-rgb),0.34); }
.key.late { border: 1px solid var(--caution); background: rgba(var(--caution-rgb),0.2); }
.key.off { border: 1px dashed var(--text-3); background: rgba(127,127,127,0.14); }
.key.miss { border: 1px solid var(--caution); background: rgba(var(--caution-rgb),0.14); }

/* ---------- v2.7: in-cycle / ad-hoc choice, and the ad-hoc bar ---------- */
.seg { display: grid; gap: 8px; margin-top: 6px; }
.seg-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 2px solid var(--input-border);
    border-radius: var(--radius); background: var(--input-bg); cursor: pointer; }
.seg-opt input { margin-top: 3px; flex: 0 0 auto; }
.seg-opt small { display: block; color: var(--text-2); font-weight: 500; margin-top: 2px; }
.seg-opt:has(input:checked) { border-color: var(--acc); background: rgba(var(--acc-rgb),0.08); }
@media (min-width: 620px) { .seg { grid-template-columns: 1fr 1fr; } }

.tsk.adhoc { border-style: dashed; border-color: var(--text-3); background: rgba(127,127,127,0.14); }
.tsk.adhoc:hover { background: rgba(127,127,127,0.22); }
.badge-nondev { background: rgba(127,127,127,0.18); color: var(--text-2); }
/* an empty stretch of a heading row invites a task */
.board-lanes.addable { cursor: copy; }
.slot.addhint { background: rgba(var(--acc-rgb), 0.10); }
.or-line { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px; color: var(--text-3); font-size: 11px;
    text-transform: uppercase; letter-spacing: .06em; }
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: var(--inner-border); }
.span2 { grid-column: 1 / -1; }

/* ---------- v2.8: rehab ---------- */
.kv-task { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; }
.rehab-tick { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); cursor: pointer; }
.rehab-tick.off { opacity: .4; cursor: not-allowed; }
.rehab-tick input { margin: 0; }
/* a rehab bar: striped, so it never reads as new ground at a glance */
.tsk.rehab, .abar.act.rehab {
    background-image: repeating-linear-gradient(135deg, rgba(127,127,127,0.16) 0 6px, transparent 6px 12px);
}
.tsk.rehab { border-style: dotted; }
.warn-text { color: var(--caution); font-weight: 700; }

/* ----- v3.0: planning by department ----- */
.dept-switch { display: flex; align-items: center; gap: 8px; }
.dept-switch select { min-width: 160px; }
/* another department's work: shown for context and clashes, never draggable here */
.cyc.foreign, .tsk.foreign { border-style: dotted; background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(127,127,127,0.12) 6px 12px); color: var(--text-2); cursor: default; }
.cyc.foreign:hover, .tsk.foreign:hover { opacity: .9; }
.dept-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; opacity: .75; margin-left: 4px; }
.cyc.clash { border-color: var(--caution); box-shadow: inset 0 0 0 1px var(--caution); }
.cyc.clash .cyc-name svg { color: var(--caution); }

/* ----- v3.2: the capture board ----- */
.btn-xs { padding: 4px 7px; font-size: 12px; min-height: 0; }
.btn-xs svg { width: 15px; height: 15px; margin: 0; }
.cap-board { min-width: 980px; }
.cap-row { display: grid; grid-template-columns: 270px 1fr; border-bottom: 1px solid var(--line); }
.cap-head { position: sticky; top: 0; z-index: 4; background: var(--card-bg); }
.cap-side { padding: 8px 10px; border-right: 1px solid var(--line); min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cap-title { display: flex; align-items: center; gap: 4px; min-width: 0; }
.cap-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cap-sub { display: flex; gap: 6px; align-items: center; }
.cap-ctl { display: flex; align-items: center; gap: 6px; }
.cap-op { flex: 1; min-width: 0; padding: 3px 6px; font-size: 12.5px; }
.cap-btns { display: flex; gap: 4px; flex-shrink: 0; }
.cap-hours { display: grid; grid-template-columns: repeat(12, 1fr); }
.cap-hour { font-size: 11px; color: var(--text-3); padding: 6px 4px; border-left: 1px solid var(--line); }
.cap-lane { position: relative; display: grid; grid-template-columns: repeat(48, 1fr); min-height: 64px; cursor: crosshair; touch-action: none; user-select: none; }
.cap-cell { border-left: 1px solid rgba(127,127,127,0.10); }
.cap-cell.hr { border-left-color: var(--line); }
.cap-lane > div:not(.cap-cell) { position: absolute; pointer-events: none; }
.cap-plan { top: 6px; height: 7px; border-radius: 4px; background: rgba(var(--acc-rgb, 59,130,246),0.30); border: 1px solid rgba(var(--acc-rgb, 59,130,246),0.6); }
.cap-work { top: 20px; height: 28px; border-radius: 5px; background: var(--good, #16a34a); opacity: .85; }
.cap-work.running { background: var(--acc, #2563eb); }
.cap-work.draft { background: repeating-linear-gradient(135deg, var(--good, #16a34a) 0 8px, rgba(22,163,74,0.55) 8px 16px); }
.cap-pause { top: 20px; height: 28px; border-radius: 5px; background: repeating-linear-gradient(135deg, var(--caution) 0 6px, rgba(var(--caution-rgb),0.45) 6px 12px); }
.cap-delay { top: 50px; height: 6px; border-radius: 3px; background: var(--caution); }
.cap-sel { top: 16px; height: 36px; border-radius: 5px; background: rgba(37,99,235,0.18); border: 2px dashed var(--acc, #2563eb); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; color: var(--acc, #2563eb); }
.cap-row.st-done .cap-side { opacity: .8; }
.cap-row.foreign .cap-side { background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(127,127,127,0.06) 6px 12px); }
.cap-row .now-line { top: 0; bottom: 0; }

/* v4.2.1: the testing site (testing--jupbuddy.netlify.app) is marked, so nobody captures real plods there */
html.test-site body { border-top: 26px solid #b45309; }
html.test-site body::before {
  content: 'TEST SITE · resets from live nightly at 02:00';
  position: fixed; top: 0; left: 0; right: 0; height: 26px; z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  background: #b45309; color: #fff; font: 600 12px/1 system-ui, sans-serif;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
