:root {
  color-scheme: light;
  --ink-950: #10272e;
  --ink-800: #274149;
  --ink-600: #5c7077;
  --ink-500: #74868c;
  --navy-950: #072b35;
  --navy-900: #0b3440;
  --navy-800: #124954;
  --teal-700: #07665f;
  --teal-600: #087d73;
  --teal-500: #11958a;
  --teal-100: #dff2ef;
  --teal-50: #eff9f7;
  --amber-500: #f4aa3d;
  --amber-100: #fff0cf;
  --red-700: #97392f;
  --red-100: #fde9e6;
  --green-700: #176441;
  --green-100: #dcf1e6;
  --blue-700: #245a72;
  --blue-100: #e5f2f8;
  --surface: #ffffff;
  --surface-soft: #f7f9f9;
  --canvas: #f1f5f5;
  --line: #dbe4e5;
  --line-strong: #bccacc;
  --shadow-sm: 0 1px 2px rgba(7, 43, 53, .04), 0 6px 18px rgba(7, 43, 53, .04);
  --shadow-md: 0 18px 50px rgba(7, 43, 53, .10);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --header-height: 72px;
  --sidebar-width: 244px;
  --focus: 0 0 0 3px rgba(17, 149, 138, .24);
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
html { min-width: 320px; scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; background: var(--canvas); color: var(--ink-950); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--teal-700); text-underline-offset: 3px; }
img, svg { display: block; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; }
.skip-link { position: fixed; top: -100px; left: 8px; z-index: 1000; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface); color: var(--navy-900); font-weight: 800; transition: top .18s ease; }
.skip-link:focus { top: 8px; }

