/* МАЯК · layout + component styles
   companion to tokens.css; pulls in tokens via CSS vars.
*/

/* ───────── APP SHELL ───────── */
.app {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "side top"
    "side main";
  height: 100vh;
  background: var(--bg);
}
.app > .sidebar { grid-area: side; }
.app > .topbar  { grid-area: top; }
.app > .main    { grid-area: main; min-height: 0; min-width: 0; }

/* ───────── SIDEBAR ───────── */
.sidebar {
  width: 232px;
  background: var(--paper);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 16px 12px;
  transition: width var(--t-med);
  position: relative;
}
.sidebar.collapsed { width: 62px; padding: 16px 8px; }

/* sidebar collapse chevron — sits on the right edge */
.side-collapse {
  position: absolute;
  right: -11px; top: 26px;
  z-index: var(--z-panel);
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
  opacity: 0;
}
.sidebar:hover .side-collapse,
.sidebar.collapsed .side-collapse {
  opacity: 1;
}
.side-collapse:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-bg);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px 16px;
}
.brand-mark {
  background: transparent; border: 0; padding: 4px; cursor: pointer;
  color: var(--accent);
  border-radius: var(--r-2);
  transition: background var(--t-fast);
}
.brand-mark:hover { background: var(--bg-sub); }
.brand-text { display: flex; flex-direction: column; }
.brand-name {
  font-size: 14px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; line-height: 1;
}
.brand-sub {
  font-size: 10px; color: var(--muted-2); margin-top: 4px;
  letter-spacing: 0.04em;
}

.sidebar-nav {
  display: flex; flex-direction: column; gap: 2px;
  margin-top: 6px;
}
.side-link {
  display: flex; align-items: center; gap: 12px;
  height: 36px; padding: 0 10px;
  background: transparent; border: 0;
  border-radius: var(--r-2);
  color: var(--fg-2);
  font-size: 13px; font-weight: 500;
  cursor: pointer; user-select: none;
  text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
}
.side-link:hover { background: var(--bg-sub); color: var(--fg); }
.side-link.active { background: var(--accent-bg); color: var(--accent); }
.side-link.active svg { color: var(--accent); }
.sidebar.collapsed .side-link { justify-content: center; padding: 0; }

/* Раскрывающееся подменю пунктов навигации (Объекты / Группы) */
.side-group { display: flex; flex-direction: column; }
.side-caret {
  display: inline-flex; align-items: center;
  transition: transform var(--t-fast);
  color: var(--fg-2); opacity: .7;
}
.side-caret.open { transform: rotate(90deg); }
.side-sub {
  display: flex; flex-direction: column; gap: 2px;
  margin: 2px 0 4px 0; padding-left: 16px;
  position: relative;
}
.side-sub::before {
  content: ''; position: absolute; left: 17px; top: 2px; bottom: 8px;
  width: 1px; background: var(--line);
}
.side-sublink {
  display: flex; align-items: center; gap: 9px;
  height: 30px; padding: 0 10px 0 12px;
  background: transparent; border: 0; border-radius: var(--r-2);
  color: var(--fg-2); font-size: 12.5px; font-weight: 500;
  cursor: pointer; user-select: none; text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
}
.side-sublink:hover { background: var(--bg-sub); color: var(--fg); }
.side-sublink.active { background: var(--accent-bg); color: var(--accent); }
.side-sub-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: .55; flex: 0 0 auto;
}

.sidebar-foot {
  margin-top: auto; padding: 12px 10px 4px;
  border-top: 1px solid var(--line); margin-top: auto;
}
.status-line {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
}

/* ───────── TOPBAR ───────── */
.topbar {
  height: 56px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px;
}
.mobile-only { display: none; }

.breadcrumbs {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--fg-2);
}
.breadcrumbs svg { color: var(--muted-2); }

.topbar-search {
  flex: 1; max-width: 480px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: 0 10px;
  margin: 0 8px;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.topbar-search:focus-within { border-color: var(--accent); background: var(--paper); }
.topbar-search > svg { color: var(--muted); flex-shrink: 0; }
.topbar-search input {
  flex: 1; height: 34px; padding: 0;
  background: transparent; border: 0; outline: 0;
  font-size: 13px;
}
.topbar-search input:focus { box-shadow: none; }

.topbar-actions {
  display: flex; align-items: center; gap: 6px;
  margin-left: auto;
}
.topbar-actions .btn.icon { position: relative; }
.badge-dot {
  position: absolute; top: 7px; right: 8px;
  width: 7px; height: 7px;
  background: var(--danger); border-radius: 999px;
  border: 1.5px solid var(--paper);
}

.topbar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px 4px 10px;
  margin-left: 6px;
  border-left: 1px solid var(--line);
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px;
  letter-spacing: 0.04em;
}
.user-avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.user-text { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 12.5px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--muted); }

/* ───────── MAIN AREA ───────── */
.main {
  display: grid;
  grid-template-columns: 380px 1fr;
  position: relative;
  background: var(--bg);
  transition: grid-template-columns var(--t-med);
}
[data-list-collapsed="true"] .main {
  grid-template-columns: 1fr;
}
[data-layout="map-first"] .main {
  grid-template-columns: 1fr;
}
[data-layout="map-first"] .beacon-list {
  position: absolute; left: 16px; top: 16px; bottom: 16px;
  width: 340px;
  border-radius: var(--r-4);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
  z-index: var(--z-panel);
}
[data-layout="map-first"] .map-shell { width: 100%; }

/* ───────── BEACON LIST ───────── */
.beacon-list {
  background: var(--paper);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0;
}
.list-head {
  padding: 16px 16px 0;
  border-bottom: 1px solid var(--line);
}
.list-head-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}
.list-title {
  margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em;
}
.list-head-tools {
  display: flex; align-items: center; gap: 8px;
}
.list-stats {
  font-size: 11.5px; color: var(--muted);
  display: flex; align-items: center; gap: 6px;
}
.list-stats b { color: var(--fg); font-weight: 600; }
.list-stats .ok-text { color: var(--ok); }
.list-stats .ok-text b { color: var(--ok); }
.list-stats .sep { color: var(--muted-2); }

.list-collapse-btn {
  height: 26px; width: 26px;
  color: var(--muted);
}
.list-collapse-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-bg); }

/* floating rail when list is collapsed */
.list-rail {
  position: absolute;
  left: 16px; top: 76px;
  display: inline-flex; align-items: center; gap: 12px;
  padding: 8px 14px 8px 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  color: var(--fg);
  font-family: var(--font-sans);
  z-index: var(--z-panel);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.list-rail:hover { border-color: var(--line-strong); box-shadow: var(--shadow-lg); }
.list-rail:active { transform: translateY(0.5px); }
.list-rail > svg { color: var(--muted); }
.list-rail-stats {
  display: flex; flex-direction: column; gap: 2px; text-align: left;
}
.list-rail-title {
  font-size: 13px; font-weight: 600; letter-spacing: -0.005em;
}
.list-rail-meta {
  font-size: 11px; color: var(--muted);
  display: flex; align-items: center; gap: 5px;
}
.list-rail-meta b { color: var(--fg); font-weight: 600; }
.list-rail-meta .sep { color: var(--muted-2); }
.list-rail-meta .ok-text { color: var(--ok); }
.list-rail-meta .ok-text b { color: var(--ok); }
.list-rail-meta .alert-text { color: var(--danger); }
.list-rail-meta .alert-text b { color: var(--danger); }

.list-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: 0 10px;
  margin-bottom: 12px;
}
.list-search:focus-within { border-color: var(--accent); background: var(--paper); }
.list-search > svg { color: var(--muted); flex-shrink: 0; }
.list-search input {
  flex: 1; height: 32px; padding: 0;
  background: transparent; border: 0; outline: 0; font-size: 13px;
}

