/* ─────────────────────────────────────────────────────────────
   DESIGN TOKENS
───────────────────────────────────────────────────────────────*/
:root {
  --bg-0: #0d1018;
  --bg-1: #0f1424;
  --bg-2: #141929;
  --bg-3: #1c2236;
  --surface: #141929;
  --surface-raised: #1c2236;
  --line: rgba(47,54,80,0.75);
  --line-strong: rgba(100,120,200,0.25);
  --ink: #f4f5ff;
  --ink-2: rgba(244,245,255,0.72);
  --ink-3: rgba(244,245,255,0.42);
  --ink-4: rgba(244,245,255,0.2);
  --brand: #3ef0c3;
  --brand-ink: #021813;
  --accent: #ff2d55;
  --accent-soft: #ff6b8a;
  --good: #64d89a;
  --bad: #ff8b88;
  --sidebar-w: 260px;
  --sidebar-collapsed-w: 68px;
  --bottom-nav-h: 62px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
}

/* ─────────────────────────────────────────────────────────────
   RESET & BASE
───────────────────────────────────────────────────────────────*/
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: linear-gradient(150deg, #0d1018 0%, #11182b 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─────────────────────────────────────────────────────────────
   NOISE + HALO AMBIENCE
───────────────────────────────────────────────────────────────*/
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(#ffffff0d 0.6px, transparent 0.6px);
  background-size: 4px 4px;
  opacity: 0.22;
}

.halo {
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.38;
  pointer-events: none;
}
.halo-a {
  width: 500px;
  height: 500px;
  background: #22ffc1;
  top: -200px;
  left: -140px;
  animation: haloA 11s ease-in-out infinite alternate;
}
.halo-b {
  width: 560px;
  height: 560px;
  background: #3a60ff;
  bottom: -240px;
  right: -180px;
  animation: haloB 13s ease-in-out infinite alternate;
}
@keyframes haloA {
  from { transform: translateY(0); }
  to   { transform: translateY(28px); }
}
@keyframes haloB {
  from { transform: translateY(0); }
  to   { transform: translateY(-32px); }
}

/* ─────────────────────────────────────────────────────────────
   TOPBAR
───────────────────────────────────────────────────────────────*/
.topbar {
  flex-shrink: 0;
  z-index: 40;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(13,16,24,0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  position: relative;
}

.brand {
  font-family: "Archivo Black", sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.03em;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  white-space: nowrap;
}

#whoami, #workspace-name {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-3);
}

/* hide on mobile to save space */
#whoami { display: none; }

.breadcrumb-bar { display: none; }

/* ─────────────────────────────────────────────────────────────
   STICKY BREADCRUMB
───────────────────────────────────────────────────────────────*/
.breadcrumb-sticky {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0 1rem;
  background: rgba(13,16,24,0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  min-height: 44px;
  overflow-x: auto;
}

.breadcrumb-sticky:empty { display: none; }

.bc-item {
  color: var(--ink-3);
  background: none;
  border: none;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 120ms;
  font-family: inherit;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.bc-item:hover { color: var(--ink); }

.bc-item.active {
  color: var(--ink-2);
  font-weight: 600;
  cursor: default;
}

.bc-sep {
  color: var(--ink-4);
  font-size: 0.75rem;
  pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────
   MOBILE BURGER BUTTON (topbar, hidden on tablet+)
───────────────────────────────────────────────────────────────*/
.mobile-burger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 120ms;
}
.mobile-burger:hover { background: rgba(255,255,255,0.08); }

/* ─────────────────────────────────────────────────────────────
   SIDEBAR BACKDROP (mobile overlay)
───────────────────────────────────────────────────────────────*/
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 220ms ease;
}
.sidebar-backdrop.open {
  display: block;
  opacity: 1;
}

/* ─────────────────────────────────────────────────────────────
   APP LAYOUT — mobile: single column (no sidebar in flow)
───────────────────────────────────────────────────────────────*/
.app-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* ─────────────────────────────────────────────────────────────
   SIDEBAR — mobile: off-canvas drawer
───────────────────────────────────────────────────────────────*/
.sidebar {
  position: fixed;
  top: 56px; /* below topbar */
  left: 0;
  bottom: 0;
  width: 280px;
  z-index: 40;
  background: rgba(13,16,24,0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0.875rem 0.75rem 1.5rem;
  gap: 0.15rem;
  overflow-y: auto;
  overflow-x: hidden;
  transform: translateX(-100%);
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar.open {
  transform: translateX(0);
}
.sidebar::-webkit-scrollbar { display: none; }

/* Always show sidebar extras (drawer has full vertical space) */
.sidebar-header  { display: flex; }
.sidebar-spacer  { display: block; flex: 1; min-height: 1rem; }
.sidebar-tree    { display: flex; }

/* ─────────────────────────────────────────────────────────────
   NAV ITEMS
───────────────────────────────────────────────────────────────*/
.nav-item {
  flex: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  text-align: left;
  width: 100%;
  min-height: 44px;
  transition: color 120ms, background 120ms;
  font-family: inherit;
  white-space: nowrap;
}

.nav-item:hover { color: var(--ink); background: rgba(255,255,255,0.07); }

.nav-item.active {
  color: var(--brand);
  background: rgba(62,240,195,0.1);
  font-weight: 600;
}

.nav-icon { flex-shrink: 0; }

.nav-label {
  opacity: 1;
  overflow: hidden;
  font-size: inherit;
}

/* ─────────────────────────────────────────────────────────────
   SIDEBAR TREE — hidden on mobile (shown below on tablet+)
───────────────────────────────────────────────────────────────*/
.sidebar-tree {
  display: flex;
  flex-direction: column;
  gap: 0.02rem;
  margin-top: 0.15rem;
  overflow: hidden;
}

.tree-artist-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 1rem;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--ink-3);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 120ms, color 120ms;
  font-family: inherit;
  min-height: 40px;
}

.tree-artist-btn:hover { background: rgba(255,255,255,0.06); color: var(--ink-2); }
.tree-artist-btn.active { color: var(--ink); }

.tree-release-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  width: 100%;
  padding: 0.4rem 0.75rem 0.4rem 1.75rem;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--ink-4);
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 120ms, color 120ms;
  font-family: inherit;
  min-height: 36px;
}

