:root {
  color-scheme: dark;
  /* Executive Dark Tech - Royalty Overhaul */
  --bg-deep: #0a0a0c;
  --bg-surface: #121216;
  --bg-elevated: #1a1a20;
  
  --accent: #00f2ff; /* Electric Cyan */
  --accent-glow: rgba(0, 242, 255, 0.4);
  --accent-soft: rgba(0, 242, 255, 0.1);
  --cyan: #00f2ff;
  --cyan-grad: linear-gradient(90deg, #00f2ff, #0080ff);
  
  --red: #ff3e3e;
  --red-soft: rgba(255, 62, 62, 0.12);
  --green: #00ffa3;
  --green-soft: rgba(0, 255, 163, 0.12);
  
  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.12);
  
  --ink: #ffffff;
  --muted: #80808a;
  --muted-strong: #b0b0ba;

  --radius-lg: 16px; /* Industrial Sharpness */
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-ui: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --shell-max-width: 1380px;
  --shell-gutter: clamp(28px, 6vw, 96px);
  --content-inset: 0px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: 
    radial-gradient(ellipse at top left, rgba(0, 242, 255, 0.08) 0%, transparent 45%),
    radial-gradient(ellipse at bottom right, rgba(126, 87, 255, 0.05) 0%, transparent 50%),
    var(--bg-deep);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-ui);
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

button,
select,
input {
  font: inherit;
}

/* Base animations */
@keyframes fadeUp {
  0% { opacity: 0; transform: translateY(30px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulseNeon {
  0% { box-shadow: 0 0 15px rgba(0, 242, 255, 0.2); }
  50% { box-shadow: 0 0 30px rgba(0, 242, 255, 0.4); }
  100% { box-shadow: 0 0 15px rgba(0, 242, 255, 0.2); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.royalty-shell {
  min-height: 100vh;
  width: min(var(--shell-max-width), calc(100% - (var(--shell-gutter) * 2)));
  margin: 0 auto;
  padding: 110px 0 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  animation: none;
}

.header-backdrop-blur {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 124px;
  z-index: 50;
  pointer-events: none;
  background:
    linear-gradient(
      180deg,
      rgba(12, 14, 18, 0.78) 0%,
      rgba(12, 14, 18, 0.62) 56%,
      rgba(12, 14, 18, 0.28) 82%,
      transparent 100%
    );
  backdrop-filter: blur(22px) saturate(120%);
  -webkit-backdrop-filter: blur(22px) saturate(120%);
  mask-image: linear-gradient(180deg, #000 0%, #000 78%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 78%, transparent 100%);
}

.workspace-header {
  position: fixed;
  top: 12px;
  left: 50%;
  width: min(var(--shell-max-width), calc(100vw - (var(--shell-gutter) * 2)));
  z-index: 60;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 16px 22px;
  border-radius: 24px;
  background: rgba(14, 16, 20, 0.78);
  backdrop-filter: blur(30px) saturate(126%);
  -webkit-backdrop-filter: blur(30px) saturate(126%);
  border: 1px solid var(--line);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.34);
  overflow: hidden;
  isolation: isolate;
  transform: translateX(-50%) translateZ(0);
  will-change: transform;
}

.workspace-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(20, 22, 28, 0.62), rgba(12, 14, 18, 0.42)),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.06), transparent 42%);
  z-index: -2;
}

.workspace-header::after {
  content: "";
  position: absolute;
  left: -8px;
  right: -8px;
  bottom: -22px;
  height: 40px;
  border-radius: 0 0 24px 24px;
  background: linear-gradient(180deg, rgba(16, 18, 22, 0.38), rgba(16, 18, 22, 0.14), transparent);
  filter: blur(12px);
  pointer-events: none;
  z-index: -1;
}

.workspace-brand {
  justify-self: start;
  min-width: 0;
  display: flex;
  align-items: center;
  color: #fff;
  text-decoration: none;
}

.workspace-brand-mark {
  width: 132px;
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.04));
}

.workspace-header-nav {
  justify-self: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.workspace-header-tools {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.workspace-nav-link {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
  font-weight: 600;
  transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.workspace-nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.workspace-nav-link.active {
  color: #081018;
  background: linear-gradient(135deg, #ffffff, #d7faff);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 24px rgba(255, 255, 255, 0.08);
}

.workspace-header-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  min-height: 42px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.theme-toggle {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted-strong);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.28s ease, background 0.28s ease, border-color 0.28s ease, color 0.28s ease,
    box-shadow 0.28s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.theme-toggle-icon {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  display: inline-block;
  flex-shrink: 0;
  background: linear-gradient(135deg, #ffe38a, #ffb703);
  box-shadow: 0 0 18px rgba(255, 200, 87, 0.32);
  position: relative;
}

.theme-toggle-icon::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.24);
}

.workspace-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #00ffa3;
  box-shadow: 0 0 14px rgba(0, 255, 163, 0.5);
}

.mobile-module-dock {
  display: none;
}

.module-strip,
.global-header {
  background: rgba(10, 10, 12, 0.84);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--line);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}

.dashboard-main {
  min-width: 0;
  display: grid;
  gap: 24px;
  padding-inline: var(--content-inset);
}

.global-header {
  border-radius: 28px;
  padding: 28px 32px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
}

.global-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.8;
}

