:root {
  --bg: #f7f7f8;
  --panel: #ffffff;
  --ink: #161122;
  --muted: #6e657b;
  --line: #e5e1ea;
  --danger: #ff1724;
  --danger-dark: #d80f1b;
  --soft-red: #ffe7e9;
  --nav: #211d26;
  --nav-line: #393340;
  --success: #0d8f57;
  --warning: #b97900;
  --info: #3267d6;
  --shadow: 0 18px 45px rgba(16, 10, 30, .08);
  --radius: 18px;
  --radius-sm: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, Cambria, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: var(--sans); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .62; }
a { color: inherit; }
.hidden { display: none !important; }

.app-shell { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }
.sidebar { background: var(--nav); color: #f7f2f6; display: flex; flex-direction: column; min-height: 100vh; position: sticky; top: 0; }
.logo-block { padding: 24px 18px 18px; border-bottom: 1px solid var(--nav-line); }
.logo-row { display: flex; align-items: center; gap: 12px; }
.logo-mark { width: 38px; height: 38px; border-radius: 12px; background: var(--danger); color: white; display: grid; place-items: center; font-weight: 900; letter-spacing: -.03em; }
.logo-copy strong { display: block; font-size: 15px; }
.logo-copy span { display: block; color: #b9b0c3; font-size: 12px; margin-top: 2px; }
.nav { padding: 18px 10px; display: grid; gap: 6px; }
.nav button { width: 100%; background: transparent; color: #cdc6d4; border: 0; border-radius: 14px; padding: 13px 12px; text-align: left; display: flex; align-items: center; gap: 12px; font-weight: 700; transition: .15s ease; }
.nav button:hover { color: white; background: rgba(255,255,255,.06); }
.nav button.active { background: var(--danger); color: white; box-shadow: 0 10px 18px rgba(255, 23, 36, .22); }
.nav button .chev { margin-left: auto; opacity: .72; }
.nav .icon { width: 18px; display: inline-grid; place-items: center; font-size: 16px; opacity: .92; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--nav-line); padding: 16px 14px; display: grid; gap: 12px; }
.user-chip { display: flex; gap: 10px; align-items: center; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #9b2730; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 12px; flex: 0 0 auto; }
.user-chip strong { font-size: 13px; display: block; }
.user-chip span { font-size: 12px; color: #b9b0c3; display: block; }
.sidebar-bottom button { border: 0; background: transparent; color: #cfc7d8; padding: 8px 4px; text-align: left; font-weight: 700; }

.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 34px; background: rgba(247,247,248,.82); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar h1 { margin: 0; font-family: var(--serif); font-size: clamp(26px, 3vw, 38px); letter-spacing: -.035em; }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.top-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.content { padding: 30px 34px 60px; max-width: 1400px; }
.section-title { display:flex; justify-content:space-between; align-items:flex-end; gap:16px; margin-bottom:18px; }
.section-title h2 { margin:0; font-family: var(--serif); font-size: 28px; letter-spacing:-.03em; }
.section-title p { margin:5px 0 0; color:var(--muted); }

.btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 12px; padding: 10px 14px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; min-height: 40px; }
.btn:hover { box-shadow: 0 8px 20px rgba(20, 13, 30, .06); transform: translateY(-1px); }
.btn-primary { border-color: var(--danger); background: var(--danger); color: white; }
.btn-primary:hover { background: var(--danger-dark); }
.btn-ghost { background: transparent; }
.btn-danger { border-color: #f2b5bc; color: #b30b16; background: #fff5f6; }
.btn-success { border-color: #bfe7d3; color: #04683d; background: #effaf4; }
.btn-small { padding: 7px 10px; min-height: 32px; border-radius: 10px; font-size: 12px; }

.grid { display:grid; gap:18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card.flat { box-shadow:none; }
.card h3 { margin:0 0 10px; font-family:var(--serif); font-size:20px; letter-spacing:-.02em; }
.card p { color: var(--muted); }
.kpi { display:flex; align-items:flex-start; gap:16px; }
.kpi .kpi-icon { width: 48px; height:48px; border-radius:14px; display:grid; place-items:center; background:var(--soft-red); color:var(--danger); font-size:22px; flex:0 0 auto; }
.kpi strong { font-size:30px; letter-spacing:-.04em; display:block; }
.kpi span { color:var(--muted); font-size:13px; }
.hero { display: grid; grid-template-columns: 1.2fr .8fr; gap: 20px; align-items: stretch; }
.hero-panel { background: linear-gradient(135deg,#201b26 0%,#342734 50%,#ff1724 130%); color:white; border-radius:24px; padding:30px; min-height: 260px; box-shadow:0 24px 60px rgba(25,15,35,.16); }
.hero-panel h2 { margin:0 0 10px; font-family:var(--serif); font-size:42px; letter-spacing:-.045em; line-height:1; }
.hero-panel p { color:#e9dce5; max-width:720px; }
.pill-row { display:flex; flex-wrap:wrap; gap:8px; margin-top:22px; }
.pill { display:inline-flex; align-items:center; gap:6px; border-radius:999px; padding:8px 11px; font-size:12px; font-weight:800; background:#f2edf4; color:#342b3c; }
.hero-panel .pill { background:rgba(255,255,255,.14); color:white; border:1px solid rgba(255,255,255,.12); }
.badge { border-radius: 999px; padding: 5px 9px; font-weight: 900; font-size: 11px; letter-spacing:.02em; text-transform: uppercase; display:inline-flex; align-items:center; gap:6px; }
.badge.green { background:#e7f8ef; color:#077245; }
.badge.red { background:#ffe8eb; color:#b40d18; }
.badge.yellow { background:#fff5d6; color:#866000; }
.badge.blue { background:#e8efff; color:#2452b3; }
.badge.gray { background:#eeeaf0; color:#5c5268; }

.table-wrap { overflow:auto; border:1px solid var(--line); border-radius:16px; background:var(--panel); }
table { width:100%; border-collapse: collapse; min-width: 860px; }
th, td { padding: 12px 13px; border-bottom:1px solid var(--line); text-align:left; vertical-align:middle; }
th { font-size: 12px; color:#71667b; text-transform: uppercase; letter-spacing:.06em; background:#fbfafc; white-space:nowrap; }
td { font-size: 14px; }
tr:last-child td { border-bottom:0; }
tr:hover td { background:#fffafb; }
.money { font-family: var(--mono); font-weight: 800; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display:inline-block; margin-right: 6px; background: var(--muted); }
.status-active { background: var(--success); }
.status-inactive { background: var(--warning); }

.form-grid { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:14px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.field { display:grid; gap:7px; }
.field label { color:#4e4558; font-size:12px; font-weight:900; text-transform:uppercase; letter-spacing:.04em; }
.field input, .field select, .field textarea { width:100%; border:1px solid var(--line); border-radius:12px; padding:11px 12px; background:white; color:var(--ink); outline:none; }
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color:#ff9da4; box-shadow: 0 0 0 4px rgba(255,23,36,.08); }
.field small { color: var(--muted); }
.form-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:18px; flex-wrap: wrap; }
.divider { height:1px; background:var(--line); margin:18px 0; }

.modal-backdrop { position:fixed; inset:0; background:rgba(17,11,24,.58); display:grid; place-items:center; z-index:80; padding:20px; }
.modal { width:min(940px, 100%); max-height:92vh; overflow:auto; background:white; border-radius:24px; box-shadow:0 30px 80px rgba(0,0,0,.28); border:1px solid rgba(255,255,255,.2); }
.modal header { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:20px 24px; border-bottom:1px solid var(--line); position:sticky; top:0; background:white; z-index:2; }
.modal header h3 { margin:0; font-family:var(--serif); font-size:24px; }
.modal .modal-body { padding:24px; }
.close-x { border:0; background:#f2edf4; width:36px; height:36px; border-radius:12px; font-weight:900; }

.login-page { min-height:100vh; display:grid; grid-template-columns: 1.1fr .9fr; background:white; }
.login-brand { background: radial-gradient(circle at 18% 22%, rgba(255,23,36,.42), transparent 28%), linear-gradient(135deg,#17121d 0%,#2d2433 60%,#1d151f 100%); color:white; padding:48px; display:flex; flex-direction:column; justify-content:space-between; }
.login-brand h1 { font-family:var(--serif); font-size: clamp(42px, 6vw, 72px); letter-spacing:-.06em; line-height:.95; margin:0; }
.login-brand p { max-width:640px; color:#eee4ed; font-size:17px; line-height:1.6; }
.login-panel { display:grid; place-items:center; padding:38px; }
.login-card { width:min(440px,100%); background:var(--panel); border:1px solid var(--line); border-radius:24px; padding:28px; box-shadow:var(--shadow); }
.login-card h2 { margin:0 0 6px; font-family:var(--serif); font-size:32px; letter-spacing:-.04em; }
.quick-users { display:grid; gap:8px; margin-top:14px; }
.quick-users button { border:1px solid var(--line); border-radius:12px; background:#fbf9fc; text-align:left; padding:10px 12px; }
.quick-users strong { display:block; }
.quick-users span { display:block; color:var(--muted); font-size:12px; margin-top:3px; }
.alert { border:1px solid #ffd0d5; background:#fff5f6; color:#8b1018; padding:12px; border-radius:12px; margin:14px 0; font-weight:700; }
.notice { border:1px solid #d9e4ff; background:#f3f7ff; color:#23468e; padding:12px; border-radius:12px; margin:14px 0; }

.print-area { font-family:var(--sans); color:#111; }
.payslip { background:white; color:#111; padding:28px; max-width:900px; margin:0 auto; }
.payslip header { display:flex; justify-content:space-between; gap:20px; border-bottom:2px solid #111; padding-bottom:14px; margin-bottom:18px; }
.payslip h1 { font-size:24px; margin:0; }
.payslip h2 { font-size:18px; margin:0 0 8px; }
.payslip .lines { display:grid; grid-template-columns: 1fr 1fr; gap:14px; }
.payslip table { min-width:0; }
.payslip th { color:#111; background:#f1f1f1; }
.payslip .net { font-size:24px; font-weight:900; }

.empty-state { text-align:center; padding:34px; border:1px dashed #d6d0dc; border-radius:18px; background:#fff; }
.empty-state strong { display:block; font-family:var(--serif); font-size:22px; margin-bottom:8px; }
.todo { display:grid; gap:10px; }
.todo-item { display:flex; gap:10px; padding:12px; border:1px solid var(--line); border-radius:14px; background:#fff; }
.todo-item input { margin-top:4px; }
.chart-bar { display:grid; gap:8px; }
.bar { height:10px; border-radius:999px; background:#eeeaf0; overflow:hidden; }
.bar i { display:block; height:100%; background:linear-gradient(90deg,#ff1724,#ff8b94); border-radius:999px; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hero { grid-template-columns:1fr; }
}
@media (max-width: 850px) {
  .app-shell { grid-template-columns:1fr; }
  .sidebar { position:relative; min-height: auto; }
  .nav { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .sidebar-bottom { display:none; }
  .topbar { position:relative; padding:20px; flex-direction:column; align-items:flex-start; }
  .content { padding:20px; }
  .grid-4, .grid-3, .grid-2, .form-grid, .form-grid.three, .login-page { grid-template-columns:1fr; }
  .login-brand { min-height: 420px; padding:28px; }
}
@media print {
  body { background:white; }
  .no-print, .sidebar, .topbar, .content > *:not(.print-area) { display:none !important; }
  .app-shell { display:block; }
  .main, .content { padding:0; max-width:none; }
  .print-area { display:block !important; }
  .payslip { box-shadow:none; padding:0; max-width:none; }
}

/* Branded document authenticity headers */
.app-logo { width: 38px; height: 38px; border-radius: 12px; object-fit: contain; background: #fff; border: 1px solid rgba(255,255,255,.18); padding: 2px; }
.app-logo-fallback { width: 38px; height: 38px; border-radius: 12px; background: var(--danger); color: white; display: grid; place-items: center; font-weight: 900; letter-spacing: -.03em; }
.document-export-header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; border-bottom:2px solid #111; padding-bottom:12px; margin-bottom:16px; }
.document-export-company { flex:1; }
.document-export-company h1 { margin:0 0 4px; font-size:22px; color:#111; }
.document-export-company div, .document-export-meta div { font-size:12px; color:#333; line-height:1.35; }
.document-export-meta { text-align:right; min-width:180px; }
.document-export-meta h2 { margin:0 0 6px; font-size:18px; color:#111; }
.document-logo { width:58px; height:58px; object-fit:contain; border:0; border-radius:0; background:transparent; padding:0; }
.document-logo-fallback { width:58px; height:58px; border-radius:10px; border:2px solid #111; display:grid; place-items:center; font-size:18px; font-weight:900; background:#fff; color:#111; }
.document-logo-preview { min-height:82px; display:flex; align-items:center; gap:10px; }
.logo-manager-field { grid-column: span 2; }
.logo-manager { display:flex; align-items:center; gap:14px; border:1px solid var(--line); border-radius:14px; padding:12px; background:#fff; }
.logo-manager input[type="file"] { max-width:100%; margin:8px 0 6px; }
.logo-status { font-size:13px; margin-bottom:4px; }
.logo-actions { display:flex; flex-wrap:wrap; gap:8px; margin:6px 0; }
.btn.ghost { background:#fff; color:var(--ink); border:1px solid var(--line); }
@media(max-width:760px){ .logo-manager-field { grid-column: span 1; } .logo-manager { align-items:flex-start; flex-direction:column; } }
.document-header { align-items:flex-start; }
.document-brand { display:flex; align-items:flex-start; gap:14px; }
.document-brand h1 { margin-top:0; }
@media print {
  .document-export-header, .document-brand { break-inside: avoid; }
}

/* KRA-style P9A annual tax card */
.p9-card { max-width: none; }
.p9-official-header { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; border:2px solid #111; padding:14px; margin:14px 0 10px; background:#fff; }
.p9-official-header h1 { margin:0; font-size:22px; letter-spacing:.02em; }
.p9-official-header h2 { margin:3px 0 6px; font-size:15px; letter-spacing:.04em; }
.p9-badge { border:2px solid #111; padding:10px 18px; font-size:32px; font-weight:900; letter-spacing:.03em; }
.p9-identity-table { width:100%; border-collapse:collapse; margin:10px 0 14px; min-width:0; }
.p9-identity-table td { border:1px solid #111; padding:8px 10px; font-size:13px; width:50%; }
.p9-section { margin-top:18px; }
.p9-section h3 { margin:0 0 6px; font-size:18px; }
.p9-table-wrap { border-radius:0; border-color:#111; }
.p9-table { min-width:1800px; font-size:11px; }
.p9-table th { background:#f2f2f2; color:#111; border:1px solid #555; text-transform:none; letter-spacing:0; white-space:normal; text-align:center; vertical-align:bottom; padding:7px; }
.p9-table td { border:1px solid #777; padding:6px 7px; font-size:11px; }
.p9-table .money { text-align:right; }
.p9-total-row td { background:#fafafa; font-weight:900; }
@media print {
  .p9-card { padding:0; }
  .p9-official-header, .p9-identity-table, .p9-section { break-inside: avoid; }
  .p9-table { font-size:8px; min-width:0; }
  .p9-table th, .p9-table td { padding:3px; font-size:7px; }
}

/* Detailed Kenya payslip template matching the printable PDF/Excel layout */
.payslip-kenya { max-width: 860px; padding: 0 8px 18px; font-family: Arial, sans-serif; font-size: 12px; line-height: 1.25; box-shadow: none; }
.payslip-kenya .payslip-top-header { display:grid; grid-template-columns: 1fr 82px; gap:12px; align-items:flex-start; padding:8px 6px 8px; }
.payslip-kenya .payslip-logo-wrap { text-align: right; padding-top: 0; }
.payslip-kenya .payslip-logo-img { width: 74px; height: 52px; max-width: 74px; max-height: 52px; object-fit: contain; border:0; background:transparent; padding:0; }
.payslip-kenya .payslip-logo-fallback { display: inline-flex; align-items: center; justify-content: center; width: 74px; height: 52px; border:1px solid #111; background:#f7f7f7; color:#111; font-size:18px; font-weight: 800; letter-spacing: -.04em; }
.payslip-kenya .payslip-company-name { text-align: center; font-weight: 700; margin: 8px 0 3px; }
.payslip-kenya .payslip-company-lines { text-align: center; font-size: 10px; color: #333; margin-bottom: 12px; }
.payslip-kenya .payslip-green-line { height: 1px; background: #22a06b; margin: 0 -2px; }
.payslip-kenya .payslip-title { text-align: center; font-size: 14px; padding: 5px 0 14px; color: #111; }
.payslip-kenya .payslip-info-table,
.payslip-kenya .payslip-line-table,
.payslip-kenya .payslip-personal-table { width: 100%; min-width: 0; border-collapse: collapse; table-layout: fixed; }
.payslip-kenya .payslip-info-table td { padding: 2px 8px; font-size: 12px; border: 0; }
.payslip-kenya .payslip-info-table td:first-child { width: 28%; text-align: left; }
.payslip-kenya .payslip-info-table td:last-child { text-align: right; font-weight: 600; }
.payslip-kenya .payslip-block { margin-top: 10px; }
.payslip-kenya .payslip-block-title { font-weight: 700; margin: 8px 0 2px; }
.payslip-kenya .payslip-line-table td { padding: 3px 8px; border: 0; }
.payslip-kenya .payslip-line-table td:first-child { text-align: left; }
.payslip-kenya .payslip-line-table td:last-child { text-align: right; }
.payslip-kenya .payslip-line-table tr:nth-child(odd) { background: #fafafa; }
.payslip-kenya .payslip-total-row td { font-weight: 700; background: #fff; }
.payslip-kenya .payslip-net-row { display: flex; justify-content: space-between; align-items: center; margin: 15px 6px 28px; border-top: 2px solid #22a06b; padding: 8px 2px 0; font-size: 14px; font-weight: 700; }
.payslip-kenya .payslip-personal { border-top: 1px solid #22a06b; border-bottom: 1px solid #22a06b; padding: 4px 0; margin-top: 6px; }
.payslip-kenya .payslip-personal-table td { padding: 2px 8px; font-size: 11px; border: 0; }
.payslip-kenya .payslip-personal-table td:nth-child(1),
.payslip-kenya .payslip-personal-table td:nth-child(3) { width: 18%; font-weight: 500; }
.payslip-kenya .payslip-personal-table td:nth-child(2),
.payslip-kenya .payslip-personal-table td:nth-child(4) { width: 32%; }
.payslip-kenya .payslip-personal-table td:nth-child(4) { text-align: right; }
.payslip-kenya .payslip-created { font-size: 11px; margin: 4px 8px; }
.payslip-kenya .payslip-footer-note { font-size: 10px; color: #444; margin: 8px; }
@media print { .payslip-kenya { margin: 0 auto; max-width: none; padding: 0 2mm 8mm; } }

/* v16 theme controls */
html[data-theme="dark"] {
  --bg: #121016;
  --panel: #1b1720;
  --ink: #f4eef7;
  --muted: #b8aebe;
  --line: #38303f;
  --nav: #09080c;
  --nav-line: #2a2430;
  --soft-red: rgba(255, 23, 36, .14);
  --shadow: 0 18px 45px rgba(0,0,0,.34);
}
html[data-theme="dark"] .card,
html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .modal header,
html[data-theme="dark"] .btn,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .todo-item,
html[data-theme="dark"] .quick-users button,
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea { background: var(--panel); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] th { background:#241f2a; color:#d6cadd; }
html[data-theme="dark"] tr:hover td { background:#211b27; }
html[data-theme="dark"] .topbar { background: rgba(18,16,22,.88); }
html[data-theme="dark"] .hero-panel { background: linear-gradient(135deg,#0d0b12 0%,#241b2d 58%,#8f0f18 130%); }
html[data-theme="dark"] .notice { background:#151f33; border-color:#29406f; color:#cbdcff; }
html[data-theme="dark"] .pill { background:#2a2430; color:#efe9f4; }
html[data-theme="dark"] .field label { color:#d8cde0; }

/* v16 document header rule: logo first, company profile after, no overlap */
.stacked-document-header,
.document-export-header.stacked-document-header { display:block; text-align:center; border-bottom:2px solid #111; padding-bottom:12px; margin-bottom:16px; }
.document-export-logo-main { display:flex; justify-content:center; align-items:center; margin-bottom:6px; }
.document-logo-main,
.document-logo.document-logo-main { width:74px; height:56px; max-width:74px; max-height:56px; object-fit:contain; border:0; border-radius:0; background:transparent; padding:0; }
.document-logo-main-fallback,
.document-logo.document-logo-main-fallback { width:74px; height:56px; max-width:74px; max-height:56px; }
.document-export-company-centered h1 { text-align:center; margin:0 0 4px; }
.document-export-company-centered div { text-align:center; }
.document-export-meta-centered { text-align:center; margin-top:6px; }

.payslip-kenya .payslip-logo-main-wrap { text-align:center; padding:8px 6px 4px; }
.payslip-kenya .payslip-logo-wrap { text-align:center; }
.payslip-kenya .payslip-logo-img { width:82px; height:58px; max-width:82px; max-height:58px; object-fit:contain; }
.payslip-kenya .payslip-logo-fallback { width:82px; height:58px; }
.payslip-kenya .payslip-company-block { text-align:center; }
.payslip-kenya .payslip-company-name { text-align:center; }
.payslip-kenya .payslip-company-lines { text-align:center; display:block; }

/* v16 KRA P9A standard fields only */
.p9-table { min-width: 1650px; }
.p9-declaration { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:8px 16px; border:1px solid #111; border-top:0; padding:10px; font-size:12px; background:#fff; }
.p9-declaration div { min-height:22px; }
html[data-theme="dark"] .p9-declaration,
html[data-theme="dark"] .payslip-kenya,
html[data-theme="dark"] .p9-card { background:#fff; color:#111; }
@media print { .p9-declaration { font-size:9px; gap:4px; padding:6px; } }

.nav-section-label{
  margin:14px 12px 7px;
  padding-top:12px;
  border-top:1px solid var(--border);
  color:var(--muted);
  font-size:11px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.08em;
}

/* v20 workflow highlights */
tr.row-warning td { background: rgba(245, 158, 11, 0.12) !important; }
tr.row-danger td { background: rgba(220, 38, 38, 0.08) !important; }
.badge.gray { background: #e5e7eb; color: #374151; }
.badge.yellow { background: #fef3c7; color: #92400e; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.blue { background: #dbeafe; color: #1e40af; }
.hr-document-preview { white-space: pre-wrap; border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: var(--card); line-height: 1.55; }

/* v23 responsive and support refinements */
.help-support { display:grid; gap:14px; }
.help-support .card.flat { border-radius:14px; }
@media (max-width: 680px) {
  .nav { grid-template-columns: 1fr; }
  .top-actions { width:100%; }
  .top-actions .btn, .top-actions label.btn { flex:1 1 160px; }
  .section-title { flex-direction:column; align-items:stretch; }
  .card { padding:16px; border-radius:14px; }
  .hero-panel { padding:22px; min-height:auto; }
  .hero-panel h2 { font-size:34px; }
  th, td { padding:10px 9px; font-size:13px; }
  .modal-backdrop { padding:8px; align-items:start; }
  .modal { max-height:96vh; border-radius:18px; }
  .modal header { padding:14px 16px; }
  .modal .modal-body { padding:16px; }
  .payslip-kenya { width:100%; padding:0 2px 16px; font-size:11px; }
  .payslip-kenya .payslip-personal-table td { display:block; width:100% !important; text-align:left !important; }
}
@media (max-width: 420px) {
  .topbar h1 { font-size:24px; }
  .btn { width:100%; }
  .pill-row { gap:6px; }
  .pill { width:100%; justify-content:center; }
  .kpi strong { font-size:24px; }
  .login-panel, .login-brand { padding:20px; }
}

/* v24 per-user theme selector */
.theme-toggle{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);background:var(--card);border-radius:12px;padding:6px 8px;font-size:12px;color:var(--muted);min-height:38px}
.theme-toggle select{border:0;background:transparent;color:var(--ink);font-weight:700;outline:none;min-width:84px}
html[data-theme="dark"] .theme-toggle select option{background:#18141d;color:#f2eef5}
@media (max-width:720px){.theme-toggle{width:100%;justify-content:space-between}.theme-toggle select{flex:1;text-align:right}}

/* v25 sales tracking grids */
.sales-grid table { min-width: 960px; }
.sales-grid input[type="number"] { width: 110px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); text-align: right; }
.sales-grid .btn-small { min-width: 96px; justify-content: flex-end; }
.row-warning { background: rgba(245, 158, 11, 0.13) !important; }
[data-theme="dark"] .row-warning { background: rgba(245, 158, 11, 0.20) !important; }
.notice.success { border-color: rgba(34, 197, 94, .35); background: rgba(34, 197, 94, .10); }
.notice.alert { border-color: rgba(239, 68, 68, .35); background: rgba(239, 68, 68, .10); }
@media (max-width: 900px) {
  .sales-grid table { min-width: 760px; }
  .sales-grid input[type="number"] { width: 88px; }
}

/* v26 collapsible navigation: desktop icon rail + mobile off-canvas drawer */
.app-shell,
.sidebar,
.main,
.nav button,
.logo-copy,
.nav-label,
.sidebar-bottom,
.topbar { transition: grid-template-columns .18s ease, width .18s ease, transform .18s ease, padding .18s ease, opacity .12s ease; }
.app-shell.sidebar-collapsed { grid-template-columns: 76px 1fr; }
.sidebar-backdrop { display:none; }
.sidebar-toggle { width:40px; height:40px; border:1px solid var(--line); border-radius:12px; background:var(--panel); color:var(--ink); display:inline-grid; place-items:center; font-size:19px; font-weight:900; flex:0 0 auto; }
.sidebar-toggle:hover { box-shadow:0 8px 20px rgba(20, 13, 30, .08); transform:translateY(-1px); }
.sidebar-toggle-inside { margin-left:auto; width:34px; height:34px; background:rgba(255,255,255,.08); color:#fff; border-color:rgba(255,255,255,.16); }
.topbar-title { display:flex; align-items:center; gap:12px; min-width:0; }
.topbar-title > div { min-width:0; }
.app-shell.sidebar-collapsed .logo-block { padding-left:12px; padding-right:12px; }
.app-shell.sidebar-collapsed .logo-row { justify-content:center; gap:0; }
.app-shell.sidebar-collapsed .logo-copy,
.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .nav-section-label,
.app-shell.sidebar-collapsed .user-chip-copy { display:none; }
.app-shell.sidebar-collapsed .sidebar-toggle-inside { display:none; }
.app-shell.sidebar-collapsed .nav { padding-left:8px; padding-right:8px; }
.app-shell.sidebar-collapsed .nav button { justify-content:center; padding:13px 0; gap:0; }
.app-shell.sidebar-collapsed .nav .icon { width:100%; font-size:18px; }
.app-shell.sidebar-collapsed .sidebar-bottom { padding:12px 8px; align-items:center; }
.app-shell.sidebar-collapsed .user-chip { justify-content:center; }
.app-shell.sidebar-collapsed .sidebar-bottom button { display:flex; justify-content:center; align-items:center; padding:10px 0; text-align:center; border-radius:10px; }
.app-shell.sidebar-collapsed .sidebar-bottom button .icon { width:auto; font-size:17px; }

@media (max-width: 850px) {
  .app-shell,
  .app-shell.sidebar-collapsed,
  .app-shell.sidebar-expanded { grid-template-columns: 1fr; }
  .sidebar { position:fixed; z-index:75; top:0; left:0; bottom:0; width:min(310px, 86vw); min-height:100vh; transform:translateX(0); box-shadow:0 24px 70px rgba(0,0,0,.32); }
  .app-shell.sidebar-collapsed .sidebar { transform:translateX(-110%); }
  .app-shell.sidebar-expanded .sidebar-backdrop { display:block; position:fixed; inset:0; z-index:70; border:0; background:rgba(15,10,22,.55); padding:0; }
  .app-shell.sidebar-expanded .logo-copy,
  .app-shell.sidebar-expanded .nav-label,
  .app-shell.sidebar-expanded .nav-section-label,
  .app-shell.sidebar-expanded .user-chip-copy { display:block; }
  .app-shell.sidebar-expanded .sidebar-toggle-inside { display:inline-grid; }
  .app-shell.sidebar-expanded .nav button { justify-content:flex-start; padding:13px 12px; gap:12px; }
  .app-shell.sidebar-expanded .nav .icon { width:18px; }
  .app-shell.sidebar-expanded .sidebar-bottom { display:grid; }
  .app-shell.sidebar-expanded .sidebar-bottom button { display:flex; gap:10px; align-items:center; justify-content:flex-start; }
  .logo-block { padding:18px 16px; }
  .nav { display:grid; grid-template-columns:1fr; max-height:calc(100vh - 178px); overflow:auto; padding:14px 10px; }
  .sidebar-bottom { display:grid; }
  .topbar { position:sticky; top:0; padding:14px 16px; flex-direction:column; align-items:stretch; gap:12px; }
  .topbar-title { width:100%; align-items:flex-start; }
  .topbar-title h1 { line-height:1.05; }
  .content { padding:16px; }
  body:has(.app-shell.sidebar-expanded) { overflow:hidden; }
}

@media (max-width: 420px) {
  .topbar-title { gap:9px; }
  .sidebar-toggle { width:38px; height:38px; }
}

/* v28 sales dashboard cleanup and payslip acknowledgement */
.sales-dashboard-section { margin-bottom: 18px; }
.sales-dashboard-section > .card + .card { margin-top: 18px; }
.sales-rank-bar .bar i { transition: width .25s ease; }
.payslip-acknowledgement { margin-top: 12px; border: 1px solid #22a06b; padding: 0; background: #fff; }
.payslip-acknowledgement p { margin: 10px 8px; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.ack-sign-grid { display: grid; grid-template-columns: 1fr 190px; gap: 12px; padding: 8px; font-size: 11px; }
@media (max-width: 680px) { .ack-sign-grid { grid-template-columns: 1fr; } }


/* v29 unframed uploaded document logos */
.document-logo,
.document-logo.document-logo-main,
.payslip-kenya .payslip-logo-img,
.payslip-pdf-sheet .payslip-logo-img,
.p9-pdf-sheet .document-logo {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  box-shadow: none !important;
}

/* v32 KRA P9A 2025 template structure */
.p9-kra-template-header{background:#fff;color:#111;margin:0 0 10px;padding:4px 0 8px;font-family:Arial,Helvetica,sans-serif}
.p9-kra-template-header .p9-iso{text-align:center;font-size:10px;font-weight:700;margin-bottom:4px}.p9-kra-template-header .p9-kra-title{text-align:center;font-size:14px;line-height:1.15;margin-bottom:5px}.p9-kra-template-header .p9-kra-title span{font-size:10px;font-weight:700}.p9-kra-template-header .p9-appendix{font-size:10px;font-weight:700;margin-bottom:5px}.p9-identity-lines{display:grid;gap:5px;font-size:11px}.p9-identity-lines>div{display:grid;grid-template-columns:auto 1fr auto 1fr;gap:8px;align-items:end}.p9-identity-lines>div:nth-child(2),.p9-identity-lines>div:nth-child(4){grid-template-columns:auto 1fr}.p9-identity-lines span{border-bottom:1px dotted #111;min-height:14px;padding:0 6px}.p9-template-table{table-layout:fixed;font-size:9px}.p9-template-table th,.p9-template-table td{border:1px solid #111!important;color:#111!important}.p9-template-table thead th{background:#d9d9d9!important;color:#111!important;text-align:center;vertical-align:middle;padding:4px 3px;white-space:normal;line-height:1.1}.p9-template-table .p9-header-main th{font-weight:700}.p9-template-table .p9-kshs-row th,.p9-template-table .p9-letter-row th,.p9-template-table .p9-sub-letter-row th{font-size:8px;padding:3px 2px}.p9-template-table tbody td{padding:3px 4px;font-size:9px;line-height:1.05}.p9-template-table .p9-month{font-weight:700;text-align:left}.p9-template-table .p9-total-row td{font-weight:900;background:#f2f2f2!important;border-top:2px solid #111!important}.p9-important-grid{display:grid;grid-template-columns:1.6fr 1fr;gap:18px;margin-top:8px;font-size:10px;color:#111}.p9-important-grid ol{margin:4px 0 0 18px;padding:0}.p9-important-grid li{margin:2px 0}.p9-declaration{border:0!important;border-top:0!important;margin-top:8px;font-size:11px;display:grid;grid-template-columns:1fr 1fr;gap:8px}.p9-declaration div:nth-child(n+3){grid-column:auto}.p9-template-section h3{font-size:13px;text-transform:uppercase;margin-bottom:5px}.p9-table-wrap{border:0!important}
@media(max-width:900px){.p9-identity-lines>div{grid-template-columns:1fr}.p9-identity-lines strong{margin-top:4px}.p9-important-grid{grid-template-columns:1fr}.p9-template-table{min-width:1500px}.p9-table-wrap{overflow:auto!important}}

/* v33 P9A company logo/header and readable column titles */
.p9-company-header{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;border-bottom:1px solid #111;padding:4px 0 8px;margin-bottom:8px;background:#fff;color:#111}
.p9-company-header .document-logo{width:96px;height:58px;object-fit:contain;border:0!important;background:transparent!important;padding:0!important;box-shadow:none!important}
.p9-company-name{font-size:15px;font-weight:800;line-height:1.2;margin-top:2px;color:#111}
.p9-company-details{font-size:10px;line-height:1.25;color:#111;max-width:1100px}
.p9-template-table thead th{word-break:normal!important;overflow-wrap:normal!important;hyphens:none!important;white-space:normal!important;line-height:1.18!important}
.p9-template-table{min-width:1900px!important}
@media print{.p9-company-header .document-logo{border:0!important;background:transparent!important;padding:0!important;box-shadow:none!important}}

/* v35 employee search and HR issue letterhead */
.search-card input { width:100%; }
.compact-title { margin-bottom:10px; }
.hr-letterhead { border-bottom:1px solid var(--line); margin:0 0 16px; padding:0 0 14px; text-align:center; display:grid; gap:8px; }
.hr-letterhead-logo { display:flex; justify-content:center; align-items:center; }
.hr-letterhead-img { max-width:160px; max-height:70px; width:auto; height:auto; border:0!important; background:transparent!important; box-shadow:none!important; padding:0!important; object-fit:contain; }
.hr-letterhead-company h2 { margin:0 0 4px; font-size:18px; }
.hr-letterhead-company div { font-size:12px; color:var(--muted); line-height:1.4; }
.hr-letterhead-title { display:grid; gap:2px; font-size:13px; }
.hr-letterhead-title span { color:var(--muted); font-size:11px; }
@media (max-width: 720px) { .search-card .form-grid { grid-template-columns:1fr; } .search-card .field[style] { grid-column:auto!important; } }

/* v37 HR issue template manager */
.template-download-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); gap:10px; margin-top:10px; }
.template-checklist { margin:12px 0; border-left:4px solid var(--accent); }
.template-check-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:8px 14px; margin-top:10px; }
.template-check { display:flex; align-items:center; gap:8px; padding:8px 10px; border:1px solid var(--line); border-radius:10px; background:var(--panel); font-size:13px; }
.template-check input { width:16px; height:16px; accent-color:var(--accent); }
.hr-letterhead .document-logo { max-height:72px; max-width:210px; object-fit:contain; }
@media (max-width:720px){ .template-check-grid,.template-download-grid{ grid-template-columns:1fr; } }

/* v38 HR issue Word-template editor */
.word-template-shell {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,248,252,.96));
  padding: 16px;
  margin: 14px 0;
}
.word-template-shell .hr-letterhead {
  margin-bottom: 14px;
}
.word-template-shell textarea {
  background: #fff;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}
.hr-word-body {
  white-space: pre-wrap;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  line-height: 1.5;
}
.template-checklist {
  margin-top: 12px;
}
.template-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}
.template-check {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  font-size: .9rem;
}
.template-check input {
  width: 16px;
  height: 16px;
}

/* v39 visual HR Word templates */
.word-template-shell {
  background: #f6f7f9;
  overflow-x: auto;
}
.word-template-shell .hr-word-letterhead,
.hr-word-letterhead {
  border: 0;
  display: block;
  text-align: initial;
  padding: 0;
  margin: 0 0 18px;
}
.hr-word-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  width: 100%;
}
.hr-word-letterhead .hr-letterhead-logo {
  justify-content: flex-start;
  flex: 0 0 240px;
}
.hr-word-letterhead .document-logo,
.hr-word-letterhead .hr-letterhead-img {
  max-width: 220px;
  max-height: 82px;
  object-fit: contain;
  border: 0!important;
  background: transparent!important;
  box-shadow: none!important;
  padding: 0!important;
}
.hr-word-letterhead .hr-letterhead-company {
  flex: 1;
  text-align: right;
  color: #2c2d33;
}
.hr-word-letterhead .hr-letterhead-company h2 {
  margin: 0 0 3px;
  font-size: 15px;
  line-height: 1.2;
  color: #2c2d33;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.hr-word-letterhead .hr-letterhead-company div {
  font-size: 11px;
  color: #2c2d33;
  line-height: 1.35;
}
.hr-word-letterhead .hr-letterhead-company small {
  display: block;
  margin-top: 5px;
  color: #91aa16;
  font-weight: 800;
}
.hr-word-green-rule {
  border-top: 7px solid #b4d334;
  margin-top: 18px;
}
.hr-template-editor-field label {
  margin-bottom: 8px;
}
.hr-template-editor {
  width: 100%;
  min-width: 780px;
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 30px;
  background: #fff;
  border: 1px solid #d9dee4;
  border-radius: 0;
  color: #2c2d33;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10pt;
  line-height: 1.28;
  overflow: auto;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
}
.hr-template-editor[contenteditable="true"]:focus {
  outline: 2px solid rgba(255, 28, 47, .38);
  outline-offset: 4px;
}
.hr-template-editor[contenteditable="false"] {
  background: #fafafa;
}
.hr-document-html table {
  border-collapse: collapse;
  max-width: 100%;
}
.hr-document-html td,
.hr-document-html th {
  vertical-align: top;
}
.hr-document-html p {
  margin-top: 0;
  margin-bottom: 7px;
}
.hr-document-html center {
  display: block;
  text-align: center;
}
.hr-document-html img {
  max-width: 100%;
  height: auto;
}
.hr-check-symbol {
  display: inline-block;
  min-width: 1em;
  cursor: pointer;
  font-family: "Segoe UI Symbol", "Arial Unicode MS", Arial, sans-serif;
  font-weight: 800;
  color: #111827;
  user-select: none;
}
.hr-check-symbol:hover {
  transform: scale(1.08);
}
.legacy-template-html p {
  margin: 0 0 7px;
}
@media (max-width: 860px) {
  .hr-template-editor { min-width: 720px; padding: 22px; }
  .hr-word-head-row { min-width: 720px; }
}

/* v40 sales entry freeze panes and uploaded-template style */
.sales-freeze-grid { max-height: 72vh; position: relative; }
.sales-freeze-grid table { border-collapse: separate; border-spacing: 0; min-width: 1400px; }
.sales-freeze-grid th { position: sticky; top: 0; z-index: 4; background: var(--panel); }
.sales-freeze-grid thead tr:nth-child(2) th { top: 38px; z-index: 4; }
.sales-freeze-grid .sticky-col,
.sales-freeze-grid .sticky-col-2 { position: sticky; background: var(--panel); z-index: 5; box-shadow: 1px 0 0 var(--line); }
.sales-freeze-grid .sticky-col { left: 0; min-width: 116px; }
.sales-freeze-grid .sticky-col-2 { left: 116px; min-width: 118px; }
.sales-freeze-grid thead .sticky-col,
.sales-freeze-grid thead .sticky-col-2 { z-index: 7; }
.sales-freeze-grid .date-cell,
.sales-freeze-grid .day-cell { text-align:left; white-space:nowrap; }
.shop-wide-sales .sticky-col { min-width: 124px; }
.employee-wide-sales .sticky-col { min-width: 116px; }
.employee-wide-sales .sticky-col-2 { left: 116px; min-width: 124px; }
.shop-branch-title { text-transform: uppercase; font-weight: 900; text-align:center; background: rgba(245, 158, 11, .12) !important; }
.branch-separator { background: #fff200 !important; min-width: 10px; width: 10px; padding: 0 !important; border-color: #fff200 !important; }
.sales-total-row td { font-weight: 900; background: rgba(15, 23, 42, .06); border-top: 2px solid var(--ink); }
[data-theme="dark"] .sales-freeze-grid .sticky-col,
[data-theme="dark"] .sales-freeze-grid .sticky-col-2,
[data-theme="dark"] .sales-freeze-grid th { background: var(--panel); }

/* v41: keep session/logout controls directly after the last visible dashboard menu item */
.nav .nav-session-actions {
  margin-top: 8px !important;
  border-top: 1px solid var(--nav-line);
  padding: 12px 4px 4px;
  display: grid;
  gap: 10px;
}
.sidebar-bottom.nav-session-actions button {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  padding: 10px 8px;
}
.app-shell.sidebar-collapsed .nav .nav-session-actions {
  padding-left: 0;
  padding-right: 0;
}

.secure-login-note{margin-top:14px;text-align:center;font-size:12px}

/* v43: notification counters and tasks/reminders UI */
.nav-badge {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ff1724;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 6px 14px rgba(255,23,36,.28);
}
.nav button.active .nav-badge { background:#fff; color:var(--danger); }
.count-pill {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--soft-red);
  color: var(--danger);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .02em;
  vertical-align: middle;
}
.app-shell.sidebar-collapsed .nav-badge {
  position: absolute;
  right: 7px;
  top: 5px;
  margin-left: 0;
  transform: scale(.86);
}
.app-shell.sidebar-collapsed .nav button { position: relative; }

/* v45: dashboard maintenance, task sharing controls, sales daily totals */
.dashboard-maintenance-list { display: grid; gap: 10px; }
.dashboard-maintenance-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; background: var(--panel); }
.dashboard-maintenance-row .top-actions { justify-content: flex-end; }
.daily-shop-total-head, .daily-shop-total { background: rgba(34, 160, 107, .12) !important; font-weight: 900; min-width: 145px; }
.sales-total-row .daily-shop-total { background: rgba(34, 160, 107, .22) !important; }
@media (max-width: 760px) { .dashboard-maintenance-row { align-items: flex-start; flex-direction: column; } }

/* v46: digital company stamp and separated sales report controls */
.company-stamp-preview { min-width: 122px; min-height: 96px; justify-content: center; border: 1px dashed var(--line); border-radius: 12px; background: #fff; }
.company-stamp-preview-img { max-width: 132px; max-height: 96px; object-fit: contain; border: 0 !important; background: transparent !important; padding: 0 !important; box-shadow: none !important; }
.company-stamp-preview-img-fallback { display: grid; place-items: center; width: 132px; height: 84px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 11px; font-weight: 800; text-align: center; padding: 8px; }
.company-stamp-approval-preview { display: flex; justify-content: center; align-items: center; margin: 12px 0; padding: 12px; border: 1px dashed var(--line); border-radius: 14px; background: #fff; }
.digital-stamp-block { pointer-events: none; }
.disabled { opacity: .6; }

/* v50: module controls and organized settings hierarchy */
.module-control-card { border: 1px solid var(--line); }
.settings-main-card > form > h3,
.settings-subhead {
  grid-column: 1 / -1;
  margin: 18px 0 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,23,36,.08);
  color: var(--ink);
  font-weight: 900;
  letter-spacing: .02em;
}
.settings-main-card > form > p.small { margin-top: -4px; margin-bottom: 12px; }
.module-control-card .table-wrap table td { vertical-align: top; }

/* v52: gender-specific leave indicators */
.badge.purple { background:#f3e8ff; color:#6b21a8; }
[data-gender-leave] { min-width: 0; }

/* v54 security and read-only HR document controls */
.link-button { border:0; background:transparent; color:var(--danger); font-weight:800; cursor:pointer; padding:0; text-decoration:underline; }
.employee-readonly-document .hr-doc-viewonly,
.hr-doc-viewonly { border:1px solid var(--line); border-radius:14px; background:var(--panel); padding:18px; max-height:62vh; overflow:auto; pointer-events:auto; user-select:text; }
.employee-readonly-document input,
.employee-readonly-document textarea,
.employee-readonly-document select,
.hr-doc-viewonly input,
.hr-doc-viewonly textarea,
.hr-doc-viewonly select { pointer-events:none; user-select:none; }
.secure-login-note .link-button { font-size:12px; }

/* v55 collapsible dashboard sections */
.collapse-card {
  margin: 0 0 18px;
  padding: 0;
  overflow: hidden;
}
.collapse-card > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  user-select: none;
}
.collapse-card > summary::-webkit-details-marker { display: none; }
.collapse-card > summary strong {
  display: block;
  font-family: var(--serif);
  font-size: 20px;
  color: var(--ink);
}
.collapse-card > summary span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.collapse-card > summary i {
  flex: 0 0 auto;
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
  color: var(--danger);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--surface);
}
.collapse-card:not([open]) > summary { border-bottom: 0; }
.collapse-card .collapse-body {
  padding: 18px;
}
.collapse-card .collapse-body > .card,
.collapse-card .collapse-body > section.card {
  box-shadow: none;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}
.report-group {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: var(--panel);
}
.report-group h4 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 18px;
}

/* v57: collapsible Settings sections */
.settings-collapse-stack { display: grid; gap: 16px; margin-top: 18px; }
.settings-main-card { padding: 0; background: transparent; border: 0; box-shadow: none; }
.settings-main-card .collapse-card { margin-bottom: 16px; }
.settings-main-card .collapse-card .collapse-body { padding-top: 14px; }
.danger-flat { border-color: rgba(231, 42, 54, .35) !important; background: rgba(231, 42, 54, .04) !important; }
.settings-collapse-stack .card.flat, .settings-main-card .card.flat { box-shadow: none; }
