/* Punchbox — one identity, light.
 *
 * Two rooms, one look: the punch screen is a wall tablet read from an arm's
 * length at 6am, the dashboard is an office monitor read sitting down. Same
 * colours, same type, same shapes; only the sizes differ, and that is what the
 * `.punch` scope is for.
 *
 * Served as /app.css. The kiosk image bundles this file beside punch.html, so
 * neither surface depends on a network round trip to look right.
 */

:root {
  /* Paper and ink */
  --paper: #f6f7f9;
  --surface: #ffffff;
  --ink: #16202a;
  --ink-soft: #5f6b76;
  --ink-faint: #8b97a2;
  --line: #e3e7eb;
  --line-strong: #ccd4da;

  /* One accent, and two states that mean something */
  --accent: #16202a;
  --in: #2f7d4f;
  --in-wash: #eaf3ee;
  --out: #a33a3a;
  --out-wash: #fbeeee;
  --warn: #8a5a1f;
  --warn-wash: #fdf4e6;

  --radius: 8px;
  --shadow: 0 1px 2px rgb(22 32 42 / 6%), 0 1px 3px rgb(22 32 42 / 4%);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-text-size-adjust: 100%;
}

a { color: #1f5f8b; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- chrome ------------------------------------------------------------ */

.topbar {
  display: flex;
  align-items: baseline;
  gap: 1.4em;
  flex-wrap: wrap;
  padding: 0.85em 1.6em;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { display: flex; flex-direction: column; line-height: 1.15; }
.topbar .product { font-weight: 700; letter-spacing: -0.015em; }
.topbar .shop { font-size: 0.78em; color: var(--ink-faint); font-weight: 500; }

/* The office door: product, no shop yet — nobody has told us who they are. */
body.signin { display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.signin .card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1.6em 1.5em;
}
.signin .brand { display: flex; flex-direction: column; line-height: 1.15; margin-bottom: 1.2em; }
.signin .product { font-weight: 700; font-size: 1.15em; }
.signin h1 { font-size: 1.15em; margin: 0 0 1em; }
.signin form.stack { max-width: none; }
.signin .stack input { width: 100%; }
.signin button { width: 100%; padding: 0.6em; margin-top: 0.3em; }
.signin .hint { margin: 1.1em 0 0; font-size: 0.86em; }
.signin .sites { display: grid; gap: 0.6em; margin: 1em 0; }
.signin .choice button {
  width: 100%;
  padding: 0.85em;
  font-size: 1.05em;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.signin .choice button:hover { background: #f3f5f7; }
.topbar nav { display: flex; gap: 1.1em; }
.topbar nav a { color: var(--ink-soft); font-weight: 500; }
.topbar nav a:hover { color: var(--ink); }
.topbar nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.topbar .who { margin-left: auto; color: var(--ink-faint); font-size: 0.9em; display: flex; gap: 0.7em; align-items: baseline; }
.topbar .who button { background: none; border: 0; padding: 0; color: #1f5f8b; cursor: pointer; font: inherit; }
.topbar .who button:hover { text-decoration: underline; }

main { max-width: 68em; margin: 0 auto; padding: 1.6em; }
h1 { font-size: 1.35em; line-height: 1.25; margin: 0 0 1em; letter-spacing: -0.01em; }
h2 {
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-faint);
  margin: 2em 0 0.7em;
  font-weight: 650;
}
h2:first-of-type { margin-top: 1.4em; }
p { margin: 0 0 0.9em; }
.muted { color: var(--ink-soft); }
.hint { color: var(--ink-soft); font-size: 0.92em; }

/* ---- tables ------------------------------------------------------------ */

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
th, td { padding: 0.62em 0.85em; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th {
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  font-weight: 650;
  background: #fbfcfd;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td .sub { color: var(--ink-faint); font-size: 0.88em; }

/* ---- state ------------------------------------------------------------- */

.pill {
  display: inline-block;
  padding: 0.12em 0.55em;
  border-radius: 999px;
  font-size: 0.82em;
  font-weight: 600;
  white-space: nowrap;
}
.pill-in { background: var(--in-wash); color: var(--in); }
.pill-out { background: var(--out-wash); color: var(--out); }
.pill-warn { background: var(--warn-wash); color: var(--warn); }
.flag { color: var(--out); font-weight: 600; }

/* ---- forms ------------------------------------------------------------- */

input, select, button, textarea { font: inherit; color: inherit; }
input[type="text"], input[type="password"], input[type="email"], input[type="datetime-local"], select {
  padding: 0.4em 0.55em;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  min-width: 0;
}
input[type="text"], input[type="email"] { width: 12em; }
input[type="datetime-local"] { width: 13.5em; }
/* The day screen has one form per punch: keep it on one line where it can be */
.day-form select { max-width: 8.5em; }
.day-form input[type="text"] { width: 9em; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid #1f5f8b;
  outline-offset: 2px;
}
button {
  padding: 0.4em 0.85em;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:hover { background: #24313d; }
button.quiet { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
button.quiet:hover { background: #f3f5f7; }
button.danger { background: var(--surface); color: var(--out); border-color: #e6c9c9; }
button.danger:hover { background: var(--out-wash); }

form.inline { display: flex; gap: 0.45em; flex-wrap: wrap; align-items: center; margin: 0; }
form.stack { display: grid; gap: 0.6em; max-width: 30em; }
form.stack label { display: grid; gap: 0.25em; font-size: 0.9em; color: var(--ink-soft); }

.notice { padding: 0.7em 0.9em; border-radius: var(--radius); margin: 0 0 1em; }
.notice-bad { background: var(--out-wash); color: var(--out); border: 1px solid #edcfcf; }
.notice-good { background: var(--in-wash); color: var(--in); border: 1px solid #cfe3d7; }

.pager { display: flex; gap: 1.2em; margin: 0 0 1em; }

/* The printable sheet: the dashboard's table, on paper. */
body.sheet main { max-width: 52em; }
td.note { color: var(--out); font-size: 0.92em; }

code {
  font: 0.92em/1.4 var(--mono);
  background: #f1f4f7;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.06em 0.4em;
}
.pin { font-size: 1.9em; letter-spacing: 0.12em; margin: 0.5em 0; }
.pin code { background: #fff; padding: 0.1em 0.3em; }
.topbar .who form { display: inline; }
/* the station form sits in a line of its own under the stations table */
main form.inline + .muted { margin-top: 0.5em; }
.topbar .who button { padding: 0; }

/* ---- the punch screen --------------------------------------------------
 * Same identity, sized for a wall: touch targets are at least 64px, type is
 * 20px, and the four actions sit in a 2x2 grid so nobody has to aim.
 */

body.punch { display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.punch-card {
  width: min(620px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 2px 4px rgb(22 32 42 / 5%), 0 12px 32px rgb(22 32 42 / 7%);
  padding: 1.6em 1.5em 1.4em;
}
.punch-card h1 { font-size: 1.5em; margin: 0; }
.punch-card .hint { margin: 0.15em 0 1.3em; }
.punch-card label { display: block; margin: 0 0 0.4em; font-size: 0.95em; color: var(--ink-soft); }
.punch-card input {
  width: 100%;
  padding: 0.7em 0.75em;
  font-size: 1.5em;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.punch-card .field { margin-bottom: 1em; }

.pad { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 1.3em 0 0; }
.pad button {
  padding: 1.35em 0.5em;
  font-size: 1.25em;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}
.pad button.in { background: var(--in); border-color: var(--in); }
.pad button.in:hover { background: #276a43; }
.pad button.out { background: var(--out); border-color: var(--out); }
.pad button.out:hover { background: #8c3232; }
.pad button.quiet { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.pad button.quiet:hover { background: #f3f5f7; }
.pad button:disabled { opacity: 0.55; cursor: progress; }

.punch-card .week { margin-top: 12px; width: 100%; padding: 0.95em; font-size: 1em; }

#status { margin: 1.1em 0 0; min-height: 1.6em; font-size: 1.05em; color: var(--ink-soft); }
#status.ok { color: var(--in); font-weight: 600; }
#status.bad { color: var(--out); font-weight: 600; }

/* ---- print ------------------------------------------------------------- */

@media print {
  :root { --paper: #fff; --shadow: none; }
  body { background: #fff; }
  .topbar, .pager, form, button, .no-print { display: none !important; }
  main { max-width: none; padding: 0; }
  table { border: 1px solid #999; box-shadow: none; }
  th { background: #f0f0f0; }
  th, td { border-color: #bbb; }
}

@media (max-width: 720px) {
  main { padding: 1em; }
  .topbar { padding: 0.7em 1em; gap: 0.8em; }
  .topbar .who { width: 100%; margin-left: 0; }
  th, td { padding: 0.5em 0.6em; font-size: 0.92em; }
}