.global-header-copy {
  min-width: 0;
  display: grid;
  gap: 12px;
}

.global-header-copy h1 {
  margin: 0;
  font-size: clamp(36px, 4vw, 62px);
  font-weight: 700;
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.global-header-actions {
  display: grid;
  gap: 14px;
  justify-items: end;
  min-width: min(420px, 100%);
}

.header-action-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.module-strip {
  border-radius: 24px;
  padding: 24px 26px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
}

.module-strip-copy {
  display: grid;
  gap: 10px;
  max-width: 720px;
}

.module-strip-copy strong {
  font-size: clamp(24px, 2.8vw, 34px);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.module-strip-copy p:last-child {
  margin: 0;
  color: var(--muted-strong);
  font-size: 15px;
  line-height: 1.6;
}

.app-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: rgba(10, 10, 12, 0.58);
  border: 1px solid var(--line);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
}

.tab-chip {
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted-strong);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
}

.tab-chip:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-2px);
}

.tab-chip.active {
  color: #000;
  border-color: var(--accent);
  background: linear-gradient(135deg, #00f2ff, #00d1ff);
  box-shadow: 0 10px 25px rgba(0, 242, 255, 0.3);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
  gap: 28px;
}

.tab-panel.active > * {
  animation: fadeUp 0.7s cubic-bezier(0.19, 1, 0.22, 1) backwards;
}

/* TOPBAR */
.topbar {
  background: rgba(10, 10, 12, 0.85);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: var(--radius-lg);
  padding: 28px 36px;
  border: 1px solid var(--line);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1), box-shadow 0.4s ease;
}

.topbar:hover {
  transform: translateY(-2px);
  box-shadow: 0 50px 110px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 242, 255, 0.1);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent), transparent);
  opacity: 0.7;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
}

.brand-mark {
  width: min(296px, 30vw);
  max-width: 100%;
  height: auto;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.brand-copy h1 {
  margin: 0;
  font-size: clamp(36px, 4vw, 64px);
  font-family: var(--font-ui);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: #fff;
}

.subcopy {
  margin: 0;
  max-width: 700px;
  color: var(--muted-strong);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.6;
}

.eyebrow {
  margin: 0;
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
}

.topbar-actions {
  display: grid;
  gap: 14px;
  justify-items: end;
  align-content: start;
}

.topbar-note {
  display: grid;
  gap: 6px;
  justify-items: end;
  color: var(--muted-strong);
}

.note-label {
  font-size: 10px;
  letter-spacing: 0.25em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
}
.topbar-note strong { color: #fff; font-weight: 500; font-size: 15px; }

.action {
  min-height: 48px;
  min-width: 180px;
  padding: 0 28px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 242, 255, 0.3);
  background: linear-gradient(135deg, #00d1ff, #0080ff);
  color: #000814;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 128, 255, 0.2);
  transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.action::before {
  content: "";
  position: absolute;
  top: 0; left: -100%; right: 0; bottom: 0;
  width: 50%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  transform: skewX(-20deg);
  opacity: 0;
  transition: opacity 0.3s;
}

.action:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 30px rgba(0, 128, 255, 0.4), 0 0 20px rgba(0, 242, 255, 0.2);
  border-color: var(--accent);
}
.action:hover::before {
  opacity: 1;
  animation: shimmer 1.5s infinite;
}

.action:active {
  transform: translateY(1px);
}

.action.ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line);
  color: #fff;
  box-shadow: none;
  font-weight: 600;
}
.action.ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.action.subtle {
  width: 100%;
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--muted-strong);
  font-weight: 500;
  box-shadow: none;
}
.action.subtle:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  border-style: solid;
  border-color: var(--accent);
}

.workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  min-width: 0;
}

/* CARDS COMMON (Floating Glass) */
.dock-card,
.canvas-card,
.dataset-tile,
.headline-card {
  background: var(--bg-surface);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1), box-shadow 0.4s ease, border-color 0.4s ease;
  position: relative;
}

.dock-card:hover,
.canvas-card:hover,
.dataset-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255,255,255,0.08);
  border-color: var(--accent);
  z-index: 2;
}

.dock-card,
.canvas-card {
  padding: 30px;
}

.dataset-ribbon {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.dataset-tile {
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  animation: fadeUp 0.8s cubic-bezier(0.19, 1, 0.22, 1) backwards;
}

.dataset-ribbon > .dataset-tile:nth-child(4) { 
  animation-delay: 0.4s; 
  border-color: var(--accent); 
  background: linear-gradient(135deg, rgba(10, 10, 12, 0.9), rgba(0, 242, 255, 0.08));
}

.headline-card {
  padding: 32px 36px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: start;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

.headline-card h2 {
  font-size: clamp(32px, 3.5vw, 48px);
  font-family: var(--font-ui);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-top: 8px;
}

.headline-copy {
  margin: 16px 0 0;
  color: var(--muted-strong);
  max-width: 800px;
  font-size: 16px;
  line-height: 1.6;
  font-weight: 300;
}

.control-rail,
.dock-card,
.source-stack,
.source-card,
.source-row,
.source-meta,
.meta-chip {
  min-width: 0;
}

.pill-wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all 0.3s;
}
.pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 28px;
}

