/* ═══════════════════════════════════════════════════════
   PManager · Glass Mono · visionOS-inspired B&W
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* DARK (default) */
  --bg-base: #0a0a0c;
  --bg-grad-1: rgba(255,255,255,0.04);
  --bg-grad-2: rgba(255,255,255,0.02);
  --bg-noise: rgba(255,255,255,0.012);

  --surface-0: rgba(255,255,255,0.025);
  --surface-1: rgba(255,255,255,0.045);
  --surface-2: rgba(255,255,255,0.075);
  --surface-3: rgba(255,255,255,0.11);
  --surface-hi: rgba(255,255,255,0.16);

  --hairline: rgba(255,255,255,0.07);
  --hairline-2: rgba(255,255,255,0.12);
  --hairline-3: rgba(255,255,255,0.20);

  --text-1: #fafafa;
  --text-2: rgba(250,250,250,0.72);
  --text-3: rgba(250,250,250,0.46);
  --text-4: rgba(250,250,250,0.28);

  --on-accent: #0a0a0c;
  --accent: #fafafa;

  --shadow-elev: 0 1px 0 rgba(255,255,255,0.05) inset, 0 24px 48px -12px rgba(0,0,0,0.55), 0 2px 6px rgba(0,0,0,0.3);
  --shadow-soft: 0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 24px -8px rgba(0,0,0,0.4);
  --shadow-pop: 0 1px 0 rgba(255,255,255,0.08) inset, 0 32px 64px -16px rgba(0,0,0,0.7);

  --r-xs: 6px;
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  --t-fast: 140ms cubic-bezier(0.4,0,0.2,1);
  --t: 220ms cubic-bezier(0.32,0.72,0,1);
  --t-spring: 380ms cubic-bezier(0.34,1.4,0.64,1);

  --sidebar-w: 268px;
  --topbar-h: 56px;
  --right-w: 380px;

  --blur: 32px;
  --blur-strong: 48px;
}

[data-theme="light"] {
  --bg-base: #f4f4f5;
  --bg-grad-1: rgba(0,0,0,0.025);
  --bg-grad-2: rgba(0,0,0,0.015);

  --surface-0: rgba(255,255,255,0.50);
  --surface-1: rgba(255,255,255,0.65);
  --surface-2: rgba(255,255,255,0.78);
  --surface-3: rgba(255,255,255,0.90);
  --surface-hi: rgba(255,255,255,1);

  --hairline: rgba(0,0,0,0.07);
  --hairline-2: rgba(0,0,0,0.12);
  --hairline-3: rgba(0,0,0,0.22);

  --text-1: #0a0a0c;
  --text-2: rgba(10,10,12,0.70);
  --text-3: rgba(10,10,12,0.46);
  --text-4: rgba(10,10,12,0.28);

  --on-accent: #fafafa;
  --accent: #0a0a0c;

  --shadow-elev: 0 1px 0 rgba(255,255,255,0.6) inset, 0 24px 48px -12px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.06);
  --shadow-soft: 0 1px 0 rgba(255,255,255,0.7) inset, 0 8px 24px -8px rgba(0,0,0,0.10);
  --shadow-pop: 0 1px 0 rgba(255,255,255,0.85) inset, 0 32px 64px -16px rgba(0,0,0,0.20);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
*::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-1);
  font-size: 13.5px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  font-feature-settings: 'cv11', 'ss01';
}

/* Ambient mesh gradient — gives the glass something to refract */
.ambient {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 700px at 12% -8%, var(--bg-grad-1), transparent 60%),
    radial-gradient(700px 600px at 92% 12%, var(--bg-grad-2), transparent 55%),
    radial-gradient(800px 600px at 60% 105%, var(--bg-grad-1), transparent 55%);
}
.ambient::after {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 3px 3px;
  opacity: 0.6;
  mix-blend-mode: overlay;
}
[data-theme="light"] .ambient::after {
  background-image: radial-gradient(rgba(0,0,0,0.015) 1px, transparent 1px);
}

/* ── Scrollbars ── */
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--hairline-2); border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: var(--hairline-3); }
::selection { background: var(--text-1); color: var(--bg-base); }

/* ═══════════════════════════════════════════════════════
   APP SHELL
═══════════════════════════════════════════════════════ */

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "topbar topbar"
    "sidebar main";
  height: 100vh;
  /* 100vw включает ширину полосы прокрутки: на десктопе это давало лишние
     ~15 px и горизонтальный скролл на всей панели. */
  width: 100%;
}

