:root {
  --bg: #140f0b;
  --card: #fff8ee;
  --card-2: #fffdf8;
  --text: #20140d;
  --muted: #7c6a5f;
  --line: rgba(77, 43, 21, 0.16);
  --brand: #f28c18;
  --brand-dark: #6b3510;
  --green: #176b4d;
  --shadow: 0 24px 70px rgba(16, 8, 3, 0.22);

  --seg-net: #176b4d;
  --seg-paye: #f28c18;
  --seg-nssf: #2f6fb0;
  --seg-shif: #0f9d8f;
  --seg-ahl: #8c4fd1;
  --seg-other: #a08a7a;

  --seg-nssf-tint: rgba(47, 111, 176, .12);
  --seg-shif-tint: rgba(15, 157, 143, .12);
  --seg-ahl-tint: rgba(140, 79, 209, .12);
}

* { box-sizing: border-box; min-width: 0; }

/* Author rules like .hero-card{display:flex} otherwise beat the UA [hidden]
   default regardless of source order, since author CSS always wins over UA
   CSS in the cascade. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Outfit', system-ui, sans-serif;
  color: var(--text);
  overflow-wrap: break-word;
  background:
    radial-gradient(circle at top left, rgba(242, 140, 24, .35), transparent 35%),
    linear-gradient(135deg, #21130b 0%, #3a1d0d 45%, #0f100e 100%);
}

button, input { font: inherit; }

abbr[title] {
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  cursor: help;
}

svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-shell {
  width: min(1520px, calc(100% - clamp(16px, 5vw, 32px) * 2));
  margin: clamp(12px, 4vw, 32px) auto;
}

.hero-card,
.layout-grid,
.input-panel,
.results-panel,
.breakdown-card,
.net-card {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-card {
  display: flex;
  justify-content: space-between;
  gap: clamp(16px, 4vw, 24px);
  align-items: center;
  padding: clamp(18px, 4vw, 28px);
  border-radius: clamp(18px, 4vw, 28px);
  background: linear-gradient(135deg, rgba(255,248,238,.96), rgba(255,255,255,.9));
  margin-bottom: clamp(6px, 1.5vw, 10px);
}

.payslip-print-header { text-align: center; margin-bottom: 10px; }
.payslip-print-header img { display: block; margin: 0 auto 6px; }
.payslip-print-logo { max-height: 64px; max-width: 200px; object-fit: contain; }
.payslip-print-business-name { margin: 0; font-weight: 800; color: var(--brand-dark); }

/* Deliberately not .hero-copy: that class is forced to display:none under
   @media print (see below) for the calculator's own hero-card tagline, and
   there's no printing-payslip override that re-enables it -- reusing it
   here would silently drop these lines from the actual printed payslip. */
.payslip-print-line { margin: 2px 0 0; font-size: .85rem; color: var(--muted); }

.credit-line {
  margin: 0 0 clamp(10px, 2.5vw, 16px);
  padding: 0 8px;
  text-align: center;
  font-size: .68rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, .55);
}

.credit-line strong { color: rgba(255, 255, 255, .85); font-weight: 700; }

.credit-line a {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.credit-line a:hover { text-decoration: underline; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--brand-dark);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: clamp(.68rem, 1.6vw, .78rem);
}

.eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(242, 140, 24, .18);
}

h1, h2 { margin: 0; }