.tree-release-btn:hover { background: rgba(255,255,255,0.05); color: var(--ink-3); }
.tree-release-btn.active { color: var(--ink-2); font-weight: 600; }

.tree-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 120ms, color 120ms;
  padding: 0;
  min-height: unset;
}

.sidebar-toggle:hover {
  background: rgba(255,255,255,0.08);
  color: var(--ink);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
  padding: 0 0.25rem;
  min-width: 0;
}

.sidebar-workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.sidebar-workspace-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--ink-4);
  text-transform: uppercase;
  line-height: 1;
  margin-bottom: 2px;
}

.sidebar-workspace-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-spacer { flex: 1; min-height: 1rem; }
.sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--ink-4);
  text-transform: uppercase;
  padding: 0.85rem 0.75rem 0.3rem;
}

/* ─────────────────────────────────────────────────────────────
   MAIN CONTENT
───────────────────────────────────────────────────────────────*/
.app-main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background: transparent;
  padding-bottom: 0;
  position: relative;
  z-index: 1;
}

/* Toast notification — floats at bottom centre, auto-dismissed by JS */
#global-feedback {
  position: fixed;
  bottom: 1.75rem;
  left: 50%;
  transform: translateX(-50%) translateY(0.5rem);
  background: var(--bg-3);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 9999;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms ease;
}
#global-feedback.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#global-feedback.good { color: var(--good); border-color: rgba(48,209,88,0.25); }
#global-feedback.bad  { color: var(--bad);  border-color: rgba(255,69,58,0.25); }

/* ─────────────────────────────────────────────────────────────
   VIEWS
───────────────────────────────────────────────────────────────*/
.view {
  display: none;
  padding: 1.25rem 1rem 2rem;
  animation: panelIn 180ms ease;
}

.view.active { display: block; }

[hidden] { display: none !important; }

