/* Fleet Control - Control Room.
   A dark operations wall: ink backgrounds, Space Grotesk for words, JetBrains
   Mono for every number, and Seartec's petal colours doing the status work.
   No inline styles anywhere in the templates; anything dynamic is a class or a
   data attribute that static/js/main.js reads. */

:root {
  --accent: #FF671E;
  --accent-ink: #ffffff;
  --accent-soft: rgba(255, 103, 30, .14);
  --ink: #0B121B;
  --panel: #0E1620;
  --raised: #14202B;
  --hover: #172433;
  --line: #1B2734;
  --line-strong: #263646;
  --text: #E8EEF4;
  --text-dim: #A8BAC8;
  --muted: #7A8390;
  --ok: #6DC148;
  --warn: #F2A900;
  --warn-ink: #1B1200;
  --error: #E5002B;
  --info: #00AFD6;
  --offline: #A8BAC8;
  --unknown: #3E5062;
  --cyan: #00AFD6;
  --magenta: #E5399E;
  --yellow: #F2C230;
  --black: #E8EEF4;
  --nav-ink: #ffffff;
  --radius: 12px;
  --font: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
}

/* Ledger: the light mode.  Warm paper, slate ink, hairline tables, a serif
   for page titles.  Same components, different room.  Switched by the toggle
   in the top bar; static/js/theme.js applies it before first paint. */
