:root {
  --ink: #1c1b19; --muted: #3d3a35; --line: #dedbd4; --line-strong: #9a978f; --ground: #f6f5f2; --card: #ffffff;
  --accent: #0f6e6e; --accent-dark: #0a4f4f; --accent-tint: #d9ecec; --warn: #7a3b00; --warn-tint: #fde8d3; --ok-tint: #d9ecec;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'IBM Plex Sans', system-ui, sans-serif; color: var(--ink); background: var(--ground); font-size: 16px; line-height: 1.45; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1 { font-size: 28px; font-weight: 600; margin: 0; }
h2 { font-size: 18px; font-weight: 600; margin: 0; }
p { margin: 0; }
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1080px; margin: 0 auto; padding: 0 16px; height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a, .nav button { font: inherit; font-size: 15px; text-decoration: none; color: var(--ink); padding: 10px 12px; border-radius: 8px; background: none; border: 0; min-height: 44px; cursor: pointer; }
.nav a[aria-current="page"] { background: #e9e7e2; font-weight: 600; }
.app { flex-grow: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 24px 16px 48px; display: flex; flex-direction: column; gap: 20px; }
.foot { max-width: 1080px; margin: 0 auto; padding: 16px; font-size: 13px; color: var(--muted); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-device { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; }
@media (max-width: 760px) { .grid2, .grid-device { grid-template-columns: minmax(0, 1fr); } }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.danger { color: var(--warn); border-color: var(--warn); }
.btn:disabled { opacity: 0.5; cursor: default; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; border-radius: 999px; padding: 4px 10px; }
.pill.ok { color: var(--accent-dark); background: var(--ok-tint); }
.pill.warn { color: var(--warn); background: var(--warn-tint); }
.pill.quiet { color: var(--muted); background: #e9e7e2; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
label { font-size: 14px; font-weight: 600; display: block; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=date], input[type=number], select, textarea {
  width: 100%; min-height: 48px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 12px; font: inherit; font-size: 16px; background: #fff; color: var(--ink);
}
textarea { resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #8ac5c5; outline-offset: 2px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.hint { font-size: 13px; color: var(--muted); }
.pill { display: block; max-width: 100%; margin: 6px 0 0; padding: 4px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--card, #fff); color: var(--muted); font: inherit; font-size: 13px; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill:hover, .pill:focus-visible { color: var(--ink); border-color: var(--ink); }
.pill[hidden] { display: none; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.check input { width: 22px; height: 22px; }
dl.kv { margin: 0; display: grid; grid-template-columns: 140px minmax(0, 1fr); row-gap: 8px; column-gap: 12px; font-size: 15px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 12px 16px; font-size: 15px; text-decoration: none; color: var(--muted); white-space: nowrap; }
.tabs a[aria-current="page"] { font-weight: 600; color: var(--ink); border-bottom: 3px solid var(--ink); }
.crumbs { font-size: 14px; }
.crumbs span { color: var(--line-strong); padding: 0 6px; }
.steps { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; font-size: 13px; }
.steps li { display: flex; flex-direction: column; gap: 6px; }
.steps .bar { height: 6px; border-radius: 3px; background: var(--line); }
.steps .done .bar { background: var(--accent); }
.steps .now .bar { background: var(--ink); }
.steps .now { font-weight: 600; }
.code { height: 72px; border: 2px solid var(--ink); border-radius: 10px; font-size: 36px; letter-spacing: 0.25em; font-weight: 600; text-transform: uppercase; }
.notice { padding: 12px 16px; border-radius: 10px; font-size: 15px; }
.notice.ok { background: var(--ok-tint); color: var(--accent-dark); }
.notice.warn { background: var(--warn-tint); color: var(--warn); }
.savebar { position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--line); margin: 0 -16px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.list-item input { min-height: 44px; }
.icon-btn { min-width: 44px; min-height: 44px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; font: inherit; cursor: pointer; }
/* an approximate render of the e-paper page: proportions and words, not the exact pixels */
.panel { aspect-ratio: 1872 / 1404; background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; font-family: 'IBM Plex Sans', sans-serif; color: #000; container-type: inline-size; }
.panel .bar { background: #000; color: #fff; padding: 2.6cqw 3.2cqw; font-weight: 700; font-size: 2.3cqw; display: flex; justify-content: space-between; }
.panel .body { padding: 3cqw 3.2cqw; display: flex; flex-direction: column; gap: 1.6cqw; flex-grow: 1; }
.panel .h { font-weight: 700; font-size: 6.2cqw; line-height: 1.05; }
.panel .t { font-size: 1.7cqw; font-weight: 600; }
.panel .s { font-size: 1.3cqw; }
.panel .box { border: 0.35cqw solid #000; border-radius: 1.4cqw; padding: 1.6cqw; display: flex; flex-direction: column; gap: 0.8cqw; }
.panel .boxes { display: flex; gap: 2cqw; }
.panel .boxes .box { flex: 1; }
.panel .foot { margin-top: auto; font-size: 0.9cqw; color: #333; display: flex; justify-content: space-between; }
.panel .qr { width: 9cqw; height: 9cqw; background: repeating-linear-gradient(90deg, #000 0 10%, #fff 10% 20%), #fff; background-blend-mode: difference; border: 0.3cqw solid #000; }
.sr-only { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* displays listed inside a home */
.displays { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.display-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 10px 0; border-top: 1px solid var(--line, #dedbd4); }
.display-row:first-child { border-top: 0; }

/* the hidden attribute must win over the display set by .card, .field and the like */
[hidden] { display: none !important; }

/* home page: one card per home, a tile per display */
.summary { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: -8px 0 0; color: var(--muted); font-size: 15px; }
.status { font-size: 13px; font-weight: 600; }
.status.ok { color: var(--accent-dark); }
.status.warn { color: var(--warn); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.card.home { gap: 18px; padding: 24px; }
.home-head { align-items: flex-start; }
.home-head h2 { font-size: 22px; }
.home-head h2 a { color: inherit; text-decoration: none; }
.home-head h2 a:hover { text-decoration: underline; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 24px; margin: 0; padding: 14px 16px; background: var(--ground); border-radius: 10px; }
.facts div { min-width: 0; }
.facts .wide { grid-column: 1 / -1; }
.facts dt { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-size: 15px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; color: inherit; text-decoration: none; background: var(--card); min-width: 0; }
.tile:hover, .tile:focus-visible { border-color: var(--ink); }
.tile .panel .h { font-size: 11cqw; overflow-wrap: anywhere; }
.tile .panel .bar { font-size: 5cqw; padding: 4cqw 5cqw; }
.tile .panel .body { padding: 5cqw; justify-content: center; }
.tile-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile-text strong { font-size: 16px; overflow-wrap: anywhere; }
.meter-row { display: flex; align-items: center; gap: 8px; }
.meter { flex: 0 0 64px; height: 8px; border-radius: 4px; background: #e9e7e2; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); }
.meter.low span { background: var(--warn); }
.tile.add { align-items: center; justify-content: center; gap: 6px; min-height: 120px; border-style: dashed; border-color: var(--line-strong); color: var(--muted); font-weight: 600; font-size: 15px; }
.tile.add span { font-size: 28px; line-height: 1; font-weight: 400; }
.tile.add:hover, .tile.add:focus-visible { color: var(--ink); }