.section-head h2 {
  font-size: 26px;
  letter-spacing: -0.02em;
  margin-top: 6px;
  font-weight: 600;
}

.section-head h3 {
  font-size: 24px;
  letter-spacing: -0.02em;
  font-weight: 500;
}

.section-note {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.15em;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.badge.live {
  color: var(--cyan);
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.3);
  box-shadow: inset 0 0 10px rgba(0, 229, 255, 0.1);
  animation: pulseNeon 3s infinite;
}

.source-stack,
.field-stack,
.spotlight-list,
.deliverable-list,
.preview-stats {
  display: grid;
  gap: 16px;
}

.source-card {
  background: rgba(8, 12, 17, 0.8);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
  color: #fff;
  border-radius: 20px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: grid;
  gap: 16px;
  transition: background 0.3s, transform 0.3s, border-color 0.3s;
  width: 100%;
  overflow: hidden;
}
.source-card:hover {
  background: rgba(12, 16, 24, 0.9);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.1);
}

.source-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.source-name {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.source-type {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.source-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.meta-chip {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 14px;
  transition: background 0.3s;
  min-width: 0;
}
.meta-chip:hover {
  background: rgba(255, 255, 255, 0.05);
}

.meta-chip span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 700;
}

.meta-chip strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(16px, 1.5vw, 22px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 860px) {
  .source-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .source-meta .meta-chip:last-child {
    grid-column: 1 / -1;
  }
}

.source-foot {
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.5;
  font-weight: 300;
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-top: 12px;
}

.field-group {
  display: grid;
  gap: 12px;
}

.field-label {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-weight: 700;
}

.field-help {
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 300;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px;
  border-radius: 26px;
  border: 1px solid rgba(255,255,255,0.05);
  background: linear-gradient(180deg, rgba(18, 20, 27, 0.82), rgba(10, 11, 16, 0.72));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.03),
    0 16px 40px rgba(0,0,0,0.22);
}

.segmented button,
select {
  min-height: 52px;
  border-radius: 18px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted-strong);
  padding: 0 18px;
  transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

select {
  font-weight: 500;
  font-size: 14px;
  border-radius: 18px;
  padding-right: 46px;
}

.segmented button,
.year-chip,
.mini-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: var(--muted-strong);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform 0.28s cubic-bezier(0.19, 1, 0.22, 1),
    background 0.28s ease,
    color 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.segmented button {
  flex: 1 1 160px;
}

.segmented button:hover,
.year-chip:hover,
.mini-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255,255,255,0.14);
  transform: translateY(-1px);
}

.segmented button.active,
.year-chip.active,
.mini-toggle.active {
  background: linear-gradient(135deg, #dff7ff 0%, #b9eeff 48%, #8be6ff 100%);
  color: #071823;
  border-color: rgba(64, 220, 255, 0.38);
  box-shadow:
    0 14px 28px rgba(0, 209, 255, 0.18),
    inset 0 1px 0 rgba(255,255,255,0.72);
}

select {
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.2) url('data:image/svg+xml;utf8,<svg fill="none" height="24" stroke="%23a0aec0" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><polyline points="6 9 12 15 18 9"/></svg>') no-repeat right 16px center;
  background-size: 16px;
  appearance: none;
  cursor: pointer;
  color: #fff;
  width: 100%;
}
select:hover {
  border-color: rgba(255,255,255,0.2);
  background-color: rgba(255,255,255,0.05);
}
select option {
  background: #080c11;
  color: #fff;
  padding: 10px;
}

.year-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.year-chip {
  min-width: 110px;
  background: rgba(255,255,255,0.03);
}

.store-filter-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mini-toggle {
  min-height: 48px;
  padding: 0 22px;
  font-size: 14px;
}

.store-checklist {
  max-height: 250px;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.25);
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.store-checklist::-webkit-scrollbar { width: 6px; }
.store-checklist::-webkit-scrollbar-track { background: transparent; }
.store-checklist::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.store-checklist::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

.store-option {
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 12px;
  padding: 12px 14px;
  background: transparent;
  cursor: pointer;
  transition: background 0.3s;
}
.store-option:hover {
  background: rgba(255, 255, 255, 0.04);
}

.store-option input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--cyan);
  cursor: pointer;
}

.store-option span {
  font-size: 14px;
  color: #fff;
  font-weight: 400;
}

.rail-actions {
  margin-top: 20px;
}

.info-panel {
  margin-top: 20px;
  border-radius: 18px;
  background: rgba(0,229,255,0.03);
  border: 1px dashed rgba(0, 229, 255, 0.2);
  padding: 20px;
}
.info-panel p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.6;
  font-weight: 300;
}

/* BIG METRICS GRID */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.metric-card {
  background: var(--bg-surface);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  padding: 28px;
  display: grid;
  gap: 14px;
  transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1), box-shadow 0.4s ease, border-color 0.4s;
  position: relative;
  overflow: hidden;
}