h1 {
  max-width: 760px;
  font-size: clamp(1.7rem, 6vw, 4.3rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.hero-copy {
  margin: clamp(10px, 2vw, 14px) 0 0;
  max-width: 720px;
  color: var(--muted);
  font-size: clamp(.88rem, 2vw, 1.05rem);
}

.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: clamp(10px, 2.4vw, 12px) clamp(14px, 3vw, 20px);
  cursor: pointer;
  font-weight: 800;
  font-size: clamp(.86rem, 2vw, 1rem);
  white-space: nowrap;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.primary-button { background: var(--brand); color: #1c1008; }
.ghost-button { background: #fff; color: var(--brand-dark); border: 1px solid var(--line); }

.primary-button:hover,
.ghost-button:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(16, 8, 3, .18); }
.primary-button:active,
.ghost-button:active { transform: translateY(0); box-shadow: none; }
.primary-button:focus-visible,
.ghost-button:focus-visible { outline: 3px solid rgba(242, 140, 24, .5); outline-offset: 2px; }

/* Grayed-out "nothing to save" state, distinct from the loading/in-flight
   disabled state (both use the disabled attribute, but visually this
   should read as "unchanged" rather than "busy"). */
.primary-button:disabled,
.primary-button:disabled:hover,
.primary-button:disabled:active {
  background: var(--line);
  color: var(--muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(440px, 1.1fr);
  gap: 20px;
  padding: 18px;
  border-radius: 30px;
  background: rgba(255, 255, 255, .12);
  backdrop-filter: blur(14px);
}

.input-panel,
.results-panel {
  border-radius: 24px;
  background: var(--card-2);
  padding: 18px;
}

.results-panel {
  position: sticky;
  top: 18px;
  align-self: start;
  display: grid;
  gap: 14px;
}

.panel-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.panel-header span,
.hint,
.net-card span,
.net-card small,
.summary-cards span {
  color: var(--muted);
}

/* h2 defaults to --text (near-black), meant for headings inside the
   light .employees-directory/.employees-form cards. The Leave page's
   title sits directly on .employees-page's translucent-on-dark panel
   instead (same background as .app-nav), so it needs light text. */
.page-title-on-dark { color: rgba(255, 255, 255, .92); }

.tab-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  margin-bottom: 16px;
  border-radius: 16px;
  background: rgba(77, 43, 21, 0.06);
  border: 1px solid var(--line);
}

.tab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  font-size: clamp(.84rem, 2vw, .95rem);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.tab-btn svg { color: currentColor; }

.tab-btn:hover { color: var(--brand-dark); }

.tab-btn[aria-selected="true"] {
  background: #fff;
  color: var(--brand-dark);
  box-shadow: 0 6px 16px rgba(16, 8, 3, .12);
}

.tab-btn:focus-visible {
  outline: 3px solid rgba(242, 140, 24, .5);
  outline-offset: 2px;
}

.tab-intro {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(242, 140, 24, .08);
}

.proceed-button {
  display: flex;
  width: 100%;
  margin-top: 4px;
}

.proceed-button svg { margin-left: auto; }

.input-group {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.input-group:hover { border-color: rgba(242, 140, 24, .4); }

.input-group summary {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 800;
  color: var(--brand-dark);
  list-style: none;
  border-radius: 10px;
  padding: 4px 6px;
  margin: -4px -6px;
}

.input-group summary::-webkit-details-marker { display: none; }

.input-group summary:hover { background: rgba(242, 140, 24, .08); }

.input-group summary::after {
  content: '';
  width: 9px;
  height: 9px;
  margin-left: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .2s ease;
  opacity: .7;
}

.input-group[open] summary::after { transform: rotate(45deg); }

.input-group summary svg { color: var(--brand); }

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
}

.field-grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.settings-logo-row { display: flex; align-items: center; gap: 16px; margin-top: 14px; flex-wrap: wrap; }

.settings-logo-preview {
  width: 96px;
  height: 96px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffaf3;
  padding: 8px;
  text-align: center;
}

.settings-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.settings-logo-preview .hint { margin: 0; }

.settings-logo-controls { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 220px; }

.settings-logo-upload-label { align-self: flex-start; cursor: pointer; }

.settings-logo-url-row { display: flex; gap: 8px; }
.settings-logo-url-row input { flex: 1; }

label {
  display: grid;
  gap: 7px;
  color: #4b3428;
  font-size: .88rem;
  font-weight: 700;
}

/* A bare <label><input type="checkbox"/> Text</label> would otherwise
   inherit label's display:grid above, which puts the checkbox and its
   text on separate grid rows instead of side by side. */
label:has(> input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

/* input's width:100% below is meant for text-like fields; a checkbox
   already matches the bare `input` selector, so without this it stretches
   to fill the row and shoves its label text far to the right. */
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: none;
  accent-color: var(--brand);
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 13px;
  color: var(--text);
  background: #fffaf3;
  outline: none;
  font-family: inherit;
  font-size: .95rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(242, 140, 24, .75);
  box-shadow: 0 0 0 4px rgba(242, 140, 24, .14);
}

input:disabled, select:disabled, textarea:disabled {
  background: rgba(77, 43, 21, .05);
  color: #a3897a;
  cursor: not-allowed;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b3510' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 15px;
  cursor: pointer;
}
select:disabled { cursor: not-allowed; }

textarea {
  resize: vertical;
  min-height: 68px;
  line-height: 1.4;
}

.field-disabled { opacity: .55; }
.field-disabled::after { content: " (not used for this classification)"; font-weight: 500; font-size: .78em; color: #a3897a; }

.hint { font-size: .82rem; margin-bottom: 0; }

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 4px;
  width: 100%;
  max-width: 360px;
}

.auth-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.auth-error { margin: 0; color: #b3261e; font-size: .85rem; font-weight: 600; }
.auth-info { margin: 0; color: #1a7a3c; font-size: .85rem; font-weight: 600; }

.password-field { position: relative; display: flex; }
.password-field input { padding-right: 44px; }

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: #8a7264;
  cursor: pointer;
  border-radius: 50%;
}

.password-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.password-toggle:hover { color: var(--brand-dark); background: rgba(242, 140, 24, .12); }

.password-toggle.is-visible { position: absolute; }
.password-toggle.is-visible::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: 50%;
  height: 1.6px;
  background: currentColor;
  transform: rotate(-45deg);
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  font-weight: 700;
  font-size: .85rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  justify-self: start;
}
.link-button:hover { color: var(--brand); }

.classification-row {
  display: grid;
  gap: 6px;
  margin: 14px 0 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(242, 140, 24, .08);
  position: relative;
}
.classification-row .field-label {
  font-size: .88rem;
  font-weight: 700;
  color: #4b3428;
}
.classification-row .hint { margin-top: 2px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.classification-dropdown { position: relative; }

.classification-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fffaf3;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}
.classification-trigger:hover { border-color: var(--brand); }
.classification-trigger:focus-visible { outline: 3px solid rgba(242, 140, 24, .5); outline-offset: 2px; }

.classification-trigger-text { flex: 1; }

.classification-chevron {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .15s ease;
}
.classification-trigger[aria-expanded="true"] .classification-chevron { transform: rotate(180deg); }

.classification-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  gap: 6px;
  padding: 8px;
  background: var(--card, #fff8ee);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 36px rgba(16, 8, 3, .22);
}

.classification-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 9px 10px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background-color .12s ease, border-color .12s ease;
}
.classification-option:hover { background: rgba(242, 140, 24, .1); }
.classification-option.is-selected { background: rgba(242, 140, 24, .16); border-color: var(--brand); }

.classification-option .option-text { display: grid; gap: 2px; }
.classification-option strong { font-size: .88rem; color: var(--text); }
.classification-option small { font-size: .76rem; color: #7a6353; line-height: 1.3; }

.option-icon { font-size: 1.15rem; line-height: 1; flex: none; }

.classification-option.simple { align-items: center; font-size: .88rem; font-weight: 700; color: var(--text); }
.lookup-dropdown .classification-panel { max-height: 240px; overflow-y: auto; }

.searchable-dropdown .classification-panel { max-height: 300px; overflow-y: auto; }
.dropdown-search-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: #fffaf3;
  font-weight: 600;
  font-size: .88rem;
}
.dropdown-search-input:focus {
  border-color: rgba(242, 140, 24, .75);
  box-shadow: 0 0 0 3px rgba(242, 140, 24, .14);
  outline: none;
}
.classification-options-scroll { display: grid; gap: 6px; }
.classification-options-scroll .hint { padding: 6px 4px; }
.purchase-modal-footer { margin-top: 16px; text-align: center; }

.payroll-detail-row { cursor: pointer; }
.payroll-detail-row:hover { background: rgba(242, 140, 24, .08); }
.payroll-detail-row.is-expanded { background: rgba(242, 140, 24, .1); }
.row-expand-icon {
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: -2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .15s ease;
  color: var(--muted);
}
.payroll-detail-row.is-expanded .row-expand-icon { transform: rotate(90deg); color: var(--brand); }
.payroll-detail-expand-row td {
  background: var(--card-2);
  padding: 16px clamp(10px, 3vw, 20px) 20px;
}
.payroll-detail-expand-row .breakdown-card { margin-top: 0; }
.payroll-detail-expand-row .breakdown-card + .breakdown-card { margin-top: 14px; }

.business-expand-row td { background: var(--card-2); padding: 14px clamp(10px, 3vw, 20px) 18px; }
.business-block-btn { margin-left: 8px; }

.net-card-classification {
  display: block;
  margin-top: 4px;
  opacity: .9;
}

.admin-preview-dropdown { position: relative; }

.admin-preview-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  display: grid;
  gap: 4px;
  min-width: 180px;
  padding: 8px;
  background: var(--card, #fff8ee);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 36px rgba(16, 8, 3, .22);
}

.admin-preview-menu button {
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
  background: transparent;
  color: #4b3428;
  font-weight: 700;
  font-size: .84rem;
  text-align: left;
  cursor: pointer;
}
.admin-preview-menu button:hover { background: rgba(242, 140, 24, .12); }
.admin-preview-menu button.is-exit { color: var(--brand-dark); border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 10px; }

.notification-bell-wrap { position: relative; }
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
}
.app-nav-btn[aria-selected="true"] .nav-badge { background: var(--brand-dark); }

.notification-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: .62rem;
  font-weight: 800;
}
.notification-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: min(320px, 84vw);
  max-height: 320px;
  overflow-y: auto;
  padding: 10px;
  background: var(--card, #fff8ee);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 36px rgba(16, 8, 3, .22);
}
.notification-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 4px;
  background: rgba(242, 140, 24, .08);
  cursor: pointer;
  font-size: .8rem;
  color: var(--brand-dark);
  font-weight: 700;
}
.notification-item:last-child { margin-bottom: 0; }
.notification-item.is-read { background: transparent; color: var(--muted); font-weight: 400; }
.notification-item small { display: block; color: var(--muted); font-size: .7rem; margin-top: 2px; }