/* ── TOPBAR ── */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px 0 20px;
  background: color-mix(in oklab, var(--bg-base) 70%, transparent);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border-bottom: 1px solid var(--hairline);
  position: relative;
  z-index: 30;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 14px;
  letter-spacing: -0.02em;
  width: calc(var(--sidebar-w) - 36px);
}
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--text-1);
  color: var(--bg-base);
  display: grid; place-items: center;
  font-weight: 800; font-size: 12px;
  letter-spacing: -0.04em;
}

.crumbs {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-3);
}
.crumbs .sep { color: var(--text-4); }
.crumbs .cur { color: var(--text-1); font-weight: 600; }

.kbar {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 12px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  color: var(--text-3);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--t);
  min-width: 240px;
}
.kbar:hover { border-color: var(--hairline-2); background: var(--surface-2); color: var(--text-2); }
.kbar svg { width: 13px; height: 13px; }
.kbar .kbd {
  margin-left: auto;
  display: inline-flex; gap: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--text-3);
}
.kbar .kbd span {
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 1px 5px;
}

.top-actions { display: flex; align-items: center; gap: 6px; }
.top-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--t);
  position: relative;
}
.top-btn:hover { background: var(--surface-2); color: var(--text-1); border-color: var(--hairline); }
.top-btn svg { width: 15px; height: 15px; stroke-width: 1.7; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.top-btn .pip {
  position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-1);
  border: 2px solid var(--bg-base);
}

.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all var(--t);
}
.user-chip:hover { background: var(--surface-2); border-color: var(--hairline-2); }
.user-chip .av {
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--text-2), var(--text-3));
  color: var(--bg-base);
  display: grid; place-items: center;
  font-weight: 700; font-size: 10.5px;
}
.user-chip .nm { font-size: 12px; font-weight: 500; }

/* ── SIDEBAR ── */
.sidebar {
  grid-area: sidebar;
  background: color-mix(in oklab, var(--bg-base) 60%, transparent);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border-right: 1px solid var(--hairline);
  overflow-y: auto;
  padding: 14px 12px 18px;
  display: flex; flex-direction: column; gap: 14px;
  position: relative; z-index: 20;
}

.guild-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border-radius: var(--r);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  cursor: pointer;
  transition: all var(--t);
}
.guild-card:hover { background: var(--surface-2); border-color: var(--hairline-2); }
.guild-card .gc-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  display: grid; place-items: center;
  font-weight: 800; font-size: 13px;
  letter-spacing: -0.03em;
  border: 1px solid var(--hairline);
}
.guild-card .gc-info { flex: 1; min-width: 0; }
.guild-card .gc-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guild-card .gc-sub { font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 5px; margin-top: 1px; }
.guild-card .gc-sub .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-1); box-shadow: 0 0 6px var(--text-2); }
.guild-card .gc-chev { color: var(--text-3); }

.nav-group {
  display: flex; flex-direction: column;
  background: var(--surface-0);
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  padding: 4px;
  position: relative;
}
.nav-group-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 8px 10px 6px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-group-label .count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-4);
  letter-spacing: 0;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 9px;
  border-radius: 9px;
  font-size: 12.8px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--t-fast);
  position: relative;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--surface-1); color: var(--text-1); }
.nav-item.active {
  background: var(--surface-2);
  color: var(--text-1);
  border-color: var(--hairline-2);
  box-shadow: var(--shadow-soft);
}
.nav-item svg {
  width: 14px; height: 14px;
  stroke: currentColor; stroke-width: 1.6;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}
.nav-item .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-1);
  flex-shrink: 0;
}
.nav-item .pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px; font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--text-2);
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}
.nav-item .pill.on { background: var(--text-1); color: var(--bg-base); border-color: var(--text-1); }

.sidebar-footer {
  margin-top: auto;
  padding: 10px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  display: flex; align-items: center; gap: 9px;
}
.sf-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-4, #555);
  flex-shrink: 0;
  transition: background .3s, box-shadow .3s;
}
.sf-dot.on {
  background: var(--text-1);
  box-shadow: 0 0 0 3px var(--surface-2), 0 0 10px var(--text-2);
}
.sf-info { flex: 1; min-width: 0; }
.sf-info .l1 { font-size: 12px; font-weight: 600; }
.sf-info .l2 { font-size: 10.5px; color: var(--text-3); font-family: 'JetBrains Mono', monospace; }

