/* webapp/static/style.css — общая дизайн-система shell'а и всех вкладок. */

:root {
  --bg: #060a13;
  --card-bg: rgba(255, 255, 255, 0.045);
  --card-bg-solid: #12172490;
  --field-bg: rgba(255, 255, 255, 0.045);
  --hover-bg: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.17);
  --text: #eef1f7;
  --text-muted: #97a0b3;
  --text-faint: #666f83;
  --accent: #46e0d4;
  --accent-2: #6be8de;
  --accent-soft: rgba(70, 224, 212, 0.16);
  --accent-line: #46e0d4;
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.14);
  --green-text: #5fe3b3;
  --amber: #ffb454;
  --amber-soft: rgba(255, 180, 84, 0.14);
  /* смысловой "синий=база" в графиках/таблицах (см. chart-canvas.js, #378ADD) —
     держим отдельно от --accent, который теперь бирюзовый бренд-цвет */
  --blue: #378add;
  --red: #f2555a;
  --red-soft: rgba(242, 85, 90, 0.14);

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 10px rgba(0, 0, 0, 0.22), 0 18px 40px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2), 0 2px 10px rgba(0, 0, 0, 0.18);
  --shadow-lift: 0 10px 24px rgba(0, 0, 0, 0.35), 0 30px 60px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 28px;
  --fs-xs: 11px; --fs-sm: 12px; --fs-base: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 21px;

  --sidebar-w: 232px;
  --topbar-h: 56px;
  --blur: blur(22px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 620px at 12% -8%, rgba(70, 224, 212, 0.20), transparent 60%),
    radial-gradient(900px 520px at 92% 4%, rgba(255, 180, 84, 0.12), transparent 58%),
    radial-gradient(700px 500px at 50% 110%, rgba(52, 211, 153, 0.06), transparent 60%),
    linear-gradient(180deg, #0a1120 0%, #05070c 55%, #040509 100%);
  background-attachment: fixed;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  font-size: var(--fs-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.006em;
}
::selection { background: var(--accent-soft); color: var(--accent-2); }
a { color: inherit; }

/* ── shell ─────────────────────────────────────────────────────────── */

#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  background: rgba(9, 13, 22, 0.55); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02), 0 12px 28px rgba(0, 0, 0, 0.25);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--sp-5); z-index: 100;
}
#topbar .brand { font-weight: 800; font-size: var(--fs-md); display: flex; align-items: center; gap: var(--sp-2); letter-spacing: -0.015em; }
#topbar .brand .brand-mark, .login-brand .brand-mark {
  width: 27px; height: 27px; border-radius: 8px;
  background: linear-gradient(155deg, var(--accent-2), var(--accent));
  box-shadow: 0 2px 10px rgba(70, 224, 212, 0.45);
  color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
#topbar .who { font-size: var(--fs-base); color: var(--text-muted); display: flex; align-items: center; gap: var(--sp-2); }
#topbar .role-badge {
  font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent-2); text-transform: uppercase; letter-spacing: 0.05em;
}
.logout-btn {
  display: inline-flex; align-items: center; justify-content: center; margin-left: var(--sp-2);
  width: 28px; height: 28px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; color: var(--text-muted); cursor: pointer; transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.logout-btn:hover { background: var(--red-soft); color: var(--red); border-color: rgba(242, 85, 90, 0.35); }

/* ── уведомления (bell-виджет топбара) ────────────────────────────── */

.notif-wrap { position: relative; display: flex; align-items: center; }
.notif-bell-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; color: var(--text-muted); cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.notif-bell-btn:hover { background: var(--hover-bg); color: var(--text); }
.notif-badge {
  position: absolute; top: 2px; right: 2px; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  line-height: 15px; text-align: center;
}
.notif-panel {
  position: absolute; top: calc(100% + 10px); right: 0; width: 340px; max-height: 420px;
  overflow-y: auto; background: var(--card-bg-solid); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lift); z-index: 300;
}
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border);
  font-size: var(--fs-base); font-weight: 700; position: sticky; top: 0;
  background: var(--card-bg-solid); backdrop-filter: var(--blur);
}
.notif-mark-all {
  font-size: var(--fs-xs); font-weight: 600; color: var(--accent-2); background: none; border: none; cursor: pointer;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-panel-list { padding: var(--sp-2); }
.notif-empty { padding: var(--sp-4); text-align: center; color: var(--text-muted); font-size: var(--fs-sm); }
.notif-item {
  padding: var(--sp-3); border-radius: var(--radius-sm); margin-bottom: 2px; cursor: default;
  transition: background 0.15s var(--ease);
}
.notif-item.unread { background: var(--accent-soft); cursor: pointer; }
.notif-item.unread:hover { background: var(--hover-bg); }
.notif-item-kind { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent-2); margin-bottom: 2px; }
.notif-item-title { font-size: var(--fs-base); font-weight: 600; }
.notif-item-body { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 2px; word-break: break-word; }
.notif-item-time { font-size: var(--fs-xs); color: var(--text-faint); margin-top: 4px; }

