/* Zotula employee portal: the design system for the employee-facing pages
   (employee.html, time.html, employee-login.html, checkin.html,
   checkin-mobile.html, quit.html). Self-contained: these pages load this file
   instead of style.css / time.css / activity.css (which belong to the admin
   pages), so nothing here can change how the admin pages look. No external
   fonts, no CDN, no build step.

   Theme: light and dark, picked from the OS setting unless the person chose
   one with the header toggle (js/portalTheme.js sets <html data-theme>).
   Colors are only ever used through the tokens below. */

/* ---------- Tokens ---------- */

:root {
  color-scheme: light;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --bg: #f3f6f7;
  --surface: #ffffff;
  --surface-2: #f2f5f7;
  --surface-3: #e5ebee;
  --border: #d6dee3;
  --border-strong: #8494a0;
  --text: #0f1f2a;
  --text-2: #3c4c57;
  --text-3: #586873;

  /* The brand (brand/01-ring, "graphite and mint"): graphite for what is
     pressed, the mint "online light" for links, rings and what is live. */
  --primary: #1f2937;
  --primary-hover: #111827;
  --primary-soft: #e5e9ee;
  --primary-text: #15803d;
  --on-primary: #ffffff;
  --ring: #15803d;

  --ok: #166534;        --ok-soft: #dcfce7;      --ok-fill: #16a34a;
  --warn: #8a4b08;      --warn-soft: #fef3c7;    --warn-fill: #d97706;   --warn-border: #e9c46a;
  --danger: #b42318;    --danger-soft: #fee4e2;  --danger-fill: #dc2626; --danger-border: #f1a9a0;
  --info: #1e40af;      --info-soft: #dbeafe;    --info-fill: #2563eb;
  --violet: #5b21b6;    --violet-soft: #ede9fe;  --violet-fill: #7c3aed;
  --rose: #9f1239;      --rose-soft: #ffe4e6;    --rose-fill: #e11d48;
  --cyan: #155e75;      --cyan-soft: #cffafe;    --cyan-fill: #0891b2;
  --pink: #9d174d;      --pink-soft: #fce7f3;    --pink-fill: #db2777;
  --orange: #9a3412;    --orange-soft: #ffedd5;  --orange-fill: #ea580c;
  --neutral: #3c4c57;   --neutral-soft: #e5ebee; --neutral-fill: #8494a0;

  --shadow-1: 0 1px 2px rgba(15, 31, 42, 0.06), 0 1px 1px rgba(15, 31, 42, 0.04);
  --shadow-2: 0 10px 30px rgba(15, 31, 42, 0.10), 0 2px 6px rgba(15, 31, 42, 0.06);
  --overlay: rgba(15, 31, 42, 0.55);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --tap: 44px;
  --header-h: 64px;
  --tabbar-h: 64px;

  /* Names the shared time helpers (js/timeCommon.js flash()) expect. */
  --accent-2: var(--ok);
  --muted: var(--text-3);
  /* Names the scripts shared with the admin pages (timeCommon.js,
     activityDay.js, employeeForms.js) use; css/style.css defines the same. */
  --link: var(--primary-text);
  --sidebar: var(--surface);
  --primary-rgb: 31 41 55; --hover-rgb: 15 23 42; --neutral-rgb: 100 116 139;
  --ok-rgb: 22 163 74; --warn-rgb: 217 119 6; --danger-rgb: 220 38 38; --info-rgb: 37 99 235; --violet-rgb: 124 58 237;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1317;
  --surface: #131d23;
  --surface-2: #1a262d;
  --surface-3: #24333c;
  --border: #2b3b45;
  --border-strong: #63798a;
  --text: #e8eef1;
  --text-2: #bac7ce;
  --text-3: #97a7b1;

  --primary: #4ade80;
  --primary-hover: #86efac;
  --primary-soft: rgba(74, 222, 128, 0.14);
  --primary-text: #86efac;
  --on-primary: #0e131b;
  --ring: #4ade80;

  --ok: #86efac;        --ok-soft: rgba(34, 197, 94, 0.16);    --ok-fill: #22c55e;
  --warn: #fcd34d;      --warn-soft: rgba(245, 158, 11, 0.15); --warn-fill: #f59e0b;  --warn-border: rgba(245, 158, 11, 0.5);
  --danger: #fca5a5;    --danger-soft: rgba(239, 68, 68, 0.16); --danger-fill: #ef4444; --danger-border: rgba(239, 68, 68, 0.5);
  --info: #93c5fd;      --info-soft: rgba(59, 130, 246, 0.18); --info-fill: #60a5fa;
  --violet: #c4b5fd;    --violet-soft: rgba(139, 92, 246, 0.2); --violet-fill: #a78bfa;
  --rose: #fda4af;      --rose-soft: rgba(244, 63, 94, 0.18);  --rose-fill: #fb7185;
  --cyan: #67e8f9;      --cyan-soft: rgba(6, 182, 212, 0.18);  --cyan-fill: #22d3ee;
  --pink: #f9a8d4;      --pink-soft: rgba(236, 72, 153, 0.18); --pink-fill: #f472b6;
  --orange: #fdba74;    --orange-soft: rgba(249, 115, 22, 0.18); --orange-fill: #fb923c;
  --neutral: #bac7ce;   --neutral-soft: #24333c;               --neutral-fill: #63798a;

  --primary-rgb: 74 222 128; --hover-rgb: 255 255 255; --neutral-rgb: 148 163 184;
  --ok-rgb: 74 222 128; --warn-rgb: 245 158 11; --danger-rgb: 239 68 68; --info-rgb: 96 165 250; --violet-rgb: 167 139 250;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 16px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.35);
  --overlay: rgba(3, 8, 11, 0.7);
}