.metric-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255,255,255,0.1);
  border-color: var(--accent);
}
.metric-card:hover::before {
  transform: translateX(100%);
}

.metric-label {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-weight: 800;
}

.metric-value {
  display: block;
  max-width: 100%;
  min-width: 0;
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  font-weight: 200; /* Apple-style thin numbers */
  color: #fff;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.metric-sub {
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 300;
}

.visual-grid,
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 24px;
}

.archive-grid {
  grid-template-columns: minmax(340px, 0.85fr) minmax(0, 1.15fr);
}

.bar-panel {
  display: grid;
  gap: 20px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 160px) minmax(0, 1fr) 108px;
  gap: 20px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  transition: background 0.3s;
}
.bar-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.bar-key {
  display: grid;
  gap: 6px;
}

.bar-key strong {
  font-size: 16px;
  font-weight: 500;
}

.bar-key span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 300;
  text-transform: capitalize;
}

.bar-track {
  position: relative;
  height: 8px; /* Thinner sophisticated lines */
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
}

.bar-track::before {
  content: "";
  position: absolute;
  inset: 0;
  width: calc(var(--fill) * 1%);
  background: linear-gradient(90deg, #00f2ff, #0080ff);
  border-radius: 999px;
  box-shadow: 0 0 15px rgba(0, 242, 255, 0.4);
  transition: width 1s cubic-bezier(0.19, 1, 0.22, 1);
}

.mix-bar span {
  display: block;
  height: 100%;
  width: calc(var(--fill) * 1%);
  border-radius: 999px;
  background: linear-gradient(90deg, #00f2ff, #0080ff);
  box-shadow: 0 0 12px rgba(0, 242, 255, 0.3);
  transition: width 1s cubic-bezier(0.19, 1, 0.22, 1);
}

.mini-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  margin: 16px 0 14px;
}

.spotlight-list {
  display: grid;
  gap: 12px;
}

.spotlight-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.3s, transform 0.3s;
}
.spotlight-item:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(6px);
  border-left: 2px solid var(--accent);
}

.spotlight-item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 400;
}

.spotlight-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 300;
}

.table-wrap {
  overflow: auto;
  scrollbar-gutter: stable;
  overscroll-behavior-x: contain;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0,0,0,0.2);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 100%;
}

thead tr {
  background: rgba(255,255,255,0.02);
  color: var(--muted-strong);
}

th,
td {
  text-align: left;
  padding: 18px 24px;
  font-size: 14px;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.table-wrap th:first-child,
.table-wrap td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 260px;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: 1px 0 0 rgba(255,255,255,0.04);
}

.table-wrap thead th:first-child {
  z-index: 3;
  background: rgba(255,255,255,0.02);
}

.table-wrap tbody td:first-child {
  background: rgba(11, 13, 18, 0.88);
}

.table-wrap tbody tr:nth-child(even) td:first-child {
  background: rgba(18, 22, 30, 0.94);
}

th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-weight: 700;
}

tbody tr {
  transition: background 0.3s;
}
tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.018);
}
tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}
tbody tr:last-child td {
  border-bottom: none;
}

.preview-card {
  display: grid;
  gap: 20px;
}

.preview-cover {
  border-radius: var(--radius-lg);
  padding: 32px;
  color: #fff;
  background: 
    radial-gradient(circle at top right, rgba(0, 242, 255, 0.15), transparent 60%),
    var(--bg-elevated);
  min-height: 240px;
  display: grid;
  align-content: end;
  gap: 12px;
  border: 1px solid var(--line);
  box-shadow: 0 30px 60px rgba(0,0,0,0.5);
  position: relative;
  overflow: hidden;
}

.preview-cover::after {
  content: "";
  position: absolute;
  top: 0; left: -100%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.1), transparent);
  transform: skewX(-20deg);
  animation: shimmer 5s infinite;
}

.preview-cover strong {
  font-size: 36px;
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.preview-cover p:last-child {
  margin: 0;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.6;
  font-size: 15px;
  font-weight: 300;
}

.deliverable-list article,
.preview-stat {
  border-radius: 18px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  gap: 12px;
  transition: background 0.3s, transform 0.3s;
}
.deliverable-list article:hover, .preview-stat:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.1);
}

.deliverable-tag {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-weight: 800;
}

.preview-stats {
  grid-template-columns: 1fr;
}

.preview-stat strong {
  font-size: clamp(20px, 2.2vw, 26px);
  font-weight: 300;
  line-height: 1.06;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.preview-stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 300;
}

.empty-state {
  border-radius: 20px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  padding: 30px;
  color: var(--muted-strong);
  line-height: 1.6;
  text-align: center;
  font-weight: 300;
}

/* UPLOAD ZONE REDESIGN */
.upload-zone {
  border: 2px dashed rgba(226, 179, 109, 0.2);
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.3);
  padding: 40px 20px;
  text-align: center;
  transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(226, 179, 109, 0.08);
  box-shadow: 0 0 30px rgba(226, 179, 109, 0.15);
  transform: scale(1.02);
}

