/* The staff app (ROTA-014): phone first, light and dark, the back office's navy and gold. No web fonts (CSP: self only). */
:root {
  color-scheme: light;
  --navy: #0D1B3E;
  --gold: #C9A84C;
  --gold-text: #7a5f14;
  --bg: #F6F5F1;
  --surface: #FFFFFF;
  --surface-2: #FAFAF8;
  --line: #E6E3DA;
  --text: #14161c;
  --text-2: #4d5160;
  --text-3: #6f7381;
  --good: #1f7a3f; --good-bg: #e6f4ea;
  --warn: #8a5800; --warn-bg: #fdf1d8;
  --bad: #b3261e; --bad-bg: #fbe6e4;
  --info: #2a5bb5; --info-bg: #e7eefb;
  --me: #fbf4de;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(13, 27, 62, .06), 0 4px 16px rgba(13, 27, 62, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --gold-text: #e3c877;
    --bg: #0b1226;
    --surface: #121b33;
    --surface-2: #17213d;
    --line: #26314f;
    --text: #f2f3f7;
    --text-2: #c3c7d4;
    --text-3: #9aa0b4;
    --good: #7fd49a; --good-bg: #133322;
    --warn: #f0c46a; --warn-bg: #332709;
    --bad: #ff9a8f; --bad-bg: #3a1714;
    --info: #9dbcff; --info-bg: #17284d;
    --me: #2a2611;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 var(--font); }
h1 { font-size: 22px; margin: 4px 0 6px; line-height: 1.25; }
h2 { font-size: 17px; margin: 22px 0 8px; }
h3 { font-size: 15px; margin: 0; }
p { margin: 0 0 10px; }
.muted { color: var(--text-2); }
.hint { color: var(--text-3); font-size: 14px; margin: 6px 0 0; }
.error { color: var(--bad); font-weight: 600; min-height: 1.4em; margin: 12px 0 0; }
button, input, select { font: inherit; color: inherit; }
label { display: block; font-size: 14px; font-weight: 600; color: var(--text-2); margin: 12px 0 5px; }
input, select { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
input[type="password"], #linkCode { letter-spacing: .3em; font-size: 20px; }
.btn-primary { display: block; width: 100%; min-height: 48px; margin-top: 16px; border: 0; border-radius: 12px; background: var(--navy); color: #fff; font-weight: 700; cursor: pointer; }
.btn-primary:disabled { opacity: .45; cursor: default; }
@media (prefers-color-scheme: dark) { .btn-primary { background: var(--gold); color: var(--navy); } }
.btn-plain { display: block; width: 100%; min-height: 46px; margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-weight: 600; cursor: pointer; }
.btn-plain.danger { color: var(--bad); }
.linkish { display: block; margin: 14px auto 0; background: none; border: 0; color: var(--text-2); text-decoration: underline; font-size: 15px; cursor: pointer; padding: 8px; }

/* sign-in */
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--navy); }
.gate-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 18px; padding: 26px 22px; box-shadow: var(--shadow); }
.mark { display: block; margin: 0 0 12px; border-radius: 12px; }
.where { color: var(--gold-text); font-weight: 700; font-size: 14px; margin: 0; }