/* ── MAIN ── */
.main {
  grid-area: main;
  overflow-y: auto;
  padding: 22px 28px 32px;
  position: relative;
  scroll-behavior: smooth;
}

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--hairline);
}
.page-head h1 {
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.035em;
  display: flex; align-items: center; gap: 12px;
}
.page-head h1 .eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; font-weight: 500;
  color: var(--text-3);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  padding: 3px 8px;
  border-radius: 5px;
  letter-spacing: 0;
  text-transform: uppercase;
}
.page-head .sub { font-size: 12.5px; color: var(--text-3); margin-top: 4px; max-width: 540px; }
.page-head-right { display: flex; align-items: center; gap: 8px; }

/* ═══════════════════════════════════════════════════════
   GLASS PRIMITIVES
═══════════════════════════════════════════════════════ */

.glass {
  background: var(--surface-1);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  position: relative;
}
.glass::before {
  content: ''; position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), transparent 30%);
  pointer-events: none;
}
[data-theme="light"] .glass::before {
  background: linear-gradient(180deg, rgba(255,255,255,0.7), transparent 40%);
}

.glass-pop {
  background: var(--surface-2);
  backdrop-filter: blur(var(--blur-strong));
  -webkit-backdrop-filter: blur(var(--blur-strong));
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
}

.tile {
  background: var(--surface-1);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--t);
}
.tile::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--hairline-3), transparent);
  opacity: 0.5;
}
.tile:hover {
  border-color: var(--hairline-2);
  background: var(--surface-2);
}

.tile-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.tile-title {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  display: flex; align-items: center; gap: 8px;
}
.tile-title svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.tile-action {
  font-size: 11px; color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  display: flex; align-items: center; gap: 4px;
  padding: 3px 7px;
  border-radius: 5px;
  transition: all var(--t-fast);
}
.tile-action:hover { color: var(--text-1); background: var(--surface-2); }

/* ═══════════════════════════════════════════════════════
   DASHBOARD GRID
═══════════════════════════════════════════════════════ */

.dash-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.dash-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

/* ── KPI tile ── */
.kpi {
  display: flex; flex-direction: column;
  gap: 10px;
}
.kpi-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  display: flex; align-items: center; gap: 7px;
}
.kpi-label .ico {
  width: 22px; height: 22px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  display: grid; place-items: center;
}
.kpi-label .ico svg { width: 11px; height: 11px; stroke: var(--text-2); stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.kpi-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  font-feature-settings: 'tnum';
  display: flex; align-items: baseline; gap: 6px;
}
.kpi-value .unit { font-size: 13px; color: var(--text-3); font-weight: 500; }
.kpi-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: var(--text-3);
}
.kpi-spark {
  flex: 1;
  height: 22px;
}
.kpi-delta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-2);
  display: inline-flex; align-items: center; gap: 4px;
  font-weight: 500;
}
.kpi-delta::before { content: '↗'; }
.kpi-delta.dn { color: var(--text-3); }
.kpi-delta.dn::before { content: '↘'; }

/* ── Activity / Heatmap ── */
.activity-tile { padding: 18px 22px; }
.activity-grid {
  display: grid;
  grid-template-columns: 32px repeat(24, 1fr);
  gap: 3px;
  margin-top: 10px;
}
.activity-grid .hr-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--text-4);
  align-self: center;
}
.activity-grid .day-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  color: var(--text-3);
  align-self: center;
  padding-right: 4px;
  text-align: right;
}
.heat-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  transition: all var(--t-fast);
  cursor: pointer;
}
.heat-cell:hover { transform: scale(1.4); border-color: var(--hairline-3); z-index: 2; }

.heat-axis {
  display: flex; justify-content: space-between;
  margin-top: 8px; padding-left: 36px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px; color: var(--text-4);
}
.heat-legend {
  display: flex; align-items: center; gap: 6px;
  font-size: 10.5px; color: var(--text-3);
  margin-top: 12px;
}
.heat-legend .scale { display: flex; gap: 2px; }
.heat-legend .sw { width: 10px; height: 10px; border-radius: 2px; border: 1px solid var(--hairline); }

