/* 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 {
  /* The palette is Artorias Tech Lab's, not invented here: brand blue #0b6fd0 and
   * red #cd1c18 are sampled out of the logo mark's own pixels on the company site
   * (artorias-tech-lab/style/main.css), and the ink, body, muted, line and wash greys
   * are the same five tokens. Punchbox is sold by that company, so the door and the
   * product have to look like each other — one brand, two rooms. */

  /* Paper and ink, from the same source */
  --paper: #f6fafd;
  --surface: #ffffff;
  --ink: #0f2438;
  --ink-soft: #4a5c6d;
  --ink-faint: #63758a;
  --line: #dce7f2;
  --line-strong: #a9cdf1;

  /* The brand blue does the one thing a primary action needs to do */
  --brand: #0b6fd0;
  --brand-strong: #0857a3;
  --brand-wash: #eaf3fc;
  --brand-line: #d6e8fa;
  --accent: #0b6fd0;

  /* Two states that mean something, and the site's red for the one that costs money */
  --in: #1f7a4d;
  --in-wash: #eaf6ef;
  --out: #cd1c18;
  --out-wash: #fdeceb;
  --warn: #8a5a1f;
  --warn-wash: #fdf4e6;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(15 36 56 / 5%), 0 10px 30px rgb(15 36 56 / 6%);
  --shadow-lift: 0 12px 34px rgb(11 111 208 / 12%);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    ui-sans-serif, system-ui, "Noto Sans", 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: var(--brand-strong); 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(--brand-strong); 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 ------------------------------------------------------------ */

/* Every table scrolls inside its own box rather than being clipped by the card.
 * The symptom this fixes: at 390px the stations' Revoke button sat half outside the
 * page, so the only way to revoke a lost phone was to tilt it. And the corrections
 * table crushed its reason column to one word per line. */
.scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
}
.scroll table { min-width: 32rem; }

/* The two facts on the billing screen: a label and its value, side by side, so a
 * manager reads "This shop is / on a free trial" rather than a stack of words. */
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .4rem 1.25rem;
  margin: 1.25rem 0 1.5rem;
}
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

/* A shop whose trial has ended keeps its board and loses its office work. The banner
 * is the reason, said once, where the manager is looking. */
.banner {
  background: #fff7e6;
  border: 1px solid #f0d9a8;
  color: #6b4a00;
  padding: .85rem 1rem;
  border-radius: var(--radius);
  margin: 0 0 1.25rem;
}

.plans { display: grid; gap: .75rem; margin: 1.25rem 0; }
.plans form { margin: 0; }
.plans button { width: 100%; padding: .9rem 1rem; font-size: 1em; }

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.45em 0.9em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:hover { background: var(--brand-strong); }
button.quiet { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
button.quiet:hover { background: var(--brand-wash); }
button.danger { background: var(--surface); color: var(--out); border-color: var(--out-wash); }
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: var(--brand-wash); }
.pad button:disabled { opacity: 0.55; cursor: progress; }

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

/* Changing a PIN happens at the wall, on a tablet, by a person in a hurry: the panel
 * is as big as the punch fields and spaced so the two boxes cannot be confused. */
#pin-change { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
#pin-change .field { margin-bottom: 0.8em; }
#pin-change.hidden { display: none; }

#status { margin: 1.1em 0 0; min-height: 1.6em; font-size: 1.05em; color: var(--ink-soft); }

/* A section the page hides before the first keystroke: the clock, or the notice
 * that this browser is not a clock yet. Explicit, so a later `display` rule
 * cannot quietly un-hide the wrong one. */
[hidden] { display: none !important; }

/* The way out of the clock screen, for the person who runs the shop rather than
 * works the floor. Quiet on purpose: it is not for the people punching. */
.punch-card .owner { margin: 1.2em 0 0; font-size: 0.9em; text-align: center; }
.punch-card .owner a { color: var(--ink-faint); }
.punch-card .owner a:hover { color: var(--ink); }
#setup .hint a { color: var(--ink); }
#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; }
}