@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────────────────────────────────────
   HEADINGS / VIEW HEADING
───────────────────────────────────────────────────────────────*/
.view-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.level-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* ─────────────────────────────────────────────────────────────
   CATALOG LEVELS
───────────────────────────────────────────────────────────────*/
.catalog-level {
  display: grid;
  gap: 1.5rem;
  animation: panelIn 180ms ease;
}

/* ─────────────────────────────────────────────────────────────
   ENTITY HERO
───────────────────────────────────────────────────────────────*/
.entity-hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.entity-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 60%);
  pointer-events: none;
}

.entity-hero-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff2d55, #6e00ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Archivo Black", sans-serif;
  font-size: 2rem;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.entity-hero-cover {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #1a1a2e, #2d1b4e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: rgba(255,255,255,0.3);
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.entity-hero-number {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--ink-2);
  flex-shrink: 0;
}

.entity-hero-info { flex: 1; min-width: 0; }

.entity-hero-meta {
  margin: 0.3rem 0 0;
  color: var(--ink-3);
  font-size: 0.9rem;
}

.entity-hero-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ─────────────────────────────────────────────────────────────
   CONTEXT TABS
───────────────────────────────────────────────────────────────*/
.ctx-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ctx-tabs::-webkit-scrollbar { display: none; }

.ctx-tab {
  padding: 0.75rem 1rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ink-3);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: color 120ms, border-color 120ms;
  font-family: inherit;
  margin-bottom: -1px;
  white-space: nowrap;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
}

.ctx-tab:hover { color: var(--ink-2); }

.ctx-tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
  font-weight: 600;
}

.ctx-panel {
  display: none;
  gap: 1rem;
  padding-top: 1.25rem;
}

.ctx-panel.active { display: grid; }

/* ─────────────────────────────────────────────────────────────
   ENTITY GRID — mobile: 2 columns
───────────────────────────────────────────────────────────────*/
.entity-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.entity-card {
  background: var(--bg-2);
  border-radius: var(--radius-md);
  padding: 0.875rem;
  cursor: pointer;
  transition: background 150ms, transform 150ms, box-shadow 150ms;
  display: grid;
  gap: 0.4rem;
  text-align: left;
  font-family: inherit;
  color: var(--ink);
  border: none;
  -webkit-tap-highlight-color: transparent;
}

.entity-card:active {
  background: var(--bg-3);
  transform: scale(0.98);
}

.entity-card-avatar {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff2d55, #6e00ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Archivo Black", sans-serif;
  font-size: 2rem;
  color: white;
  margin-bottom: 0.5rem;
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}

