/* WP Dots Attendance — Bai Jamjuree + 95% fluid layout + Light & Dark Mode */
:root {
  --font: 'Bai Jamjuree', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg: #f4f5fb;
  --card: #ffffff;
  --surface-2: #f8f9fd;
  --surface-hover: #eef1f9;
  --topbar-bg: rgba(255, 255, 255, .92);
  --input-bg: #ffffff;
  --ink: #1e2235;
  --muted: #646d82;
  --line: #e4e7f1;
  --line-strong: #cbd5e1;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-soft: #eef2ff;
  --brand-border: #c7d2fe;
  --green: #15803d;
  --green-bg: #dcfce7;
  --green-border: #86efac;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --amber-border: #fde68a;
  --grace-text: #854d0e;
  --grace-bg: #fef9c3;
  --grace-border: #fde047;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --red-border: #fecaca;
  --blue: #1d4ed8;
  --blue-bg: #dbeafe;
  --blue-border: #bfdbfe;
  --teal: #0f766e;
  --teal-bg: #ccfbf1;
  --teal-border: #99f6e4;
  --purple: #6d28d9;
  --purple-bg: #ede9fe;
  --purple-border: #ddd6fe;
  --gray-bg: #e5e7eb;
  --absent-text: #4b5563;
  --off-bg: #fafbfe;
  --off-text: #9ca3af;
  --row-late-bg: #fffaf5;
  --row-late-hover: #ffedd5;
  --toast-bg: #1e2235;
  --toast-ink: #ffffff;
  --github-bg: #24292f;
  --github-hover: #1b1f24;
  --github-ink: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 14px 36px rgba(16, 24, 40, .14);
}

[data-theme="dark"] {
  --bg: #0b101b;
  --card: #131b2e;
  --surface-2: #19233a;
  --surface-hover: #212e4a;
  --topbar-bg: rgba(19, 27, 46, .92);
  --input-bg: #0f1626;
  --ink: #f1f5f9;
  --muted: #94a3b8;
  --line: #24314d;
  --line-strong: #37496d;
  --brand: #6366f1;
  --brand-dark: #4f46e5;
  --brand-soft: rgba(99, 102, 241, .16);
  --brand-border: rgba(129, 140, 248, .38);
  --green: #4ade80;
  --green-bg: rgba(34, 197, 94, .16);
  --green-border: rgba(74, 222, 128, .35);
  --amber: #fbbf24;
  --amber-bg: rgba(245, 158, 11, .16);
  --amber-border: rgba(251, 191, 36, .35);
  --grace-text: #fde047;
  --grace-bg: rgba(234, 179, 8, .16);
  --grace-border: rgba(250, 204, 21, .35);
  --red: #f87171;
  --red-bg: rgba(239, 68, 68, .16);
  --red-border: rgba(248, 113, 113, .35);
  --blue: #60a5fa;
  --blue-bg: rgba(59, 130, 246, .16);
  --blue-border: rgba(96, 165, 250, .35);
  --teal: #2dd4bf;
  --teal-bg: rgba(20, 184, 166, .16);
  --teal-border: rgba(45, 212, 191, .35);
  --purple: #c084fc;
  --purple-bg: rgba(168, 85, 247, .16);
  --purple-border: rgba(192, 132, 252, .35);
  --gray-bg: #1e293b;
  --absent-text: #cbd5e1;
  --off-bg: #101726;
  --off-text: #64748b;
  --row-late-bg: rgba(245, 158, 11, .07);
  --row-late-hover: rgba(245, 158, 11, .14);
  --toast-bg: #f8fafc;
  --toast-ink: #0f172a;
  --github-bg: #f8fafc;
  --github-hover: #e2e8f0;
  --github-ink: #0f172a;
  --shadow: 0 2px 8px rgba(0, 0, 0, .32);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; font-family: var(--font); }
html, body { margin: 0; padding: 0; font-family: var(--font); }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .18s ease, color .18s ease;
}
h1 { font-size: 27px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
h3 { font-size: 15px; font-weight: 700; margin: 0; }
code, pre { font-family: var(--font); font-weight: 600; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.hint.center { text-align: center; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 95% screen width everywhere */
.container {
  width: 95%;
  max-width: 95%;
  margin: 0 auto;
  padding: 24px 0 64px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font); font-weight: 600; font-size: 14px;
  border: 1px solid transparent; border-radius: 10px;
  padding: 9px 16px; cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .05s;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); color: #fff; }
.btn-checkin {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(22, 163, 74, .28);
}
.btn-checkin:hover:not(:disabled) { background: linear-gradient(135deg, #15803d 0%, #166534 100%); color: #fff; }
.btn-checkout {
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(234, 88, 12, .25);
}
.btn-checkout:hover:not(:disabled) { background: linear-gradient(135deg, #c2410c 0%, #9a3412 100%); color: #fff; }
.btn-github {
  background: var(--github-bg); color: var(--github-ink); padding: 13px 18px; font-size: 15px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .16);
}
.btn-github:hover:not(.disabled) { background: var(--github-hover); color: var(--github-ink); }
.btn-outline { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); background: var(--surface-2); }
.btn-soft { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-border); }
.btn-soft:hover { background: var(--surface-hover); }
.btn-success-soft { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.btn-success-soft:hover { filter: brightness(0.97); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--gray-bg); color: var(--ink); }
.btn-danger { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
.btn-danger:hover { filter: brightness(0.95); }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 7px; }
.btn-lg { padding: 13px 26px; font-size: 16px; }
.btn-xl { padding: 15px 34px; font-size: 17px; border-radius: 12px; }

/* Theme toggle icon button (top right) */
.theme-toggle {
  width: 38px; height: 38px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
  cursor: pointer; transition: border-color .15s, background .15s, color .15s, transform .08s;
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--brand); color: var(--brand); background: var(--surface-2); }
.theme-toggle:active { transform: scale(.96); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }

/* ---------- Plain Login Screen ---------- */
.login-screen {
  min-height: 100vh; display: flex; flex-direction: column;
  background:
    radial-gradient(900px 500px at 15% -10%, var(--brand-soft) 0%, transparent 60%),
    radial-gradient(800px 450px at 90% 105%, var(--purple-bg) 0%, transparent 55%),
    var(--bg);
}
.login-topbar {
  width: 95%; max-width: 95%; margin: 0 auto;
  padding: 18px 0;
  display: flex; align-items: center; justify-content: flex-end;
}
.login-center {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 16px 2.5% 56px;
}
.login-plain-card {
  width: 100%; max-width: 440px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 38px 34px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-plain-logo {
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.login-plain-card h1 { font-size: 26px; margin: 0 0 6px; }
.login-plain-sub { color: var(--muted); font-size: 14px; margin: 0 0 26px; }
.login-plain-foot {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px;
}

.field-label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 6px; text-align: left; }
input, select, textarea {
  width: 100%; font-family: var(--font); font-size: 14px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; background: var(--input-bg); color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .18);
}
.form-error {
  background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border);
  border-radius: 10px; padding: 11px 13px; font-size: 13px; margin: 12px 0; text-align: left;
}
.setup-callout {
  background: var(--amber-bg); border: 1px solid var(--amber-border); color: var(--amber);
  border-radius: 12px; padding: 14px 15px; font-size: 13px; margin: 14px 0; text-align: left;
}
.setup-callout code {
  background: rgba(0, 0, 0, .08); padding: 1px 6px; border-radius: 4px; font-size: 12px;
}
.copy-box {
  display: flex; align-items: center; gap: 6px; margin-top: 8px;
  background: var(--card); border: 1px solid var(--amber-border); border-radius: 8px; padding: 6px 8px;
}
.copy-box code { flex: 1; background: transparent; overflow-x: auto; white-space: nowrap; color: var(--ink); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 20px 0 14px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.demo-grid { display: grid; gap: 10px; margin: 18px 0; }
.demo-user {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; cursor: pointer; font-family: var(--font); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.demo-user:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.demo-user-meta { flex: 1; display: flex; flex-direction: column; }
.demo-user-meta small { color: var(--muted); }

/* ---------- topbar (aligned to 95% width via 2.5% side padding) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--topbar-bg); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); padding: 12px 2.5%;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-title { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub { font-size: 12px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.clock-box { text-align: right; margin-right: 4px; }
.clock-time { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.clock-date { font-size: 11px; color: var(--muted); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-chip-meta small { color: var(--muted); font-size: 12px; }
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 14px;
}
.brand-mark.small svg { display: block; }

/* ---------- cards & layout ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; margin-bottom: 20px;
}
.card-title { margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head .card-title { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 .card, .grid-3 .card { margin-bottom: 20px; }

/* ---------- Check-in / Check-out & Daily Note ---------- */
.checkin-card { text-align: center; }
.checkin-card.slim { text-align: left; }
.checkin-card .row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.checkin-pending { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.checkin-pending.row {
  flex-direction: row; align-items: center; justify-content: space-between;
  text-align: left; gap: 16px; flex-wrap: wrap;
}
.checkin-pending.row .btn { flex-shrink: 0; }
.clock-big { font-size: 50px; font-weight: 700; letter-spacing: -1px; font-variant-numeric: tabular-nums; margin: 6px 0; }
.big-check {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; margin-bottom: 10px; flex-shrink: 0;
}
.big-check.small { width: 46px; height: 46px; font-size: 22px; margin: 0; }
.big-check.done-out { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-border); }
.checkin-done.row { display: flex; align-items: center; gap: 16px; text-align: left; }
.checkin-hero-actions { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.shift-strip {
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  margin-top: 14px;
}
.shift-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 6px 13px; border-radius: 99px; font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.shift-chip.live {
  background: var(--green-bg); color: var(--green); border-color: var(--green-border);
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: currentColor;
  display: inline-block; animation: pulseAnim 1.4s infinite ease-in-out;
}
@keyframes pulseAnim {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.82); }
}

.daily-note-panel {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
  text-align: left;
}
.daily-note-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px;
}
.daily-note-head strong { font-size: 13px; color: var(--ink); }
.daily-note-row { display: flex; gap: 8px; align-items: stretch; }
.daily-note-row input { flex: 1; }

.late-note { color: var(--red); font-weight: 600; margin-top: 10px; }
.rules-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: left;
}
.rules-box ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rules-box li { display: flex; align-items: flex-start; gap: 2px; font-size: 13.5px; line-height: 1.5; color: var(--ink); }
.rules-box .dot { margin-top: 6px; flex-shrink: 0; }
.holiday-banner {
  background: var(--purple-bg); color: var(--purple); border: 1px solid var(--purple-border);
  border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-weight: 600;
  display: flex; align-items: center; gap: 10px;
}