/* app */
.top { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--navy); color: #fff; }
.top-text { flex: 1; min-width: 0; }
.who { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { font-size: 13px; color: #c9cfe0; }
.sub.stale { color: #ffd27a; }
.menu-btn { border: 1px solid rgba(255, 255, 255, .35); background: transparent; color: #fff; border-radius: 10px; padding: 8px 12px; font-weight: 600; cursor: pointer; }
/* QA 0.14.0 F15: a line in the header, under the name (never over a button), gone with the next thing that works */
.banner { flex-basis: 100%; margin: 0; padding: 10px 14px; border-radius: 10px; background: #fff; color: var(--navy); font-size: 15px; font-weight: 600; }
@media (prefers-color-scheme: dark) { .banner { background: var(--gold); color: var(--navy); } }
main { max-width: 640px; margin: 0 auto; padding: 4px 16px calc(96px + env(safe-area-inset-bottom)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin: 10px 0; }
.form label:first-child, .form > div > label:first-child { margin-top: 0; }

/* week blocks */
.week-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 22px 0 8px; }
.week-head h2 { margin: 0; }
.week-head .tot { color: var(--text-2); font-size: 14px; white-space: nowrap; }
.days { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.day { display: flex; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); align-items: flex-start; }
.day:first-child { border-top: 0; }
.day .d { width: 76px; flex: none; font-weight: 700; font-size: 15px; }
.day .d small { display: block; font-weight: 500; color: var(--text-3); font-size: 13px; }
.day .what { flex: 1; min-width: 0; }
.day .line { display: flex; justify-content: space-between; gap: 8px; }
.day .line + .line { margin-top: 4px; }
.day .t { font-weight: 600; font-variant-numeric: tabular-nums; }
.day .h { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.day .none { color: var(--text-3); }
.day.past { opacity: .55; }
.day.today { background: var(--me); }
.day.today .d::after { content: "Today"; display: block; font-size: 12px; font-weight: 700; color: var(--gold-text); }
.tag { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--info-bg); color: var(--info); }
.tag.good { background: var(--good-bg); color: var(--good); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.plain { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.empty { color: var(--text-3); padding: 16px; text-align: center; }

/* team */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 4px; scrollbar-width: none; }
.chips button { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600; cursor: pointer; }
.chips button.on { background: var(--navy); border-color: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { .chips button.on { background: var(--gold); border-color: var(--gold); color: var(--navy); } }
.team-day h3 { margin: 18px 0 8px; }
.team-day.today { scroll-margin-top: 84px; }   /* opens at today, below the sticky header (QA 0.14.0 F20) */
.team-row { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--line); }
.team-row:first-child { border-top: 0; }
.team-row .t { width: 104px; flex: none; font-variant-numeric: tabular-nums; color: var(--text-2); }
.team-row .n { font-weight: 600; }
.team-row.me { background: var(--me); }
.team-row.me .n::after { content: " (you)"; font-weight: 500; color: var(--gold-text); }

/* time off, availability */
.seg { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; min-height: 42px; border: 0; background: none; border-radius: 9px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.req { padding: 12px 16px; border-top: 1px solid var(--line); }
.req:first-child { border-top: 0; }
.req .row1 { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.req .title { font-weight: 600; }
.req .meta { color: var(--text-3); font-size: 13px; margin-top: 3px; }
.req .note { color: var(--text-2); font-size: 14px; margin-top: 4px; overflow-wrap: anywhere; }
.week-rows { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; }
.week-rows label { margin: 0; color: var(--text); font-size: 15px; }
.week-rows select { min-height: 42px; }
.week-rows select.changed { border-color: var(--gold); background: var(--me); }
.pending { background: var(--info-bg); color: var(--info); border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 600; }

/* hours */
.stat { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 6px 0; }
.stat .k { color: var(--text-2); }
.stat .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.big .v { font-size: 26px; }
.src { font-size: 12px; color: var(--text-3); }
details.wk > summary { list-style: none; cursor: pointer; padding: 12px 16px; margin: 8px 0 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
details.wk > summary::-webkit-details-marker { display: none; }
details.wk > summary h2 { font-size: 16px; }
details.wk > summary .tot::after { content: " ›"; display: inline-block; margin-left: 4px; transition: transform .15s; }
details.wk[open] > summary { border-radius: var(--radius) var(--radius) 0 0; border-bottom: 0; }
details.wk[open] > summary .tot::after { transform: rotate(90deg); }
details.wk[open] > .days { border-radius: 0 0 var(--radius) var(--radius); }

/* tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
.tabbar button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border: 0; background: none; color: var(--text-3); font-size: 11.5px; font-weight: 600; cursor: pointer; border-radius: 10px; }
.tabbar button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.on { color: var(--navy); }
@media (prefers-color-scheme: dark) { .tabbar button.on { color: var(--gold); } }

/* menu sheet */
.sheet { border: 0; border-radius: 18px 18px 0 0; width: 100%; max-width: 520px; margin: auto auto 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); background: var(--surface); color: var(--text); }
.sheet::backdrop { background: rgba(5, 10, 25, .55); }
.sheet-who { font-weight: 700; margin: 0 0 6px; }
.link-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 8px 0 6px; }
.link-box .hint { margin-top: 0; }
.code { font-size: 34px; font-weight: 800; letter-spacing: .25em; text-align: center; margin: 12px 0 0; font-variant-numeric: tabular-nums; }
.code small { display: block; font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--text-3); }