/* One tone per status: text color, soft background, solid fill (timeline). */
.tone-working  { --t-fg: var(--ok);      --t-bg: var(--ok-soft);      --t-fill: var(--ok-fill); }
.tone-coffee   { --t-fg: var(--warn);    --t-bg: var(--warn-soft);    --t-fill: var(--warn-fill); }
.tone-medical  { --t-fg: var(--rose);    --t-bg: var(--rose-soft);    --t-fill: var(--rose-fill); }
.tone-personal { --t-fg: var(--violet);  --t-bg: var(--violet-soft);  --t-fill: var(--violet-fill); }
.tone-official { --t-fg: var(--info);    --t-bg: var(--info-soft);    --t-fill: var(--info-fill); }
.tone-x0       { --t-fg: var(--cyan);    --t-bg: var(--cyan-soft);    --t-fill: var(--cyan-fill); }
.tone-x1       { --t-fg: var(--pink);    --t-bg: var(--pink-soft);    --t-fill: var(--pink-fill); }
.tone-x2       { --t-fg: var(--orange);  --t-bg: var(--orange-soft);  --t-fill: var(--orange-fill); }
.tone-x3       { --t-fg: var(--info);    --t-bg: var(--info-soft);    --t-fill: var(--info-fill); }
.tone-paused   { --t-fg: var(--violet);  --t-bg: var(--violet-soft);  --t-fill: var(--violet-fill); }
.tone-warn     { --t-fg: var(--warn);    --t-bg: var(--warn-soft);    --t-fill: var(--warn-fill); }
.tone-done     { --t-fg: var(--info);    --t-bg: var(--info-soft);    --t-fill: var(--info-fill); }
.tone-off      { --t-fg: var(--neutral); --t-bg: var(--neutral-soft); --t-fill: var(--neutral-fill); }
.tone-danger   { --t-fg: var(--danger);  --t-bg: var(--danger-soft);  --t-fill: var(--danger-fill); }

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 16px); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.25; text-wrap: balance; }
a { color: var(--primary-text); text-underline-offset: 3px; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
svg { flex-shrink: 0; }

:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
:focus:not(:focus-visible) { outline: none; }
/* Headings and views that only take focus from script (so a screen reader starts there). */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus, h3[tabindex="-1"]:focus, section[tabindex="-1"]:focus, div[tabindex="-1"]:focus { outline: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.muted { color: var(--text-3); }
.num, .font-mono-data { font-variant-numeric: tabular-nums; }
.font-mono-data { font-family: var(--font); }
.font-medium { font-weight: 600; }
.text-xs { font-size: 13px; }
.whitespace-nowrap { white-space: nowrap; }

.p-skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--primary); color: var(--on-primary); padding: 10px 14px; border-radius: var(--r-sm);
  font-weight: 600; text-decoration: none;
}
.p-skip:focus { top: 12px; color: var(--on-primary); }

/* ---------- Form controls ---------- */

label, .p-label { display: block; font-size: 14px; font-weight: 600; color: var(--text); margin: 0 0 6px; }
.p-hint { font-size: 13.5px; color: var(--text-3); margin-top: 6px; line-height: 1.45; }
input:not([type="radio"]):not([type="checkbox"]), select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
input:not([type="radio"]):not([type="checkbox"]), select { height: var(--tap); }
textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--text-3); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--ring); outline-offset: 1px; border-color: var(--ring); border-radius: var(--r-sm);
}
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger-fill); box-shadow: 0 0 0 1px var(--danger-fill); }
input[type="radio"], input[type="checkbox"] { width: 20px; height: 20px; margin: 0; accent-color: var(--primary); flex-shrink: 0; }
input:disabled, select:disabled, textarea:disabled { opacity: 0.55; cursor: not-allowed; }
select option { background: var(--surface); color: var(--text); }

.p-field-error, .error {
  color: var(--danger); font-size: 14px; font-weight: 500; line-height: 1.4;
}
.p-field-error { display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; }
.p-field-error:empty, .error:empty { display: none; }
.error { margin-top: 12px; }

/* ---------- Buttons ---------- */

.p-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 16px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  font-size: 15px; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 100ms ease;
}
.p-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--text-3); }
.p-btn:active { transform: translateY(1px); }
.p-btn:disabled, .p-btn[aria-disabled="true"] { opacity: 0.55; transform: none; }
.p-btn--primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.p-btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
.p-btn--soft { background: var(--primary-soft); border-color: transparent; color: var(--primary-text); }
.p-btn--soft:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-text); }
.p-btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.p-btn--ghost:hover { background: var(--surface-3); border-color: transparent; }
.p-btn--danger { background: transparent; border-color: var(--danger-border); color: var(--danger); }
.p-btn--danger:hover { background: var(--danger-soft); border-color: var(--danger-fill); color: var(--danger); }
/* White on this red is 6.6:1 in both themes. */
.p-btn--danger.confirming, .p-btn--danger-solid { background: #b42318; border-color: #b42318; color: #fff; }
.p-btn--danger.confirming:hover, .p-btn--danger-solid:hover { background: #912018; border-color: #912018; color: #fff; }
.p-btn--lg { min-height: 52px; padding: 12px 22px; font-size: 16.5px; border-radius: 10px; }
.p-btn--block { width: 100%; }
.p-btn--sm { min-height: 38px; padding: 6px 12px; font-size: 14px; }
/* Touch: every control is at least 44px tall. */
@media (pointer: coarse), (max-width: 767px) {
  .p-btn--sm { min-height: var(--tap); padding: 8px 14px; }
  .p-toast__close { width: var(--tap); height: var(--tap); margin: -10px 0; }
}

.p-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); padding: 0;
  background: transparent; color: var(--text-2);
  border: 1px solid transparent; border-radius: var(--r-sm);
  transition: background-color 150ms ease, color 150ms ease;
}
.p-iconbtn:hover { background: var(--surface-3); color: var(--text); }
.p-iconbtn:disabled { opacity: 0.4; }
.p-iconbtn--bordered { border-color: var(--border-strong); background: var(--surface); }

