:root {
  color-scheme: light;
  --ink: #241b2b;
  --muted: #706878;
  --line: #e8e0ea;
  --paper: #ffffff;
  --wash: #f7f3f8;
  --purple: #762d87;
  --purple-dark: #562064;
  --orange: #f79018;
  --green: #1f8f63;
  --red: #b73d4d;
  --shadow: 0 18px 48px rgba(54, 31, 63, 0.10);
}

* { box-sizing: border-box; }

html { background: var(--wash); }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 8%, rgba(247, 144, 24, 0.10), transparent 24rem),
    linear-gradient(180deg, #fbf9fc 0, var(--wash) 42rem);
  font: 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }

button { color: inherit; }

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 max(24px, calc((100vw - 1440px) / 2));
  border-bottom: 1px solid rgba(118, 45, 135, 0.12);
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  overflow: hidden;
  background: white;
  box-shadow: 0 8px 24px rgba(118,45,135,.22);
}
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: cover; }

h1, h2, h3, p { margin-top: 0; }
h1 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
h2 { max-width: 780px; margin-bottom: 12px; font-size: clamp(30px, 4vw, 48px); line-height: 1.04; letter-spacing: -.045em; }
h3 { margin: 0; font-size: 18px; letter-spacing: -.015em; }

.eyebrow, .step-label {
  margin: 0;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .16em;
  color: var(--muted);
}

