/* ==========================================================================
   RTK+ LiveMap — prototype styles
   ========================================================================== */

/* ---------------------------------------------------------------- Tokens */
:root {
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #F2F4F8;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --surface-3: #EEF2F7;
  --border: #E2E8F0;
  --border-2: #CBD5E1;
  --text: #0F172A;
  --text-2: #334155;
  --text-3: #64748B;
  --text-4: #94A3B8;

  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --shadow-1: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-2: 0 6px 16px rgba(15, 23, 42, .08), 0 2px 4px rgba(15, 23, 42, .05);
  --shadow-3: 0 24px 48px rgba(15, 23, 42, .16), 0 6px 14px rgba(15, 23, 42, .08);

  --c-fixed: #16A34A;
  --c-float: #EAB308;
  --c-dgps: #F97316;
  --c-nofix: #DC2626;
  --c-online: #2563EB;
  --c-nocorr: #E11D48;
  --c-nodata: #FFFFFF;
  --c-offline: #1E293B;
  --c-cov: #0891B2;

  --ux: #6D28D9;
  --ux-bg: #F3EEFF;
  --tbc: #B45309;
  --tbc-bg: #FFF4DE;

  --ok: #15803D;
  --ok-bg: #ECFDF3;
  --warn: #B45309;
  --warn-bg: #FFFAEB;
  --err: #B91C1C;
  --err-bg: #FEF2F2;
  --info: #1D4ED8;
  --info-bg: #EFF6FF;

  --topbar-h: 58px;
  --rail-w: 84px;
  --drawer-w: 420px;
}

[data-brand="nh"] {
  --brand: #0B3D91;
  --brand-strong: #082E6E;
  --brand-soft: #E8EEF9;
  --brand-ink: #0B3D91;
  --accent: #FFD100;
  --topbar: linear-gradient(90deg, #072C6B 0%, #0B3D91 55%, #1048A8 100%);
}
[data-brand="caseih"] {
  --brand: #B5121B;
  --brand-strong: #8C0D14;
  --brand-soft: #FCEBEC;
  --brand-ink: #A3111A;
  --accent: #1A1A1A;
  --topbar: linear-gradient(90deg, #8C0D14 0%, #B5121B 60%, #C41E27 100%);
}

/* Status colour variables (shared by markers, chips, badges, bars) */
.s-fixed { --sw: var(--c-fixed); }
.s-float { --sw: var(--c-float); }
.s-dgps { --sw: var(--c-dgps); }
.s-nofix { --sw: var(--c-nofix); }
.s-online { --sw: var(--c-online); }
.s-nocorr { --sw: var(--c-nocorr); }
.s-nodata { --sw: #FFFFFF; }
.s-offline { --sw: var(--c-offline); }
.q-fixed { --q: var(--c-fixed); }
.q-float { --q: var(--c-float); }
.q-dgps { --q: var(--c-dgps); }
.q-nofix { --q: var(--c-nofix); }

/* ------------------------------------------------------------------ Base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  font-feature-settings: 'cv11', 'ss01';
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.muted { color: var(--text-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
mark { background: color-mix(in srgb, var(--accent) 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
[data-brand="caseih"] mark { background: #FDE68A; }

.ic {
  width: 18px; height: 18px; flex: none;
  stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.ic-sm { width: 14px; height: 14px; }

/* ------------------------------------------------------------------ Shell */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh;
}

.topbar {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 18px;
  padding: 0 14px 0 0;
  background: var(--topbar);
  color: #fff;
  position: relative; z-index: 60;
  box-shadow: inset 0 -3px 0 var(--accent);
}
.brand { display: flex; align-items: center; gap: 14px; height: 100%; padding-left: 20px; text-decoration: none; color: inherit; }
.brand-sep { width: 1px; height: 24px; background: rgba(255, 255, 255, .28); }
.product { font-weight: 700; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; }
.product sup, .gate-product sup, h2 sup { font-size: .6em; vertical-align: .5em; margin-left: 1px; }

.wm { display: inline-flex; flex-direction: column; line-height: 1; white-space: nowrap; }
.wm b { font-weight: 800; font-size: 15px; letter-spacing: .04em; }
.wm small { font-size: 7.5px; letter-spacing: .42em; margin-top: 3px; opacity: .85; font-weight: 600; }
.wm-case b { font-style: italic; font-size: 19px; letter-spacing: -.01em; font-weight: 800; }
.wm-case small { letter-spacing: .5em; }

.context-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
  font-size: 12.5px; white-space: nowrap;
}
.context-chip .cc-k { opacity: .7; }
.context-chip .ic { width: 15px; height: 15px; opacity: .85; }
.topbar-spacer { flex: 1; }

.clock { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.clock b { font-size: 14px; font-weight: 600; }
.clock-day, .clock-tz { opacity: .72; }

.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 10px 5px 5px; border-radius: 999px; border: 0;
  background: rgba(255, 255, 255, .1); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}
.user-btn:hover { background: rgba(255, 255, 255, .18); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #111; font-weight: 700; font-size: 12px; flex: none;
}
[data-brand="caseih"] .avatar { background: #fff; color: var(--brand); }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; background: var(--brand-soft); color: var(--brand-ink); }
[data-brand="caseih"] .avatar-sm { background: var(--brand-soft); color: var(--brand-ink); }
.user-txt { display: flex; flex-direction: column; text-align: left; line-height: 1.2; }
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; opacity: .75; }

.menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 280px;
  background: var(--surface); color: var(--text);
  border-radius: var(--radius); box-shadow: var(--shadow-3); border: 1px solid var(--border);
  padding: 6px; z-index: 100;
}
.menu-head { padding: 10px 10px 8px; }
.menu-title { font-weight: 600; }
.menu-sub { font-size: 12px; color: var(--text-3); }
.menu-scope { display: flex; gap: 8px; align-items: center; margin: 0 4px 6px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 12.5px; color: var(--text-2); }
.menu-scope .ic { width: 15px; height: 15px; color: var(--text-3); }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: var(--radius-sm); background: none; text-align: left;
  flex-wrap: wrap;
}
.menu-item:hover { background: var(--surface-3); }

/* Rail */
.rail {
  grid-row: 2; grid-column: 1;
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 8px;
  background: var(--surface); border-right: 1px solid var(--border);
  position: relative; z-index: 40;
}
.rail-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 2px 9px; border-radius: 12px; border: 0; background: none;
  color: var(--text-3); font-size: 11px; font-weight: 600; line-height: 1.15; text-align: center; text-decoration: none;
  transition: background .15s, color .15s;
}
.rail-item .ic { width: 22px; height: 22px; }
.rail-item:hover { background: var(--surface-3); color: var(--text); }
.rail-item.is-active { background: var(--brand-soft); color: var(--brand-ink); }
.rail-item.is-active::before {
  content: ''; position: absolute; left: -8px; top: 12px; bottom: 12px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand);
}
.rail-spacer { flex: 1; }
.admin-only { display: none; }
.is-admin .admin-only { display: flex; }
.rail-proto { margin-top: 8px; border: 1.5px dashed var(--border-2); color: var(--ux); }
.rail-proto:hover, .rail-proto.is-active { background: var(--ux-bg); color: var(--ux); border-color: color-mix(in srgb, var(--ux) 40%, transparent); }

