/* HRMS design system. Plain CSS, no build step. Colours live in tokens only. */
:root {
  color-scheme: light;
  --brand: #e55659;
  --paper: #f6f6f7;
  --surface: #ffffff;
  --surface-2: #f2f2f4;
  --line: #e7e7ea;
  --line-strong: #d3d4d9;
  --ink: #1d1f24;
  --ink-2: #555960;
  --ink-3: #6f737b;
  --accent: #c8363f;
  --accent-ink: #ffffff;
  --accent-soft: #fcebeb;
  --rail: #ffffff;
  --rail-ink: #4a4e56;
  --rail-ink-strong: #c8363f;
  --rail-hover: #f2f2f4;
  --rail-active: #fcebeb;
  --good: #14785a;
  --good-soft: #e0f4ec;
  --warn: #8a5a04;
  --warn-soft: #fbf0d9;
  --bad: #9b1c2e;
  --bad-soft: #f9e6e9;
  --info: #2560ad;
  --info-soft: #e4eefb;
  --quiet: #666a72;
  --quiet-soft: #efeff1;
  --teal: #0b6f7a;
  --teal-soft: #d9f1f3;
  --orange: #b4440c;
  --orange-soft: #fde6d6;
  --purple: #6b3fb0;
  --purple-soft: #ece4f8;
  --pink: #a3226f;
  --pink-soft: #fae0ef;
  --chart-ontime: #2e9e78;
  --chart-late: #d9901a;
  --chart-leave: #3b7dd8;
  --chart-absent: #b53a4e;
  --shadow-s: 0 1px 2px rgb(29 31 36 / 5%);
  --shadow: 0 2px 6px rgb(29 31 36 / 6%), 0 16px 40px rgb(29 31 36 / 12%);
  --radius: 14px;
  --radius-s: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #e55659;
  --paper: #111214;
  --surface: #18191c;
  --surface-2: #222327;
  --line: #2c2e33;
  --line-strong: #3f4148;
  --ink: #eeeef0;
  --ink-2: #aeb0b6;
  --ink-3: #93959c;
  --accent: #e55659;
  --accent-ink: #240708;
  --accent-soft: #3a1c1e;
  --rail: #18191c;
  --rail-ink: #aeb0b6;
  --rail-ink-strong: #f08487;
  --rail-hover: #222327;
  --rail-active: #3a1c1e;
  --good: #5ccda3;
  --good-soft: #14322a;
  --warn: #e8b552;
  --warn-soft: #352a12;
  --bad: #ff9aa6;
  --bad-soft: #3d1b24;
  --info: #8ab6f0;
  --info-soft: #182b42;
  --quiet: #a5a7ad;
  --quiet-soft: #26282c;
  --teal: #5fd0dc;
  --teal-soft: #12323a;
  --orange: #ff9d66;
  --orange-soft: #402313;
  --purple: #bb9cf0;
  --purple-soft: #2b2042;
  --pink: #f59ccc;
  --pink-soft: #40192e;
  --chart-ontime: #2ea27c;
  --chart-late: #bd8620;
  --chart-leave: #4f8bdd;
  --chart-absent: #c95468;
  --shadow-s: 0 1px 2px rgb(0 0 0 / 35%);
  --shadow: 0 2px 6px rgb(0 0 0 / 35%), 0 16px 40px rgb(0 0 0 / 50%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand: #e55659;
    --paper: #111214;
    --surface: #18191c;
    --surface-2: #222327;
    --line: #2c2e33;
    --line-strong: #3f4148;
    --ink: #eeeef0;
    --ink-2: #aeb0b6;
    --ink-3: #93959c;
    --accent: #e55659;
    --accent-ink: #240708;
    --accent-soft: #3a1c1e;
    --rail: #18191c;
    --rail-ink: #aeb0b6;
    --rail-ink-strong: #f08487;
    --rail-hover: #222327;
    --rail-active: #3a1c1e;
    --good: #5ccda3;
    --good-soft: #14322a;
    --warn: #e8b552;
    --warn-soft: #352a12;
    --bad: #ff9aa6;
    --bad-soft: #3d1b24;
    --info: #8ab6f0;
    --info-soft: #182b42;
    --quiet: #a5a7ad;
    --quiet-soft: #26282c;
  --teal: #5fd0dc;
  --teal-soft: #12323a;
  --orange: #ff9d66;
  --orange-soft: #402313;
  --purple: #bb9cf0;
  --purple-soft: #2b2042;
  --pink: #f59ccc;
  --pink-soft: #40192e;
    --chart-ontime: #2ea27c;
    --chart-late: #bd8620;
    --chart-leave: #4f8bdd;
    --chart-absent: #c95468;
    --shadow-s: 0 1px 2px rgb(0 0 0 / 35%);
    --shadow: 0 2px 6px rgb(0 0 0 / 35%), 0 16px 40px rgb(0 0 0 / 50%);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.5 var(--font); }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); text-underline-offset: 2px; }