/* ── логин ─────────────────────────────────────────────────────────── */

#login-screen[hidden] { display: none; }
#login-screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  background-image:
    radial-gradient(1100px 620px at 12% -8%, rgba(70, 224, 212, 0.22), transparent 60%),
    radial-gradient(900px 520px at 92% 4%, rgba(255, 180, 84, 0.13), transparent 58%),
    linear-gradient(180deg, #0a1120 0%, #05070c 55%, #040509 100%);
  z-index: 200;
}
.login-card {
  width: 328px; background: var(--card-bg-solid); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lift); padding: var(--sp-6) var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-4);
}
.login-brand {
  display: flex; align-items: center; gap: var(--sp-2); font-weight: 800; font-size: var(--fs-lg);
  letter-spacing: -0.015em; margin-bottom: var(--sp-2);
}
.login-field { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); }
.login-field input {
  font-size: var(--fs-md); padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--field-bg); color: var(--text); transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.login-field input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-error { font-size: var(--fs-sm); color: var(--red); background: var(--red-soft); border-radius: var(--radius-sm); padding: 8px 10px; }
.login-submit { width: 100%; justify-content: center; padding: 10px 0; font-size: var(--fs-md); }

#sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--sidebar-w);
  background: rgba(9, 13, 22, 0.45); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-right: 1px solid var(--border);
  padding: var(--sp-3) var(--sp-3) var(--sp-4); display: flex; flex-direction: column; gap: 1px; overflow-y: auto;
}
.nav-section-title {
  font-size: 10px; font-weight: 700; color: var(--text-faint); text-transform: uppercase;
  letter-spacing: 0.08em; padding: var(--sp-4) var(--sp-3) var(--sp-2);
}
.nav-section-title:first-child { padding-top: var(--sp-2); }
#sidebar a.nav-item {
  display: flex; align-items: center; gap: var(--sp-3); padding: 8px var(--sp-3); border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; font-size: var(--fs-base); font-weight: 500; position: relative;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
#sidebar a.nav-item .ic { display: flex; align-items: center; color: var(--text-muted); flex-shrink: 0; transition: color 0.15s var(--ease); }
#sidebar a.nav-item:hover { background: var(--hover-bg); }
#sidebar a.nav-item.active { background: var(--accent-soft); color: var(--accent-2); font-weight: 700; box-shadow: inset 3px 0 0 var(--accent-2); }
#sidebar a.nav-item.active .ic { color: var(--accent-2); }
#sidebar a.nav-item.soon { opacity: 0.5; }
#sidebar a.nav-item .soon-tag {
  margin-left: auto; font-size: 9px; background: rgba(255, 255, 255, 0.08); color: var(--text-muted);
  padding: 1px 6px; border-radius: 8px; text-transform: uppercase; font-weight: 700;
}

#view {
  margin-left: var(--sidebar-w); margin-top: var(--topbar-h);
  padding: var(--sp-5) var(--sp-6); min-height: calc(100vh - var(--topbar-h)); max-width: 1180px;
}

#loading {
  position: fixed; inset: 0; background: rgba(5, 7, 12, 0.75); backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center;
  font-size: var(--fs-base); color: var(--text-muted); z-index: 9999; flex-direction: column; gap: var(--sp-3);
}
#loading .spinner {
  width: 26px; height: 26px; border: 3px solid var(--border); border-top-color: var(--accent-2);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── общие элементы ────────────────────────────────────────────────── */

.card {
  background: var(--card-bg); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: var(--sp-4) var(--sp-5);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.15s var(--ease), background 0.15s var(--ease);
}
.card.selectable { cursor: pointer; }
.card.selectable:hover { border-color: var(--border-strong); background: var(--hover-bg); box-shadow: var(--shadow); transform: translateY(-1px); }
.card.selected { border-color: var(--accent-2); box-shadow: 0 0 0 2px var(--accent-soft); }

.page-title { font-size: var(--fs-xl); font-weight: 800; margin-bottom: var(--sp-5); letter-spacing: -0.02em; }
.section-title { font-size: var(--fs-md); font-weight: 700; margin-bottom: var(--sp-3); letter-spacing: -0.008em; }
.section-hint { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--sp-3); line-height: 1.5; }

