:root {
  --ink: #172321;
  --muted: #68736f;
  --forest: #173f3a;
  --forest-2: #245d54;
  --forest-soft: #e8f0ee;
  --gold: #d5ad5b;
  --gold-soft: #f5ead1;
  --paper: #f5f6f3;
  --surface: #ffffff;
  --line: #dce2de;
  --line-strong: #bdc8c3;
  --danger: #a63d3d;
  --danger-soft: #fbe9e7;
  --success: #246b4d;
  --success-soft: #e6f4ec;
  --shadow: 0 18px 46px rgba(28, 47, 42, 0.08);
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 90% 0%, rgba(213, 173, 91, 0.08), transparent 24rem),
    var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

button, input { font: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(220, 226, 222, 0.86);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.topbar__inner {
  width: min(1400px, calc(100% - 48px));
  min-height: 72px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  width: fit-content;
}

.brand__mark, .login-card__mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: white;
  background: var(--forest);
  font-family: Georgia, serif;
  font-weight: 700;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
}

.brand strong, .brand small { display: block; line-height: 1.05; }
.brand strong { font-size: 1rem; letter-spacing: .01em; }
.brand small { margin-top: 4px; color: var(--muted); font-size: .75rem; }

.topnav { display: flex; align-items: center; gap: 28px; }
.topnav > a:not(.button) { text-decoration: none; color: #3c4b47; font-size: .925rem; font-weight: 650; }
.topnav > a:not(.button):hover { color: var(--forest); }

.user-menu { justify-self: end; display: flex; align-items: center; gap: 10px; }
.user-menu__avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--forest-soft);
  color: var(--forest);
  font-weight: 800;
}
.user-menu__name { color: #40504c; font-size: .875rem; font-weight: 650; }

.page {
  width: min(1400px, calc(100% - 48px));
  margin: 0 auto;
  padding: 42px 0 72px;
}

.page-heading, .record-heading { margin-bottom: 28px; }
.page-heading--with-action, .record-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 28px; }
.page-heading__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.page-heading h1, .record-heading h1 {
  margin: 3px 0 7px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.15rem);
  line-height: 1.04;
  font-weight: 600;
  letter-spacing: -.03em;
}
.page-heading p:not(.eyebrow), .record-heading p:not(.eyebrow) { margin: 0; color: var(--muted); }
.eyebrow {
  margin: 0;
  color: var(--forest-2);
  font-size: .75rem;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.back-link {
  display: inline-block;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 650;
  text-decoration: none;
}
.back-link:hover { color: var(--forest); }

.button {
  appearance: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 750;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .7; transform: none; }
.button--primary { background: var(--forest); color: white; box-shadow: 0 6px 18px rgba(23,63,58,.16); }
.button--primary:hover { background: #0f332f; }
.button--secondary { background: white; border-color: var(--line-strong); color: var(--forest); }
.button--secondary:hover { border-color: var(--forest); }
.button--ghost { background: transparent; border-color: var(--line); color: #40504c; }
.button--ghost:hover { background: var(--forest-soft); border-color: #c7d8d3; }
.button--small { min-height: 36px; padding: 0 13px; font-size: .825rem; }
.button--wide { width: 100%; }

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 18px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.7);
}
.field { display: grid; gap: 8px; color: #33433f; font-weight: 700; }
.field > span { font-size: .875rem; }
.field small { color: var(--muted); font-size: .78rem; font-weight: 500; }
.field input {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  background: white;
  color: var(--ink);
}
.field input:focus { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(36,93,84,.12); }
.field--compact { min-width: 180px; }
.field--compact input { min-height: 42px; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 138px;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(31,50,45,.04);
}
.metric-card::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -30px;
  width: 92px;
  height: 92px;
  border: 1px solid rgba(23,63,58,.07);
  border-radius: 50%;
}
.metric-card span, .metric-card small { display: block; color: var(--muted); }
.metric-card span { font-size: .8rem; font-weight: 750; letter-spacing: .03em; }
.metric-card strong { display: block; margin: 14px 0 4px; font-family: Georgia, serif; font-size: clamp(1.35rem, 2.2vw, 1.8rem); line-height: 1; font-weight: 600; }
.metric-card small { font-size: .75rem; }
.metric-card--accent { background: var(--forest); color: white; border-color: var(--forest); }
.metric-card--accent span, .metric-card--accent small { color: rgba(255,255,255,.68); }
.metric-card--accent::after { border-color: rgba(255,255,255,.1); }

.panel, .record-panel, .upload-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.panel__header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel__header h2, .panel__header p { margin: 0; }
.panel__header h2 { font-size: 1.05rem; }
.panel__header p { margin-top: 2px; color: var(--muted); font-size: .8rem; }

.table-scroll { overflow-x: auto; }
.data-table, .statement-table, .cash-sheet { width: 100%; border-collapse: collapse; }
.data-table { min-width: 1050px; }
.data-table th, .data-table td { padding: 15px 16px; border-bottom: 1px solid #e8ece9; text-align: left; white-space: nowrap; }
.data-table th { color: #65716d; background: #fafbf9; font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; }
.data-table td { color: #394844; font-size: .86rem; }
.data-table tbody tr:hover { background: #fbfcfb; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.text-link { color: var(--forest-2); font-weight: 800; text-decoration: none; }
.person-chip { display: inline-flex; padding: 5px 9px; border-radius: 999px; color: var(--forest); background: var(--forest-soft); font-size: .76rem; font-weight: 750; }
.status-badge { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: .74rem; font-weight: 800; }
.status-badge--missing { color: var(--danger); background: var(--danger-soft); }
.missing-value { color: var(--muted); }
.availability-notice { margin-bottom: 20px; padding: 14px 16px; border: 1px solid #e7c77f; border-radius: 12px; background: var(--gold-soft); color: #71591f; font-size: .88rem; font-weight: 700; }
.empty-state--compact { padding: 42px 24px; }
.button--danger { border-color: var(--danger); background: var(--danger); color: white; }
.button--danger:hover { background: #8f2f27; }
.button--danger-outline { border-color: #dfaaa4; background: white; color: var(--danger); }
.button--danger-outline:hover { background: var(--danger-soft); }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 24px; padding: 20px 22px; border: 1px solid #efc1bc; border-radius: 16px; background: #fffafa; }
.danger-zone h2, .danger-zone p { margin: 0; }
.danger-zone h2 { color: var(--danger); font-size: 1rem; }
.danger-zone p { margin-top: 5px; color: var(--muted); font-size: .8rem; }
.danger-zone__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.danger-zone__actions form { margin: 0; }

.report-presets { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 16px; }
.report-presets__link { padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--forest); font-size: .82rem; font-weight: 750; text-decoration: none; }
.report-presets__link:hover, .report-presets__link--active { border-color: var(--forest); background: var(--forest-soft); }
.report-filter { margin-bottom: 20px; }
.report-metrics { margin-bottom: 14px; }
.report-balance { margin: 0 0 24px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--muted); font-size: .85rem; }
.report-balance strong { color: var(--forest); }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 22px; }
.report-panel { min-width: 0; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: var(--shadow); }
.report-panel__header { padding: 19px 20px 15px; border-bottom: 1px solid var(--line); }
.report-panel__header h2, .report-panel__header p { margin: 0; }
.report-panel__header h2 { font-size: 1.05rem; }
.report-panel__header p { margin-top: 3px; color: var(--muted); font-size: .78rem; }
.report-panel__empty { margin: 0; padding: 28px 20px; color: var(--muted); font-size: .88rem; }
.report-chart { max-height: 390px; overflow-y: auto; padding: 5px 20px 12px; }
.report-chart__row { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 5px 13px; align-items: center; padding: 11px 0; border-bottom: 1px solid #edf0ee; }
.report-chart__row:last-child { border-bottom: 0; }
.report-chart__period { align-self: start; padding-top: 6px; color: #384945; font-size: .78rem; font-variant-numeric: tabular-nums; }
.report-chart__series { grid-column: 2; display: grid; grid-template-columns: 36px minmax(0, 1fr) 112px; gap: 8px; align-items: center; min-width: 0; }
.report-chart__series--single { grid-template-columns: minmax(0, 1fr) 112px; }
.report-chart__series span, .report-chart__row small { color: var(--muted); font-size: .72rem; }
.report-chart__series svg { display: block; width: 100%; height: 13px; }
.report-chart__series b { color: #34443f; font-size: .71rem; font-variant-numeric: tabular-nums; font-weight: 750; text-align: right; white-space: nowrap; }
.report-chart__row small, .report-chart__missing { grid-column: 2; }
.report-chart__missing { color: var(--danger); font-size: .78rem; font-weight: 750; }
.report-chart__track { fill: #edf1ee; }
.report-chart__fill--income { fill: var(--forest-2); }
.report-chart__fill--expense { fill: var(--gold); }
.report-chart__fill--instruction { fill: var(--forest); }
.report-chart__fill--vendor { fill: var(--gold); }
.report-chart--vendors .report-chart__row { grid-template-columns: minmax(125px, 190px) minmax(0, 1fr); }
.report-chart__vendor { overflow: hidden; color: #384945; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.report-completeness { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 25px; min-height: 230px; padding: 22px; }
.report-ring { width: 174px; height: 174px; flex: none; }
.report-ring__base { stroke: #edf1ee; }
.report-ring__segment { transform: rotate(-90deg); transform-origin: 60px 60px; }
.report-ring__segment--complete { stroke: var(--forest); }
.report-ring__segment--instruction { stroke: var(--gold); }
.report-ring__segment--cash { stroke: #8aabb9; }
.report-ring text { fill: var(--ink); font-family: Georgia, serif; font-size: 26px; font-weight: 700; }
.report-legend { display: grid; gap: 11px; min-width: 170px; margin: 0; padding: 0; list-style: none; }
.report-legend li { display: grid; grid-template-columns: 10px 1fr auto; gap: 9px; align-items: center; font-size: .82rem; }
.report-legend strong { font-variant-numeric: tabular-nums; }
.report-legend__dot { width: 10px; height: 10px; border-radius: 50%; }
.report-legend__dot--complete { background: var(--forest); }
.report-legend__dot--instruction { background: var(--gold); }
.report-legend__dot--cash { background: #8aabb9; }
.report-table__scroll { max-height: 540px; overflow-y: auto; }
.report-method { max-width: 900px; margin: 16px 0 0; color: var(--muted); font-size: .77rem; }

.emergency-entry-panel { max-width: none; margin-bottom: 22px; }
.emergency-entry-panel h2 { margin: 5px 0 4px; font-family: Georgia, serif; font-size: 1.8rem; font-weight: 600; }
.emergency-entry-panel > p:not(.eyebrow) { margin: 0 0 20px; color: var(--muted); font-size: .85rem; }
.emergency-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
.emergency-form .field { min-width: 0; }
.emergency-form select { width: 100%; min-height: 48px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 10px; background: white; color: var(--ink); font: inherit; }
.emergency-form .button { min-height: 48px; white-space: nowrap; grid-column: 1 / -1; justify-self: end; }
.emergency-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 22px; }
.emergency-metrics .metric-card strong { font-size: clamp(1.2rem, 1.8vw, 1.7rem); }
.emergency-archive { margin-top: 22px; }
.emergency-refund-archive { margin-top: 22px; }
.emergency-archive .report-table__scroll { max-height: none; overflow-x: auto; }
.emergency-refund-archive .report-table__scroll { max-height: none; overflow-x: auto; }
.emergency-table { width: 100%; min-width: 1350px; border-collapse: collapse; }
.emergency-refund-table { min-width: 1150px; }
.emergency-table th, .emergency-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: .81rem; }
.emergency-table th { background: #f8faf8; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.emergency-table td small { color: var(--muted); }
.emergency-table__voided { background: #fff8f7; color: var(--muted); }
.emergency-badge { display: inline-flex; padding: 3px 8px; border-radius: 999px; font-size: .75rem; font-weight: 800; }
.emergency-badge--income { color: var(--success); background: var(--success-soft); }
.emergency-badge--expense { color: #875b16; background: var(--gold-soft); }
.emergency-void summary { width: max-content; color: var(--danger); font-weight: 750; cursor: pointer; }
.emergency-refund summary { width: max-content; padding: 6px 10px; border: 1px solid var(--forest); border-radius: 7px; color: var(--forest); background: var(--forest-soft); font-weight: 850; cursor: pointer; list-style: none; }
.emergency-refund summary::-webkit-details-marker { display: none; }
.emergency-refund summary:hover, .emergency-refund summary:focus-visible { background: var(--forest); color: white; }
.emergency-void form, .emergency-refund form { display: grid; gap: 7px; min-width: 190px; margin-top: 8px; }
.emergency-void label, .emergency-refund label { display: grid; gap: 5px; color: var(--ink); font-size: .75rem; }
.emergency-void input, .emergency-refund input, .emergency-refund select { min-height: 34px; max-width: 220px; padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 7px; background: white; }
.emergency-refund form > small { color: var(--muted); }
.emergency-pagination { display: flex; justify-content: center; gap: 18px; padding: 14px; font-size: .84rem; }
.emergency-pagination a { color: var(--forest); font-weight: 750; }
.emergency-chart { max-height: 420px; overflow: auto; padding: 8px 20px 16px; }
.emergency-chart__row { padding: 11px 0; border-bottom: 1px solid #edf0ee; }
.emergency-chart__row > strong { display: block; margin-bottom: 5px; font-size: .8rem; }
.emergency-chart__row label { display: grid; grid-template-columns: 42px minmax(0, 1fr) 110px; gap: 8px; align-items: center; font-size: .74rem; }
.emergency-chart__row label span { text-align: right; white-space: nowrap; }
.emergency-chart progress, .emergency-hours progress, .emergency-table--compact progress { width: 100%; height: 14px; accent-color: var(--forest-2); }
.emergency-chart__expense { accent-color: var(--gold) !important; }
.emergency-chart__refund { accent-color: var(--danger) !important; }
.emergency-table--compact { min-width: 570px; }
.emergency-hour-panel { margin-bottom: 22px; }
.emergency-hours { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 24px; padding: 20px; }
.emergency-hours label { display: grid; grid-template-columns: 54px minmax(0, 1fr) 24px; gap: 8px; align-items: center; font-size: .78rem; }
.emergency-hours strong { text-align: right; }
.emergency-note { margin: 15px 0 0; color: var(--muted); font-size: .78rem; }

.empty-state { padding: 64px 24px; text-align: center; }
.empty-state__icon { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 50%; background: var(--forest-soft); color: var(--forest); font-size: 1.5rem; }
.empty-state h3, .empty-state p { margin: 0; }
.empty-state p { margin: 6px 0 20px; color: var(--muted); }

.alert {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  margin-bottom: 22px;
  border: 1px solid;
  border-radius: 12px;
  font-size: .9rem;
  font-weight: 650;
}
.alert--success { color: var(--success); background: var(--success-soft); border-color: #b8dfc9; }
.alert--error { color: var(--danger); background: var(--danger-soft); border-color: #efc1bc; }
.alert__close { border: 0; background: transparent; color: currentColor; cursor: pointer; font-size: 1.35rem; }

.upload-panel { max-width: 980px; padding: 26px; }
.upload-panel__date { max-width: 340px; margin-bottom: 26px; }
.upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 30px;
  border: 1.5px dashed #aebdb7;
  border-radius: 16px;
  background: #fafcfb;
  text-align: center;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.dropzone:hover, .dropzone--dragging { background: var(--forest-soft); border-color: var(--forest-2); transform: translateY(-2px); }
.dropzone--selected { background: #f1f7f5; border-style: solid; border-color: #83a99e; }
.dropzone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone__number { position: absolute; top: 16px; left: 16px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #e8eeeb; color: var(--forest); font-size: .76rem; font-weight: 800; }
.dropzone__icon { display: grid; place-items: center; width: 58px; height: 66px; margin-bottom: 12px; border-radius: 8px 16px 8px 8px; background: var(--forest); color: white; font-family: Georgia, serif; font-size: 1.3rem; font-weight: 700; box-shadow: 0 8px 20px rgba(23,63,58,.16); }
.dropzone__icon--gold { background: #bd9140; }
.dropzone strong { margin-bottom: 4px; font-size: 1.05rem; }
.dropzone > span:not(.dropzone__number):not(.dropzone__icon) { max-width: 100%; color: var(--forest-2); font-size: .85rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone small { max-width: 320px; margin-top: 10px; color: var(--muted); font-size: .76rem; }
.check-row { display: flex; align-items: flex-start; gap: 12px; margin-top: 22px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--forest); }
.check-row strong, .check-row small { display: block; }
.check-row strong { font-size: .88rem; }
.check-row small { color: var(--muted); font-size: .76rem; }
.upload-panel__footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 24px; }
.upload-panel__footer p { margin: 0; color: var(--muted); font-size: .78rem; }

.record-heading .back-link { margin-bottom: 12px; }
.record-panel__toolbar { display: flex; justify-content: space-between; align-items: center; min-height: 66px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; height: 66px; gap: 24px; }
.tabs button { position: relative; border: 0; padding: 0 4px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 750; }
.tabs button[aria-selected="true"] { color: var(--forest); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--gold); }
.download-actions { display: flex; gap: 8px; }
.tab-panel { padding: 28px; }
.document-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; padding: 0 0 18px; border-bottom: 2px solid var(--forest); }
.document-title h2, .document-title span, .document-title strong { display: block; margin: 0; }
.document-title h2 { font-family: Georgia, serif; font-size: 1.85rem; font-weight: 600; }
.document-title span { color: var(--muted); font-size: .72rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.document-title__meta { text-align: right; }
.document-title__meta strong { font-size: .9rem; }

.statement-table { min-width: 960px; margin-top: 14px; }
.statement-table th, .statement-table td { padding: 12px 13px; border-bottom: 1px solid #e3e8e5; text-align: left; font-size: .84rem; }
.statement-table th { background: var(--forest); color: white; font-size: .72rem; letter-spacing: .04em; }
.statement-table th:first-child { width: 62px; text-align: center; }
.statement-table td:first-child { text-align: center; color: var(--muted); }
.statement-table td:nth-child(2) { min-width: 240px; }
.statement-table td:nth-child(3) { min-width: 230px; }
.statement-table td:nth-child(4) { min-width: 220px; }
.statement-table tbody tr:nth-child(even) { background: #f8faf8; }
.statement-table tfoot td { border-top: 2px solid var(--forest); border-bottom: 0; background: var(--gold-soft); font-weight: 850; }
.statement-table tfoot td:first-child { text-align: right; }
.iban { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; letter-spacing: .01em; }
.money-cell { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }

.cash-sheet-wrap { overflow-x: auto; margin-top: 14px; padding: 18px; border: 1px solid var(--line); background: #f2f3f0; }
.cash-sheet { min-width: 900px; background: white; box-shadow: 0 12px 30px rgba(29,43,39,.08); }
.cash-sheet col.cash-sheet__label { width: 25%; }
.cash-sheet col.cash-sheet__expense { width: 38%; }
.cash-sheet col.cash-sheet__amount { width: 12%; }
.cash-sheet td { height: 29px; padding: 5px 10px; border-right: 1px solid #e2e4e1; border-bottom: 1px solid #e2e4e1; font-family: Arial, sans-serif; font-size: .78rem; font-weight: 650; }
.cash-sheet td:nth-child(2), .cash-sheet td:nth-child(4) { text-align: right; }
.cash-sheet__title td { height: 48px; border-bottom: 2px solid #333; text-align: center !important; font-family: Georgia, serif; font-size: 1.3rem; font-weight: 750; }
.cash-sheet__headers td { background: #e3e8e5; color: var(--forest); font-size: .8rem; font-weight: 850; }
.cash-sheet__total td { background: #f5eddc; font-weight: 850; }
.cash-sheet__signatures td { height: 36px; text-align: center; border-top: 1px solid #777; }

.analysis-details { margin-top: 20px; border: 1px solid var(--line); border-radius: 12px; }
.analysis-details summary { padding: 14px 16px; cursor: pointer; color: var(--forest); font-size: .86rem; font-weight: 750; }
.analysis-columns { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 22px; padding: 0 18px 18px; }
.analysis-columns h3 { font-size: .9rem; }
.entry-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.entry-list li { display: flex; justify-content: space-between; gap: 18px; padding: 9px 0; border-bottom: 1px solid #edf0ee; font-size: .78rem; }
.entry-list strong { white-space: nowrap; }

.auth-shell { min-height: 100vh; background: var(--forest); }
.auth-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(135deg, transparent 0 55%, rgba(213,173,91,.08) 55% 56%, transparent 56%),
    radial-gradient(circle at 12% 18%, rgba(255,255,255,.09), transparent 23rem);
  pointer-events: none;
}
.auth-page { position: relative; display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login-card { width: min(100%, 450px); padding: 36px; border: 1px solid rgba(255,255,255,.18); border-radius: 22px; background: white; box-shadow: 0 36px 80px rgba(0,0,0,.25); }
.login-card__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 42px; }
.login-card__brand p, .login-card__brand span { margin: 0; line-height: 1.15; }
.login-card__brand p { font-weight: 850; }
.login-card__brand span { color: var(--muted); font-size: .78rem; }
.login-card__intro h1 { margin: 4px 0 10px; font-family: Georgia, serif; font-size: 2.15rem; line-height: 1.05; font-weight: 600; letter-spacing: -.025em; }
.login-card__intro > p:last-child { margin: 0 0 26px; color: var(--muted); font-size: .9rem; }
.form-stack { display: grid; gap: 18px; }
.form-stack .button { margin-top: 4px; }

.error-card { max-width: 520px; margin: 10vh auto; padding: 46px; border: 1px solid var(--line); border-radius: 18px; background: white; text-align: center; box-shadow: var(--shadow); }
.error-card__code { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 16px; border-radius: 50%; color: var(--danger); background: var(--danger-soft); font-size: 1.6rem; font-weight: 850; }
.error-card h1 { margin: 0; font-family: Georgia, serif; }
.error-card p { margin: 8px 0 22px; color: var(--muted); }

@media (max-width: 1000px) {
  .topbar__inner { grid-template-columns: 1fr auto; }
  .topnav { grid-column: 1 / -1; grid-row: 2; justify-content: center; min-height: 42px; gap: 24px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .emergency-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .report-grid { grid-template-columns: 1fr; }
  .emergency-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .emergency-form .button { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .topbar__inner, .page { width: min(100% - 28px, 1400px); }
  .topbar__inner { min-height: 64px; }
  .brand small, .user-menu__name { display: none; }
  .page { padding-top: 28px; }
  .page-heading--with-action, .record-heading { align-items: stretch; flex-direction: column; }
  .page-heading--with-action .button, .record-heading .button { width: 100%; }
  .page-heading__actions { flex-direction: column; }
  .topnav { gap: 12px; flex-wrap: wrap; }
  .topnav > a:not(.button) { font-size: .8rem; }
  .topnav .button { min-height: 32px; padding: 0 9px; font-size: .75rem; }
  .filter-bar { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .filter-bar .button { grid-column: 1 / -1; }
  .field--compact { min-width: 0; }
  .metric-grid { grid-template-columns: 1fr; }
  .emergency-metrics { grid-template-columns: 1fr; }
  .metric-card { min-height: 120px; }
  .upload-panel { padding: 18px; }
  .upload-grid { grid-template-columns: 1fr; }
  .dropzone { min-height: 220px; }
  .upload-panel__footer { align-items: stretch; flex-direction: column; }
  .upload-panel__footer .button { width: 100%; }
  .record-panel__toolbar { align-items: stretch; flex-direction: column; padding: 0 16px 14px; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; }
  .download-actions .button { width: 100%; }
  .tab-panel { padding: 18px 14px; }
  .document-title { align-items: flex-start; flex-direction: column; }
  .document-title__meta { text-align: left; }
  .analysis-columns { grid-template-columns: 1fr; }
  .danger-zone { align-items: stretch; flex-direction: column; }
  .danger-zone__actions { justify-content: stretch; }
  .danger-zone__actions form, .danger-zone__actions .button { width: 100%; }
  .login-card { padding: 28px 22px; }
  .report-chart { padding-right: 12px; padding-left: 12px; }
  .report-chart__row, .report-chart--vendors .report-chart__row { grid-template-columns: minmax(0, 1fr); }
  .report-chart__series, .report-chart__row small, .report-chart__missing { grid-column: 1; }
  .report-chart__series { grid-template-columns: 34px minmax(0, 1fr) 108px; }
  .report-chart__series--single { grid-template-columns: minmax(0, 1fr) 108px; }
  .emergency-form, .emergency-hours { grid-template-columns: 1fr; }
  .emergency-form .button { justify-self: stretch; }
  .emergency-chart__row label { grid-template-columns: 38px minmax(0, 1fr) 94px; }
}

@media print {
  .topbar, .record-heading .button, .record-panel__toolbar, .analysis-details, .back-link, .danger-zone, .report-presets, .report-filter, .emergency-entry-panel, .emergency-void, .emergency-refund, .emergency-pagination { display: none !important; }
  body { background: white; }
  .page { width: 100%; padding: 0; }
  .metric-grid { break-inside: avoid; }
  .record-panel { border: 0; box-shadow: none; }
  .tab-panel { padding: 0; }
  .report-chart, .report-table__scroll { max-height: none; overflow: visible; }
  .report-panel { box-shadow: none; break-inside: avoid; }
}
