:root {
  color-scheme: light;
  --ink: #29261f;
  --muted: #605d54;
  --paper: #fffef8;
  --surface: #fff;
  --accent: #d7c432;
  --green: #315f49;
  --danger: #9e352d;
  --line: #ddd9c7;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}
header { border-bottom: 1px solid var(--line); background: var(--surface); }
header .bar, main, footer div {
  width: min(1600px, calc(100% - 32px));
  margin: 0 auto;
}
header .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  flex-wrap: wrap;
}
header img { width: 112px; height: auto; display: block; }
#session { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
main { padding: 36px 0 64px; }
h1 { margin: 0 0 10px; font-size: clamp(26px, 5vw, 38px); line-height: 1.15; }
h2 { margin: 36px 0 12px; font-size: 22px; }
.lead { color: var(--muted); font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code { background: #f3f0df; padding: 1px 4px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 18px;
  display: grid;
  gap: 12px;
}
.narrow { max-width: 420px; }
label { display: grid; gap: 4px; font-size: 14px; font-weight: 700; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
input, select, textarea {
  font: inherit;
  font-weight: 400;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  width: 100%;
  min-width: 0;
}
input[type="checkbox"] { width: auto; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}
fieldset { border: 1px solid var(--line); padding: 12px; display: grid; gap: 10px; margin: 0; }
legend { font-weight: 700; padding: 0 4px; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

button { font: inherit; cursor: pointer; }
button.primary {
  border: 2px solid var(--green);
  background: var(--green);
  color: #fff;
  font-weight: 700;
  padding: 9px 16px;
}
button.primary:disabled { opacity: 0.6; cursor: wait; }
button.link {
  border: 0;
  background: none;
  color: var(--green);
  text-decoration: underline;
  padding: 4px 0;
  justify-self: start;
}
.pill {
  background: var(--accent);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
}

.flash { padding: 10px 14px; border: 1px solid var(--line); background: #f4f8f5; }
.flash.error { border-color: var(--danger); background: #fbf0ee; color: var(--danger); }

.toolbar { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin: 18px 0 4px; }
.toolbar label { min-width: 150px; }

.totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 18px 0;
}
.total { background: var(--surface); border: 1px solid var(--line); padding: 12px; }
.total strong { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.total span { color: var(--muted); font-size: 13px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: #faf8ee; font-size: 12px; text-transform: uppercase; letter-spacing: 0.02em; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tr.subtotal td { font-weight: 700; background: #faf8ee; }
.status-on { color: var(--green); font-weight: 700; }
.status-off { color: var(--danger); font-weight: 700; }

.grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 28px; }
.list { list-style: none; padding: 0; margin: 0 0 12px; border: 1px solid var(--line); background: var(--surface); }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }

footer { border-top: 1px solid var(--line); padding: 20px 0; }
footer p { margin: 0; font-size: 13px; color: var(--muted); }

@media (max-width: 860px) {
  .grid, .row, .row.three { grid-template-columns: minmax(0, 1fr); }
}
