/* ─────────────── reset / base ─────────────── */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: 'Inter', 'SF Pro Display', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0.005em;
  overflow: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
}

input, select {
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scroll);
  border-radius: 8px;
}

/* ─────────────── shell layout ─────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 22px;
  backdrop-filter: blur(20px);
}

.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─────────────── brand ─────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 6px;
}
.brand-logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--accent-bg);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--accent-border);
}
.brand-text { line-height: 1.1; }
.brand-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.12em;
}
.brand-accent {
  color: var(--accent);
  text-shadow: 0 0 12px var(--accent-glow);
}
.brand-sub {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-top: 4px;
}

/* radar mini for logo */
.radar-mini {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  position: relative;
  box-shadow: 0 0 16px var(--accent-glow), inset 0 0 8px var(--accent-glow);
}
.radar-mini::before {
  content: '';
  position: absolute; inset: 4px;
  border-radius: 50%;
  border: 1px dashed var(--accent);
  opacity: .4;
}
.radar-mini span {
  position: absolute;
  top: 50%; left: 50%;
  width: 50%; height: 50%;
  transform-origin: 0 0;
  background: linear-gradient(90deg, var(--accent) 0%, transparent 70%);
  animation: radar-sweep 2.4s linear infinite;
  border-radius: 100% 0 0 0;
}
@keyframes radar-sweep {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ─────────────── nav ─────────────── */
.nav-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-mute);
  padding: 0 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
  position: relative;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active {
  background: var(--accent-bg);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-border);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 8px; bottom: 8px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px var(--accent-glow);
}
.nav-item .nav-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 6px var(--ok);
}
.nav-item .nav-dot.live {
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .6; transform: scale(.8); }
}

/* sub-nav (вкладки внутри проекта) */
.subtabs {
  display: flex;
  gap: 4px;
  padding: 6px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: max-content;
  margin-bottom: 16px;
}
.subtab {
  padding: 8px 18px;
  font-size: 13px;
  border-radius: 8px;
  color: var(--text-soft);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.subtab:hover { color: var(--text); }
.subtab.active {
  background: var(--accent-bg);
  color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ─────────────── theme switcher ─────────────── */
.theme-switcher { margin-top: auto; }
.theme-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.theme-btn {
  padding: 8px;
  border-radius: 8px;
  font-size: 11px;
  letter-spacing: 0.1em;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text-soft);
  background: var(--surface-1);
  transition: all .15s;
}
.theme-btn:hover { color: var(--text); }
.theme-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow), inset 0 0 6px var(--accent-glow);
}

/* connection status */
.conn-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.conn-status .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--bad);
  box-shadow: 0 0 8px var(--bad);
}
.conn-status.online .dot {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  animation: pulse 1.6s ease-in-out infinite;
}

/* ─────────────── topbar ─────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  z-index: 5;
}
.crumbs {
  font-size: 13px;
  color: var(--text-mute);
  letter-spacing: 0.05em;
}
.crumbs strong { color: var(--text); font-weight: 600; }

.topbar-right {
  display: flex;
  gap: 14px;
}
.kpi-mini {
  padding: 6px 14px;
  border-radius: 10px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  min-width: 110px;
  text-align: right;
}
.kpi-mini .kpi-label {
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--text-mute);
}
.kpi-mini .kpi-value {
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-shadow: 0 0 8px var(--accent-glow);
}

/* ─────────────── view container ─────────────── */
.view {
  flex: 1;
  overflow: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ─────────────── background layers (themed) ─────────────── */
.bg-canvas, .bg-aurora, .bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ─────────────── toast / event flash ─────────────── */
.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  z-index: 1000;
}
.toast {
  min-width: 280px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toast-in .35s ease-out, toast-fade 4.5s forwards;
  box-shadow: 0 4px 24px rgba(0, 0, 0, .35);
}
.toast.win {
  border-color: var(--ok);
  box-shadow: 0 0 18px var(--ok-glow), 0 4px 24px rgba(0, 0, 0, .35);
}
.toast.loss {
  border-color: var(--bad);
  box-shadow: 0 0 18px var(--bad-glow), 0 4px 24px rgba(0, 0, 0, .35);
}
.toast .toast-icon {
  font-size: 22px;
  filter: drop-shadow(0 0 6px currentColor);
}
.toast.win .toast-icon { color: var(--ok); }
.toast.loss .toast-icon { color: var(--bad); }

@keyframes toast-in {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes toast-fade {
  0%, 90% { opacity: 1; }
  100%    { opacity: 0; transform: translateX(120%); }
}