.approval-list { display: grid; gap: 8px; margin-top: 10px; }
.approval-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fffaf3;
}
.approval-item p { margin: 0 0 8px; font-size: .84rem; }
.approval-item textarea { width: 100%; margin-bottom: 8px; font-size: .82rem; }
.approval-item .auth-actions { gap: 8px; }

.approval-payroll-detail { margin: 0 0 8px; }
.approval-payroll-detail summary { cursor: pointer; font-size: .8rem; font-weight: 700; color: var(--brand-dark); }
.approval-payroll-detail ul { margin: 6px 0 0; padding-left: 18px; font-size: .8rem; color: var(--text); }
.approval-payroll-detail li { margin-bottom: 2px; }

/* Already-decided items (read-only, no textarea/buttons) sit lighter
   than pending ones so the actionable cards stay visually primary --
   but still an opaque light card, not transparent: .approval-list sits
   directly on .employees-page's dark translucent panel, and the
   --muted/--brand-dark/status-pill text below assumes a light card
   backdrop. Transparent here let it inherit the dark panel instead,
   making everything below near-illegible. */
.approval-item-decided { background: var(--card); }
.approval-item-decided p:last-child { margin-bottom: 0; }
.approval-decision-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.approval-decision-line .hint { margin: 0; }

.access-banner {
  margin-bottom: clamp(6px, 1.5vw, 10px);
  padding: 10px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card, #fff8ee);
  color: var(--brand-dark);
  font-weight: 700;
  font-size: .85rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.blurred {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}

.purchase-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 8, 3, .55);
  backdrop-filter: blur(2px);
}

.purchase-modal {
  position: relative;
  width: 100%;
  max-width: 620px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--card, #fdf6ec);
  border-radius: 24px;
  border: 1px solid var(--line);
  padding: clamp(20px, 4vw, 32px);
  box-shadow: 0 30px 60px rgba(16, 8, 3, .35);
}

.why-buy {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(242, 140, 24, .1);
  border: 1px solid rgba(242, 140, 24, .3);
}

.why-buy strong {
  display: block;
  margin-bottom: 4px;
  color: var(--brand-dark);
  font-size: .85rem;
}

