/* Ticker — "time card" look: flat paper surfaces, 1px rules, colour only for state. */
:root {
  --text: #1C2733;   /* ink */
  --bg: #EEF1F4;     /* paper */
  --card: #FFFFFF;
  --line: #C5CED8;   /* rule */
  --soft: #E4E9EE;   /* row shading */
  --muted: #586575;
  --in: #13795B;     /* punch green: clocked in */
  --bad: #B42318;    /* stamp red: needs attention */
  --warn: var(--bad);
  --accent: #2457C5; /* ledger blue: actions, focus, today */
  --out: var(--muted);
  --radius: 6px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --text: #E4E9EF; --bg: #12181F; --card: #19212A; --line: #2C3744; --soft: #202A35; --muted: #93A0AE;
  --in: #3CB98A; --bad: #F0675C; --accent: #7EA2F2;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", "PingFang TC", "PingFang SC", "Microsoft JhengHei", "Microsoft YaHei", "Noto Sans CJK TC", sans-serif;
  font-variant-numeric: tabular-nums; background: var(--bg); color: var(--text); -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 650; }
h1 { font-size: 23px; }
h2 { font-size: 18px; }
p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.logo img { width: 26px; height: 26px; border-radius: 6px; }

button, .btn {
  font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
button:hover:not(:disabled), .btn:hover { border-color: var(--text); }
button:disabled { opacity: .5; cursor: default; }
button.small, .btn.small { padding: 4px 10px; font-size: 13px; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .primary { color: #0E1520; }
.danger { color: var(--bad); }
.primary.danger { background: var(--bad); border-color: var(--bad); color: #fff; } /* destructive confirm buttons */
.ghost { background: transparent; border-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select, textarea {
  font: inherit; font-size: 16px; /* < 16px makes iOS zoom in on focus */
  color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; }
label.check input { width: auto; }

/* segmented control: the chosen option is filled with ink */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.seg button { border: 0; border-radius: 0; padding: 6px 12px; background: transparent; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--text); color: var(--card); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }

/* state chips: text says the state, colour repeats it */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.in { color: var(--in); background: color-mix(in srgb, var(--in) 12%, var(--card)); }
.pill.bad, .pill.warn { color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--card)); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--soft); white-space: nowrap; }
th { font-size: 12.5px; font-weight: 600; color: var(--muted); border-bottom-color: var(--line); }
tr.void td { opacity: .45; text-decoration: line-through; }
.scroll { overflow: auto; }

dialog { border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); padding: 20px; width: min(420px, calc(100% - 32px)); }
dialog::backdrop { background: rgb(14 20 28 / .45); }
dialog form { display: grid; gap: 12px; }

#toast[popover] { inset: auto auto 24px 50%; margin: 0; padding: 0; border: 0; background: transparent; overflow: visible; }
#toast { pointer-events: none; position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; }
#toast div { background: var(--text); color: var(--card); padding: 10px 16px; border-radius: var(--radius); max-width: 90vw; }
#toast .bad { background: var(--bad); color: #fff; }
#toast .good { background: var(--in); color: #fff; }

.center { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
/* phones: keep the login form in the top half so the on-screen keyboard doesn't cover it */
@media (max-width: 600px) { .center { place-items: start center; padding-top: max(24px, 6vh); } }
.login { width: min(360px, 100%); display: grid; gap: 14px; }
.pinbox { letter-spacing: .5em; font-size: 22px; text-align: center; }

/* availability editor (lib.js availEditor): day | mode, then the time ranges and a note */
.arows { display: grid; gap: 12px; }
.arow { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 6px 10px; align-items: center; }
.arow b small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.arow .times, .arow .anote { grid-column: 2; }
.arow .times { display: grid; gap: 6px; justify-items: start; }
.arow .rg { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; gap: 4px; align-items: center; width: 100%; }
.arow .rg input { min-width: 0; padding: 6px 8px; } /* native time inputs don't shrink on their own */
.arow .rg input::-webkit-calendar-picker-indicator { display: none; } /* room for AM / PM on phones; typing and arrows still work */
.arow .anote { padding: 6px 8px; }

/* the one motion: the time "stamps" after a punch */
@keyframes stamp { from { transform: scale(1.12); color: var(--accent); } to { transform: scale(1); } }
.stamped { animation: stamp .35s ease-out; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
