/* Hermes mobile — iPhone-first dark theme inspired by reference.jpg */
:root {
  --bg: #071514; --bg2: #0b1d1c; --card: #0e2322; --card2: #112a29; --line: #1f3d3a; --line2: #2a4f4b;
  --text: #e8f1ee; --muted: #8aa5a0; --dim: #5f7c77;
  --green: #3ddc84; --amber: #f2b33d; --red: #ff5f56; --blue: #4cb3ff; --violet: #b18cff; --teal: #3fd0c9; --slate: #7f9692;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --footer-h: 190px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 15px/1.38 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .red { color: var(--red); }
[hidden] { display: none !important; }

/* views */
#top, #main, #footer { display: none; }
body[data-view="app"] #top, body[data-view="app"] #main, body[data-view="app"] #footer { display: block; }
.screen { display: none; min-height: 100vh; min-height: 100dvh; padding: calc(var(--safe-t) + 24px) 20px calc(var(--safe-b) + 24px); align-items: center; justify-content: center; }
body[data-view="login"] #login, body[data-view="offline"] #offline { display: flex; }

/* header */
#top { position: sticky; top: 0; z-index: 20; background: linear-gradient(var(--bg) 85%, rgba(7,21,20,.92));
  padding: calc(var(--safe-t) + 10px) calc(var(--safe-r) + 14px) 8px calc(var(--safe-l) + 14px); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; gap: 10px; }
