/* Page shell: header, tabs, banner, stat tiles, tools row, cards, empty state, buttons. */
.app { max-width: 1180px; margin: 0 auto; padding-inline: 16px; padding-block: 22px 56px; }
.muted { color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.hint.flush { margin: 0; }

/* Header */
.top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; }
.eyebrow { font: 600 12px/1 var(--font-display); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
h1 { font: 700 clamp(30px, 5.4vw, 46px)/.95 var(--font-display); text-transform: uppercase; letter-spacing: .01em; margin: 8px 0 0; text-wrap: balance; overflow-wrap: anywhere; }
.weeknav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.weeklabel { display: grid; text-align: center; min-width: 160px; }
.weeklabel b { font: 600 19px/1.1 var(--font-display); letter-spacing: .03em; text-transform: uppercase; }
.weeklabel span { font-size: 12.5px; color: var(--muted); }
.hazard { height: 7px; margin-top: 18px; border-radius: 2px; background: repeating-linear-gradient(-45deg, var(--accent) 0 9px, var(--ink) 9px 18px); }

/* Buttons */
.iconbtn { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); border-radius: var(--r); font-size: 18px; line-height: 1; cursor: pointer; }
.iconbtn:disabled { opacity: .35; cursor: not-allowed; }
.btn { position: relative; font: 600 14px/1 var(--font-body); padding: 10px 14px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.small { padding: 7px 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }

/* Tabs + actions */
.bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; border-bottom: 1px solid var(--line); margin-top: 6px; }
.tabs { display: flex; gap: 2px; }
.tab { font: 600 15px/1 var(--font-display); letter-spacing: .09em; text-transform: uppercase; padding: 14px 12px 12px; border: 0; background: none; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; padding-block: 8px; }
.banner { margin-top: 14px; padding: 10px 14px; border-radius: var(--r); background: var(--accent-soft); display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; font-size: 14px; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; min-width: 0; }
.stat .k { font: 600 12px/1 var(--font-display); letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.stat .v { font: 600 30px/1.1 var(--font-display); margin-top: 7px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat .s { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat.alert .v { color: var(--bad); }
.stat.good .v { color: var(--ok); }

/* Tools row */
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.search { flex: 1 1 200px; max-width: 300px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--panel); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; flex: none; justify-self: start; width: max-content; }
.seg button { border: 0; background: var(--panel); color: var(--muted); font: 600 13px/1 var(--font-body); padding: 9px 12px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); margin-left: auto; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; border: 1px solid var(--line-strong); }
.sw-below { background: var(--bad-soft); border-color: var(--bad); }
.sw-missed { border-style: dashed; border-color: var(--bad); }

/* Cards, forms, generic rows */
.rostergrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 18px; margin-top: 18px; align-items: start; }
@media (max-width: 820px) { .rostergrid { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.card h2, .dlg h2 { font: 700 20px/1.1 var(--font-display); text-transform: uppercase; letter-spacing: .04em; margin: 0; }
.card h3 { font: 600 14px/1.2 var(--font-display); letter-spacing: .1em; text-transform: uppercase; margin: 0; }
.h-sm { font-size: 17px !important; }
label.f { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
.input { width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--bg); color: var(--ink); }
textarea.input { resize: vertical; min-height: 110px; }
.mono { font-family: var(--font-num) !important; font-size: 14px; }
.input.invalid { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.stack { display: grid; gap: 12px; }
.stack.tight { gap: 6px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row.spread { justify-content: space-between; }
.row.end { align-items: flex-end; }
.grow { flex: 1 1 220px; }
.scrollx { overflow-x: auto; }
.vh { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
fieldset.choice { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 14px; }
fieldset.choice legend { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 6px; padding: 0; }
fieldset.choice label { display: flex; gap: 8px; align-items: baseline; }

/* Empty state */
.empty { margin-top: 18px; padding: 28px 24px; border: 1.5px dashed var(--line-strong); border-radius: var(--r); background: var(--panel); }
.empty h2 { font: 700 26px/1.05 var(--font-display); text-transform: uppercase; letter-spacing: .03em; margin: 0; text-wrap: balance; }
.empty p { max-width: 62ch; margin: 8px 0 0; color: var(--muted); }
.steps { margin: 16px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; max-width: 640px; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: start; counter-increment: s; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 4px; background: var(--ink); color: var(--bg); font: 700 14px/1 var(--font-display); }
.steps b { display: block; }
.steps span { color: var(--muted); font-size: 14px; }
.empty .row { margin-top: 18px; }

/* Toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--r); font-size: 14px; max-width: calc(100vw - 32px); z-index: 50; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); }

@media (max-width: 560px) {
  .weeklabel { min-width: 0; flex: 1; }
  .legend { margin-left: 0; }
  .search { max-width: none; }
  .stat .v { font-size: 26px; }
}
