  :root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface2: #f0f1f4;
    --border: #e4e6eb;
    --border2: #d0d3da;
    --text: #1a1d23;
    --muted: #6b7280;
    --accent: #2563eb;
    --accent-dim: rgba(37,99,235,0.08);
    --accent-dark: #1d4ed8;
    --danger: #dc2626;
    --danger-dim: rgba(220,38,38,0.09);
    --success: #16a34a;
    --success-dim: rgba(22,163,74,0.10);
    --warning: #d97706;
    --warning-dim: rgba(217,119,6,0.10);
    --warning-dark: #b45309;
    --violet: #7c3aed;
    --violet-dim: rgba(124,58,237,0.10);
    /* D9c: was #9ca3af — 2.35:1 on --bg and 2.54:1 on a card, well under the
       4.5:1 WCAG AA needs for normal text, and this is used at ~11.5px for
       real information (the punch-refusal hints, report footnotes). #676d76
       clears 4.5:1 on all three surfaces it actually appears on: --bg 4.82,
       --surface 5.22, --surface2 4.62.
       It ends up close to --muted, and that is the honest outcome: a colour
       light enough to be visibly "fainter" than --muted is a colour too light
       to read. The hierarchy is carried by size and weight instead. */
    --faint: #676d76;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --page: #eceef2;
    --chrome: #1a1d23;
  }
  @media (prefers-color-scheme: dark) { :root { --page: #101216; --chrome: #e7e9ee; } }
  :root[data-theme="dark"]  { --page: #101216; --chrome: #e7e9ee; }
  :root[data-theme="light"] { --page: #eceef2; --chrome: #1a1d23; }

  * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

  body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    /* These two lines are the whole browser floor. An engine that does not know
       dvh drops the declaration entirely and the layout collapses — on exactly
       the un-updated Android WebView this app targets. The fallback first, the
       override second, takes the floor from Chrome 108 to Chrome 88. */
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
  }

  .screen {
    display: none;
    width: 100%;
    max-width: 420px;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px 20px 32px;
    flex-direction: column;
    animation: fadeUp 0.25s ease both;
  }
  .screen.active { display: flex; }

  /* D3. These two values were inline on #owner-content and #master-content in
     index.html, where a stylesheet could not override them. Same numbers, so
     phone rendering is unchanged: .screen already caps at 420px, and 640 is
     bigger than that, so this has never been the binding constraint on a
     phone. Moving it here is what lets the desktop query below exist. */
  .wide-content { max-width: 640px; margin: 0 auto; padding: 0 16px 40px; }

  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* ── Logo / header ── */
  .logo {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--accent);
  }
  .logo span { color: var(--muted); font-weight: 400; }

  .page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
  }

  .back-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: var(--shadow);
  }
  .back-btn:hover { color: var(--text); border-color: var(--border2); }

  /* ── Greeting ── */
  .greeting { margin-bottom: 28px; }
  .greeting h1 {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.5px;
    color: var(--text);
  }
  .greeting p {
    color: var(--muted);
    font-size: 14px;
    margin-top: 5px;
    font-weight: 400;
  }

  /* ── Employee list ── */
  .emp-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    flex: 1;
  }

  /* A real <button> so it is keyboard-focusable and announced to screen
     readers; these resets strip the native button chrome so it still looks like
     the card it always was. width:100% + text-align:left keep the flex layout. */
  .emp-card {
    width: 100%;
    text-align: left;
    font: inherit;
    color: inherit;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: var(--shadow);
  }
  .emp-card:active { transform: scale(0.985); }
  .emp-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
  /* A visible focus ring for keyboard users, suppressed for mouse/touch. */
  .emp-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  .emp-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--accent-dim);
    border: 1.5px solid rgba(37,99,235,0.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 600; color: var(--accent);
    flex-shrink: 0;
  }

  .emp-info { flex: 1; min-width: 0; }
  .emp-name { font-size: 14px; font-weight: 600; color: var(--text); }
  .emp-role { font-size: 12px; color: var(--muted); margin-top: 1px; }

  .emp-status {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 9px;
    border-radius: 20px;
    flex-shrink: 0;
  }
  .emp-status.in  { background: var(--success-dim); color: var(--success); border: 1px solid rgba(22,163,74,0.2); }
  .emp-status.out { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
  .emp-status.done { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(37,99,235,0.2); }

  /* ── PIN screen ── */
  .pin-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .pin-employee {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }

  .pin-dots {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 32px;
  }
  .pin-dot {
    width: 13px; height: 13px;
    border-radius: 50%;
    border: 2px solid var(--border2);
    transition: all 0.15s;
  }
  .pin-dot.filled {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.15);
  }
  .pin-dot.error {
    background: var(--danger);
    border-color: var(--danger);
    animation: shake 0.35s ease;
  }

  @keyframes shake {
    0%,100% { transform: translateX(0); }
    20%      { transform: translateX(-6px); }
    40%      { transform: translateX(6px); }
    60%      { transform: translateX(-4px); }
    80%      { transform: translateX(4px); }
  }

  .numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  /* Keyboard users get a visible focus ring on every interactive element;
     :focus-visible keeps it off for mouse and touch, so the look is unchanged
     for the vast majority who never tab. Accessibility basics (chunk 6). */
  button:focus-visible, a:focus-visible, input:focus-visible,
  select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  .num-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 17px 10px;
    font-family: 'Inter', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
  }
  .num-btn:active { background: var(--surface2); transform: scale(0.94); box-shadow: none; }
  .num-btn.del { font-size: 15px; color: var(--muted); }
  .num-btn.empty { opacity: 0; pointer-events: none; }

  .pin-hint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 14px; }

  .pin-submit-btn {
    width: 100%;
    margin-top: 18px;
    padding: 15px;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    border: none;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
    transition: all 0.15s;
    display: none;
  }
  .pin-submit-btn.visible { display: block; }
  .pin-submit-btn:active { transform: scale(0.97); }

  .loading-overlay {
    position: fixed; inset: 0;
    background: rgba(245,246,248,0.85);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    z-index: 200;
    font-size: 14px;
    color: var(--muted);
    font-weight: 500;
  }
  .loading-overlay.show { display: flex; }
  .spinner {
    width: 28px; height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* ── Dashboard ── */
  .dash-header { margin-bottom: 20px; }
  .dash-header h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
  .dash-header .date-str { font-size: 13px; color: var(--muted); margin-top: 3px; }

  .time-card {
    background: var(--accent);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: 0 4px 14px rgba(37,99,235,0.25);
  }
  .time-card-label {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
    font-weight: 500;
  }
  .time-card-value {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
  }
  .time-card-value.muted { color: rgba(255,255,255,0.5); font-size: 26px; }
  .time-card-sub { font-size: 12px; color: rgba(255,255,255,0.75); margin-top: 5px; }

  .stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
  }

  .stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
  }
  .stat-label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 5px;
    font-weight: 500;
  }
  .stat-value { font-size: 20px; font-weight: 700; }
  .stat-value.green { color: var(--success); }
  .stat-value.yellow { color: var(--warning); }
  .stat-value.red { color: var(--danger); }
  .stat-value.accent { color: var(--accent); }

  /* ── CTA buttons ── */
  .cta-btn {
    width: 100%;
    padding: 16px;
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    margin-bottom: 10px;
    letter-spacing: -0.1px;
  }
  .cta-btn:active { transform: scale(0.97); }
  .cta-btn:disabled { opacity: 0.4; cursor: not-allowed; }

  .cta-btn.primary {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
  }
  .cta-btn.primary:hover { background: var(--accent-dark); }
  .cta-btn.danger {
    background: var(--danger);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(220,38,38,0.3);
  }
  .cta-btn.ghost {
    background: var(--surface);
    color: var(--muted);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .cta-btn.ghost:hover { color: var(--text); border-color: var(--border2); }

  /* .cta-btn defaults to width:100% for the big stacked CTAs. When one is
     placed in a flex row as a non-growing item (style="…flex:0 0 auto…"),
     that 100% becomes its flex-basis and squishes its row siblings (e.g. the
     "Add city" input, the fee field next to Save/Suspend). Force auto width
     in that case so the row lays out naturally. */
  .cta-btn[style*="flex:0 0 auto"],
  .cta-btn[style*="flex: 0 0 auto"] { width: auto; }

  /* ── History ── */
  .history-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 12px;
    flex: 1;
    overflow-y: auto;
  }

  .history-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
  }

  .history-date { font-size: 13px; font-weight: 600; }
  .history-times { font-size: 11px; color: var(--muted); margin-top: 2px; }
  .history-salary { font-size: 13px; font-weight: 600; color: var(--success); }
  .history-salary.absent { color: var(--danger); }

  /* ── Admin screen ── */
  .admin-section { margin-bottom: 24px; }
  .section-title {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 10px;
    font-weight: 600;
  }

  .input-group { margin-bottom: 10px; }
  .input-label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
    margin-bottom: 5px;
    display: block;
  }
  .text-input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-shadow: var(--shadow);
  }
  .text-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
  .text-input::placeholder { color: #9ca3af; }

  .salary-prefix { position: relative; }
  .salary-prefix .prefix {
    position: absolute;
    left: 13px; top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 14px;
    pointer-events: none;
  }
  .salary-prefix .text-input { padding-left: 28px; }

  .salary-details { margin-top:10px; padding-top:10px; border-top:1px solid rgba(255,255,255,0.18); font-size:12px; line-height:1.5; opacity:0.9; text-align:left; }

  .emp-admin-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 7px;
    box-shadow: var(--shadow);
  }
  .emp-admin-info { flex: 1; }
  .emp-admin-name { font-size: 14px; font-weight: 600; }
  .emp-admin-rate { font-size: 12px; color: var(--muted); margin-top: 1px; }
  .emp-admin-actions { display: flex; gap: 6px; }
  .emp-delete-btn {
    background: var(--danger-dim);
    border: 1px solid rgba(220,38,38,0.2);
    color: var(--danger);
    padding: 5px 11px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: all 0.15s;
  }
  .emp-delete-btn:hover { background: rgba(220,38,38,0.15); }

  /* Manual attendance button */
  .emp-manual-btn {
    background: var(--warning-dim);
    border: 1px solid rgba(217,119,6,0.2);
    color: var(--warning);
    padding: 5px 11px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: all 0.15s;
  }
  .emp-manual-btn:hover { background: rgba(217,119,6,0.15); }

  /* Admin link on login */
  .admin-link {
    text-align: center;
    margin-top: auto;
    padding-top: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
  }
  .admin-link:hover { color: var(--accent); }

  /* Toast */
  /* Sits above the bottom tab bar, and WRAPS. It used to be a nowrap pill
     pinned 28px up, which was fine for "Saved" but silently clipped anything
     longer at both edges and hid it behind the tabs — so the one message that
     matters most, why a punch was refused, was the one nobody could read. */
  .toast {
    position: fixed;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    /* Centred with auto margins rather than left:50% + translateX(-50%):
       with only `left` set, the available width is the space to the RIGHT of
       that point, so a wrapping toast could never grow past half the screen. */
    left: 12px;
    right: 12px;
    margin-inline: auto;
    width: fit-content;
    max-width: min(92vw, 420px);
    /* Must clear its own height PLUS the bottom offset, or the "hidden" toast
       just sits lower on screen and never actually goes away. A fixed 80px
       worked only while bottom was 28px and the toast was one line tall. */
    transform: translateY(calc(100% + 96px));
    background: var(--text);
    border-radius: 16px;
    padding: 12px 18px;
    font-size: 13px;
    line-height: 1.45;
    font-weight: 500;
    text-align: center;
    color: #ffffff;
    z-index: 999;
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
    box-shadow: var(--shadow-md);
  }
  .toast.show { transform: translateY(0); }

  .live-clock { font-size: 13px; color: var(--muted); font-weight: 500; }

  /* Section divider */
  .divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
  }

  /* Scrollbar */
  ::-webkit-scrollbar { width: 4px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

  /* Modal overlay for manual attendance */
  /* Phase 6: bottom-sheet look (matches .sheet) — same .open mechanics. */
  .modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,17,21,0.45);
    z-index: 100;
    align-items: flex-end;
    justify-content: center;
  }
  .modal-overlay.open { display: flex; }
  .modal-box {
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    padding: 20px 20px 26px;
    width: 100%;
    max-width: 520px;
    max-height: 88%;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    animation: slideUp 0.25s ease;
  }
  @keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
  }
  .modal-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
  .modal-sub { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
  .modal-actions { display: flex; gap: 8px; margin-top: 16px; }
  .modal-actions .cta-btn { margin-bottom: 0; flex: 1; }
  .modal-actions .ghostbtn, .modal-actions .bigbtn { flex: 1; }

  /* ── Calendar day tooltip ── */
  .cal-tip {
    position: absolute;
    bottom: calc(100% + 7px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1d23;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
    padding: 6px 9px;
    border-radius: 7px;
    pointer-events: none;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    opacity: 0;
    transition: opacity 0.12s;
  }
  .cal-tip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1a1d23;
  }
  .cal-cell { position: relative; }
  .cal-cell:hover .cal-tip { opacity: 1; }

  /* ════════════════════════════════════════════════════════════════════
     Phase 6 design system — ported from docs/design/prototype.html.
     Frame-shell rules (.frame/.stage/.personas/.sbar/.scr/.top/.hint) are
     NOT ported; overlays/tabs use position:fixed for the real viewport. */

  /* ── Header / identity ── */
  .hdr { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
  .avatar { width:34px; height:34px; border-radius:50%; background:var(--accent-dim); color:var(--accent-dark); display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; }
  .bell { position:relative; width:34px; height:34px; border:1px solid var(--border); border-radius:10px; background:var(--surface); display:flex; align-items:center; justify-content:center; font-size:15px; cursor:pointer; }
  .bdg { position:absolute; top:-5px; right:-6px; background:var(--danger); color:#fff; font-size:9.5px; font-weight:700; border-radius:9px; padding:1px 5px; }
  .cobrand { display:flex; align-items:center; gap:9px; margin-bottom:14px; }
  .colo { width:30px; height:30px; border-radius:9px; background:var(--warning-dim); color:var(--warning-dark); font-size:11px; font-weight:700; display:flex; align-items:center; justify-content:center; }
  .cobrand b { font-size:13.5px; } .cobrand i { font-style:normal; font-size:11px; color:var(--faint); display:block; }
  .hello { font-size:24px; font-weight:700; letter-spacing:-.4px; line-height:1.15; }
  .hello.md { font-size:20px; }
  .sub { font-size:13px; color:var(--muted); margin-top:3px; }

  /* ── Chips / status ── */
  .chip { display:inline-flex; align-items:center; gap:7px; font-size:12px; font-weight:600; padding:6px 12px; border-radius:99px; }
  .dot { width:8px; height:8px; border-radius:50%; }
  .ok { background:var(--success-dim); color:var(--success); } .ok .dot { background:var(--success); }
  .bad { background:var(--danger-dim); color:var(--danger); } .bad .dot { background:var(--danger); }
  .warn { background:var(--warning-dim); color:var(--warning-dark); } .warn .dot { background:var(--warning); }

  /* ── Cards ── */
  .card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:14px 16px; margin-top:12px; box-shadow:var(--shadow); }
  .card h4 { margin:0 0 10px; font-size:11px; letter-spacing:.08em; text-transform:uppercase; color:var(--faint); font-weight:700; }

  /* ── Buttons ── */
  .bigbtn { margin-top:16px; width:100%; border:none; border-radius:var(--radius); padding:17px; font:700 16px Inter,sans-serif; background:var(--accent); color:#fff; cursor:pointer; }
  .bigbtn:active { transform:scale(.98); }
  .bigbtn.off { background:var(--border); color:var(--faint); cursor:not-allowed; }
  .bigbtn.out { background:var(--text); }
  .bigbtn.sm { padding:13px; font-size:14px; }
  .ghostbtn { width:100%; margin-top:10px; background:var(--surface); border:1px solid var(--border2); border-radius:var(--radius-sm); padding:11px; font:600 13px Inter,sans-serif; color:var(--muted); cursor:pointer; }
  .smbtn { background:var(--surface); border:1px solid var(--border2); border-radius:8px; padding:6px 12px; font:600 12px Inter,sans-serif; color:var(--muted); cursor:pointer; }
  .smbtn.pri { background:var(--accent); border-color:var(--accent); color:#fff; }
  .smbtn.grn { background:var(--success); border-color:var(--success); color:#fff; }

  /* ── Key-value rows / tags ── */
  .kv { display:flex; justify-content:space-between; align-items:center; font-size:13px; padding:7px 0; gap:10px; }
  .kv + .kv { border-top:1px solid var(--border); }
  .kv b { font-weight:600; } .kv i { font-style:normal; color:var(--muted); text-align:right; }
  .tag { font-size:10px; font-weight:700; padding:2.5px 8px; border-radius:6px; }
  .t-auto { background:var(--accent-dim); color:var(--accent-dark); }
  .t-hol { background:var(--violet-dim); color:var(--violet); }
  .t-off { background:var(--surface2); color:var(--muted); }
  .t-late { background:var(--danger-dim); color:var(--danger); }
  .t-corr { background:var(--accent-dim); color:var(--accent-dark); }
  .t-pend { background:var(--warning-dim); color:var(--warning-dark); }
  .t-ok { background:var(--success-dim); color:var(--success); }
  .ib { display:inline-flex; align-items:center; justify-content:center; width:15px; height:15px; border-radius:50%; border:1px solid var(--border2); color:var(--faint); font-size:9.5px; font-weight:700; margin-left:6px; cursor:pointer; vertical-align:1px; }

  /* ── Stats / tiles ── */
  .stats { display:flex; gap:9px; margin-top:14px; }
  .stat { flex:1; background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:11px 6px; text-align:center; }
  .stat b { display:block; font-size:19px; font-weight:700; }
  .stat i { font-style:normal; font-size:10.5px; color:var(--muted); }
  .tiles { display:grid; gap:9px; margin-top:14px; }
  .tile { border-radius:12px; padding:14px 8px; text-align:center; }
  .tile i { font-style:normal; font-size:10.5px; letter-spacing:.08em; text-transform:uppercase; font-weight:700; }
  .tile b { display:block; font-size:24px; font-weight:700; margin-top:2px; }

  /* ── Calendar ── */
  .cal { display:grid; grid-template-columns:repeat(7,1fr); gap:4px; margin-top:10px; }
  .cal .dh { font-size:9.5px; color:var(--faint); text-align:center; font-weight:700; padding:2px 0; }
  .day { aspect-ratio:1; border-radius:8px; display:flex; flex-direction:column; align-items:center; justify-content:center; font-size:11.5px; font-weight:600; cursor:pointer; border:1px solid transparent; }
  .day small { font-size:8.5px; font-weight:600; opacity:.75; }
  .day.P { background:var(--success-dim); color:var(--success); }
  .day.A { background:var(--danger-dim); color:var(--danger); }
  .day.O { background:var(--surface2); color:var(--muted); }
  .day.H { background:var(--violet-dim); color:var(--violet); }
  .day.W { background:var(--warning-dim); color:var(--warning-dark); }
  .day.F { color:var(--faint); }
  .day.today { border-color:var(--accent); }
  .day.sel { border-color:var(--accent); border-width:2px; }

  /* ── People / notification rows ── */
  .prow { display:flex; align-items:center; gap:11px; padding:10px 0; border-top:1px solid var(--border); font-size:13px; }
  .prow:first-of-type { border-top:none; }
  .prow .avatar { width:32px; height:32px; font-size:11px; flex-shrink:0; }
  .prow .nm { flex:1; min-width:0; }
  .prow .nm b { font-weight:600; display:block; }
  .prow .nm i { font-style:normal; font-size:11.5px; color:var(--muted); }
  .nrow { display:flex; gap:10px; padding:12px 14px; border-top:1px solid var(--border); font-size:12.5px; }
  .nrow:first-child { border-top:none; }
  .nrow.unread { background:var(--accent-dim); }
  .nrow .ndot { width:8px; height:8px; border-radius:50%; margin-top:5px; flex-shrink:0; }
  .nrow.unread .ndot { background:var(--accent); }
  .nrow b { font-weight:600; display:block; }
  .nrow i { font-style:normal; color:var(--muted); }
  .nrow .tm { font-size:10.5px; color:var(--faint); margin-top:1px; }

  /* ── Form controls ── */
  .seg { display:flex; border:1px solid var(--border2); border-radius:10px; overflow:hidden; margin-top:8px; }
  .seg button { flex:1; text-align:center; font:600 12px Inter,sans-serif; padding:9px 2px; color:var(--muted); background:none; border:none; cursor:pointer; }
  .seg button.on { background:var(--accent); color:#fff; }
  .tgl { width:40px; height:23px; border-radius:99px; background:var(--border2); position:relative; cursor:pointer; flex-shrink:0; border:none; transition:background .15s; }
  .tgl::after { content:''; position:absolute; top:2.5px; left:2.5px; width:18px; height:18px; border-radius:50%; background:#fff; transition:left .15s; box-shadow:0 1px 2px rgba(0,0,0,.25); }
  .tgl.on { background:var(--accent); }
  .tgl.on::after { left:19.5px; }
  /* Native checkbox variant — handlers keep reading .checked. */
  input.tgl { appearance:none; -webkit-appearance:none; margin:0; }
  input.tgl:checked { background:var(--accent); }
  input.tgl:checked::after { left:19.5px; }
  .field { margin-top:10px; }
  .field label { font-size:11.5px; font-weight:600; color:var(--muted); display:block; margin-bottom:5px; line-height:1.45; }
  .field input, .field select { width:100%; border:1px solid var(--border2); border-radius:var(--radius-sm); padding:10px 12px; font:600 13.5px Inter,sans-serif; color:var(--text); background:var(--surface); }

  /* ── Overlays / sheets (fixed, real viewport — prototype used absolute-in-frame) ── */
  .overlay { position:fixed; inset:0; z-index:40; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; padding:30px; animation:pop .18s ease; }
  @keyframes pop { from { opacity:0; transform:scale(.96); } to { opacity:1; transform:scale(1); } }
  .overlay .big { width:84px; height:84px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:44px; color:#fff; margin-bottom:18px; }
  .overlay h3 { font-size:22px; font-weight:700; margin:0; }
  .overlay p { font-size:14px; margin:8px 0 0; line-height:1.55; }
  .modal { position:fixed; inset:0; z-index:50; background:rgba(15,17,21,.45); display:flex; align-items:flex-end; justify-content:center; }
  .sheet { background:var(--surface); border-radius:20px 20px 0 0; width:100%; max-width:520px; padding:20px 20px 26px; animation:up .2s ease; max-height:88%; overflow-y:auto; }
  @keyframes up { from { transform:translateY(30px); opacity:.4; } to { transform:none; opacity:1; } }
  .sheet h3 { margin:0 0 4px; font-size:16px; font-weight:700; }

  /* ── Bottom tab nav (fixed) ── */
  .tabs { position:fixed; bottom:0; left:0; right:0; background:var(--surface); border-top:1px solid var(--border); display:flex; z-index:30; }
  .tab { flex:1; text-align:center; padding:10px 2px 14px; font-size:10px; font-weight:600; color:var(--faint); cursor:pointer; border:none; background:none; font-family:inherit; }
  .tab .ico { display:block; font-size:16px; margin-bottom:2px; }
  .tab.on { color:var(--accent); }

  /* ── Tables / pills ── */
  .tbl { width:100%; border-collapse:collapse; font-size:12.5px; }
  .tbl th { font-size:10.5px; text-transform:uppercase; letter-spacing:.05em; color:var(--faint); text-align:left; padding:9px 10px; background:var(--surface2); font-weight:700; white-space:nowrap; }
  .tbl td { padding:10px; border-top:1px solid var(--border); white-space:nowrap; }
  .pill { font-size:10.5px; font-weight:700; padding:3px 10px; border-radius:99px; }
  .p-ok { background:var(--success-dim); color:var(--success); }
  .p-bad { background:var(--danger-dim); color:var(--danger); }
  /* Amber: approaching a limit, not yet over it — the read meter's warning band. */
  .p-warn { background:var(--warning-dim); color:var(--warning-dark); }
  .link { color:var(--accent-dark); font-weight:600; cursor:pointer; font-size:12px; }
  .widetbl { overflow-x:auto; border:1px solid var(--border); border-radius:12px; margin-top:14px; background:var(--surface); }
  .mgrid { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; margin-top:14px; }
  .mcard { background:var(--surface2); border-radius:12px; padding:13px 15px; }
  .mcard i { font-style:normal; font-size:11.5px; color:var(--muted); display:block; }
  .mcard b { font-size:23px; font-weight:700; }

  /* ── Misc blocks ── */
  .demo { background:var(--warning-dim); border:1px dashed var(--warning); border-radius:var(--radius-sm); padding:9px 12px; margin-top:12px; font-size:11.5px; color:var(--warning-dark); line-height:1.6; }
  .demo .link { color:var(--warning-dark); text-decoration:underline; }
  .mono { font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:11.5px; background:var(--surface2); border-radius:8px; padding:9px 11px; word-break:break-all; color:var(--text); }
  .obar { height:6px; background:var(--surface2); border-radius:99px; overflow:hidden; }
  .obar div { height:100%; background:var(--accent); border-radius:99px; transition:width .3s; }
  .orow { display:flex; align-items:center; gap:10px; padding:10px 2px; border-top:1px solid var(--border); font-size:13px; }
  .orow:first-of-type { border-top:none; }
  .orow .cb { width:19px; height:19px; border-radius:50%; border:2px solid var(--border2); flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:11px; color:#fff; cursor:pointer; }
  .orow.done .cb { background:var(--success); border-color:var(--success); }
  .orow.done span { color:var(--faint); text-decoration:line-through; }
  .orow .go { margin-left:auto; font-size:11.5px; font-weight:700; color:var(--accent-dark); cursor:pointer; }
  .barrow { margin-top:10px; }
  .barrow .bl { display:flex; justify-content:space-between; font-size:11.5px; color:var(--muted); margin-bottom:4px; }
  .bar { height:9px; border-radius:99px; background:var(--surface2); overflow:hidden; margin-bottom:5px; }
  .bar div { height:100%; border-radius:99px; }
  .lock { background:var(--surface2); border-radius:var(--radius-sm); padding:10px 12px; font-size:12px; color:var(--muted); margin-top:10px; line-height:1.5; }
  .rephead { display:flex; align-items:center; gap:11px; }
  .rephead .nm { flex:1; }
  .rephead .nm b { font-size:14px; font-weight:700; display:block; }
  .rephead .nm i { font-style:normal; font-size:11.5px; color:var(--muted); }
  .rephead .pay { text-align:right; }
  .rephead .pay b { font-size:22px; font-weight:700; color:var(--accent-dark); display:block; line-height:1; }
  .rephead .pay i { font-style:normal; font-size:10px; color:var(--faint); letter-spacing:.05em; text-transform:uppercase; }
  .chiprow { display:flex; flex-wrap:wrap; gap:5px; margin-top:10px; }
  .det { margin-top:10px; border-top:1px solid var(--border); padding-top:8px; }
  .det div { font-size:12px; color:var(--muted); padding:3px 0; }

  /* Punch feedback: brief full-screen flash (pref-gated), fades out. */
  .punch-flash { position:fixed; inset:0; z-index:300; pointer-events:none; animation:flashfade .5s ease both; }
  .punch-flash.okf { background:var(--success); }
  .punch-flash.badf { background:var(--danger); }
  @keyframes flashfade { from { opacity:.45; } to { opacity:0; } }

  /* ── D3: desktop, and only for the two screens that need it ───────────────
   *
   * Every screen was capped at 420px while the master company table needs
   * ~770px, so an owner or super admin on a laptop read their widest data
   * through a phone-sized slot with the rest of the monitor blank.
   *
   * Additive and last in the file on purpose: everything above is untouched,
   * and below 900px not one declaration here applies — phone rendering is
   * byte-identical, which is the constraint that matters on the hardware this
   * app targets.
   *
   * Manager and employee stay phone-width deliberately. Both are used standing
   * up, on a phone, mid-shift; widening them would be change without a reason.
   */
  @media (min-width: 900px) {
    /* The table is the whole screen here, so it takes the width directly. */
    #screen-master { max-width: 1160px; }
    #screen-master .wide-content { max-width: 1160px; }

    #screen-owner { max-width: 1100px; }
    #screen-owner .wide-content { max-width: 1100px; }

    /* A 1100px single column of short cards is worse than 420px, not better —
     * it just stretches each card into a band.
     *
     * Multi-column rather than a 2-track grid, which was tried first: a grid
     * puts each pair of cards in a shared row, so a short card next to a tall
     * one leaves a dead gap the height of the difference. Columns just flow,
     * and `break-inside: avoid` is what stops a card being sliced in half at
     * the column boundary.
     *
     * The header and who's-in span the full width — the first is the page
     * header and the second is the thing an owner opens the app to read. */
    #owner-content { columns: 2; column-gap: 20px; }
    #owner-content > * { break-inside: avoid; }
    #owner-content > .hdr,
    #owner-content > #owner-whos-in { column-span: all; }
  }
