/* =====================================================================
   Pixel Speed Staff Portal
   Charcoal base · Pixel Speed red for actions · brand blue for "draft"
   Barlow (text) + Barlow Semi Condensed (times, headings, numbers)
   ===================================================================== */

@font-face { font-family: "Barlow"; src: url("../fonts/barlow-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Barlow Semi Condensed"; src: url("../fonts/barlow-semi-condensed-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow Semi Condensed"; src: url("../fonts/barlow-semi-condensed-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow Semi Condensed"; src: url("../fonts/barlow-semi-condensed-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #17181b;
  --surface: #202126;
  --surface-2: #292a30;
  --surface-3: #33343b;
  --line: #3a3b42;
  --line-soft: #2d2e34;
  --text: #f3f3f4;
  --text-2: #c9cacf;
  --muted: #9a9ca4;
  --red: #e2121b;
  --red-hot: #ff3b42;
  --red-soft: rgba(226, 18, 27, .14);
  --blue: #3a9ad6;
  --blue-soft: rgba(58, 154, 214, .16);
  --ok: #3cc48a;
  --ok-soft: rgba(60, 196, 138, .14);
  --warn: #f0a63a;
  --warn-soft: rgba(240, 166, 58, .15);
  --bad: #ff5a5f;
  --bad-soft: rgba(255, 90, 95, .14);

  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-c: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;

  --r-card: 14px;
  --r-ctl: 9px;
  --r-chip: 6px;
  --tap: 44px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/1.5 var(--font); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--text); text-decoration-color: rgba(255,255,255,.35); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--red-hot); }
h1, h2, h3 { font-family: var(--font-c); font-weight: 700; line-height: 1.15; margin: 0 0 .5em; letter-spacing: .005em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
hr { border: 0; border-top: 1px solid var(--line-soft); margin: 1.25rem 0; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------------------------------------------------------- icons */
.ico { width: 22px; height: 22px; flex: none; }

/* ---------------------------------------------------------- brand */
.brand-logo.brand-sm { height: 26px; width: auto; }
.brand-logo.brand-lg { width: min(340px, 82vw); height: auto; margin: 0 auto; }
.brand-text { font-family: var(--font-c); font-weight: 700; font-style: italic; letter-spacing: .01em; display: inline-flex; gap: .28em; align-items: baseline; }
.brand-text .bt-a { color: var(--blue); }
.brand-text .bt-b { color: var(--red); }
.brand-text .bt-c { color: var(--muted); font-style: normal; font-weight: 600; font-size: .62em; }
.brand-text.brand-sm { font-size: 1.35rem; }
.brand-text.brand-lg { font-size: 2.6rem; justify-content: center; display: flex; }

/* ---------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1rem; background: rgba(23,24,27,.94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-brand { display: flex; align-items: center; text-decoration: none; flex: none; }
.topnav { display: none; gap: .15rem; flex: 1; overflow-x: auto; scrollbar-width: none; }
.topnav a {
  text-decoration: none; color: var(--text-2); padding: .45rem .7rem; border-radius: 8px;
  font-weight: 500; font-size: .95rem; white-space: nowrap; position: relative; display: inline-flex; align-items: center; gap: .4rem;
}
.topnav a:hover { background: var(--surface-2); color: var(--text); }
.topnav a.is-active { color: var(--text); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--red); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .25rem; }
.logout-form { display: none; margin: 0; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: var(--tap); height: var(--tap);
  border-radius: 10px; color: var(--text-2); background: none; border: 0; cursor: pointer;
}
.icon-btn:hover, .icon-btn.is-active { background: var(--surface-2); color: var(--text); }
.dot-count {
  position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font: 700 11px/18px var(--font); text-align: center;
}
.badge { display: inline-block; min-width: 20px; padding: 0 6px; height: 20px; line-height: 20px; border-radius: 10px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; text-align: center; }

/* ---------------------------------------------------------- bottom nav (mobile) */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: #1c1d21; border-top: 1px solid var(--line-soft);
}
.bottomnav a, .bottomnav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font: 500 11.5px/1 var(--font); position: relative;
  background: none; border: 0; cursor: pointer; min-width: 0;
}
.bottomnav a span:not(.dot-count), .bottomnav button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bottomnav a.is-active { color: var(--text); }
.bottomnav a.is-active .ico { color: var(--red); }
.bottomnav .dot-count { top: 6px; right: calc(50% - 22px); }
.has-nav .main { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 1.5rem); }

.sheet { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; }
.sheet-panel {
  width: 100%; background: var(--surface); border-radius: 18px 18px 0 0; padding: 1rem 1rem calc(1rem + var(--safe-b));
  border-top: 1px solid var(--line); max-height: 85vh; overflow-y: auto;
}
.sheet-who { color: var(--muted); font-size: .9rem; margin: .25rem .25rem .75rem; }
.sheet-link {
  display: flex; align-items: center; gap: .8rem; width: 100%; min-height: 52px; padding: 0 .6rem;
  color: var(--text); text-decoration: none; font: 500 1.02rem var(--font); background: none; border: 0;
  border-radius: 10px; cursor: pointer; text-align: left;
}
.sheet-link:hover { background: var(--surface-2); }
.sheet-link .badge { margin-left: auto; }
.sheet form { margin: 0; }

@media (min-width: 960px) {
  .topnav { display: flex; }
  .logout-form { display: block; }
  .bottomnav, .sheet { display: none !important; }
  .has-nav .main { padding-bottom: 3rem; }
}

/* ---------------------------------------------------------- layout */
.main { max-width: 1080px; margin: 0 auto; padding: 1.25rem 1rem; }
.main-wide { max-width: 1480px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin: .25rem 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.panel { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-card); padding: 1.1rem; margin-bottom: 1rem; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.panel-head h2 { margin: 0; font-size: 1.15rem; }
.panel-head a { font-size: .92rem; color: var(--text-2); }
.panel.narrow { max-width: 560px; }
.panel.attention { border-color: rgba(226,18,27,.5); background: linear-gradient(0deg, var(--red-soft), var(--red-soft)), var(--surface); }
.grid-2 { display: grid; gap: 1rem; }
@media (min-width: 820px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-2 > .panel { margin-bottom: 0; } .grid-2 { margin-bottom: 1rem; } }
.empty { color: var(--muted); padding: .75rem 0; margin: 0; }

/* ---------------------------------------------------------- stats */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .65rem; margin-bottom: 1rem; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }
.stat {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: 12px; padding: .8rem .9rem;
  text-decoration: none; display: block; min-height: 84px;
}
a.stat:hover { border-color: var(--line); background: var(--surface-2); }
.stat-num { font: 700 2rem/1 var(--font-c); display: block; }
.stat-label { color: var(--muted); font-size: .88rem; display: block; margin-top: .35rem; }
.stat.hot .stat-num { color: var(--red-hot); }
.stats-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 420px) { .stats-3 .stat { padding: .7rem .65rem; } .stats-3 .stat-num { font-size: 1.7rem; } .stats-3 .stat-label { font-size: .8rem; line-height: 1.3; } }

