/* OccupyOS - charcoal console. Colour is reserved for meaning:
   red/amber/green for state, the cool-warm scale for temperature only. */
:root {
  --bg: #1b1b1c; --panel: #232324; --panel2: #2a2a2b; --raise: #313133; --line: #353537; --line2: #424245;
  --text: #f4f4f4; --muted: #9b9b9e; --faint: #6c6c70;
  --red: #ef5b52; --amber: #e8a23b; --green: #5cc584; --blue: #69a7ee;
  --red-bg: rgba(239,91,82,.12); --amber-bg: rgba(232,162,59,.12); --green-bg: rgba(92,197,132,.12); --blue-bg: rgba(105,167,238,.12);
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --sans: 'Jost', 'Futura', 'Century Gothic', system-ui, sans-serif;
  --r: 10px; --side: 232px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-weight: 300; letter-spacing: .16em; text-transform: uppercase; margin: 0; }
h1 { font-size: 24px; } h2 { font-size: 13px; color: var(--muted); font-weight: 400; } h3 { font-size: 12px; color: var(--muted); font-weight: 400; }
.mono, code { font-family: var(--mono); font-size: .88em; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.small { font-size: 13px; } .tiny { font-size: 11.5px; }
.num { font-variant-numeric: tabular-nums; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: #161617; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; gap: 6px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; letter-spacing: .32em; font-weight: 300; font-size: 15px; padding: 4px 8px 18px; }
.brand img { width: 26px; } .brand b { font-weight: 500; }
.navsec { font-size: 10.5px; letter-spacing: .2em; color: var(--faint); padding: 14px 10px 6px; text-transform: uppercase; }
.side nav a { display: flex; align-items: center; gap: 11px; text-decoration: none; padding: 8px 10px; border-radius: 7px; color: var(--muted); font-size: 14.5px; letter-spacing: .03em; position: relative; }
.side nav a:hover { color: var(--text); background: var(--panel); }
.side nav a.on { color: var(--text); background: var(--panel2); }
.side nav a.on::before { content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--text); }
.side nav a .badge { margin-left: auto; }
.side .bldg a .code { font-family: var(--mono); font-size: 11px; color: var(--faint); width: 26px; }
.side .foot { margin-top: auto; border-top: 1px solid var(--line); padding: 12px 8px 0; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--raise); display: grid; place-items: center; font-size: 12px; color: var(--text); }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.live.on i { background: var(--green); box-shadow: 0 0 0 0 rgba(92,197,132,.6); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(92,197,132,.5); } 70% { box-shadow: 0 0 0 7px rgba(92,197,132,0); } 100% { box-shadow: 0 0 0 0 rgba(92,197,132,0); } }
.mtop { display: none; }
main { padding: 26px 32px 60px; max-width: 1480px; width: 100%; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.pagehead .sub { color: var(--muted); font-size: 14px; margin-top: 6px; letter-spacing: .02em; }
.crumb { font-size: 12px; color: var(--muted); text-decoration: none; letter-spacing: .08em; display: inline-flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.crumb:hover { color: var(--text); }

/* ---------- surfaces ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.panel > h3:first-child, .panel .ph { margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack { display: grid; gap: 16px; }
.cols { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

/* KPI strip */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 10px; position: relative; overflow: hidden; }
.kpi .lbl { font-size: 11px; letter-spacing: .16em; color: var(--muted); text-transform: uppercase; display: flex; align-items: center; gap: 7px; }
.kpi .lbl svg.i { width: 15px; height: 15px; }
.kpi .val { font-size: 30px; font-weight: 300; margin-top: 4px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi .val small { font-size: 14px; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.kpi .note { font-size: 12px; color: var(--muted); min-height: 16px; }
.kpi svg.spark { display: block; width: 100%; height: 34px; margin-top: 6px; }
.kpi.alert { border-color: rgba(239,91,82,.5); background: linear-gradient(180deg, var(--red-bg), var(--panel) 70%); }
.kpi.alert .val { color: var(--red); }

/* building cards */
a.bcard { text-decoration: none; display: flex; flex-direction: column; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; transition: border-color .15s, transform .15s; }
a.bcard:hover { border-color: var(--line2); transform: translateY(-1px); }
.bcard .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.bcard .nm { font-size: 18px; letter-spacing: .14em; text-transform: uppercase; font-weight: 300; }
.bcard .addr { font-size: 13px; color: var(--muted); margin-top: 2px; }
.bcard .metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bcard .m b { display: block; font-weight: 300; font-size: 22px; font-variant-numeric: tabular-nums; }
.bcard .m b small { font-size: 12px; color: var(--muted); }
.bcard .m span { font-size: 10.5px; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
.bcard .trend { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bcard .trend > div { background: var(--panel2); border-radius: 8px; padding: 8px 10px 4px; }
.bcard .trend .tl { font-size: 10.5px; letter-spacing: .14em; color: var(--faint); text-transform: uppercase; }
.bcard .trend svg { width: 100%; height: 36px; display: block; }
.bcard .floors { display: flex; gap: 3px; height: 8px; }
.bcard .floors i { flex: 1; border-radius: 2px; }

/* status pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 20px; font-size: 12px; background: var(--raise); color: var(--muted); letter-spacing: .03em; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.plain::before { display: none; }
.pill.ok, .pill.sent { background: var(--green-bg); color: var(--green); }
.pill.warning, .pill.held, .pill.starting { background: var(--amber-bg); color: var(--amber); }
.pill.critical, .pill.failed, .pill.error { background: var(--red-bg); color: var(--red); }
.pill.notice { background: var(--blue-bg); color: var(--blue); }
.pill.info, .pill.stopped { background: var(--raise); color: var(--muted); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11.5px; display: inline-grid; place-items: center; font-weight: 500; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--faint); flex: none; }
.dot.ok { background: var(--green); } .dot.error { background: var(--red); } .dot.starting { background: var(--amber); }

/* alarm banner */
.banner { display: flex; align-items: center; gap: 14px; border: 1px solid rgba(239,91,82,.55); background: linear-gradient(90deg, rgba(239,91,82,.18), rgba(239,91,82,.05)); border-radius: var(--r); padding: 12px 16px; margin-bottom: 18px; }
.banner svg.i { color: var(--red); width: 22px; height: 22px; }
.banner b { font-weight: 500; letter-spacing: .06em; }
.banner a { margin-left: auto; font-size: 13px; }

/* building section diagram */
.section { display: flex; flex-direction: column; gap: 4px; }
.floor { display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 6px; background: var(--panel2); border: 1px solid transparent; cursor: pointer; position: relative; overflow: hidden; }
.floor::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--heat, var(--faint)); }
.floor::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, var(--heat, transparent), transparent 75%); opacity: .13; pointer-events: none; }
.floor:hover, .floor.on { border-color: var(--line2); }
.floor.on { background: var(--raise); }
.floor .fc { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.floor .fn { font-size: 14px; }
.floor .fv { display: flex; gap: 12px; align-items: center; font-variant-numeric: tabular-nums; font-size: 14px; }
.floor .fv .t { min-width: 52px; text-align: right; font-size: 16px; font-weight: 300; }
.floor.alarm { border-color: rgba(239,91,82,.6); }
.floor.alarm::before { background: var(--red); }
.floor.plant { background: transparent; border: 1px dashed var(--line2); }
.section .ground { height: 3px; background: var(--line2); border-radius: 2px; margin: 4px -6px 0; }
.legend { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--faint); margin-top: 12px; }
.legend .scale { flex: 1; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #5b9bd5, #8fb8a8, #c8c08a, #e8a23b, #ef5b52); }

/* tiles */
.areahd { display: flex; align-items: center; gap: 10px; margin: 26px 0 10px; }
.areahd:first-child { margin-top: 0; }
.areahd h2 { color: var(--text); font-size: 13px; }
.areahd .line { flex: 1; height: 1px; background: var(--line); }
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px 10px; cursor: pointer; position: relative; min-height: 112px; display: flex; flex-direction: column; transition: border-color .15s; }
.tile:hover { border-color: var(--line2); }
.tile .th { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.tile .th svg.i { width: 16px; height: 16px; color: var(--faint); }
.tile .th .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .val { font-size: 26px; font-weight: 300; margin-top: 6px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile .val small { font-size: 13px; color: var(--muted); margin-left: 2px; }
.tile .spark { display: block; width: 100%; height: 26px; margin-top: auto; }
.tile .dev { color: var(--faint); font-size: 11.5px; margin-top: 4px; display: flex; justify-content: space-between; gap: 6px; }
.tile .dev span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.off { opacity: .45; }
.tile.alarm { border-color: var(--red); background: linear-gradient(180deg, var(--red-bg), var(--panel)); }
.tile.alarm .val { color: var(--red); font-weight: 400; }
.tile.on-state .val { color: var(--text); }
.tile.flash { animation: flash .9s; }
@keyframes flash { from { box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); } to { box-shadow: inset 0 0 0 1px rgba(255,255,255,0); } }

/* segmented + chips */
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; border-radius: 6px; background: none; padding: 5px 12px; color: var(--muted); font-size: 13px; }
#filters button { text-transform: capitalize; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--raise); color: var(--text); }

/* activity feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed .sev { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--faint); }
.feed .sev.critical { background: var(--red); } .feed .sev.warning { background: var(--amber); } .feed .sev.notice { background: var(--blue); }
.feed .what { font-size: 14px; line-height: 1.35; }
.feed .meta { font-size: 11.5px; color: var(--faint); margin-top: 2px; display: flex; gap: 8px; }
.feed .meta .mono { font-size: 11px; }
.feed li.new { animation: slidein .5s; }
@keyframes slidein { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* tables */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 400; color: var(--faint); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255,255,255,.015); }