.main { grid-row: 2; grid-column: 2; position: relative; overflow: hidden; }
.view { position: absolute; inset: 0; display: none; }
.view.is-active { display: block; }

/* ------------------------------------------------------------ Annotations */
.anno {
  display: none; align-items: center; gap: 5px;
  padding: 3px 7px 3px 6px; border-radius: 999px;
  font: 600 10.5px/1 var(--font); letter-spacing: .01em; white-space: nowrap;
  vertical-align: middle; cursor: help; text-transform: none; font-style: normal;
}
.show-annotations .anno, .anno-static { display: inline-flex; }
.anno::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.anno-ux { color: var(--ux); background: var(--ux-bg); box-shadow: inset 0 0 0 1px rgba(109, 40, 217, .22); }
.anno-tbc { color: var(--tbc); background: var(--tbc-bg); box-shadow: inset 0 0 0 1px rgba(180, 83, 9, .25); }
.anno-dot { position: absolute; top: 4px; right: 6px; padding: 0; width: 16px; height: 16px; justify-content: center; font-size: 10px; }
.anno-dot::before { display: none; }
.live-pill .anno-dot { position: static; }

.tip {
  position: fixed; z-index: 9999; max-width: 300px;
  padding: 8px 11px; border-radius: 9px;
  background: #0F172A; color: #fff; font-size: 12px; line-height: 1.45;
  box-shadow: var(--shadow-2); pointer-events: none;
}
.tip-ux { background: #4C1D95; }
.tip-tbc { background: #7C2D12; }

/* --------------------------------------------------------------- Controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 13.5px; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
}
.btn .ic { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .2), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-secondary { background: var(--surface); border-color: var(--border-2); color: var(--text); box-shadow: var(--shadow-1); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--text-4); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { color: var(--err); }
.btn-danger:hover { background: var(--err-bg); color: var(--err); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; gap: 6px; }
.btn-sm .ic { width: 14px; height: 14px; }
.btn.is-loading { opacity: .85; pointer-events: none; }
.btn-group { display: inline-flex; gap: 2px; padding: 2px; background: var(--surface-3); border-radius: 10px; }

.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; flex: none;
  border: 0; border-radius: 9px; background: transparent; color: var(--text-3);
  transition: background .15s, color .15s;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn-sm { width: 28px; height: 28px; border-radius: 7px; }
.icon-btn-sm .ic { width: 16px; height: 16px; }
.icon-btn-xs { width: 22px; height: 22px; border-radius: 6px; }
.icon-btn-xs .ic { width: 13px; height: 13px; }

.link-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 0; background: none; padding: 0;
  color: var(--brand-ink); font-weight: 600; font-size: 12.5px;
}
.link-btn:hover { text-decoration: underline; }
.link-btn .ic { width: 14px; height: 14px; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 10px; }
.segmented button {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: transparent; padding: 6px 11px; border-radius: 8px;
  font-weight: 500; font-size: 12.5px; color: var(--text-2); white-space: nowrap;
}
.segmented button:hover { color: var(--text); }
.segmented button.is-active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-1); }
.segmented-xs { padding: 2px; border-radius: 8px; }
.segmented-xs button { padding: 3px 8px; font-size: 11.5px; border-radius: 6px; }
.segmented-full { display: flex; }
.segmented-full button { flex: 1; justify-content: center; }

input.switch {
  appearance: none; -webkit-appearance: none;
  width: 36px; height: 21px; border-radius: 999px; margin: 0; flex: none;
  background: var(--border-2); position: relative; cursor: pointer;
  transition: background .2s;
}
input.switch::after {
  content: ''; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .3); transition: transform .2s;
}
input.switch:checked { background: var(--brand); }
input.switch:checked::after { transform: translateX(15px); }
input.switch:disabled { opacity: .45; cursor: not-allowed; }
input.switch:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
input.switch-sm { width: 30px; height: 18px; }
input.switch-sm::after { width: 13px; height: 13px; }
input.switch-sm:checked::after { transform: translateX(12px); }

input.cb {
  appearance: none; -webkit-appearance: none;
  width: 17px; height: 17px; margin: 0; flex: none; border-radius: 5px;
  border: 1.5px solid var(--border-2); background: var(--surface); cursor: pointer;
  display: inline-grid; place-items: center; transition: background .15s, border-color .15s;
}
input.cb:checked, input.cb:indeterminate { background: var(--brand); border-color: var(--brand); }
input.cb:checked::after {
  content: ''; width: 9px; height: 5px; margin-top: -2px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg);
}
input.cb:indeterminate::after { content: ''; width: 8px; height: 2px; background: #fff; border-radius: 1px; }
input.cb:disabled { opacity: .45; cursor: not-allowed; }

.select, input[type="date"], .input-icon input {
  height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.select { padding-right: 32px; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.select:focus, input[type="date"]:focus, .input-icon input:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.input-icon { position: relative; }
.input-icon > .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-4); width: 17px; height: 17px; pointer-events: none; }
.input-icon input { width: 100%; padding-left: 38px; }
.input-icon-sm input { height: 34px; font-size: 13px; }
.input-icon-sm > .ic { width: 15px; height: 15px; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 4px; cursor: pointer;
}
.switch-row.is-disabled { opacity: .55; cursor: default; }
.sr-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sr-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.sr-icon .ic { width: 16px; height: 16px; }
.sr-cov { background: color-mix(in srgb, var(--c-cov) 14%, white); color: var(--c-cov); }
.sr-label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 500; font-size: 13px; }
.sr-sub { display: block; font-size: 11.5px; color: var(--text-3); }
.switch-row-plain { padding: 6px 0; }
.switch-row-xs .sr-label { font-size: 12px; }
.switch-row-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-top: 14px; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; vertical-align: middle; }
.pill-admin { background: var(--brand-soft); color: var(--brand-ink); }

/* Status badges */
.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 7px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.3;
  background: color-mix(in srgb, var(--sw) 13%, white);
  color: color-mix(in srgb, var(--sw) 72%, black);
}
.status-badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--sw); flex: none; }
.status-badge.station::before { border-radius: 2px; }
.status-badge.s-float { color: #854D0E; background: #FEF9C3; }
.status-badge.s-nodata { background: #F1F5F9; color: #475569; }
.status-badge.s-nodata::before { box-shadow: inset 0 0 0 1.5px #64748B; }
.status-badge.s-offline { background: #E2E8F0; color: #1E293B; }

/* Live dot */
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-fixed); position: relative; flex: none; display: inline-block; }
.live-dot::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--c-fixed); opacity: 0; animation: ping 1.8s ease-out infinite; }
.live-dot-sm { width: 6px; height: 6px; }
.live-dot-sm::after { inset: -3px; border-width: 1.5px; }
@keyframes ping { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(1.8); opacity: 0; } }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--brand); animation: spin .8s linear infinite; }
.spinner-sm { width: 14px; height: 14px; border-width: 2px; display: inline-block; }
.btn-primary .spinner-sm { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Cards & pages */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; flex-wrap: wrap; }
.card-head h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; margin-right: auto; }
.card-head h3 .ic { color: var(--text-3); }
.card-sub { padding: 4px 18px 0; color: var(--text-3); font-size: 12.5px; }
.card-note { padding: 10px 18px 16px; display: flex; gap: 6px; flex-wrap: wrap; }