/* ---------------------------------------------------------- the "next shift" card */
.next-shift {
  display: grid; gap: .25rem; padding: 1.15rem 1.2rem; border-radius: var(--r-card); margin-bottom: 1rem;
  background: var(--surface); border: 1px solid var(--line-soft); border-left: 4px solid var(--red);
}
.next-shift .when { font: 700 1.9rem/1.05 var(--font-c); }
.next-shift .day { color: var(--text-2); font-size: 1.05rem; font-weight: 500; }
.next-shift .rel { color: var(--muted); font-size: .9rem; }
.welcome { font: 700 1.9rem/1.1 var(--font-c); margin: .25rem 0 1rem; }

/* ---------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: var(--tap);
  padding: 0 1rem; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font: 600 .95rem var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: #f01f28; }
.btn-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-blue:hover { background: #4aa8e3; }
.btn-ok { background: #1f8a5c; border-color: #1f8a5c; color: #fff; }
.btn-ok:hover { background: #26a06c; }
.btn-danger { background: transparent; border-color: rgba(255,90,95,.55); color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { min-height: 36px; padding: 0 .7rem; font-size: .88rem; }
.btn-lg { min-height: 52px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.linklike { background: none; border: 0; color: var(--text-2); text-decoration: underline; cursor: pointer; font: inherit; padding: .25rem; }
.inline-form { display: inline; margin: 0; }

/* ---------------------------------------------------------- forms */
.field { display: block; margin-bottom: .95rem; }
.field > span { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .35rem; color: var(--text-2); }
.hint { display: block; color: var(--muted); font-size: .83rem; margin-top: .3rem; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], input[type=email], input:not([type]), select, textarea {
  width: 100%; min-height: var(--tap); padding: .55rem .75rem; border-radius: var(--r-ctl);
  border: 1px solid var(--line); background: #1a1b1f; color: var(--text); font: 400 1rem var(--font);
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
input[type=color] { width: 56px; height: var(--tap); padding: 3px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: #1a1b1f; }
::-webkit-calendar-picker-indicator { filter: invert(.85); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
@media (max-width: 480px) { .row-3 { grid-template-columns: 1fr 1fr; } }
.check { display: flex; gap: .6rem; align-items: flex-start; margin-bottom: .8rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--red); flex: none; }
.form-error { background: var(--bad-soft); border: 1px solid rgba(255,90,95,.4); color: #ffd3d4; padding: .65rem .8rem; border-radius: var(--r-ctl); }
.form-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .5rem; }

/* Segmented control (radio buttons styled as tabs) */
.seg { display: flex; background: #1a1b1f; border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 3px; margin-bottom: 1rem; }
.seg label, .seg a { flex: 1; text-align: center; cursor: pointer; text-decoration: none; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span, .seg a { white-space: nowrap; display: block; padding: .6rem .4rem; border-radius: 8px; font-weight: 600; font-size: .93rem; color: var(--text-2); }
.seg input:checked + span, .seg a.is-active { background: var(--surface-3); color: var(--text); box-shadow: inset 0 -2px 0 var(--red); }
.seg input:focus-visible + span { outline: 2px solid var(--blue); }

/* ---------------------------------------------------------- flash & pills */
.flash { display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; border-radius: var(--r-ctl); margin-bottom: 1rem; border: 1px solid var(--line); background: var(--surface-2); }
.flash span { flex: 1; }
.flash-ok { border-color: rgba(60,196,138,.45); background: var(--ok-soft); }
.flash-error { border-color: rgba(255,90,95,.45); background: var(--bad-soft); }
.flash-warn { border-color: rgba(240,166,58,.45); background: var(--warn-soft); }
.flash-x { background: none; border: 0; color: var(--text-2); font-size: 1.4rem; cursor: pointer; width: 32px; height: 32px; }
.pill { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.pill-ok { background: var(--ok-soft); color: #8ae6bd; }
.pill-pending { background: var(--warn-soft); color: #ffd08a; }
.pill-bad { background: var(--bad-soft); color: #ffb0b3; }
.pill-muted { background: var(--surface-3); color: var(--muted); }
.pill-draft { background: var(--blue-soft); color: #9fd2f2; }
.person { display: inline-flex; align-items: center; gap: .45rem; }
.swatch { width: 11px; height: 11px; border-radius: 3px; background: var(--c, #888); flex: none; }

/* ---------------------------------------------------------- lists & tables */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: .8rem 0; border-top: 1px solid var(--line-soft); display: flex; gap: .75rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 200px; }
.list .title { font-weight: 600; }
.list .meta { color: var(--muted); font-size: .88rem; }
.note-box { background: #1a1b1f; border-left: 3px solid var(--line); padding: .45rem .7rem; border-radius: 4px; color: var(--text-2); font-size: .92rem; margin: .4rem 0 0; white-space: pre-wrap; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .85rem; padding: .5rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .65rem .6rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-inactive td { color: var(--muted); }
@media (max-width: 640px) {
  .table.stack thead { display: none; }
  .table.stack tr { display: block; padding: .6rem 0; border-bottom: 1px solid var(--line-soft); }
  .table.stack td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .25rem 0; }
  .table.stack td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; }
  .table.stack td.td-main { font-weight: 600; font-size: 1.02rem; }
  .table.stack td.td-main::before { content: none; }
}

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: .7rem .9rem; text-decoration: none; color: var(--text-2); font-weight: 600; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: .45rem; align-items: center; }
.tabs a.is-active { color: var(--text); border-bottom-color: var(--red); }

/* ---------------------------------------------------------- shift rows */
.shift-row { display: flex; align-items: center; gap: .8rem; padding: .7rem 0; border-top: 1px solid var(--line-soft); }
.shift-row:first-child { border-top: 0; }
.shift-row .date-badge { width: 54px; flex: none; text-align: center; background: var(--surface-2); border-radius: 10px; padding: .35rem 0; }
.date-badge .dw { display: block; font-size: .75rem; color: var(--muted); font-weight: 600; }
.date-badge .dn { display: block; font: 700 1.35rem/1.1 var(--font-c); }
.shift-row .times { font: 600 1.1rem var(--font-c); }
.shift-row .len { color: var(--muted); font-size: .88rem; }

/* ---------------------------------------------------------- auth */
.is-bare .main { max-width: 480px; padding-top: 2.5rem; }
.auth { display: grid; gap: 1.5rem; }
.auth-brand { text-align: center; padding: .5rem 0; }
.auth-card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 16px; padding: 1.4rem 1.25rem; }
.auth-card h1 { font-size: 1.5rem; }

/* ---------------------------------------------------------- closed banner */
.closed-tag { display: inline-flex; align-items: center; gap: .4rem; font: 700 .82rem var(--font-c); letter-spacing: .03em; color: #ffb0b3; background: var(--bad-soft); border-radius: 5px; padding: .15rem .45rem; }
.special-tag { display: inline-block; font: 600 .78rem var(--font); color: #ffd08a; background: var(--warn-soft); border-radius: 5px; padding: .1rem .4rem; }

/* =====================================================================
   Calendar
   ===================================================================== */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .9rem; }
.cal-nav { display: flex; align-items: center; gap: .25rem; }
.cal-nav .btn { min-width: var(--tap); padding: 0 .55rem; }
.cal-title { font: 700 1.3rem var(--font-c); margin: 0 .35rem; min-width: 10ch; }
.cal-toolbar .seg { margin: 0; min-width: 240px; }
.cal-toolbar .spacer { flex: 1; }
.cal-legend { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .85rem; color: var(--text-2); margin: 0 0 .9rem; }
.cal-loading { opacity: .5; pointer-events: none; }

/* Month */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line-soft); border-radius: var(--r-card); overflow: hidden; background: var(--line-soft); gap: 1px; }
.month-dow { background: var(--surface); text-align: center; font: 600 .78rem var(--font); color: var(--muted); padding: .45rem 0; }
.mday { background: var(--surface); min-height: 64px; padding: .3rem; display: flex; flex-direction: column; gap: 2px; cursor: pointer; border: 0; color: inherit; text-align: left; font: inherit; min-width: 0; }
.mday:hover { background: var(--surface-2); }
.mday.is-out { background: #1c1d21; color: var(--muted); }
.mday.is-today .mnum { background: var(--red); color: #fff; }
.mday.is-closed { background: repeating-linear-gradient(135deg, #24191b 0 6px, #201618 6px 12px); }
.mnum { font: 700 .92rem/1 var(--font-c); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.mdots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; }
.mdot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.mdot.is-draft { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c); }
.mtag { font-size: .68rem; font-weight: 700; line-height: 1.2; color: #ffb0b3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtag.off { color: var(--muted); font-weight: 500; }
.mname { display: none; }
@media (min-width: 760px) {
  .mday { min-height: 108px; padding: .4rem; }
  .mdots { display: none; }
  .mname { display: flex; align-items: center; gap: 4px; font-size: .78rem; line-height: 1.25; overflow: hidden; white-space: nowrap; color: var(--text-2); }
  .mname .swatch { width: 8px; height: 8px; }
  .mname.is-draft { color: #9fd2f2; }
  .mname b { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
  .mtag { font-size: .74rem; }
}

/* Week: list on phones, 7 columns on desktop */
.week { display: grid; gap: .6rem; }
.wday { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 12px; padding: .7rem .8rem; }
.wday.is-today { border-color: rgba(226,18,27,.55); }
.wday.is-closed { background: repeating-linear-gradient(135deg, #24191b 0 8px, #201618 8px 16px); }
.wday-head { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .45rem; flex-wrap: wrap; }
.wday-head button { background: none; border: 0; color: var(--text); font: 700 1.05rem var(--font-c); padding: 0; cursor: pointer; text-decoration: underline; text-decoration-color: transparent; }
.wday-head button:hover { text-decoration-color: var(--red); }
.wday-head .hrs { color: var(--muted); font-size: .82rem; margin-left: auto; }
.wshift { display: flex; align-items: center; gap: .55rem; padding: .4rem .5rem; border-radius: var(--r-chip); background: var(--surface-2); margin-top: 4px; border-left: 3px solid var(--c); }
.wshift .who { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wshift .t { font: 600 .95rem var(--font-c); white-space: nowrap; color: var(--text-2); }
.wshift.is-mine { background: #33292b; }
.wshift.is-draft { border-left-style: dashed; background: var(--blue-soft); }
.woff { font-size: .84rem; color: var(--muted); margin-top: 4px; padding-left: .5rem; }
.wempty { color: var(--muted); font-size: .88rem; }
@media (min-width: 900px) {
  .week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .45rem; }
  .wday { padding: .55rem; min-height: 220px; }
  .wday-head { flex-direction: column; gap: 0; }
  .wday-head .hrs { margin-left: 0; }
  .wshift { flex-direction: column; align-items: flex-start; gap: 0; padding: .35rem .45rem; }
  .wshift .who { width: 100%; font-size: .9rem; }
  .wshift .t { font-size: .88rem; }
}

/* Day: timing-board timeline */
.dayview { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-card); padding: 1rem; }
.day-status { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin-bottom: 1rem; }
.day-status .hours { font: 600 1.05rem var(--font-c); }
.closed-banner { font: 700 1.5rem var(--font-c); color: #ffb0b3; background: var(--bad-soft); border: 1px solid rgba(255,90,95,.35); border-radius: 12px; padding: 1rem; text-align: center; margin-bottom: 1rem; letter-spacing: .02em; }
.tl { position: relative; }
.tl-scale { position: relative; height: 18px; margin-left: var(--lane-label, 0); font: 600 .72rem var(--font-c); color: var(--muted); }
.tl-scale span { position: absolute; transform: translateX(-50%); }
.tl-row { display: grid; grid-template-columns: 1fr; gap: 2px; padding: .45rem 0; border-top: 1px solid var(--line-soft); }
.tl-label { display: flex; align-items: baseline; gap: .5rem; font-weight: 600; }
.tl-label .t { font: 600 .95rem var(--font-c); color: var(--text-2); margin-left: auto; }
.tl-track { position: relative; height: 18px; background: #1a1b1f; border-radius: 5px; overflow: hidden; }
.tl-open { position: absolute; top: 0; bottom: 0; background: rgba(255,255,255,.045); }
.tl-bar { position: absolute; top: 2px; bottom: 2px; border-radius: 4px; background: var(--c); }
.tl-bar.is-draft { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
.tl-bar.is-off { background: repeating-linear-gradient(135deg, rgba(255,255,255,.18) 0 4px, transparent 4px 8px); }
.tl-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,.06); }
@media (min-width: 700px) {
  .tl { --lane-label: 220px; }
  .tl-row { grid-template-columns: 220px 1fr; align-items: center; gap: 0; }
  .tl-label { padding-right: .9rem; }
  .tl-track { height: 26px; }
}

/* Coverage strip — the race "sector" bar: each segment is a stretch of the
   day, red when fewer people are on duty than needed. */
.cov { display: flex; height: 10px; border-radius: 3px; overflow: hidden; gap: 2px; background: transparent; }
.cov-seg { height: 100%; background: var(--ok); position: relative; min-width: 2px; }
.cov-seg.c-1 { background: #2a9b6b; }
.cov-seg.c-2 { background: var(--ok); }
.cov-seg.c-3 { background: #6be0ad; }
.cov-seg.under { background: var(--red); }
.cov-closed { height: 10px; border-radius: 3px; background: repeating-linear-gradient(135deg, #4a2427 0 4px, #2a1a1c 4px 8px); }
.cov-wrap { margin: .35rem 0 0; }
.cov-wrap.big .cov, .cov-wrap.big .cov-closed { height: 16px; }
.cov-legend { display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-size: .8rem; color: var(--muted); margin-top: .5rem; }
.cov-legend i { display: inline-block; width: 12px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }

/* =====================================================================
   Schedule builder
   ===================================================================== */
.builder-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: .9rem; }
.builder-bar .grow { flex: 1; }
.draft-status { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .75rem; border-radius: 999px; background: var(--surface-2); font-weight: 600; font-size: .9rem; }
.draft-status.has-changes { background: var(--blue-soft); color: #bfe3f8; }
.draft-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.draft-status.has-changes i { background: var(--blue); }

.bgrid-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--r-card); background: var(--surface); -webkit-overflow-scrolling: touch; }
.bgrid { display: grid; grid-template-columns: 148px repeat(7, minmax(132px, 1fr)); min-width: 1072px; }
.bgrid > div { border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); min-width: 0; }
.bgrid > div:nth-child(8n) { border-right: 0; }
.bh { padding: .55rem .55rem .5rem; background: #1d1e22; position: sticky; top: 0; }
.bh .d { font: 700 1rem var(--font-c); display: flex; justify-content: space-between; gap: .3rem; align-items: baseline; }
.bh .d small { font: 500 .78rem var(--font); color: var(--muted); }
.bh .h { font-size: .76rem; color: var(--muted); display: block; margin-top: 1px; }
.bh.is-today .d { color: var(--red-hot); }
.bh.is-closed { background: repeating-linear-gradient(135deg, #2a1b1d 0 6px, #24181a 6px 12px); }
.bname { padding: .55rem .6rem; position: sticky; left: 0; background: var(--surface); z-index: 2; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.bname .n { font-weight: 600; display: flex; align-items: center; gap: .4rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bname .hrs { font-size: .78rem; color: var(--muted); }
.bcorner { position: sticky; left: 0; z-index: 3; background: #1d1e22; padding: .55rem .6rem; font-size: .8rem; color: var(--muted); display: flex; align-items: flex-end; }
.bcell { padding: .35rem; display: flex; flex-direction: column; gap: 4px; min-height: 64px; }
.bcell.is-closed { background: repeating-linear-gradient(135deg, rgba(255,90,95,.05) 0 6px, transparent 6px 12px); }
.bcell.is-off::after { content: attr(data-off); font-size: .72rem; color: var(--warn); }
.chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0; width: 100%; text-align: left;
  padding: .3rem .45rem; border-radius: var(--r-chip); border: 0; border-left: 3px solid var(--c);
  background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit;
}
.chip:hover { background: var(--surface-3); }
.chip .t { font: 600 .92rem var(--font-c); }
.chip .s { font-size: .7rem; color: var(--muted); font-weight: 600; }
.chip.st-new, .chip.st-changed { background: var(--blue-soft); border-left-style: dashed; }
.chip.st-new .s, .chip.st-changed .s { color: #9fd2f2; }
.chip.st-deleted { opacity: .55; background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.chip.st-deleted .t { text-decoration: line-through; }
.chip.has-warn { box-shadow: inset 0 0 0 1px var(--warn); }
.add-btn {
  min-height: 30px; border-radius: var(--r-chip); border: 1px dashed var(--line); background: transparent;
  color: var(--muted); cursor: pointer; font: 600 .82rem var(--font); display: flex; align-items: center; justify-content: center; gap: .25rem;
}
.add-btn:hover { border-color: var(--red); color: var(--text); background: var(--red-soft); }
.add-btn .ico { width: 16px; height: 16px; }
.bfoot { padding: .45rem .5rem .55rem; background: #1d1e22; }
.bfoot .cnt { font-size: .76rem; color: var(--muted); display: flex; justify-content: space-between; }
.bfoot .cnt.bad { color: #ff9ea2; font-weight: 600; }

/* Month planner (builder) */
.mplan .mday { min-height: 78px; }
.mplan .mcount { font: 600 .8rem var(--font-c); color: var(--text-2); }
.mplan .mcount.bad { color: #ff9ea2; }

/* ---------------------------------------------------------- modal */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; }
.modal-card {
  width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px 18px 0 0; padding: 1.1rem 1.1rem calc(1.1rem + var(--safe-b));
}
@media (min-width: 640px) { .modal { align-items: center; } .modal-card { border-radius: 16px; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.modal-head h2 { margin: 0; font-size: 1.25rem; }
.tpl-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem; }
.tpl-chip { border: 1px solid var(--line); background: #1a1b1f; color: var(--text); border-radius: 999px; padding: .45rem .8rem; cursor: pointer; font: 600 .9rem var(--font); min-height: 40px; }
.tpl-chip small { color: var(--muted); font-weight: 500; margin-left: .3rem; }
.tpl-chip.is-on { border-color: var(--red); background: var(--red-soft); }
.daypick { display: flex; gap: .3rem; flex-wrap: wrap; }
.daypick label { cursor: pointer; }
.daypick input { position: absolute; opacity: 0; }
.daypick span { display: grid; place-items: center; width: 44px; height: 40px; border-radius: 8px; border: 1px solid var(--line); font: 600 .85rem var(--font); color: var(--text-2); }
.daypick input:checked + span { background: var(--surface-3); border-color: var(--red); color: var(--text); }
.daypick input:disabled + span { opacity: .35; }
.warn-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.warn-list li { padding: .6rem .75rem; border-radius: var(--r-ctl); background: var(--warn-soft); border: 1px solid rgba(240,166,58,.4); color: #ffe0b0; font-size: .93rem; }
.warn-list.block li { background: var(--bad-soft); border-color: rgba(255,90,95,.4); color: #ffd3d4; }
.modal-foot { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.modal-foot .grow { flex: 1; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 1rem); z-index: 90; background: var(--surface-3); border: 1px solid var(--line); padding: .7rem 1rem; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.4); font-weight: 500; max-width: 92vw; }
@media (min-width: 960px) { .toast { bottom: 1.5rem; } }

/* Notifications */
.notif { display: flex; gap: .8rem; padding: .85rem 0; border-top: 1px solid var(--line-soft); }
.notif:first-child { border-top: 0; }
.notif .mark { width: 9px; height: 9px; border-radius: 50%; margin-top: .45rem; background: transparent; flex: none; }
.notif.is-unread .mark { background: var(--red); }
.notif .grow { flex: 1; min-width: 0; }
.notif .t { font-weight: 600; }
.notif:not(.is-unread) .t { font-weight: 500; color: var(--text-2); }
.notif .b { color: var(--text-2); font-size: .92rem; }
.notif .w { color: var(--muted); font-size: .8rem; }

@media (prefers-reduced-motion: no-preference) {
  .sheet-panel, .modal-card { animation: rise .18s ease-out; }
  @keyframes rise { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }
}
@media print {
  .topbar, .bottomnav, .cal-toolbar .seg, .builder-bar { display: none !important; }
  body { background: #fff; color: #000; }
}