.list-filters {
  display: flex; gap: 4px;
  margin-bottom: 8px; padding-bottom: 12px;
  overflow-x: auto;
}
.tab-chip {
  height: 26px; padding: 0 10px;
  background: transparent; border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px; color: var(--muted);
  cursor: pointer; white-space: nowrap;
  transition: all var(--t-fast);
}
.tab-chip:hover { color: var(--fg); border-color: var(--line-2); }
.tab-chip.active {
  background: var(--fg); color: var(--bg);
  border-color: var(--fg);
}

.list-body { flex: 1; overflow-y: auto; }
.list-empty {
  display: flex; flex-direction: column; align-items: center;
  padding: 48px 24px; color: var(--muted);
  gap: 8px;
}
.list-foot {
  padding: 10px 12px; border-top: 1px solid var(--line);
}

/* ───────── ЖУРНАЛ ПРИХОДА ДАННЫХ (экран/пункт меню, только super) ───────── */
.ingest-screen {
  grid-column: 1 / -1;
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
  background: var(--bg); overflow: hidden;
}
.ingest-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  padding: 18px 24px 16px;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.ingest-title { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.ingest-sub { margin: 4px 0 0; font-size: 12.5px; max-width: 640px; line-height: 1.45; }
.ingest-head-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ingest-stats { display: inline-flex; gap: 6px; }

.ingest-table-wrap { flex: 1; min-height: 0; overflow: auto; padding-bottom: 24px; }
.ingest-empty { padding: 40px 24px; font-size: 13px; text-align: center; }
.ingest-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ingest-table thead th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; font-weight: 600; color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  padding: 8px 14px; background: var(--paper); border-bottom: 1px solid var(--line);
}
.ingest-table tbody td {
  padding: 6px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.ingest-table tbody tr:hover { background: var(--bg-sub); }
.ingest-table .it-time { color: var(--muted); }
.ingest-table .it-note { white-space: normal; }

/* бейджи каналов (в таблице и в шапке-статистике) */
.il-tr {
  display: inline-block;
  font-size: 9.5px; font-weight: 700; letter-spacing: .03em;
  padding: 2px 6px; border-radius: 4px; color: #fff;
}
.il-tr-udp { background: #4f8cff; }
.il-tr-tcp { background: #7a5cd0; }
.il-tr-api { background: #2ec16b; }

/* раскрываемые строки журнала */
.ingest-table .il-exp-col { width: 22px; text-align: center; padding-left: 4px; padding-right: 0; }
.ingest-table tr.il-expandable { cursor: pointer; }
.ingest-table tr.il-open { background: var(--bg-sub); }
.il-caret { display: inline-block; color: var(--muted); transition: transform .12s ease; font-size: 10px; }
.il-caret.open { transform: rotate(90deg); }
.il-detail-row td { background: var(--bg-sub); border-bottom: 1px solid var(--line); }
.il-detail {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px 18px; padding: 8px 10px 10px 6px;
}
.il-detail-kv { display: flex; gap: 8px; align-items: baseline; font-size: 12px; min-width: 0; }
.il-detail-k { color: var(--muted); flex: 0 0 auto; }
.il-detail-v { color: var(--text); overflow-wrap: anywhere; min-width: 0; }
.il-detail-raw { font-size: 11px; opacity: .8; }

/* пагинация журнала */
.ingest-pager {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  justify-content: space-between; padding: 10px 2px 4px; border-top: 1px solid var(--line);
}
.ingest-pager-size, .ingest-pager-nav { display: flex; gap: 6px; align-items: center; }
.ingest-pager-nav .muted { font-size: 12px; }

/* ───────── LIST SECTION HEADER (Маяки / Пеленгаторы) ───────── */
.list-section-h {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 7px 14px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted);
  background: var(--bg-sub);
  border: none; border-bottom: 1px solid var(--line);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: color .12s, background .12s;
}
.list-section-h:hover { color: var(--fg-2); background: var(--paper-2); }
.list-section-h svg { flex: none; color: var(--muted-2); }
.list-section-h .sec-count { margin-left: auto; }

/* тег «Пеленгатор» в строке списка */
.pel-tag {
  font-size: 10px; font-weight: 600; letter-spacing: .03em;
  padding: 1px 6px; border-radius: 999px;
  color: #a06bd6; background: rgba(160, 107, 214, .14);
}
.pel-row .row-callsign { letter-spacing: -0.005em; }

/* ───────── BEACON ROW ───────── */
.marker-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: 0; border-bottom: 1px solid var(--line);
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast);
}
.marker-row:hover { background: var(--bg-sub); }
.marker-row.selected {
  background: var(--accent-bg);
  box-shadow: inset 2px 0 0 var(--accent);
}
.row-status { padding-top: 6px; }
.row-main { min-width: 0; }
.row-title {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 4px;
}
.row-callsign { font-size: 14px; font-weight: 600; letter-spacing: -0.005em; }
.row-id { font-size: 11px; }
.row-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  margin-bottom: 4px;
}
.row-meta svg { color: var(--muted); }
.row-addr {
  font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-right {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 4px; font-size: 11px;
}
.row-batt, .row-sig {
  display: flex; align-items: center; gap: 5px;
}
.row-last { font-size: 11px; }

/* battery glyph */
.batt-glyph { display: inline-flex; align-items: center; }
.batt-shell {
  display: inline-block;
  width: 22px; height: 11px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 1px;
  position: relative;
}
.batt-fill { display: block; height: 100%; border-radius: 1px; transition: width var(--t-med); }
.batt-tip {
  display: inline-block;
  width: 2px; height: 5px;
  background: var(--line-strong);
  border-radius: 0 1px 1px 0;
  margin-left: 1px;
}

/* signal bars */
.sig-bars {
  display: inline-flex; align-items: flex-end; gap: 1.5px;
  height: 11px;
}
.sig-bar {
  width: 2.5px;
  background: var(--line-2);
  border-radius: 1px;
}
.sig-bar.on { background: var(--ok); }

/* ───────── MAP ───────── */
.map-shell {
  position: relative;
  background: var(--map-bg);
  min-height: 0;
  overflow: hidden;
}
.map-widget {
  position: absolute; inset: 0;
  cursor: crosshair;
}
.map-bg { position: absolute; inset: 0; }

.map-markers { position: absolute; inset: 0; pointer-events: none; }
.mk-marker {
  position: absolute;
  width: 18px; height: 18px;
  transform: translate(-50%, -50%);
  background: transparent; border: 0; padding: 0;
  cursor: pointer; pointer-events: auto;
}
.mk-core {
  position: absolute; inset: 4px;
  background: var(--ok); border-radius: 999px;
  border: 2px solid var(--paper);
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.mk-alert .mk-core { background: var(--danger); }
.mk-offline .mk-core { background: var(--offline); border-color: var(--paper); }
.mk-sleeping .mk-core { background: var(--warn); }
.mk-pulse {
  position: absolute; inset: 4px;
  background: var(--ok); border-radius: 999px;
  opacity: 0.4;
  animation: mk-pulse 2s ease-out infinite;
}
.mk-alert .mk-pulse { background: var(--danger); animation-duration: 0.8s; }
@keyframes mk-pulse {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(3); opacity: 0; }
}
.mk-ring {
  position: absolute; inset: -6px;
  border: 2px solid var(--accent);
  border-radius: 999px;
  box-shadow: 0 0 0 2px var(--paper);
}

.map-controls {
  position: absolute; right: 14px; top: 14px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: 4px;
  box-shadow: var(--shadow-md);
}
.map-legend {
  position: absolute; left: 14px; bottom: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: 10px 12px;
  font-size: 12px;
  box-shadow: var(--shadow-sm);
}
.legend-row {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 0;
}
.map-coords {
  position: absolute; right: 14px; bottom: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11px;
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}

/* ───────── MARKER CARD ───────── */
.marker-card {
  position: absolute;
  right: 16px; top: 16px; bottom: 16px;
  width: min(460px, calc(100% - 32px));
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  z-index: var(--z-overlay);
  overflow: hidden;
  container-type: inline-size;
  container-name: card;
}
.marker-card.status-danger {
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--danger);
}