.upload-content {
  display: grid;
  gap: 16px;
  justify-items: center;
  pointer-events: none;
}

.upload-content svg {
  color: var(--accent);
  opacity: 0.9;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 8px rgba(226, 179, 109, 0.3));
}

.upload-content strong {
  font-size: 18px;
  font-weight: 400;
  color: #fff;
}

.upload-content span {
  font-size: 14px;
  color: var(--muted-strong);
  font-weight: 300;
}

/* UPLOAD PROGRESS */
.upload-progress-wrap {
  display: grid;
  gap: 16px;
  padding: 20px;
  background: rgba(0,0,0,0.4);
  border-radius: 16px;
  margin-top: 20px;
  text-align: left;
  border: 1px solid rgba(255,255,255,0.05);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-info strong {
  font-size: 15px;
  font-weight: 400;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.progress-info span {
  font-size: 16px;
  font-weight: 700;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

.progress-bar {
  height: 8px; /* Slightly thicker */
  background: rgba(255,255,255,0.05);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

.progress-fill {
  height: 100%;
  background: var(--cyan-grad);
  border-radius: 999px;
  transition: width 0.1s linear;
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.6);
}

.progress-subtext {
  font-size: 13px;
  color: var(--muted-strong);
  font-weight: 300;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg-deep: #eef3f8;
  --bg-surface: rgba(255, 255, 255, 0.8);
  --bg-elevated: #ffffff;
  --accent: #0ea5e9;
  --accent-glow: rgba(14, 165, 233, 0.2);
  --accent-soft: rgba(14, 165, 233, 0.08);
  --cyan: #0ea5e9;
  --cyan-grad: linear-gradient(90deg, #38bdf8, #2563eb);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.08);
  --green: #10b981;
  --green-soft: rgba(16, 185, 129, 0.08);
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.14);
  --ink: #142033;
  --muted: #7b8798;
  --muted-strong: #556377;
}

html[data-theme="light"] body {
  background:
    radial-gradient(ellipse at top left, rgba(14, 165, 233, 0.1) 0%, transparent 34%),
    radial-gradient(ellipse at top right, rgba(59, 130, 246, 0.08) 0%, transparent 28%),
    linear-gradient(180deg, #f8fbfd 0%, #edf3f7 100%);
  color: var(--ink);
}

html[data-theme="light"] .header-backdrop-blur {
  background:
    linear-gradient(
      180deg,
      rgba(244, 248, 252, 0.88) 0%,
      rgba(244, 248, 252, 0.74) 54%,
      rgba(244, 248, 252, 0.3) 82%,
      transparent 100%
    );
  backdrop-filter: blur(20px) saturate(118%);
  -webkit-backdrop-filter: blur(20px) saturate(118%);
}

html[data-theme="light"] .workspace-header {
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(26px) saturate(118%);
  -webkit-backdrop-filter: blur(26px) saturate(118%);
  border-color: rgba(148, 163, 184, 0.16);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .workspace-header::before {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(248, 250, 252, 0.54)),
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.08), transparent 42%);
}

html[data-theme="light"] .workspace-header::after {
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.22), rgba(148, 163, 184, 0.08), transparent);
}

html[data-theme="light"] .workspace-brand-mark {
  filter: brightness(0) saturate(100%) opacity(0.92);
}

html[data-theme="light"] .workspace-nav-link,
html[data-theme="light"] .workspace-header-meta,
html[data-theme="light"] .theme-toggle,
html[data-theme="light"] .pill,
html[data-theme="light"] .app-tabs {
  background: rgba(255, 255, 255, 0.68);
  border-color: rgba(148, 163, 184, 0.18);
  color: var(--muted-strong);
}

html[data-theme="light"] .workspace-nav-link:hover,
html[data-theme="light"] .theme-toggle:hover,
html[data-theme="light"] .pill:hover {
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  border-color: rgba(14, 165, 233, 0.18);
}