.page { height: 100%; overflow: auto; padding: 24px 28px 32px; }
.page-fixed { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 20px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head h1 { font-size: 24px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }

/* ===================================================================== MAP */
.map { position: absolute; inset: 0; z-index: 0; background: #DDE5EE; }
.leaflet-container { font-family: var(--font); }
.map-overlay { position: absolute; z-index: 10; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.map-overlay > * { pointer-events: auto; }
.map-tl { top: 16px; left: 16px; width: 340px; max-height: calc(100% - 32px); }
.map-tr { top: 16px; right: 16px; align-items: flex-end; }
.map-br { right: 16px; bottom: 28px; align-items: flex-end; }
.map-bl { left: 16px; bottom: 28px; }

.panel {
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px 8px 14px; }
.panel-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; flex-wrap: wrap; }
.panel-title .ic { width: 15px; height: 15px; color: var(--text-3); }

/* Search */
.search-box {
  position: relative; display: flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 12px 0 14px;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-2);
  border: 1px solid rgba(226, 232, 240, .9);
}
.search-box:focus-within { box-shadow: var(--shadow-2), 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.search-box > .ic { color: var(--text-4); }
.search-box input { flex: 1; border: 0; outline: none; background: none; min-width: 0; font-size: 14px; }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box kbd { font: 600 11px var(--mono); color: var(--text-4); border: 1px solid var(--border-2); border-bottom-width: 2px; padding: 1px 6px; border-radius: 5px; }
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-3); border: 1px solid var(--border);
  padding: 6px; max-height: 420px; overflow: auto; z-index: 30;
}
.sres { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 0; border-radius: 9px; background: none; text-align: left; }
.sres:hover, .sres.is-active { background: var(--surface-3); }
.sres-ic { width: 26px; height: 26px; display: grid; place-items: center; background: var(--sw); color: #fff; flex: none; border-radius: 50%; }
.sres-ic.station { border-radius: 7px; }
.sres-ic.s-nodata { color: #334155; box-shadow: inset 0 0 0 1.5px #64748B; }
.sres-ic .ic { width: 14px; height: 14px; }
.sres-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sres-go { color: var(--text-4); width: 15px; height: 15px; opacity: 0; }
.sres:hover .sres-go, .sres.is-active .sres-go { opacity: 1; }
.sr-empty { display: flex; gap: 10px; align-items: center; padding: 12px; color: var(--text-3); font-size: 12.5px; }
.sr-empty b { display: block; color: var(--text); }

/* Filters */
.filters { overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.filters .panel-body { padding: 0 12px 12px; overflow: auto; }
.filters.is-collapsed .panel-body { display: none; }
.filters .panel-head { cursor: grab; touch-action: none; user-select: none; }
.filters.is-dragging { box-shadow: var(--shadow-3); }
.filters.is-dragging .panel-head { cursor: grabbing; }
.panel-title .panel-grip { width: 14px; height: 14px; margin-left: -6px; margin-right: -4px; color: var(--text-4); }
.filter-group + .filter-group { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.fg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.fg-icon { width: 24px; height: 24px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.fg-icon .ic { width: 14px; height: 14px; }
.fg-rover { border-radius: 50%; }
.fg-station { border-radius: 6px; }
.fg-title { font-weight: 600; font-size: 13px; flex: 1; }
.fg-total { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; }
.fg-scope { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding: 9px 10px; border-radius: 10px; background: var(--surface-2); font-size: 12px; color: var(--text-2); }
.fg-scope > .ic { width: 15px; height: 15px; color: var(--text-3); margin-top: 1px; }
.fg-scope > span:not(.anno) { flex: 1; min-width: 200px; }

.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.chips-inline { display: flex; flex-wrap: wrap; }
.chip {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); text-align: left; font-size: 12.5px;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--border-2); background: var(--surface-2); }
.chip-swatch {
  width: 16px; height: 16px; flex: none; display: grid; place-items: center;
  background: var(--sw); border: 1.5px solid var(--sw); color: #fff; border-radius: 50%;
  transition: background .15s;
}
.chip-station .chip-swatch { border-radius: 5px; }
.chip.s-nodata .chip-swatch { border-color: #64748B; color: #334155; }
.chip-swatch .ic { width: 10px; height: 10px; stroke-width: 3.4; }
.chip-label { flex: 1; white-space: nowrap; font-weight: 500; }
.chip-count { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-2); }
.chip.is-off { background: var(--surface-2); color: var(--text-4); border-style: dashed; }
.chip.is-off .chip-swatch { background: transparent; }
.chip.is-off .chip-swatch .ic { opacity: 0; }
.chip.is-off .chip-count { color: var(--text-4); }
.chip-sm { padding: 5px 9px; }

/* Map buttons */
.live-pill {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 6px 0 12px;
  background: var(--surface); border-radius: 999px; box-shadow: var(--shadow-2); font-size: 12.5px;
  border: 1px solid rgba(226, 232, 240, .9);
}
.live-pill .live-txt { color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.live-pill .live-txt b { color: var(--text); }
.live-pill.is-paused .live-dot { background: var(--text-4); }
.live-pill.is-paused .live-dot::after { display: none; }

.map-btn {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  background: var(--surface); border: 1px solid rgba(226, 232, 240, .9); border-radius: 12px; box-shadow: var(--shadow-2);
  font-weight: 600; font-size: 13px; color: var(--text-2);
}
.map-btn:hover, .map-btn.is-active { color: var(--brand-ink); background: var(--brand-soft); }

.map-ctrl-group { display: flex; flex-direction: column; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-2); overflow: hidden; border: 1px solid rgba(226, 232, 240, .9); }
.map-ctrl { width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: var(--surface); color: var(--text-2); }
.map-ctrl:hover { background: var(--surface-3); color: var(--text); }
.map-ctrl-group .map-ctrl + .map-ctrl { border-top: 1px solid var(--border); }
.map-ctrl-solo { border-radius: 12px; box-shadow: var(--shadow-2); border: 1px solid rgba(226, 232, 240, .9); }

/* Layers panel */
.layers-panel { width: 320px; padding-bottom: 6px; }
.lp-section { padding: 4px 14px 10px; }
.lp-section + .lp-section { border-top: 1px solid var(--border); padding-top: 10px; }
.lp-title { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-4); margin-bottom: 8px; }
.lp-title .anno { text-transform: none; letter-spacing: 0; }
.basemaps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.basemap { border: 0; background: none; padding: 0; display: flex; flex-direction: column; gap: 5px; align-items: center; font-size: 11.5px; font-weight: 500; color: var(--text-2); }
.bm-thumb { width: 100%; aspect-ratio: 1; border-radius: 10px; background-size: cover; background-position: center; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .1); transition: box-shadow .15s; background-color: var(--surface-3); }
.basemap:hover .bm-thumb { box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .1), 0 0 0 2px var(--border-2); }
.basemap.is-active .bm-thumb { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }
.basemap.is-active { color: var(--brand-ink); font-weight: 600; }