.p-icon { display: inline-flex; width: 20px; height: 20px; }
.p-icon svg { width: 100%; height: 100%; }

/* ---------- App shell: sidebar, top bar, content ----------
   Desktop: a left sidebar (brand, nav, person/theme/sign out) and the content
   beside it under a slim top bar. The sidebar collapses to an icon rail
   (<html data-rail>, set by js/portalTheme.js from the person's choice, or by
   default between 768 and 1023px). Phone: no sidebar; the same nav is a bottom
   tab bar and the person/theme/sign out sit in the top bar. */

.p-app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
:root { --side-w: 248px; --top-h: 64px; }
:root[data-rail] { --side-w: 72px; }

.p-side {
  position: sticky; top: 0; align-self: start; height: 100vh; height: 100dvh; z-index: 30;
  display: flex; flex-direction: column; gap: 4px; padding: 14px 12px 12px;
  background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; overflow-x: hidden;
}
.p-side__top { display: flex; align-items: center; gap: 4px; min-height: 44px; margin-bottom: 14px; }
.p-brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; text-decoration: none; color: var(--text); border-radius: var(--r-sm); padding: 2px 4px; }
.p-brand:hover { color: var(--text); }
.p-brand__mark {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: var(--primary); color: var(--on-primary);
  display: inline-flex; align-items: center; justify-content: center;
}
.p-brand__mark svg { width: 20px; height: 20px; }
/* The Zotula mark (brand/01-ring): ring and Z in the text colour, the dot in mint. */
.ring-mark { width: 34px; height: 34px; color: var(--text); flex-shrink: 0; }
:root[data-rail] .ring-mark { width: 30px; height: 30px; }
.p-brand__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.p-brand__org { font-weight: 700; font-size: 14.5px; min-height: 18px; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.p-brand__sub { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }

.p-nav { display: flex; flex-direction: column; gap: 4px; }
.p-nav a, .p-side__btn {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: var(--tap); padding: 0 12px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-2); text-decoration: none; text-align: left;
  font-size: 15px; font-weight: 600; white-space: nowrap;
  transition: color 150ms ease, background-color 150ms ease;
}
.p-nav a:hover, .p-side__btn:hover { color: var(--text); background: var(--surface-2); }
.p-nav a[aria-current="page"] { color: var(--primary-text); background: var(--primary-soft); }
.p-nav a[aria-current="page"]::before {
  content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--primary);
}
.p-nav__label, .p-side__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.p-nav__badge {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--warn); color: var(--surface); font-size: 12.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}