/* ---------- stats & KPIs ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-grid.three { grid-template-columns: repeat(3, 1fr); }
.stat-grid.wide { grid-template-columns: repeat(6, 1fr); }
.stat-grid.payroll-kpis { grid-template-columns: repeat(5, 1fr); margin-bottom: 20px; }
.stat {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; text-align: center;
}
.stat.highlight { background: var(--brand-soft); border-color: var(--brand-border); }
.stat-num { display: block; font-size: 25px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-num.sm { font-size: 20px; }
.stat-num.green { color: var(--green); }
.stat-num.amber { color: var(--amber); }
.stat-num.red { color: var(--red); }
.stat-num.blue { color: var(--blue); }
.stat-num.teal { color: var(--teal); }
.stat-num.brand { color: var(--brand); }
.stat-num.gray { color: var(--muted); }
.stat-label { font-size: 12px; color: var(--muted); display: block; margin-top: 2px; }
.progress-wrap { margin: 6px 0 14px; }
.progress-bar { height: 8px; background: var(--gray-bg); border-radius: 99px; overflow: hidden; margin-bottom: 6px; }
.progress-fill { height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.dot-green { background: var(--green); } .dot-amber { background: var(--amber); }
.dot-red { background: var(--red); } .dot-blue { background: var(--blue); }
.dot-teal { background: var(--teal); } .dot-purple { background: var(--purple); }
.dot-gray { background: #9ca3af; }

/* ---------- pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap;
}
.st-present { background: var(--green-bg); color: var(--green); }
.st-wfh { background: var(--teal-bg); color: var(--teal); }
.st-grace { background: var(--grace-bg); color: var(--grace-text); }
.st-half { background: var(--amber-bg); color: var(--amber); }
.st-full { background: var(--red-bg); color: var(--red); }
.st-leave { background: var(--blue-bg); color: var(--blue); }
.st-holiday { background: var(--purple-bg); color: var(--purple); }
.st-absent { background: var(--gray-bg); color: var(--absent-text); }
.st-off { background: var(--off-bg); color: var(--off-text); }
.st-brand { background: var(--brand-soft); color: var(--brand); }

/* ---------- calendar ---------- */
.month-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-head { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; text-transform: uppercase; }
.cal-cell {
  min-height: 42px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 13px; border-radius: 8px; background: var(--card); border: 1px solid var(--line);
  font-variant-numeric: tabular-nums; position: relative;
  font-family: inherit; color: inherit; padding: 0; width: 100%; cursor: pointer;
  transition: transform .08s, border-color .15s, box-shadow .15s;
}
button.cal-cell:hover, button.cal-cell:focus-visible { border-color: var(--brand); transform: translateY(-1px); box-shadow: 0 2px 10px rgba(79,70,229,.15); }
.cal-cell.clickable { cursor: pointer; transition: transform .08s, border-color .15s; }
.cal-cell.clickable:hover { border-color: var(--brand); transform: translateY(-1px); }
.cal-cell .cal-note-dot {
  width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .75; margin-top: 2px;
}
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-present { background: var(--green-bg); color: var(--green); border-color: var(--green-border); font-weight: 700; }
.cal-wfh { background: var(--teal-bg); color: var(--teal); border-color: var(--teal-border); font-weight: 700; }
.cal-grace { background: var(--grace-bg); color: var(--grace-text); border-color: var(--grace-border); font-weight: 700; }
.cal-half { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-border); font-weight: 700; }
.cal-full { background: var(--red-bg); color: var(--red); border-color: var(--red-border); font-weight: 700; }
.cal-leave { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-border); font-weight: 700; }
.cal-holiday { background: var(--purple-bg); color: var(--purple); border-color: var(--purple-border); font-weight: 700; }
.cal-absent { background: var(--gray-bg); color: var(--absent-text); border-color: transparent; }
.cal-off { color: var(--off-text); background: var(--off-bg); border-color: transparent; }
.cal-today { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(99, 102, 241, .3); font-weight: 700; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--line); white-space: nowrap;
}
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr.row-late { background: var(--row-late-bg); }
.table tr.row-late:hover { background: var(--row-late-hover); }
.table tfoot td { border-top: 2px solid var(--line); font-weight: 700; background: var(--surface-2); }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user small { display: block; color: var(--muted); font-size: 12px; }
.num-amber { color: var(--amber); font-weight: 600; }
.num-red { color: var(--red); font-weight: 600; }
.num-green { color: var(--green); font-weight: 700; }
.salary-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 8px;
  padding: 4px 10px; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer;
}
.salary-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.salary-btn.unset { color: var(--brand); border-color: var(--brand-border); background: var(--brand-soft); }
.mini-progress { display: inline-block; width: 70px; height: 6px; background: var(--gray-bg); border-radius: 99px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.mini-progress > div { height: 100%; background: var(--brand); }

.note-stack { display: flex; flex-direction: column; gap: 3px; max-width: 340px; }
.note-emp { font-size: 13px; color: var(--ink); }
.note-adm { font-size: 12px; color: var(--brand); font-weight: 500; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 8px; margin: 4px 0 18px; flex-wrap: wrap; }
.tab {
  font-family: var(--font); font-weight: 600; font-size: 14px;
  background: var(--card); border: 1px solid var(--line); color: var(--muted);
  padding: 9px 18px; border-radius: 99px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: border-color .15s, color .15s, background .15s;
}
.tab:hover { border-color: var(--brand); color: var(--brand); }
.tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tab-count {
  font-size: 11px; padding: 1px 7px; border-radius: 99px;
  background: var(--surface-2); color: var(--ink); font-weight: 700;
}
.tab.active .tab-count { background: rgba(255, 255, 255, .22); color: #fff; }

/* ---------- Tasks & Timers ---------- */
.task-composer {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; margin-bottom: 18px;
}
.task-composer-grid {
  display: grid; grid-template-columns: 2.2fr 1.1fr .9fr .9fr auto; gap: 10px; align-items: end;
}
.task-composer-notes { margin-top: 10px; }
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 16px;
}
.filter-bar > .filter-item { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.filter-bar > .filter-item.grow { flex: 1; min-width: 190px; }
.filter-bar label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.filter-bar input, .filter-bar select { padding: 7px 10px; font-size: 13px; }
@media (min-width: 1100px) {
  .filter-bar { flex-wrap: nowrap; }
  .filter-bar > .filter-item { min-width: 116px; }
  .filter-bar > .filter-item.grow { flex: 1 1 220px; }
}
.filter-bar select { padding-right: 30px; border-radius: 10px; }
.filter-bar input { border-radius: 10px; }

.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; transition: border-color .15s;
}
.task-item:hover { border-color: var(--line-strong); }
.task-item.running { border-color: var(--green-border); background: var(--card); box-shadow: 0 0 0 2px var(--green-bg); }
.task-item.done { opacity: .88; }
.task-main { flex: 1; min-width: 0; }
.task-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.task-title { font-weight: 700; font-size: 15px; color: var(--ink); }
.task-item.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-notes { font-size: 13px; color: var(--muted); margin: 4px 0 6px; white-space: pre-wrap; }
.task-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.task-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; flex-shrink: 0; }
.timer-readout {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px;
  padding: 4px 10px; border-radius: 99px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
  display: inline-flex; align-items: center; gap: 6px;
}
.timer-readout.active {
  background: var(--green-bg); border-color: var(--green-border); color: var(--green);
}
.prio-high { background: var(--red-bg); color: var(--red); }
.prio-normal { background: var(--brand-soft); color: var(--brand); }
.prio-low { background: var(--gray-bg); color: var(--muted); }

/* ---------- Policies Viewer & Builder ---------- */
.policy-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.policy-card {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 13px;
  padding: 16px 18px;
}
.policy-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.policy-card h3 { font-size: 15px; color: var(--ink); }
.policy-body { font-size: 13.5px; color: var(--muted); white-space: pre-line; line-height: 1.55; }
.policy-editor-list { display: flex; flex-direction: column; gap: 12px; margin: 12px 0; }
.policy-editor-item {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px;
}
.policy-editor-top {
  display: grid; grid-template-columns: 1.6fr 1fr auto; gap: 10px; align-items: end; margin-bottom: 10px;
}

/* ---------- forms & rule builder ---------- */
.inline-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)) auto; gap: 10px; margin-bottom: 16px; align-items: end; }
.settings-form .form-grid, .form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.settings-form .form-grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1180px) { .settings-form .form-grid { grid-template-columns: repeat(2, 1fr); } }
.check-row { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0 4px; }
.check { display: flex; align-items: center; gap: 7px; font-size: 14px; cursor: pointer; user-select: none; }
.check input { width: auto; accent-color: var(--brand); }
textarea { resize: vertical; }

