/* Tekifi Timesheets · system UI
   Layout: macOS-style sidebar + single content column (max 1120px); bottom tab bar under 820px.
   Type: the platform system face (SF on Apple devices), Inter elsewhere. One family, weight carries hierarchy. */

@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("/fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("/fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("/fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("/fonts/inter-latin-700-normal.woff2") format("woff2"); }

:root {
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;

  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --surface-pop: #FFFFFF;
  --sidebar: rgba(240, 240, 243, 0.86);
  --ink: #1D1D1F;
  --ink-2: #6E6E73;
  --ink-3: #8E8E93;
  --sep: rgba(60, 60, 67, 0.12);
  --sep-strong: rgba(60, 60, 67, 0.2);
  --fill: rgba(118, 118, 128, 0.12);
  --fill-2: rgba(118, 118, 128, 0.07);
  --input: #FFFFFF;
  --seg-on: #FFFFFF;

  --brand: #5CBA47;            /* Tekifi green: marks, wordmark dot, progress */
  --accent: #2B8427;           /* interactive green with text contrast on white */
  --accent-ink: #2B8427;
  --on-accent: #FFFFFF;
  --sel: rgba(43, 132, 39, 0.11);
  --focus: rgba(43, 132, 39, 0.35);

  --ok-ink: #1F7A1D; --ok-soft: rgba(52, 168, 83, 0.13);
  --warn-ink: #8A5A00; --warn-soft: rgba(237, 161, 0, 0.16);
  --danger: #D70015; --danger-soft: rgba(215, 0, 21, 0.1);
  --switch-off: rgba(120, 120, 128, 0.24);

  --grid: rgba(60, 60, 67, 0.1);
  --weekend: rgba(118, 118, 128, 0.045);

  /* Category hues: fixed order, validated for colour-vision separation in both themes */
  --c-client: #4FAE3B; --c-bid: #2A78D6; --c-bd: #EDA100; --c-internal: #E87BA4;
  --c-training: #6250D6; --c-admin: #199E70; --c-leave: #EB6834;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.035);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.06);
  --r-card: 14px;
  color-scheme: light;
}

@media screen and (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1C1C1E;
    --surface-pop: #2C2C2E;
    --sidebar: rgba(28, 28, 30, 0.86);
    --ink: #F5F5F7;
    --ink-2: #98989D;
    --ink-3: #7C7C80;
    --sep: rgba(84, 84, 88, 0.5);
    --sep-strong: rgba(120, 120, 128, 0.5);
    --fill: rgba(118, 118, 128, 0.24);
    --fill-2: rgba(118, 118, 128, 0.14);
    --input: #1C1C1E;
    --seg-on: #636366;
    --accent: #5CBA47;
    --accent-ink: #7ACF66;
    --on-accent: #0B1F08;
    --sel: rgba(92, 186, 71, 0.18);
    --focus: rgba(92, 186, 71, 0.45);
    --ok-ink: #7ACF66; --ok-soft: rgba(92, 186, 71, 0.18);
    --warn-ink: #F2B53C; --warn-soft: rgba(201, 133, 0, 0.22);
    --danger: #FF6961; --danger-soft: rgba(255, 105, 97, 0.15);
    --switch-off: rgba(120, 120, 128, 0.36);
    --grid: rgba(84, 84, 88, 0.45);
    --weekend: rgba(118, 118, 128, 0.08);
    --c-client: #4FAE3B; --c-bid: #3987E5; --c-bd: #C98500; --c-internal: #D55181;
    --c-training: #9085E9; --c-admin: #199E70; --c-leave: #D95926;
    --shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.06);
    --shadow-pop: 0 16px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-ink); text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-radius: 6px; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; display: block; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wordmark { font-weight: 700; font-size: 21px; letter-spacing: -0.03em; color: var(--ink); }
.wordmark i { font-style: normal; color: var(--brand); }
.wordmark-sub { font-size: 13px; font-weight: 500; color: var(--ink-2); letter-spacing: -0.01em; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 22px 12px 14px; background: var(--sidebar); border-right: 1px solid var(--sep); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
.brand { display: flex; align-items: baseline; gap: 8px; padding: 0 10px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-section { font-size: 11.5px; font-weight: 600; color: var(--ink-3); padding: 16px 10px 6px; letter-spacing: 0.01em; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--ink); font-size: 14px; font-weight: 500; }
.nav-item .ic { color: var(--ink-2); }
.nav-item:hover { background: var(--fill-2); }
.nav-item[aria-current="page"] { background: var(--sel); color: var(--accent-ink); }
.nav-item[aria-current="page"] .ic { color: var(--accent-ink); }
.sidebar-foot { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 6px 0 8px; border-top: 1px solid var(--sep); }
.me-text { display: grid; min-width: 0; line-height: 1.25; }
.me-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { font-size: 12px; color: var(--ink-2); }

.main { min-width: 0; }
.mobilebar { display: none; }
.content { max-width: 1120px; margin: 0 auto; padding-block: 34px 72px; padding-left: max(40px, env(safe-area-inset-left, 0px)); padding-right: max(40px, env(safe-area-inset-right, 0px)); }
.view { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.view > * { min-width: 0; }
.boot { display: flex; align-items: center; gap: 10px; color: var(--ink-2); padding: 40px 0; }
.print-head { display: none; }

/* ---------- page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 20px; margin-bottom: 6px; }
.page-titles { min-width: 0; }
h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.12; margin: 0; text-wrap: balance; }
.page-sub { margin: 5px 0 0; font-size: 15px; color: var(--ink-2); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--sep-strong); background: var(--surface); color: var(--ink); font-size: 13.5px; font-weight: 500; white-space: nowrap; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.03); transition: background 0.15s, border-color 0.15s, opacity 0.15s; }
.btn:hover:not(:disabled) { background: var(--fill-2); }
.btn:active:not(:disabled) { background: var(--fill); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn .ic { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--on-accent); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
.btn-primary:active:not(:disabled) { background: var(--accent); filter: brightness(0.94); }
.btn-plain { background: transparent; border-color: transparent; box-shadow: none; color: var(--accent-ink); padding: 0 8px; }
.btn-plain:hover:not(:disabled) { background: var(--sel); }
.btn-danger-plain { color: var(--danger); }
.btn-danger-plain:hover:not(:disabled) { background: var(--danger-soft); }
.btn-large { height: 44px; border-radius: 11px; font-size: 15px; width: 100%; }
.btn-small { height: 28px; padding: 0 11px; font-size: 13px; border-radius: 7px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--ink-2); }
.icon-btn:hover:not(:disabled) { background: var(--fill); color: var(--ink); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }

.stepper { display: inline-flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--sep-strong); border-radius: 9px; padding: 1px; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.03); }
.stepper .icon-btn { width: 30px; height: 28px; border-radius: 7px; }
.stepper .btn { border: 0; box-shadow: none; height: 28px; background: transparent; }
.stepper .btn:hover:not(:disabled) { background: var(--fill-2); }

.segmented { display: inline-flex; background: var(--fill); padding: 2px; border-radius: 9px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 0 14px; height: 28px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--ink); transition: background 0.15s; }
.segmented button[aria-pressed="true"] { background: var(--seg-on); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04); font-weight: 600; }

.input, .select select, textarea.input { width: 100%; height: 36px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--sep-strong); background: var(--input); font-size: 14px; transition: border-color 0.15s, box-shadow 0.15s; }
textarea.input { height: auto; min-height: 64px; padding: 9px 11px; resize: vertical; line-height: 1.45; }
.input:focus, .select select:focus, textarea.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.select { position: relative; }
.select select { appearance: none; -webkit-appearance: none; padding-right: 32px; }
.select .ic { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-2); pointer-events: none; }
.field { display: grid; gap: 6px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field-help { font-size: 12px; color: var(--ink-3); margin: 0; }
.input-suffix { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.input-num { width: 76px; text-align: right; font-variant-numeric: tabular-nums; }

.search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border-radius: 9px; background: var(--fill); color: var(--ink-2); }
.search:focus-within { box-shadow: 0 0 0 3px var(--focus); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 14px; color: var(--ink); height: 100%; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search .ic { width: 16px; height: 16px; }

.switch { position: relative; display: inline-block; width: 42px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch input:disabled { cursor: default; }
.switch-track { position: absolute; inset: 0; border-radius: 13px; background: var(--switch-off); transition: background 0.2s; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 0 0.5px rgba(0, 0, 0, 0.04); transition: transform 0.2s cubic-bezier(0.3, 0.7, 0.4, 1); }
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:disabled + .switch-track { opacity: 0.5; }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--focus); }

.pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill .ic { width: 13px; height: 13px; stroke-width: 2.2; }
.pill-ok { background: var(--ok-soft); color: var(--ok-ink); }
.pill-draft { background: var(--warn-soft); color: var(--warn-ink); }
.pill-none { background: var(--fill-2); color: var(--ink-2); }

.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.cat-client { background: var(--c-client); } .cat-bid { background: var(--c-bid); } .cat-bd { background: var(--c-bd); }
.cat-internal { background: var(--c-internal); } .cat-training { background: var(--c-training); } .cat-admin { background: var(--c-admin); } .cat-leave { background: var(--c-leave); }
.fill-client { fill: var(--c-client); } .fill-bid { fill: var(--c-bid); } .fill-bd { fill: var(--c-bd); }
.fill-internal { fill: var(--c-internal); } .fill-training { fill: var(--c-training); } .fill-admin { fill: var(--c-admin); } .fill-leave { fill: var(--c-leave); }

.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(180deg, #A5A5AB, #86868B); color: #FFFFFF; font-size: 12px; font-weight: 600; letter-spacing: 0.01em; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.avatar.lg { width: 36px; height: 36px; font-size: 13.5px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-card); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 16px 20px 6px; }
.caption { font-size: 12.5px; color: var(--ink-2); }
.empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 40px 20px; color: var(--ink-2); }
.empty h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--ink); }
.empty p { margin: 0; max-width: 46ch; }
.empty .row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.loading { padding: 48px 20px; text-align: center; color: var(--ink-2); }
.notice { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-card); padding: 12px 16px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.notice.error { color: var(--danger); }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--fill); border-top-color: var(--ink-2); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- timer ---------- */
.timer { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 8px; }
.timer-proj { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; }
.timer-proj:hover { background: var(--fill-2); }
.tp-text { display: grid; min-width: 0; line-height: 1.25; }
.tp-name { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-code { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-placeholder { font-size: 15px; color: var(--ink-3); }
.timer-proj .tp-chev { width: 15px; height: 15px; color: var(--ink-3); margin-left: auto; }
.timer-right { display: flex; align-items: center; gap: 10px; }
.timer-clock { font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; color: var(--ink-3); min-width: 92px; text-align: right; }
.timer.is-running .timer-clock { color: var(--ink); }
.timer-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; color: #FFFFFF; transition: transform 0.12s, filter 0.15s; }
.timer-btn .ic { width: 18px; height: 18px; }
.timer-btn.start { background: var(--accent); color: var(--on-accent); }
.timer-btn.stop { background: #E5484D; }
.timer-btn:hover { filter: brightness(1.07); }
.timer-btn:active { transform: scale(0.94); }
.timer.is-running { box-shadow: var(--shadow-card), inset 3px 0 0 var(--brand); }

/* ---------- weekly sheet ---------- */
.sheet { overflow: hidden; }
.sheet-scroll { overflow-x: auto; position: relative; }
.ts { width: 100%; min-width: 780px; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.ts th, .ts td { padding: 6px 4px; border-bottom: 1px solid var(--sep); text-align: center; vertical-align: middle; font-weight: 400; }
.ts thead th { padding-top: 14px; padding-bottom: 10px; }
.ts .c-proj { text-align: left; padding-left: 20px; width: 34%; min-width: 230px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.ts thead .c-proj { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.dow { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.dom { display: inline-grid; place-items: center; min-width: 28px; height: 28px; margin-top: 2px; padding: 0 4px; border-radius: 14px; font-size: 16px; font-weight: 600; color: var(--ink); }
.is-weekend .dow, .is-weekend .dom { color: var(--ink-3); }
.is-today .dom, .is-today.is-weekend .dom { background: var(--accent); color: var(--on-accent); }
.ts .c-total { width: 72px; font-weight: 600; }
.ts thead .c-total { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.ts .c-act { width: 44px; padding-right: 12px; }
.ts tbody tr:hover .c-act .icon-btn { opacity: 1; }
.ts .c-act .icon-btn { opacity: 0.35; width: 28px; height: 28px; }
.ts .c-act .icon-btn:focus-visible { opacity: 1; }
.ts tfoot th, .ts tfoot td { border-bottom: 0; padding-top: 12px; padding-bottom: 12px; font-weight: 600; }
.ts tfoot .c-proj { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.ts tfoot .zero { color: var(--ink-3); font-weight: 500; }
.rowlabel { display: grid; grid-template-columns: 9px minmax(0, 1fr); gap: 0 11px; align-items: center; }
.rowlabel .dot { grid-row: 1; grid-column: 1; }
.rowlabel > :not(.dot) { grid-column: 2; }
.desc { display: block; width: calc(100% + 8px); margin: 3px 0 0 -6px; padding: 3px 6px; border: 1px solid transparent; border-radius: 6px; background: transparent; font-size: 12.5px; line-height: 1.35; color: var(--ink); text-overflow: ellipsis; transition: background 0.12s, border-color 0.12s, box-shadow 0.12s; }
.desc::placeholder { color: var(--ink-3); opacity: 0.75; }
.desc:hover:not(:disabled) { background: var(--fill-2); }
.desc:focus { outline: none; background: var(--input); border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.desc:disabled { color: var(--ink-2); -webkit-text-fill-color: var(--ink-2); opacity: 1; }
.rl-name { font-size: 14px; font-weight: 500; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-code { font-size: 12px; color: var(--ink-2); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell { width: 100%; max-width: 62px; height: 36px; padding: 0 4px; text-align: center; border: 1px solid transparent; border-radius: 8px; background: var(--fill-2); font-size: 15px; font-variant-numeric: tabular-nums; transition: background 0.12s, border-color 0.12s, box-shadow 0.12s; }
.cell:hover:not(:disabled) { background: var(--fill); }
.cell:focus { outline: none; background: var(--input); border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.cell::placeholder { color: var(--ink-3); opacity: 0.5; }
.cell:disabled { background: transparent; color: var(--ink); }
.cell.bad { border-color: var(--danger); }
.ts .is-weekend.cellwrap .cell { background: var(--weekend); }
.ts .is-weekend.cellwrap .cell:focus { background: var(--input); }
.sheet-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 10px 12px; }

/* compact (phone) sheet: one day at a time */
.mdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; padding: 8px; border-bottom: 1px solid var(--sep); }
.mday { display: grid; justify-items: center; gap: 1px; padding: 6px 0 7px; border: 0; border-radius: 10px; background: transparent; }
.mday .dom { margin-top: 1px; font-size: 16px; }
.mtot { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; min-height: 15px; }
.mtot.zero { opacity: 0.6; }
.mday[aria-selected="true"] { background: var(--sel); }
.mday[aria-selected="true"] .dow { color: var(--accent-ink); }
.mday[aria-selected="true"]:not(.is-today) .dom { color: var(--accent-ink); }
.mday[aria-selected="true"] .mtot { color: var(--accent-ink); font-weight: 600; }
.mrow { display: grid; grid-template-columns: 9px minmax(0, 1fr) 76px 30px; gap: 10px; align-items: center; padding: 9px 8px 9px 16px; border-bottom: 1px solid var(--sep); }
.mrow .cell { max-width: none; height: 42px; font-size: 17px; }
.mrow .icon-btn { width: 30px; height: 30px; opacity: 0.5; }
.mrow-text { display: grid; min-width: 0; line-height: 1.3; }
.mfoot { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 16px 4px; font-size: 13.5px; color: var(--ink-2); }
.mfoot b { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.sheet-empty td { padding: 0 !important; border-bottom: 1px solid var(--sep); }

.ts-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 28px; padding: 18px 20px; }
.ts-note { flex: 1 1 320px; display: grid; gap: 6px; min-width: 0; }
.ts-summary { display: flex; align-items: center; gap: 16px; flex: 0 1 auto; }
.ring { width: 56px; height: 56px; flex: none; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring .ring-track { stroke: var(--fill); }
.ring .ring-fill { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset 0.4s ease; }
.sum-total { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.sum-total small { font-size: 15px; font-weight: 500; color: var(--ink-2); }
.save-line { margin: -6px 4px 0; font-size: 12.5px; color: var(--ink-3); min-height: 18px; text-align: right; }
.save-line.err { color: var(--danger); }

/* ---------- reports ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 18px 20px; display: grid; gap: 2px; min-width: 0; }
.stat + .stat { border-left: 1px solid var(--sep); }
.stat-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.15; }
.stat-value small { font-size: 16px; font-weight: 500; color: var(--ink-2); letter-spacing: 0; margin-left: 2px; }
.stat-sub { font-size: 12.5px; color: var(--ink-3); }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 8px; height: 8px; }
.chart { position: relative; padding: 4px 16px 12px 10px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis-text { fill: var(--ink-3); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .axis-text.today { fill: var(--ink); font-weight: 600; }
.chart .wk-band { fill: var(--weekend); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hover-band { fill: var(--fill-2); }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 190px; padding: 10px 12px; border-radius: 10px; background: var(--surface-pop); box-shadow: var(--shadow-pop); font-size: 12.5px; }
.chart-tip .tt-date { font-weight: 600; margin-bottom: 6px; }
.chart-tip .tt-row { display: grid; grid-template-columns: 8px 1fr auto; gap: 8px; align-items: center; color: var(--ink-2); padding: 1px 0; }
.chart-tip .tt-row b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-tip .tt-total { display: flex; justify-content: space-between; border-top: 1px solid var(--sep); margin-top: 6px; padding-top: 6px; font-weight: 600; }
.chart-tip .dot { width: 8px; height: 8px; }

.blist { padding: 4px 0 8px; }
.brow + .brow { border-top: 1px solid var(--sep); }
.brow-main { display: grid; grid-template-columns: 14px 28px minmax(0, 1fr) auto minmax(60px, 180px) 70px; gap: 12px; align-items: center; width: 100%; padding: 10px 20px; border: 0; background: transparent; text-align: left; }
.brow-main:hover { background: var(--fill-2); }
.brow-main .chev { width: 14px; height: 14px; color: var(--ink-3); transition: transform 0.2s; }
.brow.open .brow-main .chev { transform: rotate(90deg); }
.brow-lead { display: grid; place-items: center; }
.brow-text { display: grid; min-width: 0; line-height: 1.3; }
.brow-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow-sub { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow-bar { height: 6px; border-radius: 3px; background: var(--fill-2); overflow: hidden; }
.brow-bar span { display: block; height: 100%; border-radius: 3px; background: var(--brand); }
.brow-hours { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.brow-detail { display: none; padding: 0 20px 12px 74px; }
.brow.open .brow-detail { display: block; }
.srow { display: grid; grid-template-columns: 9px minmax(0, 1fr) 64px 46px; gap: 10px; align-items: center; padding: 6px 0; font-size: 13.5px; border-top: 1px solid var(--sep); }
.srow:first-child { border-top: 0; }
.srow-main { display: grid; min-width: 0; }
.srow-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow-desc { font-size: 12.5px; color: var(--ink-2); line-height: 1.35; margin-top: 1px; }
.srow-name .muted { color: var(--ink-2); font-size: 12px; margin-left: 6px; }
.srow-hours { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.srow-pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 12.5px; }
.bnote { margin: 8px 0 2px; padding: 8px 12px; border-radius: 8px; background: var(--fill-2); color: var(--ink-2); font-size: 13px; }
.bactions { display: flex; gap: 8px; margin-top: 8px; }
.bempty { color: var(--ink-2); font-size: 13px; padding: 4px 0; }

/* ---------- lists (projects, team) ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.toolbar .search { flex: 0 1 320px; }
.group { display: grid; gap: 8px; }
.group-title { margin: 6px 4px 0; font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; gap: 6px; }
.group-title span { color: var(--ink-3); font-weight: 500; }
.list { overflow: hidden; }
.lrow { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; min-height: 52px; padding: 9px 16px; border: 0; background: transparent; text-align: left; }
button.lrow:hover { background: var(--fill-2); }
.lrow + .lrow::before { content: ""; position: absolute; top: 0; left: 44px; right: 0; border-top: 1px solid var(--sep); }
.lrow-text { display: grid; min-width: 0; line-height: 1.3; }
.lrow-title { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow-sub { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .chev { width: 15px; height: 15px; color: var(--ink-3); }
.lrow.archived .lrow-title { color: var(--ink-2); }
.team-row { grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 14px; }
.team-row + .team-row::before { left: 66px; }
.tr-meta { font-size: 12.5px; color: var(--ink-3); text-align: right; }
.tr-toggles { display: flex; gap: 18px; align-items: center; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.tr-state { font-size: 12px; color: var(--ink-3); grid-column: 2 / -1; margin-top: -4px; }
.tr-state.err { color: var(--danger); }
.settings-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; }

/* ---------- leave colours ---------- */
.lv-annual { --bar: var(--c-client); }
.lv-sick { --bar: var(--c-internal); }
.lv-compassionate { --bar: var(--c-training); }
.lv-unpaid { --bar: var(--c-bd); }
.lv-other { --bar: var(--c-bid); }
.lv-away { --bar: #8E8E93; }
.lv-holiday { --bar: var(--ink-3); }
.lv-closure { --bar: var(--c-admin); }
.closed-ic { background: var(--sel); color: var(--accent-ink); }
.bal-note { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin: 0; padding-top: 14px; border-top: 1px solid var(--sep); font-size: 13px; color: var(--ink-2); }
.bal-note .ic { width: 15px; height: 15px; color: var(--ink-3); }
.loc-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; padding: 12px 14px; border-radius: 10px; background: var(--fill-2); }
.loc-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.loc-check input { width: 16px; height: 16px; accent-color: var(--accent); }
#view-holidays .cl-row { grid-template-columns: 26px minmax(0, 1fr) auto auto; }
.dot[class*="lv-"] { background: var(--bar); }
.pill-bad { background: var(--danger-soft); color: var(--danger); }
.muted { color: var(--ink-3); font-weight: 400; }
.neg { color: var(--danger); }
.opt { color: var(--ink-3); font-weight: 400; margin-left: 4px; }
.caption.foot-note { margin: -4px 4px 0; }
.empty.small { padding: 20px 20px 24px; }
.card-actions { display: inline-flex; align-items: center; gap: 10px; }

/* timesheet: read-only leave rows */
.ts-leave th, .ts-leave td { background: var(--weekend); }
.ts .ts-leave .c-proj { background: var(--weekend); }
.cell-ro { display: inline-grid; place-items: center; min-width: 40px; height: 36px; font-size: 15px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.lock { display: inline-grid; place-items: center; width: 28px; height: 28px; color: var(--ink-3); }
.lock .ic { width: 15px; height: 15px; }
.mrow-leave { background: var(--weekend); }
.mrow-leave .cell-ro { justify-self: center; }

/* home */
.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.home-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { display: grid; gap: 6px; align-content: start; padding: 18px 20px 20px; color: var(--ink); transition: transform 0.15s, box-shadow 0.15s; }
.tile:hover { box-shadow: var(--shadow-card), 0 6px 18px rgba(0, 0, 0, 0.06); }
.tile:active { transform: scale(0.99); }
.tile-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.tile-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--sel); color: var(--accent-ink); }
.tile-icon .ic { width: 17px; height: 17px; }
.tile-title { font-size: 15px; font-weight: 600; margin-right: auto; }
.tile-big { font-size: 32px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
.tile-big small { font-size: 15px; font-weight: 500; color: var(--ink-2); letter-spacing: 0; }
.tile-sub { font-size: 13px; color: var(--ink-2); }
.tile-next { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--sep); }
.tile-attn .tile-icon { background: var(--warn-soft); color: var(--warn-ink); }
.meter { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; margin: 4px 0 2px; }
.meter span { display: block; height: 100%; border-radius: 3px; background: var(--brand); }
.away-list { padding: 2px 0 8px; }
.away-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 20px; }
.away-row + .away-row { border-top: 1px solid var(--sep); }
.away-text { display: grid; min-width: 0; line-height: 1.3; }
.away-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.away-sub { font-size: 12.5px; color: var(--ink-2); }
.away-when { font-size: 13px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.away-ic { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--fill-2); color: var(--ink-2); }
.away-ic .ic { width: 14px; height: 14px; }
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; padding: 8px 16px 16px; }
.app-tile { display: grid; grid-template-columns: 38px minmax(0, 1fr) 16px; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; background: var(--fill-2); color: var(--ink); }
.app-tile:hover { background: var(--fill); }
.app-mono { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--band, #3D3D33); background: #3D3D33; color: #FFFFFF; font-size: 13px; font-weight: 600; }
.app-text { display: grid; min-width: 0; line-height: 1.3; }
.app-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-desc { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-ext { width: 15px; height: 15px; color: var(--ink-3); }
.tool-rows { display: grid; gap: 12px; }
.tool-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) 32px; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--sep); }
.tool-edit .tool-desc { grid-column: 1 / 3; }

/* leave page */
.balance { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center; padding: 22px 26px; }
.bal-ring { position: relative; width: 124px; height: 124px; }
.bal-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.bal-ring circle { fill: none; stroke-width: 10; }
.bal-ring .ring-track { stroke: var(--fill); }
.bal-ring .ring-used { stroke: var(--brand); stroke-linecap: round; }
.bal-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.bal-num { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; }
.bal-lbl { font-size: 12.5px; color: var(--ink-2); }
.bal-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.bstat { display: grid; gap: 2px; padding: 4px 18px; min-width: 0; }
.bstat + .bstat { border-left: 1px solid var(--sep); }
.bstat-val { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.rlist { padding: 2px 0 8px; }
.rrow { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 20px; }
.rrow > .dot { justify-self: center; }
.rrow + .rrow { border-top: 1px solid var(--sep); }
.rrow-text { display: grid; min-width: 0; line-height: 1.35; }
.rrow-title { font-size: 14px; font-weight: 500; }
.rrow-sub { font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.rrow-gap { width: 1px; }
.rrow.removed .rrow-title, .rrow.removed .hol-date { opacity: 0.5; text-decoration: line-through; }
.hol-date { display: grid; justify-items: center; width: 38px; line-height: 1.05; }
.hd-day { font-size: 17px; font-weight: 600; }
.hd-mon { font-size: 11px; color: var(--accent-ink); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
#view-holidays .rrow { grid-template-columns: 40px minmax(0, 1fr) auto auto; }

/* request dialog */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg-full { display: flex; width: 100%; }
.seg-full button { flex: 1; }
.half-opts { display: grid; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--fill-2); }
.sf-label { font-size: 14px; font-weight: 500; color: var(--ink); }
.switch-field .field-help { margin-top: 1px; }
.rq-preview { display: grid; gap: 3px; min-height: 40px; padding: 10px 14px; border-radius: 10px; background: var(--sel); font-size: 13px; }
.rq-preview:empty { display: none; }
.pv-days { font-size: 15px; font-weight: 600; color: var(--ink); }
.pv-sub { color: var(--ink-2); }
.pv-warn { color: var(--danger); }
.dialog-text { margin: 0; color: var(--ink-2); font-size: 14px; }
.dialog-sub { margin: -10px 0 0; }
.dialog-wide { width: min(620px, calc(100vw - 32px)); }
.btn-danger { background: #E5484D; border-color: transparent; color: #FFFFFF; font-weight: 600; }
.btn-danger:hover:not(:disabled) { background: #E5484D; filter: brightness(1.06); }
input[type="date"].input { font-variant-numeric: tabular-nums; }
.select-inline { min-width: 190px; }
.select-inline select { height: 32px; }

/* calendar */
.cal { overflow: hidden; }
.cal-scroll { overflow-x: auto; }
.calgrid { width: 100%; min-width: 900px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.calgrid th, .calgrid td { padding: 0; text-align: center; border-bottom: 1px solid var(--sep); }
.calgrid thead th { padding: 12px 0 8px; font-weight: 500; }
.calgrid thead .dow { font-size: 11px; }
.calgrid thead .dom { font-size: 13px; min-width: 24px; height: 24px; margin-top: 2px; }
.calgrid thead th.today .dom { background: var(--accent); color: var(--on-accent); }
.calgrid .cal-name { width: 200px; text-align: left; padding: 8px 12px 8px 16px; position: sticky; left: 0; z-index: 2; background: var(--surface); border-right: 1px solid var(--sep); }
.calgrid tbody .cal-name { display: table-cell; }
.cal-name .avatar { vertical-align: middle; margin-right: 10px; }
.cal-who { display: inline-grid; vertical-align: middle; line-height: 1.25; max-width: calc(100% - 40px); }
.cal-n { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-l { font-size: 11.5px; color: var(--ink-2); font-weight: 400; }
.calgrid td { position: relative; height: 46px; }
.calgrid .we { background: var(--weekend); }
.calgrid td.hol { background: repeating-linear-gradient(135deg, var(--fill-2) 0 4px, transparent 4px 8px); }
.calgrid td.closed { background: color-mix(in srgb, var(--c-admin) 14%, transparent); }
.calgrid td.today { box-shadow: inset 1px 0 0 var(--accent), inset -1px 0 0 var(--accent); }
.bar { position: absolute; top: 50%; left: 0; right: 0; height: 20px; transform: translateY(-50%); background: var(--bar); }
.bar.s { left: 3px; border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.bar.e { right: 3px; border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
.bar.half-am { right: 50%; border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
.bar.half-pm { left: 50%; border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.bar.pending { background: repeating-linear-gradient(135deg, var(--bar) 0 4px, transparent 4px 8px); box-shadow: inset 0 0 0 1.5px var(--bar); }
.hol-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); }
.cal-foot { padding: 12px 16px 14px; }
.sw-hol { display: inline-block; width: 14px; height: 10px; border-radius: 2px; background: repeating-linear-gradient(135deg, var(--fill) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px var(--sep-strong); }
.sw-closed { display: inline-block; width: 14px; height: 10px; border-radius: 2px; background: color-mix(in srgb, var(--c-admin) 30%, transparent); }
.sw-pending { display: inline-block; width: 14px; height: 10px; border-radius: 2px; background: repeating-linear-gradient(135deg, var(--c-client) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px var(--c-client); }

/* approvals */
.appr-list { padding: 2px 0 6px; }
.appr { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 20px; }
.appr + .appr { border-top: 1px solid var(--sep); }
.appr-text { display: grid; gap: 3px; min-width: 0; }
.appr-name { font-size: 15px; font-weight: 600; }
.appr-name .muted { font-size: 13px; margin-left: 4px; }
.appr-what { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.appr-sub { font-size: 12.5px; color: var(--ink-2); }
.appr-actions { display: flex; gap: 8px; align-items: center; align-self: center; }

/* team */
.tr-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tag { font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 6px; background: var(--fill-2); color: var(--ink-2); white-space: nowrap; }
.tag-accent { background: var(--sel); color: var(--accent-ink); }
.tag-muted { color: var(--ink-3); }
.team-row { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.settings-row + .settings-row { border-top: 1px solid var(--sep); }
.settings-row.stack { display: grid; gap: 12px; }
.allow-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 20px; }
.allow-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.mobile-only { display: none; }
.lrow .tile-icon { width: 28px; height: 28px; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #E5484D; color: #FFFFFF; font-size: 11.5px; font-weight: 600; display: inline-grid; place-items: center; }

/* ---------- popovers, picker, dialog, toast ---------- */
.pop-backdrop { position: fixed; inset: 0; z-index: 40; }
.pop { position: fixed; z-index: 41; background: var(--surface-pop); border-radius: 12px; box-shadow: var(--shadow-pop); overflow: hidden; animation: pop-in 0.14s ease-out; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.pop-sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: auto !important; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); animation: sheet-in 0.22s ease-out; }
@keyframes sheet-in { from { transform: translateY(30px); opacity: 0; } }
.pop-backdrop.dim { background: rgba(0, 0, 0, 0.3); }
.picker .search { margin: 10px 10px 4px; }
.pk-list { max-height: 340px; overflow-y: auto; padding: 0 6px 8px; overscroll-behavior: contain; }
.pop-sheet .pk-list { max-height: 60vh; }
.pk-group { font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 10px 10px 4px; }
.pk-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.pk-item.active { background: var(--sel); }
.pk-text { display: grid; min-width: 0; line-height: 1.3; }
.pk-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-code { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-empty { padding: 22px 12px; text-align: center; color: var(--ink-2); }
.menu { padding: 6px; display: grid; }
.menu-item { display: grid; gap: 1px; padding: 8px 12px; border-radius: 8px; color: var(--ink); text-align: left; }
.menu-item:hover, .menu-item:focus-visible { background: var(--sel); outline: none; }
.menu-item span { font-size: 14px; font-weight: 500; }
.menu-item small { font-size: 12px; color: var(--ink-2); }

.dialog { border: 0; padding: 0; border-radius: 16px; width: min(440px, calc(100vw - 32px)); background: var(--surface-pop); color: var(--ink); box-shadow: var(--shadow-pop); }
.dialog::backdrop { background: rgba(0, 0, 0, 0.28); }
.dialog[open] { animation: pop-in 0.16s ease-out; }
.dialog-form { display: grid; gap: 16px; padding: 22px; }
.dialog-title { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; margin: 0; }
.dialog-body { display: grid; gap: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dialog-actions .btn { min-width: 84px; }
.form-error { margin: 0; color: var(--danger); font-size: 13px; }
.switch-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.toast-region { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { padding: 10px 16px; border-radius: 12px; background: rgba(29, 29, 31, 0.92); color: #FFFFFF; font-size: 13.5px; font-weight: 500; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; }
.toast.in { opacity: 1; transform: none; }
.toast-error { background: rgba(190, 20, 30, 0.95); }

/* ---------- sign-in screens ---------- */
body.screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.screen-card { width: min(400px, calc(100vw - 32px)); background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-card), 0 20px 50px rgba(0, 0, 0, 0.06); padding: 36px 32px 30px; display: grid; gap: 8px; text-align: center; }
.screen-brand { display: flex; justify-content: center; align-items: baseline; gap: 8px; margin-bottom: 18px; }
.screen-brand .wordmark { font-size: 28px; }
.screen-card h1 { font-size: 24px; }
.screen-msg { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; }
.screen-notice { margin: 0 0 12px; padding: 8px 12px; border-radius: 10px; background: var(--ok-soft); color: var(--ok-ink); font-size: 13.5px; font-weight: 500; }
.screen-form { display: grid; gap: 8px; text-align: left; margin-top: 8px; }
.screen-form .btn { margin-top: 8px; }
.screen-dev { margin: 6px 0 2px; font-size: 12px; font-weight: 600; color: var(--warn-ink); text-align: center; }
.screen-foot { margin: 0; font-size: 12px; color: var(--ink-3); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .content { padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--sep); }
}
@media (max-width: 820px) {
  .app { display: block; }
  .sidebar { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 30; flex-direction: row; padding: 6px max(8px, env(safe-area-inset-right, 0px)) max(6px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); border-right: 0; border-top: 1px solid var(--sep); }
  .brand, .sidebar-foot, .nav-section, .nav-item[data-manage] { display: none !important; }
  .nav-badge { display: none !important; }
  .mobile-only { display: block; }
  .home-grid, .home-grid.three { grid-template-columns: 1fr; }
  .balance { grid-template-columns: 1fr; justify-items: center; gap: 18px; }
  .bal-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 14px 0; }
  .bstat:nth-child(3) { border-left: 0; }
  .nav { flex-direction: row; justify-content: space-around; }
  .nav-item { flex: 1; flex-direction: column; gap: 2px; padding: 5px 4px; font-size: 10.5px; font-weight: 500; color: var(--ink-3); border-radius: 8px; }
  .nav-item .ic { width: 23px; height: 23px; color: var(--ink-3); }
  .nav-item[aria-current="page"] { background: transparent; }
  .nav-item:hover { background: transparent; }
  .mobilebar { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); padding-top: max(10px, env(safe-area-inset-top, 0px)); background: var(--sidebar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--sep); }
  .mobilebar .wordmark { font-size: 19px; }
  .content { padding-block: 20px 110px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  h1 { font-size: 26px; }
  .toast-region { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 640px) {
  .page-head { align-items: flex-start; }
  .timer { flex-wrap: wrap; padding: 8px; }
  .timer-proj { flex-basis: 100%; }
  .timer-right { width: 100%; justify-content: flex-end; padding: 0 4px 2px; }
  .timer-clock { margin-right: auto; text-align: left; padding-left: 8px; }
  .brow-main { grid-template-columns: 14px 26px minmax(0, 1fr) auto 62px; gap: 10px; padding: 10px 14px; }
  .brow-bar { display: none; }
  .brow-detail { padding: 0 14px 12px 14px; }
  .team-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .tr-meta { display: none; }
  .tr-toggles { grid-column: 2; gap: 16px; }
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 24px; }
  .ts-summary { width: 100%; }
  .ts-summary .btn { margin-left: auto; }
  .rrow { grid-template-columns: 22px minmax(0, 1fr) auto; padding: 10px 14px; }
  .rrow > .btn, .rrow > .rrow-gap { grid-column: 2 / -1; justify-self: start; }
  .appr { grid-template-columns: 32px minmax(0, 1fr); padding: 14px; }
  .appr-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .field-row { grid-template-columns: 1fr; }
  .tr-tags { display: none; }
  .away-row { padding: 9px 14px; }
  .calgrid { min-width: 760px; }
  .calgrid .cal-name { width: 118px; padding-left: 12px; padding-right: 8px; }
  .cal-name .avatar, .cal-l { display: none; }
  .cal-who { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- print (reports) ---------- */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #FFFFFF; font-size: 11pt; }
  .sidebar, .mobilebar, .page-actions, .toast-region, .boot, .chart-tip, .bactions, .card-head .segmented { display: none !important; }
  .brow-main .chev { visibility: hidden; }
  .brow-bar { display: block !important; }
  .brow-main { grid-template-columns: 0 28px minmax(0, 1fr) auto minmax(60px, 160px) 70px; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .stat + .stat { border-left: 1px solid #E3E3E6 !important; border-top: 0 !important; }
  .app { display: block; }
  .content { max-width: none; padding: 0; }
  .print-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid var(--brand); padding-bottom: 8px; margin-bottom: 14px; }
  .print-head .ph-meta { font-size: 9pt; color: #6E6E73; text-align: right; }
  .card { box-shadow: none; border: 1px solid #E3E3E6; }
  .stats, .chart-card { break-inside: avoid; }
  .chart-card .chart svg { max-height: 62mm; }
  .brow-detail { display: block !important; }
  .brow { break-inside: avoid; }
  .view { gap: 12px; }
}
