/* Rent Flow — plain CSS, no build step. Colours are tokens; utility colours are fixed per type. */
:root {
    color-scheme: light;
    --canvas: #f5f4f0;
    --surface: #ffffff;
    --ink: #1a1a18;
    --muted: #6b6963;
    --faint: #9b9890;
    --line: #e6e3dc;
    --brand: #1f5c4a;
    --brand-hover: #2b6d59;
    --brand-soft: #e3efe9;
    --gas: #eb6834;
    --electricity: #eda100;
    --water: #2a78d6;
    --other: #6250d6;
    --good: #1d7a4b;
    --good-soft: #e2f3e9;
    --warn: #a35d00;
    --warn-soft: #fdf0d9;
    --bad: #b42626;
    --bad-soft: #fbe6e4;
    --radius: 16px;
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--canvas);
    color: var(--ink);
    font: 15px/1.5 var(--font);
    font-feature-settings: "tnum" 1;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }
h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.container { max-width: 1152px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 672px; margin: 0 auto; }
.medium { max-width: 896px; margin: 0 auto; }
main.container { padding-top: 32px; padding-bottom: 40px; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 600; }
.medium-weight { font-weight: 500; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.text-good { color: var(--good); }
.text-warn { color: var(--warn); }
.text-bad { color: var(--bad); }
.stack > * + * { margin-top: 32px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Header */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: -0.01em; }
.logo { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: #fff; font-size: 14px; }
.logo.large { width: 44px; height: 44px; border-radius: 12px; font-size: 18px; margin: 0 auto; }
.back { font-size: 14px; color: var(--muted); }
.back:hover { color: var(--ink); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 8px 0 20px; }
.page-head p { font-size: 14px; color: var(--muted); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card.pad { padding: 20px; }
.card.pad-s { padding: 16px; }
.divided > * + * { border-top: 1px solid var(--line); }
.empty { padding: 40px 16px; text-align: center; font-size: 14px; color: var(--muted); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 14px; border-radius: 8px; border: 1px solid transparent;
    font: 500 14px/1.4 var(--font); cursor: pointer; transition: background-color 120ms; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { background: var(--canvas); }
.btn-danger { background: transparent; color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-block { width: 100%; }
.link { color: var(--brand); font-weight: 500; }
.link:hover { text-decoration: underline; }
.link-button { background: none; border: 0; padding: 0; font: 500 12px var(--font); color: var(--brand); cursor: pointer; }
.link-button:hover { text-decoration: underline; }
form.inline { display: inline; }

/* Forms */
.label { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
.input {
    width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
    background: var(--surface); color: var(--ink); font: 14px/1.4 var(--font); outline: none;
}
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 92, 74, 0.15); }
.input:invalid:not(:placeholder-shown) { border-color: var(--bad); }
textarea.input { min-height: 80px; resize: vertical; }
.field-grid { display: grid; gap: 16px; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-radius: 8px; background: var(--canvas); font-size: 14px; }
.check input { margin-top: 3px; accent-color: var(--brand); }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 16px; }
.inline-form .w-xs { width: 80px; }
.inline-form .w-s { width: 112px; }
.inline-form .w-m { width: 144px; }
.inline-form .w-l { width: 192px; }
.utility-row { padding-bottom: 30px; }
.with-hint { position: relative; }
.field-hint { position: absolute; top: 100%; left: 0; margin-top: 4px; font-size: 12px; color: var(--faint); white-space: nowrap; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 10px 12px; text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; border-bottom: 1px solid var(--line); }
td { padding: 10px 12px; white-space: nowrap; vertical-align: top; }
tbody tr + tr td { border-top: 1px solid var(--line); }
tbody tr:hover { background: rgba(245, 244, 240, 0.6); }
tfoot td { border-top: 1px solid var(--line); background: rgba(245, 244, 240, 0.5); }
th.right, td.right { text-align: right; }
.sub { font-size: 12px; color: var(--muted); font-weight: 400; }
/* Wide per-utility tables: tighter horizontal padding so they fit without scrolling. */
/* Wide per-utility tables: tighter padding, and text may wrap between parts (marked .nowrap) so the table
   fits the page in every language instead of scrolling sideways. */
table.dense th, table.dense td { padding-left: 6px; padding-right: 6px; white-space: normal; }
table.dense th:first-child, table.dense td:first-child { padding-left: 12px; }
table.dense th:last-child, table.dense td:last-child { padding-right: 12px; }
table.dense .nowrap { white-space: nowrap; }

/* Badges & dots */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-neutral { background: var(--canvas); color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot.small { width: 8px; height: 8px; }
.with-dot { display: inline-flex; align-items: center; gap: 6px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-label { font-size: 12px; font-weight: 500; color: var(--muted); }
.stat-value { margin-top: 6px; font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.stat-hint { margin-top: 4px; font-size: 12px; }

/* Section headings */
.section-title { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.section-title p { font-size: 14px; color: var(--muted); }

/* Supply cards */
.supply { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.supply .card { display: flex; flex-direction: column; padding: 16px; }
.reading { margin-top: 16px; display: flex; align-items: baseline; gap: 6px; }
.reading strong { font-size: 30px; font-weight: 600; letter-spacing: -0.01em; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; }
.fixed-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; }

/* Usage chart */
.chart { width: 100%; height: auto; overflow: visible; }
.chart text { font-size: 10px; }
.chart .value { fill: var(--ink); font-weight: 500; }
.chart .tip { fill: var(--muted); opacity: 0; transition: opacity 120ms; }
.chart .date { fill: var(--faint); }
.chart .col:hover .tip, .chart .col:focus .tip { opacity: 1; }
.chart .col:hover .bar { filter: brightness(0.92); }
.chart .col:focus { outline: none; }

/* Tabs */
/* The row's bottom line is an inset shadow so the active underline can cover it without overflowing. */
.tabs { display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; margin: 24px 0; box-shadow: inset 0 -1px 0 var(--line); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 8px 12px; border-bottom: 2px solid transparent; font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { border-color: var(--brand); color: var(--ink); }

/* Segmented language toggle */
.segmented { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--canvas); box-shadow: inset 0 0 0 1px var(--line); }
.segmented a, .segmented button {
    padding: 4px 8px; border: 0; border-radius: 6px; background: transparent;
    font: 600 12px var(--font); text-transform: uppercase; color: var(--muted); cursor: pointer;
}
.segmented a:hover, .segmented button:hover { color: var(--ink); }
.segmented .active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

/* Flash */
.flash { margin-bottom: 16px; padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.flash-success { background: var(--good-soft); color: var(--good); }
.flash-error { background: var(--bad-soft); color: var(--bad); }
.notice { margin-bottom: 20px; padding: 12px 16px; border-radius: 12px; font-size: 14px; }
.notice strong { display: block; margin-bottom: 2px; }
.notice-warn { background: var(--warn-soft); color: var(--warn); }
.tariff { margin-bottom: 12px; padding: 12px 16px 0; }
.tariff summary { cursor: pointer; padding-bottom: 12px; font-size: 14px; font-weight: 500; color: var(--brand); }
.tariff .inline-form { padding: 12px 0 16px; }

/* Share panel */
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.share-url { font-size: 12px; color: var(--muted); }

/* Payments layout */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.split form > * + * { margin-top: 16px; }

/* Login */
.center-screen { position: relative; display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 16px; }
.center-screen .corner { position: absolute; top: 16px; right: 16px; }
.login { width: 100%; max-width: 384px; }
.login-head { margin-bottom: 24px; text-align: center; }
.login-head h1 { margin-top: 16px; font-size: 20px; }
.login-head p { margin-top: 4px; font-size: 14px; color: var(--muted); }
.login form > * + * { margin-top: 16px; }

/* Shared report header */
.report-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; }
.eyebrow { font-size: 12px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.pill { padding: 4px 12px; border-radius: 999px; background: var(--canvas); font-size: 12px; color: var(--muted); }
footer.report-foot { padding: 0 0 40px; text-align: center; font-size: 12px; color: var(--faint); }

/* Property list */
.property-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.property-card { display: block; padding: 20px; transition: box-shadow 150ms; }
.property-card:hover { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06); }
.property-card:hover h2 { color: var(--brand); }
.property-card h2 { font-size: 15px; }
.property-card dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 20px 0 0; font-size: 14px; }
.property-card dt { font-size: 12px; color: var(--muted); }
.property-card dd { margin: 0; font-weight: 500; }

@media (max-width: 1024px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .supply { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
    .supply, .property-grid { grid-template-columns: minmax(0, 1fr); }
    .field-grid.two { grid-template-columns: minmax(0, 1fr); }
    .span-2 { grid-column: auto; }
    .stat-value { font-size: 20px; }
}