.grid { display: grid; gap: var(--sp-4); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }

.btn {
  font-size: var(--fs-base); padding: 7px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--field-bg); color: var(--text); cursor: pointer; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; line-height: 1.3;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.1s var(--ease);
}
.btn:hover { background: var(--hover-bg); border-color: var(--text-faint); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(155deg, var(--accent-2), var(--accent)); color: #04140f; border-color: var(--accent); box-shadow: 0 1px 2px rgba(70, 224, 212, 0.25), 0 6px 16px rgba(70, 224, 212, 0.3); }
.btn-primary:hover { background: linear-gradient(155deg, #8ff2e8, #2fb8ae); box-shadow: 0 2px 6px rgba(70, 224, 212, 0.32), 0 8px 20px rgba(70, 224, 212, 0.38); }
.btn-danger { color: var(--red); border-color: rgba(242, 85, 90, 0.35); }
.btn-danger:hover { background: var(--red-soft); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 700; vertical-align: middle; }
.tag-blue  { background: var(--accent-soft); color: var(--accent-2); }
.tag-green { background: var(--green-soft); color: var(--green-text); }
.tag-save  { background: var(--green-soft); color: var(--green-text); font-size: 12px; padding: 3px 10px; }
.tag-muted { background: rgba(255, 255, 255, 0.08); color: var(--text-muted); }
.tag-amber { background: var(--amber-soft); color: var(--amber); }
.tag-red   { background: var(--red-soft); color: var(--red); }

/* Всплывающая подсказка на CSS (не нативный title) — тот всплывает с
   задержкой браузера и не всегда виден (жаловались, что видно только
   курсор-"?" от cursor:help, а текста нет). Разметка: <span class="tip">
   <иконка/текст-триггер>
   <span class="tip-bubble">пояснение</span></span> — bubble появляется сразу
   по чистому :hover, без JS. */
.tip { position: relative; display: inline-flex; align-items: center; cursor: help; }
.tip .tip-bubble {
  visibility: hidden; opacity: 0; position: absolute; bottom: calc(100% + 7px); left: 50%;
  transform: translateX(-50%); background: var(--card-bg-solid); backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur); color: var(--text); border: 1px solid var(--border-strong);
  padding: 8px 11px; border-radius: var(--radius-sm); font-size: var(--fs-sm); font-weight: 400;
  line-height: 1.45; white-space: normal; width: max-content; max-width: 280px; text-align: left;
  box-shadow: var(--shadow-lift); z-index: 60; transition: opacity 0.12s var(--ease); pointer-events: none;
}
.tip:hover .tip-bubble, .tip:focus-visible .tip-bubble { visibility: visible; opacity: 1; }
/* Раскрытие вниз вместо вверх — для триггеров у верхнего края контейнера с
   overflow:hidden (см. dom-utils.js:tip, параметр direction='down'). */
.tip.tip-down .tip-bubble { bottom: auto; top: calc(100% + 7px); }

.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-dot.ok { background: var(--green); box-shadow: 0 0 6px rgba(52, 211, 153, 0.6); }
.status-dot.off { background: var(--text-faint); }
.status-dot.warn { background: var(--amber); box-shadow: 0 0 6px rgba(245, 167, 66, 0.5); }

.status-msg { font-size: var(--fs-sm); color: var(--text-muted); min-height: 16px; }
.status-msg.err { color: var(--red); }

.setup-row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.setup-row label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); min-width: 80px; }
.setup-row select, .setup-row input[type=text], .setup-row input[type=number], .setup-row input[type=date], .setup-row input:not([type]), .setup-row input[type=file] {
  font-size: var(--fs-base); padding: 7px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--field-bg); color: var(--text);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.setup-row select:focus, .setup-row input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
select, input, textarea, button { font-family: inherit; }
select, .setup-row select, input[type=date] { color-scheme: dark; }
textarea { font-family: ui-monospace, monospace; font-size: var(--fs-sm); padding: var(--sp-2); border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--field-bg); color: var(--text); min-height: 70px; resize: vertical; width: 100%; }

table.data-table { width: 100%; border-collapse: collapse; }
table.data-table th { font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 0 var(--sp-3) var(--sp-2) 0; text-align: left; border-bottom: 1px solid var(--border); }
table.data-table td { padding: 11px var(--sp-3) 11px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); font-size: var(--fs-base); }
table.data-table tbody tr { transition: background 0.12s var(--ease); }
table.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr.route-row.selected { background: var(--accent-soft); }
table.data-table tbody tr.route-row.selected td:first-child { color: var(--accent-2); font-weight: 700; }