/* head */
.card-head {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 12px 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.card-head .btn.icon.ghost {
  width: 28px; height: 28px;
  color: var(--muted);
}
.card-head .btn.icon.ghost:hover { color: var(--fg); background: var(--bg-sub); }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px 0 8px;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px; font-weight: 500;
  color: var(--fg);
}
.status-pill.tone-ok      { background: var(--ok-bg);      border-color: transparent; }
.status-pill.tone-ok .status-pill-label { color: var(--ok); }
.status-pill.tone-danger  { background: var(--danger-bg);  border-color: transparent; }
.status-pill.tone-danger .status-pill-label { color: var(--danger); }
.status-pill.tone-warn    { background: var(--warn-bg);    border-color: transparent; }
.status-pill.tone-warn .status-pill-label { color: var(--warn); }
.status-pill.tone-offline { background: var(--offline-bg); border-color: transparent; }
.status-pill.tone-offline .status-pill-label { color: var(--offline); }
.status-pill-sep { color: var(--muted-2); }
.status-pill-sub { font-size: 11px; color: var(--muted); }

/* title section */
.card-title {
  padding: 14px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.card-title-row {
  display: flex; align-items: center; gap: 12px;
}
.card-model-pill {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  color: var(--muted);
  flex-shrink: 0;
}
.status-danger .card-model-pill { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }
.card-title-text { flex: 1; min-width: 0; }
.card-callsign-h {
  margin: 0; font-size: 22px; font-weight: 600;
  letter-spacing: -0.015em; line-height: 1.15;
}
.card-callsign-h.editable { cursor: text; border-radius: 5px; padding: 0 4px; margin: 0 -4px; transition: background var(--t-fast); }
.card-callsign-h.editable:hover { background: var(--bg-sub); box-shadow: inset 0 0 0 1px var(--line); }
.card-name-edit {
  margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.15;
  font-family: inherit; color: var(--text);
  border: 1px solid var(--accent); border-radius: 5px; padding: 0 4px; margin: 0 -5px;
  background: var(--paper); width: 100%; max-width: 260px; outline: none;
}
.card-id-line {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--fg-2);
  margin-top: 2px;
}
.alert-flag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 9px;
  background: var(--danger-bg); color: var(--danger);
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}

/* tabs */
.card-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.card-tabs::-webkit-scrollbar { display: none; }
.card-tabs .tab {
  height: 38px; padding: 0 11px;
  flex-shrink: 0;
  white-space: nowrap;
  background: transparent; border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: 13px; font-weight: 500; color: var(--muted);
  cursor: pointer;
  transition: color var(--t-fast);
}
.card-tabs .tab:hover { color: var(--fg); }
.card-tabs .tab.active { color: var(--fg); border-bottom-color: var(--accent); }

.card-body { flex: 1; overflow-y: auto; }
.tab-body { padding: 16px 18px; }
.log-tab-body { padding: 8px 0 0; display: flex; flex-direction: column; }

/* ─── hero metric strip ─── */
.metric-strip {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
@container card (max-width: 420px) {
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .prof-trig-grid { grid-template-columns: 1fr; }
}
.metric-card {
  padding: 10px 12px;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  min-width: 0;
}
.metric-card.ok      { border-color: transparent; background: var(--ok-bg); }
.metric-card.warn    { border-color: transparent; background: var(--warn-bg); }
.metric-card.danger  { border-color: transparent; background: var(--danger-bg); }
.metric-card.offline { border-color: transparent; background: var(--offline-bg); }
.metric-row {
  display: flex; align-items: center; gap: 6px;
  color: var(--muted);
  margin-bottom: 4px;
}
.metric-row svg { color: var(--muted); }
.metric-card.ok .metric-row svg { color: var(--ok); }
.metric-card.warn .metric-row svg { color: var(--warn); }
.metric-card.danger .metric-row svg { color: var(--danger); }
.metric-card.offline .metric-row svg { color: var(--offline); }

.metric-label { margin: 0; font-size: 10.5px; }
.metric-value {
  font-size: 22px; font-weight: 500; line-height: 1;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.metric-sub {
  margin-top: 6px;
  font-size: 11px; color: var(--muted-2);
  display: flex; align-items: center; gap: 5px;
}

.bar-bar {
  display: block; width: 100%; height: 3px;
  background: oklch(85% 0.008 250);
  border-radius: 999px;
  overflow: hidden;
}
[data-theme="dark"] .bar-bar { background: oklch(30% 0.012 250); }
.bar-fill { display: block; height: 100%; border-radius: 999px; transition: width var(--t-med); }

/* ─── info rows (coords / address) ─── */
.info-block { margin-bottom: 8px; }
.info-row {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.info-row:last-child { border-bottom: 0; }
.info-row .eyebrow { margin-bottom: 4px; }

.copy-row {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 0;
  padding: 2px 0;
  cursor: pointer;
  color: var(--fg);
  font-size: 13.5px;
  text-align: left;
  font-family: inherit;
}
.copy-row.mono { font-family: var(--font-mono); font-size: 13px; }
.copy-row-text { flex: 1; }
.copy-row-icon {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted-2);
  border-radius: var(--r-1);
  opacity: 0;
  transition: opacity var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.copy-row:hover .copy-row-icon { opacity: 1; }
.copy-row:hover .copy-row-icon { background: var(--bg-sub); color: var(--accent); }

/* ─── section heads with optional right item ─── */
.card-section {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--line);
}
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.empty-line { margin: 0; font-size: 13px; }

.link-btn {
  background: transparent; border: 0;
  display: inline-flex; align-items: center; gap: 2px;
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
}
.link-btn:hover { color: var(--accent); }

.trigger-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ─── очередь команд (выпадающий список в карточке) ─── */
.qcmd-head {
  width: 100%; background: transparent; border: 0; padding: 0; cursor: pointer;
  gap: 6px; color: inherit;
}
.qcmd-head .eyebrow { cursor: pointer; }
.qcmd-list { display: flex; flex-direction: column; gap: 4px; }
.qcmd-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 8px;
  background: var(--surface-2, rgba(127, 127, 127, .06));
}
.qcmd-pos { font-size: 11px; min-width: 14px; text-align: center; }
.qcmd-name { flex: 1; font-size: 12.5px; }
.qcmd-transport {
  font-size: 10px; font-weight: 600; letter-spacing: .04em;
  padding: 1px 6px; border-radius: 999px; white-space: nowrap;
  color: var(--muted, #8a8f98);
  background: var(--surface-3, rgba(127, 127, 127, .12));
}
.qcmd-time { font-size: 11px; white-space: nowrap; }
.qcmd-actions { display: flex; align-items: center; gap: 2px; }
.qcmd-actions .btn.icon { padding: 3px; }
.qcmd-actions .btn.icon:disabled { opacity: .3; cursor: default; }
.qcmd-actions .btn.icon.danger:hover { color: var(--danger); }

/* ─── overview subsections (телеметрия + сенсоры сгруппированы в обзоре) ─── */
.ov-section { margin-top: 14px; }
.ov-section-head {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted, #8a8f98);
}
.ov-section-head svg { opacity: .8; }
.ov-kpis {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  margin-bottom: 10px;
}
/* Блок «Аккумулятор»: 2×2, где 4-я ячейка — график «Заряд АКБ». KPI не тянем по
   высоте графика — держим компактными по верху ряда. */
.ov-kpis-bat .ov-kpi { align-self: start; }
.ov-kpi {
  padding: 8px 10px; border-radius: 10px; text-align: center;
  background: var(--surface-2, rgba(127, 127, 127, .06));
}
.ov-kpi-value { font-size: 18px; font-weight: 600; line-height: 1.2; margin-top: 2px; }
.ov-kpi-value.ok { color: var(--ok); }
.ov-kpi-value.warn { color: var(--warn); }
.ov-kpi-value.danger { color: var(--danger); }
.ov-kpi-value.offline { color: var(--muted-2, #6b7280); }
.ov-kpi-sub { font-size: 11px; margin-top: 3px; }

/* ─── profile section row ─── */
.profile-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.profile-row:hover { border-color: var(--accent-line); }
.profile-row-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-2);
  color: var(--accent);
  flex-shrink: 0;
}
.profile-row-name { flex: 1; font-size: 13px; font-weight: 500; }
.profile-row-edit {
  color: var(--muted-2);
  display: flex; align-items: center; gap: 4px;
  font-size: 11px;
}

/* ─── actions ─── */
.card-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--line);
}
.card-actions .btn { flex: 0 0 auto; }
.danger-end { margin-left: auto; }
@media (max-width: 520px) { .danger-end { margin-left: 0; } }

