:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px; color: #263244; background: #f4f6f8;
  font-synthesis: none; --blue: #285eca; --muted: #7a8595; --border: #dde3ea;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; background: #fff; color: inherit; }
button { cursor: pointer; }
button:hover { background: #f4f7fb; }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
button.primary:hover { background: #1f50b4; }
a { color: var(--blue); text-decoration: none; }
button:focus-visible, input:focus, a:focus-visible, .table-wrap:focus-visible { outline: 3px solid #bdd0f5; outline-offset: 2px; }
.quiet { border: 0; background: transparent; color: var(--muted); font-size: 12px; padding: 8px; }
.danger { color: #ab4242; }
.header { max-width: 1060px; margin: auto; padding: 26px 28px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: #1e2a3c; font-size: 21px; font-weight: 650; letter-spacing: -.6px; }
.brand small { display: block; font-size: 11px; color: var(--muted); letter-spacing: 0; font-weight: 400; margin-top: 3px; }
.header-actions, .sheet-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
main { max-width: 1060px; margin: auto; padding: 8px 28px 40px; }
footer { text-align: center; color: #9aa4b2; font-size: 11px; padding: 24px; }
h1, h2, p { margin: 0; }
h1 { font-size: 28px; letter-spacing: -.8px; font-weight: 600; overflow-wrap: anywhere; }
h2 { font-size: 15px; font-weight: 600; }
.subtitle, .note { color: var(--muted); font-size: 13px; line-height: 1.6; }
.subtitle { margin-top: 7px; }
.note { margin-bottom: 16px; overflow-wrap: anywhere; }
.page-title { margin-bottom: 24px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.breadcrumb { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.breadcrumb button { padding: 0; border: 0; background: transparent; color: var(--blue); }
.sheet { background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 15px 17px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.sheet-actions button { font-size: 12px; }
.table-wrap { overflow-x: auto; }
.ledger { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.ledger th, .ledger td { text-align: center; vertical-align: middle; padding: 12px; border-right: 1px solid #e9edf2; border-bottom: 1px solid #e5eaf0; }
.ledger tr > :last-child { border-right: 0; width: 1%; white-space: nowrap; }
.ledger tbody tr:last-child > * { border-bottom: 0; }
.ledger thead th { color: #788496; background: #f8fafc; font-size: 11px; font-weight: 500; }
.ledger tbody th { font-weight: 550; overflow-wrap: anywhere; }
.ledger small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 4px; }
.cell-button { border: 0; border-radius: 0; background: transparent; width: calc(100% + 24px); margin: -12px; padding: 12px; }
.service-link { color: var(--blue); font-weight: 550; }
.order-cell { width: 1%; white-space: nowrap; }
.drag-handle { cursor: grab; padding: 9px 10px; color: var(--muted); font-size: 18px; line-height: 1; user-select: none; }
.drag-handle:active { cursor: grabbing; }
:is(.services-ledger, .apartments-ledger) .dragging { opacity: .45; }
:is(.services-ledger, .apartments-ledger) .drop-before > * { box-shadow: inset 0 3px var(--blue); }
:is(.services-ledger, .apartments-ledger) .drop-after > * { box-shadow: inset 0 -3px var(--blue); }
.consumption-cell { min-width: 100px; font-weight: 550; }
.consumption-cell small { max-width: 150px; margin-left: auto; margin-right: auto; }
.muted { color: var(--muted); }
.negative-consumption, .ledger small.negative-consumption { color: #a26a2d; }
.reading-value input { width: min(100%, 220px); min-width: 130px; text-align: center; font-variant-numeric: tabular-nums; }
.readings-ledger tbody th { white-space: nowrap; overflow-wrap: normal; }
.consumption-chart { margin-top: 26px; }
.chart-unit { color: var(--muted); font-size: 12px; }
.chart-scroll { padding: 12px 12px 0; overflow-x: auto; }
.chart-scroll:focus-visible { outline: 3px solid #bdd0f5; outline-offset: -3px; }
.year-chart { display: block; width: 100%; min-width: 680px; font-variant-numeric: tabular-nums; }
.chart-grid { stroke: #e9edf2; stroke-width: 1; }
.chart-axis { fill: #788496; font-size: 12px; }
.chart-baseline { stroke: #b4becc; stroke-width: 1; }
.chart-bar { fill: var(--blue); }
.chart-negative { fill: #d69c51; }
.chart-missing { fill: #a4aebd; font-size: 12px; }
.chart-hit { fill: transparent; }
.chart-point { cursor: crosshair; }
.chart-point:focus { outline: none; }
.chart-point:hover .chart-hit, .chart-point:focus .chart-hit { fill: #285eca0a; stroke: #bdd0f5; }
.chart-point:hover .chart-bar, .chart-point:focus .chart-bar { filter: brightness(.85); }
.chart-detail { padding: 6px 18px; min-height: 34px; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.chart-note, .chart-empty { padding: 0 18px 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.chart-empty { padding-top: 16px; padding-bottom: 0; }
.reading-saved { background: #d9f2e1; }
.reading-empty { background: #fff3e3; }
.reading-saved small { color: #387552; }
.reading-empty small { color: #a26a2d; }
.year-control { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.year-control label { font-size: 12px; color: var(--muted); }
.year-control input { width: 90px; text-align: center; }
.breadcrumb { flex-wrap: wrap; }
.empty { color: var(--muted); padding: 36px 18px !important; line-height: 1.7; white-space: normal !important; }
dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); border: 1px solid var(--border); border-radius: 12px; padding: 22px; box-shadow: 0 20px 70px #18355126; color: inherit; }
dialog::backdrop { background: #14223455; backdrop-filter: blur(2px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.field { margin-top: 16px; }
.field label { display: block; font-size: 12px; margin-bottom: 7px; color: var(--muted); }
.field input { display: block; width: 100%; }
.form-error { color: #ab4242; font-size: 12px; line-height: 1.6; margin-top: 12px; }
.form-error:empty { display: none; }
.selection-wrap { border: 1px solid var(--border); border-radius: 8px; }
.selection-table label { cursor: pointer; display: block; }
.selection-table input { width: 18px; height: 18px; accent-color: #368460; padding: 0; cursor: pointer; }
.selection-table .already-added { background: #edf7f0; }
.selection-table .already-added label { cursor: default; }
.login-box, .error-box { max-width: 400px; margin: 60px auto; background: white; border: 1px solid var(--border); border-radius: 12px; padding: 28px; }
.login-box button { margin-top: 20px; }
.error-box p { margin: 18px 0; color: var(--muted); }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #263244; color: #fff; padding: 12px 18px; border-radius: 9px; font-size: 12px; max-width: calc(100vw - 32px); z-index: 5; box-shadow: 0 3px 20px #18355125; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 600px) {
  .header { padding: 20px 16px; }
  .brand { font-size: 19px; }
  .brand small { max-width: 150px; font-size: 10px; }
  main { padding: 8px 16px 28px; }
  h1 { font-size: 24px; }
  .ledger th, .ledger td { padding: 10px; }
  .cell-button { width: calc(100% + 20px); margin: -10px; padding: 10px; }
  .ledger td button { padding: 8px; font-size: 12px; }
  .readings-ledger td:last-child { white-space: normal; min-width: 100px; }
  .readings-ledger { min-width: 480px; }
  .readings-ledger td form { display: grid; justify-items: center; gap: 2px; }
  .readings-ledger td .form-error { white-space: normal; overflow-wrap: anywhere; }
  dialog { padding: 18px; }
}
