:root {
  color-scheme: light dark;
  --bg: #f5f4ef;
  --surface: #fffefa;
  --ink: #1c2925;
  --muted: #65736d;
  --line: #e0dfd6;
  --track: #eceae3;
  --free: #b9dfcd;
  --full: #cf4339;
  --missing: #b9b6aa;
  --accent: #17735a;
  --warn: #bf7928;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111715;
    --surface: #18201e;
    --ink: #e4ebe8;
    --muted: #93a29c;
    --line: #2a3431;
    --track: #212a27;
    --free: #2b5a48;
    --full: #ef5f53;
    --missing: #56605c;
    --accent: #5fc79f;
    --warn: #e09a4a;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.4; }
.defs { position: absolute; }
.top, main, footer { max-width: 1080px; margin: auto; padding-left: 1rem; padding-right: 1rem; }

.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; padding-top: 2rem; padding-bottom: 1.25rem; }
h1 { font-size: 1.6rem; margin: 0; letter-spacing: -.02em; }
.subtitle { margin: .25rem 0 0; color: var(--muted); }
.collector { margin: 0; font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: .45rem; }
.collector__dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--accent); flex: none; }
.collector__dot--warn { background: var(--warn); }
.collector__dot--down { background: var(--full); }

.range-form { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; }
.range-form label { display: grid; gap: .25rem; font-size: .75rem; font-weight: 600; color: var(--muted); }
input, button { font: inherit; }
input { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: .45rem; padding: .45rem .6rem; }
button { border: 0; border-radius: .45rem; padding: .5rem 1rem; background: var(--accent); color: var(--surface); font-weight: 650; cursor: pointer; }
button:hover { filter: brightness(1.08); }
.message { min-height: 1.25rem; color: var(--full); font-size: .85rem; margin: .5rem 0; }

.location { background: var(--surface); border: 1px solid var(--line); border-radius: .8rem; padding: 1rem 1.1rem .6rem; margin-bottom: 1rem; }
.location__head { display: flex; align-items: baseline; gap: .75rem; margin-bottom: .6rem; }
h2 { font-size: 1.15rem; margin: 0; }
.now-badge { font-size: .8rem; font-weight: 650; padding: .15rem .55rem; border-radius: 999px; background: var(--track); color: var(--muted); }
.now-badge--free { color: var(--accent); }
.now-badge--full { background: var(--full); color: var(--surface); }
.now-badge--error { color: var(--warn); cursor: help; }

.axis, .day { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) 11rem; gap: .75rem; align-items: center; }
.axis__hours { display: grid; grid-template-columns: repeat(8, 1fr); font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.days { list-style: none; margin: 0; padding: 0; }
.day { padding: .3rem 0; border-top: 1px solid var(--line); }
.day:first-child { border-top: 0; }
.day__date { font-size: .85rem; white-space: nowrap; }
.day--today .day__date { font-weight: 700; }
.day__summary { font-size: .85rem; font-variant-numeric: tabular-nums; }
.day__summary small { display: block; color: var(--muted); font-size: .72rem; }
.day__summary--full { color: var(--full); font-weight: 600; }
.day__summary--free { color: var(--muted); }
.day__summary--none { color: var(--muted); font-style: italic; }

.day__bar { display: block; width: 100%; height: 1.1rem; border-radius: .25rem; overflow: hidden; }
.day__bar .track { fill: var(--track); }
.day__bar .free { fill: var(--free); }
.day__bar .full { fill: var(--full); }
.day__bar .missing { fill: url(#hatch); }
.day__bar .hour { stroke: var(--surface); stroke-width: 1; }
.day__bar .now { stroke: var(--ink); stroke-width: 2; }
.hatch-back { fill: var(--track); }
.hatch-line { stroke: var(--missing); stroke-width: 2.5; }

.legend { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; font-size: .8rem; color: var(--muted); margin: .25rem 0 1.5rem; }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.swatch { width: 1.4rem; height: .8rem; border-radius: .2rem; display: inline-block; }
.swatch--full { background: var(--full); }
.swatch--free { background: var(--free); }
.swatch--missing { background: repeating-linear-gradient(45deg, var(--missing) 0 2px, var(--track) 2px 5px); }

footer { padding-bottom: 2rem; color: var(--muted); font-size: .78rem; }

@media (max-width: 640px) {
  .top { flex-direction: column; align-items: flex-start; padding-top: 1.25rem; }
  .day { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "date summary" "bar bar"; gap: .3rem .75rem; padding: .45rem 0; }
  .day__date { grid-area: date; }
  .day__summary { grid-area: summary; text-align: right; }
  .day__summary small { display: inline; margin-left: .4rem; }
  .day__bar { grid-area: bar; }
  .axis { grid-template-columns: minmax(0, 1fr); }
  .axis > span { display: none; }
}
