:root {
  color-scheme: light;
  --surface: #fff;
  --ground: #eef2ee;
  --ink: #17382f;
  --subtle: #405d54;
  --line: #cfdbd3;
  --dark: #12372c;
  --accent: #c9ed73;
  font: 16px/1.5 system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--ground); color: var(--ink); }
header { background: var(--dark); color: white; }
.header-inner, main { max-width: 1220px; margin-inline: auto; padding-inline: 32px; }
.header-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 750; }
.logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--dark); background: var(--accent); font-size: 25px; line-height: 1; }
.org { color: #dce8dd; font-size: 13px; }
main { padding-block: 30px 50px; }
.intro { background: #dcebd7; border: 1px solid #c8dbc6; padding: 25px 27px 27px; border-radius: 15px; }
.intro p { margin: 8px 0 0; color: #304c3f; }
h1 { margin: 0; font-size: clamp(27px, 4vw, 43px); line-height: 1.12; letter-spacing: -.044em; }
h2 { margin: 0; font-size: 21px; letter-spacing: -.025em; }
h3 { margin: 0; font-size: 17px; }
section { margin-top: 17px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px 24px; }
.heading, .actions, .toolbar, .settings, #tariffs { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.heading { justify-content: space-between; margin-bottom: 13px; }
#count, .hint { font-size: 13px; color: var(--subtle); }
.hint { margin: 10px 0 0; }
.heading .hint { margin-top: 3px; }
#files { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
#files.two-meter-files { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#meter-period input { width: auto; }
.exclusions label.source-option { display: flex; align-items: center; gap: 7px; }
.source-option input { accent-color: #1a563f; }
.card { background: #f6f8f5; border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-width: 0; }
.card[data-state="ready"] { border-color: #83ad8c; }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.format, .filename, .file-status { font-size: 12px; color: var(--subtle); }
.format { white-space: nowrap; }
.file-status { padding-top: 4px; }
.filename { margin-top: 8px; overflow-wrap: anywhere; font-weight: 650; }
.pick { position: relative; margin-top: 9px; overflow: hidden; }
.pick input { width: 1px; height: 1px; opacity: 0; position: absolute; left: 0; bottom: 0; }
button, .pick, select, input, textarea { font: inherit; border-radius: 7px; }
button, .pick { display: inline-block; cursor: pointer; border: 1px solid transparent; padding: 8px 13px; font-size: 14px; font-weight: 690; }
button, .pick { color: #fff; background: #1a563f; }
button:hover, .pick:hover { filter: brightness(.93); }
button:disabled { opacity: .55; cursor: wait; }
.pagination button:disabled, .report-actions button:disabled { cursor: default; }
.secondary, .pick { color: var(--dark); background: #fff; border-color: #aebfb4; }
.remove { background: transparent; color: var(--subtle); margin-left: 3px; font-size: 12px; padding-inline: 5px; }
.link-button { background: transparent; color: var(--dark); }
:focus-visible, .pick:focus-within { outline: 2px solid #337b52; outline-offset: 2px; }
.actions { margin: 15px 0 0; }
.settings { align-items: flex-end; margin-top: 10px; gap: 12px 20px; }
.settings input { width: 110px; }
label:not(.pick) { display: grid; gap: 4px; font-size: 13px; color: #344f43; }
select, input:not([type="file"]), textarea { min-width: 0; max-width: 100%; padding: 7px 8px; border: 1px solid #aebfb4; background: #fff; color: var(--ink); }
.exclusions { margin-top: 13px; max-width: 460px; font-size: 14px; }
.exclusions summary { padding-block: 3px; font-weight: 690; }
.exclusions > label { margin-top: 7px; }
.exclusions textarea { resize: vertical; }
.exclusions .hint { margin-top: 4px; }
.config { margin-top: 7px; font-size: 12px; }
.config > div { display: grid; gap: 5px; margin-top: 7px; }
#message { margin: 10px 0; padding: 10px 12px; border-radius: 8px; background: #fce9e2; color: #7d2d23; }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.metric { display: grid; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #f6f8f5; }
.metric span { font-size: 12px; color: var(--subtle); }
.metric strong { font-size: clamp(18px, 2.1vw, 25px); font-variant-numeric: tabular-nums; }
.metric.alert { background: #fff1da; border-color: #ead0a7; }
.toolbar { align-items: flex-end; margin-block: 14px 10px; }
.toolbar .report-search { flex: 1; max-width: 345px; }
.toolbar label.table-toggle { display: flex; align-items: center; gap: 7px; min-height: 38px; white-space: nowrap; cursor: pointer; }
.table-toggle input { width: 16px; height: 16px; margin: 0; padding: 0; accent-color: #1a563f; }
#visible-count { margin: 0 0 5px auto; }
.report-actions, .pagination { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pagination { justify-content: flex-end; margin-top: 10px; }
.pagination span { font-size: 13px; color: var(--subtle); }
.scroll { overflow: auto; border: 1px solid var(--line); border-radius: 8px; max-height: 630px; }
table { width: 100%; min-width: 780px; border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid #e0e8e1; vertical-align: top; }
thead th { color: var(--dark); background: #edf3ed; position: sticky; top: 0; z-index: 1; }
.sort-button { color: inherit; background: transparent; padding: 0; text-align: inherit; font: inherit; }
.sort-button:hover { text-decoration: underline; }
.sort-arrow { margin-left: 4px; color: var(--subtle); }
th[aria-sort] .sort-arrow { color: var(--dark); font-weight: 800; }
.cell-note { display: block; margin-top: 2px; color: var(--subtle); font-size: 11px; font-weight: 500; }
tbody tr:last-child > * { border-bottom: 0; }
.numeric { text-align: right; white-space: nowrap; }
thead th.numeric { white-space: normal; }
#columns th, #result-rows > tr > * { text-align: center; vertical-align: middle; }
#columns th[data-key="status"] { width: 200px; min-width: 200px; }
.owner { min-width: 160px; }
tr.flag { background: #fff6e6; }
.badge { display: inline-block; border-radius: 5px; padding: 2px 6px; background: #edf2eb; }
.flag .badge { background: #fae6c8; color: #703b0b; font-weight: 690; }
.check .badge { background: #fce9e2; color: #7d2d23; }
details summary { cursor: pointer; color: #295942; }
.result-detail { margin-top: 4px; }
.result-detail li { margin-block: 3px; }
.result-detail ul { padding-left: 17px; }
.activity-detail { margin-top: 8px; }
.activity-detail ul { margin-block: 5px 10px; }
dialog { width: min(990px, calc(100% - 24px)); max-height: 90vh; padding: 18px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface); }
dialog::backdrop { background: #112f27a6; }
dialog .scroll { max-height: min(610px, 66vh); }
dialog table { min-width: 740px; }
#debt-report-columns .sort-button { white-space: pre; }
#debt-report-columns th[data-key="usesElectricity"] { width: 100px; }
#debt-report-columns th[data-key="usesElectricity"] .sort-button { font-size: 12px; line-height: 1.3; }
#debt-report-totals tr > * { position: sticky; bottom: 0; background: #edf3ed; border-top: 1px solid var(--line); font-weight: 700; }
#debt-report-cost { margin: 0 0 10px; }
#chat-report { width: min(680px, calc(100% - 24px)); }
#chat-report-hint { margin: 0 0 10px; }
#chat-report-text { display: block; width: 100%; min-height: 140px; max-height: 49vh; margin: 10px 0; resize: vertical; }
@media (max-width: 840px) {
  main, .header-inner { padding-inline: 15px; }
  main { padding-top: 16px; }
  section, .intro { padding: 16px; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #files, #files.two-meter-files { grid-template-columns: 1fr; gap: 8px; }
  .card { padding: 11px; }
}
@media (max-width: 550px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .org { font-size: 11px; text-align: right; }
  .settings { align-items: stretch; flex-direction: column; }
  .settings input { width: 125px; }
  .toolbar .report-search { flex: auto; }
  #visible-count { margin-left: 0; }
}