html[data-theme="light"] .workspace-nav-link.active {
  color: #0b2238;
  background: linear-gradient(135deg, #f3fbff, #d9f3ff);
  border-color: rgba(14, 165, 233, 0.3);
  box-shadow: 0 12px 24px rgba(14, 165, 233, 0.12);
}

html[data-theme="light"] .tab-chip {
  background: rgba(255, 255, 255, 0.52);
  border-color: rgba(148, 163, 184, 0.16);
  color: var(--muted-strong);
}

html[data-theme="light"] .tab-chip:hover {
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  border-color: rgba(14, 165, 233, 0.18);
}

html[data-theme="light"] .tab-chip.active {
  color: #0b2238;
  background: linear-gradient(135deg, #e8f8ff, #d7f0ff);
  box-shadow: 0 10px 22px rgba(14, 165, 233, 0.12);
}

html[data-theme="light"] .theme-toggle-icon {
  background: linear-gradient(135deg, #0f172a, #475569);
  box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] .theme-toggle-icon::after {
  inset: 4px 2px 4px 6px;
  background: rgba(255, 255, 255, 0.74);
}

html[data-theme="light"] .module-strip,
html[data-theme="light"] .global-header,
html[data-theme="light"] .dock-card,
html[data-theme="light"] .canvas-card,
html[data-theme="light"] .dataset-tile,
html[data-theme="light"] .headline-card,
html[data-theme="light"] .metric-card,
html[data-theme="light"] .source-card,
html[data-theme="light"] .preview-cover,
html[data-theme="light"] .deliverable-list article,
html[data-theme="light"] .preview-stat,
html[data-theme="light"] .upload-progress-wrap,
html[data-theme="light"] .table-wrap,
html[data-theme="light"] .store-checklist {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(148, 163, 184, 0.14);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .dock-card:hover,
html[data-theme="light"] .canvas-card:hover,
html[data-theme="light"] .dataset-tile:hover,
html[data-theme="light"] .metric-card:hover {
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .dataset-ribbon > .dataset-tile:nth-child(4) {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(14, 165, 233, 0.08));
  border-color: rgba(14, 165, 233, 0.24);
}

html[data-theme="light"] .topbar-note strong,
html[data-theme="light"] .metric-value,
html[data-theme="light"] .source-name,
html[data-theme="light"] .bar-key strong,
html[data-theme="light"] .bar-views,
html[data-theme="light"] .spotlight-item strong,
html[data-theme="light"] .preview-cover strong,
html[data-theme="light"] .progress-info strong,
html[data-theme="light"] .upload-content strong {
  color: var(--ink);
}

html[data-theme="light"] .source-card {
  color: var(--ink);
}

html[data-theme="light"] .source-card:hover,
html[data-theme="light"] .meta-chip:hover,
html[data-theme="light"] .spotlight-item:hover,
html[data-theme="light"] .deliverable-list article:hover,
html[data-theme="light"] .preview-stat:hover,
html[data-theme="light"] tbody tr:hover,
html[data-theme="light"] .store-option:hover,
html[data-theme="light"] .bar-row:hover {
  background: rgba(148, 163, 184, 0.08);
}

html[data-theme="light"] tbody tr:nth-child(even) {
  background: rgba(226, 232, 240, 0.34);
}

html[data-theme="light"] .meta-chip,
html[data-theme="light"] .spotlight-item,
html[data-theme="light"] .deliverable-list article,
html[data-theme="light"] .preview-stat,
html[data-theme="light"] .store-option,
html[data-theme="light"] .upload-progress-wrap,
html[data-theme="light"] .empty-state {
  background: rgba(248, 250, 252, 0.72);
  border-color: rgba(148, 163, 184, 0.14);
}

html[data-theme="light"] .segmented,
html[data-theme="light"] .store-checklist,
html[data-theme="light"] .table-wrap {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(148, 163, 184, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.92),
    0 20px 46px rgba(148, 163, 184, 0.08);
}

html[data-theme="light"] .store-option span,
html[data-theme="light"] .upload-content span,
html[data-theme="light"] .progress-subtext,
html[data-theme="light"] .preview-cover p:last-child {
  color: var(--muted-strong);
}

html[data-theme="light"] .segmented button,
html[data-theme="light"] .year-chip,
html[data-theme="light"] select,
html[data-theme="light"] .mini-toggle {
  color: #52647e;
  border-color: rgba(203, 213, 225, 0.84);
  background: rgba(248, 250, 252, 0.9);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.92);
}

html[data-theme="light"] .segmented button:hover,
html[data-theme="light"] .year-chip:hover,
html[data-theme="light"] .mini-toggle:hover {
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink);
  border-color: rgba(148, 163, 184, 0.34);
  box-shadow: 0 8px 20px rgba(148, 163, 184, 0.12);
}

html[data-theme="light"] .segmented button.active,
html[data-theme="light"] .year-chip.active,
html[data-theme="light"] .mini-toggle.active {
  background: linear-gradient(135deg, #e7f8ff 0%, #c8efff 46%, #a8e8ff 100%);
  color: #0b2238;
  border-color: rgba(14, 165, 233, 0.22);
  box-shadow:
    0 14px 30px rgba(14, 165, 233, 0.16),
    inset 0 1px 0 rgba(255,255,255,0.95);
}

html[data-theme="light"] select {
  border-color: rgba(148, 163, 184, 0.18);
  background:
    rgba(255, 255, 255, 0.9)
    url('data:image/svg+xml;utf8,<svg fill="none" height="24" stroke="%2364748b" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><polyline points="6 9 12 15 18 9"/></svg>')
    no-repeat right 16px center;
  background-size: 16px;
  color: var(--ink);
}

html[data-theme="light"] select:hover,
html[data-theme="light"] select:focus {
  border-color: rgba(14, 165, 233, 0.22);
  background-color: rgba(255, 255, 255, 0.98);
}

html[data-theme="light"] select option {
  background: #ffffff;
  color: var(--ink);
}

html[data-theme="light"] thead tr {
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted-strong);
}

html[data-theme="light"] th,
html[data-theme="light"] td {
  border-bottom-color: rgba(148, 163, 184, 0.12);
}

html[data-theme="light"] .table-wrap thead th:first-child {
  background: rgba(230, 238, 246, 0.95);
  box-shadow: 1px 0 0 rgba(148, 163, 184, 0.14);
}

html[data-theme="light"] .table-wrap tbody td:first-child {
  background: rgba(246, 250, 253, 0.98);
  box-shadow: 1px 0 0 rgba(148, 163, 184, 0.14);
}

html[data-theme="light"] .table-wrap tbody tr:nth-child(even) td:first-child {
  background: rgba(237, 243, 248, 0.98);
}

html[data-theme="light"] .bar-track,
html[data-theme="light"] .progress-bar {
  background: rgba(148, 163, 184, 0.16);
}

html[data-theme="light"] .info-panel {
  background: rgba(14, 165, 233, 0.05);
  border-color: rgba(14, 165, 233, 0.18);
}

html[data-theme="light"] .upload-zone {
  background: rgba(255, 255, 255, 0.68);
  border-color: rgba(14, 165, 233, 0.18);
}

html[data-theme="light"] .upload-zone:hover,
html[data-theme="light"] .upload-zone.dragover {
  background: rgba(14, 165, 233, 0.08);
  box-shadow: 0 0 28px rgba(14, 165, 233, 0.12);
}

html[data-theme="light"] .preview-cover {
  background:
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.12), transparent 52%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(244, 248, 252, 0.9));
}