svg.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.right { text-align: end; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 12px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; color: var(--rail-ink-strong); text-decoration: none; font-weight: 600; line-height: 1.2; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: #e8b552; color: #12302b; display: grid; place-items: center; font-weight: 800; flex: none; }
.brand small { display: block; font-weight: 400; font-size: 11.5px; color: var(--rail-ink); }
.nav-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--rail-ink); opacity: .72; padding: 14px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-s); color: var(--rail-ink); text-decoration: none; }
.nav a:hover { background: var(--rail-hover); color: var(--rail-ink-strong); }
.nav a[aria-current="page"] { background: var(--rail-hover); color: var(--rail-ink-strong); font-weight: 600; box-shadow: inset 2px 0 0 #e8b552; }
.nav .count { margin-inline-start: auto; background: #e8b552; color: #12302b; font-size: 11.5px; font-weight: 700; border-radius: 99px; padding: 0 7px; font-variant-numeric: tabular-nums; }
.rail-foot { margin-top: auto; padding-top: 14px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 28px 0; flex-wrap: wrap; }
.topbar h1 { font-size: 21px; font-weight: 650; letter-spacing: -.01em; line-height: 1.25; }
.topbar .sub { color: var(--ink-2); font-size: 13px; }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.content { padding: 18px 28px 40px; display: grid; gap: 18px; min-width: 0; }
.icon-btn.menu-btn { display: none; }
.scrim { display: none; }

.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.user-menu summary::-webkit-details-marker { display: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; text-decoration: none; }
.menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; z-index: 20; }
.menu-head { padding: 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; overflow-wrap: anywhere; }
.menu a, .menu button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 7px 10px; border: 0; background: none; border-radius: var(--radius-s); color: var(--ink); text-decoration: none; font: inherit; cursor: pointer; text-align: start; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 6px 12px; border-radius: var(--radius-s); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 550; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.3); }
.btn-danger { color: var(--bad); border-color: currentColor; }
.btn-danger:hover { background: var(--bad-soft); }
.btn-good { color: var(--good); border-color: currentColor; }
.btn-good:hover { background: var(--good-soft); }
.btn-sm { min-height: 28px; padding: 3px 9px; font-size: 13px; }
.icon-btn { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; border: 0; background: none; border-radius: var(--radius-s); color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.rail .icon-btn { color: var(--rail-ink); width: 100%; display: flex; gap: 10px; padding: 7px 10px; height: auto; justify-content: flex-start; font: inherit; }
.rail .icon-btn:hover { background: var(--rail-hover); color: var(--rail-ink-strong); }

label.field, .field { display: grid; gap: 4px; min-width: 0; }
.field > span, .field-label { font-size: 12.5px; font-weight: 550; color: var(--ink-2); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-s); padding: 6px 9px; min-height: 34px; width: 100%; }
textarea { min-height: 72px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.is-invalid { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: 12.5px; }
.field-hint { color: var(--ink-2); font-size: 12.5px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }

.period { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface); }
.period a { display: grid; place-items: center; width: 32px; height: 32px; color: var(--ink-2); text-decoration: none; }
.period a:hover { background: var(--surface-2); color: var(--ink); }
.period strong { padding: 0 8px; min-width: 124px; text-align: center; font-weight: 600; }