.why-buy p {
  margin: 0;
  font-size: .82rem;
  line-height: 1.45;
  color: #4b3428;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand-dark);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: rgba(242, 140, 24, .12); }

.passcode-modal { max-width: 380px; text-align: center; }
.passcode-modal-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: rgba(242, 140, 24, .12);
  color: var(--brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}
.passcode-modal-icon svg { width: 26px; height: 26px; }
.passcode-modal h2 { margin: 0 0 8px; }
.passcode-modal .hint { margin: 0 0 18px; }
.passcode-modal form label { display: block; text-align: left; margin-bottom: 14px; font-size: .85rem; font-weight: 700; color: var(--brand-dark); }
.passcode-modal input[type="password"] { width: 100%; margin-top: 6px; text-align: center; letter-spacing: .35em; font-size: 1.15rem; }
.passcode-modal .auth-actions { justify-content: center; }

.package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.package-btn {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 10px;
  background: #fffaf3;
  cursor: pointer;
  text-align: center;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.package-btn:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: 0 8px 18px rgba(16, 8, 3, .14); }
.package-btn:disabled { opacity: .6; cursor: default; transform: none; box-shadow: none; }

.package-days { font-weight: 800; font-size: .95rem; color: var(--text); }
.package-amount { font-weight: 700; color: var(--brand-dark); }
.package-rate { font-size: .72rem; color: #8a7264; }

.net-card {
  border-radius: 24px;
  padding: 22px;
  background: linear-gradient(135deg, #241208, #69360e 55%, #f28c18);
  color: #fff;
}

.net-card span,
.net-card small { color: rgba(255,255,255,.75); }
.net-card strong { display: block; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1; margin: 8px 0; white-space: nowrap; overflow-wrap: normal; word-break: keep-all; }

.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.summary-cards div {
  padding: 14px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  transition: transform .15s ease, box-shadow .15s ease;
}

.summary-cards div:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(16, 8, 3, .1); }

.summary-cards span { font-size: .82rem; }

.summary-cards strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(.92rem, 1.6vw, 1.15rem);
  transition: color .2s ease;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
}

.breakdown-card {
  background: #fff;
  border-radius: 22px;
  padding: 18px;
}

.breakdown-card h2 { font-size: 1rem; margin-bottom: 12px; }

.breakdown-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

.breakdown-col + .breakdown-col {
  border-left: 1px dashed var(--line);
  padding-left: 20px;
}

.breakdown-col h3 {
  margin: 0 0 8px;
  font-size: .74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--brand-dark);
}

.breakdown-net {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px solid var(--line);
}

.breakdown-net .result-row { padding: 0; border-bottom: 0; font-size: 1.05rem; }

.result-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  color: #4b3428;
}

.result-row:last-child { border-bottom: 0; }
.result-row span { flex: 1 1 auto; }
.result-row strong {
  flex: 0 0 auto;
  color: var(--text);
  text-align: right;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
}
.result-row.highlight { color: var(--green); font-weight: 800; }

@media (max-width: 900px) {
  .hero-card { align-items: flex-start; flex-direction: column; }
  .layout-grid { grid-template-columns: 1fr; }
  .results-panel { position: static; }
}

@media (max-width: 760px) {
  .summary-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .app-shell { width: min(100% - 14px, 1520px); margin: 8px auto; }
  .hero-card, .layout-grid { border-radius: 18px; padding: 12px; }
  .input-panel, .results-panel { padding: 10px; }
  .field-grid.two-col { grid-template-columns: 1fr; }
  .field-grid { gap: 8px; }

  .breakdown-columns { grid-template-columns: 1fr; gap: 12px 0; }
  .breakdown-col + .breakdown-col {
    border-left: 0;
    padding-left: 0;
    border-top: 1px dashed var(--line);
    padding-top: 10px;
  }

  /* Compact but still >=16px so mobile Safari doesn't zoom in on focus */
  input { padding: 8px 10px; font-size: 16px; }
  label { font-size: .78rem; }
  .input-group { padding: 8px 10px; }
  .input-group summary { font-size: .84rem; gap: 7px; }
  .earning-line { padding: 6px; gap: 6px; }

  .hero-actions { gap: 6px; }
  .primary-button, .ghost-button { padding: 7px 12px; font-size: .78rem; }

  .tab-btn { font-size: .78rem; padding: 7px 6px; }
  .tab-intro { padding: 8px 10px; font-size: .8rem; }

  /* Force "Affects" + chips onto their own line, every time, instead of an
     unpredictable partial wrap depending on label width. */
  .stat-toggles { flex-basis: 100%; gap: 4px; margin-top: 2px; padding-top: 5px; }
  .stat-toggles > span { font-size: .58rem; }
  .stat-toggles label { padding: 3px 7px 3px 6px; font-size: .62rem; gap: 3px; }
  .stat-toggles input[type="checkbox"] { width: 11px; height: 11px; }

  .summary-cards div { padding: 10px; }
  .summary-cards span { font-size: .74rem; }
  .summary-cards strong { font-size: .88rem; margin-top: 3px; }

  .result-row { padding: 7px 0; font-size: .84rem; }
  .breakdown-card { padding: 12px; }
  .breakdown-card h2 { font-size: .9rem; }

  .classification-panel { max-height: 70vh; overflow-y: auto; }
  .classification-trigger { padding: 8px 10px; }
  .classification-option { padding: 7px 8px; }
  .classification-option strong { font-size: .82rem; }
  .classification-option small { font-size: .7rem; }

  .purchase-modal { padding: 16px; }
  .package-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 7px; }
  .package-btn { padding: 10px 6px; }
  .package-days { font-size: .84rem; }
  .package-rate { font-size: .64rem; }
}

/* Sub-4-inch phones (~360px and narrower) — micro type and boxes, and
   content centred rather than left-aligned like a document. */
