/* App shell, sidebar, topbar, main content area and panels. */
/* ═══ APP SHELL ═══ */
.app-shell { display: none; height: 100vh; flex-direction: row; opacity: 0; transform: translateY(5px); transition: opacity .35s ease, transform .35s ease; }
.app-shell.is-visible { display: flex; }
.app-shell.is-revealed { opacity: 1; transform: none; }

/* ═══ SIDEBAR ═══ */
.sidebar { width: var(--sidebar-w); background: var(--bg-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; height: 100vh; position: relative; z-index: 10; }
.sidebar::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 1px; background: linear-gradient(to bottom, transparent, rgba(79,140,255,.12), transparent); }
.sidebar-brand { padding: 26px 24px 20px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); }
.sidebar-brand .logo-mark { width: 36px; height: 36px; border-radius: 10px; font-size: 16px; }
.sidebar-brand .brand-name { font-size: 17px; font-weight: 800; letter-spacing: -.2px; }
.sidebar-section { padding: 20px 14px 12px; }
.sidebar-section-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .9px; padding: 0 10px; margin-bottom: 10px; font-family: var(--mono); }
.nav-item { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: 12px; color: var(--text-2); font-size: 15px; font-weight: 600; cursor: pointer; transition: all .18s; border: none; background: none; width: 100%; text-align: left; margin-bottom: 6px; position: relative; }
.nav-item .nav-icon { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: rgba(79,140,255,.1); color: var(--accent2); font-weight: 600; }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 20%; bottom: 20%; width: 3px; background: var(--accent2); border-radius: 0 3px 3px 0; }

.sidebar .sidebar-section:first-of-type {
  display: flex;
  flex-direction: column;
}


.guardian-status-pill { margin-left: auto; padding: 2px 7px; border-radius: 20px; font-size: 9px; font-weight: 700; font-family: var(--mono); letter-spacing: .4px; flex-shrink: 0; text-transform: uppercase; }
.guardian-status-pill.active-pill { background: rgba(0,229,160,.12); color: var(--accent); border: 1px solid rgba(0,229,160,.25); }
.guardian-status-pill.inactive-pill { background: rgba(255,255,255,.05); color: var(--muted); border: 1px solid var(--border); }

.sidebar-bottom { margin-top: auto; padding: 18px 14px; border-top: 1px solid var(--border); }
.guardian-side-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
}
.guardian-side-status .guardian-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.guardian-side-status.active { border-color: rgba(0,229,160,.28); color: var(--accent); }
.guardian-side-status.active .guardian-dot { background: var(--accent); box-shadow: 0 0 8px rgba(0,229,160,.5); }
.conn-pill { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: all .2s; }
.conn-pill:hover { border-color: var(--border-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; transition: background .3s; }
.dot.connected { background: var(--accent); box-shadow: 0 0 7px rgba(0,229,160,.5); animation: pulse-dot 2s infinite; }
.dot.pending { background: var(--warning); }
@keyframes pulse-dot { 0%,100% { box-shadow: 0 0 4px rgba(0,229,160,.3); } 50% { box-shadow: 0 0 12px rgba(0,229,160,.7); } }
.conn-text { flex: 1; min-width: 0; }
.conn-text .conn-label { font-size: 13px; font-weight: 700; font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn-text .conn-sub { font-size: 11px; color: var(--muted); font-family: var(--mono); }

/* ═══ MAIN CONTENT ═══ */
.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.topbar { height: 58px; display: flex; align-items: center; padding: 0 28px; border-bottom: 1px solid var(--border); background: rgba(7,9,13,.85); backdrop-filter: blur(20px); flex-shrink: 0; gap: 16px; }
.topbar-title { font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.topbar-title span { color: var(--muted); font-weight: 400; }
.topbar-spacer { flex: 1; }
.topbar-badge { display: flex; align-items: center; gap: 7px; padding: 6px 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); font-size: 12px; font-family: var(--mono); color: var(--text-2); white-space: nowrap; }
.guardian-topbar-badge { display: flex; align-items: center; gap: 8px; padding: 6px 16px; border-radius: 20px; font-size: 11px; font-family: var(--mono); font-weight: 700; letter-spacing: .4px; text-transform: uppercase; border: 1px solid; white-space: nowrap; transition: all .3s; }
.guardian-topbar-badge.active-state { background: rgba(0,229,160,.08); border-color: rgba(0,229,160,.25); color: var(--accent); }
.guardian-topbar-badge.inactive-state { background: rgba(255,255,255,.03); border-color: var(--border); color: var(--muted); }
.guardian-topbar-badge .guardian-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.guardian-topbar-badge.active-state .guardian-dot { animation: pulse-dot 2s infinite; box-shadow: 0 0 6px rgba(0,229,160,.6); }
.content-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 26px 28px 48px; }

/* ═══ PANELS ═══ */
.panel { display: none; animation: panelIn .22s ease; }
.panel.active { display: block; }
@keyframes panelIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Minimal monochrome sidebar polish */
.nav-item { color: var(--text); }
.nav-item .nav-label { opacity: 1; }
.nav-item .nav-icon {
  font-family: var(--mono);
  color: currentColor;
  opacity: 1;
  font-weight: 700;
  line-height: 1;
}
.nav-item:not(.active) .nav-icon { color: var(--text-2); }

/* Sidebar visibility refinement */
.nav-item,
.nav-item .nav-label,
.nav-item .nav-icon { opacity: 1; }
.nav-item { color: var(--text); }
.nav-item:not(.active) { color: var(--text); }
.nav-item:not(.active) .nav-icon { color: var(--text-2); }
.nav-item.active { color: var(--text); background: rgba(255,255,255,.075); }
.nav-item.active::before { background: var(--warning); }
.sidebar-section-label,
.conn-text .conn-sub,
.topbar-title span { color: var(--text-2); }