/* ── Live feed ── */
.feed-tile { display: flex; flex-direction: column; padding: 0; }
.feed-tile .tile-head { padding: 16px 20px 0; margin-bottom: 0; }
.feed-tile .live-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-1);
}
.feed-tile .live-pill::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-1);
  box-shadow: 0 0 0 0 var(--text-1);
  animation: live-pulse 2s ease-out infinite;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 var(--hairline-3); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.feed-list {
  flex: 1;
  display: flex; flex-direction: column;
  padding: 6px 8px 12px;
  overflow-y: auto;
  max-height: 380px;
}
.feed-row {
  display: grid;
  grid-template-columns: 60px 24px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 9px;
  transition: background var(--t-fast);
  cursor: pointer;
  position: relative;
}
.feed-row:hover { background: var(--surface-1); }
.feed-row + .feed-row { border-top: 1px dashed var(--hairline); }
.feed-row.fresh { animation: feed-in 0.5s ease both; }
@keyframes feed-in {
  from { opacity: 0; transform: translateY(-4px); background: var(--surface-2); }
  to { opacity: 1; transform: translateY(0); }
}
.feed-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--text-3);
  letter-spacing: 0;
}
.feed-icon {
  width: 24px; height: 24px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.feed-icon svg { width: 11px; height: 11px; stroke: var(--text-2); stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.feed-icon.warn { background: var(--text-1); border-color: var(--text-1); }
.feed-icon.warn svg { stroke: var(--bg-base); }
.feed-text {
  font-size: 12.5px; line-height: 1.45;
  color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.feed-text strong { color: var(--text-1); font-weight: 600; }
.feed-text code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-1);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 1px 5px;
}
.feed-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-4);
}

/* ── Modules grid (App Store style) ── */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.mod-card {
  display: flex; flex-direction: column;
  padding: 18px;
  background: var(--surface-1);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all var(--t);
  position: relative;
  overflow: hidden;
}
.mod-card::before {
  content: '';
  position: absolute; inset: -1px -1px auto -1px; height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), transparent);
  pointer-events: none;
  border-radius: inherit;
}
[data-theme="light"] .mod-card::before {
  background: linear-gradient(180deg, rgba(255,255,255,0.7), transparent);
}
.mod-card:hover {
  border-color: var(--hairline-2);
  background: var(--surface-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-elev);
}

.mod-head {
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 10px;
}
.mod-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--hairline-2);
  display: grid; place-items: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-soft);
}
.mod-icon svg { width: 20px; height: 20px; stroke: var(--text-1); stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.mod-info { flex: 1; min-width: 0; }
.mod-name { font-weight: 700; font-size: 14px; letter-spacing: -0.02em; }
.mod-cat {
  font-size: 10.5px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-top: 2px;
}
.mod-desc {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.55;
  margin-bottom: 14px;
  flex: 1;
}
.mod-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
}
.mod-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mod-status .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-4);
}
.mod-status.on { color: var(--text-1); }
.mod-status.on .dot { background: var(--text-1); box-shadow: 0 0 6px var(--text-1); }

/* ── Switch ── */
.switch {
  position: relative;
  width: 36px; height: 20px;
  background: var(--surface-2);
  border: 1px solid var(--hairline-2);
  border-radius: 99px;
  cursor: pointer;
  transition: all var(--t);
  flex-shrink: 0;
}
.switch::after {
  content: '';
  position: absolute;
  top: 1px; left: 1px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text-2);
  transition: all var(--t-spring);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch.on { background: var(--text-1); border-color: var(--text-1); }
.switch.on::after { transform: translateX(16px); background: var(--bg-base); }
/* Тумблер теперь в порядке обхода Tab — без видимого фокуса по нему нельзя
   было бы понять, где ты находишься. */
