:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8faff;
  --text: #172033;
  --muted: #778196;
  --border: #e5e9f1;
  --primary: #5b55e7;
  --primary-dark: #4841cf;
  --primary-soft: #efeeff;
  --success: #15803d;
  --danger: #dc2626;
  --warning: #d97706;
  --shadow: 0 12px 32px rgba(24, 35, 65, 0.06);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10131c;
  --surface: #191e2b;
  --surface-soft: #202637;
  --text: #edf0fa;
  --muted: #a1aabd;
  --border: #30384a;
  --primary: #8b85ff;
  --primary-dark: #7770ed;
  --primary-soft: #2b294d;
  --success: #4ade80;
  --danger: #f87171;
  --warning: #fbbf24;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

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",
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(91, 85, 231, 0.3);
  outline-offset: 2px;
}

::selection {
  color: #fff;
  background: var(--primary);
}

/* App layout */

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #7770f5, #4942c9);
  font-size: 13px;
  font-weight: 800;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  border: 0;
  border-radius: 9px;
  padding: 10px 16px;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
  background: var(--primary-soft);
}

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

.icon-button {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 20px;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.icon-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* Main content */

.main-content {
  flex: 1;
  padding: 32px 0 40px;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.2;
  letter-spacing: -1px;
}

h2 {
  margin-bottom: 5px;
  font-size: 17px;
  letter-spacing: -0.3px;
}

.muted {
  color: var(--muted);
  margin-bottom: 0;
  font-size: 13px;
  line-height: 1.6;
}

/* Panels */

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.plan-panel {
  margin-bottom: 20px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

/* Plans */

.plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.plan-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  padding: 20px;
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 13px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.plan-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.plan-card:focus-visible {
  outline: 3px solid rgba(91, 85, 231, 0.3);
  outline-offset: 3px;
}

.plan-card.selected {
  border: 2px solid var(--primary);
  padding: 19px;
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.plan-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.plan-name {
  font-size: 17px;
  font-weight: 800;
}

.plan-price {
  font-size: 23px;
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
}

.plan-price small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.plan-description {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.plan-feature {
  display: block;
  padding: 6px 0;
  font-size: 12px;
  border-top: 1px solid var(--border);
  line-height: 1.5;
}

.plan-feature.included {
  color: var(--success);
}

.plan-feature.excluded {
  color: var(--muted);
}

/* Builder */

.builder-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  align-items: start;
  gap: 20px;
}

.builder-panel,
.preview-panel {
  min-width: 0;
}

.badge,
.preview-label {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border-radius: 20px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* Form fields */

.field {
  margin-bottom: 18px;
}

.field > label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 750;
}

.required {
  color: var(--danger);
}

.field input[type="url"],
.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="number"],
.field select,
.field textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 11px 13px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

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

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"] {
  border-color: var(--danger);
}

.field-help {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 7px;
  line-height: 1.5;
}

/* Locked fields */

.locked-wrap {
  position: relative;
}

.lock-tooltip {
  display: none;
  position: absolute;
  z-index: 10;
  top: calc(100% + 7px);
  left: 0;
  width: max-content;
  max-width: min(280px, 100%);
  padding: 8px 10px;
  border-radius: 8px;
  background: #202334;
  color: #fff;
  font-size: 11px;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.2);
}

.locked-wrap:hover .lock-tooltip,
.locked-wrap:focus-within .lock-tooltip {
  display: block;
}

/* Logo upload */

.upload-box {
  min-height: 112px;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  cursor: pointer;
  text-align: center;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.upload-box:not(.disabled):hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.upload-box.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 19px;
}

.upload-box strong {
  font-size: 12px;
}

.upload-box small {
  color: var(--muted);
  font-size: 10px;
}

/* Buttons */

.primary-button,
.secondary-button {
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 750;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease,
    transform 0.15s ease;
}

.primary-button {
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
}

.primary-button:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled) {
  transform: translateY(0);
}

.primary-button:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.secondary-button {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.full-width {
  width: 100%;
}

/* Payment section */

.payment-panel {
  margin-top: 18px;
}

.payment-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}

.payment-summary-label {
  color: var(--muted);
  font-size: 12px;
}

.payment-summary-amount {
  color: var(--primary);
  font-size: 21px;
  font-weight: 800;
  white-space: nowrap;
}

.payment-methods {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
}

.payment-method {
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 10px;
  font-weight: 700;
}

.payment-secure-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  margin: 12px 0 0;
}

.payment-secure-note .icon {
  flex-shrink: 0;
  color: var(--success);
}

/* General messages */

.disclaimer,
.table-note {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  margin: 10px 0 0;
}

.message {
  display: none;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
}

.message.show {
  display: block;
}

.message.error {
  color: var(--danger);
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.15);
}

.message.success {
  color: var(--success);
  background: rgba(21, 128, 61, 0.08);
  border: 1px solid rgba(21, 128, 61, 0.15);
}

.message.warning {
  color: var(--warning);
  background: rgba(217, 119, 6, 0.08);
  border: 1px solid rgba(217, 119, 6, 0.15);
}

.message.info {
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid var(--border);
}

/* Preview */

.phone-stage {
  display: grid;
  place-items: center;
  min-height: 290px;
  padding: 10px;
  background: radial-gradient(
    circle at 50% 45%,
    var(--primary-soft),
    transparent 70%
  );
  border-radius: 12px;
}

.phone {
  position: relative;
  width: 160px;
  height: 270px;
  padding: 7px;
  border: 4px solid #252b39;
  border-radius: 25px;
  background: #252b39;
  box-shadow: 0 15px 28px rgba(0, 0, 0, 0.18);
}