.top-row.second { margin-top: 6px; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.3px; font-weight: 700; }
.orch { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orch .muted { font-size: 11px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--dim); }
.dot.ok { background: var(--green); box-shadow: 0 0 8px rgba(61,220,132,.6); } .dot.warn { background: var(--amber); }
.icon-btn { width: 36px; height: 36px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card); font-size: 20px; line-height: 1; flex: none; }
.status-pill { font-size: 12.5px; padding: 5px 10px; border-radius: 10px; border: 1px solid var(--line2); color: var(--muted); background: var(--bg2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-pill.live { color: var(--text); }
.status-pill.late, .status-pill.offline, .status-pill.producer_stale, .status-pill.none { color: var(--amber); border-color: rgba(242,179,61,.45); }
.tabs { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; padding: 8px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.tab b { color: var(--amber); font-weight: 600; margin-left: 2px; }
.tab.on { background: var(--card2); border-color: var(--line2); color: var(--text); }

/* main: never covered by the fixed footer */
#main { padding: 10px calc(var(--safe-r) + 12px) calc(var(--footer-h) + 18px) calc(var(--safe-l) + 12px); }
.banner { margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: rgba(242,179,61,.12); border: 1px solid rgba(242,179,61,.45); color: #ffd58a; font-size: 13.5px; }
.empty { color: var(--muted); padding: 24px 8px; text-align: center; }
.sect { display: flex; align-items: center; gap: 8px; font-size: 13px; letter-spacing: 1.2px; margin: 4px 2px 10px; color: var(--muted); font-weight: 700; }
.sect b { color: var(--amber); }
.col { border-left: 3px solid var(--slate); border-radius: 16px; background: var(--bg2); padding: 12px 10px 10px; margin-bottom: 14px; }
.col.blue { border-left-color: var(--blue); } .col.blue .sect { color: var(--blue); }
.col.red { border-left-color: var(--red); } .col.red .sect { color: var(--red); }
.col.violet { border-left-color: var(--violet); } .col.violet .sect { color: var(--violet); }
.col.green { border-left-color: var(--green); } .col.green .sect { color: var(--green); }
.col.teal { border-left-color: var(--teal); } .col.teal .sect { color: var(--teal); }
.col.amber { border-left-color: var(--amber); }
.more-note { padding: 4px 4px 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin-bottom: 10px; }
.card-top { display: flex; gap: 10px; align-items: flex-start; }
.card h3 { margin: 0; font-size: 16px; line-height: 1.3; font-weight: 600; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.live { flex: none; font-size: 11.5px; font-weight: 700; letter-spacing: .5px; padding: 4px 8px; border-radius: 10px; white-space: nowrap; }
.live.alive { color: var(--green); background: rgba(61,220,132,.12); border: 1px solid rgba(61,220,132,.35); }
.live.aging, .live.unconfirmed { color: var(--amber); background: rgba(242,179,61,.1); border: 1px solid rgba(242,179,61,.35); }
.live.stale, .live.dead { color: var(--red); background: rgba(255,95,86,.1); border: 1px solid rgba(255,95,86,.4); }
.live.missing { color: var(--muted); border: 1px solid var(--line2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; padding: 4px 8px; border-radius: 9px; border: 1px solid var(--line2); background: var(--bg2); color: var(--text); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip i { font-style: normal; color: var(--muted); font-size: 11px; }
.chip.id { font-family: var(--mono); font-size: 13px; color: #f4e7b8; border-color: rgba(242,179,61,.35); background: rgba(242,179,61,.07); }
.chip.id .copy { position: relative; width: 11px; height: 11px; margin-left: 3px; border: 1.5px solid var(--muted); border-radius: 2px; display: inline-block; }
.chip.id .copy::after { content: ""; position: absolute; left: -4px; top: 2px; width: 7px; height: 7px; border-left: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); border-radius: 0 0 0 2px; }
.chip.id.copied { border-color: var(--green); } .chip.id.copied .copy { border-color: var(--green); }
.chip.model { border-style: dashed; }
.chip.observed { color: var(--teal); border-color: rgba(63,208,201,.35); }
.chip.ghost { color: var(--muted); }
.chip.warnline { border-color: rgba(242,179,61,.45); }
.chip.amber { color: var(--amber); border-color: rgba(242,179,61,.45); background: rgba(242,179,61,.08); font-weight: 600; }
.wait { margin-top: 8px; font-size: 13.5px; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(76,179,255,.4); background: rgba(76,179,255,.08); overflow-wrap: anywhere; }
.wait span { color: var(--blue); }
.wait.red { border-color: rgba(255,95,86,.45); background: rgba(255,95,86,.08); } .wait.red span { color: var(--red); }
.more { margin-top: 8px; font-size: 13px; color: var(--muted); padding: 6px 2px; min-height: 32px; }
.details { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; }
.kv { display: grid; grid-template-columns: minmax(96px, 38%) 1fr; gap: 8px; font-size: 13px; padding: 4px 0; border-bottom: 1px dashed rgba(31,61,58,.6); }
.kv span:first-child { color: var(--muted); } .kv span:last-child { overflow-wrap: anywhere; }
.txt { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); font-size: 13px; }
.txt b { font-size: 12px; color: var(--muted); letter-spacing: .4px; } .txt p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.txt.red { border-color: rgba(255,95,86,.45); } .txt.red b { color: var(--red); }
.txt.violet b { color: var(--violet); }

.cascade { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; }
.cascade-top { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; }
.cascade-name { margin: 6px 0; font-weight: 600; overflow-wrap: anywhere; }
.stages { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.stage { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 8px; border: 1px solid var(--line2); color: var(--muted); }
.stage.green { color: var(--green); border-color: rgba(61,220,132,.4); } .stage.blue { color: var(--blue); border-color: rgba(76,179,255,.45); }
.stage.red { color: var(--red); border-color: rgba(255,95,86,.45); } .stage.violet { color: var(--violet); border-color: rgba(177,140,255,.45); }
.arrow { color: var(--dim); font-size: 12px; }
h2.sect.amber { color: var(--amber); }

/* fixed bottom monitor: content stays above the home indicator */
#footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(7,21,20,.97);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--line2);
  padding: 8px calc(var(--safe-r) + 10px) calc(max(var(--safe-b), 8px)) calc(var(--safe-l) + 10px); }
.m-top { display: flex; gap: 6px; justify-content: center; margin-bottom: 6px; flex-wrap: nowrap; overflow: hidden; }
.ichip { font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); padding: 3px 8px; border-radius: 9px; border: 1px solid var(--line); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; flex: none; }
.ichip i { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); display: inline-block; }
.ichip.ok i { background: var(--green); } .ichip.warn i { background: var(--amber); } .ichip.bad i { background: var(--red); }
.m-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line2); border-radius: 14px; overflow: hidden; background: var(--bg2); }
.q { text-align: center; padding: 8px 6px 7px; border-right: 1px solid var(--line2); min-width: 0; }
.q:last-child { border-right: 0; }
.q.dim .q-big { opacity: .55; }
.q-title { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-title i { font-style: normal; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--dim); }
.q-row { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 1px 0; }
.q-big { font-size: 27px; font-weight: 800; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.q-meta { font-size: 10.5px; line-height: 1.2; color: var(--muted); text-align: left; }
.low { color: var(--green); } .mid { color: var(--amber); } .high { color: var(--red); } .unknown { color: var(--muted); }
.q-reset { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.q-week { font-size: 12px; margin-top: 4px; padding-top: 4px; border-top: 1px dashed var(--line); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-fresh { font-size: 10.5px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.q-fresh.fresh { color: var(--green); } .q-fresh.stale, .q-fresh.unconfirmed, .q-fresh.unknown { color: var(--amber); }
.q-fresh.error, .q-fresh.unavailable { color: var(--red); }

/* sheet */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; }
.sheet-panel { position: relative; width: 100%; max-height: 88vh; max-height: 88dvh; overflow-y: auto; background: var(--bg2); border-top: 1px solid var(--line2); border-radius: 20px 20px 0 0;
  padding: 18px calc(var(--safe-r) + 16px) calc(var(--safe-b) + 20px) calc(var(--safe-l) + 16px); -webkit-overflow-scrolling: touch; }
.sheet-panel h2 { margin: 0 40px 8px 0; font-size: 19px; } .sheet-panel h3 { font-size: 14px; color: var(--muted); margin: 16px 0 6px; }
.close { position: absolute; right: 14px; top: 14px; font-size: 15px; }
body.sheet-open { overflow: hidden; }
.wrow { padding: 10px 0; border-bottom: 1px solid var(--line); }
.wl { font-weight: 600; } .wl i { font-style: normal; color: var(--amber); font-size: 12px; }
.wv { margin-top: 2px; } .wv b { font-size: 18px; } .wr { font-size: 13px; color: var(--muted); }
.gaps, .steps { margin: 6px 0; padding-left: 20px; color: var(--muted); font-size: 13px; } .gaps li, .steps li { margin: 4px 0; }

/* login */
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line2); border-radius: 22px; padding: 24px 20px; text-align: center; }
.login-card img { border-radius: 16px; }
.login-card h1 { margin: 10px 0 4px; font-size: 21px; }
form { display: grid; gap: 12px; margin-top: 18px; text-align: left; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input { font: inherit; font-size: 17px; color: var(--text); background: var(--bg2); border: 1px solid var(--line2); border-radius: 12px; padding: 12px; width: 100%; }
input:focus { outline: 2px solid rgba(61,220,132,.5); border-color: transparent; }
.btn { background: linear-gradient(180deg, #2fc172, #22a35e); color: #04120b; font-weight: 700; border-radius: 12px; padding: 13px; font-size: 16px; width: 100%; }
.btn:disabled { opacity: .5; }
.btn.danger { background: rgba(255,95,86,.14); color: var(--red); border: 1px solid rgba(255,95,86,.45); margin-top: 18px; }
.err { min-height: 18px; color: var(--red); font-size: 13.5px; }
.link { margin-top: 14px; color: var(--teal); font-size: 14px; text-decoration: underline; }
.steps { text-align: left; }

@media (min-width: 760px) {
  #top, #main { max-width: 880px; margin: 0 auto; }
  #board { display: block; }
  #footer > #monitor { max-width: 880px; margin: 0 auto; }
}