.tier-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.tier-row {
  /* until · label · deduction · grace · colour · remove — six cells, one row.
     The ✕ sits in the last column so it never wraps under the colour picker. */
  display: grid;
  grid-template-columns: 140px minmax(0, 1.5fr) 118px 108px 126px 42px;
  gap: 10px; align-items: end;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.tier-row > div:last-child { justify-self: end; }
.tier-row [data-remove-tier] { width: 38px; height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.tier-row.fixed { background: var(--surface-2); grid-template-columns: 150px 1.4fr 150px 130px 42px; opacity: .94; }
.tier-row label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.tier-badge-preview {
  display: flex; align-items: center; height: 39px; font-weight: 700; font-size: 13px; color: var(--ink);
}
.holiday-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.holiday-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--purple-bg); color: var(--purple); border: 1px solid var(--purple-border);
  padding: 5px 12px; border-radius: 99px; font-size: 13px; font-weight: 600;
}
.holiday-chip button {
  border: none; background: transparent; color: var(--purple); cursor: pointer;
  font-weight: 700; font-size: 15px; padding: 0 2px; line-height: 1;
}

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(8, 12, 24, .62);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100;
}
.modal {
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 16px; padding: 24px; width: 100%; max-width: 520px;
  box-shadow: var(--shadow-lg); max-height: 92vh; overflow-y: auto;
}
.modal.wide { max-width: 640px; }
.modal.xl { max-width: 880px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { margin: 0; }
.modal h2 { margin-bottom: 14px; }
.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.modal-actions .spacer { flex: 1; }

/* ---------- day picker & projects ---------- */
.day-picker-card { padding-bottom: 16px; }
.daypick-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  max-width: 620px;
}
.daypick-head {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); text-align: center; padding-bottom: 4px;
}
.daypick {
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 10px;
  padding: 6px 4px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  cursor: pointer;
  font: inherit;
  transition: border-color .15s, background .15s, transform .1s;
}
.daypick:hover { border-color: var(--brand); background: var(--surface-hover); }
.daypick:active { transform: scale(.97); }
.daypick.empty { visibility: hidden; }
.daypick.weekend { opacity: .62; }
.daypick.holiday { background: var(--purple-bg); border-color: var(--purple-border); }
.daypick.has-attendance { border-color: var(--green-border); }
.daypick.today { box-shadow: 0 0 0 2px var(--brand-border); }
.daypick.selected { background: var(--brand); border-color: var(--brand); color: #fff; }
.daypick.selected .daypick-meta, .daypick.selected .daypick-num { color: #fff; }
.daypick-num { font-weight: 700; font-size: 14px; line-height: 1.1; }
.daypick-dots { display: flex; gap: 3px; height: 7px; align-items: center; }
.daypick-dots .dot { width: 5px; height: 5px; margin: 0; }
.daypick-meta { font-size: 9.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.color-dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}
.row-muted { opacity: .62; }
.user-link {
  background: none; border: none; padding: 0; margin: 0; font: inherit;
  color: var(--ink); cursor: pointer; text-align: left;
}
.user-link:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }

.date-link {
  background: none; border: none; padding: 0; margin: 0;
  color: var(--brand); font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px;
}
.date-link:hover { color: var(--brand-dark); }

.trend-bar-wrap {
  display: flex; align-items: center; gap: 8px;
  min-width: 140px;
}
.trend-bar-wrap .trend-bar {
  height: 8px; border-radius: 99px; background: var(--green);
  min-width: 3px; max-width: 110px;
}
.trend-bar-wrap span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row-selected { background: var(--brand-soft); }

.pay-state { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pay-state small { font-size: 11.5px; }

.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand-soft); color: var(--brand);
  border: 1px solid var(--brand-border);
  border-radius: 99px; padding: 5px 6px 5px 12px; font-size: 13px; font-weight: 600;
}
.cat-chip button {
  border: none; background: rgba(0, 0, 0, .08); color: inherit;
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
  font-size: 13px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.cat-chip button:hover { background: var(--red); color: #fff; }

/* ---------- toast ---------- */
#toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--toast-bg); color: var(--toast-ink); font-size: 14px; font-weight: 600;
  padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s;
  max-width: 390px;
}
.toast.show { opacity: 1; transform: none; }
.toast-warn { background: #d97706; color: #fff; }
.toast-error { background: #dc2626; color: #fff; }

/* ---------- loading ---------- */
.boot-loader {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-weight: 500;
}

/* ---------- themed scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong); border-radius: 99px;
  border: 2px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* ---------- rounded, themed dropdowns & inputs ---------- */
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 34px;
  border-radius: 12px;
  font-weight: 500;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7488' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 12px 12px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
select:hover { border-color: var(--line-strong); }
select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f46e5' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
select option { background: var(--card); color: var(--ink); }
input[type="date"] { border-radius: 12px; }
input:hover, textarea:hover { border-color: var(--line-strong); }

/* ---------- tables: compact, sortable, dual scrollbars ---------- */
.table { font-size: 13.5px; }
.table th { cursor: pointer; user-select: none; position: relative; padding: 9px 12px; }
.table th:hover { color: var(--ink); }
.table th[data-no-sort] { cursor: default; }
.table th[data-no-sort]:hover { color: var(--muted); }
.table th.sort-asc, .table th.sort-desc { color: var(--brand); }
.sort-ind { display: inline-block; margin-left: 6px; font-size: 9.5px; opacity: .4; vertical-align: middle; }
.table th.sort-asc .sort-ind, .table th.sort-desc .sort-ind { opacity: 1; }
.table td { padding: 9px 12px; }
.table tbody tr:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; overflow-y: hidden; scrollbar-gutter: stable; }
.table-scroll-top {
  overflow-x: auto; overflow-y: hidden; height: 0; opacity: 0;
  transition: opacity .15s; margin-bottom: 3px; border-radius: 99px;
}
.table-scroll-top.visible { height: 12px; opacity: 1; }
.table-scroll-top-inner { height: 1px; }
.table-scroll-top::-webkit-scrollbar { height: 9px; }
.table-scroll-top::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }
.table-scroll-top::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.nowrap { white-space: nowrap; }

/* drag columns / handles */
.drag-col { width: 30px; }
.drag-cell { width: 30px; padding-right: 0 !important; }
.drag-handle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 7px;
  color: var(--line-strong); cursor: grab; font-size: 15px; line-height: 1;
  transition: background .15s, color .15s;
}
.drag-handle:hover { background: var(--surface-hover); color: var(--brand); }
.drag-handle:active { cursor: grabbing; }
.drag-row.dragging, .dragging { opacity: .55; background: var(--brand-soft) !important; }
.drag-row.dragging td { background: var(--brand-soft) !important; }
.policy-editor-item { position: relative; }
.drag-handle-float { position: absolute; top: 10px; left: 8px; }
.policy-editor-item .policy-editor-top { padding-left: 20px; }

