:root {
  --ink: #06100c;
  --muted: #69756f;
  --green: #6558f5;
  --green-dark: #4059df;
  --cyan: #25bfdc;
  --cream: #f6f7f1;
  --line: #dfe4dc;
  --card: rgba(255, 255, 255, 0.82);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(rgba(247, 248, 243, .92), rgba(247, 248, 243, .96)),
    radial-gradient(circle at 1px 1px, #bcc4bb 1px, transparent 1px);
  background-size: auto, 24px 24px;
  font-family: "DM Sans", sans-serif;
}

button, input { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 420px;
  height: 420px;
  filter: blur(100px);
  opacity: .18;
  pointer-events: none;
  border-radius: 50%;
  background: #6172f4;
}
.ambient-one { top: -200px; right: -80px; }
.ambient-two { left: -220px; top: 420px; opacity: .13; background: #2dcde0; }

.topbar {
  width: min(1480px, calc(100% - 40px));
  height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
  font: 800 21px/1 "Manrope", sans-serif;
  letter-spacing: -.8px;
}
.brand > span:last-child span { color: var(--green-dark); }
.brand-mark {
  width: 32px;
  height: 32px;
  display: block;
  filter: drop-shadow(0 5px 8px rgba(69, 75, 220, .18));
}

.top-actions { display: flex; align-items: center; gap: 12px; }
.nav-link {
  padding: 9px 16px;
  color: var(--ink);
  background: transparent;
  border: 1px solid #cfd6d0;
  border-radius: 999px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  transition: .18s ease;
}
.nav-link:hover { border-color: var(--green-dark); color: var(--green-dark); background: #f4f6ff; }

main.page-grid {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 8px 0 48px;
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 36px;
  align-items: start;
}

.projects-section {
  padding: 8px 0 0;
  min-height: 320px;
  position: sticky;
  top: 24px;
}

.hero {
  text-align: left;
  padding: 8px 36px 0 0;
  border-top: 0;
  border-right: 1px solid rgba(154,166,157,.25);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.2px;
}
.eyebrow span { font-size: 14px; }

h1 {
  margin: 0;
  font: 800 clamp(36px, 3.8vw, 64px)/.98 "Manrope", sans-serif;
  letter-spacing: clamp(-4px, -.05em, -1.5px);
}
h1 em { position: relative; color: var(--green-dark); font-style: normal; background: linear-gradient(90deg, #247fdf, #754fe9); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
h1 em::after {
  content: "";
  position: absolute;
  left: 2%;
  bottom: -7px;
  width: 96%;
  height: 8px;
  opacity: .75;
  background: url("data:image/svg+xml,%3Csvg width='300' height='8' viewBox='0 0 300 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 6C80 1 220 1 298 5' fill='none' stroke='%2319d477' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") center/100% 100% no-repeat;
}

.hero-copy {
  max-width: none;
  margin: 18px 0 24px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
}

.upload-card {
  position: relative;
  width: 100%;
  margin: 0;
  padding: 28px 26px 24px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
  overflow: hidden;
  text-align: left;
  background: var(--card);
  border: 1.5px dashed #bdc8bf;
  border-radius: 20px;
  box-shadow: 0 18px 55px rgba(18, 41, 27, .08), inset 0 0 0 5px rgba(255,255,255,.35);
  backdrop-filter: blur(12px);
  transition: .22s ease;
}
.upload-card.dragging { border-color: var(--green-dark); background: #f7fff9; transform: translateY(-3px); box-shadow: 0 22px 60px rgba(16, 129, 74, .14); }
.upload-card.uploading { pointer-events: none; }
.upload-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #4e57e4;
  background: #edf0ff;
  border: 1px solid #dce1ff;
}
.upload-icon svg { width: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.upload-text { display: flex; flex-direction: column; gap: 7px; width: 100%; }
.upload-text strong { font: 700 18px/1.2 "Manrope", sans-serif; letter-spacing: -.3px; }
.upload-text span { font-size: 14px; color: #7c8781; }
.selected-files { max-width: 100%; overflow: hidden; color: #87928b; font: 10px/1.4 Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.upload-card.has-selection { border-style: solid; border-color: #9edab8; background: rgba(248,255,250,.9); }
.upload-card.has-selection .upload-icon { color: white; background: var(--green-dark); }
.upload-button {
  width: 100%;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 12px;
  color: white;
  background: var(--ink);
  box-shadow: 0 8px 18px rgba(5, 18, 12, .16);
  cursor: pointer;
  font-weight: 700;
  transition: .2s ease;
}
.upload-button:hover { transform: translateY(-2px); background: #12261c; }
.upload-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.upload-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; opacity: 0; background: #dfebe3; }
.upload-progress span { display: block; height: 100%; width: 0; background: var(--green); transition: width .2s; }
.upload-card.uploading .upload-progress { opacity: 1; }
.privacy-note { display: flex; justify-content: flex-start; align-items: center; gap: 7px; margin: 12px 0 0; color: #849089; font-size: 12px; }
.privacy-note svg { width: 14px; fill: none; stroke: #5b67dd; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.switcher {
  width: 100%;
  margin: 18px 0 16px;
  padding: 5px;
  display: flex;
  gap: 4px;
  background: #e7ece7;
  border-radius: 12px;
}
.switcher button {
  flex: 1;
  min-width: 0;
  padding: 10px 10px;
  border: 0;
  border-radius: 9px;
  color: #657169;
  background: transparent;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  transition: .18s ease;
}
.switcher button.active {
  color: white;
  background: var(--ink);
  box-shadow: 0 5px 14px rgba(7, 17, 13, .18);
}

.panel {
  display: none;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: stretch;
  padding: 22px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid #dde3dc;
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(18, 41, 27, .06);
}
.panel.active { display: grid; }
.panel-copy h3 {
  margin: 14px 0 8px;
  font: 800 22px/1.15 "Manrope", sans-serif;
  letter-spacing: -.8px;
}
.panel-copy p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.step {
  width: 33px;
  height: 33px;
  display: grid;
  place-items: center;
  color: var(--green-dark);
  background: #edf0ff;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 800;
}
.panel-body { min-width: 0; }

.form-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-width: 0;
}
.form-card label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #4d5a52;
  font-size: 11px;
  font-weight: 700;
}
.form-card label span { color: #9aa29d; font-weight: 400; }
.form-card input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid #d7dfd8;
  border-radius: 10px;
  outline: none;
  background: white;
  color: var(--ink);
  font-size: 13px;
}
.form-card input:focus {
  border-color: var(--green-dark);
  box-shadow: 0 0 0 3px rgba(64, 89, 223, .1);
}
.primary {
  grid-column: 1 / -1;
  height: 46px;
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 0;
  border-radius: 10px;
  color: white;
  background: var(--ink);
  font-weight: 700;
  cursor: pointer;
  transition: .18s ease;
}
.primary:hover { background: #12261c; }
.form-card.stacked-form { grid-template-columns: 1fr; }
.form-card.stacked-form label,
.form-card.single-form.stacked-form label {
  grid-column: 1 / -1;
}
.form-card .generate-code { height: 32px; padding: 0 10px; align-self: flex-start; border: 1px solid #d9dff7; border-radius: 8px; color: #4059df; background: #f4f6ff; font-size: 10px; font-weight: 700; cursor: pointer; }
.form-card .generate-code:hover { border-color: #aeb8f3; background: #eaedff; }
.single-form { grid-template-columns: 1fr; }
.single-form .primary { grid-column: auto; }

.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 20px; }
.section-label { display: block; margin-bottom: 9px; color: var(--green-dark); font-size: 10px; font-weight: 700; letter-spacing: 2px; }
h2 { margin: 0; font: 800 30px/1.2 "Manrope", sans-serif; letter-spacing: -1.4px; }
.project-count { padding-bottom: 5px; color: #8b958f; font-size: 12px; }
.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.project-card {
  position: relative;
  min-width: 0;
  padding: 21px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 12px 16px;
  align-items: center;
  background: rgba(255,255,255,.72);
  border: 1px solid #dde3dc;
  border-radius: 15px;
  box-shadow: 0 6px 24px rgba(22, 40, 30, .045);
  transition: .2s ease;
}
.project-card:hover { transform: translateY(-2px); border-color: #c7d1c8; box-shadow: 0 13px 32px rgba(22, 40, 30, .08); }
.project-logo { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 12px; background: #edf0ff; color: #4c58dd; font: 800 17px "Manrope", sans-serif; text-transform: uppercase; }
.project-details { min-width: 0; grid-column: 2; }
.project-details strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 14px "Manrope", sans-serif; }
.project-meta { display: flex; align-items: center; gap: 7px; margin-top: 7px; color: #89938d; font-size: 10px; flex-wrap: wrap; }
.project-meta i { width: 3px; height: 3px; border-radius: 50%; background: #b1bab4; }
.card-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid #e8ece8;
}
.view-button {
  flex: 1;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  color: white;
  background: var(--green);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: .18s;
}
.view-button:hover { background: #7768ff; transform: translateY(-1px); }
.view-button:disabled { cursor: wait; opacity: .6; }
.delete-button {
  height: 36px;
  padding: 0 14px;
  border: 1px solid #ead4d4;
  border-radius: 9px;
  color: #a43f3f;
  background: white;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: .18s;
}
.delete-button:hover { background: #fff5f5; border-color: #d4a0a0; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #b2b9b5; }
.status-dot.running { background: var(--green); box-shadow: 0 0 0 3px rgba(25,212,119,.12); }
.empty-state { padding: 54px 20px; text-align: center; color: #89938d; border: 1px dashed #d3dad3; border-radius: 16px; }
.empty-state[hidden] { display: none; }
.empty-state strong { display: block; margin-top: 16px; color: #4e5c54; font-size: 14px; }
.empty-state p { margin: 6px 0 0; font-size: 12px; }
.empty-orbit { width: 42px; height: 42px; margin: auto; display: grid; place-items: center; border: 1px solid #bdc9c0; border-radius: 50%; }
.empty-orbit span { width: 9px; height: 9px; border-radius: 3px; background: var(--green); transform: rotate(45deg); }

.modal { position: fixed; inset: 0; z-index: 20; padding: 24px; display: none; place-items: center; background: rgba(4, 12, 8, .72); backdrop-filter: blur(10px); }
.modal.open { display: grid; animation: fadeIn .18s ease; }
.modal-shell { width: min(1400px, 100%); height: min(900px, calc(100vh - 48px)); overflow: hidden; display: grid; grid-template-rows: 50px 1fr; border-radius: 16px; background: white; box-shadow: 0 30px 100px rgba(0,0,0,.32); }
.browser-bar { padding: 0 16px; display: grid; grid-template-columns: 120px 1fr 120px; align-items: center; background: #edf0ec; border-bottom: 1px solid #d8ddd8; }
.browser-dots { display: flex; gap: 7px; }
.browser-dots span { width: 10px; height: 10px; border-radius: 50%; background: #c4cbc6; }
.browser-dots span:first-child { background: #ff6d64; }
.browser-dots span:nth-child(2) { background: #ffca55; }
.browser-dots span:nth-child(3) { background: #52d273; }
.address-bar { height: 30px; min-width: 0; padding: 0 13px; display: flex; align-items: center; gap: 8px; overflow: hidden; color: #647069; background: #fff; border: 1px solid #dce1dd; border-radius: 8px; font-size: 11px; }
.address-bar span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lock { color: #5962dc; }
.browser-actions { display: flex; justify-content: flex-end; gap: 6px; }
.browser-actions button { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.browser-actions button:hover { background: #dfe4df; }
.browser-actions svg { width: 17px; fill: none; stroke: #405047; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#previewFrame { display: none; width: 100%; height: 100%; border: 0; background: white; }
#previewFrame.visible { display: block; }
.toast-wrap { position: fixed; z-index: 40; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 9px; }
.toast { max-width: 380px; padding: 13px 17px; color: white; background: #0a1810; border-radius: 10px; box-shadow: 0 14px 32px rgba(0,0,0,.22); font-size: 12px; animation: toastIn .25s ease; }
.toast.error { background: #8b3030; }
.form-message {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.5;
}
.form-message.error {
  color: #7a241f;
  background: #fff3f2;
  border: 1px solid #f0c5c0;
}
.form-message[hidden] { display: none !important; }

@keyframes fadeIn { from { opacity: 0; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1024px) {
  main.page-grid {
    width: min(100% - 32px, 1480px);
    grid-template-columns: 1fr;
    gap: 0;
  }

  .hero {
    text-align: center;
    padding: 36px 0 48px;
    border-right: 0;
    border-bottom: 1px solid rgba(154,166,157,.25);
  }

  .hero-copy { margin: 20px auto 28px; max-width: 560px; }
  .upload-card { text-align: center; align-items: center; }
  .privacy-note { justify-content: center; }
  .projects-section { padding-top: 28px; position: static; }
  .switcher { flex-wrap: wrap; }
  .switcher button { flex: 1 1 calc(50% - 4px); }
  .panel { grid-template-columns: 1fr; padding: 20px; }
  .form-card { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .topbar, main.page-grid { width: min(100% - 28px, 1480px); }
  h1 { font-size: clamp(42px, 14vw, 64px); }
  .hero-copy { font-size: 15px; }
  .upload-card { padding: 28px 22px; }
  .projects-grid { grid-template-columns: 1fr; }
  .modal { padding: 0; }
  .modal-shell { width: 100%; height: 100%; border-radius: 0; }
  .browser-bar { grid-template-columns: 60px 1fr 72px; padding: 0 9px; }
  .browser-dots span { width: 8px; height: 8px; }
}

@media (max-width: 430px) {
  .nav-link { padding: 8px 12px; font-size: 11px; }
  .section-heading { flex-direction: column; align-items: flex-start; gap: 8px; }
}
