:root {
  --ink: #16232e; --paper: #f5f3ee; --card: #fff; --line: #dcd8cf; --muted: #5d6b76;
  --accent: #0f6e6e; --go: #1c8551; --stop: #b3372f; --warn: #8a5a00; --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
h1 { font-size: 1.35rem; margin: 0 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 1rem; margin: 0 0 10px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); } .center { text-align: center; } .small { font-size: 0.86rem; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

header { background: var(--ink); color: #fff; display: flex; align-items: center; gap: 16px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; white-space: nowrap; }
.mark { width: 14px; height: 14px; border-radius: 50%; border: 3px solid #3fb37f; }
header .link { margin-left: auto; color: #cfd8de; }
nav { display: flex; }
nav button { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }

/* phone: bottom tab bar */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
#tabs button { flex: 1; padding: 14px 2px 13px; color: var(--muted); font-size: 0.8rem; white-space: nowrap; font-weight: 600;
  border-top: 3px solid transparent; }
#tabs button[aria-current="page"] { color: var(--accent); border-top-color: var(--accent); }

main { max-width: 760px; margin: 0 auto; padding: 18px 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.card > .row { margin-top: 10px; }

label { display: block; font-size: 0.86rem; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { width: 100%; font: inherit; color: inherit; background: #fff; border: 1px solid #b9b4a8;
  border-radius: 10px; padding: 11px 12px; min-height: 46px; }
textarea { min-height: 84px; resize: vertical; }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; margin: 0; }
label.check { display: flex; gap: 10px; align-items: center; font-size: 1rem; color: var(--ink); font-weight: 500; }
:focus-visible { outline: 3px solid #5bb5b5; outline-offset: 2px; }

button { font: inherit; cursor: pointer; }
.btn { border: 1px solid #b9b4a8; background: #fff; color: var(--ink); border-radius: 10px; padding: 10px 14px;
  min-height: 46px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--stop); border-color: #dcb6b2; }
.btn.big { width: 100%; min-height: 76px; font-size: 1.35rem; border-radius: 16px; border: 0; color: #fff; margin-top: 14px; }
.btn.go { background: var(--go); } .btn.stop { background: var(--stop); }
.btn:disabled { opacity: 0.55; }
.btn.wide { width: 100%; margin-top: 12px; }
.row.two > .btn { flex: 1; }
.callout.urgent { border-left-color: var(--stop); background: #f9e1de; }
.callout.top { margin-top: 12px; margin-bottom: 0; }
.link { background: none; border: 0; padding: 6px 0; color: var(--accent); font-weight: 600; text-decoration: underline; }

.status { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.status.in { color: var(--go); } .status.lunch { color: var(--warn); }
.elapsed { font-size: 3rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; margin: 4px 0; }
.jobname { font-size: 1.1rem; font-weight: 650; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat b { display: block; font-size: 1.6rem; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 11px 0; border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.list li:first-child { border-top: 0; }
.list li.tap { cursor: pointer; }
.list .hrs { margin-left: auto; font-weight: 700; white-space: nowrap; }
.note { color: var(--muted); font-size: 0.9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.day { display: flex; justify-content: space-between; font-weight: 700; margin: 16px 2px 6px; }
.badge { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px;
  background: #e7e3d9; color: var(--muted); }
.badge.in { background: #d9efe2; color: #14633c; } .badge.lunch { background: #f6e7c1; color: #6b4700; } .badge.bad { background: #f6dcd9; color: var(--stop); }

.seg { display: inline-flex; border: 1px solid #b9b4a8; border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 10px 18px; font-weight: 600; color: var(--muted); min-height: 44px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th, td { text-align: left; padding: 8px 10px 8px 0; border-top: 1px solid var(--line); vertical-align: top; }
th { border-top: 0; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
td.r, th.r { text-align: right; padding-right: 0; white-space: nowrap; }
td.nw { white-space: nowrap; }
tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
.callout { border-left: 4px solid var(--warn); background: #fbf3df; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }

dialog { border: 0; border-radius: 16px; padding: 18px; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 32px); color: var(--ink); }
dialog::backdrop { background: rgba(22, 35, 46, 0.55); }
dialog .actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
dialog .actions .spacer { flex: 1; }
.err { color: var(--stop); font-weight: 600; }
p.err { margin-top: 10px; min-height: 1.3em; }
.list li .row { margin-top: 8px; }
#toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 99px; font-weight: 600; opacity: 0;
  pointer-events: none; transition: opacity 0.2s; z-index: 20; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; }
.auth { max-width: 400px; margin: 8vh auto 0; }

/* desktop: tabs move into the header */
@media (min-width: 760px) {
  body { padding-bottom: 24px; }
  #tabs { position: static; background: none; border: 0; padding: 0; }
  #tabs button { flex: none; padding: 8px 14px; color: #cfd8de; border-top: 0; border-radius: 8px; font-size: 0.95rem; }
  #tabs button[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, 0.14); }
  #toast { bottom: 28px; }
  main { padding: 26px 20px; }
}
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