/* ---------- per-table search (centered above each table) ---------- */
.table-search-bar {
  display: flex; justify-content: center; align-items: center;
  padding: 0 0 10px; gap: 8px;
}
.table-search-bar.hidden { display: none; }
.search-box {
  position: relative; display: flex; align-items: center;
  width: 100%; max-width: 460px;
  background: var(--card); border: 1px solid var(--line); border-radius: 99px;
  padding: 0 10px 0 34px; transition: border-color .15s, box-shadow .15s;
}
.table-search-bar .search-box { max-width: 420px; }
.search-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.table-search-bar.no-match .search-box { border-color: var(--amber-border); }
.search-icon { position: absolute; left: 12px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search-box input {
  flex: 1; min-width: 0; width: auto;
  border: none; background: transparent; box-shadow: none !important;
  padding: 8px 4px; font-size: 13px; border-radius: 99px;
}
.search-box input:focus { outline: none; }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-clear {
  border: none; background: var(--surface-hover); color: var(--muted);
  width: 20px; height: 20px; border-radius: 50%; cursor: pointer;
  font-size: 11px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.search-clear:hover { background: var(--red); color: #fff; }
.search-empty td { color: var(--muted); font-style: italic; }
.list-search-empty { text-align: center; font-size: 13px; margin: 10px 0 0; }

/* ---------- themed dropdown (custom select) ---------- */
.cselect { position: relative; width: 100%; min-width: 0; }
.cselect-native {
  position: absolute !important; inset: 0; width: 100% !important; height: 100%;
  opacity: 0; pointer-events: none; margin: 0; padding: 0; border: 0;
}
.cselect-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-height: 40px;
  font-family: var(--font); font-size: 14px; font-weight: 500; text-align: left;
  background: var(--input-bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 12px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.cselect-btn:hover { border-color: var(--line-strong); }
.cselect-btn:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.cselect-btn.open { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.cselect-btn:disabled { opacity: .55; cursor: not-allowed; }
.cselect-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cselect-btn.placeholder .cselect-value { color: var(--muted); }
.cselect-caret { width: 13px; height: 13px; color: var(--muted); flex-shrink: 0; transition: transform .15s; }
.cselect-btn.open .cselect-caret { transform: rotate(180deg); color: var(--brand); }
.filter-bar .cselect-btn { min-height: 34px; padding: 6px 10px; font-size: 13px; border-radius: 10px; }
.btn-sm + .cselect, .inline-form .cselect { min-width: 0; }

.cs-pop {
  position: fixed; z-index: 130; padding: 6px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg);
  max-height: 288px; overflow-y: auto;
  animation: cs-in .12s ease-out;
  font-family: var(--font);
}
@keyframes cs-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.cs-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; cursor: pointer;
  font-family: var(--font); font-size: 13.5px; color: var(--ink);
  background: transparent; border: none; border-radius: 9px;
  padding: 9px 10px;
}
.cs-opt:hover, .cs-opt.selected { background: var(--brand-soft); color: var(--brand); }
.cs-opt.selected { font-weight: 600; }
.cs-opt.disabled { opacity: .45; cursor: not-allowed; }
.cs-opt span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-check { color: var(--brand); font-size: 12px; }

/* ---------- office network banner ---------- */
.network-banner {
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline;
  font-size: 13px; border-radius: 12px; padding: 10px 14px; margin-bottom: 14px;
  text-align: left;
}
.network-banner.ok { background: var(--green-bg); border: 1px solid var(--green-border); color: var(--green); }
.network-banner.locked { background: var(--amber-bg); border: 1px solid var(--amber-border); color: var(--amber); }
.network-banner code { font-size: 12px; background: rgba(0, 0, 0, .08); padding: 1px 6px; border-radius: 5px; }
.netlock-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.netlock-ip { font-size: 12.5px; color: var(--muted); }
.netlock-ip b { color: var(--ink); }

/* ---------- one-row day navigation ---------- */
.daynav { display: inline-flex; align-items: center; gap: 6px; }
.daynav .btn { border-radius: 99px; }
.daynav-mid {
  display: inline-flex; align-items: center; gap: 7px;
  min-width: 150px; justify-content: center; font-weight: 600;
  border-radius: 99px !important;
}
.daynav-mid svg { opacity: .8; }
.day-filter { display: flex; align-items: center; gap: 4px; }
.day-filter .btn { white-space: nowrap; border-radius: 99px; }
.day-filter .btn.has-value { background: var(--brand); color: #fff; border-color: var(--brand); }
.day-filter .btn svg { margin-right: 5px; }

/* ---------- themed date picker ---------- */
.date-field { position: relative; display: inline-flex; align-items: center; width: 100%; }
.date-field.open { z-index: 40; }
.date-field-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 9px; border: none;
  background: var(--brand-soft); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .15s, color .15s;
}
.date-field-btn:hover { background: var(--brand); color: #fff; }
.date-field input[type="date"] { padding-right: 44px; }
.date-field input[type="date"]::-webkit-calendar-picker-indicator { opacity: 0; cursor: pointer; }

.dp-popover {
  position: fixed; z-index: 320; width: 288px;
  /* Solid on purpose: a translucent calendar over busy tables read as broken. */
  background-color: var(--card);
  background-image: none;
  color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(8, 12, 24, .32), 0 2px 6px rgba(8, 12, 24, .14);
  padding: 14px;
  font-family: var(--font); animation: dp-in .14s ease-out;
  isolation: isolate;
}
[data-theme="dark"] .dp-popover { border-color: #2b3a5c; }
@keyframes dp-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.dp-month { font-size: 14px; font-weight: 700; }
.dp-nav {
  width: 28px; height: 28px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  font-size: 15px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.dp-nav:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.dp-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.dp-week span { text-align: center; font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--muted); padding: 3px 0; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-day {
  border: 1px solid transparent; background: transparent; color: var(--ink);
  border-radius: 9px; height: 32px; cursor: pointer;
  font-family: var(--font); font-size: 13px; font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s, border-color .12s;
}
.dp-day:hover { background: var(--brand-soft); color: var(--brand); }
.dp-day.empty { cursor: default; }
.dp-day.today { border-color: var(--brand-border); font-weight: 700; color: var(--brand); }
.dp-day.selected { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.dp-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
}
.dp-foot .btn { border-radius: 9px; }

/* ---------- themed confirm dialog ---------- */
.confirm-modal { max-width: 430px; text-align: left; }
.confirm-icon {
  width: 44px; height: 44px; border-radius: 14px; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700;
  background: var(--brand-soft); color: var(--brand); border: 1px solid var(--brand-border);
}
.confirm-icon.danger { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
.confirm-text { font-size: 14px; color: var(--muted); line-height: 1.5; margin: 6px 0 18px; }
.modal .confirm-modal h2, .confirm-modal h2 { font-size: 19px; margin: 0; }
.btn-danger-solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger-solid:hover:not(:disabled) { filter: brightness(.92); color: #fff; }

/* ---------- admins & access ---------- */
.admin-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 99px; padding: 5px 8px 5px 6px; font-size: 13px;
}
.admin-chip.super { background: var(--brand-soft); border-color: var(--brand-border); color: var(--brand); }
.admin-chip b { font-weight: 600; }
.avatar-xs {
  width: 22px; height: 22px; border-radius: 50%; background: var(--brand);
  color: #fff; font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.admin-tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: var(--brand); color: #fff; border-radius: 99px; padding: 2px 7px;
}
.admin-remove {
  border: none; background: var(--gray-bg); color: var(--muted);
  width: 19px; height: 19px; border-radius: 50%; cursor: pointer; font-size: 10px;
  display: inline-flex; align-items: center; justify-content: center;
}
.admin-remove:hover { background: var(--red); color: #fff; }
.field-block { margin-top: 14px; }
.card-head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- audit log ---------- */
.audit-table td { font-size: 13px; }
.audit-table .pill { font-size: 11.5px; }

/* ---------- tighter vertical rhythm ---------- */
.card { padding: 18px 20px; margin-bottom: 16px; }
.card-title { margin-bottom: 12px; }
.card-head { margin-bottom: 12px; }
.stat-grid { gap: 10px; margin-bottom: 14px; }
.stat { padding: 11px 14px; }
.stat-num { font-size: 23px; }
.tabs { margin: 2px 0 14px; }
.tab { padding: 8px 16px; }
.task-item { padding: 12px 14px; }
.filter-bar { padding: 10px 12px; margin-bottom: 14px; }
.page-head { margin-bottom: 14px; }
.policy-editor-list { gap: 10px; }

@media (max-width: 860px) {
  .search-box { max-width: none; }
  .daynav-mid { min-width: 0; }
  .daynav-mid span { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dp-popover { width: 262px; }
}

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .stat-grid.wide { grid-template-columns: repeat(3, 1fr); }
  .stat-grid.payroll-kpis { grid-template-columns: repeat(2, 1fr); }
  .tier-row, .tier-row.fixed { grid-template-columns: 1fr 1fr; }
  .tier-row > div:last-child { grid-column: 2; justify-self: end; }
  .task-composer-grid { grid-template-columns: 1fr 1fr; }
  .policy-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stat-grid, .stat-grid.wide, .stat-grid.payroll-kpis { grid-template-columns: repeat(2, 1fr); }
  .clock-box { display: none; }
  .user-chip-meta { display: none; }
  .settings-form .form-grid, .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .inline-form, .task-composer-grid, .policy-editor-top { grid-template-columns: 1fr; }
  .daypick-grid { max-width: 100%; }
  .daypick-meta { display: none; }
  .task-item { flex-direction: column; }
  .clock-big { font-size: 38px; }
}

/* ---------- density: fewer rows, more columns ---------- */
/* Rules & Policies: full-width sections in one flow (no card-per-column stacks). */
#rules-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
#rules-form > section.card { margin-bottom: 0; }
#rules-form > div:last-child { margin-bottom: 16px; }
/* Its inner field grids still go multi-column on wide screens. */
#rules-form .form-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
@media (min-width: 1200px) {
  #rules-form > section.card .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Admin task composer: everything on one line where there is room */
@media (min-width: 1280px) {
  .admin-composer .task-composer-grid { grid-template-columns: 1.1fr 2fr 1.1fr 1fr .9fr 1fr .9fr; }
}
@media (min-width: 1500px) {
  .admin-composer .task-composer-grid { grid-template-columns: 1fr 2.4fr 1.1fr 1fr .85fr 1fr .9fr; }
}

/* ---------- multi-column page layouts (real columns, not stacked cards) ---------- */
.split-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
.split-layout > .card { margin-bottom: 0; height: 100%; }
@media (max-width: 900px) { .split-layout { grid-template-columns: 1fr; } }

@media (min-width: 1200px) {
  .policy-editor-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}

.roster-form { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.roster-form > button { grid-column: 1 / -1; }
.roster-form .field-label { margin-top: 0; }

.stat-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 700px) { .stat-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

.network-banner.admin-only { border-style: dashed; }
.network-banner code { font-size: 12px; }

input[type="time"] { font-variant-numeric: tabular-nums; }
.modal-lead { margin: 0 0 12px; font-size: 13.5px; line-height: 1.55; }

/* calendar range selection */
.dp-range { width: 306px; }
.dp-hint {
  margin: 8px 2px 0; font-size: 11.5px; line-height: 1.5; color: var(--muted);
}
.dp-day.in-range { background: var(--brand-soft); color: var(--brand); border-radius: 0; }
.dp-day.range-edge { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.dp-day.past { color: var(--muted); }
.dp-day.past.range-edge, .dp-day.past.in-range { color: #fff; }
.dp-foot .spacer { flex: 1; }

/* Compact day picker (still readable, much less tall) */
.day-picker-card { padding: 14px 16px; }
.daypick-grid { gap: 4px; max-width: 560px; }
.daypick { padding: 3px 2px 2px; border-radius: 8px; min-height: 34px; }
.daypick-num { font-size: 12.5px; }
.daypick-meta { font-size: 8.5px; }
.daypick-dots { height: 5px; }
.daypick-dots .dot { width: 4px; height: 4px; }
.daypick-head { font-size: 9.5px; }
.day-picker-card .hint { font-size: 11.5px; margin: 6px 0 0; }

/* Keep long cell text from stretching rows */
.table td .cell-user small { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table td { max-width: 420px; }
.table td:first-child, .table th:first-child { max-width: none; }
.table .cell-clamp { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Tighter modals */
.modal { padding: 20px; }
.modal-actions { margin-top: 16px; }

/* Employee overview: side-by-side stats stay compact */
.grid-2 .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1180px) { .grid-2 .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }


/* ---------- number inputs: kill the native spinners (theme mismatch) ---------- */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"]:focus { outline: none; }

/* ---------- search box lives in the card's first row, centered ---------- */
.card-head > .table-search-bar {
  flex: 1 1 260px; min-width: 200px; padding: 0; margin: 0 0 0 auto;
  display: flex; justify-content: center; order: 2;
}
.card-head > .table-search-bar .search-box { max-width: 420px; }
.card-head > :last-child { order: 3; }
.card-head > div:first-child { order: 1; }

/* clickable stats (drill-down between attendance and tasks) */
.stat.stat-link { cursor: pointer; transition: border-color .15s, transform .15s; }
.stat.stat-link:hover, .stat.stat-link:focus-visible { border-color: var(--brand); }
.stat.stat-link .stat-label::after { content: ' →'; color: var(--brand); font-weight: 700; }
.btn-stat { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }

/* ---------- day navigation (Prev / date / Next) shared by every date view ---------- */
.daynav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.daynav-mid { display: inline-flex; align-items: center; gap: 7px; min-width: 132px; justify-content: center; }
.daynav-range-note { font-size: 12px; color: var(--muted); }

/* ---------- employee task composer: two explicit rows ---------- */
.task-composer-rows { display: flex; flex-direction: column; gap: 10px; }
.task-composer-row { display: grid; gap: 10px; align-items: end; }
.task-composer-row.row-1 { grid-template-columns: 1.6fr 1fr 1fr; }
.task-composer-row.row-2 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 860px) {
  .task-composer-row.row-1, .task-composer-row.row-2 { grid-template-columns: 1fr; }
}

/* ---------- compact task cards (overview / day panels) ---------- */
.task-list.compact { gap: 8px; }
.task-item.compact { padding: 10px 12px; align-items: center; }
.task-item.compact .task-actions { display: none; }
.task-item.compact .task-meta { gap: 6px 12px; font-size: 12px; }
.task-item.compact .task-notes { display: none; }

.btn-stat { width: 100%; text-align: center; }
.link-btn {
  background: none; border: 0; padding: 0; font: inherit; color: var(--brand);
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.link-btn:hover { color: var(--brand-hover, var(--brand)); }
.day-detail .daily-note-row { max-width: 520px; }

/* search box inside a table's header row (multi-table cards) */
.search-row th { padding: 6px 8px 10px; }
.search-row .table-search-bar { padding: 0; }

/* ---------- compact check-in card: all text left, action right ---------- */
.checkin-card.compact { text-align: left; padding: 16px 18px; }
.checkin-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.checkin-left { flex: 1 1 300px; min-width: 0; }
.checkin-when { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.checkin-when .checkin-dow { color: var(--brand); }
.checkin-clock { font-size: 30px; font-weight: 700; line-height: 1.1; margin: 3px 0 4px; font-variant-numeric: tabular-nums; }
.checkin-clock.live { color: var(--green); }
.checkin-meta { margin: 0; font-size: 13px; color: var(--muted); }
.checkin-extra { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 7px; font-size: 12.5px; color: var(--muted); }
.checkin-late { font-weight: 600; }
.checkin-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.checkin-right .btn { min-width: 138px; padding-top: 11px; padding-bottom: 11px; }
.checkin-note { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.checkin-note-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.checkin-note input { flex: 1 1 240px; }
.shift-hours-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.shift-hours-form input { width: 74px; }

/* ---------- month navigation: ‹ Prev · November 2026 · Next › ---------- */
.monthnav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.monthnav-mid { display: inline-flex; align-items: center; gap: 7px; min-width: 150px; justify-content: center; }
.month-picker { position: fixed; z-index: 900; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg, 0 18px 40px rgba(15,23,42,.18)); padding: 12px; width: 250px; }
.month-picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.month-picker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.month-picker-grid button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 9px; padding: 8px 4px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--ink); }
.month-picker-grid button:hover { border-color: var(--brand); color: var(--brand); }
.month-picker-grid button.selected { background: var(--brand-soft); border-color: var(--brand-border); color: var(--brand); }
.month-picker-grid button:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- searchable listbox options ---------- */
.cs-search { padding: 6px 6px 8px; }
.cs-search-input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font: inherit; font-size: 13px; background: var(--surface-2); color: var(--ink); }
.cs-empty { margin: 8px 6px; font-size: 12.5px; color: var(--muted); }

/* ---------- avatar upload preview ---------- */
.avatar-preview { display: flex; align-items: center; gap: 8px; margin-top: 6px; min-height: 34px; }
.avatar-preview img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }

/* ---------- attendance filter chips ---------- */
.filter-chips { display: flex; gap: 7px; flex-wrap: wrap; margin: 0 0 12px; }
.filter-chip { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 99px; padding: 5px 12px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.filter-chip:hover { border-color: var(--brand); color: var(--brand); }
.filter-chip.active { background: var(--brand-soft); border-color: var(--brand-border); color: var(--brand); }
.task-title-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left; }
.task-title-link:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }

/* table title row: name on the left, its search box on the right */
.table-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.table-head-row > h2, .table-head-row > h3, .table-head-row > h4 { margin: 0; }
.table-head-row > .table-search-bar { flex: 0 1 360px; margin: 0; padding: 0; }
.tab-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 99px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; vertical-align: middle; }
.pending-banner { margin: 0 0 12px; padding: 9px 12px; border-radius: 10px; background: var(--amber-bg, #fef3c7); border: 1px solid var(--amber-border, #fcd34d); color: var(--ink); font-size: 13px; }

/* ---------- batch 7: task activity log, timers, activity drill-down ---------- */
/* Worked-hours total is derived from the log: read it, never type it. */
.readonly-value {
  display: flex; align-items: baseline; gap: 6px;
  background: var(--surface-2); border: 1px dashed var(--line-strong);
  border-radius: 10px; padding: 9px 12px; font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.readonly-value b { font-size: 15px; }

.activity-block {
  margin-top: 16px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface-2); padding: 12px 14px 14px;
}
.activity-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 10px;
}
.activity-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.activity-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; }
.activity-entry {
  display: grid; grid-template-columns: 168px 92px 1fr; gap: 10px; align-items: baseline;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 11px; font-size: 13px;
}
.activity-entry + .activity-entry { margin-top: 0; }
.activity-when { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.activity-hours {
  font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums;
  background: var(--brand-soft); border-radius: 99px; padding: 1px 9px; justify-self: start;
}
.activity-note { color: var(--ink); line-height: 1.4; overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .activity-entry { grid-template-columns: 1fr; gap: 3px; }
  .activity-hours { justify-self: start; }
}

/* Mandatory-field marker + live "still too short" hint. */
.req { color: var(--red); font-weight: 700; }
.hint.bad { color: var(--red); }
.hint.bad b { color: var(--red); }
textarea#lt-note { min-height: 96px; resize: vertical; }

/* Timers: a chip that matches the rest of the UI, both the task stopwatch and the shift clock. */
.timer-readout {
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
  padding: 5px 11px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--muted); display: inline-flex; align-items: center; gap: 7px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}
.timer-readout::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--line-strong); flex: 0 0 auto;
}
.timer-readout.active {
  color: var(--green); background: var(--green-bg); border-color: var(--green-border);
  box-shadow: 0 0 0 3px rgba(16,185,129,.10);
}
.timer-readout.active::before { background: var(--green); animation: timer-pulse 1.6s ease-in-out infinite; }
@keyframes timer-pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }

.checkin-clock {
  font-variant-numeric: tabular-nums; letter-spacing: .01em;
}
.checkin-clock [data-shift-elapsed] {
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--green-bg); border: 1px solid var(--green-border); color: var(--green);
  border-radius: 12px; padding: 6px 14px; font-size: 26px; line-height: 1.15;
}
.checkin-clock [data-shift-elapsed]::before {
  content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--green);
  animation: timer-pulse 1.6s ease-in-out infinite;
}

/* Inline drill-down chip ("Worked on …"). */
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand-soft); color: var(--brand); border: 1px solid transparent;
  border-radius: 999px; padding: 2px 6px 2px 10px; font-size: 12px; font-weight: 600;
}
.filter-chip .link-btn { color: inherit; font-size: 12px; padding: 0 3px; }
.btn-stat { text-align: left; }

/* ---------- batch 8: themed avatar picker ---------- */
.file-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.avatar-picker {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; margin-top: 12px;
}
.avatar-picker-preview {
  width: 56px; height: 56px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6); overflow: hidden;
}
.avatar-picker-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-picker-preview .avatar { border-radius: 50%; }
.avatar-picker-actions { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.avatar-picker-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.avatar-picker-actions .hint { margin: 0; }
/* The label has to look exactly like a button, including hover/focus. */
label.btn { cursor: pointer; }
label.btn:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- batch 9: avatar cell, clickable summary cards, leaves check ---------- */
/* Avatar picker sits beside the joining date instead of taking a whole row. */
.form-grid .avatar-cell { display: flex; align-items: flex-start; min-width: 0; }
.form-grid .avatar-cell .avatar-picker {
  margin-top: 0; width: 100%; gap: 10px; padding: 10px 12px;
}
.form-grid .avatar-cell .avatar-picker-preview { width: 46px; height: 46px; }
.form-grid .avatar-cell .avatar-picker-actions .hint { display: none; }
@media (max-width: 640px) {
  .form-grid .avatar-cell .avatar-picker-actions .hint { display: block; }
}

/* Summary cards that act as filters keep their stat look but gain a state. */
.stat.stat-link.active {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: 0 0 0 2px var(--brand-border) inset;
}
.stat.stat-link.active .stat-num { color: var(--brand); }

/* Admin leave queue: one-line proof of what the server actually holds. */
.diag-strip {
  border: 1px dashed var(--line); border-radius: 10px;
  padding: 8px 12px; margin: 0 0 12px; background: var(--surface-2);
}
.diag-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.diag-line small { flex: 1 1 260px; line-height: 1.4; }
.diag-line code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px;
}