.empty-state { text-align: center; padding: 52px 20px; color: var(--text-muted); font-size: var(--fs-base); }
.empty-state .empty-icon {
  display: flex; justify-content: center; align-items: center; color: var(--text-faint);
  margin: 0 auto var(--sp-3); width: 56px; height: 56px; border-radius: 50%; background: rgba(255, 255, 255, 0.05);
}
.empty-state .empty-title { font-weight: 700; color: var(--text); margin-bottom: 4px; font-size: var(--fs-md); }

.chart-tooltip {
  position: fixed; z-index: 500; background: #0c0e14; color: #fff; font-size: var(--fs-sm);
  border: 1px solid var(--border); padding: 7px 10px; border-radius: var(--radius-sm); pointer-events: none; line-height: 1.5;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}
.chart-tooltip b { font-size: var(--fs-md); }
.chart-tooltip .muted { color: #a6acb8; }

.log-box {
  display: none; max-height: 180px; overflow-y: auto; background: #0c0e14; color: #c9cdd6;
  border: 1px solid var(--border);
  padding: var(--sp-3); border-radius: var(--radius-sm); font-family: ui-monospace, monospace; font-size: 11px;
  margin-top: var(--sp-3); line-height: 1.6;
}

/* ── карта/демо (перенесено из исходного podolsk_monitor.html) ───────── */

#map-app { display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--card-bg); box-shadow: var(--shadow); }
#map-top { display: flex; height: 400px; }
#map-canvas { flex: 1; }
#map-panel { width: 260px; background: var(--card-bg-solid); border-left: 1px solid var(--border); display: flex; flex-direction: column; padding: var(--sp-4) var(--sp-3); gap: var(--sp-3); overflow-y: auto; }
#map-controls { padding: var(--sp-2) var(--sp-4); border-top: 1px solid var(--border); display: flex; gap: var(--sp-2); background: var(--card-bg-solid); }
#map-compare { border-top: 1px solid var(--border); padding: var(--sp-4); background: var(--card-bg-solid); }
/* Раньше здесь стояла фиксированная height:150px — контент (высота/уклон +
   скорость + расход, ~400px+) обрезался родительским #map-app (overflow:
   hidden), поэтому графики скорости/расхода физически не были видны, только
   верхушка блока высоты. Авто-высота + собственный overflow:visible решают
   это без изменения #map-app. */
#map-bottom { border-top: 1px solid var(--border); padding: var(--sp-2) var(--sp-4) 14px; display: flex; flex-direction: column; gap: 3px; background: var(--card-bg-solid); overflow: visible; }
#chart-wrap { flex: 1; }
canvas#chart { width: 100%; height: 100%; display: block; }

.cmp-table { width: 100%; border-collapse: collapse; }
.cmp-table th { font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 0 0 var(--sp-2) 0; text-align: left; }
.cmp-table th:not(:first-child) { text-align: center; }
.cmp-table td { padding: 6px 0; border-top: 1px solid rgba(255, 255, 255, 0.06); font-size: var(--fs-base); color: var(--text); vertical-align: middle; }
.cmp-table td:not(:first-child) { text-align: center; font-weight: 600; }
.row-base td { background: rgba(55, 138, 221, 0.06); }
.row-opt  td { background: rgba(52, 211, 153, 0.06); }
.lbl { font-size: var(--fs-sm); color: var(--text-muted); font-weight: 400; padding-left: 4px; }
.val-blue  { color: var(--blue); }
.val-green { color: var(--green); }
.val-amber { color: var(--amber); }
.beta-row  { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: 6px; }
.beta-row input { flex: 1; }
.beta-lbl  { font-size: var(--fs-sm); color: var(--text-muted); }
.beta-val  { font-size: var(--fs-base); font-weight: 700; color: var(--text); min-width: 40px; }

.pt { font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 3px; }
.mc { background: rgba(255, 255, 255, 0.045); border-radius: var(--radius-sm); padding: var(--sp-2) var(--sp-3); }
.ml { font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: 2px; }
.mv { font-size: var(--fs-lg); font-weight: 700; color: var(--text); line-height: 1; }
.mu { font-size: var(--fs-xs); color: var(--text-muted); margin-left: 2px; }
.dv { height: 1px; background: var(--border); flex-shrink: 0; }
.pb { height: 4px; background: rgba(255, 255, 255, 0.08); border-radius: 2px; overflow: hidden; margin-top: 3px; }
.pf { height: 100%; background: var(--accent-line); border-radius: 2px; transition: width 0.3s; }
#map-controls button { flex: 1; font-size: var(--fs-base); padding: 9px 0; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--field-bg); color: var(--text); cursor: pointer; font-weight: 600; }
#map-controls button.active { background: var(--accent-soft); color: var(--accent-2); border-color: var(--accent-line); }
.leg { display: flex; align-items: center; gap: 5px; margin-bottom: 3px; }
.ld { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ll { font-size: var(--fs-xs); color: var(--text-muted); }
.sdot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); display: inline-block; margin-right: 4px; }
.anim .sdot { animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ── главная (Обзор): виджеты + сетка приложений, в стиле CasaOS ─────── */

.home-grid { display: grid; grid-template-columns: 268px 1fr; gap: var(--sp-5); align-items: start; }
@media (max-width: 900px) { .home-grid { grid-template-columns: 1fr; } }

.widget-stack { display: flex; flex-direction: column; gap: var(--sp-4); }

.widget-clock { padding: var(--sp-5); }
.widget-clock .clock-time { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.widget-clock .clock-date { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 6px; }

.widget-title { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); font-weight: 700; color: var(--text-muted); margin-bottom: var(--sp-4); }
.widget-title .ic { color: var(--text-faint); display: flex; }

.ring-row { display: flex; gap: var(--sp-4); justify-content: space-around; }
.ring-item { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ring-item svg { display: block; transform: rotate(-90deg); }
.ring-item .ring-pct { font-size: var(--fs-md); font-weight: 800; }
.ring-item .ring-label { font-size: var(--fs-xs); color: var(--text-muted); text-align: center; }
.ring-item .ring-wrap { position: relative; width: 74px; height: 74px; display: flex; align-items: center; justify-content: center; }
.ring-item .ring-wrap .ring-pct { position: absolute; }

.widget-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.widget-badge.ok { background: var(--green-soft); color: var(--green-text); }
.widget-badge.warn { background: var(--amber-soft); color: var(--amber); }
.widget-badge.muted { background: rgba(255, 255, 255, 0.08); color: var(--text-muted); }

.storage-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-3); }
.storage-meta { font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--sp-2); }
.storage-meta b { color: var(--text); font-weight: 700; }
.storage-bar { height: 8px; border-radius: 5px; background: rgba(255, 255, 255, 0.07); overflow: hidden; display: flex; }
.storage-bar > span { height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }

