* {
  box-sizing: border-box;
}

:root {
  --bg: #f7f8fb;
  --sidebar: #ffffff;
  --card: #ffffff;
  --text: #141824;
  --muted: #697386;
  --line: #e6e8ee;
  --blue: #2457f5;
  --blue2: #6d7cff;
  --soft-blue: #eef2ff;
  --green: #16a464;
  --orange: #ff9e2c;
  --red: #ff5b45;
  --shadow: 0 20px 60px rgba(31, 42, 68, 0.08);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  display: grid;
  grid-template-columns: 320px 1fr;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 24px 18px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, #2557f5, #7a68ff);
  box-shadow: 0 14px 26px rgba(36, 87, 245, 0.18);
}

.brand strong {
  display: block;
  font-size: 18px;
  letter-spacing: -0.4px;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
}

.quick-search {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--muted);
  margin-bottom: 18px;
}

.quick-search input {
  border: 0;
  outline: 0;
  flex: 1;
  min-width: 0;
}

.quick-search kbd {
  color: #9aa2b1;
  font-size: 12px;
  font-family: inherit;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  border: 0;
  background: transparent;
  color: #2a3142;
  padding: 13px 14px;
  border-radius: 14px;
  text-align: left;
  display: flex;
  gap: 12px;
  align-items: center;
  font-weight: 650;
}

.nav-item span {
  color: #697386;
  width: 20px;
  text-align: center;
}