/* Coverage legend */
.coverage-legend { width: 300px; padding: 12px 14px; }
.cov-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cov-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.cov-title .ic { color: var(--c-cov); width: 16px; height: 16px; }
.cov-row { display: flex; gap: 10px; align-items: flex-start; padding: 4px 0; font-size: 12.5px; }
.cov-row b { display: block; font-weight: 600; }
.cov-row small { color: var(--text-3); font-size: 11.5px; }
.cov-sw { width: 22px; height: 14px; border-radius: 4px; flex: none; margin-top: 2px; }
.cov-in { background: color-mix(in srgb, var(--c-cov) 34%, white); }
.cov-out { background: color-mix(in srgb, var(--c-cov) 15%, white); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c-cov) 20%, white); }
.cov-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); }
.cov-foot .ic { width: 13px; height: 13px; }
.cov-annos { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.cov-annos:not(:has(.anno)) { display: none; }
body:not(.show-annotations) .cov-annos { display: none; }
.cov-err { display: flex; gap: 10px; font-size: 12.5px; }
.cov-err b { display: block; }
.cov-err span { color: var(--text-3); }
.cov-err-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--warn-bg); color: var(--warn); flex: none; }
.cov-actions { display: flex; gap: 6px; margin-top: 10px; justify-content: flex-end; }