.phone-camera {
  position: absolute;
  z-index: 2;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 38px;
  height: 9px;
  border-radius: 20px;
  background: #252b39;
}

.phone-screen {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 17px;
  display: grid;
  place-items: center;
  background: #fff;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 5%;
  text-align: center;
  color: #151515;
}

.preview-logo {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: #efefff;
  color: #514bd9;
  font-size: 21px;
  font-weight: 900;
}

.preview-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.splash-content strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 800;
}

.preview-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

/* Build progress */

.build-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 12px;
  text-align: center;
}

.progress-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 30px;
}

.build-progress h3 {
  margin: 0;
  font-size: 17px;
}

.build-timer {
  font-size: clamp(32px, 8vw, 46px);
  font-weight: 800;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
}

.timer-caption {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 11px;
}

#buildProgress .primary-button {
  margin-top: 10px;
}

#freeQuota {
  text-align: center;
}

/* Latest build */

.latest-panel {
  margin-top: 20px;
}

.empty-state {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
  font-size: 12px;
}

.empty-state p {
  margin: 0;
  font-size: 11px;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  margin-bottom: 4px;
  border-radius: 11px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 20px;
}

.build-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}

.build-card-main {
  min-width: 0;
}

.build-card-title {
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.build-card-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

/* Status badges */

.status {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 20px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: capitalize;
}

.status.completed,
.status.success,
.status.paid {
  color: var(--success);
  background: rgba(21, 128, 61, 0.08);
}

.status.failed,
.status.error,
.status.cancelled {
  color: var(--danger);
  background: rgba(220, 38, 38, 0.08);
}

.status.pending,
.status.processing,
.status.created {
  color: var(--warning);
  background: rgba(217, 119, 6, 0.08);
}

/* Orders table */

.orders-panel {
  padding: 0;
  overflow: hidden;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}

th {
  color: var(--muted);
  background: var(--surface-soft);
  font-weight: 800;
  white-space: nowrap;
}

td {
  color: var(--text);
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: var(--surface-soft);
}

.table-empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.table-note {
  padding: 0 16px 14px;
}

.table-action {
  display: inline-flex;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 750;
  white-space: nowrap;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.table-action:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* Utilities */

.hidden {
  display: none !important;
}

.text-success {
  color: var(--success) !important;
}

.text-danger {
  color: var(--danger) !important;
}

.text-muted {
  color: var(--muted) !important;
}

.text-primary {
  color: var(--primary) !important;
}

.text-center {
  text-align: center;
}

/* Footer */

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  color: var(--muted);
  border-top: 1px solid var(--border);
  font-size: 10px;
}

/* Responsive layout */

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 28px, 600px);
  }

  .topbar {
    min-height: 66px;
    gap: 8px;
  }

  .brand {
    font-size: 13px;
  }

  .brand-mark {
    width: 33px;
    height: 33px;
  }

  .nav {
    gap: 2px;
  }

  .nav-link {
    padding: 9px 10px;
    font-size: 11px;
  }

  .main-content {
    padding-top: 24px;
  }

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

  .preview-panel {
    order: 2;
  }

  .plan-grid {
    gap: 10px;
  }

  .plan-card {
    padding: 14px;
  }

  .plan-card.selected {
    padding: 13px;
  }

  .plan-price {
    font-size: 19px;
  }
}

@media (max-width: 480px) {
  .app-shell {
    width: calc(100% - 22px);
  }

  .topbar {
    flex-wrap: wrap;
    min-height: 62px;
    padding: 10px 0;
  }

  .brand {
    flex: 1;
  }

  .nav {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .top-actions {
    margin-left: auto;
  }

  .page-heading {
    align-items: flex-start;
  }

  .panel {
    padding: 15px;
    border-radius: 13px;
  }

  .plan-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
  }

  .payment-summary {
    padding: 11px;
  }

  .footer {
    flex-direction: column;
    gap: 5px;
  }

  .build-card {
    align-items: flex-start;
  }
}

/* Reduced motion accessibility */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
.request-dialog {
  width: min(440px, calc(100% - 32px));
  max-width: 440px;
  padding: 0;
  border: 0;
  border-radius: 18px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.25);
}

.request-dialog::backdrop {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(3px);
}

.request-dialog-content {
  padding: 28px;
  text-align: center;
}

.request-success-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: rgba(22, 155, 80, 0.12);
  color: var(--success);
  font-size: 32px;
  font-weight: 800;
}

.request-dialog h2 {
  margin-bottom: 10px;
  font-size: 23px;
}

.request-dialog p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.request-order-info {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  padding: 15px;
  margin: 20px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--background);
  text-align: left;
}

.request-order-info span {
  color: var(--muted);
  font-size: 12px;
}

.request-order-info strong {
  margin-bottom: 8px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.request-dialog-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Policy pages */
.policy-page { width: min(900px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 48px; }
.policy-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: clamp(22px, 5vw, 42px); box-shadow: var(--shadow); }
.policy-card h1 { margin-bottom: 10px; }
.policy-card h2 { margin: 26px 0 9px; font-size: 16px; }
.policy-card p, .policy-card li { color: var(--muted); font-size: 13px; line-height: 1.75; }
.policy-card ul { padding-left: 22px; }
.policy-back { display: inline-block; margin-bottom: 18px; color: var(--primary); font-size: 13px; font-weight: 700; text-decoration: none; }
.policy-links { display: flex; flex-wrap: wrap; gap: 12px 18px; }
.policy-links a { color: var(--muted); font-size: 11px; text-decoration: none; }
.policy-links a:hover { color: var(--primary); text-decoration: underline; }
@media (max-width: 600px) { .policy-page { width: min(100% - 28px, 900px); padding-top: 22px; } .policy-card { padding: 22px 18px; } }