.spark-wrap { height: 54px; display: flex; align-items: flex-end; }
.spark-wrap svg { width: 100%; height: 100%; overflow: visible; }
.spark-foot { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--text-muted); margin-top: var(--sp-2); }

.search-bar {
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--card-bg); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px var(--sp-4); margin-bottom: var(--sp-5); color: var(--text-faint);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.search-bar:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-bar input {
  flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: var(--fs-md); font-family: inherit;
}
.search-bar input::placeholder { color: var(--text-faint); }

.promo-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); margin-bottom: var(--sp-5); }
@media (max-width: 720px) { .promo-row { grid-template-columns: 1fr; } }
.promo-card {
  position: relative; overflow: hidden; padding: var(--sp-5);
  background: linear-gradient(155deg, rgba(70, 224, 212, 0.14), rgba(255, 180, 84, 0.06));
}
.promo-card .promo-title { font-size: var(--fs-md); font-weight: 800; margin-bottom: 6px; }
.promo-card .promo-text { font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.5; max-width: 78%; }
.promo-card .promo-icon { position: absolute; right: var(--sp-4); top: 50%; transform: translateY(-50%); color: var(--accent-2); opacity: 0.85; }

.apps-heading { font-size: var(--fs-sm); font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: var(--sp-3); }

.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: var(--sp-4); }
.app-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: var(--sp-5) var(--sp-3); text-align: center; text-decoration: none; color: var(--text);
  cursor: pointer;
}
.app-tile:hover { border-color: var(--border-strong); background: var(--hover-bg); box-shadow: var(--shadow); transform: translateY(-2px); }
.app-tile .app-icon {
  width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}
.app-tile .app-label { font-size: var(--fs-sm); font-weight: 600; line-height: 1.3; }
.app-tile.soon { opacity: 0.55; }
.app-tile .app-soon-tag {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.08); color: var(--text-muted); padding: 1px 7px; border-radius: 8px; margin-top: -4px;
}
.app-grid.empty-hint { display: block; text-align: center; padding: 30px 0; color: var(--text-muted); font-size: var(--fs-sm); }
