:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --ink: #17202f;
  --muted: #667085;
  --line: #dce3ef;
  --blue: #3473e6;
  --blue-dark: #285bb7;
  --blue-soft: #edf3ff;
  --amber: #a86508;
  --amber-soft: #fff4dd;
  --red: #a83d3d;
  --red-soft: #fceaea;
  --green: #18794e;
  --green-soft: #e9f7ef;
  --shadow: 0 18px 55px rgba(28, 48, 35, .09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 20% 10%, rgba(52,115,230,.13) 0, transparent 34%), var(--bg); }
.login-card { width: min(430px,100%); padding: 42px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 28px; border-radius: 14px; background: var(--blue); color: white; font-size: 22px; font-weight: 850; }
.brand-mark.small { width: 38px; height: 38px; margin: 0; border-radius: 11px; font-size: 18px; }
.login-card h1, .topbar h1 { margin: 0; letter-spacing: -.035em; }
.login-card > .muted { margin: 10px 0 28px; line-height: 1.55; }
form { display: grid; gap: 10px; }
label { margin-top: 7px; font-size: 13px; font-weight: 700; }
input, select, textarea { border: 1px solid #d6ddd7; border-radius: 10px; background: white; color: var(--ink); padding: 0 13px; outline: none; }
input, select { min-height: 44px; }
textarea { min-height: 105px; padding: 12px 13px; line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(52,115,230,.13); }

.button { min-height: 42px; border: 0; border-radius: 10px; padding: 0 15px; font-weight: 750; }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button.primary { background: var(--blue); color: white; }
.button.primary:hover { background: var(--blue-dark); }
.button.secondary { border: 1px solid var(--line); background: white; color: var(--ink); }
.button.full { width: 100%; margin-top: 14px; }
.button.small { min-height: 34px; padding: 0 10px; font-size: 13px; }
.button.approve { background: var(--green-soft); color: var(--green); }
.button.reject { background: var(--red-soft); color: var(--red); }
.message { min-height: 20px; margin: 5px 0 0; color: var(--red); font-size: 13px; }

.dashboard { min-height: 100vh; display: grid; grid-template-columns: 230px 1fr; }
.sidebar { position: sticky; top: 0; z-index: 5; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; padding: 24px 16px; background: #17202f; color: white; }
.brand-row { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; }
.brand-row strong, .brand-row span { display: block; }
.brand-row span { margin-top: 2px; color: #aebbb2; font-size: 12px; }
.nav-item { width: 100%; border: 0; border-radius: 9px; background: transparent; color: #dce5de; padding: 12px; text-align: left; }
.sidebar nav { display: grid; gap: 22px; padding-bottom: 24px; }
.nav-group { min-width: 0; }
.nav-group-title { margin: 0 0 7px; padding: 0 12px; color: #9eacc2; font-size: 10px; line-height: 1.5; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.nav-group-items { display: grid; gap: 3px; }
.nav-item:hover { background: rgba(255,255,255,.06); color: white; }
.nav-item:focus-visible { outline: 2px solid #8eb5ff; outline-offset: 2px; }
.nav-item.active { background: rgba(255,255,255,.1); color: white; font-weight: 700; }
.nav-item.logout { margin-top: auto; color: #bdc8c0; }
.workspace { min-width: 0; padding: 32px clamp(20px,4vw,56px) 52px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.admin-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; background: white; padding: 9px 13px; font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 3px rgba(52,115,230,.16); }
.notice { margin-bottom: 18px; border: 1px solid #cddcf8; border-radius: 11px; background: var(--blue-soft); color: var(--blue-dark); padding: 13px 15px; }
.notice.warning { border-color: #edd49f; background: var(--amber-soft); color: #744609; }
.notice.error { border-color: #efcaca; background: var(--red-soft); color: var(--red); }
.notice.compact { margin: 5px 0 0; font-size: 12px; line-height: 1.45; }
.privacy-note { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; border: 1px solid #d8e0ef; border-radius: 12px; background: #f9fbff; padding: 14px 16px; }
.privacy-note strong { flex: 0 0 auto; color: var(--blue-dark); font-size: 13px; }
.privacy-note span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 22px; }
.stats.stats-three { grid-template-columns: repeat(3,1fr); }
.stats article { display: flex; flex-direction: column; gap: 9px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.stats span { color: var(--muted); font-size: 13px; }
.stats strong { font-size: 27px; letter-spacing: -.04em; }
.backup-stats article:first-child { border-color: #cddcf8; background: linear-gradient(135deg,white,var(--blue-soft)); }
.backup-stats article:first-child strong { font-size: 18px; line-height: 1.3; }
.backup-run-id { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.retention-preview-note { border-color: #bcd4ff; background: linear-gradient(135deg,#f9fbff,var(--blue-soft)); }
.retention-stats article:nth-child(2) { border-color: #edd49f; background: linear-gradient(135deg,white,var(--amber-soft)); }
.retention-stats article:last-child strong { font-size: 18px; line-height: 1.3; }
.retention-summary-panel { margin-bottom: 22px; }
.storage-reference-content { padding: 0 24px 12px; font-size: 13px; line-height: 1.6; }
#archive-retention-table table { min-width: 720px; table-layout: fixed; }
#archive-retention-table th, #archive-retention-table td { padding: 14px 10px; white-space: normal; overflow-wrap: break-word; vertical-align: top; }
#archive-retention-table th:first-child { width: 21%; }
#archive-retention-table th:nth-child(2) { width: 9%; }
#archive-retention-table th:nth-child(3) { width: 17%; }
#archive-retention-table th:nth-child(4) { width: 14%; }
#storage-reference-body small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
#storage-reference-table table { min-width: 760px; table-layout: fixed; }
#storage-reference-table th, #storage-reference-table td { padding: 14px 10px; white-space: normal; overflow-wrap: break-word; vertical-align: top; }
#storage-reference-table th:first-child { width: 18%; }
#storage-reference-table th:nth-child(2) { width: 8%; }
#storage-reference-table th:nth-child(3) { width: 11%; }
#storage-reference-table th:nth-child(4), #storage-reference-table th:nth-child(5) { width: 19%; }
.cleanup-control-panel, .cleanup-history-panel { margin-bottom: 22px; }
.cleanup-control-panel { border-color: #edd49f; }
.cleanup-panel-content { padding: 18px 20px 0; }
.cleanup-warning { margin: 0 0 18px; }
.cleanup-rule-fieldset { display: grid; gap: 10px; margin: 4px 0; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.cleanup-rule-fieldset legend { padding: 0 7px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.cleanup-rule-list { display: grid; gap: 9px; }
.cleanup-rule-option { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 11px; margin: 0; border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; padding: 11px 12px; }
.cleanup-rule-option input { width: 18px; min-height: 18px; margin: 0; }
.cleanup-rule-option strong, .cleanup-rule-option small { display: block; }
.cleanup-rule-option small { margin-top: 3px; color: var(--muted); font-weight: 500; line-height: 1.4; }
.cleanup-rule-count { border-radius: 999px; background: var(--blue-soft); color: var(--blue-dark); padding: 5px 9px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.confirmation-phrase { display: block; border: 1px solid #edd49f; border-radius: 9px; background: var(--amber-soft); color: #744609; padding: 10px 12px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; overflow-wrap: anywhere; }
.retention-candidates-panel .toolbar { align-items: center; }
.retention-filters { justify-content: flex-end; }
.retention-object-id { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.retention-overdue { color: var(--red); }
.retention-detail-note { margin: 0 0 20px; line-height: 1.5; }
.overview-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.overview-heading h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.overview-heading .muted { margin: 7px 0 0; }
.month-chip { border: 1px solid #cddcf8; border-radius: 999px; background: var(--blue-soft); color: var(--blue-dark); padding: 8px 12px; font-size: 12px; font-weight: 750; text-transform: capitalize; }
.customer-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
.customer-metrics article { display: flex; flex-direction: column; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.customer-metrics article:first-child { border-color: #cddcf8; background: linear-gradient(135deg,white,var(--blue-soft)); }
.customer-metrics span { color: var(--muted); font-size: 13px; }
.customer-metrics strong { margin: 8px 0 5px; font-size: 34px; letter-spacing: -.045em; line-height: 1; }
.customer-metrics small { color: var(--muted); font-size: 12px; text-transform: capitalize; }
.customer-chart-panel { padding: 22px; }
.chart-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.chart-heading h2 { margin: 0; font-size: 18px; text-transform: capitalize; }
.chart-heading p { margin: 5px 0 0; font-size: 13px; }
.chart-legend { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.chart-legend span { width: 9px; height: 9px; border-radius: 3px; background: var(--blue); }
.customer-chart { display: grid; grid-template-columns: repeat(31,minmax(10px,1fr)); align-items: stretch; gap: 5px; min-width: 620px; height: 245px; padding-top: 8px; overflow: hidden; }
.chart-column { display: grid; grid-template-rows: 18px 1fr 18px; align-items: end; min-width: 0; }
.chart-value { color: var(--muted); font-size: 10px; text-align: center; }
.chart-track { position: relative; height: 100%; border-bottom: 1px solid var(--line); }
.chart-bar { position: absolute; right: 0; bottom: 0; left: 0; min-height: 2px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg,#5d8ee9,var(--blue)); }
.chart-day { padding-top: 6px; color: var(--muted); font-size: 10px; text-align: center; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 8px 28px rgba(30,45,34,.04); }
.toolbar { display: flex; justify-content: space-between; gap: 20px; padding: 21px; border-bottom: 1px solid var(--line); }
.toolbar h2 { margin: 0; font-size: 18px; }
.toolbar p { margin: 5px 0 0; font-size: 13px; }
.filters { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.filters input { width: 210px; }
.report-toolbar-heading { display: grid; gap: 13px; }
.mode-switch { display: inline-flex; align-items: center; width: fit-content; gap: 9px; color: var(--text); font-size: 13px; font-weight: 700; cursor: pointer; }
.mode-switch input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mode-switch-track { display: inline-flex; align-items: center; width: 39px; height: 22px; border: 1px solid #b8c2d4; border-radius: 999px; background: #d8e0ef; padding: 2px; transition: background .18s ease, border-color .18s ease; }
.mode-switch-track span { width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(16,24,40,.22); transition: transform .18s ease; }
.mode-switch input:checked + .mode-switch-track { border-color: var(--blue); background: var(--blue); }
.mode-switch input:checked + .mode-switch-track span { transform: translateX(17px); }
.mode-switch input:focus-visible + .mode-switch-track { outline: 3px solid var(--blue-soft); outline-offset: 2px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 20px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
td { font-size: 14px; }
td strong, td small { display: block; }
td small { margin-top: 4px; color: var(--muted); }
.report-group-row { background: linear-gradient(90deg,rgba(231,239,255,.36),transparent 38%); }
.report-reasons { max-width: 330px; overflow: hidden; text-overflow: ellipsis; }
.report-status-summary { color: var(--muted); font-size: 13px; }
.report-count { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 800; }
.report-count.normal { background: var(--blue-soft); color: var(--blue-dark); }
.report-count.medium { background: var(--amber-soft); color: var(--amber); }
.report-count.high { background: var(--red-soft); color: var(--red); }
.right { text-align: right; }
.actions { display: flex; justify-content: flex-end; gap: 7px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 750; }
.badge.pending, .badge.open, .badge.in_review { background: var(--amber-soft); color: var(--amber); }
.badge.approved, .badge.active, .badge.resolved, .badge.verified { background: var(--green-soft); color: var(--green); }
.badge.rejected, .badge.suspended, .badge.failed { background: var(--red-soft); color: var(--red); }
.badge.expired { background: #eef1f5; color: var(--muted); }
.badge.held { background: var(--amber-soft); color: var(--amber); }
.badge.due { background: var(--blue-soft); color: var(--blue-dark); }
.badge.completed { background: var(--green-soft); color: var(--green); }
.badge.completed_with_errors { background: var(--red-soft); color: var(--red); }
.badge.running { background: var(--blue-soft); color: var(--blue-dark); }
.empty { padding: 42px; color: var(--muted); text-align: center; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 20px; color: var(--muted); font-size: 13px; }
.pagination div { display: flex; gap: 8px; }

.modal { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; border: 0; background: transparent; padding: 24px; }
.modal[open] { display: grid; place-items: center; }
.modal::backdrop { background: rgba(16,24,40,.55); backdrop-filter: blur(3px); }
.modal-card { width: min(620px,100%); max-height: calc(100vh - 48px); overflow: auto; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: 0 25px 80px rgba(16,24,40,.25); }
.modal-card.modal-wide { width: min(920px,100%); }
.modal-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 21px 23px; border-bottom: 1px solid var(--line); background: var(--surface); }
.modal-header h2 { margin: 0; font-size: 21px; }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--muted); font-size: 24px; line-height: 1; }
.modal-content { padding: 23px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 23px; border-top: 1px solid var(--line); }
.form-stack { display: grid; gap: 10px; }
.detail-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-bottom: 20px; }
.detail-field { min-width: 0; border: 1px solid var(--line); border-radius: 11px; background: #fafbfc; padding: 13px; }
.detail-field span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.detail-field strong, .detail-field p { margin: 0; overflow-wrap: anywhere; line-height: 1.45; }
.detail-field.full { grid-column: 1 / -1; }
.section-title { margin: 22px 0 10px; font-size: 15px; }
.report-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.timeline { display: grid; gap: 10px; }
.timeline-item { border-left: 3px solid var(--line); background: #fafbfc; padding: 11px 13px; }
.timeline-item header { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 5px; }
.timeline-item p { margin: 4px 0 0; color: var(--muted); line-height: 1.5; white-space: pre-wrap; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.review-form { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfc; padding: 15px; }
.review-form .button { justify-self: start; }
.loading { padding: 35px; color: var(--muted); text-align: center; }
.group-report-list { display: grid; gap: 9px; }
.group-report-item { display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfc; padding: 13px 14px; }
.group-report-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 9px 12px; min-width: 0; }
.group-report-summary .muted { font-size: 13px; }
.group-limit-note { margin: 14px 0 0; font-size: 12px; }

@media (max-width: 980px) {
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 22px; overflow: visible; }
  .brand-row { padding: 0; }
  .sidebar nav { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; padding-bottom: 0; }
  .nav-item.logout { grid-column: 2; grid-row: 1; width: auto; margin: 0; }
  .stats { grid-template-columns: repeat(2,1fr); }
  .stats.stats-three { grid-template-columns: repeat(3,1fr); }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .customer-chart-panel { overflow-x: auto; }
  .filters { width: 100%; }
  .filters input { flex: 1; min-width: 180px; }
  .retention-filters { justify-content: flex-start; }
}

@media (max-width: 600px) {
  .sidebar { gap: 18px; padding: 20px 14px; }
  .sidebar nav { grid-template-columns: 1fr; gap: 14px; }
  .nav-group + .nav-group { border-top: 1px solid rgba(255,255,255,.1); padding-top: 14px; }
  .nav-group-items { display: flex; flex-wrap: wrap; gap: 3px; }
  .nav-group-items .nav-item { width: auto; font-size: 13px; }
  .login-card { padding: 30px 24px; }
  .workspace { padding: 24px 14px 40px; }
  .topbar { align-items: flex-start; gap: 16px; }
  .admin-chip { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
  .stats, .stats.stats-three { grid-template-columns: 1fr 1fr; gap: 9px; }
  .overview-heading, .privacy-note { align-items: flex-start; flex-direction: column; gap: 12px; }
  .customer-metrics, .detail-grid { grid-template-columns: 1fr; }
  .detail-field.full { grid-column: auto; }
  .stats article { padding: 15px; }
  .filters select, .filters input, .filters button { width: 100%; flex: auto; }
  .mode-switch { width: auto; }
  .group-report-item { align-items: stretch; flex-direction: column; }
  .group-report-item .button { width: 100%; }
  .cleanup-rule-option { grid-template-columns: auto minmax(0,1fr); }
  .cleanup-rule-count { grid-column: 2; justify-self: start; }
  .modal { padding: 10px; }
  .modal-card { max-height: calc(100vh - 20px); }
  .pagination { align-items: flex-start; flex-direction: column; }
}
.account-deletion-panel .deletion-systems { min-width: 210px; }
.deletion-step { margin: 3px 0; font-size: 12px; line-height: 1.5; }
.deletion-step-failed { color: #b42318; }
.deletion-step-succeeded, .deletion-step-skipped { color: #067647; }
.account-deletion-panel .pagination { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 16px 20px; }
.account-deletion-panel .pagination > div { display: flex; gap: 8px; }
.worker-status { margin: 0; padding: 0 20px 18px; line-height: 1.6; }
.archive-panel { margin-bottom: 20px; }
.archive-form { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 0 24px 20px; }
.archive-form .full { grid-column: 1 / -1; }
.archive-form input, .archive-form select, .archive-form textarea { width: 100%; }
.archive-form .muted, .archive-history .muted { font-size: 13px; line-height: 1.6; }
.archive-message { margin: 0; padding: 0 24px 20px; }
.archive-documents { display: grid; gap: 12px; padding: 0 24px 20px; }
.archive-document { display: flex; gap: 18px; justify-content: space-between; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.archive-document p { margin: 5px 0 0; }
.archive-history { border-top: 1px solid var(--line); padding: 20px 24px; }
.archive-history h3 { margin-top: 0; }
.archive-history li { margin: 8px 0; font-size: 13px; }
#finance-section .panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px 24px 16px; }
#finance-section .panel-heading h2 { margin: 0 0 8px; font-size: 20px; }
#finance-section .panel-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
#finance-section .archive-form label:not(.finance-origin), .finance-controls label { display: grid; gap: 8px; }
.finance-origin { display: flex; align-items: flex-start; gap: 10px; line-height: 1.5; }
.archive-form .finance-origin input { flex: 0 0 18px; width: 18px; min-height: 18px; height: 18px; margin: 0; }
#finance-section .table-wrap { overflow-x: auto; }
#finance-section table { min-width: 720px; }
#finance-section td { white-space: normal; overflow-wrap: anywhere; }
.finance-controls { padding: 0 24px 16px; display: flex; gap: 24px; align-items: flex-end; }
.finance-controls .muted { max-width: 620px; font-size: 13px; line-height: 1.6; }
.finance-detail { margin-top: 20px; }
.finance-review-action { align-self: end; }
#finance-section .pagination { display: flex; gap: 16px; justify-content: space-between; align-items: center; padding: 16px 24px; }
#finance-section .pagination > div { display: flex; gap: 8px; }
.finance-actions { display: flex; gap: 8px; justify-content: flex-end; }
.finance-actions .button { flex-shrink: 0; white-space: nowrap; overflow-wrap: normal; }
@media (max-width: 600px) {
  .archive-form { grid-template-columns: 1fr; padding: 0 16px 20px; }
  .archive-document { align-items: stretch; flex-direction: column; }
  .archive-documents, .archive-history { padding-left: 16px; padding-right: 16px; }
  .finance-controls { align-items: stretch; flex-direction: column; gap: 8px; padding: 0 16px 16px; }
  #finance-section .panel-heading { padding: 20px 16px 16px; align-items: flex-start; flex-direction: column; }
  .workspace:has(#finance-section:not([hidden])) .topbar { flex-wrap: wrap; }
  #finance-section .pagination { align-items: flex-start; flex-direction: column; }
}

#invoices-section { display: grid; gap: 20px; }
#invoices-section[hidden] { display: none; }
#invoices-section .panel-heading { padding: 22px 24px 16px; }
#invoices-section .panel-heading h2 { margin: 0 0 8px; font-size: 20px; }
#invoices-section .panel-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.invoice-create-panel { overflow: visible; }
.invoice-form label { display: grid; gap: 8px; }
.invoice-form-actions { display: flex; justify-content: flex-end; }
.invoice-form-actions .button { min-width: 180px; }
#invoices-section table { min-width: 900px; }
#invoices-section td { white-space: normal; overflow-wrap: anywhere; }
#invoices-section .pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; }
#invoices-section .pagination > div { display: flex; gap: 8px; }
.invoice-amount-cell { font-variant-numeric: tabular-nums; font-weight: 750; white-space: nowrap !important; }
.badge.invoice-status.open { background: var(--amber-soft); color: var(--amber); }
.badge.invoice-status.paid { background: var(--green-soft); color: var(--green); }
.badge.invoice-status.overdue { background: var(--red-soft); color: var(--red); }

@media (max-width: 600px) {
  #invoices-section .panel-heading { padding: 20px 16px 16px; }
  #invoices-section .pagination { align-items: flex-start; flex-direction: column; padding: 16px; }
  .invoice-form-actions .button { width: 100%; }
}
/* User confirmation evidence */
.confirmation-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; padding: 0 22px 20px; }
.confirmation-filters label, .confirmation-access label { display: grid; gap: 6px; font-size: 14px; min-width: 0; }
.confirmation-filters label:first-child { flex: 1 1 280px; }
.confirmation-filters input, .confirmation-filters select, .confirmation-access select { width: 100%; min-height: 42px; }
.confirmation-coverage { padding: 0 22px 20px; overflow-wrap: anywhere; }
.confirmation-coverage p { margin: 0 0 12px; }
.confirmation-dialog { width: min(960px, calc(100vw - 32px)); max-height: 90vh; overflow: auto; padding: 24px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); box-shadow: var(--shadow); }
.confirmation-dialog::backdrop { background: rgba(23,32,47,.38); }
.confirmation-dialog .dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: -24px; background: white; padding: 12px 0; z-index: 1; }
.confirmation-dialog .dialog-header h2 { font-size: 22px; margin: 0; }
.confirmation-dialog details { margin: 14px 0; }
.confirmation-dialog summary { cursor: pointer; font-weight: 600; }
.confirmation-access, .confirmation-actions { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin: 18px 0; }
.confirmation-details { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 3fr); gap: 9px 18px; overflow-wrap: anywhere; }
.confirmation-details dt { font-weight: 600; }
.confirmation-details dd { margin: 0; white-space: pre-wrap; }
.confirmation-raw { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 480px; overflow: auto; font-size: 13px; background: #f5f7fa; padding: 16px; }
.confirmation-document { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 600px) { .confirmation-filters label { flex: 1 1 100%; } .confirmation-details { grid-template-columns: 1fr; } .confirmation-details dd { margin-bottom: 10px; } }
.confirmation-details dd { overflow-wrap: anywhere; }
#confirmations-body td { white-space: pre-line; }
.company-invoice-filters { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; padding: 20px; }
.company-invoice-filters label { display: flex; flex: 1 1 180px; flex-direction: column; gap: 8px; }
.company-invoice-filters [hidden] { display: none; }
.company-invoice-summary { font-weight: 600; }
.company-invoice-dialog { width: min(1400px, 94vw); max-height: 90vh; padding: 24px; border: 1px solid #dce2e7; border-radius: 16px; color: #16283a; }
.company-invoice-dialog::backdrop { background: rgb(0 0 0 / 40%); }
.company-invoice-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.company-invoice-dialog .table-scroll { margin: 20px 0; }
#company-invoices-section td { max-width: 320px; overflow-wrap: anywhere; white-space: normal; }
#company-invoices-section td .button { white-space: normal; overflow-wrap: anywhere; }
.auth-captcha { width: min(420px, calc(100vw - 32px)); box-sizing: border-box; border: 0; border-radius: 20px; padding: 20px; color: #0f172a; }
.auth-captcha::backdrop { background: rgb(15 23 42 / 45%); }
.auth-captcha h2 { margin: 0 0 8px; font-size: 20px; }
.auth-captcha iframe { width: 100%; height: 270px; border: 0; }