/* controls */
button, .btn { background: var(--panel2); border: 1px solid var(--line2); border-radius: 7px; padding: 7px 14px; cursor: pointer; text-decoration: none; letter-spacing: .03em; font-size: 14px; display: inline-flex; align-items: center; gap: 7px; transition: border-color .15s, background .15s; }
button:hover, .btn:hover { border-color: #5a5a5e; background: var(--raise); }
button.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
button.primary:hover { background: #fff; }
button.danger { border-color: rgba(239,91,82,.45); color: var(--red); background: transparent; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--text); background: var(--panel2); }
button.sm { padding: 4px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { background: #151516; border: 1px solid var(--line2); border-radius: 7px; padding: 8px 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #77777c; }
textarea { width: 100%; font-family: var(--mono); font-size: 13px; min-height: 300px; tab-size: 2; line-height: 1.5; }
label { display: block; color: var(--muted); font-size: 13px; margin: 12px 0 5px; }
label input, label select { display: block; width: 100%; margin-top: 5px; color: var(--text); }
.switch { width: 40px; height: 22px; border-radius: 11px; background: #4a4a4e; position: relative; border: 0; padding: 0; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #e8e8e8; transition: left .15s; }
.switch.on { background: var(--green); } .switch.on::after { left: 21px; }
.switch:hover { border: 0; background: #56565a; } .switch.on:hover { background: var(--green); }

/* integration cards */
.icard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.icard .ic { width: 38px; height: 38px; border-radius: 9px; background: var(--panel2); display: grid; place-items: center; }
.icard .ic svg.i { width: 20px; height: 20px; }
.icard .st { font-size: 13px; color: var(--muted); min-height: 19px; }
.icard .st.err { color: var(--red); }
.icard .acts { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }

/* entity detail */
.ehero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: stretch; margin-bottom: 16px; }
.bigval { font-size: 52px; font-weight: 200; line-height: 1; font-variant-numeric: tabular-nums; }
.bigval small { font-size: 20px; color: var(--muted); margin-left: 4px; }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.stats3 div { background: var(--panel2); border-radius: 8px; padding: 8px 12px; }
.stats3 span { font-size: 10.5px; color: var(--faint); letter-spacing: .14em; text-transform: uppercase; display: block; }
.stats3 b { font-weight: 300; font-size: 18px; font-variant-numeric: tabular-nums; }
.chartbox { position: relative; }
.chart { width: 100%; height: 300px; display: block; }
.chart text { fill: var(--faint); font-size: 11px; font-family: var(--sans); }
.tip { position: absolute; pointer-events: none; background: #0f0f10; border: 1px solid var(--line2); border-radius: 6px; padding: 6px 9px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -115%); }
.tip b { font-size: 15px; font-weight: 400; display: block; }

/* modal, toast, login */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.62); backdrop-filter: blur(2px); display: flex; align-items: flex-start; justify-content: center; padding: 7vh 16px; z-index: 20; overflow: auto; }
.sheet { background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; padding: 24px; width: min(820px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.sheet h1 { font-size: 18px; margin-bottom: 6px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 8px; z-index: 30; max-width: 90vw; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.toast.err { background: var(--red); color: #fff; }
.err-text { color: var(--red); white-space: pre-wrap; }
.empty { color: var(--muted); padding: 36px 20px; text-align: center; border: 1px dashed var(--line2); border-radius: var(--r); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 50% -10%, #2a2a2c, var(--bg)); }
.login .box { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 30px; }
.login .brand { justify-content: center; padding-bottom: 6px; font-size: 18px; }
.login p { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 18px; }
details summary { cursor: pointer; }

/* cameras */
.cams { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.cams.large { grid-template-columns: repeat(auto-fill, minmax(520px, 1fr)); }
.cams.mini { grid-template-columns: 1fr 1fr; gap: 8px; }
.cam { border-radius: var(--r); overflow: hidden; background: #0e0e0f; border: 1px solid var(--line); cursor: pointer; transition: border-color .15s; }
.cam:hover, .cam:focus-visible { border-color: var(--line2); outline: none; }
.cam .frame { position: relative; aspect-ratio: 16 / 9; background: #0e0e0f; }
.cam img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.cam .over { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 8px; display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; background: linear-gradient(transparent, rgba(0,0,0,.75)); }
.cam .cn { font-size: 14px; letter-spacing: .04em; }
.cam .ca { font-size: 11.5px; color: #c9c9cc; }
.cam .livetag { font-size: 10px; letter-spacing: .16em; padding: 2px 6px; border-radius: 4px; background: rgba(0,0,0,.55); color: #e6e6e6; }
.cam.offline .livetag { color: var(--red); }
.cam .chips { position: absolute; top: 32px; right: 8px; display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 75%; }
.chip { font-size: 10.5px; letter-spacing: .06em; padding: 2px 7px; border-radius: 10px; background: rgba(0,0,0,.5); color: rgba(255,255,255,.45); border: 1px solid rgba(255,255,255,.08); }
.chip.on { background: rgba(232,162,59,.92); color: #1b1b1c; border-color: transparent; font-weight: 500; }
.chip.on.bad { background: var(--red); color: #fff; }
.cam .nosig { position: absolute; inset: 0; display: none; place-items: center; color: var(--faint); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
.cam.nosignal .nosig, .cam.offline .nosig { display: grid; }
.cam.nosignal img, .cam.offline img { opacity: .15; }
.cams.mini .cam .over { padding: 14px 8px 5px; }
.cams.mini .cam .cn { font-size: 12px; }
.cams.mini .chip { font-size: 9.5px; padding: 1px 5px; }
.cams.mini .livetag { display: none; }
.cam.viewer { cursor: default; }
.cam:not(.viewer) .chip:not(.on) { display: none; }
.dets { display: flex; flex-wrap: wrap; gap: 6px; }
.det { font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--panel2); color: var(--muted); }
.det b { font-weight: 400; color: var(--text); font-family: var(--mono); font-size: 11.5px; margin-right: 4px; }
.det.bad { background: var(--red-bg); color: var(--red); }
.cam.viewer .chips { top: 36px; }
.sheet:has(.viewer) { width: min(1100px, 100%); }

/* rule builder */
.rsec { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-top: 14px; background: var(--panel2); display: grid; gap: 10px; }
.rsh { display: flex; align-items: center; gap: 10px; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.rstep { width: 22px; height: 22px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; font-size: 12px; letter-spacing: 0; font-weight: 500; }
.rsec > button { justify-self: start; }
.rline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rline .grow { flex: 1; min-width: 220px; }
.inunit { display: inline-flex; align-items: center; gap: 6px; }
.inunit span { color: var(--muted); font-size: 13px; }
.ract { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 8px; }
.ract:first-of-type { border-top: 0; padding-top: 0; }
.phs { display: flex; gap: 6px; flex-wrap: wrap; }
.chipbtn { font-size: 12px; padding: 2px 9px; border-radius: 12px; background: var(--panel); border: 1px dashed var(--line2); color: var(--muted); }
.chipbtn:hover { color: var(--text); }
.chipbtn::before { content: '+ '; color: var(--faint); }
.rsum { margin-top: 16px; padding: 12px 14px; border-radius: 8px; background: #151516; border-left: 3px solid var(--text); font-size: 14px; line-height: 1.5; }
.rsum b { font-weight: 500; }
.ideas { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.idea { flex-direction: column; align-items: flex-start; text-align: left; gap: 4px; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.idea b { font-weight: 400; }
.idea span { font-size: 12.5px; color: var(--muted); }
.idea:hover { border-color: var(--line2); }

/* discovery */
.dgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.dcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.dcard .ic { width: 38px; height: 38px; border-radius: 9px; background: var(--panel2); display: grid; place-items: center; flex: none; }
.dcard .dt { font-size: 15px; }
.scanrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.scanrow:last-of-type { border-bottom: 0; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary h2::before { content: '▸ '; color: var(--faint); }
details[open] > summary h2::before { content: '▾ '; }

/* ---------- small screens ---------- */
.bside { position: sticky; top: 20px; }
@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; } .bside { position: static; order: -1; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; z-index: 15; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 10px 0 40px rgba(0,0,0,.5); }
  .mtop { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #161617; position: sticky; top: 0; z-index: 10; }
  .mtop .brand { padding: 0; font-size: 13px; }
  .mtop .live { margin-left: auto; }
  main { padding: 18px 16px 50px; }
  h1 { font-size: 20px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 12px 8px; }
  .kpi .val { font-size: 24px; }
  .pagehead .live { display: none; }
  .grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cams, .cams.large, .dgrid { grid-template-columns: 1fr; }
  .tile .val { font-size: 22px; }
  .ehero { grid-template-columns: 1fr; }
  .bigval { font-size: 40px; }
  .hide-sm { display: none; }
  td, th { padding: 8px; }
}
