/* Elephant — phone first: staff walk around a lodge with a phone. One DOM for every width; cards everywhere. */
:root {
  --slate: #1f2a2e; --slate-2: #2c3a40; --gold: #d4a72c; --gold-soft: #fbf3dc; --green: #2d6a4f;
  --bg: #f4f5f2; --card: #ffffff; --ink: #1d2420; --muted: #5f6b64; --line: #dde2dd; --line-strong: #c4ccc6;
  --ok: #1f7a46; --ok-bg: #e5f4ea; --bad: #b3261e; --bad-bg: #fdecea; --warn: #8a5a00; --warn-bg: #fff3d6;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121614; --card: #1b201d; --ink: #e6ebe7; --muted: #9aa69f; --line: #2c342f; --line-strong: #3d4842;
    --ok-bg: #173323; --bad-bg: #3a1b18; --warn-bg: #3a2e12; --gold-soft: #2e2810;
  }
}
* { box-sizing: border-box; }
/* `hidden` must win over any display rule below (the setup editor showed when it should not). */
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: 96px; overflow-x: hidden; }
a { color: var(--green); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) a { color: #7cc4a0; } }
h1, h2, h3 { line-height: 1.25; }
button, input, select, textarea { font: inherit; font-size: 16px; color: inherit; }
input, select, textarea {
  min-height: 44px; width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--card);
}
input[type="checkbox"] { width: 24px; height: 24px; min-height: 0; accent-color: var(--green); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
input.invalid { border-color: var(--bad); background: var(--bad-bg); }
button {
  min-height: 44px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--card); cursor: pointer;
}
button.primary { background: var(--green); color: #fff; border-color: var(--green); font-weight: 600; }
button.accent { background: var(--gold); color: #2b2200; border-color: var(--gold); font-weight: 600; }
button.danger { color: var(--bad); border-color: var(--bad); }
button.link { border: 0; background: none; color: var(--green); padding: 8px 4px; text-decoration: underline; min-height: 0; }
button.small { min-height: 36px; padding: 4px 12px; font-size: 15px; }
button:disabled { opacity: .5; cursor: default; }
a.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); text-decoration: none; font-weight: 600; }
a.button.primary { background: var(--green); border-color: var(--green); color: #fff; }
a.button.accent { background: var(--gold); border-color: var(--gold); color: #2b2200; }

header.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; padding: 8px 16px;
  background: var(--slate); color: #fff; border-bottom: 2px solid var(--gold);
}
header.top .brand { font-weight: 700; display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; letter-spacing: .02em; }
header.top .brand .mark { display: block; width: 28px; height: 28px; border-radius: 22%; }
header.top .spacer { flex: 1; }
header.top button { min-height: 36px; padding: 4px 10px; background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
nav.tabs { display: flex; gap: 0; padding: 8px 8px 0; overflow-x: auto; background: var(--slate-2); scrollbar-width: none; }
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs a { padding: 10px 8px; border-radius: 10px 10px 0 0; text-decoration: none; color: #cfd8d3; white-space: nowrap; font-size: 14px; }
@media (min-width: 700px) { nav.tabs { padding: 8px 12px 0; gap: 2px; } nav.tabs a { padding: 10px 14px; font-size: 15px; } }
nav.tabs a.on { background: var(--bg); color: var(--ink); font-weight: 600; }
nav.tabs .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 12px; text-align: center; }

main { padding: 0 16px 16px; max-width: 1100px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card h2 { margin: 0 0 12px; font-size: 18px; }
.page-head { margin: 16px 0 4px; }
.page-head h1 { font-size: 22px; margin: 0; overflow-wrap: anywhere; }
.page-head .sub { color: var(--muted); font-size: 15px; margin-top: 2px; }
.crumb { display: inline-block; margin-top: 12px; font-size: 15px; }
.muted { color: var(--muted); }
.small-text { font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack > * + * { margin-top: 8px; }
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
label.field { display: block; min-width: 0; }
label.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
label.tick { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.plain { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.num { font-variant-numeric: tabular-nums; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.toast { position: fixed; left: 16px; right: 16px; bottom: 88px; z-index: 30; padding: 12px 16px; border-radius: 10px; background: var(--ink); color: var(--bg); text-align: center; max-width: 560px; margin: 0 auto; }
.banner { padding: 12px 16px; border-radius: 10px; margin: 12px 0; }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.ok { background: var(--ok-bg); color: var(--ok); }
.empty { padding: 20px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); margin: 12px 0; }

/* Search */
.search { position: relative; margin: 16px 0 4px; }
.search input { padding-left: 40px; min-height: 48px; border-radius: 12px; }
.search::before { content: "⌕"; position: absolute; left: 14px; top: 10px; font-size: 22px; color: var(--muted); pointer-events: none; }
.results a { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.results a:last-child { border-bottom: 0; }
.results .k { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 10px 0 2px; }

/* Lists of tappable rows */
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 8px 0 16px; }
.list > a, .list > div.item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); min-height: 56px; }
.list > :last-child { border-bottom: 0; }
.list .main { flex: 1; min-width: 0; }
.list .title { font-weight: 600; overflow-wrap: anywhere; }
.list .meta { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.list .side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.list .chev { color: var(--muted); font-size: 20px; }
.prop-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 20px 0 0; }
.prop-head h2 { font-size: 18px; margin: 0; }
.kind { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* Area: setup vs what is there */
.lines { display: grid; gap: 8px; }
.ln { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--card); }
.ln.short { border-left: 4px solid var(--bad); }
.ln.over { border-left: 4px solid var(--warn); }
.ln .name { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ln .name span:first-child { overflow-wrap: anywhere; }
.ln .figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 6px; }
.ln .figs div { font-size: 13px; color: var(--muted); }
.ln .figs b { display: block; font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; }
.ln .figs .bad b { color: var(--bad); } .ln .figs .warn b { color: var(--warn); } .ln .figs .ok b { color: var(--ok); }
.ln .setup-input { margin-top: 8px; display: grid; grid-template-columns: auto 96px; gap: 8px; align-items: center; justify-content: end; }

.actions-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 12px 0; }
.actions-row a.button, .actions-row button { padding: 8px 6px; font-size: 15px; line-height: 1.2; text-align: center; }
.actions-row a.button, .actions-row button { width: 100%; }

/* Count cards (walk-through, audit) */
.cnt { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--card); }
.cnt + .cnt { margin-top: 10px; }
.cnt.done { border-color: var(--ok); }
.cnt.missing { border-color: var(--bad); background: var(--bad-bg); }
.cnt .head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.cnt .head .t { font-weight: 600; overflow-wrap: anywhere; }
.cnt .boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.cnt .boxes input { font-size: 20px; text-align: center; min-height: 52px; font-variant-numeric: tabular-nums; }
.cnt .verdict { font-size: 14px; margin-top: 6px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.seg button { width: 100%; }
.seg button.on-found { background: var(--ok); color: #fff; border-color: var(--ok); font-weight: 600; }
.seg button.on-missing { background: var(--bad); color: #fff; border-color: var(--bad); font-weight: 600; }
.cond { margin-top: 8px; }

.actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; gap: 8px; padding: 12px 16px; background: var(--card); border-top: 1px solid var(--line); }
.actions .state { flex: 1; align-self: center; font-size: 14px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.actions button { flex-shrink: 0; }

/* Problems */
.pb { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--card); margin: 10px 0; }
.pb.pair { border-color: var(--gold); background: var(--gold-soft); }
.pb .what { font-weight: 600; overflow-wrap: anywhere; }
.pb .where { font-size: 15px; margin-top: 4px; overflow-wrap: anywhere; }
.pb .who { font-size: 14px; color: var(--muted); margin-top: 4px; }
.pb .btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pb .btns button { flex: 1 1 130px; }
.k-missing { color: var(--bad); font-weight: 700; } .k-extra { color: var(--warn); font-weight: 700; } .k-broken { color: var(--bad); font-weight: 700; }
.area-head { font-weight: 600; margin: 16px 0 4px; font-size: 15px; }

/* Totals */
.tot summary { list-style: none; cursor: pointer; display: flex; gap: 10px; align-items: center; padding: 12px 14px; min-height: 56px; }
.tot summary::-webkit-details-marker { display: none; }
.tot { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin: 8px 0; }
.tot .big { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tot .body { padding: 0 14px 12px; }
.tot table { width: 100%; border-collapse: collapse; font-size: 15px; }
.tot td, .tot th { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.tot td:first-child, .tot th:first-child { text-align: left; overflow-wrap: anywhere; }
.tot th { font-size: 13px; color: var(--muted); font-weight: 500; }
.tot tr.prop td { font-weight: 700; background: var(--bg); }

/* Asset */
.tag { font: 700 26px/1.1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .04em; }
.photo { width: 100%; max-width: 320px; border-radius: 12px; border: 1px solid var(--line); display: block; }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); flex-shrink: 0; }
.hist { list-style: none; padding: 0; margin: 0; }
.hist li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.hist li:last-child { border-bottom: 0; }

dialog { width: min(560px, calc(100vw - 32px)); max-height: 85vh; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); padding: 16px; }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h2 { margin: 0 0 12px; font-size: 18px; }

.settings-list .item.retired { opacity: .6; }

@media (min-width: 700px) {
  .grid2 { grid-template-columns: 1fr 1fr; }
  .lines { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1024px) {
  .lines { grid-template-columns: 1fr 1fr 1fr; }
  .cnt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .cnt-grid .cnt + .cnt { margin-top: 0; }
}
.list > button.li { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  background: none; text-align: left; color: var(--ink); min-height: 56px; }
.list > button.li:last-child { border-bottom: 0; }
.list > button.li:hover, .list > a:hover { background: var(--bg); }