@media (max-width: 420px) {
  .app-shell { width: min(100% - 10px, 1520px); margin: 6px auto; }
  .hero-card, .layout-grid { padding: 9px; border-radius: 14px; }
  .input-panel, .results-panel { padding: 7px; }

  .hero-card { text-align: center; align-items: center; }
  .hero-actions { justify-content: center; }
  .auth-actions { justify-content: center; }
  .link-button { justify-self: center; }
  .eyebrow { justify-content: center; font-size: .56rem; }
  h1 { font-size: 1.15rem; }
  .hero-copy { font-size: .7rem; }
  .credit-line { font-size: .6rem; }

  .panel-header { flex-direction: column; align-items: center; text-align: center; gap: 2px; margin-bottom: 8px; }
  .panel-header h2 { font-size: 1rem; }
  .classification-row { text-align: center; padding: 8px 10px; }
  .field-label { font-size: .78rem; }
  .access-banner { font-size: .68rem; padding: 6px 10px; }

  .net-card { text-align: center; padding: 12px; }
  .net-card strong { font-size: 1.4rem; margin: 4px 0; }
  .net-card span, .net-card small { font-size: .7rem; }
  .summary-cards { grid-template-columns: 1fr; gap: 6px; }
  .summary-cards div { padding: 8px 10px; }
  .summary-cards span { font-size: .7rem; }
  .summary-cards strong { font-size: .82rem; }

  input { padding: 7px 9px; font-size: 16px; border-radius: 10px; }
  label { font-size: .7rem; gap: 4px; }
  .input-group { padding: 6px 7px; border-radius: 14px; }
  .input-group summary { font-size: .76rem; gap: 6px; }
  .field-grid { gap: 6px; margin-top: 10px; }
  .earning-line { padding: 5px; gap: 5px; border-radius: 12px; }
  .stat-impact-note { font-size: .68rem; padding: 7px 9px; }
  .hint { font-size: .68rem; }

  .stat-toggles { gap: 3px; padding-top: 4px; }
  .stat-toggles label { padding: 3px 6px 3px 5px; font-size: .56rem; gap: 3px; }
  .stat-toggles > span { font-size: .5rem; }
  .stat-toggles input[type="checkbox"] { width: 10px; height: 10px; }

  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .primary-button, .hero-actions .ghost-button { width: 100%; padding: 8px 12px; font-size: .74rem; }

  .breakdown-card { padding: 9px; border-radius: 16px; }
  .breakdown-card h2 { font-size: .8rem; margin-bottom: 8px; }
  .result-row { font-size: .74rem; padding: 6px 0; gap: 6px; }

  .tab-bar { padding: 3px; gap: 4px; margin-bottom: 10px; }
  .tab-btn { font-size: .7rem; padding: 6px 4px; gap: 4px; }
  .tab-intro { font-size: .74rem; padding: 7px 9px; }

  .classification-trigger { padding: 7px 8px; font-size: .8rem; gap: 6px; }
  .option-icon { font-size: .95rem; }
  .classification-option { padding: 6px 7px; gap: 7px; }
  .classification-option strong { font-size: .76rem; }
  .classification-option small { font-size: .64rem; }
  .classification-chevron { width: 13px; height: 13px; }

  .modal-close { width: 28px; height: 28px; font-size: 1.05rem; top: 10px; right: 10px; }
  .purchase-modal { padding: 14px; border-radius: 18px; }
  .purchase-modal h2 { font-size: 1.1rem; }
  .package-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
  .package-btn { padding: 8px 5px; border-radius: 10px; }
  .package-days { font-size: .76rem; }
  .package-amount { font-size: .82rem; }
  .package-rate { font-size: .6rem; }
}

