/* Premium multi-page workspace — layered over the original functional styles. */
:root {
  --premium-bg: #f4f5f9;
  --premium-surface: #ffffff;
  --premium-surface-soft: #f8f8fc;
  --premium-sidebar: #11131a;
  --premium-sidebar-soft: #1a1d27;
  --premium-text: #171821;
  --premium-muted: #6c7080;
  --premium-line: #e5e7ef;
  --premium-line-strong: #d7d9e5;
  --premium-purple: #6d5dfc;
  --premium-purple-strong: #5846ef;
  --premium-purple-soft: #efedff;
  --premium-blue: #4676ff;
  --premium-green: #18a874;
  --premium-orange: #ef8d3c;
  --premium-danger: #d9485f;
  --premium-shadow-xs: 0 1px 2px rgba(22, 24, 35, .04);
  --premium-shadow-sm: 0 8px 24px rgba(31, 35, 56, .055);
  --premium-shadow-md: 0 20px 55px rgba(31, 35, 56, .085);
  --premium-radius-sm: 10px;
  --premium-radius: 16px;
  --premium-radius-lg: 24px;
  --premium-sidebar-width: 248px;
}

body.dark {
  --premium-bg: #0f1117;
  --premium-surface: #171a22;
  --premium-surface-soft: #1d2029;
  --premium-sidebar: #0a0c11;
  --premium-sidebar-soft: #151821;
  --premium-text: #f6f7fb;
  --premium-muted: #a5a9b7;
  --premium-line: #2b2f3b;
  --premium-line-strong: #3a3f4d;
  --premium-purple-soft: #282442;
  --premium-shadow-xs: 0 1px 2px rgba(0, 0, 0, .2);
  --premium-shadow-sm: 0 8px 24px rgba(0, 0, 0, .22);
  --premium-shadow-md: 0 20px 55px rgba(0, 0, 0, .35);
}

