/* =========================================================
   Tweetycam Leave — Design System v2
   "Notion-calm meets Linear-clean"
   Plain CSS only. No framework. Self-hosted Nunito (no CDN).
   ========================================================= */

@font-face{font-family:'Nunito';font-weight:400;font-style:normal;font-display:swap;src:url('/fonts/nunito-400.woff2') format('woff2')}
@font-face{font-family:'Nunito';font-weight:600;font-style:normal;font-display:swap;src:url('/fonts/nunito-600.woff2') format('woff2')}
@font-face{font-family:'Nunito';font-weight:700;font-style:normal;font-display:swap;src:url('/fonts/nunito-700.woff2') format('woff2')}
@font-face{font-family:'Nunito';font-weight:800;font-style:normal;font-display:swap;src:url('/fonts/nunito-800.woff2') format('woff2')}

/* ── Variables ─────────────────────────────────────────── */
:root {
  /* Brand */
  /* Tweetycam brand teal (from the Shopify "Alinga" theme) */
  --brand:         #038791;
  --brand-hover:   #04b6c3;
  --brand-ink:     #ffffff;

  /* Colour tokens */
  --accent:        #038791;
  --accent-hover:  #04b6c3;
  --success:       #16a34a;
  --success-bg:    #dcfce7;
  --success-ink:   #14532d;
  --warn:          #d97706;
  --warn-bg:       #fef3c7;
  --warn-ink:      #78350f;
  --danger:        #dc2626;
  --danger-hover:  #b91c1c;
  --danger-bg:     #fee2e2;
  --danger-ink:    #7f1d1d;

  /* Surfaces */
  --bg:            #f4f7f7;
  --surface:       #ffffff;
  --surface-raised:#ffffff;
  --border:        #e3e8e9;
  --border-strong: #cdd6d7;

  /* Text */
  --text:          #111827;
  --text-muted:    #6b7280;
  --text-xmuted:   #9ca3af;

  /* Spacing scale: 4 8 12 16 24 32 48 */

  /* Components */
  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     14px;
  --shadow-sm:     0 1px 2px rgba(15,20,30,0.05);
  --shadow:        0 1px 3px rgba(15,20,30,0.06), 0 4px 16px rgba(15,20,30,0.07);
  --shadow-lg:     0 8px 30px rgba(15,20,30,0.15);
  --transition:    0.15s ease;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; letter-spacing: -0.01em; margin: 0 0 8px; }
h2 { font-size: 16px; letter-spacing: -0.01em; margin: 0 0 12px; font-weight: 700; }
h3 { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin: 16px 0 8px; }

/* ── Layout ─────────────────────────────────────────────── */
.shell { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.01em;
  flex-shrink: 0;
  margin-right: 4px;
}
.topbar .brand small { color: var(--text-muted); font-weight: 700; }
.topbar .brand-dot {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--brand-hover), var(--brand));
  color: #fff;
  border-radius: 7px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 11px; letter-spacing: 0.5px;
}
.topbar nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}
.topbar nav button {
  background: transparent;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  position: relative;
  transition: background var(--transition), color var(--transition);
}
.topbar nav button:hover { background: var(--bg); color: var(--text); }
.topbar nav button.active {
  background: var(--brand);
  color: var(--brand-ink);
}
/* Avatar dropdown trigger */
.topbar-user {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}
.topbar-avatar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  background: transparent;
  transition: background var(--transition), border-color var(--transition);
}
.topbar-avatar:hover {
  background: var(--bg);
  border-color: var(--border);
}
.topbar-avatar .avatar-initials {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.topbar-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  padding: 6px;
  z-index: 200;
}
.topbar-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  transition: background var(--transition);
}
.topbar-dropdown button:hover { background: var(--bg); }
.topbar-dropdown .drop-divider { height: 1px; background: var(--border); margin: 6px 0; }
.topbar-dropdown .drop-danger { color: var(--danger); }