@media print {
  * {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
    box-shadow: none !important;
    transition: none !important;
  }

  body {
    background: #fff;
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 12px;
  }

  .hero-actions, .input-panel, .credit-line { display: none; }
  .app-shell, .layout-grid { width: 100%; margin: 0; border: 0; }
  .layout-grid { display: block; background: #fff; padding: 0; }

  .hero-card {
    padding: 0 0 10px;
    border: 0;
    border-bottom: 2px solid var(--line);
    border-radius: 0;
    margin-bottom: 14px;
  }

  .hero-copy { display: none; }
  .eyebrow { font-size: 9px; margin-bottom: 4px; }
  h1 { font-size: 20px; line-height: 1.15; letter-spacing: -0.02em; }

  .results-panel {
    border: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
    align-items: start;
  }

  .net-card,
  .summary-cards,
  .breakdown-bar-card {
    grid-column: 1 / -1;
  }

  .breakdown-computation { grid-column: 1; }
  .employer-card { grid-column: 2; }

  .net-card {
    padding: 12px 16px;
    border-radius: 10px;
    border: 0;
  }

  .net-card strong { font-size: 26px; margin: 4px 0; }

  .summary-cards { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .summary-cards div { padding: 8px 10px; border-radius: 8px; }
  .summary-cards strong { font-size: 13px; margin-top: 3px; }

  .breakdown-card {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .breakdown-card h2 { font-size: 11px; margin-bottom: 6px; }

  .result-row { padding: 3px 0; font-size: 10.5px; gap: 10px; }

  /* Zero-value line items clutter a payslip printout — keep them on-screen, drop them here. */
  .zero-row { display: none; }

  /* Default for the calculator's own "Print summary" -- a single flowing
     list, unchanged by the on-screen earnings/deductions columns. The
     payslip print overrides this back to two real columns below. */
  .breakdown-columns { grid-template-columns: 1fr; gap: 0; }
  .breakdown-col + .breakdown-col { border-left: 0; padding-left: 0; }
  .breakdown-col h3 { display: none; }
  .breakdown-net { margin-top: 0; padding-top: 0; border-top: 0; }
  .breakdown-net .result-row { padding: 3px 0; font-size: 10.5px; border-bottom: 0; }

  /* Payslip print: A5 portrait (see printPayslip()'s injected @page rule
     -- portrait gives ~210mm of height to work with vs landscape's
     ~148mm, which is what was causing the breakdown/employer-contributions
     cards to spill onto a second page), earnings left / deductions right,
     employer contributions recentered and shrunk below -- all scoped to
     body.printing-payslip so none of this touches the calculator's own
     on-screen "Print summary". */
  body.printing-payslip {
    font-size: 9px;
  }

  body.printing-payslip #payslipPrintWrap {
    position: relative;
    min-height: 192mm;
    padding: 7mm 8mm calc(7mm + 16px);
    box-sizing: border-box;
  }

  body.printing-payslip .payslip-print-header { margin-bottom: 5px; }
  body.printing-payslip .payslip-print-logo { max-height: 30px; max-width: 100px; }
  body.printing-payslip .payslip-print-business-name { font-size: 10.5px; }
  body.printing-payslip .hero-card { margin-bottom: 6px; padding-bottom: 5px; }
  body.printing-payslip .eyebrow { font-size: 7.5px; }
  body.printing-payslip h1 { font-size: 14px; }
  body.printing-payslip .payslip-print-line { font-size: 8.5px; }

  body.printing-payslip .results-panel { display: block; }
  body.printing-payslip .net-card { padding: 7px 10px; margin-bottom: 5px; }
  body.printing-payslip .net-card strong { font-size: 17px; margin: 2px 0; }
  body.printing-payslip .summary-cards { margin-bottom: 5px; }
  body.printing-payslip .summary-cards div { padding: 5px 6px; }
  body.printing-payslip .summary-cards strong { font-size: 10px; }
  body.printing-payslip .breakdown-card { padding: 7px 9px; break-inside: avoid; page-break-inside: avoid; }

  body.printing-payslip .breakdown-columns { grid-template-columns: 1fr 1fr; gap: 0 10px; }
  body.printing-payslip .breakdown-col h3 { display: block; font-size: 9px; margin-bottom: 3px; }
  body.printing-payslip .breakdown-col + .breakdown-col { border-left: 1px solid var(--line); padding-left: 10px; }
  body.printing-payslip .result-row { padding: 2px 0; font-size: 8.5px; gap: 6px; }

  body.printing-payslip .employer-card {
    margin: 6px auto 0;
    max-width: 78%;
    text-align: center;
  }
  body.printing-payslip .employer-card h2 { font-size: 9px; }
  body.printing-payslip .employer-card .result-row { text-align: left; }

  body.printing-payslip .payslip-print-footer {
    position: absolute;
    left: 8mm;
    right: 8mm;
    bottom: 6mm;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 7px;
    color: var(--muted);
  }
}

.earning-line {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(77, 43, 21, 0.10);
  border-radius: 16px;
  background: rgba(255, 250, 243, .75);
}

.comp-history-add-row,
.comp-history-add-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
  align-items: end;
}
.comp-history-add-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.comp-history-add-row button,
.comp-history-add-grid button { height: 46px; }

@media (max-width: 760px) {
  .comp-history-add-row,
  .comp-history-add-grid { grid-template-columns: 1fr 1fr; }
}

.stat-impact-note {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(242, 140, 24, .10);
  color: var(--brand-dark);
  font-size: .82rem;
  font-weight: 700;
}

.stat-toggles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed rgba(77, 43, 21, 0.12);
}

.stat-toggles > span {
  color: var(--muted);
  font-size: .66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-right: 2px;
}

.stat-toggles label {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 5px;
  padding: 5px 10px 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: .72rem;
  font-weight: 700;
  color: #a3897a;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.stat-toggles label:hover { border-color: rgba(242, 140, 24, .5); }

.stat-toggles label abbr { text-decoration: none; }

.stat-toggles input[type="checkbox"] {
  width: 13px;
  height: 13px;
  padding: 0;
  margin: 0;
  accent-color: currentColor;
  cursor: pointer;
}

.stat-toggles label:has(input[id$="AffectsNssf"]:checked) {
  background: var(--seg-nssf-tint);
  border-color: var(--seg-nssf);
  color: var(--seg-nssf);
}

.stat-toggles label:has(input[id$="AffectsShif"]:checked) {
  background: var(--seg-shif-tint);
  border-color: var(--seg-shif);
  color: var(--seg-shif);
}

.stat-toggles label:has(input[id$="AffectsAhl"]:checked) {
  background: var(--seg-ahl-tint);
  border-color: var(--seg-ahl);
  color: var(--seg-ahl);
}

.stacked-bar {
  display: flex;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: #f1e7da;
}

.bar-seg {
  height: 100%;
  transition: width .4s ease;
}

.bar-seg.seg-net { background: var(--seg-net); }
.bar-seg.seg-paye { background: var(--seg-paye); }
.bar-seg.seg-nssf { background: var(--seg-nssf); }
.bar-seg.seg-shif { background: var(--seg-shif); }
.bar-seg.seg-ahl { background: var(--seg-ahl); }
.bar-seg.seg-other { background: var(--seg-other); }

.bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 14px;
  font-size: .78rem;
  color: var(--muted);
}

.bar-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bar-legend strong { color: var(--text); white-space: nowrap; overflow-wrap: normal; word-break: keep-all; }

.bar-legend .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

.dot.seg-net { background: var(--seg-net); }
.dot.seg-paye { background: var(--seg-paye); }
.dot.seg-nssf { background: var(--seg-nssf); }
.dot.seg-shif { background: var(--seg-shif); }
.dot.seg-ahl { background: var(--seg-ahl); }
.dot.seg-other { background: var(--seg-other); }

.app-nav {
  display: flex;
  gap: 8px;
  padding: 5px;
  margin-bottom: clamp(6px, 1.5vw, 10px);
  border-radius: 16px;
  background: rgba(255, 255, 255, .12);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .18);
}