/* ─── log toolbar / table ─── */
.log-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 18px 10px;
  border-bottom: 1px solid var(--line);
}

.log-table {
  width: 100%; border-collapse: collapse;
  font-size: 11.5px;
}
.log-table th, .log-table td {
  padding: 6px 8px; text-align: left;
  border-bottom: 1px solid var(--line);
}
.log-table th {
  font-size: 10px; font-weight: 500;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-sub);
  position: sticky; top: 0;
  z-index: 1;
}
.log-table td:first-child { padding-left: 18px; }
.log-table tr.log-now td { background: oklch(97% 0.03 182); }
[data-theme="dark"] .log-table tr.log-now td { background: oklch(24% 0.04 184); }
.log-marker {
  display: inline-block; width: 5px; height: 5px;
  border-radius: 999px; background: var(--line-strong);
}
.log-marker.wake { background: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.log-row.log-now .log-marker { background: var(--ok); box-shadow: 0 0 0 2px var(--ok-bg); }

/* ─── журнал: строки Время/Тип с раскрытием тела под каждый тип ─── */
.log-table-2col td:first-child { padding-left: 10px; }
.log-row.clickable { cursor: pointer; }
.log-row.clickable:hover td { background: var(--bg-sub); }
.log-row.open td { background: var(--bg-sub); }
.log-caret { color: var(--muted); }
.log-type-badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 500;
  background: var(--line); color: var(--fg);
}
.log-type-badge.kind-lbs { background: var(--accent-bg); color: var(--accent); }
.log-type-badge.kind-gnss { background: var(--ok-bg); color: var(--ok); }
.log-type-badge.kind-connection { background: var(--warn-bg); color: var(--warn); }
.log-type-badge.kind-wake { background: var(--accent-bg); color: var(--accent); }
.log-detail-row td { background: var(--bg-sub); border-bottom: 1px solid var(--line); }
.log-detail-body { display: flex; flex-direction: column; gap: 5px; padding: 8px 6px 12px; }
.log-kv { display: flex; gap: 10px; align-items: baseline; font-size: 11.5px; }
.log-kv-k { color: var(--muted); min-width: 108px; }
.log-kv-v { color: var(--fg); }
.log-towers { margin-top: 6px; }
.log-towers .eyebrow { margin-bottom: 3px; }
.log-tower-table { width: auto; border-collapse: collapse; font-size: 11px; }
.log-tower-table th, .log-tower-table td {
  padding: 2px 12px 2px 0; text-align: left; color: var(--fg);
  border-bottom: none;
}
.log-tower-table th { color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; }
.chip.xs { font-size: 9px; padding: 0 5px; }

/* ─── profile tab ─── */
.prof-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.prof-title {
  margin: 4px 0 4px;
  font-size: 16px; font-weight: 600; letter-spacing: -0.005em;
}

.prof-trig-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.prof-trig {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  min-width: 0;
}
.prof-trig-icon {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  color: var(--accent);
  flex-shrink: 0;
}
.prof-trig-text { min-width: 0; }
.prof-trig-label { font-size: 12.5px; font-weight: 500; }

.rate-card.sm { padding: 8px 10px; }
.rate-card.sm .rate-value { font-size: 18px; }

/* ACL */
.access-toolbar {
  display: flex; gap: 8px;
  margin-bottom: 12px;
}
.acl-table {
  width: 100%; border-collapse: collapse;
  font-size: 12.5px;
}
.acl-table th, .acl-table td {
  padding: 10px 8px; text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.acl-table th {
  font-size: 10.5px; font-weight: 500;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.06em;
}
.acl-user { display: flex; align-items: center; gap: 8px; }
.acl-name { font-weight: 500; }
.acl-login { font-size: 10.5px; line-height: 1.4; }

.level-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-mono); font-size: 10.5px;
  font-weight: 600; letter-spacing: 0.04em;
}
.level-A { background: var(--danger-bg); color: var(--danger); }
.level-E { background: var(--accent-bg); color: var(--accent); }
.level-W { background: var(--accent-bg); color: var(--accent); }
.level-R { background: var(--ok-bg); color: var(--ok); }