.switch:focus-visible {
  outline: 2px solid var(--accent, #5865F2);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════
   SECURITY / TICKETS / TOP
═══════════════════════════════════════════════════════ */

.threat-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 4px;
  border-bottom: 1px dashed var(--hairline);
}
.threat-row:last-child { border: none; }
.threat-icon {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  display: grid; place-items: center;
}
.threat-icon svg { width: 12px; height: 12px; stroke: var(--text-2); stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.threat-icon.hi { background: var(--text-1); border-color: var(--text-1); }
.threat-icon.hi svg { stroke: var(--bg-base); }

.threat-info .l1 { font-size: 12.5px; font-weight: 600; color: var(--text-1); }
.threat-info .l2 { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.threat-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  padding: 2px 7px;
  border-radius: 5px;
}

.bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 50px;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.bar-name {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bar-name::before { content: '#'; color: var(--text-4); margin-right: 2px; }
.bar-name.user::before { content: '@'; }
.bar-track {
  height: 6px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--hairline);
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--text-3), var(--text-1));
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(0.32,0.72,0,1);
}
.bar-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-align: right;
  color: var(--text-2);
  font-feature-settings: 'tnum';
}

/* ── Ticket cards ── */
.ticket-row {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all var(--t-fast);
}
.ticket-row:hover { background: var(--surface-2); border-color: var(--hairline-2); }
.ticket-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 4px 6px;
  text-align: center;
  font-weight: 600;
}
.ticket-meta { font-size: 12.5px; }
.ticket-meta .l1 { font-weight: 600; color: var(--text-1); }
.ticket-meta .l2 { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.ticket-stage {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  padding: 4px 9px;
  border-radius: 99px;
}
.ticket-stage .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--text-2);
}
.ticket-stage.open .dot { background: var(--text-1); }
.ticket-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--text-4);
}

/* ═══════════════════════════════════════════════════════
   COMMAND PALETTE
═══════════════════════════════════════════════════════ */
.cmd-overlay {
  position: fixed; inset: 0;
  background: color-mix(in oklab, var(--bg-base) 50%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 1000;
  display: grid; place-items: flex-start center;
  padding-top: 12vh;
  animation: fade-in 0.18s ease both;
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cmd-box {
  width: 640px; max-width: 92vw;
  background: var(--surface-2);
  backdrop-filter: blur(var(--blur-strong)) saturate(1.6);
  -webkit-backdrop-filter: blur(var(--blur-strong)) saturate(1.6);
  border: 1px solid var(--hairline-3);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  animation: cmd-in 0.22s cubic-bezier(0.34,1.4,0.64,1) both;
}
@keyframes cmd-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.cmd-input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--hairline);
}
.cmd-input-wrap svg { width: 16px; height: 16px; stroke: var(--text-3); stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.cmd-input {
  flex: 1; background: transparent; border: none; outline: none;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: var(--text-1);
  letter-spacing: -0.01em;
}
.cmd-input::placeholder { color: var(--text-3); }
.cmd-esc {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--text-3);
  background: var(--surface-3);
  border: 1px solid var(--hairline-2);
  padding: 2px 6px;
  border-radius: 4px;
}

.cmd-list { max-height: 420px; overflow-y: auto; padding: 6px; }
.cmd-section {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 12px 4px;
  font-weight: 600;
}
.cmd-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
}
.cmd-item.sel, .cmd-item:hover { background: var(--surface-3); }
.cmd-ico {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  display: grid; place-items: center;
}
.cmd-ico svg { width: 12px; height: 12px; stroke: var(--text-2); stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.cmd-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--text-4);
}

.cmd-foot {
  display: flex; gap: 14px; align-items: center;
  padding: 10px 18px;
  border-top: 1px solid var(--hairline);
  font-size: 11px;
  color: var(--text-3);
}
.cmd-foot .kbd-pair { display: inline-flex; align-items: center; gap: 4px; }
.cmd-foot .kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  background: var(--surface-3);
  border: 1px solid var(--hairline-2);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text-2);
}

