:root {
  color-scheme: light;
  --ink: #14202a;
  --muted: #61707a;
  --line: #d8dee1;
  --surface: #ffffff;
  --soft: #f3f5f5;
  --accent: #9b7446;
  --accent-strong: #785838;
  --amber: #9b7446;
  --red: #bd392f;
  --blue: #245a9a;
  --shadow: 0 18px 40px rgba(17, 29, 42, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #eef1f2;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-brand {
  color: var(--ink);
  margin-bottom: 24px;
}

.login-brand span {
  color: var(--muted);
}

.login-card h1 {
  margin: 0 0 18px;
  font-size: 28px;
}

.login-card form,
.login-card label {
  display: grid;
  gap: 10px;
}

.login-card form {
  gap: 16px;
}

.login-error {
  background: #fdecea;
  color: var(--red);
  border: 1px solid #f4c8c4;
  border-radius: 8px;
  padding: 10px 12px;
}

.login-session-note {
  background: #fff7e7;
  border: 1px solid #eed29f;
  border-radius: 8px;
  color: #674000;
  font-size: 14px;
  line-height: 1.35;
  margin: 0 0 16px;
  padding: 10px 12px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  --sidebar-width: 280px;
  grid-template-columns: var(--sidebar-width) 8px minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell.sidebar-collapsed {
  --sidebar-width: 96px;
}

.sidebar {
  background: #111d2a;
  color: #f7f8f5;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.sidebar,
.app-shell {
  transition: grid-template-columns 180ms ease, padding 180ms ease;
}

.app-shell.sidebar-resizing,
.app-shell.sidebar-resizing .sidebar {
  transition: none;
}

.sidebar-resizer {
  background: transparent;
  cursor: col-resize;
  min-height: 100vh;
  position: relative;
}

.sidebar-resizer::before {
  background: transparent;
  content: "";
  inset: 0 3px;
  position: absolute;
}

.sidebar-resizer:hover::before,
.sidebar-resizer:focus-visible::before,
.app-shell.sidebar-resizing .sidebar-resizer::before {
  background: #b39266;
}

.sidebar-resizer:focus-visible {
  outline: none;
}

.sidebar-toggle {
  background: #eadfce;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #2f251a;
  font-weight: 800;
  min-height: 40px;
  padding: 8px 10px;
}

.sidebar-toggle:focus-visible {
  outline: 3px solid #c2a57d;
  outline-offset: 2px;
}

.app-shell.sidebar-collapsed .sidebar {
  align-items: stretch;
  gap: 18px;
  padding: 18px 10px;
}

.app-shell.sidebar-collapsed .brand {
  justify-items: center;
}

.app-shell.sidebar-collapsed .brand-copy,
.app-shell.sidebar-collapsed .role-control,
.app-shell.sidebar-collapsed .session-panel span,
.app-shell.sidebar-collapsed .session-panel small,
.app-shell.sidebar-collapsed .deadline-panel {
  display: none;
}

.app-shell.sidebar-collapsed .session-panel {
  font-size: 12px;
  text-align: center;
}

.app-shell.sidebar-collapsed .session-panel a {
  overflow-wrap: normal;
  white-space: nowrap;
}

.app-shell.sidebar-collapsed .nav-tab {
  font-size: 0;
  justify-content: center;
  min-height: 48px;
  padding: 10px 6px;
}

.app-shell.sidebar-collapsed .nav-tab::after {
  content: attr(data-short);
  font-size: 12px;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  font-size: 12px;
  line-height: 1.15;
  min-height: 44px;
}

.brand {
  display: grid;
  gap: 10px;
}

.brand-logo {
  display: block;
  height: auto;
  max-width: 100%;
  width: 56px;
}

.login-brand .brand-logo {
  width: 64px;
}

.app-shell.sidebar-collapsed .brand-logo {
  width: 48px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #c6ced1;
  font-size: 13px;
  margin-top: 3px;
}

.role-control {
  color: #c6ced1;
}

.role-control select {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #f7f8f5;
}

.role-control option {
  color: var(--ink);
}

.session-panel {
  background: rgba(155, 116, 70, 0.18);
  border: 1px solid rgba(234, 223, 206, 0.26);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  color: #eadfce;
  font-size: 14px;
  padding: 10px;
}

.session-panel span {
  color: #ffffff;
  font-weight: 800;
}

.session-panel small {
  color: #e7cfae;
  font-size: 12px;
  line-height: 1.35;
}

.session-panel a {
  color: #f7f8f5;
  font-weight: 700;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #edf1f2;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px 14px;
  text-align: left;
}

.nav-tab.active {
  background: #eadfce;
  color: #2f251a;
  border-color: transparent;
  font-weight: 700;
}

.deadline-panel {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
}

.deadline-panel span {
  display: block;
  color: #c6ced1;
  font-size: 13px;
}

.deadline-panel strong {
  display: block;
  margin: 6px 0 14px;
}

.deadline-meter {
  height: 8px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 99px;
  overflow: hidden;
}

.deadline-meter div {
  width: 68%;
  height: 100%;
  background: #b39266;
}

main {
  padding: 28px;
  min-width: 0;
}

.topbar,
.section-heading,
.mini-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
}

h3 {
  margin-bottom: 0;
}

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

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

.print-controls {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(180px, 1fr) auto;
}

.primary-action,
.secondary-action,
.icon-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
}

.primary-action {
  background: var(--accent);
  color: white;
  padding: 0 18px;
  font-weight: 700;
}

.primary-action:hover {
  background: var(--accent-strong);
}

.secondary-action {
  background: #dfe8e3;
  color: var(--ink);
  padding: 0 16px;
  font-weight: 700;
}

.icon-button {
  width: 42px;
  background: #dfe8e3;
  color: var(--ink);
  font-size: 20px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.summary-grid article,
.entry-panel,
.week-card,
.review-table,
.report-table,
.admin-form,
.admin-maintenance-note,
.insight-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary-grid article {
  padding: 16px;
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 7px;
}

.summary-grid strong {
  font-size: 28px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-heading {
  margin: 26px 0 14px;
}

#employeeView .section-heading {
  align-items: end;
}

.employee-controls {
  display: grid;
  gap: 10px 12px;
  grid-template-columns: minmax(160px, 0.8fr) minmax(320px, 1.6fr) minmax(170px, 0.85fr) minmax(170px, 0.85fr) minmax(170px, 0.85fr);
  width: 100%;
}

.employee-controls .wide-field {
  grid-column: span 1;
}

.employee-controls select,
.employee-controls input {
  min-width: 0;
  width: 100%;
}

.employee-controls .secondary-action {
  align-self: end;
  min-height: 62px;
}

.entry-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(360px, 1.18fr);
  gap: 16px;
}

.entry-panel {
  padding: 18px;
  display: grid;
  gap: 16px;
  align-content: start;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.day-tools {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: end;
}

.field-button {
  align-self: end;
  width: 100%;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.check-field {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-self: start;
  min-height: 42px;
  padding-top: 20px;
}

.check-field label {
  color: var(--muted);
  cursor: pointer;
  display: inline;
  font-size: 13px;
  font-weight: 700;
}

.admin-check-field {
  align-self: end;
  padding-top: 0;
}

.field-grid .check-field {
  grid-column: auto;
}

.full-row {
  grid-column: 1 / -1;
}

.check-field input {
  width: 18px;
  height: 18px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 11px 12px;
}

input[readonly] {
  background: var(--soft);
  color: var(--accent);
  font-weight: 800;
}

input[readonly]::placeholder {
  color: var(--muted);
}

textarea {
  resize: vertical;
}

.time-control {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.time-control select {
  min-width: 0;
  padding-inline: 9px;
  text-align: center;
}

.week-card {
  padding: 18px;
}

.mini-heading {
  margin-bottom: 14px;
}

.mini-heading span {
  color: var(--muted);
}

.day-list {
  display: grid;
  gap: 10px;
}

.weekly-total-grid {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 6px;
  padding-top: 14px;
}

.weekly-total-grid div {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.weekly-total-grid span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.weekly-total-grid strong {
  font-size: 22px;
}

.annual-balance-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.readonly-balance-grid {
  margin-top: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.annual-balance-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.annual-balance-grid span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.annual-balance-grid strong {
  font-size: 20px;
}

.availability-card {
  display: grid;
  gap: 8px;
}

.balance-edit-card {
  display: grid;
  gap: 8px;
}

.balance-edit-card label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.balance-edit-card input {
  margin-top: 6px;
}

.availability-card.locked {
  background: #fff7ed;
}

.availability-card button,
.balance-edit-card button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  padding: 9px 10px;
}

.signature-box {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  margin-top: 6px;
  padding-top: 14px;
}

.signature-attestation {
  align-items: start;
  display: flex;
  gap: 10px;
  justify-self: start;
  line-height: 1.35;
}

.signature-attestation input {
  flex: 0 0 auto;
  height: 18px;
  margin-top: 1px;
  width: 18px;
}

.signature-attestation label {
  color: var(--muted);
  cursor: pointer;
  display: inline;
  font-size: 13px;
  font-weight: 700;
}

.print-area {
  display: none;
}

.signature-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.signature-heading button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  min-height: 32px;
  padding: 0 11px;
  font-weight: 700;
}

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

.signature-actions button {
  flex: 1 1 220px;
}

.history-list {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
}

.history-list span {
  color: var(--muted);
  font-weight: 700;
}

#signaturePad,
#supervisorSignaturePad {
  background: white;
  border: 1px dashed var(--muted);
  border-radius: 8px;
  display: block;
  height: 160px;
  touch-action: none;
  width: 100%;
}

#signaturePad[data-signature-locked="1"] {
  background: var(--soft);
  cursor: not-allowed;
  opacity: 0.88;
}

.review-signature-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  margin-top: 14px;
  max-width: 680px;
  padding: 16px;
}

.day-row {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.day-row strong,
.day-row span {
  display: block;
}

.day-row span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.day-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.day-actions button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  min-height: 32px;
  padding: 0 11px;
  font-weight: 700;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 99px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill.ok {
  background: #d9f0df;
  color: #0b493d;
}

.pill.warn {
  background: #fff0cf;
  color: var(--amber);
}

.pill.danger {
  background: #ffe0dd;
  color: var(--red);
}

.pill.info {
  background: #dceafe;
  color: var(--blue);
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.segmented-control button {
  border: 0;
  background: transparent;
  padding: 10px 14px;
  color: var(--muted);
}

.segmented-control button.active {
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.review-table,
.report-table {
  overflow: hidden;
}

.report-table {
  overflow: auto;
}

.review-table {
  max-height: 62vh;
  overflow: auto;
}

.agency-summary-table,
.sick-vacation-table,
.leave-date-table,
.user-table,
.employee-admin-table {
  max-height: 62vh;
  overflow: auto;
}

.user-table,
.employee-admin-table {
  height: 62vh;
}

.table-row {
  display: grid;
  grid-template-columns: 1.4fr 0.75fr repeat(6, 0.5fr) 0.8fr 1.3fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}

.table-row:first-child {
  border-top: 0;
}

.table-row.header {
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.table-row small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-top: 2px;
}

.review-table .table-row {
  grid-template-columns:
    minmax(150px, 1.35fr)
    repeat(7, minmax(48px, 0.42fr))
    minmax(86px, 0.58fr)
    minmax(92px, 0.5fr)
    minmax(205px, 0.92fr);
  min-width: 1040px;
  padding: 10px 14px;
}

.review-table .table-row.header {
  position: sticky;
  top: 0;
  z-index: 3;
}

.review-table .table-row > :nth-child(n + 2):nth-child(-n + 8) {
  font-variant-numeric: tabular-nums;
  justify-self: end;
  text-align: right;
}

.review-table .table-row > :nth-child(6) {
  padding-right: 10px;
}

.review-table .table-row > :nth-child(7) {
  padding-left: 10px;
}

.review-table .table-row > :nth-child(9) {
  justify-self: center;
}

.review-table .table-row > :nth-child(10) {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.review-table .pill {
  font-size: 11px;
  min-height: 22px;
  padding: 0 8px;
}

.issue-button {
  border: 0;
  cursor: pointer;
  font-family: inherit;
}

.review-table .table-row > :nth-child(10) {
  position: relative;
}

.issue-popover {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(14, 31, 27, 0.16);
  display: grid;
  gap: 8px;
  left: 0;
  min-width: 280px;
  padding: 10px;
  position: absolute;
  top: calc(100% + 6px);
  z-index: 8;
}

.issue-popover-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.issue-popover-heading button {
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.issue-detail {
  align-items: start;
  display: grid;
  gap: 6px;
  grid-template-columns: auto minmax(0, 1fr);
}

.issue-detail span:last-child {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.review-table .row-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, max-content);
  justify-content: flex-start;
  min-width: 0;
}

.review-table .row-actions button {
  min-height: 32px;
  padding: 0 9px;
}

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

.row-actions button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  min-height: 36px;
  padding: 0 10px;
  font-weight: 700;
  white-space: nowrap;
}

.report-layout {
  display: grid;
  gap: 16px;
  align-items: start;
}

.admin-layout {
  display: grid;
  gap: 16px;
}

.table-search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.table-search input {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  min-height: 44px;
  padding: 0 14px;
  width: 100%;
}

.admin-form {
  padding: 18px;
}

.catalog-management-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.catalog-add-form {
  align-items: end;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.catalog-add-form label { margin: 0; }

.catalog-list {
  border-top: 1px solid var(--line);
  display: grid;
  margin-top: 14px;
}

.catalog-item {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 52px;
  padding: 8px 0;
}

.catalog-item + .catalog-item { border-top: 1px solid var(--line); }

.catalog-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.catalog-item-actions button {
  min-height: 38px;
  padding: 7px 10px;
}

.correction-audit-list,
.correction-audit-item,
.correction-change-list,
.correction-day-change {
  display: grid;
  gap: 8px;
}

.correction-audit-list {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.correction-audit-item {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.correction-audit-item > div,
.correction-day-change {
  display: grid;
  gap: 5px;
}

.correction-audit-item span {
  color: var(--muted);
  line-height: 1.35;
}

.correction-day-change + .correction-day-change {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

@media (max-width: 900px) {
  .catalog-management-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .catalog-add-form { grid-template-columns: 1fr; }
}

.admin-maintenance-note {
  padding: 18px;
}

.admin-maintenance-note ul {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
  margin: 12px 0 0;
  padding-left: 22px;
}

.admin-maintenance-note li + li {
  margin-top: 6px;
}

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

.csv-import-control {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 16px;
}

.csv-import-control input {
  margin-top: 8px;
  width: 100%;
}

.import-note {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
  margin: 10px 0 0;
}

.compact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.report-table .table-row {
  grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 0.85fr) minmax(100px, 0.65fr) minmax(160px, 0.85fr);
  min-width: 680px;
}

.agency-summary-table {
  margin-bottom: 16px;
}

.agency-summary-table .table-row {
  grid-template-columns:
    minmax(150px, 1.05fr)
    minmax(88px, 0.52fr)
    minmax(120px, 0.72fr)
    repeat(5, minmax(68px, 0.42fr))
    minmax(92px, 0.54fr)
    minmax(72px, 0.42fr);
  min-width: 940px;
}

.sick-vacation-table {
  margin-bottom: 16px;
}

.sick-vacation-table .table-row {
  grid-template-columns: minmax(190px, 1.35fr) minmax(130px, 0.85fr) repeat(6, minmax(105px, 0.75fr));
  min-width: 1080px;
}

.leave-date-table {
  margin-bottom: 16px;
}

.sensitive-cost-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  margin-top: 20px;
  padding: 18px;
}

.audit-records-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 16px;
  margin-top: 20px;
  padding: 18px;
}

.audit-records-section .mini-heading {
  margin-bottom: 0;
}

.audit-records-section .mini-heading > div {
  display: grid;
  gap: 4px;
}

.audit-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.audit-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.audit-actions .check-field {
  margin-right: auto;
}

.audit-preview-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 10px;
}

.audit-preview-grid article {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 6px;
  min-height: 82px;
  padding: 12px;
}

.audit-preview-grid span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.audit-preview-grid strong {
  font-size: 1.35rem;
}

.cost-management-grid,
.cost-history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.cost-management-grid {
  align-items: start;
}

.cost-management-grid .admin-form {
  align-self: start;
  margin: 0;
}

.cost-management-grid .mini-heading {
  align-items: start;
  display: grid;
  gap: 4px;
}

.cost-management-grid .compact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.cost-management-grid .compact-grid label {
  min-width: 0;
}

.cost-management-grid input,
.cost-management-grid select {
  min-width: 0;
  width: 100%;
}

.cost-report-title {
  align-items: center;
}

.cost-report-title > div {
  display: grid;
  gap: 4px;
}

.cost-report-table .table-row {
  grid-template-columns:
    minmax(160px, 1fr)
    minmax(88px, 0.5fr)
    minmax(100px, 0.58fr)
    repeat(5, minmax(72px, 0.42fr))
    repeat(5, minmax(84px, 0.48fr));
  min-width: 1130px;
}

.cost-rate-history-table .table-row {
  grid-template-columns: minmax(180px, 1.2fr) minmax(100px, 0.65fr) minmax(90px, 0.55fr) minmax(110px, 0.65fr);
  min-width: 620px;
}

.cost-upcharge-history-table .table-row {
  grid-template-columns: minmax(130px, 1fr) minmax(90px, 0.65fr) minmax(90px, 0.65fr) minmax(110px, 0.75fr);
  min-width: 560px;
}

@media (max-width: 1050px) {
  .cost-management-grid,
  .cost-history-grid {
    grid-template-columns: 1fr;
  }

  .audit-preview-grid {
    grid-template-columns: repeat(3, minmax(110px, 1fr));
  }
}

@media (max-width: 620px) {
  .cost-management-grid .compact-grid {
    grid-template-columns: 1fr;
  }

  .audit-filter-grid,
  .audit-preview-grid {
    grid-template-columns: 1fr;
  }
}

.leave-date-table .table-row {
  grid-template-columns: minmax(190px, 1.1fr) minmax(130px, 0.7fr) repeat(3, minmax(220px, 1.2fr));
  min-width: 1100px;
}

.report-table .table-row > :nth-child(n + 3),
.agency-summary-table .table-row > :nth-child(n + 3),
.sick-vacation-table .table-row > :nth-child(n + 3) {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.agency-summary-table .table-row > :nth-child(3) {
  text-align: left;
}

.agency-summary-table .table-row > :nth-child(9) {
  padding-right: 10px;
}

.agency-summary-table .table-row > :nth-child(10) {
  padding-left: 10px;
}

.leave-date-table .table-row > :nth-child(n + 3) {
  text-align: left;
}

.report-table .table-row > :last-child {
  text-align: left;
}

.report-table .table-row.header > *,
.agency-summary-table .table-row.header > *,
.sick-vacation-table .table-row.header > *,
.leave-date-table .table-row.header > * {
  align-self: end;
}

.agency-summary-table .table-row.header,
.sick-vacation-table .table-row.header,
.leave-date-table .table-row.header,
.user-table .table-row.header,
.employee-admin-table .table-row.header {
  position: sticky;
  top: 0;
  z-index: 3;
}

.user-table .table-row {
  /* Name, Username, Role, Status, Sign-in, Employee, Department, Action.
     The Sign-in column carries the credential-state pill, which can read
     "Code issued (27d left)", so it needs comparable width to Status. */
  grid-template-columns: 1.05fr 0.8fr 0.5fr 0.6fr 0.95fr 0.85fr 0.8fr 1.4fr;
}

/* Roll-up above the roster: how many people still need a code, and how many
   have one outstanding. Gives the admin a rollout progress read at a glance
   rather than making them scan 82 rows. */
.activation-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfcfe;
  font-size: 13px;
}

.activation-summary button {
  margin-left: auto;
}

/* One-time code reveal. Modal because the code cannot be recovered after
   dismissal, so it must not be possible to scroll past it by accident. */
.activation-code-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.55);
  padding: 20px;
}

.activation-code-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.28);
  text-align: center;
}