.app-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: transparent;
  color: rgba(255, 255, 255, .8);
  font-weight: 800;
  font-size: .9rem;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.app-nav-btn:hover { color: #fff; }
.app-nav-btn[aria-selected="true"] {
  background: #fff;
  color: var(--brand-dark);
  box-shadow: 0 6px 16px rgba(16, 8, 3, .18);
}

.employees-page {
  border-radius: 30px;
  background: rgba(255, 255, 255, .12);
  backdrop-filter: blur(14px);
  padding: 18px;
}

.employees-directory,
.employees-form {
  border-radius: 24px;
  background: var(--card-2);
  padding: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.employee-status-filter { grid-template-columns: repeat(3, 1fr); max-width: 420px; }

.employee-table-wrap { overflow-x: auto; }

.employee-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.employee-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border-bottom: 2px solid var(--line);
}

.employee-table td {
  padding: 12px;
  border-bottom: 1px dashed var(--line);
  color: #4b3428;
}

.employee-table tr:last-child td { border-bottom: 0; }

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 800;
}
.status-pill.status-active { background: rgba(23, 107, 77, .14); color: var(--seg-net); }
.status-pill.status-terminated { background: rgba(179, 38, 30, .12); color: #b3261e; }

.employee-form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.required-asterisk { color: #b3261e; margin-left: -3px; }

.settings-page { border-radius: 30px; background: rgba(255, 255, 255, .12); backdrop-filter: blur(14px); padding: 18px; }

.lookup-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.lookup-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  border-radius: 999px;
  background: rgba(242, 140, 24, .1);
  border: 1px solid rgba(242, 140, 24, .3);
  font-size: .82rem;
  font-weight: 700;
  color: var(--brand-dark);
}

.lookup-item button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 0;
  background: rgba(179, 38, 30, .12);
  color: #b3261e;
  font-size: .82rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.lookup-item button:hover { background: rgba(179, 38, 30, .22); }

.lookup-empty { font-size: .82rem; color: var(--muted); margin-top: 14px; }

.lookup-add-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.lookup-add-row input { flex: 1; }

@media (max-width: 620px) {
  .employees-page { padding: 12px; border-radius: 18px; }
  .employees-directory, .employees-form { padding: 12px; }
  .employee-status-filter { max-width: none; }
  .employee-table { font-size: .8rem; }
  .employee-table th, .employee-table td { padding: 8px; }
}

@media print {
  .app-nav, .employees-page { display: none; }
}

/* Payslip printing: JS briefly removes #payslipPrintWrap's [hidden] and
   toggles this class right before/after window.print(), so everything
   else in .app-shell -- both #ownerAppShell and #employeePortalShell,
   whichever is actually active -- is hidden for the duration and only
   the payslip prints. #payslipPrintWrap itself lives as a top-level
   sibling of both shells (not nested inside either) specifically so this
   still works when printPayslip() is called from the employee portal:
   a hidden ancestor hides a visible descendant regardless of the
   descendant's own [hidden] state, and #ownerAppShell is exactly that
   kind of hidden ancestor whenever an employee session is what's on
   screen. */
body.printing-payslip .app-shell > *:not(#payslipPrintWrap) { display: none !important; }
body.printing-payslip #payslipPrintWrap { display: block; }

/* Muster roll printing: same trick, scoped to #musterRollPrintWrap. The
   landscape @page rule itself is injected/removed by JS around
   window.print() since @page can't be scoped by a body class. */
body.printing-muster-roll .app-shell > *:not(#musterRollPrintWrap) { display: none !important; }
body.printing-muster-roll #musterRollPrintWrap { display: block; }

.payroll-employee-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.payroll-employee-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffaf3;
  font-size: .86rem;
}

.payroll-employee-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); flex: none; }
.payroll-employee-row .employee-name { font-weight: 700; flex: 1; }
.payroll-employee-row .employee-reason { font-size: .76rem; color: var(--muted); }
.payroll-employee-row.is-excluded { opacity: .7; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.001ms !important; }
}

/* Muster roll: one .muster-page per printed sheet. @page margin is set
   to 0 by JS for this print (see printMusterRoll) — Chrome/Edge only
   draw their default header/footer (page title + URL) in the page
   margin, so a 0 margin suppresses them; this padding replicates the
   visual margin from inside the content instead. */
.muster-page {
  position: relative;
  min-height: 180mm;
  padding: 10mm 10mm calc(10mm + 26px);
  box-sizing: border-box;
  page-break-after: always;
  break-after: page;
  background: #fff;
  color: #14100c;
}
.muster-page:last-child { page-break-after: auto; break-after: auto; }

.muster-header { margin-bottom: 8px; }
.muster-header-top { display: flex; align-items: center; gap: 8px; }
.muster-logo { max-height: 32px; max-width: 100px; object-fit: contain; }
.muster-business-name { font-size: 12px; font-weight: 800; }
.muster-cycle { font-size: 9px; font-weight: 700; margin-top: 1px; }
.muster-meta { font-size: 7.5px; color: #5a4d43; margin-top: 1px; }

.muster-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 6.5px;
}
.muster-table th,
.muster-table td {
  border: 1px solid #999;
  padding: 2px 3px;
  overflow-wrap: break-word;
}
.muster-table th { background: #eee; font-weight: 700; text-align: center; }
.muster-table .muster-left { text-align: left; }
.muster-table .muster-right { text-align: right; }
.muster-table .muster-bold { font-weight: 800; }
.muster-table tr.muster-totals-row td { background: #f2ece2; border-top: 2px solid #333; }

.muster-footer {
  position: absolute;
  left: 10mm;
  right: 10mm;
  bottom: 10mm;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  font-size: 7.5px;
}
.muster-footer-left { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.muster-footer-right { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.muster-prepared { white-space: nowrap; }
.muster-page-number { font-weight: 700; white-space: nowrap; }
.muster-printed,
.muster-credit { color: #5a4d43; white-space: nowrap; }

/* Leave module ---------------------------------------------------- */

.leave-subview { margin-top: 16px; }

/* .tab-bar defaults to a fixed 2-column grid (built for the calculator's
   Config/Calculate tabs) and .employee-status-filter to a fixed 3-column
   one — neither fits Leave's 5-item bars, which wrapped into an uneven
   2/2/1 or 3/2 layout. auto-fit lets each bar fill as many equal-width
   columns as the panel is wide enough for, at any item count or width. */
.leave-tab-bar,
.leave-status-filter {
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  max-width: none;
}

.eligibility-section { margin-top: 14px; }
.eligibility-section:first-of-type { margin-top: 4px; }

.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 8px;
  font-size: .86rem;
}
.checkbox-grid label { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.checkbox-grid input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--brand); }

.approval-workflow-toggle { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .88rem; }
.approval-workflow-toggle input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); }

.eligibility-checklist {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fffaf3;
  flex-direction: column;
  gap: 6px;
}

.eligibility-toolbar {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 8px;
}
.eligibility-toolbar input[type="text"] { flex: 1; }
.eligibility-toolbar .ghost-button { flex: none; padding: 9px 14px; font-size: .82rem; }

.leave-analytics-breakdown { margin-top: 14px; }

.leave-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 14px;
}