html[data-theme="light"] .preview-cover::after {
  background: linear-gradient(90deg, transparent, rgba(14, 165, 233, 0.08), transparent);
}

html[data-theme="light"] .action.ghost {
  background: rgba(255, 255, 255, 0.74);
  border-color: rgba(148, 163, 184, 0.16);
  color: var(--ink);
}

html[data-theme="light"] .action.ghost:hover {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(14, 165, 233, 0.22);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .action.subtle {
  border-color: rgba(148, 163, 184, 0.22);
  color: var(--muted-strong);
}

html[data-theme="light"] .action.subtle:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(14, 165, 233, 0.2);
}

/* Base fade-in sequence */
.workspace > * {
  animation: fadeUp 0.8s cubic-bezier(0.19, 1, 0.22, 1) backwards;
}
.control-rail { animation-delay: 0.1s; }
.canvas { animation-delay: 0.2s; }
.metric-grid { animation-delay: 0.3s; }
.visual-grid { animation-delay: 0.4s; }
.detail-grid { animation-delay: 0.5s; }

/* Responsive Adjustments */
@media (max-width: 1280px) {
  .royalty-shell { grid-template-columns: 1fr; }
  .workspace-header {
    position: fixed;
    top: 12px;
    left: 50%;
    width: min(var(--shell-max-width), calc(100vw - (var(--shell-gutter) * 2)));
    flex-direction: column;
    align-items: stretch;
    grid-template-columns: 1fr;
    transform: translateX(-50%) translateZ(0);
  }
  .workspace-header-nav {
    justify-content: flex-start;
  }
  .workspace-header-meta {
    width: fit-content;
  }
  .global-header,
  .module-strip {
    flex-direction: column;
    align-items: stretch;
  }
  .global-header-actions,
  .header-action-row {
    justify-items: start;
    justify-content: flex-start;
  }
  .workspace { grid-template-columns: 1fr; }
  .control-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
  .topbar { flex-direction: column; }
  .topbar-actions { width: 100%; grid-template-columns: repeat(auto-fit, minmax(180px, max-content)); justify-content: start; align-items: center; }
}

@media (max-width: 1080px) {
  .dataset-ribbon, .control-rail, .metric-grid, .visual-grid, .detail-grid, .archive-grid, .preview-stats { grid-template-columns: 1fr; }
  .headline-card { flex-direction: column; }
  .pill-wrap { justify-content: flex-start; }
}