.activation-code-card h2 {
  margin: 0 0 4px;
  font-size: 17px;
}

.activation-code-for {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted-text, #566);
}

/* Read aloud and transcribed onto a terminal, so it is deliberately large,
   monospaced and widely tracked. */
.activation-code-value {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 3px;
  margin: 0 0 12px;
  padding: 12px 8px;
  border: 2px dashed var(--border-strong, #94a3b8);
  border-radius: 10px;
}

.activation-code-note {
  margin: 0 0 18px;
  font-size: 12.5px;
  color: var(--muted-text, #566);
}

.activation-code-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.employee-admin-table {
  margin-bottom: 18px;
}

.employee-admin-table .table-row {
  grid-template-columns:
    minmax(150px, 1.1fr)
    minmax(100px, 0.62fr)
    minmax(120px, 0.78fr)
    minmax(74px, 0.45fr)
    minmax(115px, 0.72fr)
    minmax(130px, 0.82fr)
    minmax(82px, 0.5fr)
    minmax(150px, 0.82fr);
  min-width: 930px;
}

.employee-admin-table .table-row > :nth-child(2),
.employee-admin-table .table-row > :nth-child(n + 4) {
  min-width: 0;
}

.empty-state {
  color: var(--muted);
  padding: 18px;
}

.report-title-row {
  align-items: center;
  background: white;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.total-row {
  background: #f7faf8;
  font-weight: 800;
}

.insight-panel {
  padding: 18px;
}

.insight-panel h3 {
  margin-bottom: 12px;
}

#aiInsights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.insight {
  border-left: 4px solid var(--accent);
  padding: 10px 0 10px 12px;
}

.insight.warn {
  border-left-color: var(--amber);
}

.insight.danger {
  border-left-color: var(--red);
}

.insight strong {
  display: block;
  margin-bottom: 4px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #17211d;
  color: white;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar-resizer {
    display: none;
  }

  .sidebar {
    position: static;
    padding: 18px;
  }

  .app-shell.sidebar-collapsed .sidebar {
    padding: 18px;
  }

  .app-shell.sidebar-collapsed .brand-copy,
  .app-shell.sidebar-collapsed .role-control,
  .app-shell.sidebar-collapsed .deadline-panel {
    display: grid;
  }

  .nav-tabs {
    grid-template-columns: repeat(3, 1fr);
  }

  .app-shell.sidebar-collapsed .nav-tab {
    font-size: inherit;
    min-height: auto;
    padding: 13px 14px;
  }

  .app-shell.sidebar-collapsed .nav-tab::after {
    content: "";
  }

  .deadline-panel {
    display: none;
  }

  main {
    padding: 18px;
  }

  .summary-grid,
  .entry-layout,
  .employee-controls,
  .annual-balance-grid,
  .report-layout {
    grid-template-columns: 1fr;
  }

  .employee-controls .wide-field {
    grid-column: auto;
  }
}

@media (max-width: 680px) {
  .topbar,
  .section-heading,
  .mini-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .row-actions {
    width: 100%;
  }

  .employee-controls,
  .employee-controls .wide-field {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
  }

  .summary-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .day-row,
  .table-row,
  .table-row.header,
  .report-table .table-row {
    grid-template-columns: 1fr;
  }

  .table-row.header {
    display: none;
  }
}

@media print {
  @page {
    margin: 0.45in;
  }

  body {
    background: white;
    color: #111;
  }

  .app-shell,
  .toast {
    display: none !important;
  }

  .print-area {
    display: block;
  }

  .print-document {
    font-family: Arial, Helvetica, sans-serif;
  }

  .print-document-header {
    border-bottom: 2px solid #111;
    margin-bottom: 18px;
    padding-bottom: 8px;
  }

  .print-document-header h1 {
    font-size: 22px;
    margin: 0 0 4px;
  }

  .print-document-header p {
    margin: 0;
  }

  .print-card {
    break-after: page;
    page-break-after: always;
  }

  .print-card:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .print-card-header {
    align-items: start;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 12px;
  }

  .print-card-header h2 {
    font-size: 19px;
    margin: 0 0 4px;
  }

  .print-agency-logo {
    display: block;
    height: auto;
    max-width: 220px;
  }

  .print-logo-title {
    align-items: center;
    display: flex;
    gap: 18px;
    margin: 0 0 10px;
  }

  .print-logo-title strong {
    font-size: 20px;
    white-space: nowrap;
  }

  .print-card-header p,
  .print-card-header span {
    display: block;
    font-size: 12px;
    margin: 2px 0;
  }

  .print-table {
    border-collapse: collapse;
    font-size: 9px;
    width: 100%;
  }

  .print-table th,
  .print-table td {
    border: 1px solid #444;
    padding: 4px;
    text-align: left;
  }

  .print-table th {
    background: #eee;
  }

  .print-totals,
  .print-signature {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 12px;
  }

  .print-notes {
    border: 1px solid #444;
    font-size: 11px;
    margin-top: 12px;
    padding: 8px;
  }

  .print-certification {
    border: 1px solid #444;
    font-size: 11px;
    line-height: 1.35;
    margin: 12px 0 0;
    padding: 8px;
  }

  .print-signature {
    border-top: 1px solid #444;
    font-size: 12px;
    padding-top: 18px;
  }

  .supervisor-signature {
    margin-top: 18px;
  }

  .printed-signature-image {
    display: inline-block;
    height: 36px;
    max-width: 220px;
    object-fit: contain;
    vertical-align: middle;
  }
}
