:root {
  --bg: #101113;
  --surface: #1c1f26;
  --text: #e7e8ea;
  --muted: #8b919a;
  --accent: #8b9cf7;
  --accent-soft: #23262e;
  --line: #2c313a;
  --ok: #3dba84;
  --ok-bg: rgba(61, 186, 132, .14);
  --warn: #d9a441;
  --warn-bg: rgba(217, 164, 65, .14);
  --bad: #e15d68;
  --bad-bg: rgba(225, 93, 104, .14);
  --nav: #14161a;
  --nav-text: #C5D0E0;
  --shadow: 0 10px 28px rgba(18, 32, 58, .06);
  --radius: 6px;
  --nav-h: 62px;
  --move: 160ms ease;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; max-width: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 "Segoe UI", "PT Sans", sans-serif;
  overflow-x: hidden;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
.shell { display: flex; min-height: 100dvh; }
.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--nav); color: var(--nav-text);
  padding: 16px 12px 12px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100dvh;
}
.brand { display: flex; gap: 10px; align-items: center; color: #fff; text-decoration: none; padding: 4px 8px 16px; }
.brand b { display: block; font-size: 15px; }
.brand small { display: block; color: #8E9BB3; font-size: 12px; margin-top: 1px; }
.logo {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: #24365C; color: #fff; font-weight: 750; font-size: 12px;
}
.brand-mark { color: var(--accent); font-weight: 700; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--nav-text);
  border-radius: 10px; padding: 9px 12px; transition: background-color var(--move), color var(--move);
}
.side-nav a svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a.on { background: var(--accent); color: #fff; }
.side-user { margin-top: auto; position: relative; padding-top: 12px; }
.user-btn {
  width: 100%; display: grid; grid-template-columns: 36px 1fr; gap: 8px; align-items: center;
  background: transparent; border: 0; color: inherit; text-align: left; border-radius: 12px; padding: 6px;
}
.user-btn:hover, .leave:hover { background: rgba(255,255,255,.06); }
.user-btn b { display: block; color: #fff; font-size: 14px; }
.user-btn small, .leave { display: block; color: #8E9BB3; font-size: 12px; }
.leave { text-decoration: none; padding: 8px; border-radius: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: #24365C; color: #fff; font-weight: 650; flex: 0 0 auto;
}
.avatar.lg { width: 56px; height: 56px; font-size: 20px; background: var(--accent-soft); color: var(--accent); }
.role-pop {
  position: absolute; left: 8px; right: 8px; bottom: 72px; background: #1c1f26; color: var(--text);
  border-radius: 6px; box-shadow: 0 16px 40px rgba(16, 24, 40, .18); padding: 8px; z-index: 20;
}
.role-pop p, .sheet-title { margin: 6px 8px; color: var(--muted); font-size: 12px; }
.role-pop button, .role-choice {
  width: 100%; text-align: left; background: transparent; border: 0; border-radius: 10px;
  min-height: 38px; padding: 8px 10px; color: var(--text);
}
.role-pop button.on, .role-choice.on { background: var(--accent-soft); color: var(--accent); }
.role-pop button:hover, .role-choice:hover { background: #F4F7FB; }
.role-pop .back { color: var(--accent); font-weight: 650; }
.main { flex: 1; min-width: 0; }
.preview-banner {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  background: #17315F; color: #fff; padding: 8px 16px; font-size: 14px;
}
.preview-banner button {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: 6px; min-height: 32px; padding: 0 12px;
}
.preview-banner button:hover { background: rgba(255,255,255,.08); }
.role-mobile { display: none; padding: 8px 16px 0; }
.role-mobile button { background: transparent; border: 0; color: var(--accent); padding: 0; font-weight: 650; }
@media (max-width: 768px) {
  .role-mobile button {
    display: inline-flex; align-items: center; height: 36px; padding: 0 12px;
    border-radius: 6px; border: 1px solid rgba(47, 111, 237, .35); background: #23262e;
  }
}
.command { padding: 16px 18px 28px; }
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.topbar h1, h1 { margin: 0; font-size: 26px; letter-spacing: -.03em; font-weight: 680; }
.search { display: flex; align-items: center; gap: 8px; background: #1c1f26; border-radius: 12px; padding: 0 12px; min-height: 40px; flex: 1; min-width: 180px; box-shadow: var(--shadow); }
.search svg { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 1.8; }
.search input, .topbar > input, .topbar > select, .float-card select, .float-card input, .page .search input {
  border: 0; background: transparent; min-height: 38px; width: 100%; outline: none;
}
.topbar > input, .topbar > select {
  background: #1c1f26; border-radius: 12px; padding: 0 10px; box-shadow: var(--shadow); min-width: 132px;
}
.sys { font-size: 13px; font-weight: 650; white-space: nowrap; }
.sys.ok { color: var(--ok); }
.sys.warn { color: var(--warn); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; background: #1c1f26; box-shadow: var(--shadow);
  display: grid; place-items: center; position: relative; text-decoration: none;
}
.icon-btn svg { width: 18px; height: 18px; stroke: var(--text); fill: none; stroke-width: 1.8; stroke-linecap: round; }
.icon-btn em {
  position: absolute; top: -4px; right: -4px; background: var(--bad); color: #fff;
  border-radius: 6px; font-style: normal; font-size: 11px; min-width: 16px; text-align: center; padding: 1px 4px;
}
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi-row article, .kind-row article {
  background: var(--surface); border-radius: 6px; padding: 12px 14px; box-shadow: var(--shadow);
}
.kpi-row b, .hero b { display: block; font-size: 30px; letter-spacing: -.04em; line-height: 1.05; }
.kpi-row span, .kind-row span { color: var(--muted); font-size: 13px; }
.kpi-row .ok b { color: var(--ok); }
.kpi-row .info b { color: var(--accent); }
.kpi-row .bad b { color: var(--bad); }
.stage { display: grid; grid-template-columns: minmax(0, 1fr) 332px; gap: 12px; }
.map-card { position: relative; min-height: 560px; border-radius: var(--radius); overflow: hidden; background: #E7EDF3; box-shadow: var(--shadow); }
#homeMap, #map { height: 100%; background: #E7EDF3; }
#homeMap { position: absolute; inset: 0; }
.float-card {
  position: absolute; z-index: 500; top: 12px; left: 12px; width: 210px;
  background: rgba(255,255,255,.96); border-radius: 6px; box-shadow: var(--shadow);
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.float-card b { font-size: 14px; }
.float-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.float-card select, .float-card input { background: var(--bg); border-radius: 10px; padding: 0 8px; }
.float-card.compact { width: auto; flex-direction: row; align-items: center; }
.filter-fab { display: none; }
.watch, .panel {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px;
}
.watch { max-height: 560px; display: flex; flex-direction: column; min-height: 0; }
.watch h2, .panel h2, h2 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.watch header, .panel header, .goal-block header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.watch header a, .panel header a, .text-link { color: var(--accent); text-decoration: none; font-weight: 650; background: transparent; border: 0; padding: 0; }
.seg { display: flex; gap: 4px; background: #E7EDF4; border-radius: 12px; padding: 3px; margin: 10px 0; overflow: auto; }
.seg button {
  border: 0; background: transparent; border-radius: 9px; min-height: 32px; padding: 0 10px; color: var(--muted); white-space: nowrap;
  transition: background-color var(--move), color var(--move);
}
.seg button.on, .seg button:hover { background: #1c1f26; color: var(--text); }
.watch-list { overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.watch-row {
  display: grid; grid-template-columns: 32px 1fr auto; gap: 8px; align-items: start;
  text-decoration: none; border-radius: 12px; padding: 8px; transition: background-color var(--move);
}
.watch-row:hover { background: #F6F8FB; }
.watch-row b, .watch-row strong { display: block; }
.watch-row strong { font-weight: 650; margin-top: 2px; }
.watch-row.bad strong { color: var(--bad); }
.watch-row.warn strong { color: var(--warn); }
.watch-row small, .watch-row time, .meta, .lede, .quiet { color: var(--muted); }
.watch-row time { font-size: 12px; }
.bottom-grid { display: grid; grid-template-columns: 1.15fr .9fr .95fr; gap: 12px; margin-top: 12px; }
.dense { list-style: none; margin: 10px 0 0; padding: 0; }
.dense li {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; align-items: center;
  padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px;
}
.people-now a {
  display: grid; grid-template-columns: 32px 1fr auto; gap: 8px; align-items: center;
  text-decoration: none; width: 100%; border-radius: 10px; padding: 4px;
}
.people-now a:hover { background: #F6F8FB; }
.people-now li { display: block; border: 0; padding: 2px 0; }
.progress-list li { grid-template-columns: 1fr auto; }
.progress-list .bar { grid-column: 1 / -1; }
.page { padding: 22px 24px 48px; max-width: 1120px; }
.page.wide { max-width: 1180px; }
.page.narrow { max-width: 560px; }
.page.cabinet { max-width: 880px; }
.page-head { margin-bottom: 8px; }
.row-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; }
.lede { margin: 6px 0 0; }
.page .search { box-shadow: none; border: 1px solid var(--line); max-width: 280px; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.card-grid.tight { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.scout-card {
  display: flex; flex-direction: column; gap: 6px; background: #1c1f26; border-radius: var(--radius);
  padding: 14px; text-decoration: none; box-shadow: var(--shadow); border: 1px solid transparent;
  transition: transform var(--move), box-shadow var(--move);
}
a.scout-card { cursor: pointer; }
.scout-card:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(18, 32, 58, .1); }
.scout-card.warn { background: #FFFCF6; }
.scout-card header { display: flex; gap: 10px; align-items: center; }
.scout-card .avatar { background: var(--accent-soft); color: var(--accent); }
.scout-card dl { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 4px 0 0; }
.scout-card.compact dl { grid-template-columns: 1fr 1fr; }
.scout-card dt { color: var(--muted); font-size: 12px; }
.scout-card dd { margin: 1px 0 0; font-weight: 680; }
.status-line { font-size: 16px; font-weight: 680; margin: 4px 0; }
.dot { display: flex; align-items: center; gap: 6px; margin: 0; }
.dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.online { color: var(--ok); }
.dot.online::before { background: var(--ok); }
.dot.away { color: var(--warn); }
.dot.away::before { background: var(--warn); }
.dot.none, .dot.off { color: var(--muted); }
.task-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.task-card {
  display: flex; flex-direction: column; gap: 4px; background: #1c1f26; border-radius: var(--radius);
  padding: 16px; min-height: 168px; text-decoration: none; box-shadow: var(--shadow);
  transition: transform var(--move), box-shadow var(--move);
}
a.task-card:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(18, 32, 58, .1); }
.task-ico {
  width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
}
.task-ico svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.task-count { margin: 4px 0 0; color: var(--muted); }
.task-count b { color: var(--text); font-size: 22px; letter-spacing: -.03em; }
.left { margin: 0; font-weight: 680; }
.bar { height: 7px; background: #E6EAF1; border-radius: 6px; overflow: hidden; }
.bar.lg, .day-bar { height: 10px; margin-top: 8px; }
.bar span { display: block; height: 100%; background: var(--accent); }
.hero { display: flex; gap: 18px; align-items: stretch; margin: 16px 0; }
.hero > div:first-child { background: #1c1f26; border-radius: var(--radius); padding: 18px 20px; min-width: 180px; box-shadow: var(--shadow); }
.hero span, .hero small { color: var(--muted); }
.kind-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; flex: 1; }
.kind-row b { font-size: 22px; }
.person-head { display: flex; gap: 14px; align-items: center; }
.goal-block, .activity-block, .panel + .panel { margin-top: 14px; }
.goal-block, .activity-block { background: #1c1f26; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.activity, .feed { list-style: none; margin: 10px 0 0; padding: 0; }
.activity li, .feed li {
  display: grid; grid-template-columns: 64px 110px 1fr; gap: 10px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.tabs { display: flex; gap: 6px; margin: 16px 0 4px; }
.tabs a { text-decoration: none; padding: 8px 12px; border-radius: 6px; color: var(--muted); }
.tabs a.on, .tabs a:hover { background: #1c1f26; color: var(--accent); }
.tabs a.on { background: var(--accent-soft); }
.state { color: var(--muted); background: #1c1f26; border-radius: 6px; padding: 14px 16px; }
.state.bad, .bad-text, .feed .bad { color: var(--bad); }
.actions { display: flex; gap: 16px; margin-top: 16px; }
.primary, .text-btn {
  min-height: 42px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 14px; text-decoration: none; border: 0; cursor: pointer;
}
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: #2458C9; }
.text-btn { background: #1c1f26; border: 1px solid var(--line); }
.bottom-nav, .sheet-back { display: none; }
.bottom-nav svg { display: none; }
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.gate-card { width: min(440px, 100%); padding: 28px; background: #1c1f26; border-radius: 8px; box-shadow: var(--shadow); }
.gate-card p { color: var(--muted); }
.gate-card .primary { margin-top: 8px; }
body.map-screen { overflow: hidden; }
body.map-screen .main { height: 100dvh; display: flex; flex-direction: column; }
.map-workspace { position: relative; flex: 1; min-height: 0; }
.map-note {
  position: absolute; z-index: 500; left: 12px; bottom: 14px; margin: 0;
  background: #1c1f26; border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow);
}
.drawer {
  position: absolute; z-index: 600; top: 64px; right: 12px; bottom: 12px; width: min(300px, calc(100% - 24px));
  background: #1c1f26; border-radius: 8px; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.drawer header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; }
#scooterList { overflow: auto; padding: 0 14px 14px; }
.scooter-row {
  display: flex; flex-direction: column; width: 100%; text-align: left; background: transparent;
  border: 0; border-top: 1px solid var(--line); padding: 10px 0; cursor: pointer;
}
.scooter-row:hover { color: var(--accent); }
.sheet-back { position: fixed; inset: 0; background: rgba(16, 24, 40, .28); z-index: 800; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; background: #1c1f26; border-radius: 8px 18px 0 0;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px;
}
.sheet-handle { width: 36px; height: 4px; border-radius: 6px; background: var(--line); margin: 6px auto; }
.sheet-link { text-decoration: none; min-height: 46px; display: flex; align-items: center; border-bottom: 1px solid var(--line); background: transparent; border-left: 0; border-right: 0; border-top: 0; }
.sheet-link.on { color: var(--accent); font-weight: 680; }
.icon-x { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); margin-left: auto; }
.icon-x svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.scooter-sheet { max-height: 70dvh; }
.sk-popup { font-size: 13px; line-height: 1.35; min-width: 210px; max-width: 250px; }
.sk-popup .num { display: block; font-size: 16px; margin-bottom: 2px; }
.sk-popup .pop-line { display: block; margin-top: 7px; }
.sk-popup .pop-line span { display: block; color: var(--muted); font-size: 11px; line-height: 1.2; }
.sk-popup .pop-line b { display: block; font-weight: 650; line-height: 1.3; }
.pop-line { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; }
.pop-line span { color: var(--muted); }
.pop-status { margin-top: 8px; font-weight: 700; }
.pop-status.done { color: var(--ok); }
.pop-status.pending { color: #9A6700; }
.pop-status.failed { color: var(--bad); }
.leaflet-popup-content-wrapper { border-radius: 6px; box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 10px 12px; }
.leaflet-marker-icon.scooter-icon { background: transparent !important; border: 0 !important; }
.scooter-hit {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
}
.scooter-wrap {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid #177BC9; background: #1c1f26;
  box-shadow: 0 1px 4px rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.scooter { width: 16px; height: 16px; background: url("scooter-icon.png") center/contain no-repeat; }
.scooter-wrap.done { opacity: .45; }
.sk-stack { display: grid; gap: 6px; }
.stack-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #d6deea;
  border-radius: 10px; background: #1c1f26; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.stack-item:hover, .stack-item:active { border-color: #8b9cf7; background: #F1F5FB; }
.stack-item b { font-size: 14px; }
.stack-item span { font-size: 12px; color: #8b919a; }
.extra-filters { display: flex; flex-direction: column; gap: 8px; }
.extra-filters[hidden] { display: none !important; }

@media (max-width: 1200px) {
  .stage, .bottom-grid, .card-grid, .card-grid.tight { grid-template-columns: 1fr 1fr; }
  .kind-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .role-mobile { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
  .bottom-nav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 700;
    background: #1c1f26; border-top: 1px solid var(--line);
    height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav a, .bottom-nav button {
    border: 0; background: transparent; text-decoration: none; text-align: center;
    font-size: 11px; color: var(--muted); display: grid; place-items: center; padding: 6px;
  }
  .bottom-nav a.on { color: var(--accent); font-weight: 700; }
  .command, .page { padding: 12px 12px calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); }
  .topbar { display: grid; grid-template-columns: 1fr auto; }
  .topbar h1 { grid-column: 1 / -1; font-size: 24px; }
  .search { grid-column: 1 / -1; }
  .kpi-row, .stage, .bottom-grid, .card-grid, .card-grid.tight, .task-grid, .kind-row { grid-template-columns: 1fr 1fr; }
  .task-grid, .card-grid, .bottom-grid, .stage { grid-template-columns: 1fr; }
  .map-card { min-height: 62vh; }
  .watch { max-height: none; }
  .hero { flex-direction: column; }
  .row-head, .preview-banner, .activity li, .feed li { display: flex; flex-wrap: wrap; }
  .float-card { display: none; }
  .float-card.open {
    display: flex; position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
    top: auto; width: auto; z-index: 760; border-radius: 8px 16px 0 0; max-height: 70dvh; overflow: auto;
  }
  .filter-fab {
    display: inline-flex; position: absolute; z-index: 500; top: 12px; left: 12px;
    background: #1c1f26; border: 0; border-radius: 12px; min-height: 40px; padding: 0 12px; box-shadow: var(--shadow);
  }
  .sheet-back { display: block; }
  .sheet-back[hidden] { display: none !important; }
  body.map-screen { overflow: auto; }
  body.map-screen .main { height: auto; }
  .map-workspace { height: calc(100dvh - var(--nav-h) - env(safe-area-inset-bottom)); }
  .drawer { top: auto; left: 0; right: 0; width: auto; max-height: 60dvh; border-radius: 8px 16px 0 0; }
}
@media (min-width: 769px) {
  .sheet-back { display: block; }
  .sheet-back[hidden] { display: none !important; }
  .role-mobile { display: none; }
}

.sidebar { width: 224px; flex-basis: 224px; }
.side-nav { gap: 4px; margin-top: 8px; }
.side-nav a { min-height: 40px; }
.side-nav a.on { background: rgba(79, 140, 255, .24); color: #EAF1FF; }
body { background: #F4F7FB; font-size: 14px; }
h1, .page-head h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
.hello h1 { font-size: 22px; font-weight: 700; line-height: 1.15; white-space: nowrap; }
.hello p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.topbar { align-items: center; }
.search { flex: 0 1 320px; max-width: 320px; }
.top-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.top-tools input, .top-tools select {
  height: 36px; border: 0; border-radius: 10px; background: #1c1f26;
  box-shadow: var(--shadow); padding: 0 10px; max-width: 150px;
}
.role-badge {
  height: 32px; border: 0; border-radius: 6px; background: #23262e; color: #8b9cf7;
  font-size: 13px; font-weight: 700; padding: 0 10px; white-space: nowrap;
}
.role-badge.floating { position: absolute; top: 14px; right: 16px; z-index: 6; }
@media (min-width: 769px) {
  body.home .role-badge.floating { display: none; }
}
.kpi-row article { display: flex; align-items: center; gap: 12px; min-height: 86px; padding: 12px 16px; }
.kpi-row b { font-size: 30px; font-weight: 700; }
.kpi-ico {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: #EEF3FA; color: #5C6B82; flex: 0 0 auto;
}
.kpi-row .ok .kpi-ico { background: var(--ok-bg); color: var(--ok); }
.kpi-row .info .kpi-ico { background: var(--accent-soft); color: var(--accent); }
.kpi-row .bad .kpi-ico { background: var(--bad-bg); color: var(--bad); }
.kpi-ico svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stage { grid-template-columns: minmax(0, 1fr) 340px; align-items: stretch; }
.map-card { border-radius: 8px; }
.map-toolbar { position: absolute; z-index: 500; top: 12px; left: 12px; display: flex; gap: 8px; align-items: center; }
.tool, .tool-select {
  height: 36px; border: 0; border-radius: 10px; background: #1c1f26; box-shadow: var(--shadow); padding: 0 12px;
}
.filter-pop {
  position: absolute; z-index: 520; top: 56px; left: 12px; width: 220px;
  background: #1c1f26; border-radius: 6px; box-shadow: 0 14px 36px rgba(16, 24, 40, .14); padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.filter-pop label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.filter-pop select, .filter-pop input { min-height: 36px; border: 0; border-radius: 10px; background: #F4F7FB; padding: 0 8px; }
.watch { background: transparent; box-shadow: none; padding: 0; gap: 8px; }
.rail-switch { margin: 0; flex: 0 0 auto; }
.rail-panel { min-height: 0; display: flex; flex-direction: column; background: #1c1f26; border-radius: 8px; box-shadow: var(--shadow); padding: 12px 12px 8px; }
.watch-list { display: flex; flex-direction: column; gap: 8px; overflow: auto; }
.watch-card {
  display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: start;
  text-decoration: none; background: #F6F8FB; border-radius: 6px; padding: 10px;
}
.watch-card:hover { background: #EEF3FA; }
.watch-copy { display: flex; flex-direction: column; min-width: 0; }
.watch-copy b { font-size: 14px; }
.watch-copy small { font-size: 13px; }
.watch-copy strong { display: block; margin-top: 4px; font-size: 14px; font-weight: 700; }
.watch-copy strong.mark, .watch-card.bad strong.mark { color: var(--bad); }
.watch-copy strong.idle, .watch-card.warn strong.idle { color: var(--warn); }
.watch-copy strong.online { color: var(--ok); }
.summary-row { display: flex; gap: 18px; margin: 8px 0 14px; }
.summary-row b { display: block; font-size: 28px; font-weight: 700; letter-spacing: -.03em; }
.summary-row span { color: var(--muted); font-size: 13px; }
.today-block, .goal-block, .activity-block { background: #1c1f26; border-radius: 8px; box-shadow: var(--shadow); padding: 18px 20px; margin-top: 14px; }
.hero-num { margin: 8px 0 12px; font-size: 40px; font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.hero-num small { display: block; margin-top: 6px; font-size: 14px; font-weight: 500; color: var(--muted); }
.kind-board { display: flex; flex-wrap: wrap; gap: 16px 28px; }
.kind-board b { display: block; font-size: 22px; font-weight: 700; }
.kind-board span { color: var(--muted); font-size: 13px; }
.activity li { font-size: 14px; padding: 12px 0; }
.scout-card b { font-size: 15px; }
.status-line { font-size: 16px; }

@media (min-width: 769px) {
  body.home.fit, body.home.fit .shell { height: 100dvh; overflow: hidden; }
  body.home.fit .main { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; position: relative; }
  body.home.fit .command {
    flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
    padding: 16px 18px;
  }
  body.home.fit .topbar { flex: 0 0 64px; height: 64px; margin: 0; }
  body.home.fit .kpi-row { flex: 0 0 86px; height: 86px; margin: 12px 0; }
  body.home.fit .stage { flex: 1; min-height: 0; margin: 0; }
  body.home.fit .map-card { min-height: 0; height: 100%; }
  body.home.fit .watch { max-height: none; height: 100%; min-height: 0; }
  body.home.fit .rail-panel { flex: 1; overflow: hidden; }
  body.home.fit .watch-list { flex: 1; }
}
@media (max-width: 1440px) {
  .hello h1 { font-size: 20px; }
  .search { max-width: 240px; }
}
@media (max-width: 768px) {
  body.home.fit, body.home.fit .shell, body.home.fit .main, body.home.fit .command {
    height: auto; overflow: visible; display: block;
  }
  .stage, body.home.fit .stage { grid-template-columns: 1fr; }
  body.home.fit .map-card, .map-card { width: 100%; height: 58vh; min-height: 320px; }
  body.home.fit .watch, .watch { height: auto; width: auto; max-width: 100%; }
  .topbar { height: auto; flex-wrap: wrap; }
  .hello, .search, .top-tools { width: 100%; max-width: none; }
  .hello h1 { white-space: normal; font-size: 24px; }
  .top-tools { margin-left: 0; flex-wrap: wrap; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .kpi-row article { min-height: 78px; }
  .filter-pop:not([hidden]) {
    position: fixed; left: 0; right: 0; top: auto;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
    width: auto; border-radius: 8px 16px 0 0; z-index: 760;
  }
  .summary-row b { font-size: 24px; }
  .hero-num { font-size: 34px; }
}


.admin-home h1, .page h1 { margin: 0 0 4px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.admin-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; }
.admin-card b { font-size: 16px; }
.admin-card span, .admin-card li { color: var(--muted); font-size: 13px; }
.admin-card ul { margin: 8px 0 0; padding-left: 16px; }
.admin-card.static { cursor: default; }
.admin-form { display: grid; gap: 10px; max-width: 420px; margin: 16px 0; }
.admin-form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.admin-form input, .admin-form select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.admin-form .check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.admin-form button, .admin-inline { font: inherit; border: 0; border-radius: 10px; padding: 10px 12px; background: var(--accent); color: #fff; font-weight: 700; width: fit-content; }
.admin-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.admin-list li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.admin-list span, .admin-list .text { display: block; color: var(--muted); font-size: 13px; }
.admin-list .text { margin-top: 6px; padding: 0; border: 0; background: transparent; color: var(--bad); cursor: pointer; font: inherit; }
.admin-note { background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; }
#tour { display: none; }
#tour.is-on { display: block; }
#tour .tour-block {
  position: fixed; inset: 0; z-index: 100000; background: transparent; pointer-events: auto;
}
#tour .tour-ring {
  position: fixed; z-index: 100001; pointer-events: none; border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(6, 12, 22, .62);
  transition: top .4s cubic-bezier(.2,.8,.2,1), left .4s cubic-bezier(.2,.8,.2,1), width .4s cubic-bezier(.2,.8,.2,1), height .4s cubic-bezier(.2,.8,.2,1);
}
#tour .tour-ring::after {
  content: ""; position: absolute; inset: -5px; border: 2px solid #7ad7ff; border-radius: inherit;
  animation: tour-pulse 1.5s ease-out infinite;
}
@keyframes tour-pulse {
  0% { opacity: .95; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.035); }
}
#tour .tour-card {
  position: fixed; z-index: 100002; pointer-events: auto;
  background: #1c1f26; color: #eef3f7; border-radius: 8px; padding: 14px 14px 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
  transition: top .4s cubic-bezier(.2,.8,.2,1), left .4s cubic-bezier(.2,.8,.2,1);
  max-height: min(46vh, 320px); overflow: auto;
}
#tour .tour-card small { color: #8fd8ff; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
#tour .tour-card b { display: block; margin-top: 4px; font-size: 17px; }
#tour .tour-card p { margin: 6px 0 0; color: #d5deea; font-size: 14px; line-height: 1.4; }
#tour .tour-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
#tour .tour-actions button {
  font: inherit; border: 0; border-radius: 12px; min-height: 44px; padding: 0 14px;
  background: #1c3348; color: #eef3f7; cursor: pointer;
}
#tour .tour-actions [data-next] { background: #8b9cf7; color: #101113; font-weight: 750; }
@media (max-width: 768px) {
  #tour .tour-card { left: 12px !important; width: calc(100vw - 24px) !important; }
  #tour .tour-actions button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  #tour .tour-ring, #tour .tour-card, #tour .tour-ring::after { transition: none; animation: none; }
}
button.leave { width: 100%; text-align: left; background: transparent; border: 0; color: inherit; cursor: pointer; font: inherit; }