.leave-calendar-headcell {
  text-align: center;
  font-size: .74rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding-bottom: 4px;
}

.leave-calendar-cell {
  min-height: 84px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 8px;
  background: #fffaf3;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}
.leave-calendar-cell.is-empty { border: 0; background: transparent; }
.leave-calendar-cell.is-weekend { background: rgba(77, 43, 21, .05); }
.leave-calendar-cell.is-holiday { background: rgba(179, 38, 30, .08); border-color: rgba(179, 38, 30, .3); }
.leave-calendar-cell.is-today { border-color: var(--brand); border-width: 2px; }

.leave-calendar-date { font-weight: 800; font-size: .82rem; }
.leave-calendar-holiday {
  font-size: .68rem;
  font-weight: 700;
  color: #b3261e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.leave-calendar-onleave {
  font-size: .68rem;
  color: var(--brand-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#leaveBalancesTable th,
#leaveBalancesTable td { padding: 8px 10px; font-size: .78rem; }
#leaveBalancesTable .leave-num-cell,
#leaveBalancesTable .leave-num-head { text-align: right; white-space: nowrap; }
#leaveBalancesTable thead tr:first-child th { text-align: center; }
.leave-balance-subcell { color: var(--muted); }

.leave-balance-cell {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 6px 10px;
  background: transparent;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  text-align: right;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.leave-balance-cell:hover { background: rgba(242, 140, 24, .1); border-color: rgba(242, 140, 24, .3); }
.leave-balance-cell.has-adjustments { color: var(--brand-dark); }
.leave-balance-cell.has-adjustments::after { content: ' \25CF'; font-size: .6em; vertical-align: super; color: var(--brand); }

.leave-adjust-history {
  margin: 14px 0;
  max-height: 180px;
  overflow-y: auto;
}
.leave-adjust-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: .84rem;
}
.leave-adjust-history-row:last-child { border-bottom: 0; }
.leave-adjust-history-row div { display: flex; flex-direction: column; gap: 2px; }
.leave-adjust-history-row strong { color: var(--brand-dark); }
.leave-adjust-history-row span { color: var(--muted); font-size: .78rem; }

.bulk-upload-results {
  margin: 14px 0 0;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
}
.bulk-upload-results p { margin: 4px 0; font-size: .8rem; color: var(--muted); }
.bulk-upload-results strong { color: var(--brand-dark); }

.bulk-upload-step { display: flex; gap: 10px; margin-top: 14px; }
.bulk-upload-step-number {
  flex: none;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
}
.bulk-upload-step-body { flex: 1; min-width: 0; }
.bulk-upload-step-body > strong { display: block; font-size: .88rem; margin-bottom: 2px; }
.bulk-upload-step-body > .hint { margin: 0 0 8px; }

.bulk-upload-file-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bulk-upload-choose-label { cursor: pointer; }
.bulk-upload-filename { font-size: .82rem; color: var(--muted); overflow-wrap: anywhere; }

/* Employee self-service portal — deliberately smaller/lighter than the
   dashboard-style .summary-cards used elsewhere: this is a handful of
   read-only facts about one person, not a set of headline stats worth a
   full stat-tile treatment. */
.portal-info-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.portal-info-chips > div {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: .78rem;
}
.portal-info-chips > div span { color: var(--muted); }
.portal-info-chips > div strong { font-size: .84rem; color: var(--brand-dark); font-weight: 800; }

.portal-compact-group { padding: 10px 12px; }
.portal-section-title { margin: 0 0 8px; font-size: .82rem; font-weight: 800; color: var(--brand-dark); }

.compact-table.employee-table { font-size: .8rem; }
.compact-table.employee-table th { padding: 7px 10px; font-size: .66rem; }
.compact-table.employee-table td { padding: 8px 10px; }

/* Color consistency across the portal: the shared global rules for
   `label` and `.employee-table td` use an ad-hoc hardcoded brown
   (#4b3428) that doesn't quite match this app's actual text-color
   tokens (--text/--brand-dark/--muted) -- scoped here rather than
   changed globally, so the owner's own screens (which reuse the same
   shared classes) are untouched. */
#employeePortalShell label { color: var(--text); }
#employeePortalShell .employee-table td { color: var(--text); }

/* Leave balances printing: same trick as the muster roll, scoped to
   #leaveBalancePrintWrap; it reuses the .muster-* print styles above. */
body.printing-leave-balances .app-shell > *:not(#leaveBalancePrintWrap) { display: none !important; }
body.printing-leave-balances #leaveBalancePrintWrap { display: block; }

@media (max-width: 620px) {
  .leave-calendar-grid { gap: 4px; }
  .leave-calendar-cell { min-height: 60px; padding: 4px 5px; }
  .leave-calendar-headcell { font-size: .6rem; }
}
