:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #5f6670;
  --border: #e2e0da;
  --accent: #b5462b;
  --good: #2f7d4f;
  --warn: #b5462b;
  --heat: #c8553d;
  --heat-light: #ecb9ad;
  --dd: #3d6fb6;
  --money: #6a7f3a;
  --highlight: #fff6df;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c;
    --surface: #1f2228;
    --text: #e8e6e1;
    --muted: #a3a8b0;
    --border: #33373f;
    --accent: #f08a6c;
    --good: #6cc28f;
    --warn: #f08a6c;
    --heat: #f08a6c;
    --heat-light: #7a4537;
    --dd: #7fa7e3;
    --money: #b2c77a;
    --highlight: #3a3220;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
.muted, small { color: var(--muted); }

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem;
  padding: .75rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.brand span { color: var(--accent); }
.topbar nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: center; }
.topbar nav a { text-decoration: none; }

main { max-width: 1100px; margin: 0 auto; padding: 1rem; }
footer { max-width: 1100px; margin: 0 auto; padding: 1rem; color: var(--muted); font-size: .85rem; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 1rem 1.25rem; margin-bottom: 1rem;
}
.card.narrow { max-width: 560px; }
.card.highlight { background: var(--highlight); }
.page-head { margin: .5rem 0 1rem; }
.page-head p { margin: .25rem 0; }

.status { display: inline-block; padding: .2rem .6rem; border-radius: 6px; background: var(--surface);
  border: 1px solid var(--border); font-size: .9rem; }
.status-techem-estimate { border-color: var(--warn); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .8rem 1rem;
  display: flex; flex-direction: column; gap: .15rem; }
.tile .label { color: var(--muted); font-size: .85rem; }
.tile .value { font-size: 1.45rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile .note { color: var(--muted); font-size: .8rem; }
.tile.good .value { color: var(--good); }
.tile.warn .value { color: var(--warn); }

.chart { position: relative; height: 300px; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
table.dense { font-size: .85rem; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td.neg { color: var(--warn); }
tr.inactive td { color: var(--muted); }
.src { font-size: .75rem; color: var(--muted); }
.src-techem-estimate { color: var(--warn); }

form.inline { display: inline; margin: 0; }
.field { margin-bottom: .8rem; display: flex; flex-direction: column; gap: .25rem; }
.field label { font-weight: 600; font-size: .9rem; }
.field label.check { font-weight: normal; display: flex; gap: .5rem; align-items: center; }
input[type=text], input[type=email], input[type=password], select {
  font: inherit; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); width: 100%;
}
input.copy { font-family: ui-monospace, monospace; font-size: .85rem; }
button {
  font: inherit; padding: .5rem 1rem; border-radius: 6px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; cursor: pointer;
}
button.link { background: none; border: none; color: var(--accent); padding: 0 .25rem; text-decoration: underline; }
button.link.current { font-weight: 700; text-decoration: none; color: var(--text); }
button.small { font-size: .85rem; }
.error, .errors { color: var(--warn); margin: .2rem 0; }
.message { padding: .6rem .9rem; border-radius: 8px; background: var(--highlight); border: 1px solid var(--border); }
ul.links { padding-left: 1.2rem; }

@media (max-width: 600px) {
  main { padding: .75rem; }
  .card { padding: .8rem; }
  .chart { height: 240px; }
}