.nav-item.active {
  background: linear-gradient(135deg, #eef2ff, #f5f6ff);
  color: var(--blue);
}

.nav-item.active span {
  color: var(--blue);
}

.nav-label {
  margin: 20px 14px 8px;
  color: #788194;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  font-size: 12px;
}

.upgrade-card {
  margin-top: 26px;
  padding: 18px;
  border: 1px solid #dfe4ff;
  border-radius: 18px;
  background: linear-gradient(135deg, #f8f9ff, #eef2ff);
}

.upgrade-card .spark {
  color: var(--blue);
  font-size: 20px;
}

.upgrade-card strong {
  display: block;
  color: var(--blue);
  margin-top: 8px;
}

.upgrade-card p {
  color: var(--muted);
  line-height: 1.45;
  margin: 8px 0 14px;
}

.upgrade-card button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 800;
  padding: 0;
}

.app {
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 68px;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 28px;
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.crumb {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 14px;
  color: #2b3243;
  background: #fff;
}

.crumb button {
  border: 0;
  background: transparent;
  font-weight: 650;
}

.folder {
  color: #697386;
}

.chev {
  color: #9aa2b1;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions button {
  border: 0;
  background: transparent;
  color: #2b3243;
  font-weight: 700;
  padding: 9px 10px;
  border-radius: 10px;
}

.top-actions button:hover {
  background: #f2f4f8;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6d7cff, #2457f5) !important;
  color: #fff !important;
}

.view {
  display: none;
  padding: 72px 56px 34px;
  flex: 1;
}

.view.active {
  display: block;
}

.success-card {
  max-width: 1040px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  min-height: 520px;
  position: relative;
  overflow: hidden;
}

.success-main {
  min-height: 365px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  padding: 44px 22px;
}

.check {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 26px;
  background: linear-gradient(135deg, #dbf7e8, #eefcf4);
  color: var(--green);
  font-size: 40px;
  font-weight: 900;
}

.success-card h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 44px);
  letter-spacing: -1.4px;
}

.success-card p {
  color: var(--muted);
  margin: 12px 0 24px;
}

.published-url {
  color: var(--blue);
  font-size: clamp(23px, 3vw, 32px);
  font-weight: 750;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.success-bottom {
  border-top: 1px solid var(--line);
  padding: 28px 48px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.status-block {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eef2ff;
  color: var(--blue);
  font-size: 26px;
}

.status-block p {
  margin: 5px 0 0;
}

.primary,
.secondary {
  border-radius: 12px;
  min-height: 46px;
  padding: 0 18px;
  font-weight: 800;
}

.primary {
  border: 0;
  background: linear-gradient(135deg, #2457f5, #2f6df6);
  color: #fff;
  box-shadow: 0 12px 24px rgba(36, 87, 245, 0.18);
}

.secondary {
  background: #fff;
  border: 1px solid var(--line);
  color: #2b3243;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.confetti {
  position: absolute;
  font-weight: 900;
  user-select: none;
}

.c1 { left: 20%; top: 18%; color: var(--red); font-size: 38px; }
.c2 { right: 22%; top: 30%; color: #9cadff; font-size: 36px; }
.c3 { left: 14%; top: 49%; color: #9cadff; font-size: 32px; }
.c4 { right: 13%; top: 55%; color: #ffb044; font-size: 42px; }
.c5 { right: 17%; top: 23%; color: #ffb044; font-size: 34px; }
.c6 { left: 28%; top: 31%; color: #c8d0ff; font-size: 22px; }

.metrics-grid {
  max-width: 1040px;
  margin: 22px auto 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.metrics-grid.big {
  max-width: none;
}

.metric {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 12px 32px rgba(31, 42, 68, 0.05);
}

.metric span {
  color: var(--muted);
  font-weight: 700;
}

.metric strong {
  display: block;
  font-size: 34px;
  letter-spacing: -1px;
  margin: 9px 0 4px;
}

.metric small {
  color: var(--muted);
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}

.page-head h2 {
  margin: 4px 0 8px;
  font-size: 34px;
  letter-spacing: -1px;
}

.page-head p {
  color: var(--muted);
  margin: 0;
}

.eyebrow {
  color: var(--blue) !important;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}

.builder-layout {
  display: grid;
  grid-template-columns: 430px 1fr;
  gap: 22px;
}

.editor-panel,
.preview-column,
.table-card,
.empty-card,
.settings-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.editor-panel {
  padding: 16px;
}

.editor-panel details {
  border: 1px solid var(--line);
  border-radius: 16px;
  margin-bottom: 12px;
  padding: 0 14px 14px;
}

.editor-panel summary {
  cursor: pointer;
  font-weight: 850;
  padding: 15px 0;
}

label {
  display: block;
  color: #596276;
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 12px 0 7px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  outline: none;
  border-radius: 12px;
  padding: 12px 13px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 90px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #8ca3ff;
  box-shadow: 0 0 0 4px #eef2ff;
}

.wide {
  width: 100%;
}

.link-edit {
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 12px;
  margin-bottom: 10px;
}

.link-edit-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.link-edit-top button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 6px 8px;
}

.preview-column {
  padding: 18px;
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.phone-frame {
  width: min(410px, 100%);
  margin: 0 auto;
  padding: 12px;
  border-radius: 38px;
  border: 1px solid #dfe3eb;
  background: linear-gradient(135deg, #ffffff, #f3f5fa);
  box-shadow: 0 22px 60px rgba(31, 42, 68, 0.12);
}

.launch-page {
  min-height: 640px;
  border-radius: 28px;
  padding: 34px 24px;
  text-align: center;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(160deg, #0f172a, #111827);
}

.launch-page.theme-blue { --a: #38bdf8; --b: #6677ff; }
.launch-page.theme-purple { --a: #a78bfa; --b: #ec4899; }
.launch-page.theme-green { --a: #22c55e; --b: #2dd4bf; }
.launch-page.theme-orange { --a: #fb923c; --b: #ef4444; }
.launch-page.theme-mono { --a: #f8fafc; --b: #94a3b8; }

.launch-logo {
  width: 92px;
  height: 92px;
  border-radius: 28px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  color: #07111f;
  font-size: 36px;
  font-weight: 950;
  background: linear-gradient(135deg, var(--a), var(--b));
}

.launch-page.shape-soft .launch-logo,
.launch-page.shape-soft .launch-link,
.launch-page.shape-soft .launch-box { border-radius: 16px; }

.launch-page.shape-square .launch-logo,
.launch-page.shape-square .launch-link,
.launch-page.shape-square .launch-box { border-radius: 6px; }

.launch-page h3 {
  margin: 0;
  font-size: 31px;
  letter-spacing: -1px;
}

.launch-page .handle {
  color: #cbd5e1;
  font-weight: 750;
  margin: 6px 0 12px;
}

.launch-page .desc {
  color: #dbe5f2;
  line-height: 1.45;
  margin-bottom: 14px;
}

.launch-badge {
  display: inline-block;
  padding: 8px 11px;
  border-radius: 999px;
  color: #fff;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.10);
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 16px;
}

.launch-box {
  margin: 12px 0;
  padding: 14px;
  text-align: left;
  border: 1px solid rgba(255,255,255,.13);
  background: rgba(255,255,255,.08);
}

.launch-link {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 11px;
  margin: 11px 0;
  padding: 14px;
  color: #fff;
  text-decoration: none;
}

.link-left {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.link-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.12);
}

.btn-glass {
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.14);
}

.btn-solid {
  background: linear-gradient(135deg, var(--a), var(--b));
  color: #07111f;
  font-weight: 900;
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255,255,255,.24);
}

.launch-footer {
  color: #94a3b8;
  margin-top: 24px;
  font-size: 12px;
}

#exportCode {
  width: 100%;
  min-height: 520px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.table-card {
  overflow: hidden;
}

.table-row {
  display: grid;
  grid-template-columns: 1.2fr .7fr .8fr 1.2fr;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.table-row:last-child {
  border-bottom: 0;
}

.table-row.head {
  background: #fafbfe;
  color: var(--muted);
  font-weight: 800;
}

.pill {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
}

.pill.live {
  background: #e8f8ef;
  color: var(--green);
}

.pill.draft {
  background: #fff4df;
  color: #b86a00;
}

.empty-card,
.settings-card {
  padding: 28px;
  max-width: 760px;
}

.empty-card p {
  color: var(--muted);
}

.settings-card {
  display: grid;
  gap: 4px;
}

.statusbar {
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.76);
  padding: 16px 56px;
  display: flex;
  gap: 36px;
  flex-wrap: wrap;
  color: #586276;
  font-size: 14px;
}

.statusbar b {
  color: var(--blue);
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  border-radius: 999px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 50;
}

@media (max-width: 1000px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .topbar {
    top: 0;
  }

  .builder-layout,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .view {
    padding: 32px 18px;
  }

  .success-bottom,
  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .table-row {
    grid-template-columns: 1fr;
  }

  .statusbar {
    padding: 16px 18px;
  }
}

@media (max-width: 600px) {
  .topbar {
    height: auto;
    padding: 14px;
    flex-direction: column;
    align-items: flex-start;
  }

  .crumb {
    width: 100%;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .published-url {
    font-size: 20px;
  }

  .success-card {
    min-height: auto;
  }
}