.entity-card-cover {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  background: linear-gradient(135deg, #1a1a2e, #2d1b4e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: rgba(255,255,255,0.25);
  margin-bottom: 0.5rem;
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}

.entity-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.3;
  /* allow 2 lines on mobile */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.entity-card-meta {
  font-size: 0.82rem;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entity-card-footer {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.1rem;
}

/* ─────────────────────────────────────────────────────────────
   TRACK LIST
───────────────────────────────────────────────────────────────*/
.tracklist {
  display: grid;
  gap: 2px;
  margin-top: 0 !important;
}

.track-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  align-items: center;
  gap: 0.75rem;
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 0.75rem 0.5rem;
  cursor: pointer;
  transition: background 120ms;
  min-height: 56px;
  -webkit-tap-highlight-color: transparent;
}

.track-row:active { background: rgba(255,255,255,0.06); }

.track-row-num {
  font-weight: 400;
  font-size: 1rem;
  color: var(--ink-3);
  text-align: center;
}

.track-row-info { min-width: 0; }

.track-row-title {
  font-weight: 500;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-row-meta {
  font-size: 0.82rem;
  color: var(--ink-3);
  margin-top: 0.1rem;
}

.track-row-actions {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  /* always visible on mobile (no hover) */
  opacity: 1;
}

/* ─────────────────────────────────────────────────────────────
   CREATE PANEL
───────────────────────────────────────────────────────────────*/
.create-panel-inner { margin-bottom: 1rem; }

.create-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.9rem;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

/* ─────────────────────────────────────────────────────────────
   BUTTONS
───────────────────────────────────────────────────────────────*/
button {
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  border: none;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 700;
  cursor: pointer;
  transition: opacity 130ms, transform 130ms;
  font-family: inherit;
  font-size: 0.95rem;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

button:active:not(:disabled) {
  opacity: 0.82;
  transform: scale(0.98);
}

button.ghost {
  background: rgba(255,255,255,0.1);
  color: var(--ink);
  border: 1px solid rgba(255,255,255,0.12);
}

button.ghost:active:not(:disabled) {
  background: rgba(255,255,255,0.15);
}

button.small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  min-height: 40px;
}

button.warn {
  background: rgba(255,69,58,0.15);
  color: #ff6b6b;
  border: 1px solid rgba(255,69,58,0.25);
}

button.warn-ghost {
  background: transparent;
  color: rgba(255,120,120,0.8);
  border: 1px solid rgba(255,69,58,0.2);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.danger-zone {
  margin-top: 2rem;
  padding: 1.25rem;
  border: 1px solid rgba(255,69,58,0.25);
  border-radius: 12px;
  background: rgba(255,69,58,0.04);
}
.danger-zone h3 {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ff6b6b;
  margin: 0 0 0.5rem;
}
.danger-zone p {
  font-size: 0.85rem;
  color: var(--ink-dim);
  margin: 0 0 1rem;
}
.danger-zone .feedback {
  margin-top: 0.5rem;
  font-size: 0.82rem;
}

.primary-btn {
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  border: none;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 700;
  cursor: pointer;
  transition: opacity 130ms, transform 130ms;
  font-family: inherit;
  font-size: 0.95rem;
  min-height: 48px;
}

.primary-btn.small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  min-height: 40px;
}

.primary-btn:active:not(:disabled) { opacity: 0.85; transform: scale(0.98); }

/* ─────────────────────────────────────────────────────────────
   STATS GRID
───────────────────────────────────────────────────────────────*/
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.stat-card {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, #1a2040cc, #111828cc);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.stat-card .label {
  font-size: 0.75rem;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.stat-card .value {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 0.3rem 0 0.1rem;
}

.stat-card .meta {
  font-size: 0.82rem;
  color: var(--ink-2);
}

/* ─────────────────────────────────────────────────────────────
   ENTITY LIST / ROW
───────────────────────────────────────────────────────────────*/
.entity-list {
  display: grid;
  gap: 2px;
  margin-top: 0.5rem;
}

.entity-row {
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 0.875rem 0.75rem;
  display: grid;
  gap: 0.4rem;
  transition: background 120ms;
  min-height: 56px;
}

.entity-row:active { background: rgba(255,255,255,0.05); }

.entity-row .head {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: center;
}

.entity-row .title {
  font-weight: 600;
  font-size: 1rem;
}

.entity-row .meta {
  font-size: 0.82rem;
  color: var(--ink-3);
}

/* ─────────────────────────────────────────────────────────────
   STATUS PILL
───────────────────────────────────────────────────────────────*/
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: var(--ink-3);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.status-pill.published {
  color: var(--good);
  background: rgba(100,216,154,0.12);
}

.status-pill.archived {
  color: var(--ink-3);
  background: rgba(255,255,255,0.06);
}

/* ─────────────────────────────────────────────────────────────
   PANEL
───────────────────────────────────────────────────────────────*/
.panel {
  background: linear-gradient(160deg, #151a2bcc, #0f1424d4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ─────────────────────────────────────────────────────────────
   TWO-COL (stacked on mobile)
───────────────────────────────────────────────────────────────*/
.two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}
/* On wider layouts the left column sticks while the right scrolls */
@media (min-width: 900px) {
  .two-col > :first-child {
    position: sticky;
    top: 1rem;
  }
}

/* ─────────────────────────────────────────────────────────────
   TYPOGRAPHY
───────────────────────────────────────────────────────────────*/
h1, h2, h3, h4 { margin: 0; }

h1 {
  font-family: "Archivo Black", sans-serif;
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.15;
}

h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
}

h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink-2);
}

.kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-3);
}