.p-side__foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.p-user { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: var(--tap); padding: 4px 8px 8px; }
.p-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary-soft); color: var(--primary-text);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13.5px; font-weight: 700; letter-spacing: 0.02em;
}
.p-user__name { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Icon rail: labels stay in the accessibility tree, out of sight. */
:root[data-rail] .p-side { padding-left: 14px; padding-right: 14px; }
:root[data-rail] .p-side__top { flex-direction: column; gap: 8px; }
:root[data-rail] .p-brand { flex: 0 0 auto; padding: 0; }
:root[data-rail] .p-brand__text, :root[data-rail] .p-nav__label, :root[data-rail] .p-side__label, :root[data-rail] .p-user__name {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
:root[data-rail] .p-nav a, :root[data-rail] .p-side__btn { justify-content: center; padding: 0; }
:root[data-rail] .p-nav a[aria-current="page"]::before { left: -14px; }
:root[data-rail] .p-nav__badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; font-size: 11px; padding: 0 4px; }
:root[data-rail] .p-user { justify-content: center; padding: 4px 0 8px; }

.p-content { min-width: 0; display: flex; flex-direction: column; }
.p-top {
  position: sticky; top: 0; z-index: 25; height: var(--top-h);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.p-top__in {
  max-width: 1856px; margin: 0 auto; height: 100%; padding: 0 clamp(20px, 3vw, 48px);
  display: flex; align-items: center; gap: 16px;
}
.p-top__title { display: flex; align-items: baseline; gap: 12px; min-width: 0; flex: 1; }
.p-top__title h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.p-top__date { color: var(--text-3); font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Status on every view. The timer has a fixed width, so a tick moves nothing. */
.p-top__status {
  display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 6px;
  color: var(--text); text-decoration: none; border-radius: var(--r-sm); white-space: nowrap;
}
.p-top__status:hover { color: var(--text); background: var(--surface-2); }
.p-top__status[hidden] { display: inline-flex !important; visibility: hidden; }
.p-top__timer { order: -1; min-width: 13ch; text-align: right; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-2); }
.p-top__timer:empty { display: none; }

.p-main {
  width: 100%; max-width: 1856px; margin: 0 auto; padding: 24px clamp(20px, 3vw, 48px) 64px;
  container: main / inline-size;
}
.p-view > * + * { margin-top: 20px; }
.p-view:focus { outline: none; }
.p-viewhead { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.p-viewhead p, .p-lede { color: var(--text-2); font-size: 15px; max-width: 80ch; }

/* Phone: bottom tab bar; person, theme and sign out in the top bar. */
@media (max-width: 767px) {
  :root { --top-h: 60px; }
  .p-app { display: block; }
  .p-side { display: contents; }
  .p-side__top { display: none; }
  .p-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding: 0 4px env(safe-area-inset-bottom, 0px);
    background: var(--surface); border-top: 1px solid var(--border);
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  }
  .p-nav a { flex-direction: column; justify-content: center; gap: 3px; padding: 6px 2px; font-size: 12.5px; border-radius: 0; text-align: center; }
  .p-nav a[aria-current="page"] { background: transparent; }
  .p-nav a[aria-current="page"]::before { left: 22%; right: 22%; top: 0; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .p-nav__label { flex: 0 0 auto; position: static !important; width: auto !important; height: auto !important; margin: 0 !important; clip: auto !important; }
  .p-nav__badge { position: absolute; top: 6px; left: calc(50% + 6px); right: auto; min-width: 18px; height: 18px; font-size: 11px; padding: 0 4px; }
  .p-side__foot {
    position: fixed; top: 0; right: 4px; z-index: 31; height: var(--top-h); margin: 0; padding: 0; border: 0;
    flex-direction: row; align-items: center; gap: 0;
  }
  .p-side__foot .p-user { order: 2; padding: 0 4px; }
  .p-side__foot .p-user__name, .p-side__foot .p-side__label { display: none; }
  .p-side__btn { width: var(--tap); padding: 0; justify-content: center; }
  .p-top__in { padding: 0 148px 0 16px; gap: 10px; }
  .p-top__title { flex: 0 1 auto; }
  .p-top__date, .p-top__timer { display: none; }
  .p-top__status { padding: 0; min-width: 0; overflow: hidden; }
  .p-main { padding: 16px 16px calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- Cards ---------- */

.p-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 24px; box-shadow: var(--shadow-1); container: card / inline-size;
}
.p-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.p-card__title { font-size: 17px; font-weight: 700; }
.p-card__note { color: var(--text-2); font-size: 14.5px; margin-top: 4px; max-width: 88ch; }
.p-subtitle { font-size: 14px; font-weight: 700; color: var(--text); margin: 0 0 10px; }
.p-divider { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
@media (max-width: 767px) { .p-card { padding: 18px 16px; border-radius: 14px; } }

.p-empty { color: var(--text-3); font-size: 14.5px; padding: 6px 0; }
.p-empty--box {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 28px 16px; border: 1px dashed var(--border-strong); border-radius: var(--r-md); color: var(--text-2);
}
.p-empty--box .p-icon { width: 28px; height: 28px; color: var(--text-3); }

/* ---------- Badges ---------- */

.p-badge, .badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; line-height: 1.4; white-space: nowrap;
  background: var(--t-bg, var(--neutral-soft)); color: var(--t-fg, var(--neutral));
}
.p-badge .p-icon { width: 14px; height: 14px; }
.p-badge--wrap { white-space: normal; }

/* A live cue next to "Working": pulses only while the state is live. */
.live-dot { position: relative; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.live-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: currentColor; animation: p-pulse 1.8s ease-out infinite; }
@keyframes p-pulse { 0% { transform: scale(1); opacity: 0.55; } 100% { transform: scale(2.8); opacity: 0; } }

/* ---------- Banners ---------- */

.p-banner {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-radius: var(--r-md);
  background: var(--t-bg); color: var(--text); border: 1px solid var(--t-border, transparent); font-size: 14.5px;
}
.p-banner .p-icon { color: var(--t-fg); margin-top: 1px; }
.p-banner--warn { --t-bg: var(--warn-soft); --t-fg: var(--warn); --t-border: var(--warn-border); }
.p-banner--danger { --t-bg: var(--danger-soft); --t-fg: var(--danger); --t-border: var(--danger-border); }
.p-banner--info { --t-bg: var(--info-soft); --t-fg: var(--info); }
.p-banner--ok { --t-bg: var(--ok-soft); --t-fg: var(--ok); }
.p-banner__body { flex: 1; min-width: 0; }
.p-offline { position: sticky; top: var(--top-h); z-index: 24; border-radius: 0; border-width: 0 0 1px; justify-content: center; }

/* ---------- Skeletons ---------- */

.p-skel {
  display: block; border-radius: 8px; background: var(--surface-3);
  background-image: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 60%, transparent), transparent);
  background-size: 200% 100%; background-repeat: no-repeat;
  animation: p-shimmer 1.4s ease-in-out infinite;
}
@keyframes p-shimmer { 0% { background-position: 150% 0; } 100% { background-position: -50% 0; } }

/* ---------- Toasts ---------- */

.p-toasts {
  position: fixed; z-index: 80; right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none;
}
.p-toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 8px 12px 14px; border-radius: var(--r-md);
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-2); font-size: 14.5px; font-weight: 500;
  animation: p-toast-in 180ms ease-out;
}
.p-toast .p-icon { margin-top: 1px; }
.p-toast--error { background: #b42318; color: #fff; }
.p-toast__text { flex: 1; min-width: 0; padding-top: 1px; }
.p-toast__close { width: 32px; height: 32px; margin: -5px 0; color: inherit; opacity: 0.8; }
.p-toast__close:hover { background: transparent; color: inherit; opacity: 1; }
@keyframes p-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 767px) {
  .p-toasts { right: 16px; left: 16px; width: auto; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom, 0px)); }
  .p-auth ~ .p-toasts { bottom: 16px; }
}

/* ---------- Dialogs ---------- */

dialog.p-dialog {
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-2);
  width: min(440px, calc(100vw - 32px));
}
dialog.p-dialog::backdrop { background: var(--overlay); }
.p-dialog h2 { font-size: 18px; margin-bottom: 8px; }
.p-dialog p { color: var(--text-2); font-size: 15px; white-space: pre-line; }
.p-dialog__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