.hint-box {
  display: flex; gap: 10px;
  margin-top: 16px; padding: 10px 12px;
  background: var(--bg-sub);
  border-left: 2px solid var(--accent-line);
  border-radius: 0 var(--r-2) var(--r-2) 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.hint-box svg { flex-shrink: 0; color: var(--accent); margin-top: 1px; }

/* ───────── PROFILE EDITOR ───────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 20, 30, 0.4);
  backdrop-filter: blur(2px);
  z-index: var(--z-modal);
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
  animation: modal-fade var(--t-med) both;
}
.modal-backdrop > * { animation: modal-rise var(--t-med) both; }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-rise {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,0.6); }

.profile-editor {
  width: min(820px, 100%); max-height: calc(100vh - 64px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.pe-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.pe-title { margin: 4px 0 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }

.pe-body {
  flex: 1; overflow-y: auto;
  padding: 8px 22px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.pe-body section { padding: 16px 0; border-bottom: 1px solid var(--line); }
.pe-body section:last-child { border-bottom: 0; }
.pe-section {
  margin: 0 0 12px;
  font-size: 11px; font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 600;
}
.pe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}
.pe-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--bg-sub);
}

/* Шаг выбора профиля в редакторе */
.pe-back {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: 0; padding: 0; margin: 0 0 4px;
  font: inherit; font-size: 11px; font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); cursor: pointer;
  transition: color var(--t-fast);
}
.pe-back:hover { color: var(--accent); }
.pe-back svg { transform: rotate(180deg); }

.pe-pick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 8px 0;
}
.pe-pick-card {
  display: flex; flex-direction: column; gap: 8px;
  text-align: left;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
.pe-pick-card:hover {
  border-color: var(--accent);
  background: var(--bg-sub);
  transform: translateY(-1px);
}
.pe-pick-head {
  display: flex; align-items: center; gap: 8px;
}
.pe-pick-head svg { margin-left: auto; color: var(--muted); flex-shrink: 0; }
.pe-pick-dot {
  width: 9px; height: 9px; border-radius: 999px; flex-shrink: 0;
  background: var(--accent);
}
.pe-pick-dot.ok   { background: var(--ok); }
.pe-pick-dot.warn { background: var(--warn); }
.pe-pick-dot.accent { background: var(--accent); }
.pe-pick-name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.pe-pick-desc { font-size: 12px; color: var(--muted); line-height: 1.4; }
.pe-pick-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: auto;
}

.switch-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0;
  cursor: pointer; user-select: none;
}
.switch {
  display: inline-block;
  width: 30px; height: 18px;
  background: var(--line-2); border-radius: 999px;
  position: relative; flex-shrink: 0;
  transition: background var(--t-fast);
  cursor: pointer;
}
.switch.on { background: var(--accent); }
.switch-knob {
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: var(--paper);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: transform var(--t-fast);
}
.switch.on .switch-knob { transform: translateX(12px); }
.switch-label {
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
  flex: 1;
}
.hint {
  color: var(--muted-2); font-size: 11.5px;
  margin-left: auto;
}

.rate-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.rate-card {
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: 10px 12px;
}
.rate-value {
  font-size: 22px; font-weight: 500;
  margin-top: 2px;
}

/* ───────── USERS SCREEN ───────── */
.users-screen {
  grid-column: 1 / -1;
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

/* toolbar */
.users-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.us-tabs { display: flex; gap: 2px; }
.us-tab {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--r-2);
  color: var(--muted);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.us-tab:hover { color: var(--fg); background: var(--bg-sub); }
.us-tab.active {
  background: var(--accent-bg); color: var(--accent);
  border-color: var(--accent-line);
}
.us-tab.active svg { color: var(--accent); }
.us-count {
  font-size: 11px; padding: 1px 7px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}
.us-tab.active .us-count {
  background: var(--paper); color: var(--accent); border-color: var(--accent-line);
}

.us-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: 0 10px;
  flex: 0 1 280px;
}
.us-search:focus-within { border-color: var(--accent); background: var(--paper); }
.us-search > svg { color: var(--muted); flex-shrink: 0; }
.us-search input {
  flex: 1; height: 30px; padding: 0;
  background: transparent; border: 0; outline: 0; font-size: 13px;
}

.us-select {
  height: 32px;
  font-size: 12.5px;
  appearance: none; -webkit-appearance: none;
  padding-right: 28px;
  background: var(--paper)
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 12px) 14px / 5px 5px no-repeat,
    var(--paper)
    linear-gradient(135deg, var(--muted) 50%, transparent 50%) calc(100% - 7px) 14px / 5px 5px no-repeat;
}

/* stats strip */
.users-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}
.stat-cell {
  padding: 14px 20px;
  background: var(--paper);
}
.stat-value {
  font-size: 24px; font-weight: 500; letter-spacing: -0.01em;
  line-height: 1.1;
  margin-top: 2px;
}
.stat-value.ok { color: var(--ok); }
.stat-value.warn { color: var(--warn); }
.stat-value.danger { color: var(--danger); }

/* body */
.users-body {
  flex: 1; overflow-y: auto;
  background: var(--bg);
}
.users-table-wrap {
  background: var(--paper);
  margin: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.users-table {
  width: 100%; border-collapse: collapse;
}
.users-table th, .users-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.users-table thead th {
  background: var(--bg-sub);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
}
.users-table tbody tr:last-child td { border-bottom: 0; }
.users-table .empty-cell {
  text-align: center; padding: 48px;
  color: var(--muted-2);
}

.user-row {
  cursor: pointer;
  transition: background var(--t-fast);
}
.user-row:hover { background: var(--bg-sub); }
.user-row.selected {
  background: var(--accent-bg);
  box-shadow: inset 2px 0 0 var(--accent);
}
.user-row td:last-child { color: var(--muted-2); }

.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell-text { min-width: 0; }
.user-cell-name { font-weight: 500; font-size: 13.5px; }
.user-cell-login { font-size: 11px; line-height: 1.4; }

/* avatars with tone */
.user-avatar.md { width: 36px; height: 36px; font-size: 12.5px; }
.user-avatar.lg { width: 44px; height: 44px; font-size: 14.5px; }
.user-avatar.tone-danger { background: var(--danger-bg); color: var(--danger); }
.user-avatar.tone-accent { background: var(--accent-bg); color: var(--accent); }
.user-avatar.tone-ok    { background: var(--ok-bg);    color: var(--ok); }
.user-avatar.tone-warn  { background: var(--warn-bg);  color: var(--warn); }
.user-avatar.tone-muted { background: var(--bg-sub);  color: var(--muted); border: 1px solid var(--line); }

/* role pill */
.role-pill {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 9px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.role-pill.role-danger { background: var(--danger-bg); color: var(--danger); }
.role-pill.role-accent { background: var(--accent-bg); color: var(--accent); }
.role-pill.role-muted  { background: var(--bg-sub);    color: var(--muted); border: 1px solid var(--line); }

/* group chips */
.group-chips {
  display: flex; flex-wrap: wrap; gap: 4px;
}

/* access count */
.access-count {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--fg-2);
}
.access-count svg { color: var(--muted); }

/* status tag */
.status-tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px 0 7px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 500;
  background: var(--bg-sub);
  border: 1px solid var(--line);
}
.status-tag.tone-ok      { background: var(--ok-bg);      color: var(--ok);      border-color: transparent; }
.status-tag.tone-warn    { background: var(--warn-bg);    color: var(--warn);    border-color: transparent; }
.status-tag.tone-offline { background: var(--offline-bg); color: var(--offline); border-color: transparent; }

/* user card variant */
.user-card {
  position: absolute;
  right: 16px; top: 16px; bottom: 16px;
  width: min(480px, calc(100% - 40px));
}
.user-card .user-avatar.lg { flex-shrink: 0; }
.kv-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.kv-row:last-child { border-bottom: 0; }
.kv-row > span:first-child { color: var(--muted); }