/* ---------- demo-mode strip: never confuse the sandbox with live data ---------- */
.demo-strip {
  max-width: 1180px; margin: 0 auto; padding: 9px 18px;
  background: var(--amber-bg); border: 1px solid var(--amber-border); color: var(--amber);
  border-radius: 0 0 12px 12px; font-size: 13px; line-height: 1.45;
}
.demo-strip code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ============================================================
   Batch 11 — every summary card looks identical whether it is a
   plain <div> or a filter <button>, with room to breathe.
   (`.btn-stat` used to strip border/padding, so clickable cards
   collapsed into flat text while the active one showed as a box.)
   ============================================================ */
.stat-grid { gap: 12px; }
.stat-grid > * { min-width: 0; }
/* One padding for every summary card, plain or clickable. */
.stat { padding: 14px 16px; }
.card { padding: 20px 22px; }
.card-head { gap: 14px; }

button.stat,
.stat.btn-stat {
  display: block;
  width: 100%;
  box-sizing: border-box;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
button.stat.highlight,
.stat.btn-stat.highlight { background: var(--brand-soft); border-color: var(--brand-border); }
button.stat:hover,
.stat.btn-stat:hover { border-color: var(--brand); background: var(--surface); }
button.stat:focus-visible,
.stat.btn-stat:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  box-shadow: none;
}
button.stat .stat-num,
.stat.btn-stat .stat-num { display: block; }
button.stat .stat-label,
.stat.btn-stat .stat-label { display: block; margin-top: 2px; }

/* Active filter state: same box, brand accent — never a full-bleed outline. */
button.stat.active,
.stat.btn-stat.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  box-shadow: none;
}
button.stat.active .stat-num,
.stat.btn-stat.active .stat-num { color: var(--brand); }
button.stat.active .stat-label::after,
.stat.btn-stat.active .stat-label::after { content: ' ✓'; color: var(--brand); font-weight: 700; }

/* Read-only "photo comes from GitHub" panel in Edit employee. */
.avatar-readonly {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.avatar-readonly .avatar { flex: 0 0 auto; border-radius: 50%; }
.avatar-readonly .field-label { display: block; }

/* Live-sync indicator in the topbar (proof the portals refresh themselves). */
.live-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  color: var(--green); background: var(--green-bg);
  border: 1px solid transparent; border-radius: 99px; padding: 4px 10px;
  font-variant-numeric: tabular-nums;
}
.live-chip[data-state="slow"] { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-border); }
.live-chip[data-state="busy"] { color: var(--muted); background: var(--surface-2); border-color: var(--line); }
.live-chip[data-state="error"] { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-border); }
@media (max-width: 760px) { .live-chip { display: none; } }

/* ---------- Batch 13: search lives with the left-hand group ---------- */
.card-head > .table-search-bar.in-head { margin-right: auto; }
.card-head > .table-search-bar { max-width: 320px; }
@media (max-width: 700px) {
  .card-head > .table-search-bar { max-width: none; width: 100%; }
}

/* ---------- Batch 13: smarter calendars ---------- */
.dp-title {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; padding: 4px 8px; border-radius: 8px;
  font: inherit; color: inherit; cursor: pointer;
}
.dp-title:hover, .dp-title:focus-visible { background: var(--brand-soft); color: var(--brand); outline: none; }
.dp-caret { font-size: 10px; opacity: .7; }
.dp-months.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dp-month-block { min-width: 0; }
.dp-month-block .dp-grid { margin-top: 4px; }
.dp-panel[hidden] { display: none; }
.dp-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.dp-panel-head b { font-size: 14px; }
.dp-panel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dp-panel-grid button {
  padding: 9px 6px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface-2); color: inherit; font: inherit; font-size: 13px; cursor: pointer;
}
.dp-panel-grid button:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.dp-panel-grid button.selected { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.dp-panel-grid button:disabled { opacity: .4; cursor: not-allowed; }
.dp-day.disabled { opacity: .35; cursor: not-allowed; }
@media (max-width: 560px) {
  .dp-popover { max-width: calc(100vw - 16px); }
}

/* ---------- Batch 13: office-IP rule tester ---------- */
.netlock-tester { margin-top: 10px; }
.netlock-verdict { display: block; font-size: 13px; font-weight: 600; padding: 8px 10px; border-radius: 10px; }
.netlock-verdict.ok { background: var(--green-bg); color: var(--green); }
.netlock-verdict.bad { background: var(--amber-bg); color: var(--amber); }
.netlock-verdict.muted { background: var(--surface-2); color: var(--muted); font-weight: 500; }

/* ---------- card drag handles: always there, always draggable ---------- */
.card-drag-handle {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; width: 24px; height: 24px; margin: 0 8px 0 0; padding: 0;
  border: 1px solid transparent; border-radius: 7px; background: transparent;
  color: var(--line-strong); font-size: 15px; line-height: 1;
  cursor: grab; touch-action: none; user-select: none;
  vertical-align: middle; transition: color .12s, background .12s, border-color .12s;
}
.card-drag-handle:hover, .card-drag-handle:focus-visible {
  color: var(--brand); background: var(--brand-soft); border-color: var(--brand-border); outline: none;
}
.card-drag-handle:active { cursor: grabbing; }
/* Inside a title the handle is simply the first inline child. In a card head it
   is pinned to the left edge, so `space-between` keeps the name next to it and
   the search box / buttons still sit on the right. */
.card-title > .card-drag-handle { margin-left: -2px; }
.card-head > .card-drag-handle {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%); margin: 0;
}
.card-head:has(> .card-drag-handle) { position: relative; padding-left: 28px; }
/* A card with no head (the compact check-in card) gets the handle tucked into
   the corner instead of a stray button above its content. */
