/* app.loscera.com — dark, quiet, data first. Palette from loscera.com. */
:root {
  --bg: #0a0a0a; --side: #0e0e0e; --panel: #111; --card: #161616; --card2: #1b1b1b; --bdr: #262626; --bdr2: #333;
  --text: #e4e4e4; --dim: #a8a8a8; --muted: #6e6e6e;
  --blue: #57ACDC; --teal: #60C6B9; --magenta: #E91E63; --purple: #9C27B0; --gold: #E8961E; --yellow: #E8C21E; --acc: #276BB0;
  --r: 10px; --gap: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
/* Inter (SIL Open Font License, vendor/inter/LICENSE.txt): a variable font with an optical-size axis, so the
   big numbers get its tighter Display cut automatically. Self-hosted: the page loads nothing from other sites. */
@font-face { font-family: 'Inter Var'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/vendor/inter/inter-latin-opsz-normal.woff2) format('woff2'); }
body { background: var(--bg); color: var(--text); font: 14px/1.45 'Inter Var', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-optical-sizing: auto; font-feature-settings: 'cv10'; -webkit-font-smoothing: antialiased; }
.tile .val, .tile .mm, td, .ctl-pill, .qi .t2, .valve .sub { font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }

/* icons: masks over currentColor (inline SVG data) */
.ic { display: inline-block; width: 16px; height: 16px; flex-shrink: 0; background: currentColor; -webkit-mask: var(--m) center/contain no-repeat; mask: var(--m) center/contain no-repeat; }