.card-section.first { margin-top: 0; padding-top: 0; border-top: 0; }

/* grants — beacons + groups */
.grant-target { display: flex; align-items: center; gap: 10px; }
.grant-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-2);
  flex-shrink: 0;
}
.grant-icon.beacon { background: var(--accent-bg); color: var(--accent); }
.grant-icon.group  { background: oklch(96% 0.03 145); color: var(--ok); }
[data-theme="dark"] .grant-icon.group { background: oklch(28% 0.06 145); }

/* login history table */
.login-table {
  width: 100%; border-collapse: collapse;
}
.login-table th, .login-table td {
  padding: 8px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.login-table th {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 500;
}
.login-table tbody tr.login-fail td { background: oklch(98% 0.02 25); }
[data-theme="dark"] .login-table tbody tr.login-fail td { background: oklch(22% 0.03 25); }

/* ───────── AUDIT LOG ───────── */
.audit-screen {
  grid-column: 1 / -1;
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.audit-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px;
  padding: 18px 24px 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.audit-title {
  margin: 0; font-size: 20px; font-weight: 600;
  letter-spacing: -0.01em;
}
.audit-sub {
  margin: 4px 0 0; font-size: 12.5px;
  max-width: 640px; line-height: 1.45;
}
.audit-stats {
  display: grid; grid-template-columns: repeat(4, auto);
  gap: 18px;
}
.stat-cell.sm { padding: 0; }
.stat-cell.sm .stat-value { font-size: 22px; }

.audit-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 24px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.range-tabs {
  display: inline-flex; align-items: center;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: 2px;
}
.range-tab {
  height: 26px; padding: 0 10px;
  background: transparent; border: 0;
  border-radius: var(--r-1);
  font-size: 12px; color: var(--muted); font-weight: 500;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: background var(--t-fast), color var(--t-fast);
}
.range-tab:hover { color: var(--fg); }
.range-tab.active { background: var(--paper); color: var(--fg); box-shadow: var(--shadow-sm); }

.audit-search { flex: 1 1 240px; max-width: 360px; }

.live-btn {
  display: inline-flex; align-items: center; gap: 6px;
}
.live-btn.on { color: var(--ok); border-color: var(--ok); }

/* table */
.audit-table-wrap {
  flex: 1; overflow-y: auto;
  background: var(--paper);
  border-top: 0;
}
.audit-table {
  width: 100%;
  border-collapse: collapse;
}
.audit-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-sub);
  font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 500;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.audit-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 12.5px;
}

.audit-row { cursor: pointer; transition: background var(--t-fast); }
.audit-row:hover { background: var(--bg-sub); }
.audit-row.selected { background: var(--accent-bg); }

.audit-sev-cell { padding: 0 !important; width: 4px; }
.sev-bar {
  display: block; width: 3px; height: 100%; min-height: 28px;
  background: var(--line);
  margin: 0;
}
.sev-bar.tone-muted  { background: var(--line-2); }
.sev-bar.tone-warn  { background: var(--warn); }
.sev-bar.tone-danger { background: var(--danger); }
.audit-row.sev-warn  td:first-child + td { color: var(--fg); }
.audit-row.sev-danger { background: oklch(99% 0.012 25); }
.audit-row.sev-danger:hover { background: oklch(97% 0.025 25); }
[data-theme="dark"] .audit-row.sev-danger { background: oklch(21% 0.025 25); }
[data-theme="dark"] .audit-row.sev-danger:hover { background: oklch(24% 0.035 25); }

.audit-time { white-space: nowrap; }
.audit-time .mono { font-size: 11.5px; color: var(--muted); }

.audit-actor { display: flex; align-items: center; gap: 8px; }
.audit-actor-text { min-width: 0; line-height: 1.25; }

.audit-text-cell { min-width: 0; }
.audit-text {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 520px;
}

.audit-target {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px;
  padding: 2px 7px;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  color: var(--fg-2);
}
.audit-target svg { color: var(--muted); }

.cat-tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px;
  border-radius: var(--r-1);
  font-size: 11px; font-weight: 500;
  border: 1px solid transparent;
}
.cat-tag.tone-accent { background: var(--accent-bg); color: var(--accent); }
.cat-tag.tone-ok      { background: var(--ok-bg);      color: var(--ok); }
.cat-tag.tone-warn    { background: var(--warn-bg);    color: var(--warn); }
.cat-tag.tone-muted  { background: var(--bg-sub);    color: var(--muted); border-color: var(--line); }

.audit-foot {
  padding: 10px 24px;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--bg-sub);
  border-top: 1px solid var(--line);
  text-align: center;
}

/* detail drawer (reuses .marker-card) */
.audit-detail {
  width: min(440px, calc(100% - 32px));
}
.card-model-pill.tone-accent { background: var(--accent-bg); color: var(--accent); border-color: transparent; }
.card-model-pill.tone-ok      { background: var(--ok-bg);      color: var(--ok);      border-color: transparent; }
.card-model-pill.tone-warn    { background: var(--warn-bg);    color: var(--warn);    border-color: transparent; }
.card-model-pill.tone-muted  { background: var(--bg-sub);    color: var(--muted); }

.raw-block {
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--fg-2);
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
}

/* ───────── REPORTS ───────── */
.reports-screen {
  grid-column: 1 / -1;
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
  background: var(--bg);
  overflow: hidden;
}
.reports-toolbar { background: var(--paper); }

/* ─── gallery ─── */
.rep-gallery-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 40px;
}
.rep-gallery-head { margin: 8px 0 24px; }
.rep-gallery-title {
  margin: 0;
  font-size: 22px; font-weight: 600;
  letter-spacing: -0.01em;
}
.rep-gallery-sub {
  margin: 6px 0 0;
  font-size: 13px;
  max-width: 640px;
  line-height: 1.5;
}
.rep-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.rep-card {
  display: flex; flex-direction: column;
  align-items: stretch; text-align: left;
  padding: 18px 18px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  cursor: pointer;
  font-family: inherit; color: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-med), transform var(--t-fast);
  min-height: 196px;
}
.rep-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.rep-card:hover .rep-card-icon {
  background: var(--accent); color: var(--accent-fg);
}
.rep-card:hover .rep-card-cta {
  color: var(--accent);
  gap: 8px;
}
.rep-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.rep-card-icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-bg); color: var(--accent);
  border-radius: var(--r-2);
  transition: background var(--t-fast), color var(--t-fast);
}
.rep-card-fmts {
  font-size: 10.5px;
  padding: 3px 8px;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.rep-card-title {
  margin: 0 0 6px;
  font-size: 16px; font-weight: 600;
  letter-spacing: -0.005em;
}
.rep-card-desc {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  flex: 1;
}
.rep-card-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.rep-card-cta {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500;
  color: var(--muted);
  transition: color var(--t-fast), gap var(--t-fast);
}
.rep-card-cta svg { transition: transform var(--t-fast); }

/* ─── builder ─── */
.rep-builder {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(440px, 1.4fr);
  min-height: 0;
  background: var(--bg);
  gap: 1px;
}
.rep-builder.with-back {
  display: flex; flex-direction: column;
  gap: 0;
}
.rep-builder.with-back .rep-builder-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(440px, 1.4fr);
  min-height: 0;
  gap: 1px;
  background: var(--line);
}
.rep-builder.with-back .rep-builder-body > * { background: var(--paper); min-height: 0; }
.rep-builder > * { background: var(--paper); min-height: 0; }

