:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #f4f6fb;
  color: #182137;
  --muted: #526078;
  --border: #dce2ee;
  --accent: #5346ce;
  --dark: #18213c;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.055em; line-height: 1.1; }
h2 { font-size: 1.1rem; letter-spacing: -.02em; }
p { line-height: 1.5; color: var(--muted); }
button, input, select { font: inherit; }
button, a, input, select, [tabindex] { outline-offset: 4px; }
:focus-visible { outline: 2px solid #6554e7; }
.frame { width: min(1380px, 100% - 64px); margin-inline: auto; }
.topbar { background: var(--dark); color: #fff; }
.top-content { min-height: 64px; display: flex; align-items: center; gap: 20px; }
.brand { color: inherit; text-decoration: none; font-size: 1.2rem; font-weight: 750; display: flex; gap: 10px; align-items: center; letter-spacing: -.03em; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: #a99dff; color: #1b1948; font-weight: 800; }
.top-label { border-left: 1px solid #48516b; color: #d7ddef; padding-left: 20px; font-size: .9rem; }
.source-name { margin-left: auto; color: #d7ddef; font-size: .85rem; }
main { padding-block: 38px 32px; }
.page-heading, .section-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.page-heading { margin-bottom: 23px; }
.page-heading p, .section-heading p { margin-top: 5px; }
.section-heading p { font-size: .9rem; }
.panel, .metric { background: #fff; border: 1px solid var(--border); border-radius: 15px; }
.import-panel { padding: 22px; }
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-block: 16px; }
.upload { display: grid; align-content: start; gap: 6px; padding: 14px; border: 1px dashed #aab4cf; border-radius: 11px; background: #f8f9ff; min-width: 0; }
.upload strong { font-size: .95rem; }
.upload span { font-size: .875rem; color: var(--muted); }
.upload input { width: 100%; margin-top: 5px; font-size: .875rem; }
.upload input::file-selector-button { padding: 7px 11px; margin-right: 10px; border: 1px solid #cdd4e7; border-radius: 7px; background: white; color: #292653; cursor: pointer; }
.button { padding: 9px 13px; border: 1px solid transparent; border-radius: 8px; font-size: .875rem; font-weight: 650; cursor: pointer; white-space: nowrap; }
.button:disabled { opacity: .48; cursor: default; }
.primary { background: var(--accent); color: white; }
.primary:not(:disabled):hover { background: #4437b6; }
.secondary { background: #fff; border-color: var(--border); color: #262b49; }
.secondary:not(:disabled):hover { background: #f1efff; border-color: #b8aff5; }
.text-button { background: transparent; color: #4535b5; }
.import-actions, .date-form, .table-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 11px; }
#import-status, .date-status { font-size: .875rem; }
.error { color: #a02039; }
.overview-head { margin-block: 27px 13px; }
.report-switch { display: flex; gap: 7px; margin-top: 22px; }
.report-switch + .overview-head { margin-top: 14px; }
.report-switch[hidden] + .overview-head { margin-top: 27px; }
.report-switch .button[aria-pressed="true"] { background: #ece9ff; color: #3a2ba1; border-color: #b8aff5; }
.date-form label { display: flex; gap: 7px; align-items: center; font-size: .875rem; color: var(--muted); }
input[type="date"], input[type="search"], select { border: 1px solid var(--border); border-radius: 8px; background: #fff; color: #182137; padding: 7px 9px; }
select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 48%, #526078 50%), linear-gradient(135deg, #526078 50%, transparent 52%); background-position: right 15px center, right 10px center; background-size: 5px 5px; background-repeat: no-repeat; }
.date-status:not(:empty) { margin-bottom: 12px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 15px; }
.metric { padding: 17px 18px; min-width: 0; }
.metric:first-child { background: #24234b; color: white; border-color: #24234b; }
.metric:first-child span, .metric:first-child small { color: #dedaff; }
.metric span { display: block; color: var(--muted); font-size: .875rem; }
.metric strong { display: block; margin-block: 8px 3px; font-size: clamp(1.35rem, 3vw, 2.05rem); letter-spacing: -.045em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric small { color: var(--muted); font-size: .8rem; }
.panels { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(245px, 1fr); gap: 15px; margin-bottom: 15px; }
.chart-panel, .direction-panel { padding: 18px; }
#chart-total { color: var(--muted); font-size: .875rem; }
.plot { display: flex; align-items: stretch; gap: 2px; height: 122px; margin-top: 12px; background: repeating-linear-gradient(to top, transparent 0 29px, #e9edf6 30px); border-bottom: 1px solid var(--border); }
.bar-slot { flex: 1 1 0; position: relative; min-width: 0; }
.bar { position: absolute; left: 8%; right: 8%; border-radius: 3px 3px 0 0; background: #7666e9; }
.bar.credit { border-radius: 0 0 3px 3px; background: #138273; }
.chart-dates { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; margin-top: 7px; }
.chart-empty { padding-block: 26px 0; }
.direction { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 11px 0; border-bottom: 1px solid #e9edf6; }
.direction:last-child { border-bottom: 0; }
.direction small { color: var(--muted); }
.direction strong { font-size: .9rem; }
.number-heading { padding: 16px 18px; }
.table-controls { font-size: .875rem; }
.activity { display: inline-flex; align-items: center; gap: 5px; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td { text-align: right; padding: 11px 13px; border-bottom: 1px solid #e6eaf3; font-variant-numeric: tabular-nums; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; padding-left: 18px; }
.note-text { text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
#number-body .note-text { min-width: 150px; max-width: 275px; }
#number-head th.note-text { text-align: left; }
th { background: #eef1f8; color: #3d4a63; font-size: .8rem; font-weight: 700; }
th button { padding: 0; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
th[aria-sort="descending"] button::after { content: " ▾"; }
th[aria-sort="ascending"] button::after { content: " ▴"; }
tbody tr:hover { background: #f9f8ff; }
.number-link { padding: 0; border: 0; background: none; color: #493bac; font-weight: 700; cursor: pointer; }
.number-link:hover { text-decoration: underline; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; color: var(--muted); font-size: .875rem; }
.reconcile { margin-top: 13px; font-size: .875rem; }
dialog { width: min(940px, 100% - 32px); max-height: 88vh; padding: 0; border: 1px solid var(--border); border-radius: 15px; color: inherit; }
dialog::backdrop { background: #151c38a8; }
.modal-heading { padding: 18px; border-bottom: 1px solid var(--border); }
.modal-heading h2 { font-size: 1.4rem; }
.detail-section { padding: 14px 18px; }
.detail-section .table-scroll { margin-top: 9px; }
.detail-note { font-size: .875rem; margin-block: 8px; }
.detail-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: .875rem; margin-top: 9px; }
@media (max-width: 900px) {
  .overview-head, .number-heading { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 650px) {
  .frame { width: calc(100% - 28px); }
  .top-content { gap: 12px; min-height: 56px; }
  .top-label { padding-left: 12px; }
  .source-name { display: none; }
  main { padding-top: 24px; }
  .page-heading { flex-wrap: wrap; }
  .upload-grid, .panels { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric, .import-panel { padding: 13px; }
  input[type="search"] { max-width: 100%; }
}