/* ═══════════════════════════════════════════════════════
   DRAWER (right detail)
═══════════════════════════════════════════════════════ */
.drawer-scrim {
  position: fixed; inset: 0; z-index: 800;
  background: color-mix(in oklab, var(--bg-base) 60%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade-in 0.2s ease both;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 540px; max-width: 92vw;
  z-index: 801;
  background: var(--surface-2);
  backdrop-filter: blur(var(--blur-strong)) saturate(1.6);
  -webkit-backdrop-filter: blur(var(--blur-strong)) saturate(1.6);
  border-left: 1px solid var(--hairline-2);
  box-shadow: -32px 0 64px rgba(0,0,0,0.35);
  display: flex; flex-direction: column;
  animation: drawer-in 0.32s cubic-bezier(0.32,0.72,0,1) both;
}
@keyframes drawer-in {
  from { transform: translateX(100%); }
  to { transform: none; }
}
.drawer-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: flex-start; gap: 12px;
}
.drawer-head .mod-icon { width: 48px; height: 48px; border-radius: 14px; }
.drawer-head .mod-icon svg { width: 22px; height: 22px; }
.drawer-title-wrap { flex: 1; min-width: 0; }
.drawer-title { font-size: 18px; font-weight: 700; letter-spacing: -0.025em; }
.drawer-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.drawer-close {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--hairline);
  background: var(--surface-1);
  border-radius: 9px;
  cursor: pointer;
  color: var(--text-2);
  transition: all var(--t);
}
.drawer-close:hover { background: var(--surface-3); color: var(--text-1); }
.drawer-close svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.drawer-body {
  flex: 1; overflow-y: auto;
  padding: 18px 22px 8px;
  display: flex; flex-direction: column; gap: 18px;
}

.drawer-foot {
  padding: 12px 22px;
  border-top: 1px solid var(--hairline);
  background: var(--surface-1);
  display: flex; align-items: center; gap: 10px;
}
.save-state {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
}
.save-state.saved { color: var(--text-2); }
.save-state .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-3);
}
.save-state.dirty .dot { background: var(--text-1); animation: live-pulse 2s infinite; }
.save-state.saved .dot { background: var(--text-2); }
.save-state.saving .dot { background: var(--text-2); animation: live-pulse 1s infinite; }

/* ═══════════════════════════════════════════════════════
   FORM CONTROLS
═══════════════════════════════════════════════════════ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 11px; font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.02em;
  display: flex; align-items: center; justify-content: space-between;
}
.field-label .help { font-weight: 400; color: var(--text-4); }
.field-desc { font-size: 11.5px; color: var(--text-3); line-height: 1.5; }
.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 9px;
  color: var(--text-1);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  outline: none;
  transition: all var(--t);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--hairline-2); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--hairline-3);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px var(--surface-1);
}
.input.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 11px;
  transition: all var(--t-fast);
}
.toggle-row:hover { background: var(--surface-2); }
.toggle-row .nm { font-size: 13px; font-weight: 600; }
.toggle-row .ds { font-size: 11.5px; color: var(--text-3); margin-top: 2px; line-height: 1.45; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  letter-spacing: -0.005em;
  border: 1px solid var(--hairline-2);
  background: var(--surface-2);
  color: var(--text-1);
  cursor: pointer;
  transition: all var(--t);
}
.btn:hover { background: var(--surface-3); border-color: var(--hairline-3); }
.btn.primary {
  background: var(--text-1); color: var(--bg-base);
  border-color: var(--text-1);
}
.btn.primary:hover { background: var(--text-2); border-color: var(--text-2); }
.btn.ghost { background: transparent; border-color: var(--hairline); }
.btn.ghost:hover { background: var(--surface-1); }
.btn svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* Diff view */
.diff-list {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 9px;
  overflow: hidden;
}
.diff-row { display: grid; grid-template-columns: 18px 1fr; align-items: start; padding: 6px 12px; border-bottom: 1px solid var(--hairline); }
.diff-row:last-child { border-bottom: none; }
.diff-row .mark { color: var(--text-3); font-weight: 600; }
.diff-row.add { background: rgba(255,255,255,0.04); }
.diff-row.add .mark { color: var(--text-1); }
.diff-row.rem { background: rgba(0,0,0,0.18); }
[data-theme="light"] .diff-row.rem { background: rgba(0,0,0,0.04); }
.diff-row.rem .mark { color: var(--text-3); }
.diff-row .key { color: var(--text-3); }
.diff-row .val { color: var(--text-1); margin-left: 4px; }

/* Audit */
.audit-score {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  padding: 22px 24px;
  align-items: center;
}
.score-ring {
  position: relative;
  width: 120px; height: 120px;
}
.score-ring svg { width: 120px; height: 120px; transform: rotate(-90deg); }
.score-ring .ring-bg { stroke: var(--hairline); }
.score-ring .ring-fg {
  stroke: var(--text-1);
  stroke-linecap: round;
  transition: stroke-dasharray 1.2s cubic-bezier(0.32,0.72,0,1);
}
.score-ring .num {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 34px; font-weight: 700;
  letter-spacing: -0.04em;
  font-feature-settings: 'tnum';
}
.score-ring .grade {
  position: absolute; bottom: 6px; left: 0; right: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--text-3);
  text-align: center; letter-spacing: 0.06em;
}

