/* ── Layout ────────────────────────────────────────────────────────────────── */

/* App shell */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: #0f0f0f;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--duration) var(--ease);
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo .logo-mark {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: var(--weight-extra);
  letter-spacing: -0.02em;
  color: #1a1304;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.28), inset 0 1px 0 rgba(255,255,255,0.25);
}

.sidebar-logo .logo-text {
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-logo .logo-sub {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  display: block;
  line-height: 1.2;
}

/* Workspace affordance under the logo — a quiet "Jake's Workspace · Demo" chip. */
.sidebar-workspace {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-3) var(--space-3) 0;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.sidebar-workspace-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-12);
  flex-shrink: 0;
}
.sidebar-workspace-name {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.sidebar-workspace-chip {
  font-size: 9px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-12);
  padding: 2px 7px;
  border-radius: var(--radius-badge);
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-3) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

/* Quiet uppercase section divider (TailAdmin-style grouped nav).
   First label sits tight to the logo; subsequent labels get breathing room above. */
.nav-section-label {
  font-size: 10px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: var(--space-4) var(--space-4) var(--space-1);
  opacity: 0.75;
}
.nav-section-label:first-child { padding-top: var(--space-2); }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  margin: 0 8px;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
  white-space: nowrap;
}

/* Active accent rail — a 2px amber bar pinned to the item's left edge. */
.nav-item::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  transition: transform var(--duration) var(--ease-entrance);
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 4px var(--accent-glow);
}

.nav-item.active {
  background: var(--accent-10);
  color: var(--accent);
}

.nav-item.active::before { transform: translateY(-50%) scaleY(1); }

.nav-item.active svg { color: var(--accent); opacity: 1; }

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: var(--space-3);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Main area ───────────────────────────────────────────── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: rgba(17, 17, 17, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  flex-shrink: 0;
  gap: var(--space-4);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.topbar-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semi);
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.topbar-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text-secondary);
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}

.topbar-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: #fff;
  flex-shrink: 0;
  cursor: pointer;
}

/* ── Page content ────────────────────────────────────────── */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
}

.page-title {
  font-size: var(--text-3xl);
  font-weight: var(--weight-extra);
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 6px;
}

/* Eyebrow — the one consistent uppercase micro-label style.
   Used for KPI labels, section dividers, nav sections, insight headers. */
.eyebrow {
  font-size: 10.5px;
  font-weight: var(--weight-semi);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* ── Grid utilities ──────────────────────────────────────── */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.grid-video {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

/* ── Bento (Overview hero hierarchy) ───────────────────────────────────────
   12-col asymmetric grid: the Revenue Opportunity hero spans the left ~7/12
   and two rows; the 2x2 KPI satellites fill the right ~5/12. Tile SIZE encodes
   importance so the eye lands on revenue first. Collapses to a single column
   on narrow viewports. The inner .grid-4 (KPI cards) is preserved verbatim —
   the twow cascade/count-up selectors depend on it. */
.demo-bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  align-items: stretch;
}
.demo-bento-hero {
  grid-column: span 7;
  min-width: 0;
}
.demo-bento-kpis {
  grid-column: span 5;
  min-width: 0;
}
/* KPI satellites stack as a 2x2 inside their bento cell. */
.demo-bento-kpis .grid-4 {
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  height: 100%;
}
@media (max-width: 1180px) {
  .demo-bento-hero, .demo-bento-kpis { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .demo-bento-kpis .grid-4 { grid-template-columns: 1fr; }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  :root { --sidebar-w: 64px; }

  .sidebar-logo .logo-text,
  .nav-item span,
  .nav-section-label,
  .sidebar-workspace-name,
  .sidebar-workspace-chip,
  .sidebar-footer .nav-item span { display: none; }

  .sidebar-logo { justify-content: center; padding: var(--space-4); }
  .nav-item { justify-content: center; padding: var(--space-2); }
  .nav-item svg { opacity: 1; }
  /* Collapse the workspace chip to just its status dot, centred. */
  .sidebar-workspace { justify-content: center; padding: var(--space-2); margin: var(--space-3) var(--space-2) 0; }
  /* The active rail would clip in icon-only mode — hide it; .active bg stands in. */
  .nav-item::before { display: none; }
}

@media (max-width: 768px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .page-content { padding: var(--space-4); }

  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    z-index: 200;
  }

  .sidebar.open { transform: translateX(0); }
}
