/* ── Base ─────────────────────────────────────────────────────────────────
   Hand-rolled rather than Bootstrap: the core screen in this app is a dense
   week grid of shifts, which Bootstrap has no component for and whose row
   heights fight the framework's spacing scale. Everything here is a handful
   of custom properties, so swapping in Bootstrap later is a contained job.  */

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #16191d;
  --muted: #666e7a;
  --line: #dfe3e8;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --ok: #1a7f4b;
  --warn: #a8620b;
  --bad: #b3261e;
  --ot: #a8620b;
  --radius: 8px;
  --gap: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --panel: #1c2024;
    --ink: #e8eaed;
    --muted: #9aa3ad;
    --line: #2c3238;
    --accent: #4f8ef7;
    --ok: #4ade80;
    --warn: #fbbf24;
    --bad: #f87171;
    --ot: #fbbf24;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

/* ── Chrome ── */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { font-weight: 650; text-decoration: none; color: var(--ink); }

.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a {
  padding: 6px 10px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--muted);
}
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.on { background: var(--accent); color: var(--accent-ink); }

.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.who { color: var(--muted); font-size: 13px; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 24px 18px 60px; }
.wrap.wide { max-width: none; }

.foot {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
  border-top: 1px solid var(--line);
}

/* ── Blocks ── */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: var(--gap);
}
.card.narrow { max-width: 440px; margin-inline: auto; }

h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 17px; margin: 22px 0 8px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 14px; }
.error { color: var(--bad); font-weight: 550; }

/* ── Forms ── */
label { display: block; font-weight: 550; font-size: 13px; margin: 14px 0 4px; }
input, select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

button, .button {
  font: inherit;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover { border-color: var(--muted); }

.primary, button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 550;
  margin-top: 18px;
}
.primary:hover { filter: brightness(1.08); }

button.link {
  border: 0;
  background: none;
  color: var(--accent);
  padding: 0;
  font-size: 13px;
}

form.inline { display: inline; margin: 0; }
form.inline select { width: auto; padding: 5px 8px; }

/* ── Status pills ── */
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 550;
  border: 1px solid var(--line);
}
.pill.ok { color: var(--ok); border-color: currentColor; }
.pill.warn { color: var(--warn); border-color: currentColor; }
.pill.bad { color: var(--bad); border-color: currentColor; }
.pill.draft { color: var(--muted); }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 650; border-top: 2px solid var(--line); }

/* Overtime should be visually obvious wherever it appears. */
.ot { color: var(--ot); font-weight: 600; }

/* ── Week grid ── */
.grid-scroll { overflow-x: auto; }
.weekgrid {
  display: grid;
  grid-template-columns: 190px repeat(7, minmax(130px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  min-width: 900px;
}
.weekgrid > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px; }
.weekgrid .head { background: var(--bg); font-weight: 600; font-size: 13px; position: sticky; top: 0; }
.weekgrid .who-cell { background: var(--bg); font-size: 14px; }
.weekgrid .who-cell .sub { color: var(--muted); font-size: 12px; }
.weekgrid .cell { min-height: 76px; }

.shift {
  display: block;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 4px;
  padding: 5px 7px;
  margin-bottom: 5px;
  font-size: 13px;
  text-decoration: none;
  color: var(--ink);
}
.shift .pos { color: var(--muted); font-size: 12px; }
.shift.draft { border-left-style: dashed; opacity: .75; }
.shift.open { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }

.addshift {
  display: block;
  width: 100%;
  border: 1px dashed var(--line);
  background: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
}
.addshift:hover { border-color: var(--accent); color: var(--accent); }

/* ── Toolbar ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: var(--gap);
}
.toolbar .spacer { flex: 1; }
.weeklabel { font-weight: 600; }

@media (max-width: 700px) {
  .nav { order: 3; width: 100%; }
  .row { flex-direction: column; }
}