.rep-sub-head {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.rep-sub-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.rep-sub-title p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.no-border-l { border-left: 0 !important; }

/* Middle: form */
.rep-form { display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.rep-form-head { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.rep-form-title { display: flex; align-items: center; gap: 12px; }
.rep-form-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-bg); color: var(--accent);
  border-radius: var(--r-2);
}

.rep-form-body {
  flex: 1; overflow-y: auto;
  padding: 16px 18px;
}
.rep-form-foot {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  background: var(--bg-sub);
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.form-row { margin-bottom: 16px; }
.form-row:last-child { margin-bottom: 0; }
.form-label {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 11.5px; color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.form-hint { font-size: 11px; color: var(--muted-2); }
.form-control input,
.form-control select {
  font-size: 13px;
}

.period-row {
  display: flex; align-items: center; gap: 8px;
}
.period-row input { flex: 1; min-width: 0; }
.period-shortcuts {
  display: flex; gap: 4px;
  margin-top: 8px;
}
.period-chip {
  height: 24px; padding: 0 10px;
  background: var(--bg-sub); border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px; color: var(--muted);
  cursor: pointer;
  font-family: var(--font-mono);
}
.period-chip:hover { color: var(--accent); border-color: var(--accent); }

.check-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  cursor: pointer; user-select: none;
}

.chip-cloud { display: flex; flex-wrap: wrap; gap: 4px; }
.chip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px;
  background: transparent; border: 0;
  border-radius: 999px;
  color: inherit; opacity: 0.6;
  cursor: pointer; padding: 0;
  margin-left: 2px;
}
.chip-x:hover { opacity: 1; background: rgba(0,0,0,0.08); }
[data-theme="dark"] .chip-x:hover { background: rgba(255,255,255,0.12); }

/* multi object picker */
.obj-multi { display: flex; flex-direction: column; gap: 8px; }
.obj-chips { display: flex; flex-wrap: wrap; gap: 4px; min-height: 26px; }
.obj-pick-list {
  border: 1px solid var(--line); border-radius: var(--r-2);
  max-height: 180px; overflow-y: auto;
  background: var(--paper);
}
.obj-pick {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center; gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  cursor: pointer;
}
.obj-pick:last-child { border-bottom: 0; }
.obj-pick:hover { background: var(--bg-sub); }
.obj-pick.on { background: var(--accent-bg); }
.obj-pick-name { font-weight: 500; }

/* mode & format */
.rep-mode { display: flex; gap: 2px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-2); padding: 2px; }
.mode-tab {
  height: 26px; padding: 0 12px;
  background: transparent; border: 0;
  border-radius: var(--r-1);
  font-size: 12px; color: var(--muted); font-weight: 500;
  cursor: pointer;
}
.mode-tab:hover { color: var(--fg); }
.mode-tab.active { background: var(--fg); color: var(--bg); }

.rep-format { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.fmt-pill {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-2);
  color: var(--muted); cursor: pointer;
}
.fmt-pill:hover { color: var(--fg); border-color: var(--line-strong); }
.fmt-pill.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* Preview side */
.rep-preview { display: flex; flex-direction: column; background: var(--bg-sub); }
.rep-preview-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.rep-preview-body {
  flex: 1; overflow-y: auto;
  padding: 16px;
}

.preview-table-wrap {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.preview-table {
  width: 100%; border-collapse: collapse;
  font-size: 11.5px;
}
.preview-table thead th {
  background: var(--bg-sub);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 500;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.preview-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.preview-table tbody tr:last-child td { border-bottom: 0; }
.preview-fade {
  position: absolute; left: 0; right: 0; bottom: 0; height: 30px;
  background: linear-gradient(to bottom, transparent, var(--paper));
  pointer-events: none;
}

/* map preview */
.map-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line); border-radius: var(--r-2);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  background: var(--map-bg);
}
.map-preview .map-bg { position: absolute; inset: 0; }
.map-preview-legend {
  position: absolute; left: 12px; bottom: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: 10px 12px;
  font-size: 12px;
  box-shadow: var(--shadow-sm);
}
.legend-row .dot.accent { background: var(--accent); }

/* schedule block */
.schedule-block {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: 14px 18px;
  margin-top: 14px;
}
.schedule-grid {
  display: grid;
  grid-template-columns: 200px 120px 1fr;
  gap: 12px;
  align-items: end;
}

/* responsive */
@media (max-width: 1280px) {
  .rep-builder.with-back .rep-builder-body { grid-template-columns: minmax(320px, 1fr) minmax(360px, 1.2fr); }
}
@media (max-width: 1100px) {
  .rep-builder.with-back .rep-builder-body {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    overflow-y: auto;
  }
  .rep-form, .rep-preview { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* ───────── SETTINGS ───────── */
.settings-screen {
  grid-column: 1 / -1;
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
  background: var(--bg);
  overflow: hidden;
}
.settings-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px;
  padding: 18px 24px 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.settings-dirty { flex-shrink: 0; }
.dirty-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px 0 8px;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px; color: var(--fg-2);
}
.dirty-pill.off { color: var(--ok); border-color: transparent; background: var(--ok-bg); }
.dirty-pill.on  { color: var(--warn); border-color: transparent; background: var(--warn-bg); }

.settings-body {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 240px 1fr;
  background: var(--paper);
}

/* rail */
.settings-rail {
  border-right: 1px solid var(--line);
  padding: 12px 10px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.settings-nav {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  height: 34px; padding: 0 12px;
  background: transparent; border: 0;
  border-radius: var(--r-2);
  font-family: inherit;
  font-size: 13px; font-weight: 500;
  color: var(--fg-2);
  text-align: left; cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.settings-nav:hover { background: var(--bg-sub); color: var(--fg); }
.settings-nav.active { background: var(--accent-bg); color: var(--accent); }
.settings-nav.active svg { color: var(--accent); }
.settings-nav svg { color: var(--muted); flex-shrink: 0; }
.settings-nav.active svg { color: var(--accent); }

/* content */
.settings-content {
  display: flex; flex-direction: column;
  min-height: 0;
  background: var(--bg);
}
.settings-content-inner {
  flex: 1; overflow-y: auto;
  padding: 20px 28px 28px;
  display: flex; flex-direction: column; gap: 16px;
  max-width: 880px;
  width: 100%;
}
.settings-foot {
  display: flex; align-items: center; gap: 8px; justify-content: flex-end;
  padding: 12px 28px;
  background: var(--paper);
  border-top: 1px solid var(--line);
}
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* panel card */
.set-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  overflow: hidden;
  flex-shrink: 0;
}
.set-card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
}
.set-card-title { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.005em; }
.set-card-hint { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; max-width: 560px; }
.set-card-body { padding: 6px 20px 14px; }

.setting-row {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.setting-row:last-child { border-bottom: 0; }
.setting-row-text { flex: 1; min-width: 0; }
.setting-row-label { font-size: 13.5px; font-weight: 500; }
.setting-row-hint { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.setting-row-control { flex-shrink: 0; max-width: 50%; }
.setting-row.danger .setting-row-label { color: var(--danger); }

/* segmented control */
.seg {
  display: inline-flex;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: 2px;
}
.seg-item {
  height: 26px; padding: 0 12px;
  background: transparent; border: 0;
  border-radius: var(--r-1);
  font-size: 12px; color: var(--muted); font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}
.seg-item:hover { color: var(--fg); }
.seg-item.active { background: var(--paper); color: var(--fg); box-shadow: var(--shadow-sm); }

/* compact stats grid inside settings */
.set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  overflow: hidden;
  margin: 8px 0 12px;
}
.set-grid .stat-cell {
  background: var(--paper);
  padding: 12px 14px;
}

/* code/endpoint pill */
.code-pill {
  display: inline-block;
  font-size: 11.5px;
  padding: 4px 10px;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  color: var(--fg-2);
}

/* esim cards */
.esim-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 4px 0 10px;
}
.esim-card {
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: 12px 14px;
  background: var(--paper);
  display: flex; flex-direction: column; gap: 8px;
}
.esim-card.status-active { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line); }
.esim-head { display: flex; align-items: center; justify-content: space-between; }
.esim-name { font-weight: 600; font-size: 14px; }
.esim-body { display: flex; flex-direction: column; gap: 2px; }
.esim-body .kv-row { padding: 4px 0; font-size: 12px; border-bottom: 0; }
.esim-foot { display: flex; gap: 6px; margin-top: 4px; }