/* Markers */
.mk-wrap { background: none; border: 0; }
.mk {
  width: 100%; height: 100%; display: grid; place-items: center;
  background: var(--sw); color: #fff; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .35);
  transition: transform .15s;
}
.mk .ic { width: 13px; height: 13px; stroke-width: 2.3; }
.mk-rover { border-radius: 50%; }
.mk-station { border-radius: 7px; }
.mk-station .ic { width: 14px; height: 14px; }
.mk.s-nodata { border-color: #64748B; color: #334155; }
.mk.s-float { color: #422006; }
.mk-wrap:hover .mk { transform: scale(1.15); }
.mk-wrap.is-selected { z-index: 1000 !important; }
.mk-wrap.is-selected .mk { transform: scale(1.3); box-shadow: 0 0 0 3px var(--brand), 0 6px 14px rgba(15, 23, 42, .35); }
.mk-wrap.is-selected::after {
  content: ''; position: absolute; inset: -10px; border-radius: 50%;
  border: 2px solid var(--brand); animation: ping 1.6s ease-out infinite; pointer-events: none;
}
.mk-tip {
  background: #0F172A; color: #fff; border: 0; border-radius: 7px; padding: 4px 8px;
  font: 600 12px var(--mono); box-shadow: var(--shadow-2);
}
.mk-tip::before { border-top-color: #0F172A !important; }

.cl-wrap { background: none; border: 0; }
.cl {
  width: 100%; height: 100%; border-radius: 50%; padding: 4px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .28);
  transition: transform .15s;
}
.cl span {
  width: 100%; height: 100%; display: grid; place-items: center; border-radius: 50%;
  background: #fff; color: var(--text); font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums;
}
.cl-rover span { background: color-mix(in srgb, var(--c-fixed) 42%, #0F172A); color: #F8FAFC; }
.cl-station { border-radius: 11px; }
.cl-station span { border-radius: 6px; background: color-mix(in srgb, var(--c-online) 38%, #0F172A); color: #F8FAFC; }
.cl-wrap:hover .cl { transform: scale(1.08); }
.is-dark-base .cl { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .8), 0 2px 8px rgba(0, 0, 0, .4); }

.leaflet-control-attribution { font-size: 10.5px; background: rgba(255, 255, 255, .78) !important; border-radius: 6px 0 0 0; }

/* ================================================================= DRAWER */
.drawer {
  position: absolute; top: 12px; right: 12px; bottom: auto; width: var(--drawer-w); z-index: 50;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-3); border: 1px solid var(--border);
  transform: translateX(calc(100% + 24px)); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  overflow: hidden;
}
.drawer.is-open { transform: none; }
.drawer-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--border); }
.dh-top { display: flex; gap: 12px; align-items: flex-start; }
.dh-icon { width: 44px; height: 44px; display: grid; place-items: center; background: var(--sw); color: #fff; flex: none; box-shadow: 0 2px 6px rgba(15, 23, 42, .2); }
.dh-icon.rover { border-radius: 50%; }
.dh-icon.station { border-radius: 12px; }
.dh-icon.s-nodata { color: #334155; box-shadow: inset 0 0 0 2px #64748B; }
.dh-icon.s-float { color: #422006; }
.dh-icon .ic { width: 22px; height: 22px; }
.dh-title { flex: 1; min-width: 0; }
.dh-kicker { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); font-weight: 500; }
.dh-title h2 { font-size: 17px; display: flex; align-items: center; gap: 4px; word-break: break-all; margin: 2px 0 6px; }
.dh-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); }
.dh-actions { display: flex; gap: 8px; margin-top: 14px; }
.dh-actions .btn { flex: 1; }
.dh-admin { margin-top: 12px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.dh-admin-txt { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--text-2); }
.dh-admin-txt .ic { width: 15px; height: 15px; color: var(--text-3); margin-top: 1px; }
.dh-admin .switch-row { padding: 6px 0 0; }

.drawer-body { flex: 1; overflow: auto; padding: 14px 0 6px; background: var(--surface-2); }
.drawer-body:empty { display: none; }
.drawer-head:has(+ .drawer-body:empty) { border-bottom: none; }
.dsec { margin: 0 14px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.dsec.is-na-hidden { border-style: dashed; }
.dsec-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--surface-3); }
.dsec-title { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 12.5px; margin-right: auto; }
.dsec-title .ic { width: 15px; height: 15px; color: var(--text-3); }
.dsec-hint { padding: 6px 12px 0; font-size: 11.5px; color: var(--text-3); }
.dsec-foot { padding: 0 14px 12px; }
.kv { padding: 4px 0; }
.kv-row { display: flex; gap: 12px; padding: 6px 12px; font-size: 13px; align-items: baseline; }
.kv-row + .kv-row { border-top: 1px solid var(--surface-3); }
.kv-k { width: 46%; flex: none; color: var(--text-3); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.kv-unit { color: var(--text-4); font-size: 11.5px; }
.kv-v { flex: 1; min-width: 0; font-weight: 500; font-variant-numeric: tabular-nums; word-break: break-word; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.kv-sub { color: var(--text-3); font-weight: 400; font-size: 12px; }
.kv-row.is-na-hidden .kv-v { color: var(--text-3); }
.na-mark { display: inline-grid; place-items: center; color: var(--text-4); cursor: help; }
.na-mark .ic { width: 13px; height: 13px; }
.kv-custom { padding: 6px 12px 8px; }

.sat-table { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-size: 12px; }
.sat-table th { font-weight: 600; color: var(--text-3); padding: 2px 4px; text-align: center; font-size: 11.5px; }
.sat-table tbody th { text-align: left; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.sat-table td { text-align: center; padding: 0 2px; }
.sat-pill { display: inline-block; min-width: 28px; padding: 3px 6px; border-radius: 7px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.sat-pill.tracked { background: #1E3A5F; }
.sat-pill.fkp { background: var(--c-fixed); }
.sat-pill.nofkp { background: var(--c-nofix); }
.sat-pill.is-zero { background: var(--surface-3); color: var(--text-4); }
.sat-details { margin-top: 6px; border-top: 1px solid var(--surface-3); padding-top: 8px; }
.sat-details summary { list-style: none; display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.sat-details summary::-webkit-details-marker { display: none; }
.sat-details summary .ic { width: 14px; height: 14px; transition: transform .15s; }
.sat-details[open] summary .ic { transform: rotate(90deg); }
.prn-block { margin-top: 10px; }
.prn-title { font-size: 11px; font-weight: 600; color: var(--text-3); margin-bottom: 4px; }
.prn-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.prn { font: 600 9.5px/1 var(--mono); text-align: center; padding: 4px 0; border-radius: 4px; color: var(--text-4); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.prn-fkp { background: var(--c-fixed); color: #fff; box-shadow: none; }
.prn-nofkp { background: var(--c-nofix); color: #fff; box-shadow: none; }
.sat-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 11px; color: var(--text-3); }
.sat-legend span { display: flex; align-items: center; gap: 5px; }
.sat-legend i { width: 10px; height: 10px; border-radius: 3px; }
.lg-fkp { background: var(--c-fixed); }
.lg-nofkp { background: var(--c-nofix); }
.lg-none { box-shadow: inset 0 0 0 1px var(--border-2); }

/* ================================================================ HISTORY */
.hist-form { display: flex; align-items: flex-end; gap: 12px; padding: 14px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.field-grow { flex: 1; min-width: 180px; }
.field.has-error .input-icon input { border-color: var(--err); box-shadow: 0 0 0 3px rgba(185, 28, 28, .12); }
.field-btn .btn { height: 40px; }
.field .segmented { height: 40px; align-items: center; }
.range-inputs { display: flex; align-items: center; gap: 6px; color: var(--text-3); }
.range-inputs input { width: 200px; padding-right: 8px; }
.field.has-error .range-inputs input { border-color: var(--err); box-shadow: 0 0 0 3px rgba(185, 28, 28, .12); }

.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-3); padding: 6px;
}
.sug { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; text-align: left; }
.sug .ic { width: 15px; height: 15px; color: var(--text-4); }
.sug:hover, .sug.is-active { background: var(--surface-3); }
.sug .mono { flex: 1; font-weight: 500; }
.sug-sub { font-size: 11.5px; color: var(--text-3); }

.hist-main { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.hm-state { flex: 1; overflow: auto; display: flex; flex-direction: column; justify-content: center; }
.hm-content { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }

/* States */
.state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 28px; gap: 10px; }
.state-ic { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); margin-bottom: 4px; }
.state-ic .ic { width: 26px; height: 26px; }
.state h3 { font-size: 16px; }
.state p { color: var(--text-3); max-width: 380px; font-size: 13px; }
.state-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; margin-top: 8px; }
.state-warn .state-ic { background: var(--warn-bg); color: var(--warn); }
.state-error .state-ic { background: var(--err-bg); color: var(--err); }
.examples { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; font-size: 12px; color: var(--text-3); }
.ex-chip { border: 1px solid var(--border-2); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 500; }
.ex-chip:hover { border-color: var(--brand); color: var(--brand-ink); background: var(--brand-soft); }

.hm-empty { flex: 1; display: flex; flex-direction: column; }
.hm-empty > .state { flex: 1; justify-content: center; }
.hm-idle { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 0 28px 32px; }
.hm-idle .state { padding-bottom: 6px; }
.howto-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 260px)); gap: 12px; }
.howto-steps li { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); text-align: left; }
.howto-steps b { display: block; font-size: 13.5px; }
.howto-steps span:not(.hs-n) { font-size: 12.5px; color: var(--text-3); }
.hs-n { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: none; }

/* Skeleton */
.skel { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--surface-3) 0%, #F8FAFC 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-head { display: flex; gap: 12px; align-items: center; padding: 18px; }
.skel-circle { width: 40px; height: 40px; border-radius: 50%; }
.skel-line { height: 14px; }
.w40 { width: 40%; }
.hm-skel { flex: 1; display: flex; flex-direction: column; align-self: stretch; height: 100%; }
.hm-skel-body { flex: 1; display: grid; grid-template-columns: 1fr 300px; gap: 16px; padding: 0 18px 18px; min-height: 320px; }
.hm-skel-body .skel { border-radius: var(--radius); }

/* Results header */
.hm-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px 12px; flex-wrap: wrap; }
.hr-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--sw); color: #fff; flex: none; }
.hr-ic.s-float { color: #422006; }
.hr-ic .ic { width: 20px; height: 20px; }
.hm-id { flex: 1 1 580px; min-width: 0; }
.hm-name { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-weight: 700; font-size: 16px; }
.hm-name .link-btn { font-size: 12.5px; font-weight: 500; }
.hm-period { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 3px; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.hm-period .ic { width: 14px; height: 14px; color: var(--text-3); }
.hm-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hm-tools .segmented .ic { width: 14px; height: 14px; }
.dot-sep { color: var(--text-4); margin: 0 2px; }

.hist-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; background: var(--info-bg); color: #1E3A8A; font-family: var(--font); font-size: 11.5px; font-weight: 600; }
.hist-badge .ic { width: 13px; height: 13px; }
.hm-name .anno { margin-left: -6px; }

.hm-runs { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin: 0 18px 12px; padding-top: 10px; border-top: 1px solid var(--surface-3); font-size: 12px; }
.hm-runs-k { font-weight: 600; color: var(--text-2); }
.hm-runs-list { display: flex; gap: 6px; flex-wrap: wrap; }
.run-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text); }
button.run-chip:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.run-chip.is-static { background: var(--surface-2); }
.run-d { color: var(--text-3); font-weight: 600; }
.hm-runs-notes { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.run-note { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 999px; font-weight: 500; }
.run-note .ic { width: 13px; height: 13px; }
.run-live { background: var(--ok-bg); color: #14532D; }
.run-live .link-btn { font-size: 12px; }
.run-warn { background: var(--surface-3); color: var(--text-2); }

.alert { display: flex; align-items: flex-start; gap: 9px; padding: 9px 12px; border-radius: 10px; font-size: 12.5px; }
.alert .ic { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.alert .live-dot { margin: 5px 3px 0; }
.alert-info { background: var(--ok-bg); color: #14532D; }
.alert-warn { background: var(--warn-bg); color: #78350F; }
.alert-muted { background: var(--surface-3); color: var(--text-2); }
.alert-error { background: var(--err-bg); color: var(--err); }

/* Map view */
.hm-pane { flex: 1; min-height: 0; }
.hm-map-pane { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; padding: 0 18px 16px; min-height: 400px; }
.hm-map-col { display: flex; flex-direction: column; min-height: 0; }
.sd-map-wrap { position: relative; flex: 1; min-height: 300px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
#sessionMap { position: absolute; inset: 0; z-index: 0; background: #DDE5EE; }
.sd-map-overlay { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.sd-map-overlay > * { pointer-events: auto; }
.sd-base { position: absolute; top: 10px; right: 10px; box-shadow: var(--shadow-2); background: rgba(255, 255, 255, .92); }
.sd-legend {
  position: absolute; left: 10px; bottom: 34px; display: flex; flex-wrap: wrap; gap: 4px 12px; max-width: calc(100% - 20px);
  padding: 7px 10px; border-radius: 10px; background: rgba(255, 255, 255, .94); box-shadow: var(--shadow-2); font-size: 11.5px; font-weight: 500;
}
.sd-legend span { display: flex; align-items: center; gap: 6px; }
.lg-line { width: 18px; height: 4px; border-radius: 2px; background: var(--q); }
.lg-gap { background: repeating-linear-gradient(90deg, #64748B, #64748B 3px, transparent 3px, transparent 6px); }
.sd-map-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: rgba(248, 250, 252, .82); backdrop-filter: blur(2px); color: var(--text-2); font-size: 13px; }
.sd-map-msg .ic { width: 28px; height: 28px; color: var(--text-4); margin-bottom: 4px; }
.sd-map-msg span { color: var(--text-3); font-size: 12.5px; }
.hm-side { overflow: auto; display: flex; flex-direction: column; gap: 12px; min-height: 0; }

.trace-casing { stroke: #fff; stroke-opacity: .95; fill: none; }
.is-dark-base .trace-casing { stroke: rgba(15, 23, 42, .55); }
.trace { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.trace-fixed { stroke: var(--c-fixed); }
.trace-float { stroke: var(--c-float); }
.trace-dgps { stroke: var(--c-dgps); }
.trace-nofix { stroke: var(--c-nofix); }
.trace-gap { stroke: #64748B; fill: none; }
.is-dark-base .trace-gap { stroke: #fff; }
.tl-map-cursor { fill: var(--q, #0F172A); stroke: #fff; }

.sd-pin-wrap { background: none; border: 0; }
.sd-pin { width: 100%; height: 100%; display: grid; place-items: center; border-radius: 50%; border: 2.5px solid #fff; color: #fff; font-weight: 800; font-size: 11px; box-shadow: 0 2px 6px rgba(15, 23, 42, .4); }
.sd-start { background: #0F172A; }
.sd-end { background: #475569; }
.sd-live { background: var(--c-fixed); position: relative; }
.sd-live .ic { width: 14px; height: 14px; }
.sd-live::after { content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid var(--c-fixed); animation: ping 1.6s ease-out infinite; }
.sd-gap { width: auto; height: auto; border-radius: 999px; border: 0; padding: 3px 8px; background: #0F172A; color: #fff; font-size: 11px; font-weight: 600; white-space: nowrap; transform: translate(-50%, -50%); display: inline-flex; gap: 4px; position: absolute; }
.sd-gap .ic { width: 11px; height: 11px; }

.sd-tl { margin-top: 12px; }
.sd-tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; margin-bottom: 8px; }
.sd-tl-read { margin-left: auto; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.sd-tl-read b { color: var(--text); }
.tl-bar { position: relative; height: 22px; border-radius: 7px; overflow: hidden; cursor: pointer; background: repeating-linear-gradient(45deg, #CBD5E1, #CBD5E1 3px, #F1F5F9 3px, #F1F5F9 7px); }
.tl-bar i { position: absolute; top: 0; bottom: 0; }
.tl-fixed { background: var(--c-fixed); }
.tl-float { background: var(--c-float); }
.tl-dgps { background: var(--c-dgps); }
.tl-nofix { background: var(--c-nofix); }
.tl-cursor { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: #0F172A; box-shadow: 0 0 0 1.5px #fff; pointer-events: none; }
.tl-axis { position: relative; height: 18px; margin-top: 4px; font-size: 11px; color: var(--text-4); font-variant-numeric: tabular-nums; }
.tl-axis span { position: absolute; transform: translateX(-50%); }
.tl-axis span:first-child { transform: none; }
.tl-axis span:last-child { transform: translateX(-100%); }

.hm-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 11px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); min-width: 0; }
.stat-k { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); font-weight: 500; }
.stat-k .ic { width: 14px; height: 14px; flex: none; }
.stat-v { font-size: 18px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat-sub { font-size: 11.5px; color: var(--text-3); }
.stat-bar { display: block; height: 4px; border-radius: 2px; margin-top: 8px; background: var(--surface-3); overflow: hidden; }
.stat-bar i { display: block; height: 100%; background: var(--c-fixed); }

.qtable { padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); }
.qtable-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; margin-bottom: 6px; }
.qrow { display: grid; grid-template-columns: 86px 1fr 38px 54px; gap: 8px; align-items: center; padding: 5px 0; font-size: 12.5px; }
.qrow-k { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.sw-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--q); flex: none; }
.qrow-bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.qrow-bar i { display: block; height: 100%; background: var(--q); border-radius: 4px; }
.qrow-v { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.qrow-t { color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }

/* Table view */
.hm-table-pane { display: flex; flex-direction: column; margin: 0 18px 16px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; min-height: 360px; }
.rec-wrap { flex: 1; min-height: 0; max-height: none; }
.rec-table th { cursor: default; }
.rec-table th:hover { color: var(--text-3); }
.rec-table td { padding: 7px 14px; font-variant-numeric: tabular-nums; }
.rec-table tr.is-hl td { background: var(--brand-soft); }
.rec-table tr.no-pos td { color: var(--text-3); }
.rec-table tbody tr.rec-gap { cursor: default; }
.rec-table tbody tr.rec-gap:hover { background: none; }
.rec-gap td { padding: 5px 14px; background: repeating-linear-gradient(45deg, #F1F5F9, #F1F5F9 6px, #F8FAFC 6px, #F8FAFC 12px); color: var(--text-3); font-size: 11.5px; font-weight: 600; }
.rec-gap .ic { width: 12px; height: 12px; vertical-align: -2px; margin-right: 4px; }
.rec-foot { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 12.5px; flex-wrap: wrap; }
.rec-pager { display: flex; align-items: center; gap: 2px; margin: 0 auto; }
.rec-page { padding: 0 10px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ================================================================= ROVERS */
.table-card { overflow: hidden; display: flex; flex-direction: column; }
.table-toolbar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.table-toolbar .input-icon { width: 260px; }
.table-count { margin-left: auto; font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.table-wrap { overflow: auto; max-height: calc(100vh - var(--topbar-h) - 250px); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2);
  text-align: left; font-weight: 600; font-size: 12px; color: var(--text-3);
  padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; cursor: pointer; user-select: none;
}
.table th:hover { color: var(--text); }
.table th.is-sorted { color: var(--text); }
.table th.is-sorted::after { content: ' ↑'; }
.table th.is-sorted.is-desc::after { content: ' ↓'; }
.table td { padding: 9px 14px; border-bottom: 1px solid var(--surface-3); white-space: nowrap; }
.table tbody tr { cursor: pointer; transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions-col { text-align: right; width: 90px; cursor: default; }
.table td.actions-col .icon-btn { opacity: .5; }
.table tr:hover td.actions-col .icon-btn { opacity: 1; }
.cell-rover { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.cell-ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--sw); color: #fff; }
.cell-ic.s-float { color: #422006; }
.cell-ic .ic { width: 13px; height: 13px; }
.empty-row td { text-align: center; color: var(--text-3); padding: 40px; }
.table-foot { display: flex; justify-content: center; gap: 4px; padding: 10px; }
.table-foot:empty { display: none; }
.page-btn { min-width: 32px; height: 32px; border: 1px solid transparent; border-radius: 8px; background: none; font-size: 12.5px; font-weight: 500; display: inline-grid; place-items: center; color: var(--text-2); }
.page-btn:hover:not(:disabled) { background: var(--surface-3); }
.page-btn.is-active { border-color: var(--brand); color: var(--brand-ink); background: var(--brand-soft); font-weight: 700; }
.page-btn:disabled { opacity: .35; cursor: default; }
.page-btn .ic { width: 15px; height: 15px; }
.page-gap { display: inline-grid; place-items: center; width: 24px; color: var(--text-4); }

/* =============================================================== SETTINGS */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 10px 14px 12px; border: 0; background: none; color: var(--text-3); font-weight: 600; font-size: 13.5px;
}
.tab .ic { width: 16px; height: 16px; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--brand-ink); }
.tab.is-active::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2.5px; border-radius: 2px 2px 0 0; background: var(--brand); }
.tab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tbc); }
.has-savebar { padding-bottom: 96px; }

.set-grid { display: grid; gap: 16px; align-items: start; }
.set-grid-stations { grid-template-columns: 290px minmax(380px, 1fr) 360px; }
.set-grid-fields { grid-template-columns: minmax(420px, 1fr) 420px; }

.rule-list { list-style: none; margin: 12px 0 0; padding: 0 10px; display: flex; flex-direction: column; gap: 4px; }
.rule-item {
  position: relative; width: 100%; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px; border: 1px solid transparent; border-radius: 11px; background: none; text-align: left;
}
.rule-item:hover { background: var(--surface-2); }
.rule-item.is-active { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }
.ri-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.rule-item.is-active .ri-ic { background: var(--surface); color: var(--brand-ink); }
.ri-ic .ic { width: 16px; height: 16px; }
.ri-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ri-title { font-weight: 600; font-size: 13px; }
.ri-sub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri-tag { font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-3); }
.ri-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ri-tags:empty { display: none; }
.ri-dot { position: absolute; top: 10px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--tbc); }

.set-editor { padding-bottom: 16px; }
.set-editor > *:not(.card-head):not(.card-note) { margin-left: 18px; margin-right: 18px; }
.set-editor .card-note { padding-bottom: 0; }
.set-editor .alert { margin-top: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; margin-bottom: 18px; }
.radio-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.radio-card {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s;
}
.radio-card:hover { border-color: var(--border-2); }
.radio-card.is-active { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand); }
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.rc-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.radio-card.is-active .rc-ic { background: var(--surface); color: var(--brand-ink); }
.rc-ic .ic { width: 16px; height: 16px; }
.rc-txt b { display: block; font-size: 13px; }
.rc-txt small { font-size: 11.5px; color: var(--text-3); }

.country-picker { margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; max-height: 360px; overflow: auto; }
.country-picker.is-disabled { opacity: .45; }
.cp-region + .cp-region { border-top: 1px solid var(--border); }
.cp-region-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; background: var(--surface-2); font-size: 13px; position: sticky; top: 0; z-index: 1; }
.cp-region-head .muted { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; }
.cp-countries { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px 12px; padding: 6px 12px 10px 38px; }
.cp-country { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 12.5px; cursor: pointer; }
.cp-country .muted { margin-left: auto; font-size: 11.5px; font-variant-numeric: tabular-nums; }

.set-preview { overflow: hidden; position: sticky; top: 0; }
.preview-map { height: 210px; margin: 12px 18px 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: #EEF2F7; }
.preview-stats { padding: 14px 18px 18px; }
.ps-big { display: flex; align-items: baseline; gap: 8px; }
.ps-big b { font-size: 26px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ps-big span { color: var(--text-3); font-size: 13px; }
.ps-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.ps-list li { display: flex; gap: 8px; align-items: flex-start; }
.ps-list .ic { width: 15px; height: 15px; color: var(--ok); margin-top: 1px; }
.ps-empty { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; padding: 9px 11px; border-radius: 10px; background: var(--info-bg); color: #1E3A8A; font-size: 12.5px; }
.ps-empty .ic { width: 15px; height: 15px; margin-top: 1px; }

.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--brand-soft); color: var(--text-2); font-size: 13px; margin-bottom: 16px; }
.callout b { display: block; color: var(--text); margin-bottom: 2px; }
.callout-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--surface); color: var(--brand-ink); display: grid; place-items: center; flex: none; }
.fields-col { display: flex; flex-direction: column; gap: 16px; }
.fields-col .callout { margin-bottom: 0; }
.fields-card { padding-bottom: 8px; }
.fields-card .card-note { padding-bottom: 8px; }
.count-pill { font-size: 12px; color: var(--text-3); padding: 3px 9px; border-radius: 999px; background: var(--surface-3); font-variant-numeric: tabular-nums; }
.count-pill b { color: var(--text); }
.fgroup { margin: 0 14px 10px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.fgroup-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface-2); cursor: pointer; }
.fgroup-title { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; flex: 1; }
.fgroup-title .ic { width: 15px; height: 15px; color: var(--text-3); }
.fgroup-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.frow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px 8px 39px; border-top: 1px solid var(--surface-3); cursor: pointer; font-size: 13px; position: relative; }
.frow:hover { background: var(--surface-2); }
.frow-label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.frow.is-locked { cursor: default; color: var(--text-2); }
.frow-lock { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-4); }
.frow-lock .ic { width: 12px; height: 12px; }
.frow.is-changed::before { content: ''; position: absolute; left: 18px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--tbc); }

.preview-col { position: sticky; top: 0; }
.fields-preview { overflow: hidden; }
.preview-drawer { margin: 12px 0 0; padding: 14px 0 4px; background: var(--surface-2); border-top: 1px solid var(--border); max-height: calc(100vh - var(--topbar-h) - 260px); overflow: auto; }

.savebar {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px;
  background: #0F172A; color: #fff; border-radius: 14px; box-shadow: var(--shadow-3);
  animation: rise .25s ease-out;
}
.savebar-txt { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-right: 8px; color: rgba(255, 255, 255, .78); }
.savebar-txt b { color: #fff; }
.savebar-dot { width: 8px; height: 8px; border-radius: 50%; background: #FBBF24; }
.savebar .btn-ghost { color: rgba(255, 255, 255, .85); }
.savebar .btn-ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }
@keyframes rise { from { transform: translate(-50%, 20px); opacity: 0; } }

/* ========================================================= PROTO & GATE */
.proto-panel {
  position: fixed; left: calc(var(--rail-w) + 10px); bottom: 14px; z-index: 900; width: 340px;
  max-height: calc(100vh - var(--topbar-h) - 28px); overflow: auto;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-3);
  border: 1.5px solid color-mix(in srgb, var(--ux) 30%, var(--border));
}
.pp-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 14px 14px 10px 16px; background: var(--ux-bg); border-bottom: 1px solid color-mix(in srgb, var(--ux) 15%, transparent); position: sticky; top: 0; z-index: 2; }
.pp-title { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ux); font-size: 14px; }
.pp-sub { font-size: 11.5px; color: color-mix(in srgb, var(--ux) 70%, var(--text-3)); margin-top: 2px; }
.pp-body { padding: 4px 16px 14px; }
.pp-section { padding: 12px 0; }
.pp-section + .pp-section { border-top: 1px solid var(--border); }
.pp-label { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: 8px; }
.pp-label .anno { text-transform: none; letter-spacing: 0; }
.pp-profiles { display: flex; flex-direction: column; gap: 4px; }
.pp-profile { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); text-align: left; }
.pp-profile:hover { background: var(--surface-2); }
.pp-profile.is-active { border-color: var(--brand); background: var(--brand-soft); }
.pp-profile-txt { flex: 1; display: flex; flex-direction: column; }
.pp-profile-txt b { font-size: 13px; }
.pp-profile-txt small { font-size: 11.5px; color: var(--text-3); }
.pp-check { color: var(--brand-ink); }
.pp-legend { font-size: 11.5px; color: var(--text-3); line-height: 2; margin-top: 4px; }
.pp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.gate {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 600px at 20% 0%, color-mix(in srgb, var(--brand) 55%, transparent), transparent 60%),
    radial-gradient(900px 600px at 100% 100%, color-mix(in srgb, var(--brand) 35%, transparent), transparent 60%),
    #0B1220;
  animation: fade .25s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.gate-card { width: min(460px, 100%); background: var(--surface); border-radius: 22px; box-shadow: 0 40px 80px rgba(0, 0, 0, .35); overflow: hidden; }
.gate-brand { display: flex; align-items: center; gap: 14px; padding: 18px 24px; background: var(--topbar); color: #fff; box-shadow: inset 0 -3px 0 var(--accent); }
.gate-product { font-weight: 700; font-size: 16px; padding-left: 14px; border-left: 1px solid rgba(255, 255, 255, .3); }
.gate-body { padding: 28px 28px 22px; text-align: center; }
.gate-body h2 { font-size: 20px; margin-bottom: 8px; }
.gate-body p { color: var(--text-3); font-size: 13.5px; }
.gate-hop { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 22px; }
.hop-node { display: flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 10px; background: var(--surface-3); font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.hop-node .ic { width: 15px; height: 15px; }
.hop-node-on { background: var(--brand-soft); color: var(--brand-ink); }
.hop-dots { display: flex; gap: 4px; }
.hop-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); animation: blink 1.2s infinite; }
.hop-dots i:nth-child(2) { animation-delay: .2s; }
.hop-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
.gate-steps { list-style: none; margin: 18px 0 0; padding: 0; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.gate-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); font-size: 13.5px; transition: background .2s; }
.gs-ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 1.5px solid var(--border-2); }
.gs-ic .ic { width: 14px; height: 14px; stroke-width: 2.6; }
.gs-label { flex: 1; }
.gs-sys { font: 600 10.5px var(--mono); color: var(--text-4); padding: 2px 7px; border-radius: 6px; background: var(--surface-3); }
.gs-done .gs-ic { background: var(--ok); border-color: var(--ok); color: #fff; }
.gs-done { color: var(--text-2); }
.gs-run { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, transparent); font-weight: 600; }
.gs-run .gs-ic { border: 0; }
.gs-todo { color: var(--text-4); }
.gs-fail { background: var(--err-bg); border-color: #FECACA; color: var(--err); font-weight: 600; }
.gs-fail .gs-ic { background: var(--err); border-color: var(--err); color: #fff; }
.gate-state-ic { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; margin: 0 auto 14px; }
.gate-state-ic .ic { width: 28px; height: 28px; }
.gate-warn { background: var(--warn-bg); color: var(--warn); }
.gate-error { background: var(--err-bg); color: var(--err); }
.gate-muted { background: var(--surface-3); color: var(--text-2); }
.gate-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; }
.gate-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 11.5px; color: var(--text-4); }

/* Toasts */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column-reverse; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; min-width: 280px; max-width: 520px;
  background: #0F172A; color: #fff; border-radius: 12px; box-shadow: var(--shadow-3); font-size: 13px;
  opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s;
}
.toast.is-in { opacity: 1; transform: none; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); }
.toast-ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .14); flex: none; }
.toast-ic .ic { width: 13px; height: 13px; stroke-width: 2.6; }
.toast-success .toast-ic { background: var(--c-fixed); }
.toast-error .toast-ic { background: var(--c-nofix); }
.toast-msg { flex: 1; color: rgba(255, 255, 255, .88); }
.toast-msg b { color: #fff; }
.toast-action { border: 0; background: rgba(255, 255, 255, .14); color: #fff; padding: 5px 10px; border-radius: 8px; font-weight: 600; font-size: 12.5px; }
.toast-action:hover { background: rgba(255, 255, 255, .24); }
.toast-close { border: 0; background: none; color: rgba(255, 255, 255, .6); width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; }
.toast-close:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.toast-close .ic { width: 14px; height: 14px; }

/* ============================================================ Responsive */
@media (max-width: 1440px) {
  .set-grid-stations { grid-template-columns: 270px 1fr; }
  .set-preview { grid-column: 1 / -1; position: static; display: grid; grid-template-columns: 1fr 1fr; }
  .set-preview .card-head, .set-preview .card-sub { grid-column: 1 / -1; }
  .set-preview .preview-map { height: 230px; margin-bottom: 18px; }
}
@media (max-width: 1180px) {
  .clock-day { display: none; }
  .page-fixed { overflow: auto; }
  .hist-main { flex: none; overflow: visible; min-height: 640px; }
  .hm-content { overflow: visible; }
  .hm-map-pane { grid-template-columns: 1fr; }
  .sd-map-wrap { min-height: 380px; }
  .hm-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .howto-steps { grid-template-columns: 1fr; }
  .set-grid-fields { grid-template-columns: 1fr; }
  .preview-col { position: static; }
  .context-chip .cc-k { display: none; }
}
@media (max-width: 900px) {
  :root { --rail-w: 72px; --drawer-w: calc(100vw - var(--rail-w) - 24px); }
  .context-chip, .user-txt { display: none; }
  .set-grid-stations { grid-template-columns: 1fr; }
  .set-preview { display: block; }
  .radio-cards { grid-template-columns: 1fr; }
  .map-tl { width: calc(100% - 140px); }
}
