.layout {
  display: flex;
  gap: 0;
  min-height: 60vh;
}

/* ── Sidebar ───────────────────────────────────────────────────────────────── */

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--color-bg-surface);
  border-right: 1px solid var(--color-border);
  border-radius: 12px 0 0 12px;
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebarLink {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 1.25rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.sidebarLink:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-surface-hover);
}

.sidebarLinkActive {
  color: var(--color-accent) !important;
  background: var(--color-accent-subtle);
}

.sidebarLinkDisabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sidebarLinkDisabled:hover {
  background: none;
  color: var(--color-text-secondary);
}

.sidebarIcon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ── Content area ──────────────────────────────────────────────────────────── */

.content {
  flex: 1;
  min-width: 0;
  padding: 2rem;
}

.welcome {
  margin: 0 0 1.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

/* ── Stats row ─────────────────────────────────────────────────────────────── */

.statsRow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.statCard {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 80px;
}

.statValue {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.statLabel {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Sections ──────────────────────────────────────────────────────────────── */

.section {
  margin-bottom: 2rem;
}

.sectionTitle {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0 0 0.75rem;
}

.emptyText {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* ── Table ─────────────────────────────────────────────────────────────────── */

.tableWrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  text-align: left;
  padding: 0.625rem 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--color-border);
}

.table td {
  padding: 0.625rem 0.75rem;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border-subtle, var(--color-border));
}

.table tbody tr:hover {
  background: var(--color-bg-surface-hover);
}

.link {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
}

.link:hover {
  text-decoration: underline;
}

.filename {
  font-family: var(--font-mono, monospace);
  font-size: 0.8125rem;
  word-break: break-all;
}

/* ── Badges ────────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Processing status badges */
.badgeComplete {
  background: var(--color-badge-approved-bg);
  color: var(--color-badge-approved-text);
}

.badgeProcessing {
  background: var(--color-badge-edited-bg);
  color: var(--color-badge-edited-text);
}

.badgeError {
  background: var(--color-badge-rejected-bg);
  color: var(--color-badge-rejected-text);
}

.badgePending {
  background: var(--color-badge-pending-bg);
  color: var(--color-badge-pending-text);
}

/* Category badges */
.badgeCatSoundDesign {
  background: var(--color-badge-cat-sound-design-bg);
  color: var(--color-badge-cat-sound-design-text);
}

.badgeCatMixing {
  background: var(--color-badge-cat-mixing-bg);
  color: var(--color-badge-cat-mixing-text);
}

.badgeCatSynthesis {
  background: var(--color-badge-cat-synthesis-bg);
  color: var(--color-badge-cat-synthesis-text);
}

.badgeCatArrangement {
  background: var(--color-badge-cat-arrangement-bg);
  color: var(--color-badge-cat-arrangement-text);
}

.badgeCatWorkflow {
  background: var(--color-badge-cat-workflow-bg);
  color: var(--color-badge-cat-workflow-text);
}

.badgeCatMastering {
  background: var(--color-badge-cat-mastering-bg);
  color: var(--color-badge-cat-mastering-text);
}

.badgeCatMusicTheory {
  background: var(--color-badge-cat-music-theory-bg);
  color: var(--color-badge-cat-music-theory-text);
}

.badgeCatDefault {
  background: var(--color-badge-category-bg);
  color: var(--color-badge-category-text);
}

/* ── Mobile cards (hidden on desktop, shown on mobile) ─────────────────── */

.mobileCards {
  display: none;
}

.mobileCard {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.875rem 1rem;
}

.mobileCardMeta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* ── Empty / error states ──────────────────────────────────────────────────── */

.emptyState {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-muted);
}

.emptyState h2 {
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  margin: 0 0 0.5rem;
}

.emptyState p {
  font-size: 0.875rem;
  margin: 0;
}

.errorState {
  background: var(--color-error-bg, rgba(220, 38, 38, 0.1));
  color: var(--color-error, #ef4444);
  padding: 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
}

/* ── Skeleton loading ──────────────────────────────────────────────────────── */

.skeleton {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.skeletonPulse {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  animation: pulse 1.5s ease-in-out infinite;
}

.skeletonBlock {
  height: 120px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .statsRow {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    border-radius: 12px 12px 0 0;
    padding: 0.75rem 0.5rem;
    gap: 0;
  }

  .sidebarLink {
    padding: 0.5rem 1rem;
    white-space: nowrap;
    font-size: 0.8125rem;
  }

  .content {
    padding: 1.25rem;
  }

  .statsRow {
    grid-template-columns: 1fr;
  }

  /* Hide table, show mobile cards */
  .tableWrap {
    display: none;
  }

  .mobileCards {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
}