/* brand */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; letter-spacing: .01em; }
.brand span:last-child { background: linear-gradient(90deg, var(--blue), var(--teal)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.leaf { flex-shrink: 0; display: block; }
.brand.big { font-size: 22px; }

/* login */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--bdr); border-radius: 14px; padding: 32px; display: flex; flex-direction: column; gap: 12px; }
.login-card p { margin: -6px 0 8px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--dim); }
input, select { background: var(--panel); border: 1px solid var(--bdr); border-radius: 7px; padding: 9px 11px; font-size: 14px; outline: none; }
input:focus, select:focus { border-color: var(--acc); }
.err { color: var(--magenta); font-size: 12px; min-height: 16px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 13px; border-radius: 7px; border: 1px solid var(--bdr2); background: var(--panel); font-size: 13px; font-weight: 550; cursor: pointer; white-space: nowrap; transition: border-color .15s, background .15s; }
.btn:hover { border-color: #4a4a4a; }
.btn.pri { background: var(--acc); border-color: var(--acc); color: #fff; }
.btn.go { background: rgba(96,198,185,.12); border-color: rgba(96,198,185,.35); color: var(--teal); }
.btn.stop { background: rgba(233,30,99,.1); border-color: rgba(233,30,99,.35); color: var(--magenta); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.wide { width: 100%; padding: 10px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--bdr); background: var(--panel); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }

/* shell */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100%; background: linear-gradient(90deg, var(--side) 236px, var(--bg) 236px); }
.side { background: var(--side); border-right: 1px solid var(--bdr); display: flex; flex-direction: column; padding: 18px 12px; gap: 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 30; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.acct { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { font-size: 11px; color: var(--muted); padding: 12px 8px 4px; display: flex; align-items: center; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--dim); text-decoration: none; font-size: 13.5px; border: 0; background: none; cursor: pointer; width: 100%; text-align: left; }
.nav-item:hover { background: #161616; color: var(--text); }
.nav-item.on { background: #1a1f26; color: var(--text); box-shadow: inset 2px 0 0 var(--blue); }
.nav-item .dot { margin-left: auto; }
.side-bottom { border-top: 1px solid var(--bdr); padding-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.me { font-size: 12px; color: var(--muted); padding: 0 10px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #444; flex-shrink: 0; }
.dot.on { background: var(--teal); box-shadow: 0 0 6px rgba(96,198,185,.7); }
.dot.bad { background: var(--magenta); }

.main { min-width: 0; padding: 18px 22px 40px; }
.room-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.room-title { min-width: 0; }
.crumb { font-size: 12px; color: var(--muted); }
.room-title h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctl-status { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.ctl-pill { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--bdr); border-radius: 999px; padding: 6px 12px; font-size: 12px; color: var(--dim); white-space: nowrap; }
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.bars i { width: 3px; background: #3a3a3a; border-radius: 1px; }
.bars i.on { background: var(--teal); }
.bars.fair i.on { background: var(--yellow); }
.bars.weak i.on { background: var(--magenta); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--bdr); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
a { color: inherit; text-decoration: none; }
.tab { padding: 10px 14px; font-size: 13.5px; color: var(--muted); border: 0; background: none; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--blue); }

.banner { display: flex; align-items: center; gap: 10px; background: linear-gradient(90deg, rgba(233,30,99,.16), rgba(233,30,99,.05)); border: 1px solid rgba(233,30,99,.35); border-radius: 9px; padding: 9px 14px; margin-bottom: 14px; font-size: 13px; }
.banner b { color: #ff6b9a; font-weight: 600; }

/* dashboard grid: main column + queue column on wide screens */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-areas: "tiles q" "main q"; gap: var(--gap); align-items: start; }
.dash > .tiles { grid-area: tiles; }
.dash > .queues { grid-area: q; }
.dash > .main-col { grid-area: main; }
.dash > .col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
@media (max-width: 1280px) {
  .dash { grid-template-columns: 1fr; grid-template-areas: "tiles" "q" "main"; }
  .dash > .queues { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) { .dash > .queues { grid-template-columns: 1fr; } .queue-empty { padding: 2px 4px; } .queues .card-h { margin-bottom: 6px; } }

.card { background: var(--card); border: 1px solid var(--bdr); border-radius: var(--r); padding: 16px; min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-height: 26px; }
.card-h h2 { font-size: 13px; font-weight: 600; letter-spacing: .01em; display: flex; align-items: center; gap: 8px; }
.card-h .right { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.count { font-size: 11px; font-weight: 600; color: var(--muted); background: #222; border-radius: 9px; padding: 1px 7px; }
.count.hot { background: rgba(233,30,99,.18); color: #ff6b9a; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--bdr); border-radius: var(--r); padding: 13px 14px 12px; min-width: 0; position: relative; overflow: hidden; }
.tile::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); opacity: .85; }
.tile .lbl { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.tile .lbl span:last-child { text-transform: none; letter-spacing: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .val { font-size: 27px; font-weight: 680; letter-spacing: -.02em; margin-top: 4px; color: var(--c); line-height: 1.15; }
.tile .val small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.tile .mm { white-space: nowrap; display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 8px; gap: 4px; }
.tile .mm b { color: var(--dim); font-weight: 600; }
.tile.stale .val { color: var(--muted); }

/* chart */
.ctrl-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; margin-bottom: 10px; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--bdr); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: none; padding: 5px 10px; font-size: 12px; color: var(--muted); border-radius: 6px; cursor: pointer; }
.seg button.on { background: #262b33; color: var(--text); }
.seg .live { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #555; margin-right: 6px; vertical-align: 1px; }
.seg button.on .live { background: var(--teal); box-shadow: 0 0 6px var(--teal); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.groups { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 8px; }
.grp { display: flex; flex-direction: column; gap: 5px; }
.grp-h { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.grp-b { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--bdr); background: var(--panel); border-radius: 999px; padding: 4px 10px; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); opacity: .3; }
.chip.on { color: var(--text); border-color: #3a3a3a; }
.chip.on i { opacity: 1; box-shadow: 0 0 6px var(--c); }
.chip.na { opacity: .35; cursor: default; }
.chart-wrap { position: relative; }
.chart-tip { position: absolute; pointer-events: none; z-index: 5; display: grid; grid-template-columns: auto auto; column-gap: 20px; row-gap: 3px;
  width: max-content; min-width: 200px; max-width: none; white-space: nowrap; background: rgba(17,17,17,.96); border: 1px solid var(--bdr2);
  border-radius: 8px; padding: 9px 12px; font-size: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.chart-tip .t { grid-column: 1 / -1; color: var(--muted); font-size: 11px; margin-bottom: 3px; }
.chart-tip .sp { grid-column: 1 / -1; height: 4px; }
.chart-tip .k { display: flex; align-items: center; gap: 7px; color: var(--dim); }
.chart-tip .k i { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.chart-tip b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.chart-tip b small { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.uplot, .u-wrap { font-family: inherit; }
.u-axis { color: var(--muted); }
.empty { color: var(--muted); font-size: 13px; padding: 26px 8px; text-align: center; }

/* queues */
.queue { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; padding-right: 2px; }
.qi { background: var(--card2); border: 1px solid var(--bdr); border-left: 3px solid var(--c, var(--blue)); border-radius: 8px; padding: 9px 11px; font-size: 12.5px; animation: slide .25s ease; }
@keyframes slide { from { opacity: 0; transform: translateY(-4px); } }
.qi .t1 { font-weight: 600; font-size: 13px; display: flex; gap: 8px; justify-content: space-between; }
.qi .t2 { color: var(--dim); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.qi .t2 span { display: inline-flex; align-items: center; gap: 4px; }
.prog { height: 3px; background: #2a2a2a; border-radius: 2px; margin-top: 7px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--c, var(--teal)); }
.queue-empty { color: var(--muted); font-size: 12.5px; padding: 12px 4px; display: flex; align-items: center; gap: 8px; }
.queue::-webkit-scrollbar, .log-scroll::-webkit-scrollbar { width: 6px; }
.queue::-webkit-scrollbar-thumb, .log-scroll::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 650; white-space: nowrap; }
.p-idle { background: rgba(255,255,255,.06); color: var(--muted); }
.p-on { background: rgba(96,198,185,.14); color: var(--teal); }
.p-man { background: rgba(87,172,220,.14); color: var(--blue); }
.p-rule { background: rgba(232,150,30,.15); color: var(--gold); }
.p-hand { background: rgba(156,39,176,.18); color: #c77dd6; }
.p-bad { background: rgba(233,30,99,.15); color: #ff6b9a; }

/* valves */
.valves { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.valve { background: var(--card2); border: 1px solid var(--bdr); border-radius: 9px; padding: 12px; display: flex; flex-direction: column; gap: 10px; border-top: 2px solid var(--c, var(--blue)); }
.valve .vh { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 600; }
.valve .vr { display: flex; gap: 6px; align-items: center; }
.valve input { width: 56px; padding: 6px 8px; font-size: 13px; }
.valve .unit { font-size: 12px; color: var(--muted); margin-right: 4px; }
.valve .sub { font-size: 12px; color: var(--dim); min-height: 17px; }

/* event log */
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters select { padding: 5px 8px; font-size: 12px; }
.log-scroll { max-height: 440px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 7px 10px; border-bottom: 1px solid var(--bdr); position: sticky; top: 0; background: var(--card); }
td { padding: 8px 10px; border-bottom: 1px solid #1e1e1e; vertical-align: top; }
td.nw { white-space: nowrap; color: var(--dim); }
tr:hover td { background: #191919; }
.more { margin-top: 10px; text-align: center; }

.placeholder { max-width: 560px; margin: 50px auto; text-align: center; color: var(--muted); }
.placeholder h2 { color: var(--text); font-size: 17px; margin-bottom: 8px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1d1d1d; border: 1px solid var(--bdr2); border-radius: 9px; padding: 10px 16px; font-size: 13px; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.5); }

.only-mobile { display: none; }
.scrim { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 20; }
  .only-mobile { display: inline-flex; }
  .main { padding: 14px 14px 40px; }
  .room-head { flex-wrap: wrap; }
  .ctl-status { margin-left: 0; width: 100%; justify-content: flex-start; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile .val { font-size: 23px; }
  .tile .mm { font-size: 10px; }
  .shell { background: var(--bg); }
  .hide-sm { display: none; }
  td, th { padding: 7px 5px; }
  table { font-size: 12px; }
  td.nw { white-space: normal; min-width: 64px; }
  .queues .card { padding: 12px 14px; }
}
