:root { --bg: #14161a; --panel: #1c1f24; --card: #23272e; --line: #333a44; --fg: #e4e6ea; --mute: #9aa3ae;
  --accent: #e8a33d; --pass: #4caf7a; --warn: #e8a33d; --fail: #e0584f; --info: #6aa0d8; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 14px/1.4 system-ui, -apple-system, sans-serif; }
header { display: flex; align-items: center; gap: 1rem; padding: .5rem .75rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.title { font-weight: 650; font-size: 16px; } .sub { color: var(--mute); font-weight: 400; font-size: 13px; margin-left: .4rem; }
nav { display: flex; gap: .25rem; flex-wrap: wrap; }
nav button { background: none; border: 1px solid transparent; color: var(--mute); padding: .35rem .6rem; border-radius: 6px; cursor: pointer; font: inherit; }
nav button.on { color: var(--fg); border-color: var(--line); background: var(--card); }
.badge { display: inline-block; min-width: 1.2em; padding: 0 .35em; border-radius: 1em; font-size: 11px; background: var(--line); color: var(--fg); }
.badge:empty { display: none; }
.badge.fail { background: var(--fail); } .badge.warn { background: var(--warn); color: #111; }
main { display: flex; height: calc(100% - 49px); }
#view { position: relative; flex: 1; min-width: 0; }
#c { width: 100%; height: 100%; display: block; touch-action: none; }
#hud { position: absolute; left: .6rem; top: .5rem; font-size: 12px; color: var(--mute); pointer-events: none; text-shadow: 0 1px 2px #000; }
#hud b { color: var(--fg); font-weight: 600; }
#viewBtns { position: absolute; right: .6rem; top: .5rem; display: flex; gap: .25rem; }
#viewBtns button, #openBar button { background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: .3rem .55rem; font: inherit; cursor: pointer; }
#openBar { position: absolute; left: 50%; bottom: .8rem; transform: translateX(-50%); display: flex; align-items: center; gap: .6rem;
  background: #1c1f24dd; border: 1px solid var(--line); border-radius: 10px; padding: .4rem .7rem; width: min(520px, 92%); }
#openBar input { flex: 1; accent-color: var(--accent); } #openLbl { color: var(--mute); font-size: 12px; min-width: 7.5em; text-align: right; }
aside { width: 380px; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: .6rem; }
.hidden { display: none !important; }
/* Signed-out visitors: everything visible, nothing writable. */
.viewonly { display: none; vertical-align: middle; font-weight: 500; }
body.readonly .viewonly { display: inline-block; }
body.readonly .edit-only { display: none !important; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; margin-bottom: .6rem; }
.card h3 { margin: 0 0 .4rem; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--mute); cursor: pointer; }
details.card > summary { list-style: none; cursor: pointer; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--mute); font-weight: 650; }
details.card > summary::after { content: ' ▸'; } details.card[open] > summary::after { content: ' ▾'; }
details.card[open] > summary { margin-bottom: .4rem; }
.slider { display: grid; grid-template-columns: 1fr 64px; gap: .1rem .5rem; align-items: center; margin: .35rem 0; }
.slider .lbl { font-size: 12.5px; } .slider .lbl.changed { color: var(--accent); }
.slider input[type=range] { grid-column: 1 / 3; accent-color: var(--accent); width: 100%; }
.slider input[type=number] { width: 64px; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 5px; padding: .15rem .3rem; font: inherit; font-size: 12.5px; text-align: right; }
.row { display: flex; align-items: center; gap: .4rem; margin: .2rem 0; } .row.gap { gap: .6rem; flex-wrap: wrap; margin-top: .4rem; }
button { font: inherit; } .actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions button, .card button, dialog button { background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: .35rem .7rem; cursor: pointer; }
button.primary { background: var(--accent) !important; color: #111 !important; border-color: var(--accent) !important; font-weight: 600; }
a { color: var(--info); }
.fine { color: var(--mute); font-size: 12px; }
.check { border-left: 4px solid var(--line); } .check.pass { border-left-color: var(--pass); } .check.warn { border-left-color: var(--warn); }
.check.fail { border-left-color: var(--fail); } .check.info { border-left-color: var(--info); }
.check .st { font-size: 11px; font-weight: 700; text-transform: uppercase; margin-right: .4rem; }
.check.pass .st { color: var(--pass); } .check.warn .st { color: var(--warn); } .check.fail .st { color: var(--fail); } .check.info .st { color: var(--info); }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; } th, td { text-align: left; padding: .3rem .25rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--mute); font-weight: 600; } td.num { text-align: right; white-space: nowrap; }
.q .topic { font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.q .text { font-weight: 600; margin: .15rem 0; } .q .why { color: var(--mute); font-size: 12.5px; margin-bottom: .4rem; }
.q.resolved { opacity: .6; }
textarea, input[type=text], dialog input { width: 100%; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: .4rem; font: inherit; }
.note img { max-width: 100%; border-radius: 6px; margin-top: .4rem; cursor: zoom-in; }
.meta { font-size: 11.5px; color: var(--mute); margin-bottom: .2rem; display: flex; justify-content: space-between; gap: .5rem; }
.filebtn { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: .35rem .6rem; cursor: pointer; }
dialog { background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 12px; width: min(420px, 92vw); }
dialog::backdrop { background: #000a; } dialog h3 { margin-top: 0; } dialog textarea { margin-top: .5rem; }
.linkbtn { background: none !important; border: none !important; color: var(--info) !important; padding: 0 !important; cursor: pointer; font-size: 12px; }
h4 { color: var(--mute); margin: 1rem 0 .3rem; font-size: 12px; text-transform: uppercase; }
@media (max-width: 820px) {
  main { flex-direction: column; height: auto; }
  #view { height: 58vh; flex: none; position: sticky; top: 0; z-index: 2; background: var(--bg); }
  aside { width: 100%; border-left: none; border-top: 1px solid var(--line); }
  .sub { display: none; }
  #viewBtns { top: auto; bottom: 4.4rem; right: 50%; transform: translateX(50%); }
  #hud { font-size: 11px; right: .6rem; }
}