:root[data-theme="light"] {
  --accent: #FF671E;
  --accent-ink: #ffffff;
  --accent-soft: rgba(255, 103, 30, .12);
  --ink: #FBFAF7;
  --panel: #FFFFFF;
  --raised: #F4F2EC;
  --hover: #EEEBE3;
  --line: #E6E2DA;
  --line-strong: #D5D0C5;
  --text: #1F2328;
  --text-dim: #5B6068;
  --muted: #7A8390;
  --ok: #3B7A1E;
  --warn: #B47A00;
  --warn-ink: #ffffff;
  --error: #C9001F;
  --info: #0B7A93;
  --offline: #8A97A6;
  --unknown: #C9C4BA;
  --black: #1F2328;
  --nav-ink: #1F2328;
}
:root[data-theme="light"] .chip-warn { background: #FFF3D6; border-color: #F1D89A; color: #7A5300; }
:root[data-theme="light"] .chip-ok { background: #EAF6E2; border-color: #C6E5B3; color: #2F6A16; }
:root[data-theme="light"] .badge-ok { background: #EAF6E2; }
:root[data-theme="light"] .badge-warn { background: #FFF3D6; }
:root[data-theme="light"] .badge-error { background: #FDE8EC; color: #C9001F; }
:root[data-theme="light"] .badge-offline { background: #EEF1F4; color: #5B6B7A; }
:root[data-theme="light"] .flash-success { background: #EAF6E2; border-color: #C6E5B3; color: #2F6A16; }
:root[data-theme="light"] .flash-danger { background: #FDE8EC; border-color: #F5BEC8; color: #A9001F; }
:root[data-theme="light"] .flash-warning { background: #FFF3D6; border-color: #F1D89A; color: #7A5300; }
:root[data-theme="light"] .notice-error { border-color: #F5BEC8; }
:root[data-theme="light"] .notice-warn { border-color: #F1D89A; }
:root[data-theme="light"] .notice-info { border-color: #BCE8F3; }
:root[data-theme="light"] .avatar { color: #fff; }
:root[data-theme="light"] .bars-svg rect.is-future { fill: var(--line); }
:root[data-theme="light"] .topbar-title { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 30px; letter-spacing: 0; }
:root[data-theme="light"] .topbar-title .muted, :root[data-theme="light"] .topbar-title .badge { font-family: var(--font); }
:root[data-theme="light"] .login-title { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 32px; }
:root[data-theme="light"] .card { box-shadow: none; }
:root[data-theme="light"] .stat-n { font-weight: 500; }
:root[data-theme="light"] .table th { border-bottom: 2px solid var(--text); }
:root[data-theme="light"] .tile { background: var(--panel); border: 1px solid var(--line); border-top-width: 3px; }
:root[data-theme="light"] .top { background: var(--panel); }
:root[data-theme="light"] .top-logo { content: url("/static/brand/seartec-logo.svg"); }
:root[data-theme="light"] .login-logo { content: url("/static/brand/seartec-logo.svg"); }
:root[data-theme="light"] .badge-sev-warning { color: #ffffff; }
:root[data-theme="light"] .login-bg { background: #FBFAF7; }
:root[data-theme="light"] .login-bg::after { background: radial-gradient(ellipse at center, rgba(251,250,247,.05) 0%, rgba(251,250,247,.35) 55%, rgba(251,250,247,.9) 100%); }
:root[data-theme="light"] .login-box { background: rgba(255,255,255,.94); box-shadow: 0 30px 60px -24px rgba(31,35,40,.35); }
:root[data-theme="light"] .login-legal { color: var(--muted); }
:root[data-theme="light"] .code { background: #1F2328; }
@media (orientation: portrait) {
  :root[data-theme="light"] .login-bg::after { background: linear-gradient(180deg, rgba(251,250,247,.05) 0%, rgba(251,250,247,.4) 35%, rgba(251,250,247,.92) 70%, #FBFAF7 100%); }
  :root[data-theme="light"] .login-box { background: rgba(255,255,255,.9); }
}
.only-light { display: none; }
:root[data-theme="light"] .only-light { display: inline; }
:root[data-theme="light"] .only-dark { display: none; }
.theme-toggle { color: var(--text-dim); }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text); background: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: #FF8A4F; text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 15px; }
h3.sub { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 18px 0 8px; font-weight: 700; }
code, .mono { font-family: var(--mono); font-size: 13px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; color: var(--text); }
.nowrap { white-space: nowrap; }
.num { text-align: right; }
.inline { display: inline; }
.link { font-size: 12px; font-weight: 500; }
.back { color: var(--muted); margin-right: 6px; vertical-align: middle; }
.ic { width: 18px; height: 18px; vertical-align: -4px; flex: none; }
.ic-lg { width: 32px; height: 32px; }

/* ---- shell: top bar, no sidebar ---- */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.top { display: flex; align-items: center; gap: 20px; padding: 0 28px; height: 60px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.top-brand:hover { text-decoration: none; }
.top-logo { height: 26px; max-width: 160px; }
.top-product { display: flex; align-items: center; gap: 8px; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding-left: 14px; border-left: 1px solid var(--line); }
.top-icon { width: 20px; height: 20px; border-radius: 5px; }
.top-nav { display: flex; gap: 2px; margin-left: 8px; }
.top-nav a { display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 8px; color: var(--text-dim); font-weight: 500; font-size: 14px; }
.top-nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.top-nav a.is-active { background: var(--hover); color: var(--nav-ink); }
.top-nav .ic { width: 16px; height: 16px; }
/* Drop menus: open on hover and on keyboard focus; on touch the first tap
   opens (main.js adds is-open), the second follows the heading's link. */
.menu { position: relative; }
.menu-head { display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 8px; color: var(--text-dim); font-weight: 500; font-size: 14px; }
.menu.is-active > .menu-head { background: var(--hover); color: var(--nav-ink); }
.menu:hover > .menu-head, .menu.is-open > .menu-head, .menu:focus-within > .menu-head { background: var(--hover); color: var(--nav-ink); text-decoration: none; }
.caret { display: inline-block; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin: -3px 0 0 2px; opacity: .6; }
.menu-panel { display: none; position: absolute; top: calc(100% + 4px); left: 0; min-width: 220px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 10px; padding: 6px; z-index: 30; box-shadow: 0 18px 40px -16px rgba(0,0,0,.8); }
.menu-panel::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
.menu:hover > .menu-panel, .menu.is-open > .menu-panel, .menu:focus-within > .menu-panel { display: block; }
.top-nav .menu-panel a { display: block; padding: 8px 12px; border-radius: 6px; color: var(--text); font-weight: 400; font-size: 13px; white-space: nowrap; }
.top-nav .menu-panel a:hover { background: var(--hover); color: var(--nav-ink); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.top-search { display: flex; align-items: center; gap: 8px; background: var(--hover); border-radius: 8px; padding: 0 10px; width: 260px; color: var(--muted); }
.top-search input { flex: 1; background: transparent; border: 0; color: var(--text); font: inherit; padding: 8px 4px; min-width: 0; }
.top-search input::placeholder { color: var(--muted); }
.top-search input:focus { outline: 0; }
.top-user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.top-user-text { line-height: 1.2; }
.top-user-name { font-weight: 600; font-size: 13px; }
.top-user-role { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.side-note { margin: 0 0 0 8px; padding: 6px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--text-dim); font-size: 12px; }
.main { flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 28px 8px; }
.topbar-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.topbar-title .muted { font-size: 13px; font-weight: 400; letter-spacing: 0; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.content { padding: 8px 28px 40px; max-width: 1560px; }
.flashes { padding: 0 28px; }
.flash { padding: 10px 14px; border-radius: 8px; margin: 6px 0; font-weight: 500; border: 1px solid; }
.flash-success { background: #12301E; border-color: #1F5A32; color: #9FE080; }
.flash-danger { background: #3A0A14; border-color: #7A1428; color: #FF8AA0; }
.flash-warning { background: #3A2A00; border-color: #6B4A00; color: #FFD36B; }

/* ---- cards, grids ---- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 16px; }
.card-narrow { max-width: 720px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-2 > .card { margin: 0; }
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.dash > * { min-width: 0; }
.dash > .card { margin: 0; }
.rail { display: flex; flex-direction: column; gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; color: var(--text); }
.stat:hover { text-decoration: none; border-color: var(--line-strong); color: var(--text); }
.stat-n { font-family: var(--mono); font-size: 40px; font-weight: 700; letter-spacing: -.02em; line-height: 1; white-space: nowrap; }
.stat-l { font-size: 12px; color: var(--text-dim); margin-top: 8px; letter-spacing: .08em; text-transform: uppercase; }
.stat-ok .stat-n { color: var(--ok); }
.stat-warn .stat-n { color: var(--warn); }
.stat-error .stat-n { color: var(--error); }
.stat-offline .stat-n { color: var(--offline); }
.stat-info .stat-n { color: var(--info); }
.notices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.notice { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text-dim); }
.notice > div { flex: 1; }
.notice strong { color: var(--text); }
.notice-error { border-color: #7A1428; }
.notice-error .ic { color: var(--error); }
.notice-warn { border-color: #6B4A00; }
.notice-warn .ic { color: var(--warn); }
.notice-info { border-color: #045F73; }
.notice-info .ic { color: var(--info); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty.small { padding: 14px; }
.empty .ic { color: var(--unknown); display: block; margin: 0 auto 8px; }
.empty p { margin: 0 0 12px; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); }
.table th.num { text-align: right; }
.table td.num, .table td.mono, .table td.nowrap { white-space: nowrap; }
.table a.strong, .table .strong a { color: var(--text); }
.table a.strong:hover, .table .strong a:hover { color: var(--accent); }
.table td.cell-client { white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table-tight td { padding: 8px 8px; }
.table-hover tbody tr:hover { background: var(--raised); }
.row-link { cursor: pointer; }
.is-muted { opacity: .55; }
.w-sev { width: 90px; }
.w-gauge { width: 140px; }
.w-toner { width: 110px; }
.w-num { width: 80px; }
.agent-cell .badge { display: inline-block; margin-bottom: 4px; }

/* ---- client tree, breadcrumbs ---- */
.tree-d1 { padding-left: 34px; } .tree-d2 { padding-left: 58px; } .tree-d3 { padding-left: 82px; } .tree-d4 { padding-left: 106px; }
.tree-mark { display: inline-block; width: 12px; height: 12px; border-left: 2px solid var(--line-strong); border-bottom: 2px solid var(--line-strong); margin: 0 8px 2px -20px; vertical-align: middle; border-radius: 0 0 0 3px; }
.crumb { color: var(--text-dim); font-weight: 500; }
.crumb-sep { color: var(--muted); margin: 0 8px; font-weight: 400; }

/* ---- badges, chips ---- */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: .06em; white-space: nowrap; text-transform: uppercase; }
.badge-ok { background: #12301E; color: var(--ok); }
.badge-warn { background: #3A2A00; color: var(--warn); }
.badge-error { background: #3A0A14; color: #FF6B85; }
.badge-offline { background: var(--raised); color: var(--offline); }
.badge-unknown { background: var(--raised); color: var(--muted); }
.badge-sev-critical { background: var(--error); color: #fff; font-size: 10px; }
.badge-sev-warning { background: var(--warn); color: var(--warn-ink); font-size: 10px; }
.badge-sev-info { background: var(--info); color: #fff; font-size: 10px; }
.chip { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--raised); color: var(--text-dim); white-space: nowrap; }
.chip-ok { background: #12301E; border-color: #1F5A32; color: var(--ok); }
.chip-warn { background: #3A2A00; border-color: #6B4A00; color: var(--warn); }
.chip-muted { color: var(--muted); }
.chip-usb { padding: 2px 5px; }
.chip-admin { cursor: pointer; background: var(--accent-soft); border-color: #7A3A14; color: #FFB08A; font-family: inherit; }
.pill { display: inline-block; min-width: 18px; padding: 1px 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; text-align: center; margin-left: 4px; }
.pill-muted { background: var(--unknown); }

/* ---- gauges and toner ---- */
.gauge { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; position: relative; }
.gauge-lg { height: 12px; }
.gauge-fill { height: 100%; width: 0; border-radius: 999px; background: var(--text-dim); transition: width .3s ease; }
.gauge-c .gauge-fill { background: var(--cyan); }
.gauge-m .gauge-fill { background: var(--magenta); }
.gauge-y .gauge-fill { background: var(--yellow); }
.gauge-k .gauge-fill { background: var(--black); }
.gauge-none .gauge-fill { background: var(--offline); }
.gauge.is-low { box-shadow: inset 0 0 0 1px var(--warn); }
.gauge.is-critical { box-shadow: inset 0 0 0 1px var(--error); }
.toner { display: flex; gap: 3px; }
.toner .gauge { flex: 1; height: 5px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--text-dim); }
.swatch-c { background: var(--cyan); } .swatch-m { background: var(--magenta); } .swatch-y { background: var(--yellow); } .swatch-k { background: var(--black); }
.supplies { display: flex; flex-direction: column; gap: 12px; }
.supply { display: grid; grid-template-columns: 1fr 200px 56px 130px; align-items: center; gap: 14px; font-size: 13px; }
.supply-v { text-align: right; font-weight: 600; }
.panel-alerts { margin: 0; padding: 0; list-style: none; }
.panel-alerts li { padding: 8px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 4px 0; }

/* ---- fleet wall ---- */
.fleet-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; gap: 6px; min-width: 0; overflow: hidden; border-radius: 10px; padding: 12px; color: var(--text); background: var(--raised); border-top: 3px solid var(--unknown); transition: background .15s, transform .15s; }
.tile:hover { text-decoration: none; background: var(--hover); transform: translateY(-1px); color: var(--text); }
.tile-ok { border-top-color: var(--ok); }
.tile-warn { border-top-color: var(--warn); }
.tile-error { border-top-color: var(--error); }
.tile-offline { border-top-color: var(--offline); opacity: .75; }
.tile-state { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.tile-state > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tile-ok .tile-state { color: var(--ok); }
.tile-warn .tile-state { color: var(--warn); }
.tile-error .tile-state { color: var(--error); }
.tile-offline .tile-state { color: var(--offline); }
.tile-name { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-meta { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .toner { margin-top: 4px; }
.tile-foot { display: flex; justify-content: space-between; font-size: 12px; margin-top: 4px; color: var(--text-dim); }

/* ---- rail lists ---- */
.rail-list { display: flex; flex-direction: column; }
.rail-item { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); color: var(--text); }
.rail-item:hover { text-decoration: none; color: var(--text); }
.rail-item:first-child { border-top: 0; padding-top: 0; }
.rail-bar { width: 4px; border-radius: 2px; background: var(--muted); flex: none; }
.rail-bar-critical { background: var(--error); }
.rail-bar-warning { background: var(--warn); }
.rail-bar-info { background: var(--info); }
.rail-title { font-size: 13px; font-weight: 500; }
.rail-meta { font-size: 12px; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 90px; }
.bars-svg { width: 100%; height: 90px; display: block; }
.bars-svg rect { fill: var(--accent); }
.bars-svg rect.is-future { fill: var(--line-strong); }
.bars-axis { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.big { font-family: var(--mono); font-size: 28px; font-weight: 700; color: var(--text); white-space: nowrap; }
.big small { font-family: var(--font); font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 6px; }

/* ---- device page ---- */
.device-head { display: grid; grid-template-columns: 200px 1fr; gap: 20px 28px; }
.device-photo img { width: 200px; height: 150px; object-fit: contain; border-radius: 10px; background: var(--raised); border: 1px solid var(--line); display: block; }
.device-photo-empty { width: 200px; height: 150px; border-radius: 10px; background: var(--raised); border: 1px dashed var(--line-strong); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--unknown); font-size: 12px; }
.device-id { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 24px; align-content: start; }
.kv { display: grid; grid-template-columns: 88px 1fr; gap: 8px; padding: 5px 0; font-size: 13px; min-width: 0; }
.kv > span:last-child, .kv > a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv > span:first-child { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding-top: 2px; }
.device-counters { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.counter { text-align: left; min-width: 0; background: var(--raised); border-radius: 10px; padding: 12px 14px; }
.counter .muted.small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.counter-l { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.counter-n { font-family: var(--mono); font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; white-space: nowrap; }
.disclosure-sm summary { font-size: 12px; }
.tab-pane { display: none; }
.tab-pane.is-active { display: block; }
.meter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 20px; }
.meter { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.meter-l { color: var(--text-dim); font-size: 13px; text-transform: capitalize; }
.meter-v { font-weight: 600; }
.ticket { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ticket:last-child { border-bottom: 0; }
.ticket-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.form-tight { margin-top: 8px; gap: 6px; }
.form-tight .grow { flex: 1; min-width: 160px; font: inherit; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--raised); color: var(--text); }
.notes { list-style: none; padding: 0; margin: 12px 0 0; }
.notes li { padding: 10px 0; border-top: 1px solid var(--line); white-space: pre-wrap; }
.rdl-icon { color: var(--muted); }
.rdl-icon:hover { color: var(--accent); }
.spark { width: 100%; }
.spark-svg { width: 100%; height: 120px; display: block; }
.spark-svg rect { fill: var(--accent); opacity: .85; }
.spark-svg rect:hover { opacity: 1; }
.token { display: inline-block; padding: 6px 10px; background: var(--raised); border: 1px dashed var(--line-strong); border-radius: 6px; word-break: break-all; color: #fff; }
.code { background: #050A10; color: #E8EEF4; padding: 12px 14px; border-radius: 8px; font-family: var(--mono); font-size: 13px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; border: 1px solid var(--line); }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 6px; }
.logo-preview { display: flex; align-items: center; gap: 16px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px; background: var(--raised); }
.logo-preview img { max-height: 48px; max-width: 220px; }

/* ---- forms, buttons ---- */
.form { display: flex; flex-direction: column; gap: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-row { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.field > span { font-weight: 500; color: var(--text-dim); font-size: 12px; }
.field-wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea, .select, textarea { font: inherit; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--raised); color: var(--text); min-width: 0; }
.field input:focus, .field select:focus, .field textarea:focus, .select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field input[type="color"] { padding: 2px; height: 38px; width: 80px; }
.field input[type="file"] { padding: 6px; }
.field-inline { flex-direction: row; align-items: center; gap: 8px; }
.field-inline input { flex: 1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; color: var(--text-dim); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 6px 0; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.filters { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.filters .field-inline { flex: 1; min-width: 240px; background: var(--raised); border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 10px; }
.filters .field-inline input { border: 0; padding: 9px 4px; background: transparent; }
.filters .field-inline input:focus { outline: 0; }
.filters .ic { color: var(--muted); }
.btn { font: inherit; font-weight: 600; font-size: 13px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--raised); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #FF7A3A; border-color: #FF7A3A; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--raised); border-color: transparent; }
.btn-danger { color: #FF6B85; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 10px 14px; color: var(--text-dim); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.is-active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.disclosure { margin-top: 12px; }
.disclosure summary { cursor: pointer; font-weight: 600; color: var(--accent); padding: 6px 0; }
.disclosure .form { margin-top: 10px; }

/* ---- login ---- */
.login { min-height: 100vh; display: grid; place-items: center; position: relative; background: var(--ink); padding: 24px; color: var(--text); }
.login-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: #0B121B; }
.login-bg picture { display: block; width: 100%; height: 100%; }
.login-bg img { width: 100%; height: 100%; object-fit: contain; object-position: center; display: block; opacity: .9; }
.login-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(11,18,27,.15) 0%, rgba(11,18,27,.55) 55%, rgba(11,18,27,.9) 100%); }
/* Portrait phones get the portrait crop, filling the screen, with the card
   floated over a darker lower half so the form reads against the artwork. */
@media (orientation: portrait) {
  .login-bg img { object-fit: cover; object-position: center top; opacity: 1; }
  .login-bg::after { background: linear-gradient(180deg, rgba(11,18,27,.15) 0%, rgba(11,18,27,.45) 35%, rgba(11,18,27,.92) 70%, #0B121B 100%); }
  .login { align-items: end; padding: 16px 16px 40px; }
  .login-box { max-width: 480px; background: rgba(14,22,32,.86); }
}
.login-box { position: relative; z-index: 1; width: 100%; max-width: 420px; background: rgba(14,22,32,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line-strong); border-radius: 18px; padding: 32px 32px 26px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.7); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-logo { height: 34px; max-width: 220px; }
.login-icon { width: 44px; height: 44px; border-radius: 10px; }
.login-product { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-weight: 700; }
.login-title { font-size: 26px; margin: 6px 0 4px; }
.login-sub { color: var(--muted); margin-bottom: 18px; }
.login-foot { margin-top: 20px; font-size: 11px; color: var(--muted); display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.login-legal { position: fixed; bottom: 14px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--muted); z-index: 1; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.dot-ok { background: var(--ok); } .dot-warn { background: var(--warn); } .dot-error { background: var(--error); }

/* ---- responsive ---- */
@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .dash { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .device-head { grid-template-columns: 200px 1fr; }
  .device-id { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-search { width: 180px; }
}
@media (max-width: 800px) {
  .top { height: auto; flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
  .top-nav { flex-wrap: wrap; margin: 0; order: 3; width: 100%; }
  .top-nav > a span, .menu-head span { display: none; }
  .topbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .topbar-actions { flex-wrap: wrap; }
  .topbar-actions .btn { flex: 1; justify-content: center; }
  .stat-n { font-size: 30px; }
  .device-counters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .device-id { grid-template-columns: 1fr; }
  .device-photo img, .device-photo-empty { width: 100%; }
  .card { padding: 14px 14px; }
  .content { padding-bottom: 24px; }
  .menu-panel { left: auto; right: 0; }
  .menu:hover > .menu-panel { display: none; }
  .menu.is-open > .menu-panel { display: block; }
  .top-search { display: none; }
  .top-product { display: none; }
  .content, .topbar, .flashes { padding-left: 14px; padding-right: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .device-head { grid-template-columns: 1fr; }
  .device-id { grid-template-columns: 1fr; }
  .supply { grid-template-columns: 1fr 100px 50px; }
  .supply-d { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .login-box { padding: 22px 20px 18px; border-radius: 16px; }
  .login-icon { width: 36px; height: 36px; border-radius: 8px; }
  .login-logo { height: 26px; }
  .login-title { font-size: 22px; }
  .login-sub { font-size: 13px; }
  .login-legal { display: none; }
  .fleet-wall { grid-template-columns: repeat(2, 1fr); }
  .dash { gap: 12px; }
}