.sub {
  margin: 0.35rem 0 0;
  color: var(--ink-3);
  font-size: 0.95rem;
}

/* ─────────────────────────────────────────────────────────────
   FORM ELEMENTS
───────────────────────────────────────────────────────────────*/
.form {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
}

label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  min-height: 44px;
}

input, textarea, select, button { font: inherit; }

input, textarea, select {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.1);
  background: var(--bg-2);
  color: var(--ink);
  padding: 0.75rem 0.875rem;
  outline: none;
  transition: border-color 130ms, box-shadow 130ms;
  width: 100%;
  font-size: 1rem; /* prevents iOS zoom */
  min-height: 48px;
}

input:focus, textarea:focus, select:focus {
  border-color: rgba(255,255,255,0.3);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.06);
}

/* Override browser autofill so it stays dark */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-2) inset !important;
  -webkit-text-fill-color: var(--ink) !important;
  caret-color: var(--ink);
  border-color: rgba(255,255,255,0.1) !important;
  transition: background-color 9999s ease-in-out 0s;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* ─────────────────────────────────────────────────────────────
   FEEDBACK / EMPTY / MISC
───────────────────────────────────────────────────────────────*/
.feedback {
  margin: 0;
  min-height: 1.2rem;
  font-size: 0.9rem;
}

.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }

.empty {
  color: var(--ink-4);
  font-size: 0.95rem;
  padding: 0.5rem 0;
}

.entity-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 0.75rem 0;
}

/* ─────────────────────────────────────────────────────────────
   TABLET — sidebar comes back, bottom nav hides
   min-width: 768px
───────────────────────────────────────────────────────────────*/
@media (min-width: 768px) {
  #whoami { display: block; }

  /* Hide burger on tablet+ */
  .mobile-burger { display: none; }

  /* Backdrop never needed on tablet+ */
  .sidebar-backdrop { display: none !important; }

  .app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    transition: grid-template-columns 260ms cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
  }

  .app-layout.sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed-w) minmax(0, 1fr);
  }

  /* Sidebar: static in the grid, always visible */
  .sidebar {
    position: static;
    top: auto;
    left: auto;
    bottom: auto;
    width: auto;
    height: auto;
    transform: none !important;
    transition: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0.875rem 0.75rem 1rem;
    gap: 0.15rem;
    border-top: none;
    border-right: 1px solid var(--line);
    border-radius: 0;
    background: rgba(13,16,24,0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* Active nav teal on tablet+ */
  .nav-item.active {
    color: var(--brand);
    background: rgba(62,240,195,0.1);
  }

  .nav-label { font-size: inherit; }

  /* Collapsed sidebar */
  .sidebar-collapsed .nav-label { opacity: 0; width: 0; pointer-events: none; }
  .sidebar-collapsed .sidebar-workspace { display: none; }
  .sidebar-collapsed .sidebar-section-label { display: none; }
  .sidebar-collapsed .sidebar-tree { display: none; }
  .sidebar-collapsed .nav-item { justify-content: center; padding: 0.6rem; }

  /* Main area: no bottom padding needed */
  .app-main { padding-bottom: 0; }

  /* Wider grids on tablet */
  .entity-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }

  .two-col {
    grid-template-columns: 1fr 1.2fr;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  /* Track row actions hidden until hover on tablet+ */
  .track-row-actions { opacity: 0; }
  .track-row:hover .track-row-actions { opacity: 1; }
  .track-row:hover { background: rgba(255,255,255,0.05); }
  .track-row:active { background: transparent; }

  .view { padding: 1.75rem 2rem 2rem; }

  .breadcrumb-sticky { padding: 0 1.75rem; }
}

/* ─────────────────────────────────────────────────────────────
   DESKTOP — wider grids
   min-width: 1100px
───────────────────────────────────────────────────────────────*/
@media (min-width: 1100px) {
  .entity-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  }

  .entity-card:hover {
    background: linear-gradient(160deg, #1c2240cc, #131929cc);
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  }
}