.eyebrow.accent, .step-label { color: var(--purple); }
.privacy-pill { margin-left: auto; padding: 8px 12px; border-radius: 999px; background: #f3edf5; color: var(--purple-dark); font-size: 12px; font-weight: 700; }

.shell { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 44px 0 64px; }

.intro { display: flex; align-items: end; justify-content: space-between; gap: 42px; margin-bottom: 34px; }
.intro > div > p:last-child { max-width: 760px; margin-bottom: 0; color: var(--muted); font-size: 17px; }

.steps { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; white-space: nowrap; }
.steps li { display: flex; align-items: center; gap: 7px; padding: 8px 10px; color: #948b9a; font-size: 12px; font-weight: 750; }
.steps span { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid #d8cedc; border-radius: 50%; }
.steps .active { color: var(--purple); }
.steps .active span { color: white; border-color: var(--purple); background: var(--purple); }

.workspace { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 22px; align-items: start; }
.controls { display: grid; gap: 16px; position: sticky; top: 98px; }
.panel, .stage, .export-panel, .requirements { border: 1px solid var(--line); background: rgba(255,255,255,.96); border-radius: 18px; box-shadow: var(--shadow); }
.panel { padding: 20px; }
.panel-heading, .stage-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.step-label { margin-bottom: 4px; }

.field { display: grid; gap: 6px; margin-top: 14px; }
.field > span:first-child { color: #514957; font-size: 12px; font-weight: 750; }
.field em { margin-left: 5px; color: #99909f; font-style: normal; font-weight: 500; }
.field input, .field select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #ded4e1;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(118,45,135,.10); }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.color-control { display: grid; grid-template-columns: 44px 1fr; gap: 8px; }
.color-control input[type="color"] { padding: 4px; cursor: pointer; }

.drop-zone {
  width: 100%;
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  padding: 24px;
  border: 1.5px dashed #c9b8cf;
  border-radius: 14px;
  color: var(--purple);
  background: #fbf8fc;
  cursor: pointer;
  transition: .18s ease;
}
.drop-zone:hover, .drop-zone.dragover { transform: translateY(-1px); border-color: var(--purple); background: #f8f0fa; }
.drop-zone span { color: var(--muted); }
.drop-zone small { margin-top: 10px; color: #9a919f; }
.upload-icon { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 7px; border-radius: 13px; color: white !important; background: var(--purple); font-size: 22px; }
.sample-button { width: 100%; margin-top: 9px; padding: 7px; border: 0; color: var(--purple); background: transparent; font-size: 11px; font-weight: 800; cursor: pointer; }
.sample-button:hover { text-decoration: underline; }
.file-summary { display: grid; grid-template-columns: 48px minmax(0,1fr) auto; gap: 12px; align-items: center; }
.file-summary > div:nth-child(2) { min-width: 0; display: grid; }
.file-summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-summary span { color: var(--muted); font-size: 12px; }
.file-icon { width: 46px; height: 52px; display: grid; place-items: center; border-radius: 9px; background: #f4eaf5; color: var(--purple); font-size: 10px; font-weight: 900; }
.text-button { padding: 4px; border: 0; color: var(--purple); background: transparent; font-size: 12px; font-weight: 800; cursor: pointer; }
.progress { height: 5px; margin-top: 14px; overflow: hidden; border-radius: 99px; background: #eee7f0; }
.progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--purple), var(--orange)); transition: width .2s; }

.guidance { display: grid; grid-template-columns: 32px 1fr; gap: 10px; background: #fffaf3; border-color: #f2dfc2; box-shadow: none; }
.guidance p { margin: 4px 0 0; color: #746a5b; font-size: 12px; }
.guidance-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--orange); font-weight: 850; }

.cta-panel { border-color: #dac8df; background: linear-gradient(180deg, #fff 0, #fcf8fd 100%); }
.beta-pill { padding: 4px 7px; border-radius: 999px; color: var(--purple); background: #f2e6f5; font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.cta-intro { margin: -7px 0 14px; color: var(--muted); font-size: 11px; }
.cta-list { display: grid; gap: 9px; }
.candidate-card { padding: 12px; border: 1px solid #e4d9e7; border-radius: 12px; background: #fff; }
.candidate-preview { display: block; width: 100%; max-height: 92px; margin-bottom: 8px; object-fit: cover; object-position: center; border: 1px solid #dfe5ea; border-radius: 8px; background: #f5f7f8; }
.candidate-topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.candidate-kind { padding: 3px 7px; border-radius: 999px; color: white; background: var(--purple); font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.candidate-kind.email { background: #315f8a; }
.candidate-kind.url, .candidate-kind.pdf-link { background: var(--green); }
.candidate-kind.visual-cta { background: #d96b28; }
.candidate-confidence { color: #918797; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.candidate-label { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 12px; line-height: 1.35; }
.candidate-destination-wrap { margin-top: 9px !important; }
.candidate-destination-wrap input { height: 34px !important; font-size: 11px; }
.suggestion-button { width: 100%; margin-top: 2px; padding: 8px 10px; color: var(--purple); border: 1px solid #d9c8de; background: #f8f0fa; font-size: 11px; }
.suggestion-button.applied { color: var(--green); border-color: #b8dbc9; background: #effaf4; }

.stage { min-height: 720px; overflow: hidden; }
.stage-toolbar { margin: 0; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.toolbar-actions { display: flex; gap: 8px; }
.button { border: 0; border-radius: 11px; padding: 11px 16px; font-weight: 800; cursor: pointer; transition: .16s ease; }
.button:disabled { opacity: .42; cursor: not-allowed; }
.button:not(:disabled):hover { transform: translateY(-1px); }
.button.ghost { color: var(--purple); background: #f7f1f8; }
.button.secondary { color: var(--purple-dark); border: 1px solid #d9cddd; background: white; }
.button.primary { min-width: 250px; display: grid; color: white; background: linear-gradient(135deg, var(--purple), #923c91); box-shadow: 0 10px 24px rgba(118,45,135,.2); }
.button.primary small { margin-top: 2px; opacity: .75; font-size: 10px; font-weight: 600; }

.empty-state { min-height: 640px; display: grid; place-items: center; align-content: center; padding: 50px; text-align: center; color: var(--muted); }
.empty-state h3 { margin-top: 22px; color: var(--ink); }
.empty-state p { max-width: 430px; margin: 8px auto 0; }
.empty-illustration { width: 150px; height: 160px; position: relative; }
.empty-illustration span { position: absolute; width: 110px; height: 142px; border: 1px solid #d9cfdd; border-radius: 13px; background: white; box-shadow: 0 12px 24px rgba(63,39,69,.07); }
.empty-illustration span:nth-child(1) { left: 0; top: 12px; transform: rotate(-7deg); }
.empty-illustration span:nth-child(2) { right: 0; top: 12px; transform: rotate(7deg); }
.empty-illustration span:nth-child(3) { left: 20px; top: 0; background: linear-gradient(#7c3589 0 31%, #f2e8f4 31% 68%, #f49a22 68% 76%, white 76%); }

.slice-workspace { padding: 20px; background: #f8f5f9; }
.slice-header { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.slice-header > div { display: grid; }
.slice-header span { color: var(--muted); font-size: 12px; }
.slice-list { display: grid; gap: 12px; }
.slice-card { display: grid; grid-template-columns: 24px 32px 180px minmax(0,1fr); gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: 0 7px 20px rgba(54,31,63,.05); }
.slice-card.suggested-slice { border-color: #e2a754; box-shadow: 0 0 0 2px rgba(247,144,24,.12), 0 7px 20px rgba(54,31,63,.05); }
.slice-card.dragging { opacity: .45; }
.slice-card.drop-before { border-top: 3px solid var(--orange); }
.slice-card.drop-after { border-bottom: 3px solid var(--orange); }
.drag-handle { color: #ad9fb2; cursor: grab; font-size: 18px; letter-spacing: -5px; }
.slice-number { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--purple); background: #f5edf7; font-size: 11px; font-weight: 900; }
.slice-image { width: 180px; max-height: 180px; object-fit: contain; object-position: top; border: 1px solid #eee7ef; background: #f8f4f9; }
.slice-settings { min-width: 0; }
.field.compact { margin-top: 0; margin-bottom: 8px; }
.field.compact input { height: 36px; }
.slice-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.slice-tools label { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.slice-tools input { width: 64px; height: 30px; padding: 0 7px; border: 1px solid #ddd2e0; border-radius: 8px; }
.mini-button { height: 30px; padding: 0 9px; border: 1px solid #ddd2e0; border-radius: 8px; color: #5b4d61; background: white; font-size: 11px; font-weight: 800; cursor: pointer; }
.mini-button:hover { border-color: var(--purple); color: var(--purple); }
.mini-button.danger:hover { border-color: var(--red); color: var(--red); }
.slice-dimensions { margin: 7px 0 0; color: #9b919f; font-size: 10px; }

.email-preview { padding: 20px; background: #eee8f0; }
.preview-chrome { display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px; border-radius: 14px 14px 0 0; background: #2b2630; color: white; }
.preview-chrome span { width: 9px; height: 9px; border-radius: 50%; background: #6d6470; }
.preview-chrome strong { margin-left: 7px; font-size: 12px; }
.preview-chrome button { margin-left: auto; border: 0; color: white; background: transparent; font-size: 22px; cursor: pointer; }
.preview-meta { display: grid; gap: 3px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: white; }
.preview-meta small { color: var(--muted); font-size: 9px; letter-spacing: .12em; }
.preview-meta strong { font-size: 13px; }
.email-preview iframe { width: 100%; min-height: 660px; border: 0; background: white; }

.export-panel { display: flex; align-items: center; justify-content: space-between; gap: 28px; flex-wrap: wrap; margin-top: 22px; padding: 24px; }
.export-panel > div:first-child { max-width: 630px; }
.export-panel p:not(.step-label) { margin: 7px 0 0; color: var(--muted); }
.export-actions { display: flex; gap: 9px; align-items: stretch; }
.availability { display: inline-flex; align-items: center; gap: 7px; margin-top: 11px; padding: 5px 9px; border-radius: 999px; font-size: 10px; font-weight: 850; }
.availability::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.availability.checking { color: #746a5b; background: #fff6e8; }
.availability.ready { color: var(--green); background: #ebfaf3; }
.availability.unavailable { color: #726879; background: #f2edf3; }
.fallback-export { flex-basis: 100%; display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: -14px; color: var(--muted); font-size: 11px; }
.fallback-export .text-button:disabled { color: #aaa1ad; cursor: not-allowed; }
.requirements { display: flex; gap: 12px; margin-top: 12px; padding: 14px 18px; color: #6e6572; background: rgba(255,255,255,.65); box-shadow: none; font-size: 12px; }
.requirements strong { color: var(--purple-dark); white-space: nowrap; }

.message { margin: 12px 0 0; padding: 10px 12px; border-radius: 9px; font-size: 12px; }
.message.error { color: #8f2938; background: #fff0f2; }
.message.success { flex-basis: 100%; color: #156944; background: #ebfaf3; }
.export-panel > .message { flex-basis: 100%; width: 100%; margin-top: 0; }
[hidden] { display: none !important; }

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 320px minmax(0,1fr); }
  .slice-card { grid-template-columns: 20px 28px 130px minmax(0,1fr); }
  .slice-image { width: 130px; }
  .export-panel { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 820px) {
  .shell { width: min(100% - 24px, 700px); padding-top: 28px; }
  .intro, .export-panel { display: block; }
  .steps { margin-top: 22px; }
  .workspace { grid-template-columns: 1fr; }
  .controls { position: static; }
  .stage-toolbar, .slice-header { align-items: flex-start; flex-direction: column; }
  .slice-card { grid-template-columns: 22px 28px 1fr; align-items: start; }
  .slice-image { grid-column: 3; width: min(100%, 360px); max-height: 240px; }
  .slice-settings { grid-column: 3; }
  .export-actions { margin-top: 20px; flex-direction: column; }
  .fallback-export { align-items: flex-start; flex-direction: column; margin-top: 0; }
  .requirements { flex-direction: column; }
  .privacy-pill { display: none; }
}