dialog.p-lightbox {
  border: 0; padding: 0; background: transparent; color: #fff;
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
}
dialog.p-lightbox::backdrop { background: rgba(3, 8, 11, 0.96); }
.p-lightbox__in { display: grid; grid-template-rows: auto 1fr; height: 100%; }
.p-lightbox__bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 20px; font-size: 14.5px; }
.p-lightbox__bar .p-iconbtn, .p-lightbox__bar a { color: #fff; }
.p-lightbox__bar .p-iconbtn:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.p-lightbox__bar :focus-visible { outline-color: #fff; }
.p-lightbox__cap { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.p-lightbox__stage { min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 12px 16px; }
.p-lightbox__stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; background: #000; }

/* ---------- Today: hero ---------- */

/* One column; status + totals side by side from 620px of content; from 1080px
   a third column for what needs attention (idle review, or a short note). */
.p-today { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: stretch; }
.p-today > * { min-width: 0; }
.p-a-note { display: none; }
@container main (min-width: 620px) {
  .p-today { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
  .p-today > .p-span { grid-column: 1 / -1; }
}
@container main (min-width: 1080px) {
  .p-today { grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr) minmax(0, 1.1fr); }
  .p-a-hero { order: 1; } .p-a-totals { order: 2; } .p-a-question { order: 4; } .p-a-timeline { order: 5; }
  .p-today > .p-a-side { order: 3; grid-column: auto; }
  .p-a-note { display: flex; }
  .p-a-side .p-rows { max-height: 372px; overflow-y: auto; }
}

.p-hero { position: relative; overflow: hidden; padding: 0; display: flex; flex-direction: column; }
.p-hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--t-fill, var(--neutral-fill)); }
.p-hero__top { padding: 28px 28px 24px; }
.p-hero__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.p-hero__status { margin-top: 14px; font-size: 30px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.15; overflow-wrap: anywhere; }
.p-hero__timer {
  margin-top: 6px; min-height: 56px; display: flex; align-items: baseline; gap: 2px; flex-wrap: wrap;
  font-size: 46px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text);
}
.p-hero__timer .u { font-size: 20px; font-weight: 600; color: var(--text-3); margin: 0 10px 0 2px; letter-spacing: 0; }
.p-hero__timer .u:last-child { margin-right: 0; }
.p-hero__timer:empty { display: none; }
.p-hero__sub { margin-top: 6px; color: var(--text-2); font-size: 15px; min-height: 22px; }
.p-hero__actions { margin-top: auto; padding: 22px 28px 26px; border-top: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; gap: 18px; }
.p-hero__actions > [hidden] + * { margin-top: 0; }
.p-group__label { font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.p-group__label span { font-weight: 500; color: var(--text-3); }
.p-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.p-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 8px 14px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 999px;
  font-size: 14.5px; font-weight: 600;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.p-chip .p-icon { width: 18px; height: 18px; color: var(--t-fg, var(--text-3)); }
.p-chip:hover { border-color: var(--t-fg, var(--text-2)); background: var(--surface); }
.p-chip[aria-pressed="true"] { background: var(--t-bg); border-color: var(--t-fg); color: var(--t-fg); box-shadow: inset 0 0 0 1px var(--t-fg); }
.p-chip:disabled { opacity: 0.55; }
.p-hero__cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.p-hero__cta .p-hint { margin: 0; flex: 1; min-width: 200px; }
.p-meter { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: 2px 0 12px; }
.p-meter span { display: block; height: 100%; border-radius: 999px; background: var(--violet-fill); transition: width 300ms ease; }
.p-pause__text { font-size: 14.5px; color: var(--text-2); margin-bottom: 10px; }
.p-pause__text.on { color: var(--violet); font-weight: 600; }
@container card (max-width: 460px) {
  .p-hero__top { padding: 22px 16px 18px; }
  .p-hero__actions { padding: 18px 16px 20px; }
  .p-hero__status { font-size: 25px; }
  .p-hero__timer { font-size: 38px; min-height: 48px; }
  .p-hero__timer .u { font-size: 17px; margin-right: 8px; }
  .p-hero__cta .p-btn--lg { width: 100%; }
}
.p-hero { container: card / inline-size; }

/* ---------- Today: totals ---------- */

.p-totals { display: flex; flex-direction: column; }
.p-stat { padding: 14px 0; border-top: 1px solid var(--border); }
.p-stat:first-of-type { border-top: 0; padding-top: 0; }
.p-stat__label { font-size: 13.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.p-stat__value { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; line-height: 1.25; margin-top: 2px; }
.p-stat__value small { font-size: 14.5px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.p-breakdown { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.p-breakdown li { display: flex; align-items: baseline; gap: 8px; font-size: 14.5px; min-width: 0; }
.p-breakdown .p-dot { align-self: center; }
.p-breakdown .name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.p-breakdown .sec { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.p-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--t-fill, var(--neutral-fill)); flex-shrink: 0; }
.p-dot--round { border-radius: 50%; }

/* ---------- Timeline ---------- */

.p-track { position: relative; height: 28px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.p-track span { position: absolute; top: 0; bottom: 0; min-width: 2px; background: var(--t-fill, var(--neutral-fill)); }
.p-track .seg--hatch {
  background: repeating-linear-gradient(135deg, var(--t-fill) 0 5px, color-mix(in srgb, var(--t-fill) 45%, var(--surface)) 5px 10px);
}
.p-track .seg--mark { width: 4px; min-width: 4px; background: var(--danger-fill); transform: translateX(-2px); }
.p-ticks { position: relative; height: 20px; margin-top: 4px; font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.p-ticks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.p-ticks span:first-child { transform: none; }
.p-ticks span:last-child { transform: translateX(-100%); }
.p-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 13.5px; color: var(--text-2); }
.p-legend span { display: inline-flex; align-items: center; gap: 7px; }
.p-legend .p-dot.hatch { background: repeating-linear-gradient(135deg, var(--t-fill) 0 3px, color-mix(in srgb, var(--t-fill) 45%, var(--surface)) 3px 6px); }
.p-legend .p-dot.mark { width: 4px; border-radius: 2px; background: var(--danger-fill); }

.p-events { list-style: none; margin: 18px 0 0; padding: 0; }
.p-events li { position: relative; display: grid; grid-template-columns: 76px 20px 1fr auto; gap: 0 10px; align-items: center; min-height: 40px; font-size: 14.5px; }
.p-events .time { color: var(--text-2); font-variant-numeric: tabular-nums; }
.p-events .node { position: relative; align-self: stretch; display: flex; align-items: center; justify-content: center; }
.p-events .node::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: var(--border); }
.p-events li:first-child .node::before { top: 50%; }
.p-events li:last-child .node::before { bottom: 50%; }
.p-events li:only-child .node::before { display: none; }
.p-events .node i { position: relative; width: 12px; height: 12px; border-radius: 50%; background: var(--t-fill, var(--neutral-fill)); box-shadow: 0 0 0 3px var(--surface); }
.p-events .what { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.p-events .spent { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
@container card (max-width: 440px) { .p-events li { grid-template-columns: 62px 16px 1fr auto; gap: 0 8px; font-size: 14px; } }
/* Very wide: the list in two columns. */
@container card (min-width: 1100px) { .p-events { columns: 2; column-gap: 56px; } .p-events li { break-inside: avoid; } }

/* ---------- Needs your attention ---------- */

.p-attention { border-color: var(--warn-border); }
.p-attention__head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.p-attention__head .p-icon { color: var(--warn); width: 22px; height: 22px; }
.p-attention__block + .p-attention__block { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }

.p-rows { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.p-rows > li { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.p-rows > li:first-child { border-top: 0; }
.p-rows .main { flex: 1; min-width: 180px; }
.p-rows .primary { font-weight: 600; font-variant-numeric: tabular-nums; }
.p-rows .secondary { color: var(--text-2); font-size: 14px; margin-top: 1px; }
.p-rows .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.p-bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 14px 0 12px; }
.p-bulk .p-hint { margin: 0 auto 0 0; }
@container card (max-width: 420px) {
  .p-rows .acts { width: 100%; }
  .p-rows .acts .p-btn { flex: 1; }
}

/* ---------- My data ---------- */

.p-datebar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.p-datebar input[type="date"] { width: auto; min-width: 170px; }
.p-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 12px; }
.p-tile { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; min-height: 78px; }
.p-tile .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; line-height: 1.25; }
.p-tile .l { color: var(--text-2); font-size: 13.5px; margin-top: 2px; }
.p-split { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.p-split span { display: block; height: 100%; min-width: 2px; background: var(--t-fill); }
.c-productive { --t-fill: var(--ok-fill); }
.c-neutral { --t-fill: var(--neutral-fill); }
.c-unproductive { --t-fill: var(--danger-fill); }
.t-working { --t-fill: var(--ok-fill); }
.t-paused { --t-fill: var(--violet-fill); }
.t-idleKept { --t-fill: var(--cyan-fill); }
.t-idlePending { --t-fill: var(--warn-fill); }
.t-idleDiscarded { --t-fill: var(--neutral-fill); }
.t-claimed { --t-fill: var(--info-fill); }

.p-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
.p-list { list-style: none; margin: 0; padding: 0; }
.p-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 14.5px; min-width: 0; }
.p-list li:first-child { border-top: 0; }
.p-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-list .sec { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

.p-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.p-shot {
  display: block; padding: 0; text-align: left; background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.p-shot:hover { border-color: var(--primary); box-shadow: var(--shadow-1); }
.p-shot img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-3); }
.p-shot span { display: block; padding: 6px 10px; font-size: 13.5px; font-variant-numeric: tabular-nums; }

.p-downloads { display: flex; flex-wrap: wrap; gap: 10px; }
.p-explain { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.p-explain__item { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px; }
.p-explain__item h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.p-explain__item h3 .p-icon { color: var(--primary-text); }
.p-explain__item ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 14.5px; display: grid; gap: 4px; }
.p-notice {
  margin-top: 14px; padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--border);
  border-left: 4px solid var(--primary); background: var(--surface-2); font-size: 14.5px; color: var(--text); white-space: pre-wrap;
}
.p-notice footer { margin-top: 10px; color: var(--text-3); font-size: 13.5px; white-space: normal; }

/* ---------- History ---------- */

.p-hist { list-style: none; margin: 0; padding: 0; }
.p-hist > li { padding: 16px 0; border-top: 1px solid var(--border); }
.p-hist > li:first-child { border-top: 0; padding-top: 0; }
.p-hist > li:last-child { padding-bottom: 0; }
.p-hist__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.p-hist__title { font-weight: 700; font-size: 15.5px; }
.p-hist__when { color: var(--text-2); font-size: 14px; font-variant-numeric: tabular-nums; margin-top: 1px; }
.p-kv { display: grid; grid-template-columns: 132px 1fr; gap: 4px 12px; margin: 10px 0 0; font-size: 14.5px; }
.p-kv dt { color: var(--text-3); }
.p-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@container card (max-width: 460px) { .p-kv { grid-template-columns: 1fr; gap: 0; } .p-kv dd { margin-bottom: 6px; } }

/* ---------- My time (time.html; class names shared with js/time.js) ---------- */

.t-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-1); container: card / inline-size; }
.t-card h2 { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.t-card .t-sub { color: var(--text-2); font-size: 14.5px; margin: 0 0 16px; }
.t-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.t-row .field { flex: 1; min-width: 170px; }
.t-row .field.narrow { flex: 0 0 130px; min-width: 0; }
.t-row .field.date { flex: 0 0 170px; min-width: 0; }
.t-row .field.auto { flex: 0 0 auto; min-width: 0; display: flex; gap: 8px; }
button.t-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 8px 14px; white-space: nowrap;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  font-size: 14.5px; font-weight: 600; transition: background-color 150ms ease, border-color 150ms ease;
}
button.t-btn:hover { background: var(--surface-2); border-color: var(--text-3); }
button.t-btn:disabled { opacity: 0.55; }
button.t-btn.primary-sm, button.start-btn { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
button.t-btn.primary-sm:hover, button.start-btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
button.t-btn.ghost { background: transparent; border-color: transparent; color: var(--primary-text); }
button.t-btn.ghost:hover { background: var(--surface-3); }
button.t-btn.danger { color: var(--danger); border-color: var(--danger-border); }
button.t-btn.danger:hover { background: var(--danger-soft); }
button.t-btn.icon { width: var(--tap); padding: 0; }
.t-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.t-msg { font-size: 14px; font-weight: 500; margin-top: 10px; }
.t-msg:empty { display: none; }
.t-scroll { overflow-x: auto; margin: 6px -8px 0; padding: 0 8px; }
table.t-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.t-table th { color: var(--text-2); font-weight: 600; font-size: 13.5px; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
table.t-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
table.t-table td.wrap { white-space: normal; min-width: 160px; max-width: 260px; }
table.t-table tbody tr:last-child td { border-bottom: 0; }
table.t-table tfoot td { border-top: 1px solid var(--border-strong); border-bottom: 0; }
table.t-table td.num, table.t-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t-table tr.is-today td { background: var(--primary-soft); }
.t-empty { color: var(--text-3); font-size: 14.5px; text-align: center; padding: 22px 12px; }
.t-warn { color: var(--warn); font-weight: 600; }
.t-danger { color: var(--danger); }
.timer-running { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.timer-running .live-dot { color: var(--ok-fill); }
.timer-clock { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; line-height: 1.2; }
.timer-what { flex: 1; min-width: 200px; }
.week-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.week-nav .label { font-weight: 700; font-size: 16px; margin: 0 6px; font-variant-numeric: tabular-nums; }
.sheet-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.review-note { font-size: 14.5px; border-radius: var(--r-sm); padding: 10px 14px; margin-top: 12px; background: var(--t-bg); color: var(--t-fg); }
.review-note.rejected { --t-bg: var(--danger-soft); --t-fg: var(--danger); }
.review-note.approved { --t-bg: var(--ok-soft); --t-fg: var(--ok); }
.review-note.submitted { --t-bg: var(--info-soft); --t-fg: var(--info); }
.p-stack > * + * { margin-top: 20px; }
@media (max-width: 767px) { .t-card { padding: 18px 16px; border-radius: 14px; } .sheet-status { margin-left: 0; width: 100%; } }
@container card (max-width: 560px) {
  .t-row .field { flex: 1 1 100%; }
  .t-row .field.narrow { flex: 1 1 calc(50% - 6px); }
  .t-row .field.date { flex: 1 1 100%; }
  .t-row .field.auto .t-btn { flex: 1; }
}

/* ---------- Wide layouts (by the content's own width) ---------- */

.p-a-note { flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.p-a-note__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
.p-a-note__icon { width: 48px; height: 48px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--t-bg); color: var(--t-fg); }
.p-a-note__icon .p-icon { width: 24px; height: 24px; }
.p-a-note h2 { font-size: 18px; }
.p-a-note p { color: var(--text-2); font-size: 15px; max-width: 46ch; }

.p-grid2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.p-grid2 > * { min-width: 0; }
.p-sumgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 40px; }
.p-shots { grid-template-columns: repeat(auto-fill, minmax(clamp(168px, 15cqi, 280px), 1fr)); }
@container main (min-width: 1100px) {
  .p-grid2--hist { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
  .p-grid2--foot { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); align-items: stretch; }
  .p-grid2--time { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: stretch; }
}
@container card (min-width: 1000px) {
  .p-sumgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
  .p-tiles { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}

/* ---------- Standalone pages: sign in, check-in, quit ---------- */

.p-auth {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 72px 16px 32px;
}
.p-auth__theme { position: fixed; top: 12px; right: 12px; }
.p-auth__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.p-auth__card {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 32px; box-shadow: var(--shadow-2);
}
.p-auth__card--wide { max-width: 560px; }
.p-auth__card h1 { font-size: 23px; font-weight: 700; letter-spacing: -0.01em; }
.p-auth__card h1 + p, .p-auth__card .subtitle { color: var(--text-2); font-size: 15px; margin: 6px 0 22px; }
.p-auth__card > label, .p-auth__card form > label { margin-top: 16px; }
.p-auth__card .p-banner { margin-bottom: 4px; }
.p-auth__card .p-btn--block { margin-top: 22px; }
.p-auth__card p + p { margin-top: 10px; }
.p-auth__foot { text-align: center; font-size: 14.5px; margin-top: 18px; }
.p-auth__foot a { display: inline-flex; align-items: center; min-height: var(--tap); }
.org-name { color: var(--text-3); font-size: 14px; font-weight: 600; margin: 0 0 2px; }
.status-line { font-size: 14.5px; color: var(--text-2); margin-top: 14px; min-height: 22px; text-align: center; }
.status-line.success { color: var(--ok); }
.status-line.warn { color: var(--danger); font-weight: 500; }
.step[hidden] { display: none; }
.pin-input { font-size: 30px !important; letter-spacing: 12px; text-align: center; font-variant-numeric: tabular-nums; height: 60px !important; padding-left: 24px !important; }
.notice-box {
  background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: var(--r-sm);
  padding: 14px 16px; font-size: 15px; line-height: 1.55; max-height: 260px; overflow-y: auto; margin: 16px 0 4px; white-space: pre-wrap;
}
.method-tabs { display: flex; gap: 4px; padding: 4px; margin: 18px 0 20px; background: var(--surface-3); border-radius: 10px; }
.method-tabs .tab-btn {
  flex: 1; min-height: 40px; padding: 6px 10px; background: transparent; color: var(--text-2);
  border: 0; border-radius: 7px; font-size: 14.5px; font-weight: 600;
}
.method-tabs .tab-btn:hover { color: var(--text); }
.method-tabs .tab-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
/* One way to verify only: no switcher to show. */
.method-tabs:not(:has(.tab-btn:not([hidden]) ~ .tab-btn:not([hidden]))) { display: none; }
.method-tabs:not(:has(.tab-btn:not([hidden]) ~ .tab-btn:not([hidden]))) + .method-panel { margin-top: 20px; }
.method-panel { display: none; }
.method-panel.active { display: block; }
video.face-preview { display: block; width: 100%; border-radius: var(--r-md); background: #000; transform: scaleX(-1); border: 1px solid var(--border); }
.face-frame { position: relative; }
.face-frame .face-ring { position: absolute; inset: 8%; border: 3px solid color-mix(in srgb, var(--primary) 60%, transparent); border-radius: 50%; pointer-events: none; }
.face-frame.matched .face-ring { border-color: var(--ok-fill); }
.face-frame.mismatched .face-ring { border-color: var(--danger-fill); }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.qr-box #qrCanvas { background: #fff; padding: 12px; border-radius: var(--r-md); border: 1px solid var(--border); min-height: 244px; min-width: 244px; }
.success-check {
  width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; font-size: 30px; font-weight: 700;
}
.success-check svg { width: 32px; height: 32px; }
.p-center { text-align: center; }
.quit-actions { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.quit-actions .p-btn { flex: 1; min-width: 140px; }
strong.warn { color: var(--warn); font-weight: 700; }
@media (max-width: 480px) { .p-auth__card { padding: 24px 18px; } .p-auth { padding-top: 64px; } }

/* ---------- Motion preference ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .live-dot::after { animation: none; opacity: 0; }
  .p-skel { animation: none; background-image: none; }
}

@media print {
  .p-side, .p-nav, .p-toasts, .p-offline { display: none !important; }
  .p-app { display: block; }
  body { background: #fff; }
}

/* ----- Phone app (employee.html #phone) ----- */
.p-steps { margin: 0 0 18px; padding-left: 20px; display: grid; gap: 8px; color: var(--text-2); }
.p-steps b { color: var(--text); }
.p-pair { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.p-pair__qr { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px; background: #fff; border: 1px solid var(--border); border-radius: var(--r-md); }
.p-pair__qr img, .p-pair__qr canvas { display: block; width: 220px; height: 220px; }
.p-pair__left { margin: 0; font-size: 13px; color: #334155; font-variant-numeric: tabular-nums; }

/* Two counters on the Today card: worked today, and the current stretch. */
.p-hero__timer { display: flex; flex-wrap: wrap; gap: 6px 36px; align-items: flex-end; }
.p-hero__t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.p-hero__t .l { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); line-height: 1.2; }
.p-hero__t .v { line-height: 1.05; white-space: nowrap; }
.p-hero__t--now .v { font-size: 0.72em; color: var(--text-2); }
.p-hero__t--now .v .u { font-size: 15px; }
@media (max-width: 767px) { .p-hero__timer { gap: 10px 24px; } }

/* Check-in page, Mobile phone tab: the code as a fallback under "Send to my phone". */
.qr-fallback { margin-top: 18px; text-align: left; }
.qr-fallback > summary { cursor: pointer; color: var(--text-2); font-size: 14px; padding: 6px 0; }
.qr-fallback[open] > summary { margin-bottom: 8px; }

/* Check-in page on a shared PC: "Who are you?", then the PIN. */
.who-search { margin: 4px 0 12px; }
.who-list { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow-y: auto; margin: 0; padding: 2px; list-style: none; }
.who-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 48px; padding: 10px 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text);
  font-size: 16px; font-weight: 600; text-align: left; cursor: pointer;
}
.who-item:hover:not(:disabled), .who-item:focus-visible { border-color: var(--primary); background: var(--primary-soft); }
.who-item:disabled { opacity: 0.55; cursor: not-allowed; }
.who-item small { font-size: 13px; font-weight: 500; color: var(--text-3); }
.who-switch { margin: 2px 0 0; font-size: 14px; color: var(--text-2); }
.who-switch button { background: none; border: 0; padding: 0; color: var(--primary-text); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }

/* "Continue with Google" (js/googleButton.js): Google's own button colours, in both themes. */
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: var(--tap);
  padding: 10px 16px; border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: #ffffff; color: #1f1f1f; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.google-btn:hover { background: #f3f4f6; }
.google-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.or-line { display: flex; align-items: center; gap: 12px; margin: 18px 0 6px; color: var(--text-3); font-size: 13px; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- Your photo for face check-in (My data; js/portalPhoto.js) ---------- */

.p-photo { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.p-photo__frame {
  width: 112px; height: 112px; flex: none; display: grid; place-items: center; overflow: hidden;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface-2); color: var(--text-3);
}
.p-photo__frame img { width: 100%; height: 100%; object-fit: cover; }
.p-photo__frame svg { width: 44px; height: 44px; }
.p-photo__side { flex: 1; min-width: 220px; }
.p-photo__status { color: var(--text-2); font-size: 14.5px; margin-bottom: 12px; }
.p-photo__acts { display: flex; gap: 10px; flex-wrap: wrap; }