main { padding: 20px; max-width: 1200px; margin: 0 auto; width: 100%; }
@media (max-width: 720px) { main { padding: 12px; } }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card h2 { margin-top: 0; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .grid.two { grid-template-columns: 1fr; } }

/* ── Balance tiles ──────────────────────────────────────── */
.balance-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .balance-tiles { grid-template-columns: 1fr; } }
.tile {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: #fafbfd;
  transition: border-color var(--transition);
}
.tile:hover { border-color: var(--border-strong); }
.tile .t-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tile .t-big {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 6px 0 4px;
  color: var(--text);
  line-height: 1;
}
.tile .t-big.t-low { color: var(--warn); }
.tile .t-big.t-critical { color: var(--danger); }
.tile .t-sub {
  font-size: 12px;
  color: var(--text-muted);
}
.tile .t-committed {
  font-size: 12px;
  color: var(--warn);
  margin-top: 4px;
  font-weight: 500;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { background: var(--bg); border-color: var(--border-strong); text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* Sizes */
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.lg { padding: 10px 18px; font-size: 14px; }

/* Variants */
.btn.primary { background: var(--brand); border-color: var(--brand-hover); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.accent { background: var(--accent); border-color: var(--accent-hover); color: #fff; }
.btn.accent:hover { background: var(--accent-hover); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.success:hover { filter: brightness(0.92); }
.btn.danger { background: var(--danger); border-color: var(--danger-hover); color: #fff; }
.btn.danger:hover { background: var(--danger-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn.ghost:hover { background: var(--bg); border-color: var(--border); color: var(--text); }

/* ── Form fields ─────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label, .field > .f-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.field input, .field select, .field textarea {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field textarea { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.field input.error, .field select.error { border-color: var(--danger); }
.field .f-error { font-size: 12px; color: var(--danger); margin-top: 2px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert.error   { background: var(--danger-bg); color: var(--danger-ink); border: 1px solid #fca5a5; }
.alert.success { background: var(--success-bg); color: var(--success-ink); border: 1px solid #86efac; }
.alert.warn    { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid #fcd34d; }
.alert.info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Toast ───────────────────────────────────────────────── */
.toast-wrap {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 0.2s ease;
  max-width: 320px;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.toast.success { background: var(--success); color: #fff; }
.toast.error   { background: var(--danger);  color: #fff; }
.toast.warn    { background: var(--warn);    color: #fff; }
@media (max-width: 640px) {
  .toast-wrap { bottom: 72px; left: 12px; right: 12px; }
}

/* ── OOO Banner ─────────────────────────────────────────── */
.ooo-banner {
  background: var(--warn-bg);
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  color: var(--warn-ink);
  font-size: 13px;
}
.ooo-banner .ooo-icon { font-size: 20px; }

/* ── Impersonation banner ───────────────────────────────── */
.impersonation-banner {
  background: var(--warn-bg);
  border: 2px solid #f5b400;
  border-radius: var(--radius);
  padding: 10px 16px;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
  color: var(--warn-ink);
  font-size: 13px;
  transition: background var(--transition);
}
.impersonation-banner:hover { background: #fde68a; }

/* ── Requests list ───────────────────────────────────────── */
.list { display: flex; flex-direction: column; gap: 8px; }
.req {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.req:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.req .req-body { flex: 1; min-width: 0; }
.req .req-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; align-items: center; }
.req .who { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.req .meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.req .req-type { font-size: 13px; font-weight: 500; }
.req .req-dates { font-size: 12px; color: var(--text-muted); }

/* ── Conflict warning on pending request ─────────────────── */
.conflict-warn {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  color: #9a3412;
  margin-top: 6px;
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge.pending    { background: var(--warn-bg);    color: var(--warn-ink); }
.badge.approved   { background: var(--success-bg); color: var(--success-ink); }
.badge.declined   { background: var(--danger-bg);  color: var(--danger-ink); }
.badge.cancelled  { background: #f3f4f6;           color: var(--text-muted); }
.badge.AU-QLD, .badge.AU-NSW { background: #dbeafe; color: #1e40af; }
.badge.PH { background: #dcfce7; color: #14532d; }
.badge.SL { background: #ede9fe; color: #4c1d95; }

/* ── Tables ──────────────────────────────────────────────── */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  background: #f8f9fb;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 52px; /* below topbar */
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tbody tr:hover td { background: #f8f9fb; }
table.tbl tbody tr:last-child td { border-bottom: none; }

/* ── Empty states ────────────────────────────────────────── */
.empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.empty .empty-icon { font-size: 32px; opacity: 0.6; }
.empty .empty-title { font-weight: 600; color: var(--text); font-size: 14px; }
.empty .empty-sub { font-size: 13px; }
.muted { color: var(--text-muted); font-size: 13px; }

/* ── Skeleton loader ─────────────────────────────────────── */
@keyframes skeleton-wave {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skel {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, #edf0f5 25%, #e2e6ee 50%, #edf0f5 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.4s ease infinite;
}
.skel-tile { height: 80px; border-radius: var(--radius); }
.skel-row  { height: 48px; margin-bottom: 8px; }
.skel-sm   { height: 20px; width: 60%; }

/* ── Calendar ────────────────────────────────────────────── */
.cal-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
.calendar {
  display: grid;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 700px;
}
.cal-row { display: grid; grid-template-columns: 140px repeat(31, 1fr); gap: 1px; background: var(--border); }
.cal-row.head .cell {
  background: #f5f6fa;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  padding: 5px 0;
  color: var(--text-muted);
}
.cal-row .cal-name {
  background: #fafbfd;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  border-right: 1px solid var(--border);
}
.cal-row .cell { background: #fff; min-height: 28px; position: relative; }
.cal-row .cell.we { background: repeating-linear-gradient(45deg, #e6eaee 0 4px, #eef1f4 4px 8px); }
.cal-row.head .cell.we { background: #e6eaee; }
.cal-row .cell.today { box-shadow: inset 0 0 0 2px var(--brand); }

/* v2: pending stripe overlay (yellow diagonal) so pending cells are obvious without colour */
.cal-row .cell.is-pending::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 206, 61, 0.35) 0,
    rgba(255, 206, 61, 0.35) 3px,
    transparent 3px,
    transparent 6px
  );
  pointer-events: none;
}

/* v2: Colourblind-safe leave palette (Okabe-Ito-inspired).
   AL=blue, Sick=orange, PH=purple, Pending=yellow stripe, Weekend=teal, Unpaid=grey.
   Symbols (.cell-symbol) overlay so cells are readable without colour. */
.cal-row .cell.standard       { background: #cfe2ff; } /* AL - blue */
.cal-row .cell.sick           { background: #ffd9b3; } /* sick - orange */
.cal-row .cell.phw            { background: #ddd1ff; } /* PH worked - purple */
.cal-row .cell.weekend_worked { background: #b8e7e5; } /* weekend - teal */
.cal-row .cell.unpaid_leave   { background: #e2e2e2; } /* unpaid - grey */
.cal-row .cell.other          { background: #e8e8e8; }
.cal-row .cell.public_holiday_taken { background: #ece4fb; } /* PH taken - light purple (distinct from worked) */
.cal-row .cell.away           { background: #d4dae2; } /* "Away" - neutral slate (masked protected-user leave) */

/* Public holiday tint (one colour now, country distinguished by user row) */
.cal-row .cell.ph-cell { background: #ece1ff; } /* fallback */
.cal-row .cell.ph-AU { background: #d4f0dd; } /* AU public holiday - green */
.cal-row .cell.ph-PH { background: #fbeec2; } /* PH public holiday - amber */
.cal-row .cell.ph-LK { background: #f6d9e6; } /* LK (Sri Lanka) public holiday - pink */

/* Symbol overlay rendered alongside the colour so the calendar reads without colour */
.cell-symbol {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.55);
  pointer-events: none;
  line-height: 1;
}

/* Status overlay badge in calendar cell */
.cell-badge {
  position: absolute;
  bottom: 1px;
  right: 1px;
  font-size: 8px;
  line-height: 1;
  opacity: 0.7;
}
.cell-birthday { position: absolute; top: 0; left: 0; font-size: 9px; line-height: 1; }
.cal-row .cell[title] { cursor: help; }

/* Pending cells get a dashed border overlay */
.cal-row .cell.is-pending { outline: 2px dashed rgba(0,0,0,0.25); outline-offset: -2px; }

/* ── Calendar legend ─────────────────────────────────────── */
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--text-muted); margin-bottom: 8px; align-items: center; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: middle; border: 1px solid rgba(0,0,0,0.08); }
.legend .sw.std, .legend .sw.standard { background: #cfe2ff; }
.legend .sw.sick   { background: #ffd9b3; }
.legend .sw.public_holiday_taken { background: #ece4fb; }
.legend .sw.phw    { background: #ddd1ff; }
.legend .sw.weekend_worked { background: #b8e7e5; }
.legend .sw.unpaid_leave, .legend .sw.other { background: #e2e2e2; }
.legend .sw.ph-cell { background: #ece1ff; }
.legend .sw.ph-AU { background: #d4f0dd; }
.legend .sw.ph-PH { background: #fbeec2; }
.legend .sw.ph-LK { background: #f6d9e6; }
.legend .sw.sw-sym { font-size: 11px; font-weight: 700; color: rgba(0,0,0,0.65); display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; }
.legend-item { display: inline-flex; align-items: center; gap: 4px; }

/* ── Calendar name cell ──────────────────────────────────── */
.cal-name-cell { display: flex; align-items: center; gap: 6px; }
.cal-name-cell .name-text { overflow: hidden; }
.cal-name-cell .name-text .n-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.cal-name-cell .name-text .n-country { font-size: 10px; color: var(--text-muted); }

/* ── Filter chips ────────────────────────────────────────── */
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Month select ────────────────────────────────────────── */
.month-select { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.month-select select { height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; font-size: 13px; cursor: pointer; }
.month-select select:focus { outline: none; border-color: var(--accent); }

/* ── Modals ──────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: backdrop-in 0.15s ease;
}
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.18s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal h2 { margin: 0 0 20px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── Compensation grid inside modals ─────────────────────── */
.comp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-bottom: 12px;
}
@media (max-width: 640px) { .comp-grid { grid-template-columns: 1fr; } }
.comp-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.comp-field.full { grid-column: 1 / -1; }
.comp-field span { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.comp-field input, .comp-field select, .comp-field textarea {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.comp-field input:focus, .comp-field select:focus, .comp-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.comp-field textarea { height: auto; min-height: 70px; padding: 8px 10px; resize: vertical; }
.comp-check { flex-direction: row; align-items: center; gap: 8px; }
.comp-check input { margin: 0; width: 16px; height: 16px; }

/* ── Compensation display table ──────────────────────────── */
.comp-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.comp-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 13px; }
.comp-table tr:last-child td { border-bottom: none; }
.comp-table .comp-label { color: var(--text-muted); width: 48%; font-weight: 500; }
.comp-table .comp-value { color: var(--text); font-weight: 600; }
.comp-table .comp-value .small { font-weight: 400; color: var(--text-muted); }
.comp-other { margin: 4px 0 0 18px; padding: 0; }
.comp-other li { color: var(--text-muted); font-size: 12px; margin-bottom: 2px; }

/* ── Profile meta table ──────────────────────────────────── */
.profile-meta { width: 100%; max-width: 520px; margin-top: 12px; border-collapse: collapse; }
.profile-meta td { padding: 6px 12px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 13px; }
.profile-meta tr:last-child td { border-bottom: none; }
.profile-meta td:first-child { width: 150px; color: var(--text-muted); font-weight: 500; }
.profile-meta td:last-child { font-weight: 600; }

/* ── Audit trail ─────────────────────────────────────────── */
.audit-row { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.audit-row:last-child { border-bottom: none; }

/* ── Recent activity timeline ────────────────────────────── */
.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  align-items: flex-start;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
  flex-shrink: 0;
  margin-top: 5px;
}
.activity-dot.approved { background: var(--success); }
.activity-dot.declined { background: var(--danger); }
.activity-dot.pending  { background: var(--warn); }
.activity-dot.other    { background: var(--accent); }

/* ── Login ───────────────────────────────────────────────── */
.login-wrap { max-width: 400px; margin: 80px auto; padding: 0 16px; }
.login-wrap h1 { font-size: 24px; }

/* ── Preflight balance check ─────────────────────────────── */
.preflight-msg {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin: 6px 0;
}
.preflight-msg.info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.preflight-msg.warn { background: var(--warn-bg); border: 1px solid #fcd34d; color: var(--warn-ink); font-weight: 500; }

/* ── Report / payroll recap ──────────────────────────────── */
.recap-md {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: "SF Mono", "Fira Code", ui-monospace, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 500px;
}

/* ── Contract expiry tile ────────────────────────────────── */
.contract-warning {
  background: var(--warn-bg);
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-top: 0;
}
.contract-warning h3 { margin: 0 0 8px; color: var(--warn-ink); }

/* ── Avatars ─────────────────────────────────────────────── */
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; vertical-align: middle; flex-shrink: 0; background: #e9ecef; border: 1px solid rgba(0,0,0,0.06); }
.avatar-md { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: #e9ecef; border: 1px solid rgba(0,0,0,0.06); }
.avatar-lg { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: #e9ecef; border: 1px solid rgba(0,0,0,0.06); }

/* ── Half-day checkbox in request form ───────────────────── */
.half-day-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
}
.half-day-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 500; }
.half-day-row input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }

/* ── Year-end countdown strip ────────────────────────────── */
.year-end-strip {
  background: linear-gradient(90deg, #fef9ee 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--warn-ink);
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── NES notice ──────────────────────────────────────────── */
.nes-notice {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: #1e40af;
  margin-top: 12px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

/* ── Upcoming committed ──────────────────────────────────── */
.committed-strip {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  color: #9a3412;
  margin-top: 10px;
}

/* ── Mobile bottom tab bar ───────────────────────────────── */
@media (max-width: 640px) {
  .topbar nav { display: none; }
  .mobile-tabs {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .mobile-tabs button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px;
    background: none;
    border: none;
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
  }
  .mobile-tabs button.active { color: var(--accent); }
  .mobile-tabs button .tab-icon { font-size: 18px; }
  main { padding-bottom: 80px; }
}
@media (min-width: 641px) {
  .mobile-tabs { display: none; }
}

/* ── Loading state ───────────────────────────────────────── */
.loading { padding: 60px 20px; text-align: center; color: var(--text-muted); font-size: 14px; }

/* ── Misc helpers ────────────────────────────────────────── */
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }

/* v2: Next accrual strip + address modal + colourblind helpers */
.next-accrual {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #1e3a8a;
  padding: 8px 12px;
  border-radius: var(--radius);
  margin-top: 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: modal-fade-in 0.18s ease-out;
}
.modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-scale-in 0.18s ease-out;
}
@keyframes modal-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-scale-in { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ── Inline SVG icons (replace emoji) ─────────────────────────────────── */
.i-svg { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.i-svg svg { width: 1em; height: 1em; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.15em; }
.topbar nav button { display: inline-flex; align-items: center; gap: 7px; }
.topbar nav button .i-svg svg { width: 15px; height: 15px; }
.mobile-tabs .tab-icon .i-svg svg { width: 20px; height: 20px; }
.empty-icon .i-svg svg { width: 40px; height: 40px; stroke-width: 1.5; }
.ooo-icon .i-svg svg { width: 22px; height: 22px; }
.next-accrual .i-svg svg, .year-end-strip .i-svg svg, .nes-notice .i-svg svg { width: 16px; height: 16px; }
.cell-birthday .i-svg svg { width: 13px; height: 13px; }
.legend .i-svg svg { width: 14px; height: 14px; }
.btn .i-svg svg { width: 15px; height: 15px; }