.card:has(> .card-drag-handle) { position: relative; }
.card > .card-drag-handle {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  margin: 0; font-size: 12px; opacity: .45;
}
.card > .card-drag-handle:hover, .card > .card-drag-handle:focus-visible { opacity: 1; }
@media (hover: none) {
  .card-head:has(> .card-drag-handle) { padding-left: 36px; }
}
body.card-dragging, body.card-dragging * { cursor: grabbing !important; }
.card.dragging, section.card.dragging {
  opacity: .72; box-shadow: var(--shadow-lg);
  outline: 2px dashed var(--brand-border); outline-offset: 2px;
}
@media (hover: none) {
  .card-drag-handle { width: 32px; height: 32px; font-size: 17px; }
}

/* ---------- Batch 14: per-person shifts ---------- */
.shift-chip {
  display: inline-block; max-width: 190px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  font: inherit; font-size: 12px; line-height: 1.5; cursor: pointer; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
}
.shift-chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.shift-chip.custom { border-color: var(--brand-border); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.sub-head { font-size: 14px; margin: 18px 0 2px; }
.sched-grid { margin-top: 8px; }
.sched-summary { display: flex; flex-direction: column; justify-content: center; }
.sched-summary .hint { font-size: 12px; color: var(--muted); }
@media (max-width: 560px) {
  .shift-chip { max-width: 100%; white-space: normal; }
  .sched-grid { grid-template-columns: 1fr; }
}

/* ---------- Batch 14: acting as an employee ---------- */
.actas-strip {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  padding: 9px 16px; font-size: 13px; line-height: 1.5;
  background: #4c1d95; color: #f5f3ff;
}
.actas-strip .actas-main { max-width: 780px; }
.actas-strip .btn { background: #f5f3ff; color: #4c1d95; border: 0; font-weight: 700; }
.actas-strip .btn:hover { background: #ede9fe; }
[data-act-as] { color: var(--purple); }
[data-act-as]:hover,
[data-act-as]:focus-visible { background: var(--purple-bg); color: var(--purple); border-color: var(--purple-border); }
@media (max-width: 560px) {
  .actas-strip { flex-direction: column; align-items: stretch; text-align: center; font-size: 12.5px; padding: 10px 12px; }
  .actas-strip .btn { width: 100%; }
}

/* ---------- Batch 14: branding (white-label) ---------- */
.brand-text-mark {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; background: var(--brand); color: #fff;
  font-weight: 700; letter-spacing: .02em; line-height: 1; padding: 0 2px;
  overflow: hidden; text-transform: uppercase;
}
.brand-row { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1fr; gap: 12px; align-items: start; }
.brand-preview {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); min-width: 0;
}
.brand-preview { margin: 4px 0 10px; }
.brand-preview .brand-mark { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.brand-preview b { display: block; font-size: 14px; }
.brand-preview small { color: var(--muted); font-size: 11.5px; }
.brand-color-cell { display: flex; align-items: center; gap: 8px; }
.brand-color-cell input[type="color"] {
  width: 44px; height: 38px; padding: 2px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--card); cursor: pointer; flex: 0 0 auto;
}
.flag-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.flag-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); cursor: pointer;
}
.flag-item input { margin-top: 2px; width: 18px; height: 18px; accent-color: var(--brand); flex: 0 0 auto; }
.flag-item b { display: block; font-size: 13.5px; }
.flag-item small { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; }
[data-brand-row][hidden] { display: none !important; }

/* ============================================================
   Batch 14: phone pass — tables scroll instead of squeezing,
   modals become bottom sheets, one tap target per row, and
   nothing is smaller than a fingertip.
   ============================================================ */