h1, h2, h3, p { overflow-wrap: break-word; }
h1 { margin: 0; font-size: clamp(2rem, 3.2vw, 3.15rem); line-height: 1.08; letter-spacing: -.045em; }
h2 { margin: 0; font-size: 1.22rem; line-height: 1.3; letter-spacing: -.012em; }
h3 { margin: 26px 0 12px; font-size: 1rem; }
.muted { color: var(--ink-600); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: .8rem; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 80;
  height: var(--header-height);
  padding: 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--navy-900);
  color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,.08);
}
.brand { min-width: 0; display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; background: var(--amber-500); color: var(--navy-950); font-size: 1.35rem; font-weight: 950; box-shadow: inset 0 0 0 1px rgba(255,255,255,.32); }
.brand-copy { min-width: 0; }
.brand strong, .brand small, .user-copy strong, .user-copy small { display: block; }
.brand strong { font-size: .95rem; letter-spacing: -.01em; }
.brand small { margin-top: 1px; color: #b9cbd0; font-size: .73rem; }
.secure-label, .role-badge { padding: 6px 10px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; color: #dce9eb; font-size: .72rem; font-weight: 800; letter-spacing: .03em; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--teal-600); color: white; font-weight: 900; }
.user-copy strong { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.user-copy small { color: #afc5c9; font-size: .68rem; }
.topbar-logout { margin-left: 4px; }
.topbar-logout button { min-height: 38px; padding: 0 10px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid rgba(255,255,255,.14); border-radius: 9px; background: rgba(255,255,255,.06); color: white; cursor: pointer; }
.topbar-logout button:hover { background: rgba(255,255,255,.12); }
.topbar-logout button span { font-size: .78rem; font-weight: 800; }

.app-layout { min-height: calc(100vh - var(--header-height)); display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.app-sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  padding: 22px 14px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.app-sidebar nav { display: grid; gap: 3px; }
.nav-label { margin: 18px 12px 6px; color: var(--ink-500); font-size: .66rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.nav-label:first-child { margin-top: 0; }
.app-sidebar a { min-height: 44px; padding: 0 12px; display: flex; align-items: center; gap: 11px; border-radius: 10px; color: var(--ink-600); text-decoration: none; font-size: .87rem; font-weight: 750; transition: color .16s ease, background .16s ease, transform .16s ease; }
.app-sidebar a:hover { background: var(--surface-soft); color: var(--ink-950); transform: translateX(2px); }
.app-sidebar a.active { background: var(--teal-100); color: var(--teal-700); }
.app-sidebar a.active .icon { stroke-width: 2.2; }
.sidebar-foot { padding: 13px 12px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.sidebar-foot > span:last-child { min-width: 0; }
.sidebar-foot strong, .sidebar-foot small { display: block; }
.sidebar-foot strong { font-size: .75rem; }
.sidebar-foot small { color: var(--ink-600); font-size: .66rem; }
.system-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: #35a96d; box-shadow: 0 0 0 4px #dff3e8; }
.app-main { min-width: 0; padding: 38px clamp(24px, 4vw, 58px) 76px; }
.public-main { min-height: calc(100vh - var(--header-height)); }
.public-main > .page-shell { margin-top: 32px; margin-bottom: 64px; padding-inline: 12px; }
.mobile-nav { display: none; }

.page-shell { width: min(920px, 100%); margin: 0 auto; }
.wide-shell { width: min(1280px, 100%); }
.report-shell { width: min(960px, 100%); }
.breadcrumb { min-height: 24px; margin-bottom: 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: var(--ink-500); font-size: .77rem; }
.breadcrumb a { color: var(--ink-600); text-decoration: none; }
.breadcrumb a:hover { color: var(--teal-700); text-decoration: underline; }
.breadcrumb span:not(:last-child) { color: #a5b2b6; }
.page-heading { margin-bottom: 26px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.page-heading > div:first-child { min-width: 0; }
.page-heading h1 { margin-top: 3px; }
.page-heading p:not(.eyebrow) { max-width: 760px; margin: 8px 0 0; color: var(--ink-600); font-size: .96rem; }
.heading-actions { max-width: 50%; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 9px; }
.eyebrow { margin: 0; color: var(--teal-700) !important; font-size: .68rem; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.eyebrow.light { color: #8ee1d8 !important; }
.step-chip { flex: 0 0 auto; padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-600); font-size: .74rem; font-weight: 800; }
.section-gap { margin-top: 28px; }
.section-intro { max-width: 780px; margin: 6px 0 14px; color: var(--ink-600); font-size: .84rem; }
.section-heading, .section-heading-row { margin-bottom: 22px; display: flex; align-items: flex-start; gap: 13px; }
.section-heading-row { justify-content: space-between; }
.section-heading > span { width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; background: var(--teal-100); color: var(--teal-700); font-weight: 950; }
.section-heading > span .icon { width: 17px; height: 17px; }
.section-heading p, .section-heading-row p { margin: 4px 0 0; color: var(--ink-600); font-size: .84rem; }

.form-card, .emergency-card, .section-card {
  padding: clamp(20px, 2.3vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.form-card > h2 + p, .section-card > h2 + p { margin: 6px 0 0; color: var(--ink-600); }
.report-form { display: grid; gap: 18px; }
.report-workspace { display: grid; gap: 18px; }
.stack-form { margin-top: 20px; display: grid; gap: 17px; }
.field-grid, .time-grid { display: grid; gap: 17px; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.time-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.shift-time-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { min-width: 0; display: grid; align-content: start; gap: 7px; color: var(--ink-800); font-size: .82rem; font-weight: 800; }
.field > span, .field > label > span { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.field > label { color: var(--ink-800); font-size: .82rem; font-weight: 800; }
.field small, .field-hint { color: var(--ink-500); font-size: .72rem; font-weight: 550; line-height: 1.4; }
.field em { padding: 2px 5px; border-radius: 4px; background: var(--teal-50); color: var(--teal-700); font-size: .58rem; font-style: normal; letter-spacing: .06em; text-transform: uppercase; }
.field input, .field select, .field textarea, .inline-form input, .inline-form select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: 0;
  background: var(--surface);
  color: var(--ink-950);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.field input[type="date"], .field input[type="time"] { min-width: 0; max-width: 100%; }
.field textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder, .inline-form input::placeholder { color: #97a6aa; }
.field input:hover, .field select:hover, .field textarea:hover, .inline-form input:hover, .inline-form select:hover { border-color: #96aaad; }
.field input:focus, .field select:focus, .field textarea:focus, .inline-form input:focus, .inline-form select:focus { border-color: var(--teal-500); box-shadow: var(--focus); }
.field input:user-invalid, .field select:user-invalid, .field textarea:user-invalid { border-color: #c9685e; }
.textarea-field { margin-top: 17px; }
.comment-field textarea { border-color: #dfc98f; background: #fffdf7; }
.comment-field textarea:focus { border-color: var(--amber-500); box-shadow: 0 0 0 3px rgba(244,170,61,.2); }
.comment-field > span small { margin-left: auto; color: #805914; font-size: .65rem; }
.autocomplete-field { position: relative; }
.autocomplete-control { position: relative; }
.autocomplete-menu { position: absolute; z-index: 35; top: calc(100% + 5px); left: 0; right: 0; max-height: 250px; padding: 5px; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow-md); }
.autocomplete-menu[hidden] { display: none; }
.autocomplete-menu button { width: 100%; min-height: 38px; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-800); cursor: pointer; text-align: left; }
.autocomplete-menu button:hover, .autocomplete-menu button.active, .autocomplete-menu button[aria-selected="true"] { background: var(--teal-100); color: var(--teal-700); }
.autocomplete-menu button[hidden] { display: none; }
.autocomplete-empty { margin: 0; padding: 10px; color: var(--ink-500); font-size: .76rem; font-weight: 600; }
.check-field { min-height: 46px; display: flex; align-items: center; gap: 9px; color: var(--ink-600); font-size: .8rem; cursor: pointer; }
.check-field input, .checkbox-cell input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--teal-600); }
.check-field input:focus-visible, .checkbox-cell input:focus-visible { outline: 3px solid rgba(17,149,138,.3); outline-offset: 2px; }
.rescue-fields { margin-top: 17px; padding: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 17px; border: 1px solid #cfe4e1; border-radius: var(--radius-md); background: var(--teal-50); }
.rescue-fields[hidden] { display: none; }
.edit-shift-time-grid, .edit-rescue-grid { margin-top: 17px; }
.break-disclosure { margin-top: 15px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-soft); }
.break-disclosure summary { min-height: 56px; padding: 11px 14px; display: flex; align-items: center; gap: 11px; cursor: pointer; list-style: none; color: var(--ink-800); }
.break-disclosure summary::-webkit-details-marker { display: none; }
.break-disclosure summary::before { width: 24px; height: 24px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 7px; background: var(--teal-100); color: var(--teal-700); content: "+"; font-size: 1rem; font-weight: 900; }
.break-disclosure[open] summary::before { content: "−"; }
.break-disclosure summary:hover { background: #f2f7f6; }
.break-disclosure summary:focus-visible { outline: 3px solid rgba(17,149,138,.32); outline-offset: -3px; }
.break-disclosure summary > span:first-of-type { min-width: 0; margin-right: auto; display: grid; }
.break-disclosure summary strong { font-size: .83rem; }
.break-disclosure summary small { color: var(--ink-600); font-size: .72rem; font-weight: 600; }
.disclosure-action { color: var(--teal-700); font-size: .72rem; font-weight: 850; white-space: nowrap; }
.break-disclosure[open] .disclosure-action { font-size: 0; }
.break-disclosure[open] .disclosure-action::after { content: "Dölj"; font-size: .72rem; }
.break-panel { padding: 13px 14px 14px; border-top: 1px solid var(--line); background: var(--surface); }
.break-panel > p { margin: 0 0 10px; color: var(--ink-600); font-size: .73rem; }
.break-list { display: grid; gap: 10px; }
.break-row { padding: 15px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-soft); }
.break-panel .text-button { margin-top: 8px; }
.emergency-card { display: flex; align-items: center; justify-content: space-between; gap: 28px; border-left: 4px solid var(--amber-500); background: linear-gradient(100deg, #fffaf0 0, var(--surface) 55%); }
.emergency-card p:not(.eyebrow) { max-width: 680px; margin: 7px 0 0; color: var(--ink-600); }
.segmented { flex: 0 0 auto; display: flex; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span, .segmented button { min-width: 68px; padding: 9px 14px; display: block; border: 0; border-radius: 8px; background: transparent; color: var(--ink-600); font-weight: 850; text-align: center; }
.segmented input:checked + span, .segmented .active { background: var(--surface); color: var(--ink-950); box-shadow: 0 2px 8px rgba(12,44,51,.11); }
.segmented input:focus-visible + span { box-shadow: var(--focus); }
.form-actions { padding-top: 6px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; }
.form-stepper { width: 100%; margin: -4px 0 18px; padding: 5px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.72); }
.form-stepper a { min-height: 38px; padding: 6px 10px; display: flex; align-items: center; justify-content: center; gap: 7px; border-radius: 8px; color: var(--ink-600); text-decoration: none; font-size: .73rem; font-weight: 800; }
.form-stepper a:hover { background: var(--teal-50); color: var(--teal-700); }
.form-stepper a span { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 6px; background: var(--teal-100); color: var(--teal-700); font-size: .66rem; }

.primary-button, .secondary-button, .danger-button, .primary-link, .secondary-link, .text-button, .remove-button, .inline-form button {
  min-height: 44px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 850;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease, border-color .14s ease, color .14s ease;
}
.primary-button, .primary-link, .inline-form button { border: 1px solid var(--teal-700); background: var(--teal-600); color: white; box-shadow: 0 5px 14px rgba(8,125,115,.16); }
.primary-button:hover, .primary-link:hover, .inline-form button:hover { background: var(--teal-700); box-shadow: 0 8px 20px rgba(8,125,115,.2); transform: translateY(-1px); }
.secondary-button, .secondary-link { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-800); }
.secondary-button:hover, .secondary-link:hover { border-color: #94a9ac; background: var(--surface-soft); color: var(--ink-950); }
.danger-button { border: 1px solid #d29a94; background: var(--surface); color: var(--red-700); }
.danger-button:hover { border-color: var(--red-700); background: var(--red-100); }
.text-button, .remove-button { min-height: 38px; padding: 0 4px; border: 0; background: transparent; color: var(--teal-700); box-shadow: none; }
.text-button { margin-top: 14px; }
.remove-button { color: var(--red-700); }
.primary-button.full { width: 100%; }
button:disabled, .primary-button:disabled, .secondary-button:disabled { cursor: not-allowed; opacity: .48; transform: none; box-shadow: none; }
.primary-button:focus-visible, .secondary-button:focus-visible, .danger-button:focus-visible, .primary-link:focus-visible, .secondary-link:focus-visible, .text-button:focus-visible, .remove-button:focus-visible, .inline-form button:focus-visible, .topbar-logout button:focus-visible, .app-sidebar a:focus-visible, .mobile-nav a:focus-visible { outline: 3px solid rgba(17,149,138,.38); outline-offset: 2px; }
.is-loading::after { width: 14px; height: 14px; content: ""; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.alert { position: relative; margin: 18px 0; padding: 14px 16px 14px 42px; border: 1px solid; border-radius: var(--radius-md); font-size: .84rem; font-weight: 650; }
.alert::before { position: absolute; left: 16px; top: 13px; width: 18px; height: 18px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; content: "i"; font-size: .7rem; font-weight: 950; }
.alert.error { border-color: #efc0ba; background: #fff3f1; color: #842b22; }
.alert.error::before { content: "!"; }
.alert.success { border-color: #b8dfcc; background: #edf8f3; color: var(--green-700); }
.alert.success::before { content: "✓"; }
.alert.warning { border-color: #ead19c; background: #fff8e8; color: #74500d; }
.alert.warning::before { content: "!"; }
.validation-list { margin: 15px 0; display: grid; gap: 9px; }
.validation { padding: 13px 15px; display: grid; gap: 3px; border: 1px solid; border-radius: 10px; font-size: .8rem; }
.validation-error { border-color: #eebdb8; background: #fff3f1; color: #842b22; }
.validation-warning { border-color: #ead19c; background: #fff8e8; color: #74500d; }
.validation-info { border-color: #bddde9; background: #eff8fb; color: var(--blue-700); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-grid article { position: relative; min-height: 138px; padding: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.metric-grid article::after { position: absolute; top: 0; right: 0; width: 58px; height: 58px; border-radius: 0 0 0 58px; background: var(--teal-50); content: ""; }
.metric-grid span, .metric-grid small { position: relative; z-index: 1; display: block; color: var(--ink-600); }
.metric-grid span { font-size: .76rem; font-weight: 800; }
.metric-grid strong { position: relative; z-index: 1; margin: 10px 0 5px; display: block; font-size: clamp(1.8rem, 3vw, 2.35rem); line-height: 1.1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.metric-grid small { font-size: .71rem; line-height: 1.35; }
.metric-grid .metric-text { font-size: 1.12rem; letter-spacing: -.02em; overflow-wrap: anywhere; }
.batch-metrics { margin-bottom: 20px; }
.mini-metrics { margin-top: 16px; grid-template-columns: repeat(3, 1fr); }

.dashboard-shell { width: min(1180px, 100%); }
.dashboard-hero { position: relative; padding: clamp(26px, 4vw, 42px); overflow: hidden; border-radius: var(--radius-xl); background: linear-gradient(130deg, var(--navy-900), var(--navy-800)); color: white; box-shadow: var(--shadow-md); }
.dashboard-hero::after { position: absolute; width: 320px; height: 320px; right: -130px; top: -170px; border: 55px solid rgba(255,255,255,.05); border-radius: 50%; content: ""; }
.dashboard-hero .eyebrow { color: #8ee1d8 !important; }
.dashboard-hero p:not(.eyebrow) { max-width: 630px; margin: 10px 0 24px; color: #c7dadd; }
.dashboard-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.dashboard-hero .secondary-link { border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.08); color: white; }
.dashboard-grid { margin-top: 18px; display: grid; grid-template-columns: 1.25fr .75fr; gap: 16px; }
.workflow-list { margin-top: 16px; display: grid; gap: 8px; }
.workflow-list a { padding: 13px 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink-800); text-decoration: none; font-weight: 750; }
.workflow-list a:hover { border-color: #bad6d2; background: var(--teal-50); color: var(--teal-700); }
.workflow-list .icon { width: 18px; }
.quick-note { padding: 22px; border: 1px solid #f0d6a5; border-radius: var(--radius-lg); background: linear-gradient(145deg, #fff9eb, #fffdf8); }
.quick-note p { color: var(--ink-600); }

.table-card { position: relative; overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); scrollbar-color: #b7c7ca transparent; }
.table-card:focus-visible { outline: 3px solid rgba(17,149,138,.25); outline-offset: 3px; }
table { width: 100%; min-width: 680px; border-collapse: separate; border-spacing: 0; font-size: .82rem; }
th, td { padding: 13px 15px; border-bottom: 1px solid #e6ecec; text-align: left; vertical-align: middle; white-space: nowrap; }
thead th { position: sticky; top: 0; z-index: 2; background: #f6f9f9; color: var(--ink-600); font-size: .66rem; font-weight: 900; letter-spacing: .065em; text-transform: uppercase; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #f9fbfb; }
tbody tr:last-child td { border-bottom: 0; }
td a { color: var(--teal-700); font-weight: 850; text-decoration: none; }
td a:hover { text-decoration: underline; }
td small { color: var(--ink-500); }
tfoot th { border-top: 2px solid var(--line-strong); border-bottom: 0; background: #eef4f3; color: var(--ink-950); }
.compact-table { margin-top: 14px; }
.empty-cell { padding: 44px 24px; white-space: normal; text-align: center; }
.empty-state { max-width: 430px; margin: 0 auto; display: grid; justify-items: center; gap: 5px; color: var(--ink-600); }
.empty-state strong { color: var(--ink-800); font-size: .9rem; }
.empty-state span { font-size: .78rem; }
.empty-state-icon { width: 30px; height: 30px; margin-bottom: 4px; color: #90a2a6; }
.table-subline { margin-top: 4px; display: block; color: var(--ink-500); font-size: .7rem; white-space: normal; }
.numeric-cell { text-align: right; font-variant-numeric: tabular-nums; }
.checkbox-cell { width: 42px; padding-right: 6px; text-align: center; }
.report-selection-table tr[hidden], tr[data-cost-line][hidden] { display: none; }
.report-selection-table { min-width: 1000px; table-layout: fixed; font-size: .76rem; }
.report-selection-table th, .report-selection-table td { padding: 10px 8px; white-space: normal; }
.report-selection-table th:nth-child(1) { width: 42px; }
.report-selection-table th:nth-child(2) { width: 110px; }
.report-selection-table th:nth-child(3) { width: 110px; }
.report-selection-table th:nth-child(4) { width: 100px; }
.report-selection-table th:nth-child(5) { width: 110px; }
.report-selection-table th:nth-child(6) { width: 85px; }
.report-selection-table th:nth-child(7) { width: 95px; }
.report-selection-table th:nth-child(8) { width: 200px; }
.report-selection-table th:nth-child(9) { width: 65px; }
.report-selection-table th:nth-child(10) { width: 83px; }
.comment-cell { min-width: 260px; max-width: 420px; background: #fffdf7; color: var(--ink-800); font-weight: 650; line-height: 1.45; white-space: normal; }
.comment-cell .empty-comment { color: var(--ink-500); font-weight: 500; }
.comment-cell hr { margin: 8px 0; border: 0; border-top: 1px solid #eadfbf; }
.reference-cell { min-width: 85px; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: .78rem; }
.batch-number-subtle { color: var(--ink-500); font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: .72rem; font-weight: 700; }
.batch-number-subtle:hover { color: var(--teal-700); }
.batch-report-table { min-width: 1380px; }
.batch-report-table td { vertical-align: top; }
.batch-report-table .comment-cell { min-width: 300px; }
.invoice-snapshot-table { min-width: 880px; table-layout: fixed; }
.invoice-snapshot-table th, .invoice-snapshot-table td { padding: 11px 10px; white-space: normal; }
.invoice-snapshot-table th:nth-child(1) { width: 125px; }
.invoice-snapshot-table th:nth-child(2) { width: 145px; }
.invoice-snapshot-table th:nth-child(3) { width: 190px; }
.invoice-snapshot-table th:nth-child(4) { width: 285px; }
.invoice-snapshot-table th:nth-child(5) { width: 60px; }
.invoice-snapshot-table th:nth-child(6) { width: 95px; }
.invoice-snapshot-table .comment-cell { min-width: 0; }
.batch-meta-line { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 7px 14px; color: var(--ink-600); font-size: .78rem; }
.batch-meta-line .batch-number-subtle { align-self: center; }

.status { min-height: 26px; padding: 4px 9px; display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; background: #e9eeee; color: #495a60; font-size: .64rem; font-weight: 900; letter-spacing: .025em; white-space: nowrap; }
.status::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; opacity: .75; }
.status-approved, .status-included_in_batch, .status-invoiced, .status-approved_by_borealis, .status-complete { background: var(--green-100); color: var(--green-700); }
.status-needs_classification, .status-rejected, .status-warning { background: var(--amber-100); color: #87510b; }
.status-void, .status-error { background: var(--red-100); color: var(--red-700); }
.status-exported_to_borealis, .status-info { background: var(--blue-100); color: var(--blue-700); }

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
dl { margin: 16px 0 0; }
dl div { padding: 10px 0; display: grid; grid-template-columns: minmax(120px, 145px) minmax(0, 1fr); gap: 14px; border-bottom: 1px solid #e7eded; }
dl div:last-child { border-bottom: 0; }
dt { color: var(--ink-600); font-size: .8rem; }
dd { min-width: 0; margin: 0; font-weight: 750; overflow-wrap: anywhere; }

.subnav { width: fit-content; max-width: 100%; margin-bottom: 22px; padding: 4px; display: flex; gap: 3px; overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow-sm); }
.subnav a { padding: 8px 13px; border-radius: 8px; color: var(--ink-600); text-decoration: none; font-size: .79rem; font-weight: 850; white-space: nowrap; }
.subnav a:hover { color: var(--ink-950); background: var(--surface-soft); }
.subnav a.active { background: var(--teal-100); color: var(--teal-700); }
.inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.inline-form input, .inline-form select { min-width: 110px; min-height: 40px; padding: 7px 10px; border-radius: 8px; }
.inline-form button { min-height: 40px; padding: 0 13px; border-radius: 8px; }
.batch-filter { margin-top: 18px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 12px; align-items: end; }
.batch-filter-wide { grid-template-columns: 145px 145px minmax(210px, 1.4fr) minmax(170px, 1fr) auto; }
.batch-reference-search small { color: var(--ink-500); font-size: .7rem; }
.month-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 15px; }
.month-toolbar .inline-form { align-items: end; }
.reference-pills { max-width: 420px; display: flex; flex-wrap: wrap; gap: 5px; white-space: normal; }
.reference-pills span { padding: 3px 7px; border: 1px solid #d7e6e4; border-radius: 6px; background: var(--teal-50); color: #355158; font-size: .67rem; font-weight: 800; }
.reference-pills-large { max-width: none; margin: 15px 0; }
.reference-pills-large span { padding: 6px 9px; font-size: .73rem; }
.reference-summary { min-width: 0; display: grid; gap: 5px; white-space: normal; }
.reference-summary > span { min-width: 0; display: grid; gap: 1px; }
.reference-summary > span + span { padding-top: 5px; border-top: 1px solid var(--line); }
.reference-summary strong { overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: .76rem; line-height: 1.25; }
.reference-summary small { color: var(--ink-500); font-size: .62rem; font-weight: 800; line-height: 1.2; }
.reference-summary .reference-missing { color: var(--ink-500); font-size: .72rem; font-style: italic; }
.batch-history-table td { vertical-align: top; white-space: normal; }
.batch-history-table td:first-child, .batch-history-table td:nth-last-child(-n+3) { white-space: nowrap; }
.batch-history-table { min-width: 1160px; }
.batch-history-table .comment-cell { min-width: 280px; }
.stacked-values { display: grid; gap: 4px; white-space: normal; }
.stacked-values span { overflow-wrap: anywhere; }

.finance-shell { width: 100%; max-width: 1480px; }
.finance-heading { margin-bottom: 18px; }
.finance-workflow { margin: 0 0 18px; padding: 5px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.7); list-style: none; }
.finance-workflow li { min-height: 42px; padding: 7px 10px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 9px; color: var(--ink-500); font-size: .72rem; }
.finance-workflow li.active { background: var(--teal-50); color: var(--teal-700); }
.finance-workflow li span { width: 22px; height: 22px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 7px; background: #e7eeee; font-size: .67rem; font-weight: 900; }
.finance-workflow li.active span { background: var(--teal-100); }
.finance-period-card { padding: 20px; }
.finance-period-card .section-heading-row { margin-bottom: 15px; }
.finance-period-form { display: grid; grid-template-columns: 145px 145px minmax(240px, 1.5fr) minmax(180px, .9fr) auto auto; gap: 10px; align-items: end; }
.finance-period-form .primary-button, .finance-period-form .secondary-link { min-height: 46px; white-space: nowrap; }
.server-filter-strip { margin-top: 13px; padding-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; border-top: 1px solid var(--line); color: var(--ink-600); font-size: .72rem; }
.server-filter-strip strong { color: var(--ink-800); }
.server-filter-strip span { padding: 4px 8px; border: 1px solid #d1e4e1; border-radius: 999px; background: var(--teal-50); color: #315d59; font-weight: 750; }
.finance-selection-section { min-width: 0; }
.finance-section-heading { margin-bottom: 14px; }
.selection-summary-bar { margin-bottom: 12px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow-sm); }
.selection-summary-bar article { min-width: 0; padding: 13px 15px; display: grid; align-content: center; border-right: 1px solid var(--line); }
.selection-summary-bar article:last-child { border-right: 0; }
.selection-summary-bar span, .selection-summary-bar small { color: var(--ink-600); font-size: .68rem; font-weight: 750; }
.selection-summary-bar strong { margin: 2px 0; color: var(--ink-950); font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.finance-table-toolbar { margin-bottom: 9px; display: grid; grid-template-columns: minmax(260px, 1fr) auto auto 125px; gap: 9px; align-items: end; }
.finance-global-search input { background: #fbfdfd; }
.finance-selection-actions { display: flex; gap: 7px; }
.finance-selection-actions .secondary-button, .column-menu > summary { min-height: 46px; white-space: nowrap; }
.column-menu { position: relative; }
.column-menu > summary { list-style: none; }
.column-menu > summary::-webkit-details-marker { display: none; }
.column-menu-panel { position: absolute; z-index: 40; top: calc(100% + 7px); right: 0; width: 250px; padding: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 7px 10px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-md); }
.column-menu-panel label { display: flex; align-items: center; gap: 6px; color: var(--ink-700); font-size: .72rem; font-weight: 700; }
.column-menu-panel input { accent-color: var(--teal-600); }
.column-menu-panel .text-button { grid-column: 1 / -1; justify-self: start; margin-top: 3px; min-height: 30px; }
.page-size-field { min-width: 120px; }
.active-filter-bar { min-height: 42px; margin-bottom: 9px; padding: 7px 9px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; border: 1px dashed #cbd9da; border-radius: 10px; background: rgba(255,255,255,.56); color: var(--ink-600); font-size: .7rem; }
.active-filter-bar > strong { margin-right: 2px; color: var(--ink-800); }
.active-filter-bar > .text-button { min-height: 28px; margin: 0 0 0 auto; padding-inline: 8px; font-size: .69rem; }
.filter-chip { min-height: 28px; padding: 4px 8px; border: 1px solid #c9dfdc; border-radius: 999px; background: var(--teal-50); color: var(--teal-700); cursor: pointer; font-size: .68rem; font-weight: 800; }
.finance-table-frame { max-height: min(64vh, 720px); border-radius: 12px; }
.finance-table { width: max-content; min-width: 100%; table-layout: fixed; font-size: .73rem; }
.finance-table th, .finance-table td { padding: 9px 8px; white-space: normal; }
.finance-table thead .finance-header-row th { top: 0; z-index: 8; height: 42px; background: #edf4f3; resize: horizontal; overflow: hidden; }
.finance-table thead .finance-column-filters th { top: 42px; z-index: 7; height: 45px; padding: 5px; background: #f8fbfb; }
.finance-table th:nth-child(1) { width: 42px; }
.finance-table th:nth-child(2) { width: 38px; }
.finance-table th[data-column="date"] { width: 104px; }
.finance-table th[data-column="reference"] { width: 170px; }
.finance-table th[data-column="name"] { width: 135px; }
.finance-table th[data-column="time"] { width: 92px; }
.finance-table th[data-column="service"] { width: 135px; }
.finance-table th[data-column="hours"] { width: 76px; }
.finance-table th[data-column="comment"] { width: 250px; }
.finance-table th[data-column="status"] { width: 105px; }
.finance-table th[data-column="amount"] { width: 100px; }
.finance-table .finance-sticky-select { position: sticky; left: 0; z-index: 6; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
.finance-table thead .finance-sticky-select { z-index: 12; background: #edf4f3; }
.finance-table thead .finance-column-filters .finance-sticky-select { z-index: 11; background: #f8fbfb; }
.sort-button { width: 100%; padding: 0; display: flex; align-items: center; justify-content: space-between; gap: 5px; border: 0; background: transparent; color: var(--ink-700); cursor: pointer; font: inherit; font-weight: 900; letter-spacing: inherit; text-align: left; text-transform: uppercase; }
.sort-button span { color: var(--teal-600); font-size: .8rem; }
.finance-column-filters input, .finance-column-filters select { width: 100%; min-width: 0; height: 31px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; outline: 0; background: var(--surface); color: var(--ink-800); font-size: .7rem; }
.finance-column-filters input:focus, .finance-column-filters select:focus { border-color: var(--teal-500); box-shadow: 0 0 0 2px rgba(17,149,138,.18); }
.filter-period-note { color: var(--ink-500); font-size: .63rem; font-weight: 700; text-transform: none; }
.finance-report-row.needs-attention-row td { background-color: #fffcf3; }
.finance-report-row:hover td { background-color: #f4f9f8; }
.finance-report-row:hover .finance-sticky-select { background-color: #f4f9f8; }
.row-detail-column { width: 38px; padding-inline: 4px !important; text-align: center; }
.row-detail-button { width: 27px; height: 27px; display: inline-grid; place-items: center; border: 1px solid #bfd4d1; border-radius: 7px; background: var(--teal-50); color: var(--teal-700); cursor: pointer; font-size: .9rem; font-weight: 900; }
.finance-comment-cell { min-width: 0; max-width: none; background: #fffaf0 !important; color: #4e3c1b; font-weight: 700; line-height: 1.42; }
.finance-comment-copy { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.finance-comment-cell:hover .finance-comment-copy,
.finance-comment-cell:focus-within .finance-comment-copy { display: block; }
.billing-blocked-row > td { background: #fff6f5; }
.billing-blocked-row > td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.time-range { font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; }
.finance-detail-row td { padding: 0; background: #f4f8f7; }
.finance-row-detail { padding: 14px 16px 16px 50px; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; border-bottom: 1px solid var(--line); box-shadow: inset 4px 0 0 var(--teal-500); }
.finance-row-detail > div { min-width: 0; display: grid; align-content: start; gap: 3px; }
.finance-row-detail span { color: var(--ink-500); font-size: .64rem; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.finance-row-detail strong, .finance-row-detail a { overflow-wrap: anywhere; white-space: normal; font-size: .75rem; }
.finance-row-detail .detail-attention { color: #80520b; }
.selection-pagination { margin-top: 10px; }
.selection-pagination > [data-visible-count] { margin-right: auto; }
.finance-review-grid { margin: 16px 0 92px; display: grid; gap: 8px; }
.review-disclosure { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); }
.review-disclosure > summary { min-height: 54px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.review-disclosure > summary::-webkit-details-marker { display: none; }
.review-disclosure > summary::before { width: 24px; height: 24px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 7px; background: var(--surface-soft); color: var(--ink-600); content: "+"; font-weight: 900; }
.review-disclosure[open] > summary::before { content: "−"; }
.review-disclosure > summary:hover { background: #fafcfc; }
.review-disclosure > summary span { display: grid; }
.review-disclosure > summary small { color: var(--ink-500); font-size: .7rem; }
.review-disclosure-body { padding: 0 14px 14px; border-top: 1px solid var(--line); }
.review-disclosure-body .validation-list { margin-bottom: 0; }
.review-disclosure-body > .table-card { margin-top: 14px; }
.finance-finalize-dock { position: sticky; z-index: 25; bottom: 12px; margin: 0 auto; padding: 11px 12px 11px 16px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid rgba(183,202,202,.9); border-radius: 15px; background: rgba(255,255,255,.95); box-shadow: 0 16px 42px rgba(7,43,53,.18); backdrop-filter: blur(16px); }
.finance-finalize-dock > div { display: grid; grid-template-columns: auto auto; align-items: baseline; gap: 2px 14px; }
.finance-finalize-dock > div > strong { font-size: .92rem; }
.finance-finalize-dock > div > span { color: var(--ink-700); font-size: .8rem; font-weight: 800; }
.finance-finalize-dock small { grid-column: 1 / -1; color: var(--ink-500); font-size: .67rem; }
.finance-finalize-dock .primary-button { flex: 0 0 auto; }
.history-search { width: min(300px, 100%); }
.finance-history-table { min-width: 980px; }
.finance-history-table th:first-child { width: 135px; }
.finance-history-table th:nth-child(2) { width: 190px; }
.finance-history-table th:nth-child(3) { width: 260px; }
.finance-history-table th:nth-child(4) { width: 310px; }
.monthly-detail-section .section-heading-row > span { color: var(--ink-600); font-size: .75rem; font-weight: 800; }
.monthly-filter-toolbar { margin-bottom: 10px; display: grid; grid-template-columns: minmax(280px, 1.6fr) repeat(3, minmax(145px, .7fr)) auto; gap: 9px; align-items: end; }
.monthly-filter-toolbar .secondary-button { min-height: 46px; }
.monthly-finance-table { max-height: min(68vh, 760px); }
.monthly-finance-table .batch-report-table { min-width: 1260px; }
.monthly-finance-table thead th { resize: horizontal; overflow: hidden; }
.monthly-finance-table th:nth-child(1) { width: 185px; }
.monthly-finance-table th:nth-child(2) { width: 145px; }
.monthly-finance-table th:nth-child(3) { width: 150px; }
.monthly-finance-table th:nth-child(4) { width: 125px; }
.monthly-finance-table th:nth-child(5) { width: 190px; }
.monthly-finance-table th:nth-child(6) { width: 300px; }
.monthly-finance-table th:nth-child(7) { width: 80px; }
.monthly-finance-table th:nth-child(8) { width: 145px; }
.monthly-finance-table th:nth-child(9) { width: 110px; }
.monthly-finance-table th:nth-child(10) { width: 110px; }
.process-card .alert { margin-bottom: 0; }
.process-secondary-action { margin-top: 7px; }
.process-secondary-action .text-button { margin-top: 0; }
.technical-meta { margin-top: 14px; border-top: 1px solid var(--line); }
.technical-meta summary { padding-top: 12px; color: var(--teal-700); cursor: pointer; font-size: .75rem; font-weight: 800; }
.sort-button:focus-visible, .row-detail-button:focus-visible, .filter-chip:focus-visible, .column-menu > summary:focus-visible, .review-disclosure > summary:focus-visible { outline: 3px solid rgba(17,149,138,.34); outline-offset: 2px; }

@media (min-width: 901px) {
  .finance-shell .breadcrumb { display: none; }
  .finance-shell .subnav { margin-bottom: 12px; }
  .finance-heading { margin-bottom: 11px; align-items: center; }
  .finance-heading h1 { font-size: clamp(2rem, 2.8vw, 2.7rem); }
  .finance-heading p:not(.eyebrow) { margin-top: 4px; font-size: .84rem; }
  .finance-workflow { margin-bottom: 11px; }
  .finance-workflow li { min-height: 34px; padding-block: 4px; }
  .finance-period-card { padding: 14px 16px; }
  .finance-period-card .section-heading-row { margin-bottom: 8px; }
  .finance-period-card .section-heading-row h2 { font-size: 1.05rem; }
  .finance-period-card .section-heading-row p { margin-top: 2px; font-size: .72rem; }
  .finance-period-form .field { gap: 4px; font-size: .72rem; }
  .finance-period-form .field input,
  .finance-period-form .field select,
  .finance-period-form .primary-button,
  .finance-period-form .secondary-link { min-height: 40px; }
  .finance-period-form .field small { font-size: .62rem; }
  .server-filter-strip { margin-top: 8px; padding-top: 8px; }
  .finance-selection-section.section-gap { margin-top: 16px; }
  .finance-section-heading { margin-bottom: 8px; }
  .finance-section-heading h2 { font-size: 1.18rem; }
  .finance-section-heading p:not(.eyebrow) { margin-top: 2px; font-size: .75rem; }
  .selection-summary-bar { margin-bottom: 8px; }
  .selection-summary-bar article { padding: 8px 14px; }
  .finance-table-toolbar { margin-bottom: 6px; }
  .active-filter-bar { min-height: 34px; margin-bottom: 6px; padding-block: 4px; }
  .report-entry-page .app-main { padding-top: 22px; padding-bottom: 20px; }
  .compact-report-shell { width: min(1180px, 100%); }
  .compact-report-shell .breadcrumb { display: none; }
  .compact-report-heading { margin-bottom: 10px; }
  .compact-report-heading h1 { font-size: clamp(2rem, 2.7vw, 2.65rem); }
  .compact-report-heading p:not(.eyebrow) { margin-top: 5px; font-size: .86rem; }
  .report-form-compact .report-workspace { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); grid-template-areas: "person references" "time references" "emergency actions"; gap: 13px; align-items: stretch; }
  .report-form-compact .form-card, .report-form-compact .emergency-card { padding: 17px; border-radius: 15px; }
  .report-form-compact .section-heading { margin-bottom: 13px; gap: 10px; }
  .report-form-compact .section-heading > span { width: 28px; height: 28px; }
  .report-form-compact .section-heading p { display: none; }
  .report-form-compact .autocomplete-field > small { display: none; }
  .report-form-compact .field-grid, .report-form-compact .time-grid { gap: 10px; }
  .report-form-compact .field { gap: 5px; font-size: .76rem; }
  .report-form-compact .field input, .report-form-compact .field select, .report-form-compact .field textarea { min-height: 42px; padding: 8px 10px; }
  .report-form-compact .field textarea { min-height: 74px; }
  .compact-person { grid-area: person; }
  .compact-time { grid-area: time; }
  .compact-references { grid-area: references; }
  .compact-emergency { grid-area: emergency; }
  .report-form-compact .form-actions { grid-area: actions; align-self: end; padding: 12px 0 0; }
  .compact-time .time-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compact-time .break-disclosure { margin-top: 10px; }
  .compact-time .break-disclosure summary { min-height: 45px; padding: 7px 10px; }
  .compact-time .break-panel { padding: 9px 10px 10px; }
  .compact-time .break-row { padding: 9px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 7px; }
  .compact-time .text-button { margin-top: 5px; min-height: 34px; }
  .compact-references .textarea-field { margin-top: 11px; }
  .compact-emergency { padding-block: 14px !important; gap: 14px; }
  .compact-emergency h2 { font-size: 1rem; }
  .compact-emergency p:not(.eyebrow) { margin-top: 3px; font-size: .72rem; }
  .compact-emergency .segmented span { min-width: 54px; padding: 7px 10px; }
}
.selection-toolbar { margin: 17px 0; display: grid; grid-template-columns: minmax(280px, 1fr) auto auto auto; gap: 9px; align-items: end; }
.selection-toolbar .secondary-button { min-height: 42px; }
.selection-toolbar > span { align-self: center; color: var(--ink-600); font-size: .76rem; font-weight: 750; }
.selection-pagination { margin-top: 13px; display: flex; justify-content: flex-end; align-items: center; gap: 11px; }
.selection-pagination .secondary-button { min-height: 38px; padding: 0 13px; }
.selection-pagination span { color: var(--ink-600); font-size: .75rem; font-weight: 750; }

.mapping-stack { margin-top: 16px; display: grid; gap: 10px; }
.mapping-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }
.mapping-card summary { min-height: 68px; padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; cursor: pointer; list-style: none; }
.mapping-card summary::-webkit-details-marker { display: none; }
.mapping-card summary::before { width: 22px; height: 22px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 6px; background: var(--surface-soft); color: var(--ink-600); content: "+"; font-weight: 900; }
.mapping-card[open] > summary::before, .mapping-card details[open] > summary::before { content: "−"; }
.mapping-card summary:hover { background: #fbfcfc; }
.mapping-card summary:focus-visible { outline: 3px solid rgba(17,149,138,.3); outline-offset: -3px; }
.mapping-card summary > span:first-of-type { min-width: 0; margin-right: auto; display: grid; gap: 2px; }
.mapping-card summary strong { overflow-wrap: anywhere; }
.mapping-card summary small { color: var(--ink-600); }
.mapping-state { padding: 5px 9px; border-radius: 999px; background: var(--amber-100); color: #754d0a; font-size: .68rem; font-weight: 900; white-space: nowrap; }
.mapping-state.mapping-complete { background: var(--green-100); color: var(--green-700); }
.mapping-form { padding: 22px; border-top: 1px solid var(--line); background: #fafcfc; }
.mapping-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mapping-form > .field { margin: 17px 0; }
.contract-section { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(255,255,255,.55); }
.contract-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.contract-meta { margin: 5px 0 0; color: var(--ink-600); font-size: .8rem; }
.mapping-fieldset { min-width: 0; margin: 0; padding: 20px 0; border: 0; border-bottom: 1px solid var(--line); }
.mapping-fieldset:first-of-type { padding-top: 0; }
.mapping-fieldset legend { padding: 0; color: var(--ink-950); font-size: .9rem; font-weight: 900; }
.mapping-fieldset > p { margin: 3px 0 14px; color: var(--ink-600); font-size: .75rem; }
.mapping-save-row { padding-top: 20px; display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 14px; align-items: end; }
.table-section-head { margin-bottom: 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.table-section-head p:not(.eyebrow) { margin: 5px 0 0; color: var(--ink-600); font-size: .82rem; }
.holiday-form { display: grid; grid-template-columns: 190px minmax(260px, 1fr) auto; }
.user-create-grid { grid-template-columns: 1fr 1.3fr 1fr .8fr auto; }
.user-access-form input[name="reason"] { min-width: 210px; }
.rate-form input[name="reason"] { min-width: 210px; }
.danger-zone { border-color: #e7b9b3; background: #fffafa; }
.minimum-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.login-shell { min-height: calc(100vh - var(--header-height)); display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(400px, .72fr); background: var(--surface); }
.login-intro { position: relative; padding: clamp(48px, 8vw, 112px); display: flex; flex-direction: column; justify-content: center; overflow: hidden; background: linear-gradient(145deg, var(--navy-950), #0b5960); color: white; }
.login-intro::before, .login-intro::after { position: absolute; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; content: ""; }
.login-intro::before { width: 460px; height: 460px; right: -180px; top: -150px; }
.login-intro::after { width: 290px; height: 290px; right: -60px; bottom: -180px; border-width: 55px; }
.login-intro > * { position: relative; z-index: 1; }
.login-intro h1 { max-width: 720px; margin: 10px 0 20px; font-size: clamp(2.7rem, 5vw, 4.6rem); line-height: 1.02; }
.login-intro > p:not(.eyebrow) { max-width: 600px; color: #c8dbdd; font-size: 1.05rem; }
.trust-list { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 8px; }
.trust-list span { padding: 8px 11px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; color: #d8e8e9; font-size: .73rem; font-weight: 700; }
.login-card { width: min(450px, calc(100% - 40px)); align-self: center; justify-self: center; padding: clamp(28px, 4vw, 42px); border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-md); }
.login-card h2 { margin: 5px 0 0; font-size: 2rem; }
.login-card > .muted { margin: 6px 0 0; }
.privacy-note { margin: 22px 0 0; padding-top: 17px; border-top: 1px solid var(--line); color: var(--ink-500); font-size: .72rem; text-align: center; }

.empty-panel { margin-top: 18px; padding: 27px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border: 1px solid #c9e0dd; border-radius: var(--radius-lg); background: var(--teal-50); }
.empty-panel p:not(.eyebrow) { color: var(--ink-600); }
.error-state { max-width: 580px; margin: clamp(40px, 9vh, 100px) auto; padding: clamp(30px, 5vw, 54px); text-align: center; }
.error-state .empty-state-icon { width: 48px; height: 48px; margin: 0 auto 18px; color: var(--amber-500); }
.error-state p { color: var(--ink-600); }
.error-state .secondary-link { margin-top: 12px; }

@media (max-width: 1120px) {
  :root { --sidebar-width: 218px; }
  .app-main { padding-inline: 28px; }
  .batch-filter-wide { grid-template-columns: 1fr 1fr; }
  .batch-filter-wide .primary-button { grid-column: 1 / -1; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mapping-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-period-form { grid-template-columns: 145px 145px minmax(230px, 1fr) minmax(180px, 1fr); }
  .finance-period-form .primary-button, .finance-period-form .secondary-link { grid-column: span 2; }
  .finance-table-toolbar { grid-template-columns: minmax(250px, 1fr) auto; }
  .finance-selection-actions { justify-content: flex-end; }
  .finance-row-detail { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .monthly-filter-toolbar { grid-template-columns: 1fr 1fr; }
  .monthly-filter-toolbar .field:first-child { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .app-sidebar { display: none; }
  .app-layout { display: block; }
  .app-main { padding: 28px 20px 104px; }
  .mobile-nav { position: fixed; z-index: 90; left: 10px; right: 10px; bottom: 9px; min-height: 62px; padding: 5px; display: flex; justify-content: space-around; gap: 2px; border: 1px solid rgba(188,202,204,.85); border-radius: 16px; background: rgba(255,255,255,.94); box-shadow: 0 16px 48px rgba(7,43,53,.2); backdrop-filter: blur(16px); }
  .mobile-nav a { min-width: 58px; padding: 7px 8px; display: grid; justify-items: center; align-content: center; gap: 2px; border-radius: 11px; color: var(--ink-600); text-decoration: none; font-size: .62rem; font-weight: 850; }
  .mobile-nav a.active { background: var(--teal-100); color: var(--teal-700); }
  .mobile-nav .icon { width: 20px; height: 20px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-intro { display: none; }
  .login-card { margin: 48px auto; }
  .public-main { background: linear-gradient(180deg, var(--canvas), var(--surface)); }
  .finance-finalize-dock { bottom: 82px; }
}

@media (max-width: 720px) {
  .app-header { padding: 0 15px; }
  .brand-mark { width: 37px; height: 37px; }
  .role-badge, .user-copy, .topbar-logout button span { display: none; }
  .topbar-logout { margin-left: 0; }
  .page-heading { flex-direction: column; gap: 15px; }
  .heading-actions { max-width: none; justify-content: flex-start; }
  .field-grid.two { grid-template-columns: 1fr; }
  .time-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid, .rescue-fields, .dashboard-grid { grid-template-columns: 1fr; }
  .break-row { grid-template-columns: 1fr 1fr; }
  .break-row .remove-button { grid-column: 1 / -1; justify-self: start; }
  .minimum-grid, .batch-filter, .batch-filter-wide { grid-template-columns: 1fr 1fr; }
  .user-create-grid, .holiday-form { grid-template-columns: 1fr 1fr; }
  .user-create-grid .primary-button, .holiday-form .primary-button { align-self: end; }
  .batch-filter-wide .primary-button { grid-column: auto; }
  .batch-reference-search, .selection-search { grid-column: 1 / -1; }
  .selection-toolbar { grid-template-columns: 1fr 1fr; }
  .month-toolbar { align-items: stretch; flex-direction: column; }
  .month-toolbar .secondary-link { width: 100%; }
  .emergency-card { align-items: flex-start; flex-direction: column; }
  .segmented { width: 100%; }
  .segmented label { flex: 1; }
  .metric-grid article { min-height: 126px; }
  .form-actions { padding-top: 10px; }
  .finance-workflow { display: flex; overflow-x: auto; }
  .finance-workflow li { min-width: 118px; flex: 1 0 auto; }
  .finance-period-form { grid-template-columns: 1fr 1fr; }
  .finance-reference-filter { grid-column: 1 / -1; }
  .finance-period-form .primary-button, .finance-period-form .secondary-link { grid-column: auto; }
  .selection-summary-bar { grid-template-columns: 1fr 1fr; }
  .selection-summary-bar article:nth-child(2) { border-right: 0; }
  .selection-summary-bar article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .finance-table-toolbar { grid-template-columns: 1fr 1fr; }
  .finance-global-search, .finance-selection-actions { grid-column: 1 / -1; }
  .finance-selection-actions { justify-content: flex-start; }
  .finance-row-detail { padding-left: 18px; grid-template-columns: 1fr; }
  .finance-finalize-dock { align-items: stretch; flex-direction: column; gap: 9px; }
  .finance-finalize-dock .primary-button { width: 100%; }
  .section-heading-row:has(.history-search) { align-items: stretch; flex-direction: column; }
  .history-search { width: 100%; }
  .monthly-filter-toolbar { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .app-main { padding: 22px 12px 102px; }
  .brand-copy small { display: none; }
  .secure-label { display: none; }
  .page-heading h1 { font-size: 2rem; }
  .metric-grid, .mini-metrics { grid-template-columns: 1fr; }
  .metric-grid article { min-height: 116px; }
  .form-card, .emergency-card, .section-card { padding: 18px; border-radius: 14px; }
  .minimum-grid, .batch-filter, .batch-filter-wide, .mapping-grid, .selection-toolbar { grid-template-columns: 1fr; }
  .user-create-grid, .holiday-form, .mapping-save-row { grid-template-columns: 1fr; }
  .form-stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .break-row { grid-template-columns: 1fr; }
  .break-row .remove-button { grid-column: auto; }
  .disclosure-action { display: none; }
  .field input, .field select, .field textarea { font-size: 16px; }
  .time-grid { grid-template-columns: 1fr; }
  .form-actions > * { flex: 1 1 auto; }
  .button-row > * { flex: 1 1 calc(50% - 6px); }
  .selection-pagination { justify-content: space-between; }
  .subnav { width: 100%; }
  .subnav a { flex: 1; text-align: center; }
  dl div { grid-template-columns: 1fr; gap: 2px; }
  .login-card { width: calc(100% - 24px); margin: 24px auto; padding: 24px; }
  .finance-period-form, .finance-table-toolbar { grid-template-columns: 1fr; }
  .finance-reference-filter, .finance-global-search, .finance-selection-actions { grid-column: auto; }
  .finance-period-form .primary-button, .finance-period-form .secondary-link { grid-column: auto; }
  .finance-selection-actions { display: grid; grid-template-columns: 1fr; }
  .selection-summary-bar article { padding: 11px; }
  .selection-summary-bar strong { font-size: .96rem; }
  .finance-finalize-dock > div { grid-template-columns: 1fr; }
  .finance-finalize-dock small { grid-column: auto; }
  .finance-review-grid { margin-bottom: 150px; }
  .monthly-filter-toolbar { grid-template-columns: 1fr; }
  .monthly-filter-toolbar .field:first-child { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.mapping-import-fields { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto; gap: 16px; align-items: end; }
.mapping-import-fields input[type="file"] { width: 100%; min-width: 0; }
.mapping-tools { display: flex; flex-wrap: wrap; gap: 18px; align-items: end; }
.mapping-tools[hidden], .mapping-card[hidden] { display: none; }
.mapping-tools > .field { flex: 1 1 240px; }
.mapping-filter { display: flex; gap: 8px; align-items: center; min-height: 44px; }
.mapping-filter input { width: auto; }
.mapping-advanced, .mapping-import-notes { margin-block: 12px; }
.mapping-advanced > summary, .mapping-import-notes > summary { cursor: pointer; padding-block: 12px; }
.mapping-card summary > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.mapping-state { flex-shrink: 0; }
.mapping-import p, .mapping-import-notes li { overflow-wrap: anywhere; }
@media (max-width: 900px) { .mapping-import-fields { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) { .mapping-card > summary, .contract-header { flex-wrap: wrap; gap: 12px; } }

/* Compact invoice workspace */
.billing-simple { max-width: 1500px; }
.billing-simple .finance-heading { margin-bottom: 12px; }
.billing-simple .finance-heading p:not(.eyebrow) { margin-top: 4px; }
.billing-filter-card { padding: 14px 16px; }
.billing-period-form { display: grid; grid-template-columns: 140px 140px minmax(280px, 1fr) minmax(190px, .55fr) auto auto; gap: 9px; align-items: end; }
.billing-period-form .field { gap: 4px; }
.billing-period-form input, .billing-period-form select, .billing-period-form .primary-button { min-height: 40px; }
.billing-reset-link { min-height: 40px; align-self: end; }
.billing-selection.section-gap { margin-top: 16px; }
.billing-list-heading { margin-bottom: 8px; display: grid; grid-template-columns: auto minmax(280px, 1fr) auto; gap: 10px; align-items: end; }
.billing-list-heading > div { display: flex; align-items: baseline; gap: 10px; }
.billing-list-heading h2 { margin: 0; font-size: 1.15rem; }
.billing-list-heading > div > span { color: var(--ink-500); font-size: .72rem; font-weight: 800; }
.billing-table-search input { width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink-900); font: inherit; font-size: .8rem; }
.billing-table-search input:focus { border-color: var(--teal-500); outline: 0; box-shadow: 0 0 0 3px rgba(17,149,138,.15); }
.billing-more-filters { position: relative; }
.billing-more-filters > summary { min-height: 40px; list-style: none; white-space: nowrap; }
.billing-more-filters > summary::-webkit-details-marker { display: none; }
.billing-more-filters-panel { position: absolute; z-index: 40; top: calc(100% + 7px); right: 0; width: min(680px, calc(100vw - 40px)); padding: 14px; display: grid; grid-template-columns: repeat(4, minmax(125px, 1fr)); gap: 10px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-md); }
.billing-more-filters-panel .text-button { grid-column: 1 / -1; justify-self: end; }
.billing-active-filters { min-height: 32px; margin-bottom: 7px; padding-block: 3px; }
.billing-active-filters[hidden] { display: none; }
.billing-selection-bar { min-height: 42px; margin-bottom: 7px; padding: 6px 10px; display: flex; align-items: center; gap: 8px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink-600); font-size: .77rem; font-variant-numeric: tabular-nums; }
.billing-selection-bar strong { color: var(--ink-950); font-size: .87rem; }
.billing-selection-bar .text-button:first-of-type { margin-left: auto; }
.billing-validation { margin-bottom: 8px; display: grid; gap: 5px; }
.billing-validation .validation { padding: 8px 10px; }
.billing-simple .finance-table-frame { max-height: min(62vh, 690px); }
.billing-report-table { min-width: 1040px; font-size: .74rem; }
.billing-report-table th, .billing-report-table td { padding: 9px 8px; vertical-align: top; }
.billing-report-table thead .finance-header-row th { top: 0; height: 40px; resize: none; }
.billing-report-table th:nth-child(1) { width: 42px; }
.billing-report-table th[data-column="date"] { width: 120px; }
.billing-report-table th[data-column="reference"] { width: 130px; }
.billing-report-table th[data-column="name"] { width: 145px; }
.billing-report-table th[data-column="network"] { width: 110px; }
.billing-report-table th[data-column="cost"] { width: 100px; }
.billing-report-table th[data-column="comment"] { width: 220px; }
.billing-report-table th[data-column="hours"] { width: 65px; }
.billing-report-table th[data-column="amount"] { width: 90px; }
.billing-report-table .finance-comment-cell { background: #fffaf0 !important; line-height: 1.42; }
.billing-report-table .status { min-height: 21px; margin-top: 5px; padding: 2px 6px; font-size: .58rem; }
.billing-order-cell > *, .billing-report-table td[data-column="name"] > * { display: block; }
.billing-order-cell > * + *, .billing-report-table td[data-column="name"] > * + * { margin-top: 3px; }
.billing-code-cell { overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: .72rem; }
.billing-pagination { margin-top: 8px; justify-content: flex-end; }
.billing-finalize-bar { margin-top: 10px; }
.billing-finalize-bar > div { grid-template-columns: auto auto; }
.history-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); }
.history-panel > summary { min-height: 48px; padding: 10px 14px; display: flex; align-items: center; gap: 9px; cursor: pointer; list-style: none; color: var(--ink-800); font-size: .86rem; font-weight: 850; }
.history-panel > summary::-webkit-details-marker { display: none; }
.history-panel > summary::before { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; background: var(--surface-soft); content: "+"; }
.history-panel[open] > summary::before { content: "−"; }
.history-panel > summary span { min-width: 24px; padding: 3px 7px; border-radius: 999px; background: var(--teal-50); color: var(--teal-700); text-align: center; font-size: .68rem; }
.history-panel-body { padding: 0 12px 12px; border-top: 1px solid var(--line); }
.history-panel-body .history-search { margin: 10px 0; }
.history-panel-body .finance-history-table { min-width: 900px; }

@media (max-width: 1050px) {
  .billing-period-form { grid-template-columns: 140px 140px minmax(250px, 1fr) minmax(180px, 1fr); }
  .billing-period-form .primary-button, .billing-reset-link { grid-column: span 2; }
}

@media (max-width: 760px) {
  .billing-period-form { grid-template-columns: 1fr 1fr; }
  .billing-reference-filter { grid-column: 1 / -1; }
  .billing-period-form .primary-button, .billing-reset-link { grid-column: auto; }
  .billing-list-heading { grid-template-columns: 1fr auto; }
  .billing-list-heading > div, .billing-table-search { grid-column: 1 / -1; }
  .billing-more-filters-panel { grid-template-columns: 1fr 1fr; }
  .billing-selection-bar { flex-wrap: wrap; }
  .billing-selection-bar .text-button:first-of-type { margin-left: 0; }
  .billing-finalize-bar { position: static; }
}

@media (max-width: 480px) {
  .billing-period-form { grid-template-columns: 1fr; }
  .billing-reference-filter { grid-column: auto; }
  .billing-list-heading { grid-template-columns: 1fr; }
  .billing-more-filters { width: 100%; }
  .billing-more-filters > summary { width: 100%; }
  .billing-more-filters-panel { position: static; width: 100%; margin-top: 7px; grid-template-columns: 1fr; box-shadow: none; }
  .billing-selection-bar { gap: 7px 11px; }
  .billing-selection-bar .text-button { flex: 1 1 auto; }
  .billing-finalize-bar > div { grid-template-columns: 1fr; }
}