.btn-quiet { border-color: transparent; background: none; color: var(--ink-2); }
.tabs { display: flex; gap: 2px; padding: 6px 10px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { display: flex; align-items: center; gap: 6px; padding: 8px 10px; color: var(--ink-2); text-decoration: none; white-space: nowrap; font-weight: 550; box-shadow: inset 0 -2px 0 transparent; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--brand); }
.tabs a .num { font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border-radius: 99px; padding: 0 7px; }
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.chip { padding: 2px 10px; border: 1px solid var(--line-strong); border-radius: 99px; color: var(--ink-2); text-decoration: none; font-size: 12.5px; }
.chip:hover { background: var(--surface-2); }
.chip[aria-current] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 14px; font-weight: 650; }
.card-head .sub { color: var(--ink-2); font-size: 12.5px; }
.card-head > :last-child:not(:first-child) { margin-inline-start: auto; }
.card-body { padding: 14px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.stack { display: grid; gap: 18px; min-width: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stat { padding: 13px 16px; border-inline-end: 1px solid var(--line); min-width: 0; }
.stat:last-child { border-inline-end: 0; }
.stat-label { font-size: 12.5px; color: var(--ink-2); }
.stat-value { font-size: 25px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.25; }
.stat-value small { font-size: 14px; font-weight: 500; color: var(--ink-2); letter-spacing: 0; }
.stat-hint { font-size: 12.5px; color: var(--ink-2); }
.stat a { color: inherit; text-decoration: none; }
.stat a:hover .stat-label { text-decoration: underline; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th { text-align: start; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 8px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
tr.is-off td { color: var(--ink-3); }
th.right, td.right { text-align: end; }
.table-tight th, .table-tight td { padding-inline-start: 8px; padding-inline-end: 8px; }
.table-tight th:first-child, .table-tight td:first-child { padding-inline-start: 14px; }
.table-tight th:last-child, .table-tight td:last-child { padding-inline-end: 14px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; }
a.person:hover strong { text-decoration: underline; }
.person strong { font-weight: 600; display: block; line-height: 1.25; white-space: nowrap; }
.person small { color: var(--ink-2); font-size: 12px; display: block; white-space: nowrap; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 10px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .end { margin-inline-start: auto; text-align: end; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px 1px 7px; border-radius: 99px; font-size: 12.5px; font-weight: 550; white-space: nowrap; background: var(--tone-soft); color: var(--tone); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tone-good { --tone: var(--good); --tone-soft: var(--good-soft); }
.tone-warn { --tone: var(--warn); --tone-soft: var(--warn-soft); }
.tone-bad { --tone: var(--bad); --tone-soft: var(--bad-soft); }
.tone-info { --tone: var(--info); --tone-soft: var(--info-soft); }
.tone-teal { --tone: var(--teal); --tone-soft: var(--teal-soft); }
.tone-orange { --tone: var(--orange); --tone-soft: var(--orange-soft); }
.tone-purple { --tone: var(--purple); --tone-soft: var(--purple-soft); }
.tone-pink { --tone: var(--pink); --tone-soft: var(--pink-soft); }
.tone-unpaid { --tone: var(--info); --tone-soft: var(--info-soft); }
.cal-cell.tone-unpaid, .cal-key b.tone-unpaid { background-image: repeating-linear-gradient(135deg, transparent 0 2px, color-mix(in srgb, var(--info) 55%, transparent) 2px 4px); }
.tone-quiet { --tone: var(--quiet); --tone-soft: var(--quiet-soft); }
.text-bad { color: var(--bad); font-weight: 600; }
.text-good { color: var(--good); font-weight: 600; }

.empty { padding: 34px 20px; text-align: center; color: var(--ink-2); }
.empty strong { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius-s); background: var(--tone-soft); color: var(--tone); font-weight: 500; }
.alert .icon { margin-top: 1px; }
.alert ul { margin: 0; padding-inline-start: 16px; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 13px; flex-wrap: wrap; }
.pagination .pages, .pagination .page-sizes { display: flex; gap: 4px; align-items: center; }
.pagination .btn .icon { width: 15px; height: 15px; }
.btn.is-current { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.is-disabled { opacity: .45; pointer-events: none; }
.pages-gap { padding: 0 2px; color: var(--ink-3); }
.th-sort { color: inherit; text-decoration: none; display: inline-flex; gap: 3px; }
.th-sort:hover { color: var(--ink); text-decoration: underline; }
th[aria-sort] { color: var(--accent); }
.nowrap { white-space: nowrap; }

/* ---------- month strip ---------- */
.month-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; }
.day { aspect-ratio: 1; min-height: 34px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--tone-soft); color: var(--tone); border: 1px solid transparent; }
.day.is-today { border-color: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 5px; background: var(--swatch); vertical-align: -1px; }

.meter { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--tone, var(--accent)); border-radius: 99px; }

/* ---------- trend chart ---------- */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 6px; }
.chart-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; height: 100%; justify-content: flex-end; align-items: center; gap: 5px; border-radius: 4px; position: relative; cursor: default; outline-offset: 1px; }
.chart-bar { width: min(100%, 26px); display: flex; flex-direction: column-reverse; gap: 2px; flex: 1 1 auto; justify-content: flex-start; }
.chart-bar i { display: block; min-height: 2px; }
.chart-bar i:last-child { border-radius: 4px 4px 0 0; }
.chart-tick { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-col:hover .chart-bar, .chart-col:focus-visible .chart-bar { filter: brightness(.92); }
.chart-tip { position: absolute; bottom: calc(100% - 18px); left: 50%; transform: translateX(-50%); background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--radius-s); padding: 7px 10px; font-size: 12.5px; white-space: nowrap; z-index: 5; pointer-events: none; display: none; }
.chart-col:hover .chart-tip, .chart-col:focus-visible .chart-tip { display: block; }
.chart-col:first-child .chart-tip, .chart-col:nth-child(2) .chart-tip { left: 0; transform: none; }
.chart-col:last-child .chart-tip, .chart-col:nth-last-child(2) .chart-tip { left: auto; right: 0; transform: none; }
.chart-tip b { display: block; margin-bottom: 2px; font-weight: 600; }
.chart-tip span { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }
details.data-table summary { cursor: pointer; color: var(--ink-2); font-size: 12.5px; margin-top: 10px; }

/* ---------- team calendar ---------- */
.cal { border-collapse: separate; border-spacing: 1.5px; width: auto; min-width: 100%; }
.cal th, .cal td { padding: 0; border: 0; background: none; }
.cal tbody tr:hover td { background: none; }
.cal .cal-name { position: sticky; inset-inline-start: 0; z-index: 2; background: var(--surface); padding: 2px 12px 2px 14px; text-align: start; font-size: 13px; font-weight: 550; white-space: nowrap; color: var(--ink); }
.cal thead th { font-size: 11px; font-weight: 600; color: var(--ink-2); text-align: center; padding: 6px 0 4px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.cal thead th small { display: block; font-size: 10px; font-weight: 500; color: var(--ink-3); }
.cal thead th.is-weekend { color: var(--ink-3); }
.cal thead th.is-today { color: var(--accent); }
.cal-cell { display: grid; place-items: center; width: 23px; height: 26px; border-radius: 5px; font-size: 11px; font-weight: 650; background: var(--tone-soft); color: var(--tone); }
.cal-cell.tone-none { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.cal-cell.is-today { outline: 1.5px solid var(--ink); outline-offset: 0; }
.cal .cal-foot td { font-size: 11px; color: var(--ink-2); text-align: center; font-variant-numeric: tabular-nums; padding-top: 4px; }
.cal-key { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.cal-key b { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; font-size: 10.5px; font-weight: 650; margin-inline-end: 5px; background: var(--tone-soft); color: var(--tone); vertical-align: -3px; }

/* ---------- insights ---------- */
.delta { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.delta b { font-weight: 600; }
.delta .up { color: var(--good); }
.delta .down { color: var(--bad); }
.hbar { display: grid; grid-template-columns: 88px minmax(0, 1fr) 96px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.hbar-track { height: 14px; display: flex; }
.hbar-track i { display: block; height: 100%; background: var(--chart-late); border-radius: 0 4px 4px 0; min-width: 2px; }
.rank { width: 22px; color: var(--ink-3); font-variant-numeric: tabular-nums; flex: none; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }

/* ---------- payslip ---------- */
.slip { max-width: 680px; }
.slip-head { display: flex; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.slip-head h2 { font-size: 17px; font-weight: 650; }
.slip-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.slip-grid div { padding: 10px 20px; border-inline-end: 1px solid var(--line); }
.slip-grid div:last-child { border-inline-end: 0; }
.slip-grid b { display: block; font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.slip-lines { width: 100%; }
.slip-lines td { padding: 10px 20px; }
.slip-total td { font-size: 16px; font-weight: 700; border-top: 2px solid var(--ink); }
.slip-foot { padding: 12px 20px; color: var(--ink-2); font-size: 12.5px; border-top: 1px solid var(--line); }

/* ---------- announcements ---------- */
.notice { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notice:last-child { border-bottom: 0; }
.notice > .icon { color: var(--accent); margin-top: 2px; }
.notice h3 { font-size: 14px; font-weight: 650; }
.notice p { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; overflow-wrap: anywhere; }
.notice .meta { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.notice .end { margin-inline-start: auto; flex: none; }
.notice.is-expired { opacity: .6; }

.conflict { display: flex; gap: 5px; align-items: flex-start; color: var(--warn); margin-top: 3px; max-width: 320px; }
.conflict .icon { width: 14px; height: 14px; margin-top: 2px; }

/* ---------- quick search ---------- */
.search-btn { color: var(--ink-2); font-weight: 500; }
.search-btn kbd { font: inherit; font-size: 11px; border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 4px; color: var(--ink-3); }
dialog.palette { margin-top: 12vh; width: min(520px, calc(100vw - 32px)); }
dialog.palette input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 12px 16px; font-size: 15px; background: transparent; outline: none; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 340px; overflow-y: auto; }
.palette-list a { display: flex; gap: 10px; justify-content: space-between; padding: 8px 10px; border-radius: var(--radius-s); color: var(--ink); text-decoration: none; }
.palette-list a small { color: var(--ink-2); }
.palette-list a[aria-selected="true"] { background: var(--accent-soft); }
.palette-empty { padding: 16px 10px; text-align: center; color: var(--ink-2); }

.qr-card { display: flex; gap: 20px; align-items: center; padding: 16px; flex-wrap: wrap; }
.qr-card img { background: #fff; border-radius: 8px; padding: 8px; }
.qr-card h2 { font-size: 15px; font-weight: 650; margin-bottom: 6px; }
.qr-card ol { margin: 0; padding-inline-start: 18px; color: var(--ink-2); }

.import-table td { vertical-align: top; }
.import-table input:not([type=checkbox]), .import-table .combo { min-width: 150px; }
.import-table input[type=checkbox] { width: 18px; height: 18px; min-height: 0; margin-top: 10px; accent-color: var(--accent); }

.checkin-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 16px 18px; border-inline-start: 4px solid var(--brand); }
.checkin-card strong { display: block; font-size: 16px; font-weight: 650; margin: 2px 0; }
.checkin-card .btn { min-height: 42px; padding: 8px 20px; }
.rota { border-collapse: separate; border-spacing: 0; }
.rota th, .rota td { padding: 6px 6px; }
.rota th:first-child, .rota td:first-child { padding-inline-start: 18px; position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1; }
.rota select { width: 100%; min-width: 96px; min-height: 34px; padding: 5px 6px; font-size: 12.5px; }
.rota td:not(:first-child) { width: 13%; }
.rota .person small { display: none; }
.rota select.is-planned { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.rota th.is-weekend { color: var(--ink-3); }
.rota-foot td { font-size: 12px; color: var(--ink-2); padding-top: 8px; vertical-align: top; }

/* ---------- dialog ---------- */
dialog.modal { border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog.modal::backdrop { background: rgb(10 20 18 / 45%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 15px; font-weight: 650; }
.modal-body { padding: 16px 18px; display: grid; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---------- status pages ---------- */
.status-page { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.status-page b { display: block; font-size: 54px; font-weight: 700; letter-spacing: -.03em; color: var(--brand); line-height: 1; }
.status-page p { color: var(--ink-2); margin: 8px 0 18px; }

/* ---------- small screens ---------- */
@media (max-width: 1100px) {
  .grid-2, .grid-even { grid-template-columns: minmax(0, 1fr); }
}
/* sign-in */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); background: var(--surface); }
.auth-panel { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 48px 56px; color: #fff; background: linear-gradient(155deg, var(--brand) 0%, #d8454c 55%, #bd3039 100%); }
/* The wordmark, oversized and cropped, as texture. */
.auth-panel::before { content: ""; position: absolute; left: -9%; top: 24%; width: 150%; aspect-ratio: 335 / 80; background: url("../images/logo.svg") left center / contain no-repeat; filter: brightness(0) invert(1); opacity: .09; pointer-events: none; }
/* The slash cut through the logo's C, carried across the panel. */
.auth-panel::after { content: ""; position: absolute; inset-inline-end: -14%; bottom: -30%; width: 62%; height: 110%; background: rgb(255 255 255 / 7%); transform: skewX(-32deg); pointer-events: none; }
.auth-logo { position: relative; z-index: 1; width: 196px; height: auto; filter: brightness(0) invert(1); }
.auth-headline { position: relative; z-index: 1; margin: 0; max-width: 11.5em; font-size: clamp(34px, 3.5vw, 50px); line-height: 1.1; font-weight: 720; letter-spacing: -.03em; }
.auth-main { display: grid; place-items: center; padding: 40px 32px; background: var(--surface); }
.auth-form { width: min(380px, 100%); display: grid; gap: 22px; }
.auth-form .field { gap: 7px; }
.auth-form .field > span:first-child { font-size: 13px; }
.auth-form h1 { font-size: 32px; font-weight: 720; letter-spacing: -.03em; line-height: 1.15; }
.signin-lead { color: var(--ink-2); margin-top: 4px; font-size: 14.5px; }
.signin-error { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-s); background: var(--bad-soft); color: var(--bad); font-size: 13.5px; font-weight: 500; }
.signin-error .icon { margin-top: 1px; }
.input-icon { position: relative; display: block; }
.input-icon > .icon { position: absolute; inset-inline-start: 13px; top: 50%; margin-top: -9px; color: var(--ink-3); pointer-events: none; }
.input-icon input { min-height: 50px; padding-inline-start: 42px; font-size: 15px; }
.input-icon input:has(+ .input-action) { padding-inline-end: 46px; }
.input-action { position: absolute; inset-inline-end: 7px; top: 7px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 7px; background: none; color: var(--ink-3); cursor: pointer; }
.input-action:hover { background: var(--surface-2); color: var(--ink); }
.input-action[aria-pressed="true"] { color: var(--accent); }
.signin-submit { min-height: 50px; width: 100%; font-size: 15px; font-weight: 600; }
.signin-foot { text-align: center; font-size: 13.5px; color: var(--ink-2); }
.signin-foot a { color: var(--accent); font-weight: 550; }
.signin-success { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-s); background: var(--good-soft); color: var(--good); font-size: 13.5px; font-weight: 500; }
.signin-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.signin-row a { color: var(--accent); font-size: 13.5px; font-weight: 550; }
.code-input { min-height: 54px; letter-spacing: .35em; font-size: 20px !important; font-weight: 650; text-align: center; font-variant-numeric: tabular-nums; }
.slip-logo { width: 130px; margin-bottom: 8px; }

@media (max-width: 860px) {
  .auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .auth-panel { padding: 24px; gap: 18px; }
  .auth-panel::before { display: none; }
  .auth-logo { width: 150px; }
  .auth-headline { font-size: 22px; max-width: none; line-height: 1.2; }
  .auth-main { place-items: start center; padding: 28px 20px 40px; }
  .auth-form { gap: 18px; }
  .auth-form h1 { font-size: 26px; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; z-index: 40; width: 250px; inset-inline-start: 0; top: 0; transform: translateX(-100%); transition: transform .18s ease; }
  body.nav-open .rail { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgb(10 20 18 / 45%); z-index: 30; }
  .icon-btn.menu-btn { display: inline-grid; }
  .search-btn span, .search-btn kbd { display: none; }
  .slip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hbar { grid-template-columns: 76px minmax(0, 1fr) 84px; }
  .topbar { padding: 12px 16px 0; }
  .topbar h1 { font-size: 18px; }
  .content { padding: 14px 16px 32px; gap: 14px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { border-bottom: 1px solid var(--line); }
  .stat:nth-child(2n) { border-inline-end: 0; }
  .stat:nth-last-child(-n+2) { border-bottom: 0; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .chart-tick { font-size: 10px; }
  .chart-col:nth-child(even) .chart-tick { visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .rail, .topbar, .filters, .row-actions, .pagination, .alert, .no-print { display: none !important; }
  .card { border-color: #bbb; }
  .shell { display: block; }
  body { background: #fff; }
}

/* ==========================================================================
   Layout and components
   ========================================================================== */
body { font-size: 14px; }
.shell { grid-template-columns: 248px minmax(0, 1fr); }

::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }

/* logo */
.logo { display: block; height: auto; }

/* sidebar */
.rail { border-inline-end: 1px solid var(--line); padding: 18px 12px; }
.brand { padding: 2px 10px 14px; display: block; text-decoration: none; }
.brand .logo { width: 138px; }
.brand small { color: var(--ink-3); display: block; margin-top: 6px; font-size: 11.5px; font-weight: 400; }
.nav-label { color: var(--ink-3); opacity: 1; font-size: 11px; font-weight: 600; letter-spacing: .05em; padding: 16px 10px 5px; }
.nav a { padding: 7px 10px; font-weight: 500; margin-bottom: 1px; color: var(--rail-ink); }
.nav a .icon { width: 17px; height: 17px; }
.nav a:hover { background: var(--rail-hover); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--rail-active); color: var(--rail-ink-strong); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.nav .count { background: var(--accent); color: var(--accent-ink); }

/* app bar */
.main { min-height: 100vh; }
.appbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 28px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.search-btn { flex: 0 1 340px; justify-content: flex-start; gap: 8px; background: var(--surface-2); border-color: transparent; color: var(--ink-3); font-weight: 400; min-height: 38px; padding: 0 10px; }
.search-btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.search-btn kbd { margin-inline-start: auto; background: var(--surface); }
.appbar-end { margin-inline-start: auto; display: flex; align-items: center; gap: 4px; }
.user-menu summary { padding: 3px 8px 3px 4px; border-radius: 99px; gap: 8px; font-weight: 550; font-size: 13.5px; }
.user-menu summary:hover { background: var(--surface-2); }
.user-menu .avatar { width: 30px; height: 30px; }

/* page header */
.page-head { display: flex; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; padding: 24px 28px 0; }
.page-head h1 { font-size: 24px; font-weight: 680; letter-spacing: -.02em; line-height: 1.2; }
.page-head .sub { color: var(--ink-2); font-size: 13.5px; margin-top: 3px; }
.page-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.content { padding: 18px 28px 48px; gap: 16px; }

/* cards */
.card { border-color: var(--line); box-shadow: var(--shadow-s); }
.card-head { padding: 14px 18px; }
.card-head h2 { font-size: 14.5px; }
.card-body { padding: 18px; }
.list li { padding: 11px 18px; }
.grid-2, .grid-even, .stack { gap: 16px; }

/* stats */
.stats { background: none; border: 0; border-radius: 0; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 18px; box-shadow: var(--shadow-s); }
.stat:last-child { border-inline-end: 1px solid var(--line); }
.stat-label { font-weight: 500; }
.stat-value { font-size: 27px; margin-top: 2px; }

/* buttons */
.btn { border-radius: var(--radius-s); min-height: 36px; padding: 6px 14px; box-shadow: var(--shadow-s); }
.btn-primary { box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 40%, transparent); }
.btn-sm { min-height: 30px; padding: 3px 10px; box-shadow: none; border-color: transparent; background: var(--surface-2); }
.btn-sm:hover { background: var(--line); }
.btn-sm.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-sm.btn-danger { background: transparent; color: var(--bad); }
.btn-sm.btn-danger:hover { background: var(--bad-soft); }
.btn-danger { box-shadow: none; }
.btn-quiet { box-shadow: none; }
.icon-btn { border-radius: var(--radius-s); }

/* form fields */
input, select, textarea { min-height: 38px; padding: 7px 11px; border-radius: var(--radius-s); border-color: var(--line-strong); transition: border-color .12s, box-shadow .12s; }
input:hover, textarea:hover { border-color: var(--ink-3); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.field > span, .field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.form-grid { gap: 14px; }
.form-section { font-size: 11.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); grid-column: 1 / -1; padding-top: 4px; }

/* autocomplete dropdown */
.combo { position: relative; display: block; }
.combo-native { position: absolute; inset-inline-start: 0; bottom: 0; width: 100%; height: 1px; min-height: 0; padding: 0; opacity: 0; pointer-events: none; border: 0; }
.combo-input { padding-inline-end: 32px; cursor: pointer; text-overflow: ellipsis; }
.combo-input:not([readonly]):focus { cursor: text; }
.combo-arrow { position: absolute; inset-inline-end: 10px; top: 50%; width: 14px; height: 14px; margin-top: -7px; color: var(--ink-3); pointer-events: none; transition: transform .12s; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.combo[data-open] .combo-arrow { transform: rotate(180deg); }
.combo-list { position: fixed; z-index: 60; margin: 0; padding: 4px; list-style: none; max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.combo-list li { padding: 7px 10px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.combo-list li[data-active] { background: var(--surface-2); }
.combo-list li[aria-selected="true"] { color: var(--accent); font-weight: 600; }
.combo-list li[aria-selected="true"]::after { content: "✓"; font-size: 12px; }
.combo-list mark { background: none; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.combo-empty { padding: 10px; color: var(--ink-2); text-align: center; font-size: 13px; }

/* toggle switch */
.toggle { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.toggle.full { grid-column: 1 / -1; }
.toggle input[type="checkbox"] { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; padding: 0; }
.toggle-track { position: relative; flex: none; width: 36px; height: 20px; margin-top: 1px; border-radius: 99px; background: var(--line-strong); transition: background .15s; }
.toggle-track::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 30%); transition: transform .15s; }
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle input:checked + .toggle-track::after { transform: translateX(16px); }
.toggle input:focus-visible + .toggle-track { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.toggle b { font-weight: 550; display: block; line-height: 1.35; }
.toggle small { color: var(--ink-2); font-size: 12.5px; display: block; }

/* filter bar */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; align-items: end; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.filters .field { width: auto !important; min-width: 0; }
.filters input, .combo { max-width: 100%; }
.filter-grow { grid-column: span 2; }
@media (max-width: 1400px) { .filter-grow { grid-column: span 1; } }
.filters-end { display: flex; gap: 6px; justify-self: start; }
.js .filters-apply { display: none; }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.active-filters a { display: inline-flex; align-items: center; gap: 6px; padding: 2px 6px 2px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 550; text-decoration: none; }
.active-filters a span { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; font-size: 12px; }
.active-filters a:hover span { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.active-filters .clear-all { background: none; color: var(--ink-2); padding: 2px 8px; }
.tabs { padding: 10px 18px 0; gap: 4px; }
.tabs a { border-radius: 8px 8px 0 0; padding: 8px 12px; }
.tabs a:hover { background: var(--surface-2); }
.presets { padding: 10px 18px; }
.chip { background: var(--surface); }

/* tables */
th { padding: 11px 12px; background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); font-size: 11.5px; letter-spacing: .02em; text-transform: uppercase; color: var(--ink-3); }
td { padding: 11px 12px; }
th:first-child, td:first-child { padding-inline-start: 18px; }
th:last-child, td:last-child { padding-inline-end: 18px; }
.card > .table-wrap:first-child { border-radius: var(--radius); }
.table-tight th, .table-tight td { padding-inline-start: 6px; padding-inline-end: 6px; }
.table-tight th:first-child, .table-tight td:first-child { padding-inline-start: 18px; }
.table-tight th:last-child, .table-tight td:last-child { padding-inline-end: 18px; }
td .note { display: block; font-size: 12px; color: var(--ink-2); margin-top: 2px; white-space: nowrap; }
.pill { padding: 2px 10px 2px 8px; }
.pagination { padding: 12px 18px; }
.cal .cal-name { padding-inline-start: 18px; }

/* dialog */
dialog.modal { border-radius: 16px; border: 0; }
dialog.modal::backdrop { background: rgb(15 23 30 / 45%); backdrop-filter: blur(2px); }
.modal-head { padding: 16px 16px 14px 22px; }
.modal-body { padding: 18px 22px; gap: 14px; }
.modal-foot { padding: 14px 22px; background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); border-radius: 0 0 16px 16px; }


@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .filters input[type="date"] { min-width: 0; padding-inline-start: 8px; padding-inline-end: 4px; font-size: 13px; }
  .appbar { padding: 0 12px; height: 56px; }
  .search-btn { flex: 0 0 auto; width: 38px; padding: 0; justify-content: center; }
  .user-menu .user-name { display: none; }
  .page-head { padding: 16px 16px 0; }
  .page-head h1 { font-size: 20px; }
  .page-actions { margin-inline-start: 0; width: 100%; }
  .content { padding: 14px 16px 36px; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px 16px; }
  .filter-grow { grid-column: 1 / -1; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { border-bottom: 1px solid var(--line); border-inline-end: 1px solid var(--line); padding: 12px 14px; }
  .stat:nth-child(2n), .stat:nth-last-child(-n+2) { border: 1px solid var(--line); }
  .stat-value { font-size: 22px; }
}
@media print {
  .appbar, .page-actions, .active-filters, .tabs, .presets { display: none !important; }
  .card, .stat { box-shadow: none; }
}

/* Arabic: right-to-left, with an Arabic typeface. */
html[lang="ar"] { --font: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif; }
html[lang="ar"] body { font-size: 14.5px; }
[dir="rtl"] .chart-col:first-child .chart-tip, [dir="rtl"] .chart-col:nth-child(2) .chart-tip { left: auto; right: 0; }
[dir="rtl"] .chart-col:last-child .chart-tip, [dir="rtl"] .chart-col:nth-last-child(2) .chart-tip { right: auto; left: 0; }
[dir="rtl"] .nav a[aria-current="page"] { box-shadow: inset -3px 0 0 var(--brand); }
[dir="rtl"] .toggle input:checked + .toggle-track::after { transform: translateX(-16px); }
[dir="rtl"] .icon-left, [dir="rtl"] .icon-right, [dir="rtl"] .icon-logout { transform: scaleX(-1); }
@media (max-width: 860px) { [dir="rtl"] .rail { transform: translateX(100%); } [dir="rtl"] body.nav-open .rail { transform: none; } }
.lang-switch { font-weight: 650; font-size: 13px; text-decoration: none; color: var(--ink-2); padding: 6px 8px; border-radius: var(--radius-sm, 6px); }
.lang-switch:hover { background: var(--hover, rgb(0 0 0 / 5%)); color: var(--ink); }
.auth-lang { position: absolute; top: 16px; inset-inline-end: 16px; }
.auth-main { position: relative; }

/* Sticky table headers: the header row follows the page under the top bar (app.js moves it),
   while wide tables keep scrolling sideways inside their card. */
.table-wrap thead th { position: relative; z-index: 3; box-shadow: inset 0 -1px 0 var(--line); transform: translateY(var(--head-shift, 0px)); will-change: transform; }
.table-wrap.is-stuck thead th { box-shadow: inset 0 -1px 0 var(--line), 0 6px 10px -8px rgb(0 0 0 / 35%); }
.cal thead th { background: var(--surface); }
.cal thead th.cal-name, .rota thead th:first-child { z-index: 4; }
@media print { .table-wrap thead th { transform: none; } }

/* Instant tooltip (team calendar). */
.tip { position: fixed; z-index: 60; display: none; max-width: 320px; padding: 8px 11px; border-radius: 8px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow, 0 6px 20px rgb(0 0 0 / 18%)); font-size: 12.5px; line-height: 1.6; white-space: pre-line; pointer-events: none; }
.tip::first-line { font-weight: 650; }
.cal-cell { cursor: default; }
.cal-cell:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

.month-strip .day[data-tip] { cursor: default; }

/* Pick one of a few options, each a card with a title and a line of explanation. */
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 14px; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface); cursor: pointer; }
.choice:hover { border-color: var(--ink-2); }
.choice input[type=radio] { flex: none; width: 18px; min-height: 0; height: 18px; margin: 2px 0 0; padding: 0; accent-color: var(--brand); }
.choice b { display: block; font-weight: 600; }
.choice small { display: block; margin-top: 3px; color: var(--ink-2); font-size: 13px; line-height: 1.45; }
.choice:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 640px) { .choices { grid-template-columns: 1fr; } }

/* Settings laid out as rules: what it is on the left, how to set it on the right. */
.stat.is-text .stat-value, .rule-summary .stat-value { font-size: 17px; line-height: 1.4; }
.rule-summary { margin-bottom: 16px; }
.rules { overflow: hidden; }
.rule { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 28px; padding: 22px 24px; }
.rule + .rule { border-top: 1px solid var(--line); }
.rule-intro h2 { font-size: 15px; font-weight: 650; margin: 8px 0 6px; }
.rule-intro p { color: var(--ink-2); font-size: 13px; line-height: 1.55; }
.rule-step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 650; }
.choices.stack { grid-template-columns: 1fr; margin-top: 0; gap: 8px; }
.rule-factors { max-width: 460px; }
.field-error { color: var(--bad); margin-top: 8px; }
.savebar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 16px; padding: 12px 0; background: linear-gradient(to top, var(--paper) 70%, transparent); }
.savebar-note { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; }
.savebar-note svg { width: 16px; height: 16px; }
.savebar .btn[disabled] { opacity: .5; cursor: default; }
@media (max-width: 760px) { .rule { grid-template-columns: 1fr; gap: 14px; padding: 18px 16px; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* The month's sign-off on the payroll page. */
.review { margin-bottom: 16px; border-inline-start: 4px solid var(--line-strong); }
.review-approved { border-inline-start-color: var(--good); }
.review-ready { border-inline-start-color: var(--good); }
.review-blocked { border-inline-start-color: var(--warn); }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; flex-wrap: wrap; }
.review-head h2 { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 650; }
.review-head h2 svg { width: 18px; height: 18px; }
.review-head p { margin-top: 3px; color: var(--ink-2); font-size: 13px; max-width: 70ch; }
.review-approved h2 svg, .review-ready h2 svg { color: var(--good); }
.review-blocked h2 svg { color: var(--warn); }
.review-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.review-list li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px; }
.review-list li + li { border-top: 1px solid var(--line); }
.pill-count { display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 12px; font-weight: 650; text-align: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