* { scrollbar-width: thin; scrollbar-color: #b8bccb transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #bec2cf; border: 3px solid transparent; border-radius: 999px; background-clip: padding-box; }

html { scroll-padding-top: 112px; }
body {
  min-width: 320px;
  color: var(--premium-text);
  background: var(--premium-bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -.005em;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(circle at 78% -20%, rgba(109, 93, 252, .09), transparent 32rem),
    radial-gradient(circle at 5% 100%, rgba(70, 118, 255, .055), transparent 28rem);
}
svg { display: block; width: 1.2em; height: 1.2em; fill: currentColor; }
.app-page-hidden { display: none !important; }

.shell {
  width: auto;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 20px 26px 48px calc(var(--premium-sidebar-width) + 28px);
}

/* Sidebar */
.section-nav::before,
.section-nav::after,
.app-header::after { display: none !important; content: none !important; }

.section-nav {
  position: fixed;
  inset: 14px auto 14px 14px;
  z-index: 100;
  display: flex;
  width: var(--premium-sidebar-width);
  margin: 0;
  padding: 14px 12px;
  overflow: hidden auto;
  flex-direction: column;
  gap: 5px;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 21px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.035), transparent 22%),
    var(--premium-sidebar);
  box-shadow: 0 24px 60px rgba(12, 13, 19, .22);
  backdrop-filter: none;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 8px 18px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 11px;
}
.sidebar-brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #7e6dff 0%, #5168ff 52%, #2ea7ff 100%);
  box-shadow: 0 9px 22px rgba(91, 83, 255, .38), inset 0 1px 0 rgba(255,255,255,.34);
  font-size: 1.1rem;
  font-weight: 950;
}
.sidebar-brand strong,
.sidebar-brand span { display: block; }
.sidebar-brand strong { font-size: .95rem; letter-spacing: -.02em; }
.sidebar-brand span { margin-top: 1px; color: rgba(255,255,255,.52); font-size: .69rem; }
.sidebar-group-label {
  padding: 8px 10px 6px;
  color: rgba(255,255,255,.38);
  font-size: .64rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.section-nav .nav-item {
  display: grid;
  grid-template-columns: 36px minmax(0,1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 8px 10px;
  color: rgba(255,255,255,.67);
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  text-align: left;
  transform: none;
}
.section-nav .nav-item:hover:not(:disabled) {
  color: #fff;
  background: rgba(255,255,255,.055);
  border-color: rgba(255,255,255,.04);
  box-shadow: none;
  transform: none;
}
.section-nav .nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(118, 99, 255, .32), rgba(75, 100, 255, .18));
  border-color: rgba(150, 137, 255, .22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 10px 22px rgba(61, 49, 156, .16);
}
.nav-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: rgba(255,255,255,.58);
  background: rgba(255,255,255,.055);
}
.nav-item.active .nav-icon {
  color: #fff;
  background: linear-gradient(145deg, #7665ff, #5368ff);
  box-shadow: 0 8px 16px rgba(82, 72, 231, .28);
}
.nav-item > span:last-child,
.nav-item strong,
.nav-item small { display: block; min-width: 0; }
.nav-item strong { font-size: .82rem; font-weight: 790; letter-spacing: -.01em; }
.nav-item small { margin-top: 2px; color: rgba(255,255,255,.38); font-size: .66rem; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nav-item.active small { color: rgba(255,255,255,.58); }
.sidebar-spacer { flex: 1 1 auto; min-height: 22px; }
.sidebar-system-card {
  padding: 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 13px;
  background: rgba(255,255,255,.035);
  color: rgba(255,255,255,.5);
  font-size: .67rem;
}
.system-card-top { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; color: #fff; }
.system-card-top strong { font-size: .74rem; }
.status-dot.online { box-shadow: 0 0 0 4px rgba(51, 211, 151, .12); }

/* Top bar */
.app-header {
  position: sticky;
  top: 12px;
  z-index: 70;
  display: flex;
  align-items: center;
  min-height: 80px;
  margin: 0 0 22px;
  padding: 13px 16px;
  border: 1px solid color-mix(in srgb, var(--premium-line) 88%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--premium-surface) 91%, transparent);
  box-shadow: var(--premium-shadow-sm);
  backdrop-filter: blur(20px) saturate(1.35);
}
.header-leading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mobile-nav-toggle { display: none; width: 40px; height: 40px; padding: 0; place-items: center; }
.brand-block { align-items: center; gap: 12px; }
.brand-mark {
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  border-radius: 13px;
  background: linear-gradient(145deg, #7665ff 0%, #5368ff 60%, #33a6ff 100%);
  box-shadow: 0 10px 22px rgba(90, 77, 235, .25), inset 0 1px 0 rgba(255,255,255,.3);
  font-size: .78rem;
}
.eyebrow, .section-kicker {
  color: var(--premium-purple);
  font-size: .64rem;
  font-weight: 900;
  letter-spacing: .15em;
}
.app-header h1 { margin: 1px 0 2px; font-size: clamp(1.2rem, 2vw, 1.58rem); line-height: 1.1; letter-spacing: -.035em; }
.app-header p { max-width: 700px; color: var(--premium-muted); font-size: .76rem; line-height: 1.38; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-tools { display: flex; align-items: center; justify-items: initial; gap: 10px; margin-left: auto; }
.topbar-health {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 130px;
  padding: 7px 11px;
  border: 1px solid var(--premium-line);
  border-radius: 11px;
  background: var(--premium-surface-soft);
}
.topbar-health > span:last-child,
.topbar-health strong,
.topbar-health small { display: block; }
.topbar-health strong { font-size: .71rem; }
.topbar-health small { color: var(--premium-muted); font-size: .62rem; }
.header-actions { flex-wrap: nowrap; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; }
.subtle-danger { color: var(--premium-danger); background: rgba(217, 72, 95, .08); border: 1px solid rgba(217,72,95,.18); box-shadow: none; }

/* Dashboard */
.dashboard-home { display: grid; gap: 16px; }
.dashboard-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr);
  min-height: 310px;
  overflow: hidden;
  border: 1px solid rgba(114, 94, 255, .16);
  border-radius: 26px;
  background:
    radial-gradient(circle at 88% 18%, rgba(110, 94, 255, .27), transparent 22rem),
    radial-gradient(circle at 62% 110%, rgba(51, 165, 255, .18), transparent 24rem),
    linear-gradient(130deg, #151724 0%, #222138 47%, #302a62 100%);
  box-shadow: 0 30px 70px rgba(36, 31, 86, .22);
  color: #fff;
}
.dashboard-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(90deg, transparent, #000 60%);
}
.dashboard-hero-copy { position: relative; z-index: 2; align-self: center; padding: 46px 18px 46px 48px; }
.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.78);
  font-size: .69rem;
  font-weight: 750;
  backdrop-filter: blur(10px);
}
.dashboard-hero h2 { max-width: 720px; margin: 18px 0 13px; font-size: clamp(2rem, 4vw, 3.6rem); line-height: .99; letter-spacing: -.062em; }
.dashboard-hero p { max-width: 650px; margin: 0; color: rgba(255,255,255,.66); font-size: .94rem; line-height: 1.65; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 25px; }
.hero-actions button { min-height: 43px; border-radius: 12px; background: #fff; color: #1d1a32; box-shadow: 0 12px 28px rgba(0,0,0,.16); }
.hero-actions button:hover:not(:disabled) { box-shadow: 0 14px 32px rgba(0,0,0,.2); }
.hero-actions .hero-secondary { color: #fff; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.14); box-shadow: none; }
.dashboard-visual { position: relative; z-index: 1; min-height: 310px; }
.visual-orbit { position: absolute; border: 1px solid rgba(255,255,255,.11); border-radius: 50%; }
.orbit-one { width: 280px; height: 280px; top: 15px; right: 32px; }
.orbit-two { width: 188px; height: 188px; top: 61px; right: 78px; border-style: dashed; }
.visual-center {
  position: absolute;
  top: 111px;
  right: 129px;
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border: 1px solid rgba(255,255,255,.19);
  border-radius: 26px;
  background: linear-gradient(145deg, rgba(130,112,255,.92), rgba(69,112,255,.86));
  box-shadow: 0 24px 60px rgba(53, 43, 159, .44), inset 0 1px 0 rgba(255,255,255,.28);
}
.visual-center span { font-size: 1.5rem; font-weight: 950; letter-spacing: -.04em; }
.visual-center small { margin-top: -19px; color: rgba(255,255,255,.7); font-size: .58rem; }
.visual-card {
  position: absolute;
  display: grid;
  min-width: 100px;
  padding: 11px 13px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 13px;
  background: rgba(15,17,29,.62);
  box-shadow: 0 15px 34px rgba(0,0,0,.2);
  backdrop-filter: blur(15px);
}
.visual-card strong { font-size: 1rem; }
.visual-card span { color: rgba(255,255,255,.52); font-size: .64rem; }
.visual-card-one { top: 45px; right: 10px; }
.visual-card-two { bottom: 34px; right: 27px; }
.visual-card-three { bottom: 48px; left: 6px; }
.dashboard-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.dashboard-kpi {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--premium-line);
  border-radius: 16px;
  background: var(--premium-surface);
  box-shadow: var(--premium-shadow-xs);
}
.kpi-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px; }
.kpi-icon svg { width: 19px; height: 19px; }
.kpi-icon.purple { color: #6b58f4; background: #f0edff; }
.kpi-icon.blue { color: #3572ef; background: #eaf1ff; }
.kpi-icon.green { color: #139369; background: #e8f8f1; }
.kpi-icon.orange { color: #d8762a; background: #fff1e5; }
body.dark .kpi-icon.purple { background: #2b2743; }
body.dark .kpi-icon.blue { background: #1c2b45; }
body.dark .kpi-icon.green { background: #18362c; }
body.dark .kpi-icon.orange { background: #3c2b1e; }
.dashboard-kpi > div:last-child,
.dashboard-kpi span,
.dashboard-kpi strong,
.dashboard-kpi small { display: block; min-width: 0; }
.dashboard-kpi span { color: var(--premium-muted); font-size: .64rem; font-weight: 760; text-transform: uppercase; letter-spacing: .055em; }
.dashboard-kpi strong { margin: 3px 0 1px; font-size: .87rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dashboard-kpi small { color: var(--premium-muted); font-size: .67rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dashboard-launch-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.launch-card {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 13px;
  min-height: 88px;
  padding: 16px;
  color: var(--premium-text);
  border: 1px solid var(--premium-line);
  border-radius: 17px;
  background: var(--premium-surface);
  box-shadow: var(--premium-shadow-xs);
  text-align: left;
}
.launch-card:hover:not(:disabled) { border-color: rgba(109,93,252,.35); box-shadow: var(--premium-shadow-sm); transform: translateY(-2px); }
.launch-number { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: var(--premium-purple); background: var(--premium-purple-soft); font-size: .68rem; font-weight: 900; }
.launch-card span:nth-child(2), .launch-card strong, .launch-card small { display: block; min-width: 0; }
.launch-card strong { font-size: .88rem; }
.launch-card small { margin-top: 4px; color: var(--premium-muted); font-size: .72rem; }
.launch-arrow { color: var(--premium-muted); font-size: 1.35rem; transition: transform .16s ease, color .16s ease; }
.launch-card:hover .launch-arrow { color: var(--premium-purple); transform: translateX(3px); }

.dashboard-status-bar {
  display: grid;
  grid-template-columns: repeat(5,minmax(0,1fr));
  gap: 0;
  margin: 16px 0 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--premium-line);
  border-radius: 16px;
  background: var(--premium-surface);
  box-shadow: var(--premium-shadow-xs);
}
.dashboard-status-bar > div { padding: 15px 17px; border-right: 1px solid var(--premium-line); }
.dashboard-status-bar > div:last-child { border-right: 0; }
.dashboard-status-bar strong { font-size: .8rem; }
.dashboard-status-bar small { margin-top: 3px; color: var(--premium-muted); font-size: .66rem; }
.overview-strip { grid-template-columns: repeat(6,minmax(0,1fr)); gap: 10px; margin: 13px 0; }
.overview-card { padding: 13px; border-color: var(--premium-line); border-radius: 14px; background: var(--premium-surface); box-shadow: var(--premium-shadow-xs); }
.overview-card.accent { border-color: rgba(109,93,252,.2); background: linear-gradient(145deg, var(--premium-purple-soft), var(--premium-surface)); }
.overview-icon { background: linear-gradient(145deg, #7969ff, #4f6cff); box-shadow: 0 7px 16px rgba(93,80,235,.22); }
.workflow { grid-template-columns: repeat(8,minmax(0,1fr)); gap: 7px; margin: 0 0 18px; }
.workflow-step { min-height: 44px; border-color: var(--premium-line); border-radius: 12px; background: var(--premium-surface); box-shadow: var(--premium-shadow-xs); }
.workflow-step.done { color: #16835d; background: #eaf8f2; }
body.dark .workflow-step.done { background: #183429; }

/* Page layout */
.layout { display: block; width: 100%; }
.layout > main { width: 100%; min-width: 0; }
.layout > aside { display: none; }
.workspace-section-heading {
  grid-template-columns: auto minmax(0,1fr);
  gap: 16px;
  margin: 4px 0 16px;
  padding: 4px 2px 0;
}
.workspace-section-heading .section-kicker {
  min-width: 84px;
  padding: 6px 9px;
  border: 1px solid rgba(109,93,252,.14);
  border-radius: 999px;
  background: var(--premium-purple-soft);
  text-align: center;
}
.workspace-section-heading h2 { font-size: 1.24rem; letter-spacing: -.03em; }
.workspace-section-heading p { max-width: 900px; color: var(--premium-muted); font-size: .82rem; }

.card {
  margin-bottom: 16px;
  padding: 22px;
  border: 1px solid var(--premium-line);
  border-radius: var(--premium-radius-lg);
  background: var(--premium-surface);
  box-shadow: var(--premium-shadow-sm);
  backdrop-filter: none;
}
.workspace-card { overflow: visible; }
.workspace-card::before { display: none; }
.card h2 { color: var(--premium-text); font-size: 1.1rem; letter-spacing: -.02em; }
.card h3 { color: var(--premium-text); }
.step-number {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  color: #fff;
  background: linear-gradient(145deg, #7766ff, #5268ff);
  box-shadow: 0 8px 18px rgba(91, 77, 235, .22);
}
.help, .muted { color: var(--premium-muted); }
.help { font-size: .78rem; line-height: 1.55; }

/* Controls */
button {
  min-height: 39px;
  padding: 9px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--premium-purple), var(--premium-purple-strong));
  box-shadow: 0 7px 18px rgba(93, 75, 237, .18);
  font-size: .76rem;
  font-weight: 790;
  letter-spacing: -.005em;
}
button:hover:not(:disabled) { box-shadow: 0 10px 22px rgba(93,75,237,.24); transform: translateY(-1px); }
button.secondary { color: var(--premium-purple); background: var(--premium-purple-soft); border-color: rgba(109,93,252,.14); }
button.ghost { color: var(--premium-text); background: var(--premium-surface); border-color: var(--premium-line); }
button.danger { background: var(--premium-danger); }
.actions { gap: 8px; }
.field { margin-bottom: 14px; }
.field label { margin-bottom: 6px; color: var(--premium-text); font-size: .72rem; font-weight: 790; letter-spacing: .005em; }
input, textarea, select {
  min-height: 42px;
  color: var(--premium-text);
  border: 1px solid var(--premium-line-strong);
  border-radius: 11px;
  background: var(--premium-surface);
  box-shadow: inset 0 1px 2px rgba(18,20,31,.02);
  font-size: .78rem;
}
textarea { min-height: 112px; padding: 12px 13px; line-height: 1.55; resize: vertical; }
input, select { padding: 9px 11px; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--premium-muted) 70%, transparent); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: rgba(109,93,252,.58);
  box-shadow: 0 0 0 4px rgba(109,93,252,.11);
}
input[type="checkbox"], input[type="radio"] { min-height: auto; accent-color: var(--premium-purple); }
.two, .three, .automation-grid { gap: 13px; }
.toolbar { gap: 9px; padding: 10px; border: 1px solid var(--premium-line); border-radius: 14px; background: var(--premium-surface-soft); }
.toggle-grid label, .cloud-checklist label {
  min-height: 44px;
  padding: 10px 12px;
  color: var(--premium-text);
  border: 1px solid var(--premium-line);
  border-radius: 11px;
  background: var(--premium-surface-soft);
  font-size: .73rem;
}

/* Statuses, notices, pills */
.status, .notice {
  padding: 11px 13px;
  border: 1px solid var(--premium-line);
  border-radius: 11px;
  background: var(--premium-surface-soft);
  color: var(--premium-muted);
  font-size: .73rem;
  line-height: 1.45;
}
.status.good, .good-summary { color: #127451; background: #eaf8f2; border-color: #ccecdf; }
.status.warn { color: #8c5c0d; background: #fff7e8; border-color: #f2dfb7; }
.status.bad { color: #ad3046; background: #fff0f3; border-color: #f4cad3; }
body.dark .status.good, body.dark .good-summary { color: #78dab2; background: #17342a; border-color: #28513f; }
body.dark .status.warn { color: #f0c675; background: #3a301c; border-color: #574726; }
body.dark .status.bad { color: #ff9eae; background: #3e2028; border-color: #60303c; }
.pill, .model-badge {
  color: var(--premium-purple);
  border-color: rgba(109,93,252,.14);
  background: var(--premium-purple-soft);
  font-size: .66rem;
}

/* Upload and selection surfaces */
.csv-drop-grid, .reference-upload-grid { gap: 12px; }
.csv-drop-card, .reference-drop-card, .digital-file-drop-card {
  min-height: 112px;
  padding: 17px;
  border: 1.5px dashed color-mix(in srgb, var(--premium-purple) 35%, var(--premium-line));
  border-radius: 15px;
  background: linear-gradient(145deg, var(--premium-surface-soft), var(--premium-surface));
}
.csv-drop-card:hover, .reference-drop-card:hover, .digital-file-drop-card:hover {
  border-color: var(--premium-purple);
  background: var(--premium-purple-soft);
  transform: translateY(-1px);
}
.csv-drop-number, .reference-drop-icon {
  color: #fff;
  background: linear-gradient(145deg, #7968ff, #5369ff);
  box-shadow: 0 8px 18px rgba(92, 79, 235, .2);
}
.workflow-choice-panel, .reference-examples-panel, .approval-panel, .subpanel, .deployment-panel {
  padding: 17px;
  border: 1px solid var(--premium-line);
  border-radius: 16px;
  background: var(--premium-surface-soft);
}
.listing-type-grid { gap: 12px; }
.listing-type-card {
  padding: 16px;
  border: 1px solid var(--premium-line);
  border-radius: 15px;
  background: var(--premium-surface);
  box-shadow: var(--premium-shadow-xs);
}
.listing-type-card:hover { border-color: rgba(109,93,252,.36); box-shadow: var(--premium-shadow-sm); }
.listing-type-card.selected { border-color: rgba(109,93,252,.55); background: linear-gradient(145deg, var(--premium-purple-soft), var(--premium-surface)); box-shadow: 0 0 0 3px rgba(109,93,252,.07); }
.listing-type-icon { border-radius: 12px; background: var(--premium-purple-soft); color: var(--premium-purple); }

/* Expandable panels */
details {
  margin: 12px 0;
  border: 1px solid var(--premium-line);
  border-radius: 14px;
  background: var(--premium-surface);
  overflow: clip;
}
details > summary {
  position: relative;
  min-height: 47px;
  padding: 14px 43px 14px 15px;
  color: var(--premium-text);
  background: var(--premium-surface-soft);
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 15px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  color: var(--premium-muted);
  background: var(--premium-surface);
  border: 1px solid var(--premium-line);
  transform: translateY(-50%);
}
details[open] > summary::after { content: "−"; color: var(--premium-purple); }
details[open] > summary { border-bottom: 1px solid var(--premium-line); }
details > :not(summary) { margin-left: 15px; margin-right: 15px; }
details > :last-child { margin-bottom: 15px; }
.optional-api-panel, .competitor-research-panel, .etsy-publish-panel, .digital-type-reference { background: var(--premium-surface); }
.optional-api-panel > summary, .competitor-research-panel > summary { background: linear-gradient(90deg, var(--premium-purple-soft), var(--premium-surface-soft)); }
.api-setup-card { border-color: var(--premium-line); border-radius: 14px; background: var(--premium-surface-soft); }
.key-file-block { border-radius: 12px; border-color: var(--premium-line); background: var(--premium-surface); }
.key-file-block pre, pre { color: var(--premium-text); background: var(--premium-surface-soft); }

/* Tables */
.table-wrap {
  border: 1px solid var(--premium-line);
  border-radius: 14px;
  background: var(--premium-surface);
  box-shadow: var(--premium-shadow-xs);
}
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 11px 12px;
  color: var(--premium-muted);
  border-bottom: 1px solid var(--premium-line);
  background: var(--premium-surface-soft);
  font-size: .65rem;
  font-weight: 850;
  letter-spacing: .045em;
  text-transform: uppercase;
}
td { padding: 11px 12px; border-bottom: 1px solid var(--premium-line); font-size: .74rem; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .13s ease; }
tbody tr:hover { background: color-mix(in srgb, var(--premium-purple-soft) 40%, transparent); }
.pager { margin-top: 12px; }
.metrics { gap: 9px; }
.metric { padding: 13px; border: 1px solid var(--premium-line); border-radius: 13px; background: var(--premium-surface-soft); }
.metric strong { color: var(--premium-text); }
.selected-name { font-size: 1.15rem; letter-spacing: -.025em; }

/* Dynamic cards */
.approval-product-card, .batch-product-card, .competitor-research-card, .image-card {
  border-color: var(--premium-line);
  border-radius: 16px;
  background: var(--premium-surface);
  box-shadow: var(--premium-shadow-xs);
}
.approval-product-card:hover, .batch-product-card:hover { border-color: rgba(109,93,252,.25); box-shadow: var(--premium-shadow-sm); }
.approval-product-card.approved { border-color: rgba(24,168,116,.32); box-shadow: 0 0 0 3px rgba(24,168,116,.06); }
.batch-product-header { gap: 12px; }
.batch-meta-grid, .batch-copy-grid { gap: 9px; }
.batch-meta-grid > *, .batch-copy-block, .batch-original-listing, .batch-prompt-block {
  border-color: var(--premium-line);
  border-radius: 12px;
  background: var(--premium-surface-soft);
}
.batch-status-badge { border-radius: 999px; }
.approval-badge, .workflow-type-pill { border-radius: 999px; }
.competitor-research-gallery { gap: 10px; }
.competitor-research-card { overflow: hidden; }
.competitor-research-card img { aspect-ratio: 1 / 1; object-fit: cover; }

/* Image galleries */
.gallery { grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap: 12px; }
.image-card { overflow: hidden; }
.image-card img { background: #f0f1f5; }
.image-meta { padding: 10px; }
.generated-gallery { grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); }
.image-readiness-bar { border-radius: 999px; }
.large-prompt { min-height: 270px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .72rem; }

/* SEO split workspace */
.seo-workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(480px, 1.08fr);
  gap: 16px;
  align-items: start;
}
.seo-workspace-grid > .card { margin-bottom: 0; }
.results-card { position: sticky; top: 110px; max-height: calc(100vh - 128px); overflow: auto; }
.results-heading { align-items: center; }
.output-block {
  padding: 15px;
  border: 1px solid var(--premium-line);
  border-radius: 14px;
  background: var(--premium-surface-soft);
}
.output-block h3 { margin-top: 0; font-size: .76rem; letter-spacing: .035em; }
.copybox {
  border: 1px solid var(--premium-line-strong);
  border-radius: 11px;
  background: var(--premium-surface);
  font-size: .75rem;
  line-height: 1.55;
}
.copybox button { top: 8px; right: 8px; min-height: 30px; padding: 6px 9px; font-size: .64rem; }
.title-option, .backup-tag-row { border-color: var(--premium-line); border-radius: 11px; background: var(--premium-surface); }

/* Deployment */
.deployment-choice { gap: 12px; }
.choice-card { border-color: var(--premium-line); border-radius: 15px; background: var(--premium-surface-soft); }
.choice-card:has(input:checked) { border-color: rgba(109,93,252,.5); background: var(--premium-purple-soft); box-shadow: 0 0 0 3px rgba(109,93,252,.07); }
.command-preview { border-color: var(--premium-line); border-radius: 13px; background: var(--premium-sidebar); }
.command-preview pre { color: #d8d9e4; background: transparent; }

footer {
  margin-top: 28px;
  padding: 18px 4px 4px;
  color: var(--premium-muted);
  border-top: 1px solid var(--premium-line);
  font-size: .68rem;
}

/* Dark theme refinements */
body.dark .app-header { background: color-mix(in srgb, var(--premium-surface) 92%, transparent); }
body.dark input, body.dark textarea, body.dark select { color-scheme: dark; }
body.dark .dashboard-hero { box-shadow: 0 30px 70px rgba(0,0,0,.42); }
body.dark .csv-drop-card, body.dark .reference-drop-card { background: linear-gradient(145deg, var(--premium-surface-soft), var(--premium-surface)); }
body.dark code { background: #11131a; }

/* Responsive */
@media (max-width: 1320px) {
  .dashboard-kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .overview-strip { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .workflow { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .seo-workspace-grid { grid-template-columns: 1fr; }
  .results-card { position: relative; top: auto; max-height: none; }
}

@media (max-width: 1040px) {
  :root { --premium-sidebar-width: 230px; }
  .shell { padding-right: 18px; padding-left: calc(var(--premium-sidebar-width) + 22px); }
  .dashboard-hero { grid-template-columns: 1fr; }
  .dashboard-visual { display: none; }
  .dashboard-hero-copy { padding-right: 42px; }
  .dashboard-status-bar { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .dashboard-status-bar > div { border-bottom: 1px solid var(--premium-line); }
  .dashboard-launch-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .shell { padding: 12px 12px 40px; }
  .section-nav {
    inset: 10px auto 10px 10px;
    width: min(280px, calc(100vw - 36px));
    transform: translateX(calc(-100% - 24px));
    transition: transform .22s ease;
  }
  body.nav-open .section-nav { transform: translateX(0); }
  body.nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(8,10,16,.5);
    backdrop-filter: blur(3px);
  }
  .section-nav { z-index: 110; }
  .app-header { top: 8px; min-height: 72px; margin-bottom: 14px; padding: 10px 11px; }
  .mobile-nav-toggle { display: grid; }
  .brand-mark { display: none; }
  .app-header p { max-width: 48vw; }
  .topbar-health { display: none; }
  .header-actions button:not(.icon-button) { display: none; }
  .dashboard-hero-copy { padding: 34px 26px; }
  .dashboard-hero h2 { font-size: clamp(2rem, 10vw, 3rem); }
  .dashboard-kpi-grid { grid-template-columns: 1fr; }
  .dashboard-status-bar { grid-template-columns: 1fr 1fr; }
  .overview-strip { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .workflow { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .workspace-section-heading { display: block; }
  .workspace-section-heading .section-kicker { display: inline-flex; margin-bottom: 9px; }
  .card { padding: 16px; border-radius: 18px; }
  .two, .three, .automation-grid, .api-setup-grid, .competitor-research-grid { grid-template-columns: 1fr !important; }
  .csv-drop-grid, .listing-type-grid, .reference-upload-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .app-header h1 { font-size: 1.05rem; }
  .app-header p { display: none; }
  .eyebrow { font-size: .56rem; }
  .dashboard-hero { min-height: auto; border-radius: 20px; }
  .dashboard-hero-copy { padding: 28px 21px; }
  .dashboard-hero h2 { font-size: 2rem; }
  .dashboard-hero p { font-size: .82rem; }
  .hero-actions { display: grid; }
  .dashboard-status-bar, .overview-strip, .workflow { grid-template-columns: 1fr; }
  .dashboard-status-bar > div { border-right: 0; }
  .launch-card { grid-template-columns: auto minmax(0,1fr); }
  .launch-arrow { display: none; }
  .card { padding: 14px; }
  .actions { display: grid; grid-template-columns: 1fr; }
  .actions button, .actions a, .actions a button { width: 100%; }
  .header-actions { display: flex; }
  .header-actions .icon-button { width: 38px; }
  .gallery, .generated-gallery { grid-template-columns: 1fr; }
}

/* Ensure top-bar utility buttons remain readable over the light premium header. */
.app-header button.ghost,
.app-header button.secondary {
  color: var(--premium-text);
  background: var(--premium-surface-soft);
  border-color: var(--premium-line);
}
.app-header button.ghost:hover:not(:disabled),
.app-header button.secondary:hover:not(:disabled) {
  color: var(--premium-purple);
  background: var(--premium-purple-soft);
  border-color: rgba(109,93,252,.22);
}
.app-header button.danger.subtle-danger {
  color: var(--premium-danger);
  background: rgba(217,72,95,.08);
  border-color: rgba(217,72,95,.18);
}


/* Keep action buttons visible within the viewport */
.header-actions,
.toolbar,
.actions,
.generation-sheet-heading,
.generation-sheet-heading-actions {
  flex-wrap: wrap;
}

.toolbar,
.actions {
  width: 100%;
  max-width: 100%;
}

.toolbar > *,
.actions > * {
  max-width: 100%;
}

button,
a.button,
.actions button,
.actions a,
.toolbar button,
.toolbar a {
  max-width: 100%;
  white-space: normal;
}

@media (max-width: 1100px) {
  .header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

/* Universal digital-product template builder */
.digital-template-builder,
.reference-instruction-builder {
  min-width: 0;
}

.digital-universal-template {
  min-height: 440px;
  max-height: 68vh;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: .74rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

#globalReferenceNotes {
  min-height: 280px;
  max-height: 55vh;
  resize: vertical;
  line-height: 1.55;
}

.digital-generation-request {
  min-height: 280px;
  max-height: 60vh;
  resize: vertical;
  white-space: pre-wrap;
}

.digital-template-actions,
.digital-template-inline-actions,
.reference-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
  max-width: 100%;
}

.digital-template-actions button,
.digital-template-inline-actions button,
.reference-toolbar-actions button {
  max-width: 100%;
  white-space: normal;
}

.reference-file-toolbar {
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.reference-file-toolbar .status {
  flex: 1 1 300px;
}

.template-summary-note {
  color: var(--premium-muted);
  font-size: .72rem;
}

@media (max-width: 760px) {
  .digital-universal-template {
    min-height: 360px;
  }

  .digital-template-actions,
  .digital-template-inline-actions,
  .reference-toolbar-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .digital-template-actions button,
  .digital-template-inline-actions button,
  .reference-toolbar-actions button {
    width: 100%;
  }
}


.reference-upload-grid.physical-reference-mode {
  grid-template-columns: minmax(0, 1fr);
}

.reference-analysis-summary {
  display: block;
  margin-top: 0.35rem;
  line-height: 1.35;
  color: var(--muted, #667085);
}

#automationDigitalPrompt {
  min-height: 34rem;
  white-space: pre-wrap;
}
