:root {
  --paper: #f3efe4;
  --paper-2: #fffdf8;
  --ink: #1c2430;
  --navy: #1a2744;
  --slate: #3d4a5c;
  --line: #e4dccb;
  --line-strong: #d3c7ae;
  --emerald: #0f6e56;
  --emerald-ink: #0c4f3e;
  --amber: #8a4e08;
  --amber-bg: #f8efd8;
  --danger: #8a3d3d;
  --shadow: 0 16px 40px rgba(26, 39, 68, 0.06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "ui-monospace", "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(1200px 480px at 0% -10%, rgba(161, 92, 7, 0.08), transparent 55%),
    linear-gradient(180deg, #f7f3ea 0%, var(--paper) 280px);
}
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--emerald-ink); }
a:hover { color: var(--navy); }
:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; }

.skip {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  background: var(--navy);
  color: white;
  padding: 0.5rem 0.8rem;
  z-index: 5;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
fieldset { border: none; margin: 0.85rem 0 0; padding: 0; }
legend { font-weight: 700; margin-bottom: 0.45rem; }
.table-scroll { overflow-x: auto; max-width: 100%; }
.skip:focus { top: 0.75rem; }

.wrap { width: min(1120px, calc(100% - 1.5rem)); margin: 0 auto; }
.site-header { padding: 1rem 0 0.35rem; }
.header-inner, .footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}
.brand { display: flex; flex-direction: column; text-decoration: none; color: inherit; min-width: 0; }
.wordmark {
  font-family: var(--serif);
  font-size: 1.85rem;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--navy);
}
.tagline { color: var(--slate); font-size: 0.86rem; }
.nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.nav a, .tabs button, .tabs a {
  text-decoration: none;
  color: var(--navy);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.nav a[aria-current="page"] { background: var(--navy); color: #f6f1e7; }
.tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0.35rem 0 0.85rem;
}
.tabs button, .tabs a {
  border: 1px solid var(--line-strong);
  background: transparent;
  white-space: nowrap;
}
.tabs button[aria-selected="true"], .tabs a[aria-current="page"] {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #f4fbf8;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.02em; color: var(--navy); }
h1 { font-size: clamp(1.8rem, 3vw, 2.4rem); line-height: 1.15; margin: 0 0 0.4rem; }
h2 { font-size: 1.35rem; margin: 1.4rem 0 0.45rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 0.35rem; }
.lede { font-size: 1.05rem; color: var(--slate); margin-top: 0; }
.eyebrow {
  margin: 0 0 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--emerald-ink);
  font-weight: 700;
}
.muted { color: var(--slate); }
.kicker { margin: 0; color: var(--emerald-ink); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.75rem; }

.workspace { display: grid; gap: 1rem; }
.stack { display: grid; gap: 0.9rem; min-width: 0; }
.workspace > *, .card, .summary { min-width: 0; }
.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: var(--shadow);
}
.card h2 { margin-top: 0; }
.form-grid { display: grid; gap: 0.75rem; }
label { display: grid; gap: 0.3rem; font-size: 0.92rem; font-weight: 600; }
label input, label select, .text-input {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  font-weight: 500;
}
.segment { display: flex; gap: 0.4rem; }
.segment label {
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  font-weight: 600;
  background: #fff;
}
.rule-cards { display: grid; gap: 0.55rem; }
.rule-card {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0.7rem;
  background: #fff;
  font-weight: 500;
}
.rule-card strong { display: block; font-family: var(--serif); font-size: 1rem; }
.rule-card span { display: block; color: var(--slate); font-weight: 500; font-size: 0.86rem; }
.rule-note, .warn {
  background: var(--amber-bg);
  color: var(--amber);
  border-left: 3px solid #c4841d;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  margin: 0.7rem 0 0;
  font-size: 0.92rem;
}
.actions, .row-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.btn, .file-btn {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  padding: 0.5rem 0.85rem;
  font-weight: 600;
  color: var(--navy);
}
.btn-primary { background: var(--emerald); border-color: var(--emerald); color: #f4fbf8; }
.btn-primary:hover { background: var(--emerald-ink); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: #e3c4c4; background: #fff8f8; }
.file-btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.shift {
  display: grid;
  gap: 0.2rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}
.shift-top { display: flex; justify-content: space-between; gap: 0.75rem; align-items: baseline; }
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  background: #e7f3ee;
  color: var(--emerald-ink);
  font-size: 0.75rem;
  font-weight: 700;
}
.num, .money, .hours, .figure {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}
.gross-hero { margin: 0.2rem 0; font-size: clamp(2rem, 6vw, 2.7rem); letter-spacing: -0.04em; color: var(--navy); }
.lines { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.lines li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 0.8rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
}
.lines .detail { grid-column: 1 / -1; color: var(--slate); font-size: 0.86rem; }
.week-block + .week-block { margin-top: 1rem; padding-top: 0.2rem; }
.stub-check { margin-top: 0.8rem; padding-top: 0.2rem; }
.stamp {
  border: 1.5px solid var(--amber);
  color: var(--amber);
  background: #fbf6ec;
  padding: 0.7rem 0.75rem;
  border-radius: 10px;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.diff-label { font-weight: 700; margin-bottom: 0.2rem; }
.empty { color: var(--slate); margin: 0.4rem 0; }
.field-error { color: var(--danger); margin: 0.4rem 0 0; }
.calc-table { width: 100%; border-collapse: collapse; }
.calc-table th, .calc-table td {
  text-align: left;
  padding: 0.45rem 0.35rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.calc-table th { font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--slate); }
.site-footer { padding: 1.5rem 0 2rem; color: var(--slate); font-size: 0.92rem; }
.legal-page { padding-bottom: 2rem; }
.prose { max-width: 72ch; overflow-wrap: break-word; }
.prose p, .prose li { font-size: 1rem; }
.updated { color: var(--slate); }

dialog.modal {
  width: min(680px, calc(100vw - 1.25rem));
  max-height: min(88vh, 820px);
  border: none;
  border-radius: 18px;
  padding: 0;
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(26, 39, 68, 0.28);
}
dialog.modal::backdrop { background: rgba(26, 39, 68, 0.62); }
.modal-body { padding: 1.1rem 1.1rem 0.4rem; max-height: calc(88vh - 5.5rem); overflow: auto; }
.modal-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  padding: 0.75rem 1.1rem 1rem;
  background: linear-gradient(180deg, rgba(255, 253, 248, 0), var(--paper-2) 28%);
}
.print-only { display: none; }

@media (min-width: 720px) {
  .form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
  .form-grid.cols-3 { grid-template-columns: 1.1fr 0.8fr 0.8fr; }
  .rule-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .workspace { grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.82fr); align-items: start; }
  .summary { position: sticky; top: 0.75rem; max-height: calc(100vh - 1.5rem); overflow: auto; }
}
@media (max-width: 420px) {
  .wrap { width: min(1120px, calc(100% - 1.1rem)); }
  .wordmark { font-size: 1.6rem; }
  .card { padding: 0.85rem; }
}
@media print {
  body { background: white; }
  .no-print, .site-header, .site-footer, .tabs, dialog { display: none !important; }
  .print-only { display: block; }
  .summary { position: static; max-height: none; overflow: visible; }
  .card, .stamp { box-shadow: none; }
  a { color: inherit; text-decoration: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
