/* ============================================================
   Escala 5x2 — design tokens
   ============================================================ */
:root {
  color-scheme: light;
  --bg: #eef3f5;
  --bg-glow: radial-gradient(1200px 500px at 15% -10%, #d8ecea 0%, transparent 60%),
             radial-gradient(900px 400px at 100% 0%, #e9f0f2 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f6f9fa;
  --surface-3: #eef4f6;
  --ink: #0d2730;
  --ink-2: #2c4b55;
  --muted: #657d86;
  --line: #dde7ea;
  --line-2: #c9d8dd;
  --brand: #0d7a75;
  --brand-strong: #0a5f5b;
  --brand-soft: #e2f2f0;
  --on-brand: #ffffff;
  --sand: #e39a3f;
  --danger: #b3352f;
  --danger-soft: #fde8e6;
  --warn: #8f6414;
  --ok: #12664a;
  --ok-soft: #e2f4ea;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(13, 39, 48, .06);
  --shadow: 0 1px 2px rgba(13, 39, 48, .05), 0 12px 28px -18px rgba(13, 39, 48, .35);
  --shadow-lg: 0 24px 60px -24px rgba(13, 39, 48, .45);
  --c-t-bg: #dff3e8; --c-t-ink: #12664a;
  --c-f-bg: #fdeec4; --c-f-ink: #7d5300;
  --c-fe-bg: #dbeeff; --c-fe-ink: #145d8a;
  --c-a-bg: #ece1fa; --c-a-ink: #5b3a8f;
  --c-fa-bg: #fde1df; --c-fa-ink: #a1332d;
  --c-u-bg: #edf1f3; --c-u-ink: #6a7c85;
  --focus: 0 0 0 3px rgba(13, 122, 117, .28);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1417;
  --bg-glow: radial-gradient(1000px 460px at 10% -10%, #10312f 0%, transparent 60%),
             radial-gradient(800px 400px at 100% 0%, #10222a 0%, transparent 55%);
  --surface: #111e22;
  --surface-2: #16262b;
  --surface-3: #1b2d33;
  --ink: #e6f1f2;
  --ink-2: #b9cdd2;
  --muted: #8ba2aa;
  --line: #22363d;
  --line-2: #2c464e;
  --brand: #35b3a9;
  --brand-strong: #59c9c0;
  --brand-soft: #14332f;
  --on-brand: #04211f;
  --sand: #e7b269;
  --danger: #e5766d;
  --danger-soft: #3a1d1b;
  --warn: #e2b55c;
  --ok: #63d3a4;
  --ok-soft: #12342a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 18px 36px -22px #000;
  --shadow-lg: 0 30px 70px -30px #000;
  --c-t-bg: #123b2d; --c-t-ink: #7fe0b0;
  --c-f-bg: #3c2f10; --c-f-ink: #f0c86a;
  --c-fe-bg: #10303f; --c-fe-ink: #8cc9ee;
  --c-a-bg: #2b2145; --c-a-ink: #c0a5f0;
  --c-fa-bg: #3d1f1d; --c-fa-ink: #f0a19a;
  --c-u-bg: #1a272c; --c-u-ink: #8ba2aa;
  --focus: 0 0 0 3px rgba(53, 179, 169, .35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1417;
    --bg-glow: radial-gradient(1000px 460px at 10% -10%, #10312f 0%, transparent 60%),
               radial-gradient(800px 400px at 100% 0%, #10222a 0%, transparent 55%);
    --surface: #111e22;
    --surface-2: #16262b;
    --surface-3: #1b2d33;
    --ink: #e6f1f2;
    --ink-2: #b9cdd2;
    --muted: #8ba2aa;
    --line: #22363d;
    --line-2: #2c464e;
    --brand: #35b3a9;
    --brand-strong: #59c9c0;
    --brand-soft: #14332f;
    --on-brand: #04211f;
    --sand: #e7b269;
    --danger: #e5766d;
    --danger-soft: #3a1d1b;
    --warn: #e2b55c;
    --ok: #63d3a4;
    --ok-soft: #12342a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 18px 36px -22px #000;
    --shadow-lg: 0 30px 70px -30px #000;
    --c-t-bg: #123b2d; --c-t-ink: #7fe0b0;
    --c-f-bg: #3c2f10; --c-f-ink: #f0c86a;
    --c-fe-bg: #10303f; --c-fe-ink: #8cc9ee;
    --c-a-bg: #2b2145; --c-a-ink: #c0a5f0;
    --c-fa-bg: #3d1f1d; --c-fa-ink: #f0a19a;
    --c-u-bg: #1a272c; --c-u-ink: #8ba2aa;
    --focus: 0 0 0 3px rgba(53, 179, 169, .35);
  }
}

/* ============================================================
   base
   ============================================================ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg-glow), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: .95rem; }
p { margin: 0 0 .5rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
a { color: var(--brand); }
code { background: var(--surface-3); padding: 1px 5px; border-radius: 5px; font-size: .85em; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.mt { margin-top: 16px; }
.text-bad { color: var(--danger); }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
::selection { background: color-mix(in srgb, var(--brand) 25%, transparent); }

button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
button { cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-weight: 550; font-size: .86rem; box-shadow: var(--shadow-sm);
  transition: background .15s ease, border-color .15s ease, transform .06s ease, color .15s ease;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: linear-gradient(180deg, var(--brand), var(--brand-strong)); border-color: transparent; color: var(--on-brand); box-shadow: 0 6px 16px -8px var(--brand); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); background: var(--danger-soft); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: .8rem; }
.icon-btn { padding: 0; width: 38px; min-width: 38px; }
.icon-btn.sm, .btn.sm.icon-btn { width: 32px; min-width: 32px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ============================================================
   appbar
   ============================================================ */
.appbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(14px, 3vw, 30px);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--brand); color: var(--brand); box-shadow: 0 8px 18px -10px var(--brand); }
.logo svg { width: 26px; height: 26px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 1.02rem; letter-spacing: -.02em; white-space: nowrap; }
.brand-text em { font-style: normal; color: var(--brand); }
.brand-text small { color: var(--muted); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-actions { display: flex; align-items: center; gap: 8px; }
.saved-pill { font-size: .74rem; color: var(--muted); padding: 0 4px; transition: color .2s; white-space: nowrap; }
.saved-pill.is-fresh { color: var(--ok); font-weight: 600; }
.divider { width: 1px; height: 26px; background: var(--line); }

/* ============================================================
   tabs + layout
   ============================================================ */
.tabs {
  position: sticky; top: 65px; z-index: 25;
  display: flex; gap: 4px; padding: 0 clamp(14px, 3vw, 30px);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: transparent; color: var(--muted);
  padding: 12px 12px 11px; font-size: .87rem; font-weight: 550;
  border-bottom: 2px solid transparent; border-radius: 0; white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.wrap { padding: 16px clamp(12px, 3vw, 30px) 60px; max-width: 1680px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }

.periodbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.nav-group { display: flex; align-items: center; gap: 7px; }
.period-label { display: flex; flex-direction: column; padding-left: 6px; line-height: 1.2; }
.period-label strong { font-size: .98rem; }
.period-label strong::first-letter { text-transform: uppercase; }
.period-label small { color: var(--muted); font-size: .74rem; }
.month-input, select, input[type="date"], input[type="number"], input[type="text"], input[type="search"], textarea {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 8px 10px; min-height: 38px; color: var(--ink);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
.segmented { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 7px; font-size: .82rem; font-weight: 550; }
.segmented button.on { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-sm); }
.segmented.full { display: flex; width: 100%; margin: 6px 0 14px; }
.segmented.full button { flex: 1; padding: 9px; }

/* ============================================================
   cards / stats
   ============================================================ */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.count { font-weight: 500; font-size: .78rem; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 14px; align-items: start; }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.stat::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--brand); opacity: .55; }
.stat.is-warn::after { background: var(--warn); }
.stat.is-bad::after { background: var(--danger); }
.stat.is-good::after { background: var(--ok); }
.stat-label { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat strong { font-size: 1.6rem; font-weight: 680; letter-spacing: -.03em; line-height: 1.1; }
.stat.is-warn strong { color: var(--warn); }
.stat.is-bad strong { color: var(--danger); }
.stat-sub { font-size: .74rem; color: var(--muted); }

/* ============================================================
   scale grid
   ============================================================ */
.grid-card { padding: 0; overflow: hidden; }
.grid-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.search { display: flex; align-items: center; gap: 8px; flex: 1 1 220px; max-width: 320px; position: relative; }
.search svg { position: absolute; left: 10px; width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; }
.search input { width: 100%; padding-left: 32px; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-actions select { min-height: 32px; padding: 4px 8px; font-size: .8rem; }

.table-scroll { overflow: auto; max-height: min(72vh, 760px); overscroll-behavior: contain; }
.grid { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
.grid th, .grid td { border-bottom: 1px solid var(--line); padding: 0; text-align: center; white-space: nowrap; }
.grid thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface-2); color: var(--muted);
  font-size: .72rem; font-weight: 600; padding: 6px 4px; height: 50px;
  border-bottom: 1px solid var(--line-2);
}
.grid .person-col, .grid .person-cell {
  position: sticky; left: 0; z-index: 2; background: var(--surface);
  text-align: left; min-width: 214px; max-width: 214px; padding: 0 10px;
  box-shadow: inset -1px 0 0 var(--line);
}
.grid thead .person-col { z-index: 4; background: var(--surface-2); }
.day-head { min-width: 47px; }
.dh-week { display: block; text-transform: uppercase; letter-spacing: .06em; font-size: .64rem; }
.dh-day { display: block; font-size: .92rem; font-weight: 650; color: var(--ink); }
.dh-cov { display: inline-block; margin-top: 1px; font-size: .66rem; font-weight: 700; color: var(--ok); background: var(--ok-soft); border-radius: 99px; padding: 0 6px; line-height: 1.5; }
.dh-cov.is-edge { color: var(--c-f-ink); background: var(--c-f-bg); }
.dh-cov.is-low { color: var(--danger); background: var(--danger-soft); }
.day-head.is-weekend { background: color-mix(in srgb, var(--brand) 6%, var(--surface-2)); }
.day-head.is-today { background: var(--brand-soft); color: var(--brand-strong); }
.day-head.is-today .dh-day { color: var(--brand-strong); }
.day-head.is-holiday { position: relative; }
.dh-holiday { position: absolute; top: 3px; right: 4px; color: var(--sand); font-size: .6rem; }

.grid tbody tr:hover .person-cell { background: var(--surface-2); }
.person-cell { height: 46px; }
.person-btn {
  display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: transparent;
  padding: 5px 0; text-align: left; border-radius: 8px;
}
.person-btn:hover .pname { color: var(--brand); }
.avatar {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--brand-soft); color: var(--brand-strong); font-weight: 700; font-size: .72rem;
  letter-spacing: .02em;
}
.avatar.xs { width: 20px; height: 20px; border-radius: 6px; font-size: .58rem; }
.person-text { display: flex; flex-direction: column; min-width: 0; }
.pname { font-size: .84rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.pmeta { font-size: .7rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

.day-cell { padding: 2px !important; }
.day-cell.is-today { background: color-mix(in srgb, var(--brand) 7%, transparent); }
.cell {
  display: block; width: 100%; min-width: 43px; height: 40px;
  border: 0; border-radius: 8px; font-weight: 700; font-size: .82rem;
  transition: transform .06s ease, box-shadow .12s ease, filter .12s ease;
  position: relative;
}
.cell:hover { filter: brightness(.97) saturate(1.15); box-shadow: inset 0 0 0 1px currentColor; }
.cell:active { transform: scale(.96); }
.cell.is-selected { box-shadow: inset 0 0 0 2px var(--brand), 0 0 0 2px var(--brand-soft); }
.cell.is-locked::after {
  content: ""; position: absolute; top: 3px; right: 3px; width: 4px; height: 4px;
  border-radius: 50%; background: currentColor; opacity: .65;
}
.c-t { background: var(--c-t-bg); color: var(--c-t-ink); }
.c-f { background: var(--c-f-bg); color: var(--c-f-ink); }
.c-fe { background: var(--c-fe-bg); color: var(--c-fe-ink); }
.c-a { background: var(--c-a-bg); color: var(--c-a-ink); }
.c-fa { background: var(--c-fa-bg); color: var(--c-fa-ink); }
.c-u { background: var(--c-u-bg); color: var(--c-u-ink); }

.grid .num, .grid .flag { min-width: 46px; padding: 0 6px; font-weight: 650; color: var(--ink-2); font-size: .82rem; }
.grid .flag { min-width: 34px; }
.dot-ok, .dot-bad { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-ok { background: var(--ok); opacity: .55; }
.dot-bad { background: var(--danger); }
.grid tfoot td, .grid tfoot th {
  background: var(--surface-2); height: 34px; font-size: .78rem; font-weight: 650; color: var(--ink-2);
  border-top: 1px solid var(--line-2);
}
.grid tfoot th { text-align: left; padding-left: 12px; text-transform: uppercase; letter-spacing: .05em; font-size: .68rem; color: var(--muted); }
.grid tfoot tr:first-child td, .grid tfoot tr:first-child th { border-top: 2px solid var(--line-2); }
.grid tfoot td.bad { background: var(--danger-soft); color: var(--danger); }
.grid tfoot td.edge { background: var(--c-f-bg); color: var(--c-f-ink); }
.grid tfoot td.is-today { box-shadow: inset 0 0 0 2px var(--brand-soft); }
.grid.simple .person-col { min-width: 190px; max-width: 190px; }
.grid.simple th, .grid.simple td { height: 36px; }
.empty-row { padding: 40px 10px !important; color: var(--muted); }

.grid-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .74rem; color: var(--muted); }
.legend.compact { gap: 8px; }
.lg { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hint { font-size: .72rem; color: var(--muted); margin: 0; }

/* alerts */
.alerts { border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); }
.alerts-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.pill-bad { background: var(--danger-soft); color: var(--danger); border-radius: 999px; padding: 1px 8px; font-size: .78rem; font-weight: 700; }
.alert-list { display: flex; flex-direction: column; gap: 6px; }
.alert-list.compact { max-height: 150px; overflow: auto; }
.alert-line { display: flex; align-items: flex-start; gap: 8px; font-size: .82rem; color: var(--ink-2); background: var(--surface-2); border-radius: 8px; padding: 7px 10px; }
.alert-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; background: var(--warn); }
.alert-line.k-coverage .alert-dot, .alert-line.k-sector .alert-dot { background: var(--danger); }
.alert-line.k-cycle .alert-dot { background: var(--sand); }
.ok-card { border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); color: var(--ok); font-size: .86rem; }

/* ============================================================
   today view
   ============================================================ */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.hero.compact { padding: 18px; }
.eyebrow { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); font-weight: 700; margin: 0 0 4px; }
.hero h2 { font-size: 1.5rem; margin-bottom: 2px; }
.hero h2::first-letter { text-transform: uppercase; }
.hero-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.hs { min-width: 92px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); text-align: left; }
.hs strong { display: block; font-size: 1.5rem; letter-spacing: -.03em; line-height: 1.1; }
.hs span { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.hs.good strong { color: var(--ok); }
.hs.bad strong { color: var(--danger); }

.sector-block { padding: 10px 0; border-top: 1px dashed var(--line); }
.sector-block:first-of-type { border-top: 0; }
.sector-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.sector-head strong { font-size: .86rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px 3px 4px; font-size: .78rem;
}
.chip.off { background: var(--c-f-bg); color: var(--c-f-ink); border-color: transparent; }
.chip.warn { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.chip-x { border: 0; background: transparent; color: inherit; padding: 0 2px; opacity: .6; }
.chip-x:hover { opacity: 1; }
.row-line { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: .84rem; }
.badge { font-size: .68rem; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: var(--surface-3); }
.badge.b-fe { background: var(--c-fe-bg); color: var(--c-fe-ink); }
.badge.b-a { background: var(--c-a-bg); color: var(--c-a-ink); }
.badge.b-fa { background: var(--c-fa-bg); color: var(--c-fa-ink); }

.bars { position: relative; display: flex; align-items: flex-end; gap: 6px; height: 190px; padding-top: 6px; overflow-x: auto; }
.bars::before { content: ''; position: absolute; left: 0; right: 0; bottom: calc(var(--min-line, 71%) + 30px); border-top: 1px dashed color-mix(in srgb, var(--brand) 55%, transparent); pointer-events: none; }
.bar-col { flex: 1; min-width: 46px; background: transparent; border: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; padding: 0; border-radius: 8px; }
.bar-col:hover { background: var(--surface-2); }
.bar-stack { flex: 1; width: 100%; max-width: 40px; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.bar-stack i { display: block; border-radius: 4px; }
.b-work { background: var(--c-t-bg); }
.b-off { background: var(--c-f-bg); }
.b-abs { background: var(--c-u-bg); }
.bar-col.is-today .bar-stack { outline: 2px solid var(--brand-soft); outline-offset: 2px; border-radius: 4px; }
.bar-value { font-size: .72rem; font-weight: 700; color: var(--ink-2); }
.bar-value.bad { color: var(--danger); }
.bar-label { font-size: .62rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; text-align: center; }
.bar-label b { display: block; font-size: .74rem; color: var(--ink-2); }

/* ============================================================
   people
   ============================================================ */
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.person-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 9px; }
.person-card.is-inactive { opacity: .55; }
.pc-head { display: flex; align-items: center; gap: 8px; }
.name-input { flex: 1; min-width: 0; border: 1px solid transparent !important; background: transparent !important; font-weight: 620; padding: 6px 6px !important; min-height: 34px !important; }
.name-input:hover { border-color: var(--line) !important; background: var(--surface) !important; }
.name-input:focus { border-color: var(--brand) !important; background: var(--surface) !important; }
.pc-tools { display: flex; gap: 2px; }
.pc-tools .icon-btn { width: 28px; min-width: 28px; height: 28px; min-height: 28px; background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); font-size: .85rem; }
.pc-tools .icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.pc-tools .icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.pc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.person-card label { display: flex; flex-direction: column; gap: 3px; font-size: .72rem; color: var(--muted); font-weight: 550; }
.person-card input, .person-card textarea, .person-card select { width: 100%; min-height: 34px; padding: 6px 8px; font-size: .82rem; background: var(--surface); }
.person-card .check { flex-direction: row; align-items: center; gap: 7px; justify-content: flex-start; padding-top: 14px; }
.person-card .check input { width: 16px; height: 16px; min-height: 0; }
.pc-more summary { cursor: pointer; font-size: .76rem; color: var(--muted); padding: 2px 0; }
.pc-more[open] summary { margin-bottom: 8px; }
.pc-more label { margin-bottom: 8px; }
.pill-warn { background: var(--danger-soft); color: var(--danger); border-radius: 999px; padding: 0 7px; font-size: .68rem; font-weight: 700; }

/* ============================================================
   rotation / settings
   ============================================================ */
.pc-inline { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.pc-inline span:last-child { overflow: hidden; text-overflow: ellipsis; }
.mini-bar { width: 100%; height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; min-width: 60px; }
.mini-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--sand)); border-radius: 99px; }
.table-scroll.short { max-height: 420px; }
.pill { border-radius: 999px; padding: 2px 10px; font-size: .74rem; font-weight: 650; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--c-f-bg); color: var(--c-f-ink); }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 14px 0; }
.preview-grid > div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.preview-grid strong { font-size: 1.3rem; letter-spacing: -.02em; }
.callout { background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: var(--radius-sm); padding: 12px 14px; font-size: .8rem; color: var(--ink-2); margin-top: 12px; }
.callout ul { margin: 6px 0 0; padding-left: 18px; }
.callout li { margin: 2px 0; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: .78rem; color: var(--muted); font-weight: 550; margin-bottom: 12px; }
.field input, .field select { width: 100%; }
.inline-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: .84rem; border-bottom: 1px dashed var(--line); }
.inline-field input { width: 84px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--ink-2); margin: 10px 0; }
.check input { width: 16px; height: 16px; }
.inline-form { display: flex; gap: 8px; margin-top: 10px; }
.inline-form input { flex: 1; }
.version { margin: 10px 0 0; }