/* about */
.about-hero {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 0 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
  color: var(--accent);
}
.about-hero h2, .about-hero p { color: var(--fg); }
.about-hero p { color: var(--muted); }
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}
.about-grid .kv-row { padding: 8px 0; }

/* responsive */
@media (max-width: 900px) {
  .settings-body { grid-template-columns: 1fr; }
  .settings-rail {
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px;
    flex-shrink: 0;
  }
  .settings-nav { width: auto; flex-shrink: 0; }
}

/* ───────── STUB SCREENS ───────── */
.stub {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  height: 100%;
  padding: 40px;
  background: var(--bg-sub);
  grid-column: 1 / -1;
}
.stub-icon {
  color: var(--muted-2);
  margin-bottom: 16px;
}
.stub h1 {
  font-size: 22px; font-weight: 600; letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.stub p { color: var(--muted); max-width: 480px; margin: 0 0 18px; }
.stub-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
}

/* ───────── RESPONSIVE ───────── */
@media (max-width: 1100px) {
  .marker-card { width: min(400px, calc(100% - 32px)); }
}
@media (max-width: 960px) {
  .topbar-user .user-text { display: none; }
  .marker-card { width: min(360px, calc(100% - 24px)); right: 12px; top: 12px; bottom: 12px; }
}

@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; grid-template-areas: "top" "main"; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    z-index: var(--z-modal);
    width: 232px;
    transform: translateX(-100%);
    transition: transform var(--t-med);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: inline-flex; }
  .breadcrumbs { display: none; }
  .topbar-user { display: none; }
  .topbar-search { max-width: none; }
  .main {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }
  .beacon-list {
    position: absolute; inset: 0;
    z-index: var(--z-panel);
    transform: translateX(0);
    transition: transform var(--t-med);
  }
  [data-mobile-view="map"] .beacon-list { transform: translateX(-100%); }
  .map-shell { position: absolute; inset: 0; }
  .marker-card {
    left: 0; right: 0; top: auto; bottom: 0;
    width: 100%;
    height: 75vh;
    border-radius: var(--r-4) var(--r-4) 0 0;
  }
  .mobile-switch {
    position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 4px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px;
    z-index: var(--z-panel);
    box-shadow: var(--shadow-lg);
  }
  .mobile-switch button {
    height: 32px; padding: 0 14px;
    background: transparent; border: 0;
    border-radius: 999px;
    font-size: 12.5px; color: var(--muted);
    cursor: pointer;
  }
  .mobile-switch button.active { background: var(--fg); color: var(--bg); }
}
.mobile-switch { display: none; }
@media (max-width: 768px) { .mobile-switch { display: flex; } }

/* ═══════════════════════ LOGIN SCREEN ═══════════════════════ */
.login-wrap {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--bg); font-family: var(--font-sans);
}
.login-card {
  width: 360px; max-width: 92vw; box-sizing: border-box;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-4);
  padding: 40px 32px 30px; box-shadow: var(--shadow-lg); color: var(--fg);
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 16px; }
/* Анимированный радар-логотип: расходящиеся кольца от ядра (в стиле MayakMark). */
.login-logo {
  position: relative; width: 76px; height: 76px;
  display: grid; place-items: center; color: var(--accent);
}
.login-logo .lr-ring {
  position: absolute; inset: 0; margin: auto; width: 22px; height: 22px;
  border: 1.5px solid var(--accent); border-radius: 999px;
  opacity: 0; animation: login-ping 2.6s cubic-bezier(.2, .6, .3, 1) infinite;
}
.login-logo .lr-ring:nth-child(2) { animation-delay: .85s; }
.login-logo .lr-ring:nth-child(3) { animation-delay: 1.7s; }
.login-logo .lr-core {
  position: relative; width: 13px; height: 13px; border-radius: 999px;
  background: var(--accent); box-shadow: 0 0 16px 1px var(--accent);
  animation: login-core 2.6s ease-in-out infinite;
}
@keyframes login-ping {
  0%   { transform: scale(.55); opacity: 0; }
  12%  { opacity: .6; }
  100% { transform: scale(3.3); opacity: 0; }
}
@keyframes login-core {
  0%, 100% { transform: scale(1); opacity: .9; }
  50%      { transform: scale(1.12); opacity: 1; }
}
.login-title {
  font-size: 23px; font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase; color: var(--fg);
}
.login-sub {
  color: var(--muted); font-size: 12.5px; text-align: center;
  margin: 8px 0 26px; letter-spacing: .01em;
}
.login-label {
  display: block; font-size: 11px; color: var(--muted); margin: 0 0 6px;
  letter-spacing: .05em; text-transform: uppercase;
}
.login-input {
  width: 100%; box-sizing: border-box; padding: 11px 13px; margin-bottom: 15px;
  background: var(--bg-sub); border: 1px solid var(--line); border-radius: var(--r-3);
  color: var(--fg); font-size: 14px; outline: none; font-family: var(--font-sans);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.login-input::placeholder { color: var(--muted-2); }
.login-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.login-btn {
  width: 100%; padding: 12px; margin-top: 6px; border: none; border-radius: var(--r-3);
  background: var(--accent); color: var(--accent-fg); font-size: 14.5px; font-weight: 600;
  letter-spacing: .02em; cursor: pointer; font-family: var(--font-sans);
  transition: filter var(--t-fast), transform var(--t-fast);
}
.login-btn:hover:not(:disabled) { filter: brightness(1.06); }
.login-btn:active:not(:disabled) { transform: translateY(1px); }
.login-btn:disabled { opacity: .55; cursor: default; }
.login-err {
  background: var(--danger-bg); border: 1px solid var(--danger); color: var(--danger);
  border-radius: var(--r-2); padding: 9px 11px; font-size: 12.5px; margin-bottom: 15px;
}
@media (prefers-reduced-motion: reduce) {
  .login-logo .lr-ring, .login-logo .lr-core { animation: none; }
  .login-logo .lr-ring:first-child { opacity: .4; transform: scale(2.2); }
}
