:root {
  color-scheme: light;
  --ink: #202923;
  --muted: #526057;
  --line: #d8e1da;
  --surface: #fff;
  --paper: #f5f7f3;
  --green: #195940;
  --green-dark: #10422f;
  --green-soft: #e8f3eb;
  --warning: #8a302a;
  --warning-soft: #fff4f0;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 system-ui, sans-serif; }
.shell { width: min(1340px, calc(100% - 64px)); margin-inline: auto; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.16; }
a { color: var(--green-dark); text-underline-offset: .18em; }
:focus-visible { outline: 3px solid #237251; outline-offset: 3px; }
section, #workspace { scroll-margin-top: 96px; }
.skip { position: fixed; top: 10px; left: 12px; z-index: 101; opacity: 0; pointer-events: none; background: #fff; padding: 10px; }
.skip:focus { opacity: 1; pointer-events: auto; }
.crumb { display: flex; gap: 9px; color: var(--muted); padding: 23px 0 0; font-size: .82rem; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 28px; padding: 29px 0 28px; }
.intro h1 { font-size: clamp(2rem, 4.3vw, 3.5rem); letter-spacing: -.05em; }
.lead { margin-top: 8px; font-size: clamp(1rem, 1.7vw, 1.17rem); color: var(--muted); }
.eyebrow { color: var(--green); font-size: .7rem; line-height: 1.25; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; margin-bottom: 7px; }
.intro .eyebrow { display: flex; align-items: center; gap: 7px; font-size: .78rem; }
.eyebrow span { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #408667; }
.trust { flex: none; display: flex; align-items: flex-start; gap: 10px; max-width: 350px; padding: 11px 14px; border-radius: 10px; border: 1px solid #c9dfcf; background: var(--green-soft); color: var(--green-dark); font-size: .85rem; }
.trust svg { flex: none; margin-top: 2px; }
.trust p { color: var(--muted); font-size: .77rem; margin-top: 2px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; min-width: 0; }
.actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.file-state { display: grid; gap: 2px; padding-inline: 4px; overflow-wrap: anywhere; }
.file-state strong { font-size: .91rem; }
.file-state span { color: var(--muted); font-size: .78rem; }
.button-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
button, input, select { font: inherit; color: inherit; }
button { display: inline-flex; align-items: center; justify-content: center; background: #fff; border: 1px solid #b7c5ba; border-radius: 8px; min-height: 42px; max-width: 100%; padding: 8px 12px; font-size: .86rem; font-weight: 680; line-height: 1.26; cursor: pointer; }
button:hover { background: #edf4ef; border-color: #799685; }
button.primary { color: #fff; background: var(--green); border-color: var(--green); }
button.primary:hover { background: var(--green-dark); }
button.quiet { color: var(--green-dark); border-color: transparent; }
button.danger { color: var(--warning); }
button:disabled { cursor: default; opacity: .56; }
.action-status:empty { margin: 0; height: 0; }
.action-status { font-size: .88rem; color: var(--green-dark); margin-top: 8px; }
.action-status.error { color: var(--warning); }
.desk { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; gap: 18px; margin-top: 16px; }
.entry, .review { display: grid; min-width: 0; align-content: start; gap: 16px; }
.panel-heading { display: flex; min-width: 0; justify-content: space-between; align-items: start; flex-wrap: wrap; column-gap: 8px; row-gap: 5px; margin-bottom: 15px; }
.panel-heading h2 { font-size: 1.24rem; letter-spacing: -.023em; }
.panel-copy, .hint, .empty-copy { color: var(--muted); font-size: .88rem; }
.panel-copy { margin: -5px 0 14px; }
.hint { margin-top: 7px; }
.shift-fields, .pool-inputs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.restaurant-field { grid-column: 1 / -1; }
label { display: block; min-width: 0; color: #34423a; font-size: .81rem; font-weight: 680; }
label small { color: var(--muted); font-weight: 500; font-size: inherit; }
input:not([type=checkbox]), select { display: block; width: 100%; min-width: 0; max-width: 100%; min-height: 43px; margin-top: 4px; padding: 7px 9px; font-size: 1rem; font-weight: 450; background: #fff; border: 1px solid #bac8bf; border-radius: 7px; }
input, select, button { scroll-margin-block: 95px 16px; }
input[type=date] { appearance: none; text-align: left; }
input[type=date]::-webkit-date-and-time-value { text-align: left; }
input::placeholder { color: #68776e; }
input[aria-invalid=true], select[aria-invalid=true] { border-color: #a84038; background: #fffafa; }
.mode-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 4px; gap: 4px; border-radius: 11px; border: 1px solid #cbd8ce; background: #e9efe9; }
.mode-switch button { background: transparent; border-color: transparent; color: var(--muted); }
.mode-switch button[aria-pressed=true] { background: #fff; border-color: #b3c8b9; color: var(--green-dark); box-shadow: 0 1px 2px #203b2714; }
.jump-results { display: none; }
.row-actions { margin-top: 12px; }
.employees, .rules { display: grid; gap: 9px; }
.employees:not(:empty) { margin-top: 13px; }
.entry-card { min-width: 0; min-inline-size: 0; margin: 0; border: 1px solid var(--line); background: #f8faf7; border-radius: 10px; padding: 8px 11px 11px; }
.entry-card legend { color: var(--green-dark); font-size: .78rem; font-weight: 720; padding-inline: 4px; max-width: 100%; overflow-wrap: anywhere; }
.entry-fields { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.entry-fields > label { grid-column: span 2; }
.entry-fields > .wide { grid-column: span 3; }
.entry-fields > .employee-extras { grid-column: 1 / -1; }
.employee-extras summary { width: fit-content; color: var(--green-dark); font-size: .78rem; }
.entry-card .card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 12px; margin-top: 7px; }
.check-label { display: inline-flex; align-items: center; gap: 7px; min-height: 37px; cursor: pointer; }
.check-label input { margin: 0; accent-color: var(--green); width: 17px; height: 17px; flex: none; }
.remove { margin-left: auto; background: transparent; border-color: transparent; min-height: 37px; padding: 5px 7px; }
.role-settings { display: grid; gap: 7px 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 8px; }
.role-settings label { overflow-wrap: anywhere; }
.recipient-heading { margin-top: 18px; font-size: 1rem; }
.badge { display: inline-flex; color: #3d5144; background: #eef2ee; border: 1px solid #dce4de; border-radius: 999px; font-size: .73rem; font-weight: 750; padding: 4px 8px; }
.badge.success { color: var(--green-dark); background: var(--green-soft); border-color: #c7dece; }
.badge.error { color: var(--warning); background: var(--warning-soft); border-color: #efcbc1; }
.summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-radius: 10px; border: 1px solid #d4e1d6; background: #f1f6f0; }
.summary > div { padding: 10px 13px; min-width: 0; }
.summary > div:nth-child(odd) { border-right: 1px solid #d4e1d6; }
.summary > div:nth-child(n+3) { border-top: 1px solid #d4e1d6; }
.summary dt { font-size: .77rem; color: var(--muted); font-weight: 650; }
.summary dd { margin-top: 1px; font: 750 clamp(1.05rem, 1.85vw, 1.62rem)/1.25 system-ui, sans-serif; letter-spacing: -.035em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.result-status { font-size: .84rem; color: var(--muted); margin-top: 12px; }
.result-status.error { color: var(--warning); }
.issues { margin: 6px 0 0; padding-left: 21px; font-size: .84rem; }
.issues li + li { margin-top: 6px; }
.issues a { color: var(--warning); }
.detail-title { font-size: 1rem; margin: 18px 0 7px; }
.settlement { width: 100%; border-collapse: collapse; table-layout: fixed; color: var(--ink); font-size: .81rem; line-height: 1.3; }
.settlement th, .settlement td { padding: 8px 5px; border-bottom: 1px solid var(--line); text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.settlement tr > :first-child { width: 31%; text-align: left; }
.settlement thead th { background: #f1f5f0; color: #3d4b41; font-size: .71rem; }
.settlement tbody th { font-weight: 720; }
.settlement tbody td:last-child { font-weight: 700; }
.employee-detail { display: block; margin-top: 2px; color: var(--muted); font-size: .74rem; font-weight: 450; }
.money-lines { margin-top: 12px; border-top: 1px solid var(--line); }
.money-lines > div { display: flex; gap: 8px; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .84rem; }
.money-lines dt, .money-lines dd { overflow-wrap: anywhere; min-width: 0; }
.money-lines dd { text-align: right; font-weight: 660; font-variant-numeric: tabular-nums; }
.backup { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 9px; }
summary { cursor: pointer; color: var(--ink); font-weight: 700; padding: 6px 0; }
.backup summary { font-size: .84rem; }
.backup p { color: var(--muted); font-size: .83rem; margin-bottom: 9px; }

.help { display: grid; align-items: start; gap: 30px; grid-template-columns: .9fr 1.1fr; padding: 32px 0; margin-top: 32px; margin-bottom: 10px; border-top: 1px solid #ccd7cd; }
.help h2 { font-size: 1.4rem; margin-bottom: 7px; }
.help p { color: var(--muted); font-size: .94rem; }
.boundary { margin-top: 15px; padding: 12px 14px; border-left: 3px solid #91a991; background: #edf2eb; font-size: .9rem; }
.boundary p { margin-top: 5px; font-size: .87rem; }
.faq details { border-bottom: 1px solid var(--line); padding: 4px 1px; }
.faq details p { padding: 0 1px 9px; }
dialog { width: min(620px, calc(100% - 28px)); max-height: 85vh; margin: auto; border: 1px solid #a7baad; background: #fff; border-radius: var(--radius); color: var(--ink); padding: 19px; }
dialog::backdrop { background: #14241bc0; }
.history-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.history-heading h2 { font-size: 1.3rem; }
.history-item { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0; border-block-start: 1px solid var(--line); }
.history-item strong, .history-item p { overflow-wrap: anywhere; }
.history-item p { font-size: .81rem; color: var(--muted); }
#delete-history { margin-top: 12px; }
@media screen { .print-report { display: none; } }

@media (max-width: 900px) {
  .shell { width: calc(100% - 36px); }
  .desk { grid-template-columns: minmax(0, 1fr); }
  .jump-results { display: block; justify-self: end; padding: 5px 3px; margin-block: -9px; font-size: .84rem; font-weight: 680; }
}
@media (max-width: 700px) {
  .intro { align-items: flex-start; flex-direction: column; gap: 15px; padding: 19px 0; }
  .trust { max-width: 100%; }
  .crumb { padding-top: 13px; }
  .actions { align-items: flex-start; flex-direction: column; }
  .help { grid-template-columns: minmax(0, 1fr); gap: 18px; }
}
@media (max-width: 570px) {
  .shell { width: calc(100% - 24px); }
  .panel { padding: 15px; }
  .actions { padding: 11px; }
  .actions .button-group { width: 100%; }
  .actions button { flex: 1; padding-inline: 5px; white-space: nowrap; }
  button { min-height: 44px; }
  .mode-switch button { padding-inline: 4px; }
  .entry-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry-fields > label, .entry-fields > .wide { grid-column: auto; }
  .rule-fields > label:nth-child(3) { grid-column: 1 / -1; }
  .role-settings { grid-template-columns: minmax(0, 1fr); }
  .check-label, .remove { min-height: 42px; }
  .settlement, .settlement tbody, .settlement tr, .settlement th, .settlement td { display: block; width: 100%; }
  .settlement thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .settlement tbody { display: grid; gap: 8px; }
  .settlement tbody tr { padding: 6px 10px 9px; border: 1px solid var(--line); border-radius: 8px; }
  .settlement tbody tr > th:first-child { width: 100%; border-bottom: 1px solid var(--line); padding: 5px 0; margin-bottom: 3px; }
  .settlement td { display: flex; justify-content: space-between; align-items: start; gap: 8px; border: 0; padding: 4px 0; }
  .cell-title { display: inline; color: var(--muted); text-align: left; font-weight: 500; }
}
@media (min-width: 571px) { .cell-title { display: none; } }
