/* ═══════════════════════════════════════
   LAYOUT SHELL
═══════════════════════════════════════ */
.shell { display: flex; height: 100vh; overflow: hidden; }

/* ═══════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════ */
.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  transition: width 0.25s;
  z-index: 10;
}
.sidebar.collapsed { width: 60px; }

.sb-head {
  padding: 20px 16px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.sb-logo {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--accent); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.sb-logo svg { width: 16px; height: 16px; fill: white; }
.sb-brand { font-size: 15px; font-weight: 700; letter-spacing: -0.03em; white-space: nowrap; overflow: hidden; }
.sb-brand span { color: var(--acc2); }
.sidebar.collapsed .sb-brand { display: none; }

.sb-nav { flex: 1; overflow-y: auto; padding: 8px 8px; }
.sb-section { font-size: 10px; font-family: var(--mono); color: var(--txt3); letter-spacing: 0.1em; padding: 12px 8px 4px; white-space: nowrap; overflow: hidden; }
.sidebar.collapsed .sb-section { opacity: 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius);
  cursor: pointer; transition: all 0.15s;
  color: var(--txt2); margin-bottom: 2px;
  white-space: nowrap; overflow: hidden;
}
.nav-item:hover { background: var(--bg3); color: var(--txt); }
.nav-item.active { background: rgba(61,108,255,0.15); color: var(--acc2); }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-label { font-size: 13px; font-weight: 500; }
.sidebar.collapsed .nav-label { display: none; }
.nav-badge { margin-left: auto; background: var(--red); color: white; font-size: 10px; font-family: var(--mono); padding: 1px 6px; border-radius: 10px; }
.sidebar.collapsed .nav-badge { display: none; }

.sb-foot {
  padding: 12px 8px;
  border-top: 1px solid var(--line);
}
.sb-platform-label { font-size: 10px; color: var(--txt3); font-family: var(--mono); padding: 4px 10px 8px; white-space: nowrap; overflow: hidden; }
.sidebar.collapsed .sb-platform-label { opacity: 0; }
.platform-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius);
  cursor: pointer; color: var(--txt2); margin-bottom: 2px;
  transition: all 0.15s; border: none; background: transparent;
  width: 100%;
}
.platform-btn:hover { background: var(--bg3); color: var(--txt); }
.platform-btn.active { background: rgba(0,200,122,0.1); color: var(--green); }
.platform-icon { width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.platform-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; }
.sidebar.collapsed .platform-name { display: none; }
.platform-status { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.sidebar.collapsed .platform-status { display: none; }

/* ═══════════════════════════════════════
   MAIN AREA
═══════════════════════════════════════ */
.main { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

/* TOPBAR */
.topbar {
  height: 56px; flex-shrink: 0;
  background: var(--bg2); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
}
.topbar-toggle {
  width: 32px; height: 32px; border-radius: 8px;
  background: transparent; border: none; cursor: pointer;
  color: var(--txt2); display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.topbar-toggle:hover { background: var(--bg3); color: var(--txt); }
.topbar-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.breadcrumb-item { color: var(--txt2); }
.breadcrumb-sep { color: var(--txt3); }
.breadcrumb-current { color: var(--txt); font-weight: 500; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg3); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 7px 12px;
  min-width: 240px; transition: border-color 0.15s;
}
.search-bar:focus-within { border-color: var(--accent); }
.search-bar svg { width: 14px; height: 14px; fill: none; stroke: var(--txt3); stroke-width: 1.8; flex-shrink: 0; }
.search-bar input { background: transparent; border: none; outline: none; color: var(--txt); font-size: 13px; width: 100%; }
.search-bar input::placeholder { color: var(--txt3); }

.topbar-btn {
  height: 34px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: transparent;
  color: var(--txt2); cursor: pointer; font-size: 13px;
  display: flex; align-items: center; gap: 6px;
  transition: all 0.15s;
}
.topbar-btn:hover { background: var(--bg3); color: var(--txt); }
.topbar-btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.topbar-btn.primary:hover { background: #2d5ce0; }
.topbar-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.notif-btn {
  position: relative; width: 34px; height: 34px;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; color: var(--txt2);
}
.notif-btn:hover { background: var(--bg3); color: var(--txt); }
.notif-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.notif-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); border: 1px solid var(--bg2); }

.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; cursor: pointer; }

/* CONTENT AREA */
.content { flex: 1; overflow-y: auto; }

/* ═══════════════════════════════════════
   PAGES
═══════════════════════════════════════ */
.page { display: none; padding: 24px; max-width: 1400px; margin: 0 auto; }
.page.active { display: block; }

/* ═══════════════════════════════════════
   PAGE HEADER
═══════════════════════════════════════ */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.04em; }
.page-sub { font-size: 13px; color: var(--txt2); margin-top: 2px; }

/* ═══════════════════════════════════════
   GRID LAYOUTS
═══════════════════════════════════════ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-70-30 { display: grid; grid-template-columns: 7fr 3fr; gap: 16px; }
.grid-60-40 { display: grid; grid-template-columns: 6fr 4fr; gap: 16px; }
.mb16 { margin-bottom: 16px; }
.mb24 { margin-bottom: 24px; }

/* ═══════════════════════════════════════
   RESPONSIVE TWEAKS
═══════════════════════════════════════ */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .connect-grid { grid-template-columns: 1fr 1fr; }
  .grid-70-30, .grid-60-40, .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .sidebar.open {
    display: flex;
    position: fixed;
    top: 0; left: 0;
    height: 100vh; width: 260px;
    z-index: 400;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  }
  body.sidebar-open .main::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 350;
  }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page { padding: 16px; }
}
@media (max-width: 640px) {
  .topbar { height: auto; padding: 10px 12px; flex-wrap: wrap; gap: 10px; }
  .breadcrumb { display: none; }
  .topbar-right { width: 100%; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
  .search-bar { min-width: 0; width: 100%; order: 1; flex: 1 0 100%; }
  .topbar-btn { height: 32px; padding: 0 10px; font-size: 12px; }
  .notif-btn, .avatar, .topbar-toggle { width: 30px; height: 30px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header .topbar-btn { width: 100%; justify-content: center; }
}

/* ═══════════════════════════════════════
   PULSE ANIMATION
═══════════════════════════════════════ */
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); animation: pulse 2s infinite;
  display: inline-block;
}
