/* Shift Clock — phone-first time card; admin pages widen to a ledger. */
:root {
  --bg: #eef0f3; --surface: #ffffff; --ink: #17202b; --muted: #5d6877; --line: #d6dbe2;
  --accent: #d9480f; --accent-ink: #ffffff; --on-state: #ffffff;
  --work: #1f8a4c; --lunch: #b7791f; --break: #2b6cb0; --off: #6b7685;
  --work-soft: #e3f4ea; --lunch-soft: #fbf0dc; --break-soft: #e2edf9; --off-soft: #eceff3;
  --warn: #c0392b; --warn-soft: #fbe6e3;
  --f-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Public Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c; --surface: #1b2129; --ink: #e8ecf1; --muted: #9aa5b3; --line: #2d3540;
    --accent: #ff7a3d; --accent-ink: #1a0d05; --on-state: #0d1117;
    --work: #4cc27f; --lunch: #e5a84b; --break: #6ea8f0; --off: #8d98a7;
    --work-soft: #17301f; --lunch-soft: #33270f; --break-soft: #172a40; --off-soft: #232a33;
    --warn: #ff7b6b; --warn-soft: #3a1c19;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5; }
[hidden] { display: none !important; }
.app { max-width: 460px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 16px; }
.app.wide { max-width: 1000px; }
h1, h2, h3 { font-family: var(--f-display); margin: 0; text-wrap: balance; }
a { color: inherit; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.stamp { font-family: var(--f-mono); font-size: 11px; color: var(--accent); border: 1.5px solid var(--accent); padding: 0 6px; border-radius: 3px; letter-spacing: 0.08em; text-transform: uppercase; }
.tabs { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; flex-wrap: wrap; }
.tabs a { text-decoration: none; color: var(--muted); font: 600 13px var(--f-body); padding: 6px 14px; border-radius: 999px; }
.tabs a.on { background: var(--ink); color: var(--bg); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; min-width: 0; }
.label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 600; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.notice { padding: 14px 16px; border-radius: 12px; background: var(--off-soft); }
.notice strong { display: block; font-family: var(--f-display); margin-bottom: 2px; }
.notice.ok { background: var(--work-soft); color: var(--work); }
.notice.bad { background: var(--warn-soft); color: var(--warn); }

/* Employee clock */
.hello h2 { font-size: 18px; }
.face { text-align: center; padding: 22px 16px 18px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.face .time { font-family: var(--f-mono); font-size: clamp(40px, 13vw, 56px); font-weight: 500; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.face .time small { font-size: 0.4em; color: var(--muted); margin-left: 4px; }
.face .date { color: var(--muted); font-size: 14px; }
.status { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.status.sm { padding: 1px 9px; font-size: 12px; gap: 6px; }
.status.sm::before { width: 7px; height: 7px; }
.s-working { background: var(--work-soft); color: var(--work); }
.s-lunch { background: var(--lunch-soft); color: var(--lunch); }
.s-break { background: var(--break-soft); color: var(--break); }
.s-off { background: var(--off-soft); color: var(--off); }
.s-working::before { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .s-working::before { animation: none; } }
.since { font-size: 13px; color: var(--muted); min-height: 1.5em; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions .full { grid-column: 1 / -1; }
.pbtn { border: 0; border-radius: 14px; padding: 18px 12px; font: 700 17px var(--f-display); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 76px; color: var(--on-state); }
.pbtn span { font: 500 12px var(--f-body); opacity: 0.85; }
.pbtn:disabled { opacity: 0.5; }
.b-in { background: var(--work); }
.b-lunch { background: var(--lunch); }
.b-break { background: var(--break); }
.b-out { background: var(--accent); color: var(--accent-ink); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.tot { background: var(--bg); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.tot b { font-family: var(--f-mono); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.timeline { list-style: none; margin: 14px 0 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 78px 12px 1fr; gap: 10px; align-items: center; padding: 6px 0; }
.timeline .t { font-family: var(--f-mono); font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.timeline .dot { width: 10px; height: 10px; border-radius: 50%; }
.d-in, .d-lunch_end, .d-break_end { background: var(--work); }
.d-lunch_start { background: var(--lunch); }
.d-break_start { background: var(--break); }
.d-out { background: var(--accent); }
.empty { color: var(--muted); font-size: 14px; margin-top: 10px; }
.weekrow { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.weekrow b { font-family: var(--f-mono); font-size: 22px; font-variant-numeric: tabular-nums; }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; align-items: end; height: 72px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.bar i { display: block; width: 100%; max-width: 26px; background: var(--work); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar i.zero { background: var(--line); }
.bar em { font-style: normal; font-size: 11px; color: var(--muted); }
.bar.today em { color: var(--ink); font-weight: 700; }

/* Add to Home Screen */
.install { display: flex; gap: 12px; align-items: flex-start; border-color: var(--accent); }
.install img { width: 46px; height: 46px; border-radius: 11px; flex: none; }
.install .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.install .txt strong { font-family: var(--f-display); font-size: 15px; }
.install .row2 { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.linkbtn { border: 0; background: none; color: var(--muted); font: 500 13px var(--f-body); text-decoration: underline; cursor: pointer; padding: 4px 0; }
.modal.sheet { align-items: flex-end; padding: 0; }
.modal.sheet .card { width: 100%; max-width: 460px; text-align: left; align-items: stretch; border-radius: 18px 18px 0 0; padding: 20px max(20px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.ios-share { width: 19px; height: 19px; vertical-align: -4px; color: var(--break); }

/* Forms */
form.stack { display: flex; flex-direction: column; gap: 10px; }
form.row, .controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
input[type="text"], input[type="password"], input[type="date"], input[type="time"], select {
  font: 500 16px var(--f-body); padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); min-width: 0; max-width: 100%;
}
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 14px var(--f-body); padding: 9px 14px; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-block; white-space: nowrap; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.danger { color: var(--warn); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 13px var(--f-body); padding: 6px 12px; border-radius: 999px; text-decoration: none; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* Admin */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-top: 12px; }
.who { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.who .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tablewrap { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1.5px solid var(--ink); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
td.num, th.num { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; border-bottom: 0; border-top: 1.5px solid var(--ink); }
tr.emp td { background: var(--bg); font-weight: 600; }
tr.inactive td { color: var(--muted); }
.flag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }
.flag.soft { background: var(--off-soft); color: var(--muted); }
.note { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.linkbox { display: flex; gap: 6px; align-items: center; }
.linkbox input { width: 230px; font: 400 12px var(--f-mono); padding: 6px 8px; }
.inline { display: inline; }
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.modal .card { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; max-width: 340px; }
.modal #qr { background: #fff; padding: 12px; border-radius: 10px; }
.modal #qr img, .modal #qr canvas { display: block; }