.audit-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.audit-stat {
  padding: 12px 14px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 10px;
}
.audit-stat .l { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.audit-stat .v { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; margin-top: 4px; font-feature-settings: 'tnum'; }
.audit-stat .v small { font-size: 12px; font-weight: 500; color: var(--text-3); margin-left: 4px; }

.audit-list { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.audit-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  transition: all var(--t-fast);
}
.audit-item:hover { background: var(--surface-2); border-color: var(--hairline-2); }
.audit-item .ico {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  display: grid; place-items: center;
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}
.audit-item.fail .ico { background: var(--text-1); color: var(--bg-base); border-color: var(--text-1); }
.audit-item.warn .ico { background: var(--surface-3); color: var(--text-1); }
.audit-item .l1 { font-size: 13px; font-weight: 600; }
.audit-item .l2 { font-size: 11.5px; color: var(--text-3); margin-top: 2px; line-height: 1.45; }
.audit-item .sev {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 3px 7px;
  border: 1px solid var(--hairline);
  border-radius: 5px;
  background: var(--surface-2);
}
.audit-item.fail .sev { color: var(--text-1); border-color: var(--text-1); }

/* Module category tabs */
.category-tabs {
  display: flex; gap: 6px;
  padding: 4px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 11px;
  width: max-content;
  margin-bottom: 18px;
}
.cat-tab {
  padding: 6px 14px;
  font-size: 12px; font-weight: 600;
  color: var(--text-3);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--t-fast);
  display: inline-flex; align-items: center; gap: 6px;
  letter-spacing: -0.005em;
}
.cat-tab:hover { color: var(--text-1); }
.cat-tab.active {
  background: var(--text-1);
  color: var(--bg-base);
  box-shadow: var(--shadow-soft);
}
.cat-tab .num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  opacity: 0.6;
}

/* ── Inline-saving toast (corner) ── */
.save-toast {
  position: fixed; bottom: 22px; right: 22px;
  padding: 11px 16px;
  background: var(--surface-3);
  backdrop-filter: blur(var(--blur-strong));
  -webkit-backdrop-filter: blur(var(--blur-strong));
  border: 1px solid var(--hairline-2);
  border-radius: 11px;
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px;
  z-index: 900;
  box-shadow: var(--shadow-pop);
  animation: drawer-in 0.3s ease both;
}
.save-toast .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-1);
  box-shadow: 0 0 8px var(--text-1);
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
/* Бургер и подложка нужны только на узком экране — на десктопе сайдбар
   в потоке, и открывать нечего. */
.burger {
  display: none;
  align-items: center; justify-content: center;
  width: 32px; height: 32px; flex: 0 0 auto;
  margin-right: 2px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface-1);
  color: var(--text-2);
  cursor: pointer;
}
.burger:hover { color: var(--text-1); }
.nav-backdrop { display: none; }

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; grid-template-areas: "topbar" "main"; }
  .dash-row { grid-template-columns: 1fr 1fr; }

  .burger { display: inline-flex; }

  /* Раньше здесь стояло .sidebar { display: none } без замены: с телефона
     панель залипала на дашборде, ни в один раздел было не попасть. */
  .sidebar {
    position: fixed;
    top: var(--topbar-h); bottom: 0; left: 0;
    width: min(280px, 84vw);
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .22s ease;
    background: var(--bg-base);
  }
  .sidebar.open { transform: none; }

  .nav-backdrop {
    display: block;
    position: fixed;
    top: var(--topbar-h); left: 0; right: 0; bottom: 0;
    z-index: 50;
    background: rgba(0, 0, 0, .5);
    opacity: 0; pointer-events: none;
    transition: opacity .22s ease;
  }
  .nav-backdrop.open { opacity: 1; pointer-events: auto; }

  /* Крошки съедают всю строку и выталкивают бургер за край. */
  .crumbs { display: none; }
}

/* Анимацию выключаем тем, кто просил её не показывать. */
@media (prefers-reduced-motion: reduce) {
  .sidebar, .nav-backdrop { transition: none; }
}

/* Tweaks panel overrides — slimmer */
[data-tweaks-panel] { font-family: 'Inter', sans-serif !important; }