@media (max-width: 760px) {
  .royalty-shell {
    width: calc(100% - 24px);
    padding: 96px 0 calc(112px + var(--safe-bottom));
  }
  .dashboard-main {
    padding-inline: 0;
  }
  .header-backdrop-blur {
    height: 104px;
  }
  .workspace-header {
    top: 8px;
    left: 50%;
    width: calc(100vw - 24px);
    padding: 12px 14px;
    border-radius: 20px;
    transform: translateX(-50%) translateZ(0);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .workspace-brand-mark {
    width: min(132px, 100%);
  }
  .workspace-header-nav {
    display: none;
  }
  .workspace-header-tools {
    width: auto;
    flex: 0 1 auto;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    min-width: 0;
  }
  .workspace-nav-link {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 14px;
  }

  .global-header, .module-strip, .dock-card, .canvas-card, .headline-card { padding: 22px; border-radius: 20px; }
  .brand-lockup { flex-direction: column; align-items: start; }
  .brand-mark { width: min(100%, 280px); max-width: 100%; }
  .dataset-tile { padding: 18px; }
  .app-tabs { padding: 10px; gap: 10px; }
  .tab-chip { width: 100%; justify-content: center; min-height: 44px; }
  .segmented { gap: 10px; }
  .segmented button { flex-basis: 100%; min-height: 44px; }
  .bar-row { grid-template-columns: 1fr; }
  .bar-value { text-align: left; }
  .global-header-actions,
  .topbar-actions {
    width: 100%;
    justify-items: start;
  }
  .header-action-row {
    width: 100%;
    justify-content: stretch;
  }
  .header-action-row > * {
    flex: 1 1 100%;
    min-width: 0;
  }
  .topbar-note {
    justify-items: start;
  }

  /* Disable hover transforms on mobile */
  .headline-card:hover,
  .canvas-card:hover,
  .metric-card:hover,
  .topbar:hover {
    transform: none;
  }

  /* Source meta compact */
  .source-meta {
    grid-template-columns: 1fr;
  }

  .source-meta .meta-chip:last-child {
    grid-column: auto;
  }

  .mobile-module-dock {
    position: fixed;
    left: 50%;
    bottom: calc(12px + var(--safe-bottom));
    z-index: 70;
    width: calc(100vw - 24px);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    border-radius: 22px;
    border: 1px solid rgba(196, 210, 223, 0.18);
    background: rgba(245, 249, 252, 0.88);
    backdrop-filter: blur(28px) saturate(132%);
    -webkit-backdrop-filter: blur(28px) saturate(132%);
    box-shadow: 0 20px 42px rgba(15, 23, 42, 0.12);
    transform: translateX(-50%);
  }

  html[data-theme="dark"] .mobile-module-dock {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(14, 16, 20, 0.84);
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.34);
  }

  .mobile-dock-link {
    min-width: 0;
    min-height: 60px;
    padding: 8px 6px;
    border-radius: 16px;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 4px;
    color: #607089;
    border: 1px solid rgba(196, 210, 223, 0.34);
    background: rgba(255, 255, 255, 0.82);
    transition: background 0.24s ease, border-color 0.24s ease, color 0.24s ease;
  }

  html[data-theme="dark"] .mobile-dock-link {
    color: var(--muted-strong);
    border-color: rgba(255, 255, 255, 0.04);
    background: rgba(255, 255, 255, 0.02);
  }

  .mobile-dock-link.active {
    color: #071823;
    background: linear-gradient(135deg, #dff7ff 0%, #b9eeff 48%, #8be6ff 100%);
    border-color: rgba(64, 220, 255, 0.38);
    box-shadow: 0 10px 24px rgba(0, 209, 255, 0.14);
  }

  .mobile-dock-icon {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    background: rgba(10, 18, 30, 0.08);
  }

  html[data-theme="dark"] .mobile-dock-icon {
    background: rgba(255, 255, 255, 0.05);
  }

  .mobile-dock-link.active .mobile-dock-icon {
    background: rgba(7, 24, 35, 0.12);
  }

  .mobile-dock-link span:last-child {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
  }
}

@media (max-width: 560px) {
  .royalty-shell {
    width: calc(100% - 16px);
    padding-top: 88px;
    padding-bottom: calc(108px + var(--safe-bottom));
    gap: 16px;
  }

  .header-backdrop-blur {
    height: 96px;
  }

  .workspace-header {
    top: 8px;
    width: calc(100vw - 16px);
    padding: 12px calc(14px + var(--safe-right)) 12px calc(14px + var(--safe-left));
    gap: 12px;
    border-radius: 18px;
  }

  .workspace-brand-mark {
    width: 100px;
  }

  .theme-toggle {
    margin-left: auto;
  }

  .mobile-module-dock {
    width: calc(100vw - 16px);
    gap: 6px;
    padding: 8px;
    border-radius: 20px;
  }

  .mobile-dock-link {
    min-height: 56px;
    padding: 8px 4px;
    border-radius: 14px;
  }

  .mobile-dock-icon {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }

  .mobile-dock-link span:last-child {
    font-size: 10px;
  }

  .global-header,
  .module-strip,
  .dock-card,
  .canvas-card,
  .headline-card,
  .metric-card,
  .dataset-tile {
    padding: 16px;
    border-radius: 16px;
  }

  .global-header-copy h1,
  .headline-card h2 {
    font-size: clamp(26px, 8vw, 36px);
  }

  .subcopy,
  .headline-copy {
    font-size: 14px;
    line-height: 1.55;
  }

  .metric-value {
    font-size: clamp(20px, 8vw, 28px);
  }

  .source-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .source-meta {
    grid-template-columns: 1fr;
  }

  .source-meta .meta-chip:last-child {
    grid-column: auto;
  }

  .meta-chip {
    padding: 12px;
  }

  .meta-chip strong {
    font-size: clamp(14px, 4vw, 18px);
  }

  .year-chip-grid,
  .store-filter-tools {
    display: grid;
    grid-template-columns: 1fr;
  }

  .year-chip,
  .mini-toggle,
  .action {
    width: 100%;
    min-height: 44px;
  }

  .action {
    min-width: 0;
  }

  .pill {
    min-height: 36px;
    padding: 0 12px;
    font-size: 12px;
  }

  /* Theme toggle compact */
  #themeToggleLabel {
    display: none;
  }

  .theme-toggle {
    padding: 0 12px;
    min-width: 44px;
    min-height: 44px;
  }

  .canvas-card {
    min-height: 0;
  }

  .chart-shell {
    min-height: 200px;
  }
}