/* ============================================================
   dialog / toast / boot
   ============================================================ */
.backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(8, 24, 30, .5); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; animation: fade .15s ease; }
.dialog { background: var(--surface); border-radius: 18px; padding: 22px; width: min(520px, 100%); max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lg); animation: pop .18s ease; }
.dialog.wide { width: min(620px, 100%); }
.dialog h2 { margin-bottom: 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.dialog-actions.left { justify-content: flex-start; margin-top: 10px; }
.dialog textarea { width: 100%; margin-top: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 999px;
  font-size: .84rem; font-weight: 550; opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease; z-index: 70; box-shadow: var(--shadow-lg);
  max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.boot { display: grid; place-items: center; min-height: 60vh; color: var(--muted); gap: 10px; }
.boot-dot { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   responsive
   ============================================================ */
@media (max-width: 1100px) {
  .two-col { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 820px) {
  .appbar { padding: 10px 12px; gap: 8px; }
  .tabs { top: 61px; padding: 0 12px; }
  .appbar-actions { gap: 6px; }
  .hide-sm { display: none !important; }
  .saved-pill { display: none; }
  .brand-text strong { font-size: .95rem; }
  .wrap { padding: 12px 10px 48px; gap: 10px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:last-child { grid-column: span 2; }
  .stat strong { font-size: 1.35rem; }
  .hero { gap: 12px; }
  .hero h2 { font-size: 1.2rem; }
  .hero-stats { width: 100%; gap: 6px; }
  .hs { flex: 1; min-width: 0; padding: 8px 10px; }
  .hs strong { font-size: 1.2rem; }
  .card { padding: 13px; }
  .grid .person-col, .grid .person-cell { min-width: 152px; max-width: 152px; padding: 0 7px; }
  .pmeta { display: none; }
  .cell { min-width: 38px; height: 38px; border-radius: 7px; font-size: .76rem; }
  .day-head { min-width: 40px; }
  .grid-foot { padding: 9px 11px; }
  .hint { display: none; }
  .periodbar { gap: 8px; }
  .segmented button { padding: 6px 9px; }
  .pc-grid { grid-template-columns: 1fr; }
  .bars { height: 160px; }
  .bar-col { min-width: 38px; }
  .dialog { padding: 18px; border-radius: 16px; }
  .roster { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .period-label small { display: none; }
  .month-input { width: 118px; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions select { flex: 1; }
  .legend { gap: 8px; }
}

/* ============================================================
   print
   ============================================================ */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #f5f8f9; --line: #d5dfe3; --line-2: #b9c8cd; --ink: #000; --ink-2: #333; --muted: #555; --shadow: none; --shadow-sm: none; }
  body { background: #fff; font-size: 10px; }
  .appbar, .tabs, .periodbar, .stats, .grid-toolbar, .grid-foot, .alerts, .toast, .dialog, .backdrop, .hero-stats, .hide-sm { display: none !important; }
  .wrap { padding: 0; max-width: none; gap: 0; }
  .card { border: 0; box-shadow: none; padding: 0; border-radius: 0; }
  .table-scroll { max-height: none; overflow: visible; }
  .grid { font-size: 8px; }
  .grid th, .grid td { border-color: #c9d3d7; }
  .cell { min-width: 24px; height: 24px; border-radius: 0; font-size: 8px; }
  .day-head { min-width: 26px; height: 34px; }
  .grid .person-col, .grid .person-cell { min-width: 120px; max-width: 120px; position: static; }
  .avatar { display: none; }
  .grid tfoot td, .grid tfoot th { position: static; }
  @page { size: landscape; margin: 8mm; }
}