@media (max-width: 720px) {
  .brand-row { grid-template-columns: 1fr 1fr; }
  .flag-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  .topbar-sub, .clock-date { display: none; }
  .topbar-title { font-size: 15.5px; }
  .topbar-right { gap: 8px; width: 100%; justify-content: flex-start; }
  .user-chip small { display: none; }
  .container { padding-left: 12px; padding-right: 12px; }
  .card { padding: 14px; }
  .card-head { flex-direction: column; align-items: stretch; gap: 8px; }
  .card-head .row-actions { justify-content: flex-start; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table { min-width: 560px; }
  .table th, .table td { padding: 9px 10px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs .tab { flex: 0 0 auto; }
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .link-btn { min-height: 32px; display: inline-flex; align-items: center; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal, .modal.wide, .modal.xl {
    width: 100%; max-width: none; max-height: 92vh; overflow-y: auto;
    border-radius: 18px 18px 0 0; padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
  }
  .modal-actions { position: sticky; bottom: 0; background: var(--card); padding-top: 10px; margin-top: 14px; }
  .modal-actions .btn, .modal-actions .btn-danger { flex: 1 1 46%; }
  .modal-actions .spacer { display: none; }
  .form-grid, .form-grid-3, .inline-form, .task-composer-row.row-1, .task-composer-row.row-2 { grid-template-columns: 1fr; }
  .checkin-right { width: 100%; }
  .checkin-right .btn { width: 100%; min-width: 0; }
  .stat-grid, .stat-grid.three, .grid-2 .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-head > .table-search-bar { max-width: none; width: 100%; }
  .actas-strip { font-size: 12.5px; }
  /* 16px keeps iOS from zooming the page when a field is focused. */
  input, select, textarea { font-size: 16px; }
  .table-search-bar input, .search-box input { font-size: 16px; }
}

@media (max-width: 480px) {
  .brand-row { grid-template-columns: 1fr; }
  .topbar .clock-box { display: none; }
  .container { padding-left: 10px; padding-right: 10px; }
  .card { padding: 12px; border-radius: 12px; }
  .stat-grid, .stat-grid.three, .grid-2 .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat { padding: 11px 12px; }
  .tab { padding: 8px 11px; font-size: 13px; }
  .modal { max-height: 96vh; }
  .table { min-width: 520px; }
  .btn { font-size: 13.5px; }
  .sched-grid { grid-template-columns: 1fr; }
}

/* ---------- Batch 15: settings that breathe ---------- */
.settings-more {
  margin: 16px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface-2);
}
.settings-more > summary {
  cursor: pointer; padding: 11px 14px; font-weight: 600; font-size: 13.5px;
  list-style: none; display: flex; align-items: center; gap: 8px;
}
.settings-more > summary::-webkit-details-marker { display: none; }
.settings-more > summary::before { content: '▸'; color: var(--muted); font-size: 11px; }
.settings-more[open] > summary::before { content: '▾'; }
.settings-more > summary:hover { color: var(--brand); }
.settings-more > *:not(summary) { margin-left: 14px; margin-right: 14px; }
.settings-more > *:last-child { margin-bottom: 14px; }
.settings-save {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
}
.settings-save .hint { margin: 0; }
@media (max-width: 720px) {
  .settings-more > *:not(summary) { margin-left: 10px; margin-right: 10px; }
  .settings-save .btn { width: 100%; }
}

/* Settings: two fields per row on desktop, one on a phone. */
.settings-form > .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-form .form-grid-3 { margin-top: 2px; }
@media (max-width: 860px) {
  .settings-form > .form-grid, .settings-form .form-grid-3 { grid-template-columns: 1fr; gap: 10px; }
}

/* ============================================================
   Batch 16: module navigation + white-label controls
   ============================================================ */
/* Top strip = modules; the row below it = the tabs inside that module. */
.module-tabs .tab { display: inline-flex; align-items: center; gap: 7px; }
.module-tabs .tab-icon { font-size: 14px; line-height: 1; opacity: .9; }
.subtabs {
  display: flex; gap: 4px; flex-wrap: wrap; align-items: center;
  margin: -6px 0 16px; padding: 4px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
  width: fit-content; max-width: 100%;
}
.subtab {
  border: 0; background: transparent; color: var(--muted); font: inherit;
  font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 9px;
  cursor: pointer; white-space: nowrap;
}
.subtab:hover { color: var(--brand); }
.subtab.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }

/* The logo image sits wherever the built-in mark did. */
.brand-img { border-radius: 9px; object-fit: contain; background: transparent; }
.login-plain-logo .brand-img, .brand-mark .brand-img { display: block; }

/* Settings: section headings + the logo editor */
.settings-h {
  margin: 26px 0 12px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 15px; letter-spacing: .01em;
}
.settings-h:first-of-type { margin-top: 20px; border-top: 0; padding-top: 0; }
.logo-editor {
  display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap;
  margin: 14px 0 18px; padding: 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface-2);
}
.logo-preview {
  width: 84px; height: 84px; flex: 0 0 84px; border-radius: 16px;
  display: grid; place-items: center; overflow: hidden;
  background: var(--card); border: 1px solid var(--line);
}
.logo-preview img { max-width: 74px; max-height: 74px; object-fit: contain; }
.logo-actions { flex: 1 1 260px; min-width: 220px; }
.logo-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* Modules: one row per product pillar */
.module-row {
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  margin-bottom: 10px; background: var(--card);
}
.module-row.module-off { background: var(--surface-2); border-style: dashed; }
.module-row.module-off .module-blurb { opacity: .6; }
.module-row-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.switch-row { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; flex: 1 1 220px; cursor: pointer; }
.switch-row input { width: auto; accent-color: var(--brand); }
.module-name { font-size: 14.5px; }
.module-rename { max-width: 190px; font-size: 13px; padding: 6px 9px; }
.module-blurb { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.module-people { margin-top: 8px; }
.module-people > summary { cursor: pointer; font-size: 12.5px; color: var(--brand); }
.module-people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-top: 8px; }
.module-person { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.module-person select { max-width: 190px; font-size: 12.5px; padding: 5px 8px; }
@media (max-width: 720px) {
  .logo-editor { padding: 12px; }
  .logo-preview { width: 64px; height: 64px; flex-basis: 64px; }
  .module-rename { max-width: 100%; width: 100%; }
  .subtabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
}

/* Drag & drop: the placeholder shows exactly where the card will land. */
.card-placeholder {
  border: 2px dashed var(--brand-border);
  background: var(--brand-soft);
  border-radius: var(--radius, 16px);
  min-height: 90px;
  flex: 1 1 auto;
  transition: background .12s, border-color .12s;
}
.card.dragging, section.card.dragging { opacity: .9; box-shadow: var(--shadow-lg); }

/* ============================================================
   b17 — one calendar, opaque menus, search-first rows
   ============================================================ */

/* Nothing floats over live content with a translucent skin: any panel that
   covers the page gets the card colour painted solid underneath it, in both
   themes, so text behind it can never read through. */
.dp-popover,
.month-picker,
.confirm-modal,
.modal,
.popover,
[data-theme="dark"] .dp-popover {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.dp-popover,
.month-picker,
.modal,
.confirm-modal {
  background-color: var(--card);
  background-image: linear-gradient(var(--card), var(--card));
}
[data-theme="dark"] .dp-popover,
[data-theme="dark"] .month-picker,
[data-theme="dark"] .modal,
[data-theme="dark"] .confirm-modal {
  background-color: var(--card);
  background-image: linear-gradient(var(--card), var(--card));
}

/* Native dropdowns (select) paint their own popup; give every option a solid
   background so the list never shows the page through it. */
select {
  background-color: var(--input-bg);
  color: var(--ink);
}
select option,
select optgroup {
  background-color: var(--card);
  color: var(--ink);
}
[data-theme="dark"] select option,
[data-theme="dark"] select optgroup {
  background-color: #131b2e;
  color: #f1f5f9;
}

/* Calendar: header title doubles as the day/month/year switch */
.dp-title .dp-caret { opacity: .55; margin-left: 4px; font-size: 11px; }
.dp-popover[data-view="months"] .dp-caret,
.dp-popover[data-view="years"] .dp-caret { opacity: 1; }
.dp-year-label {
  border: 1px solid transparent; background: transparent; color: var(--ink);
  font-family: var(--font); font-size: 14px; font-weight: 700; cursor: pointer;
  border-radius: 8px; padding: 3px 8px;
}
.dp-year-label:hover { background: var(--brand-soft); color: var(--brand); }
.dp-panel[hidden], .dp-years[hidden], .dp-months[hidden] { display: none; }
.dp-years .dp-panel-grid { grid-template-columns: repeat(4, 1fr); }
.dp-monthmode .dp-months { display: none; }
.dp-foot .btn { padding: 5px 10px; }
.dp-hint { margin: 8px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.dp-hint b { color: var(--ink); font-weight: 700; }

/* Search sits at the extreme left of its row: right after the card title,
   before the month nav, the buttons and the filters. */
.table-search-bar { justify-content: flex-start; }
.card-head > .table-search-bar { order: 2; margin: 0 auto 0 0; flex: 0 1 320px; max-width: 320px; }
.card-head > .card-title { order: 1; }
.card-head > .card-head-actions { order: 3; }
.card-head > .monthnav,
.card-head > .daynav { order: 3; margin-left: auto; }
.card-head > .table-search-bar.in-head { margin-right: auto; }
@media (max-width: 720px) {
  .card-head > .table-search-bar { order: 4; flex-basis: 100%; max-width: none; }
  .card-head > .monthnav,
  .card-head > .daynav { order: 3; }
}

/* Every floating panel is painted with an opaque colour, not a translucent
   theme token — a menu over a dense table must hide what is behind it. */
.cs-pop,
.dp-popover,
.month-picker {
  background-color: var(--card) !important;
  opacity: 1;
}
[data-theme="dark"] .cs-pop,
[data-theme="dark"] .dp-popover,
[data-theme="dark"] .month-picker {
  background-color: #131b2e !important;
}
/* Reset only the *unselected* cells: matching `.selected` here would out-rank
   `.dp-day.selected` (same specificity, later in the file) and paint the
   selection transparent — invisible white-on-white in light mode. */
.cs-pop .cs-opt:not(.active),
.dp-popover .dp-day:not(.selected):not(.range-edge):not(.in-range):not(.preview-edge),
.dp-popover .dp-panel-grid button:not(.selected) {
  background-color: transparent;
}
.cs-pop .cs-opt:hover,
.cs-pop .cs-opt.active {
  background-color: var(--brand-soft);
}

/* ============================================================
   b18 — the calendar, restyled around how ranges are actually used
   ------------------------------------------------------------
   Modern range pickers share a shape: one big, quiet month grid;
   the start/end drawn as solid pills joined by a soft band; the
   days between the first click and the pointer previewed live;
   quick ranges for the 90% case; one obvious way out.
   ============================================================ */
.dp-popover {
  width: 320px;
  padding: 16px 16px 12px;
  border-radius: 18px;
}
.dp-popover.dp-range { width: 340px; }
.dp-head { margin-bottom: 14px; }
.dp-month { font-size: 15px; letter-spacing: -.01em; }
.dp-nav {
  width: 32px; height: 32px; border-radius: 10px; font-size: 16px;
  border-color: transparent; background: transparent;
}
.dp-nav:hover:not(:disabled) { background: var(--brand-soft); border-color: transparent; }
.dp-nav:disabled { opacity: .35; cursor: not-allowed; }
.dp-title { border-radius: 10px; padding: 5px 8px; }
.dp-title:hover { background: var(--brand-soft); }

.dp-week { margin-bottom: 6px; }
.dp-week span { font-size: 10px; letter-spacing: .08em; padding: 2px 0; }

/* One rhythm for the whole grid: every cell the same square, the row gap
   doubled so numbers read as days and not as a spreadsheet. */
.dp-grid { gap: 4px 2px; }
.dp-day {
  height: 38px; border-radius: 10px; font-size: 13.5px;
  background: transparent; border: 1px solid transparent;
}
.dp-day:hover:not(.selected):not(.range-edge):not(.disabled) { background: var(--brand-soft); color: var(--brand); }
.dp-day.today { border-color: var(--brand-border); font-weight: 700; color: var(--brand); }
.dp-day.selected,
.dp-day.range-edge {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
  color: #fff !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(79, 70, 229, .28);
}
.dp-day.in-range {
  background: var(--brand-soft) !important;
  color: var(--brand) !important;
  border-radius: 6px;
}
.dp-day.preview-edge {
  background: var(--brand-soft) !important;
  color: var(--brand) !important;
  border: 1px dashed var(--brand-border) !important;
  border-radius: 10px;
}
.dp-day.past:not(.selected):not(.range-edge):not(.in-range) { color: var(--muted); }

/* Month / year tiles: same shape as a day, wider text. */
.dp-panel-grid { gap: 6px; }
.dp-panel-grid button {
  padding: 10px 4px; border-radius: 10px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); color: var(--ink);
}
.dp-panel-grid button.selected {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
  color: #fff !important;
}
.dp-years .dp-panel-grid { grid-template-columns: repeat(4, 1fr); }

/* Quick ranges: the "I just want this week" path. */
.dp-presets {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line);
}
.dp-presets button {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  font-family: var(--font); font-size: 11.5px; font-weight: 600;
  padding: 5px 10px; border-radius: 99px; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.dp-presets button:hover { border-color: var(--brand-border); background: var(--brand-soft); color: var(--brand); }
.dp-hint { margin-top: 10px; }
.dp-foot { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.dp-foot .btn { border-radius: 9px; }

@media (max-width: 640px) {
  .dp-popover, .dp-popover.dp-range { width: min(94vw, 340px); }
  .dp-day { height: 34px; font-size: 13px; }
}

/* Keyboard cursor inside the calendar: visible without stealing the selection. */
.dp-day.cursor { outline: 2px solid var(--brand); outline-offset: 1px; }
.dp-popover:focus { outline: none; }

/* Date fields: the value is ISO (for the code), the label is the workspace's
   own format (for the person) — the native control is painted transparently
   underneath so no browser locale can leak mm/dd/yyyy into the product. */
.date-field input[type="date"],
.date-field input[type="date"]::-webkit-datetime-edit {
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.date-field input[type="date"] { caret-color: transparent; }
.date-field-view {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  pointer-events: none; font-size: 14px; color: var(--ink);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.date-field-view.placeholder { color: var(--muted); }

/* ---------- b19: salary journey, pay extras, clickable names, form dialog ---------- */
.name-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  border-bottom: 1px dashed transparent;
}
.name-link:hover,
.name-link:focus-visible { color: var(--brand); border-bottom-color: currentColor; }

.pay-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: color-mix(in srgb, var(--brand) 16%, transparent);
  color: var(--brand);
  white-space: nowrap;
}
.pay-tag.extra { background: color-mix(in srgb, var(--green, #17a06a) 16%, transparent); color: var(--green, #17a06a); }
.pay-edit-btn { font-size: 12px; }
.pay-note { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); font-style: italic; }

.pay-extras { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; justify-content: flex-end; }
.pay-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--surface-2, rgba(127, 127, 127, 0.14));
  color: var(--ink);
  white-space: nowrap;
}
.pay-chip-x {
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 0 1px;
}
.pay-chip-x:hover { color: var(--red); }

.journey { list-style: none; margin: 6px 0 14px; padding: 0; display: grid; gap: 6px; }
.journey li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface-2, rgba(127, 127, 127, 0.1));
}
.journey-date { min-width: 92px; color: var(--muted); font-variant-numeric: tabular-nums; }
.journey-override { margin: 0 0 8px; }

.fd-form { display: grid; gap: 12px; }
.fd-row { display: grid; gap: 4px; }
.fd-row textarea,
.fd-row input,
.fd-row select { width: 100%; }
.cell-user:hover b { text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.refresh-btn.is-busy, .refresh-btn:disabled { opacity: .65; }

/* ---------- b19: themed time picker ---------- */
.time-field { cursor: pointer; font-variant-numeric: tabular-nums; }
.time-pop {
  position: absolute;
  z-index: 9000;
  width: 236px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 10px;
  display: grid;
  gap: 8px;
}
.tp-head { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tp-col { display: grid; gap: 2px; max-height: 190px; overflow-y: auto; padding-right: 2px; }
.tp-cell {
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-variant-numeric: tabular-nums;
  padding: 5px 8px;
  border-radius: 7px;
  cursor: pointer;
  text-align: center;
}
.tp-cell:hover { background: var(--surface-hover); }
.tp-cell.selected { background: var(--brand); color: #fff; font-weight: 700; }
.tp-foot { display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; }
.tp-foot .spacer { flex: 1; }

/* ---------- b19: Paid Leaves tiers ---------- */
.leave-tier-list { display: grid; gap: 10px; margin-bottom: 10px; }
.leave-tier {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.leave-tier-label { font-weight: 700; min-width: 110px; }
.leave-tier-cell { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.leave-tier-cell input { width: 84px; }
.leave-tier-cell select { min-width: 108px; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- b19: country holidays ---------- */
.hol-country-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 6px 0 14px; }
.hol-country-row select { min-width: 220px; }
.holiday-chip.auto { border-style: dashed; }
.hol-src {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 5px;
  margin-left: 2px;
}
.account-block {
  margin: 4px 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 13px;
  white-space: pre-wrap;
  color: var(--ink);
}

/* ---------- b19: Google-Analytics-style calendars ---------- */
/* One calm surface, presets in a left rail, two months, a continuous band
   between the two picked days and round edge days. */
.dp-popover {
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(60, 64, 67, .18), 0 1px 3px rgba(60, 64, 67, .12);
}
.dp-popover.dp-range {
  width: 704px;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  grid-template-areas:
    "presets head"
    "presets months"
    "presets hint"
    "presets foot";
  column-gap: 20px;
  border-radius: 12px;
}
.dp-range .dp-head { grid-area: head; }
.dp-range .dp-months,
.dp-range .dp-panel { grid-area: months; }
.dp-range .dp-presets { grid-area: presets; }
.dp-range .dp-hint { grid-area: hint; }
.dp-range .dp-foot { grid-area: foot; }

.dp-presets {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0 14px 0 0;
  border-top: 0;
  border-right: 1px solid var(--line);
  align-content: start;
}
.dp-presets button {
  border: 0;
  background: none;
  color: var(--ink);
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}
.dp-presets button:hover { background: var(--brand-soft); color: var(--brand); }

.dp-grid { gap: 0; }
.dp-day {
  height: 34px;
  border: 0;
  border-radius: 50%;
  font-size: 12.5px;
  font-weight: 500;
}
.dp-day:hover { background: var(--surface-hover); color: var(--ink); }
.dp-day.today { border: 1px solid var(--brand); color: var(--brand); font-weight: 700; }
.dp-day.past { color: var(--muted); }
.dp-day.in-range {
  background: color-mix(in srgb, var(--brand) 16%, transparent);
  color: var(--ink);
  border-radius: 0;
}
.dp-day.range-edge,
.dp-day.preview-edge,
.dp-day.selected {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff !important;
  font-weight: 700;
  border-radius: 50%;
}
.dp-day.selected { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 24%, transparent); }
.dp-week span { font-size: 10px; letter-spacing: .06em; font-weight: 700; }
.dp-hint { font-size: 12px; }
.dp-range .dp-foot { border-top: 1px solid var(--line); }

@media (max-width: 920px) {
  .dp-popover.dp-range {
    display: block;
    width: min(94vw, 360px);
  }
  .dp-range .dp-presets {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-top: 1px solid var(--line);
    padding: 10px 0 0;
    margin-top: 10px;
  }
  .dp-range .dp-presets button { padding: 5px 10px; border: 1px solid var(--line); border-radius: 99px; font-size: 11.5px; }
}

/* ---------- b20: one-header calendar (no duplicated year rows) ---------- */
.dp-head {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.dp-head .dp-nav { width: 30px; height: 30px; border-radius: 50%; }
.dp-head .dp-nav[hidden] { display: none; }
.dp-head .dp-jump { font-size: 13px; opacity: .75; }
.dp-head .dp-jump:hover { opacity: 1; }
.dp-title {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.dp-title:hover { background: var(--surface-hover); }
.dp-title:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.dp-caret { font-size: 10px; opacity: .6; }

/* Month panel: 3 × 4, comfortable hit areas, no second header row. */
.dp-month-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 4px 0 2px;
}
.dp-month-grid button {
  padding: 12px 6px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
}
.dp-monthmode .dp-month-grid button.selected,
.dp-month-grid button.selected {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.dp-panel { min-height: 210px; }
.dp-day.cursor { outline: 2px solid var(--brand); outline-offset: -2px; }
.dp-day.disabled { opacity: .35; cursor: not-allowed; }

/* ---------- b20: free-form minutes ---------- */
.minute-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.minute-chip {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  cursor: pointer;
}
.minute-chip:hover { border-color: var(--brand-border); background: var(--brand-soft); color: var(--brand); }

/* ---------- b20: clickable audit details ---------- */
.audit-link {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  max-width: 100%;
  padding: 2px 6px;
  margin: -2px -6px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.audit-link:hover,
.audit-link:focus-visible { background: var(--brand-soft); color: var(--brand); }
.audit-go { font-size: 11px; opacity: .55; }
.audit-link:hover .audit-go { opacity: 1; }

/* ---------- b20: salary slips (preview + generator) ---------- */
.slip-modal .form-grid { gap: 12px; }
.slip-field { display: grid; gap: 4px; }
.slip-field textarea { width: 100%; }
.slip-notes { grid-column: 1 / -1; }

.slip-paper {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 22px 24px;
  display: grid;
  gap: 16px;
}
/* The slip header is one centred block — logo, company, then the period. It
   matches the PDF exactly, which is what the admin signs off on. */
.slip-top { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.slip-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.slip-company { font-size: 18px; font-weight: 700; }
.slip-sub { font-size: 12px; color: var(--muted); }
.slip-period { text-align: center; display: grid; gap: 2px; justify-items: center; }
.slip-period b { font-size: 14px; letter-spacing: .04em; }
.slip-period span { font-size: 12px; color: var(--muted); }

.slip-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.slip-facts div { display: grid; gap: 1px; }
.slip-facts span { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.slip-facts b { font-size: 13px; font-weight: 600; }

.slip-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.slip-th, .slip-tr { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; font-size: 13px; }
.slip-th { background: var(--surface-2); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-radius: 7px 7px 0 0; }
.slip-tr { border-bottom: 1px solid var(--line); }
.slip-tr.total { border-bottom: 0; font-weight: 700; }
.slip-tr span:last-child { font-variant-numeric: tabular-nums; }

.slip-net {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--surface-2); border-radius: 10px; padding: 14px 16px;
}
.slip-net span { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: block; }
.slip-net small { font-size: 11px; color: var(--muted); }
.slip-net b { font-size: 22px; }
.slip-pay { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.slip-pay div { display: grid; gap: 1px; }
.slip-pay span { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.slip-pay b { font-size: 13px; }
.slip-note { margin: 0; font-size: 12px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 10px; }

@media (max-width: 640px) {
  .slip-facts, .slip-tables { grid-template-columns: 1fr; }
  .slip-pay { grid-template-columns: 1fr 1fr; }
}

/* employee payroll tab */
.pay-stats { margin: 4px 0 16px; }
.slip-table-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 10px; }
.year-nav { display: inline-flex; align-items: center; gap: 6px; }
.year-nav b { font-variant-numeric: tabular-nums; }
.row-current { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.pay-slip-btn { font-size: 12px; margin-top: 4px; }

/* hide salary values (admin payroll, screen sharing) */
.hide-money .money, .hide-money .money span, .hide-money .money b {
  filter: blur(6px);
  user-select: none;
  transition: filter .15s ease;
}
.hide-money .money:hover { filter: blur(6px); }

/* ---------- b21: one-row history header, filled month nav ---------- */
.card-head-actions.history-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  justify-content: flex-end;
}
.history-actions .monthnav { flex: 1 1 auto; flex-wrap: nowrap; min-width: 300px; }
.history-actions .monthnav .btn { white-space: nowrap; }
.history-actions .monthnav-mid { flex: 1 1 auto; justify-content: center; }
.history-actions select { min-width: 190px; max-width: 260px; }
.history-actions .seg-toggle { flex: 0 0 auto; }

.seg-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.seg-toggle button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.seg-toggle button:hover { color: var(--text); }
.seg-toggle button.active { background: var(--card); color: var(--brand); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

@media (max-width: 780px) {
  .card-head-actions.history-actions { justify-content: flex-start; }
  .history-actions .monthnav { min-width: 0; width: 100%; }
  .history-actions select { flex: 1 1 140px; min-width: 0; max-width: none; }
}

/* role next to the greeting */
.page-title-role {
  font-size: .58em;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
  margin-left: 4px;
}

/* task deadline chip, now on the title row */
.task-title-row .task-due { margin-left: auto; }
.pill.task-due { background: var(--surface-2); color: var(--text-soft, var(--muted)); border: 1px solid var(--line); }
.pill.task-due.overdue { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); }

/* ---------- b21: slip generator (read-only facts, brand header) ---------- */
.slip-modal-title { display: flex; align-items: center; gap: 12px; }
.slip-modal-logo { width: 42px; height: 42px; object-fit: contain; border-radius: 8px; background: #fff; padding: 3px; border: 1px solid var(--line); }
.slip-field.slip-ro b { font-size: 13.5px; font-weight: 600; }
.slip-field.slip-ro { min-height: 58px; align-content: start; }
.slip-ro-note { font-size: 11.5px; color: var(--muted); }
.slip-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.slip-logo { width: 56px; height: 56px; object-fit: contain; }
.slip-att { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.slip-att div { display: grid; gap: 1px; }
.slip-att span { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.slip-att b { font-size: 13px; }
@media (max-width: 640px) { .slip-att { grid-template-columns: 1fr 1fr; } }

/* the slip itself is set in the brand face */
@font-face {
  font-family: 'Bai Jamjuree';
  src: url('/fonts/BaiJamjuree-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Bai Jamjuree';
  src: url('/fonts/BaiJamjuree-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
.slip-paper { font-family: 'Bai Jamjuree', var(--font, 'Inter', system-ui, sans-serif); }
.slip-paper .slip-tr span:last-child,
.slip-paper .slip-net b { font-variant-numeric: tabular-nums; }

/* ---------- b22: four-across task composer (deadline next to the estimate) ---------- */
.task-composer-row.row-4 { grid-template-columns: 1.6fr 0.8fr 0.9fr 0.9fr; }
@media (max-width: 980px) {
  .task-composer-row.row-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .task-composer-row.row-4 { grid-template-columns: 1fr; }
}

/* ---------- b22: the calendar header fills the popover ---------- */
.dp-head { width: 100%; }
.dp-title { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; gap: 6px; }
.dp-title .dp-month { text-align: center; }
.dp-months { width: 100%; }

/* ---------- b22: one-row card headers with search ---------- */
.card-head.history-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.history-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 320px;
  min-width: 0;
  flex-wrap: wrap;
}
.history-head-left .card-title { white-space: nowrap; }
.history-head-left .table-search-bar { flex: 0 1 260px; min-width: 150px; }
.history-head-left .table-search-bar input { width: 100%; }
.card-head.history-head .history-actions { flex: 0 0 auto; }

/* the ✕ inside a filter chip: same everywhere */
.filter-chip .chip-x {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 11px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 50%;
  cursor: pointer;
  opacity: .75;
}
.filter-chip .chip-x:hover { opacity: 1; background: rgba(255, 255, 255, .16); }

@media (max-width: 860px) {
  .card-head.history-head { align-items: flex-start; }
  .history-head-left { flex: 1 1 100%; }
  .history-head-left .table-search-bar { flex: 1 1 100%; }
  .card-head.history-head .history-actions { width: 100%; justify-content: space-between; }
}

/* ---------- b22: the History search (its own state, so it gets a chip) ---------- */
.hist-search {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 1 230px;
  min-width: 150px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 10px;
  height: 34px;
  color: var(--muted);
}
.hist-search input {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  width: 100%;
  height: 100%;
}
.hist-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.hist-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
