:root {
  --bg: #0a0b0f;
  --bg-elev: #101219;
  --surface: #14171f;
  --surface-2: #1a1e28;
  --surface-3: #222735;
  --border: #242938;
  --border-strong: #333a4d;
  --text: #eef0f6;
  --text-2: #b6bccd;
  --text-3: #7d8598;
  --accent: #7c8cff;
  --accent-2: #a06bff;
  --accent-soft: rgba(124, 140, 255, 0.14);
  --success: #3ddc97;
  --success-soft: rgba(61, 220, 151, 0.13);
  --warn: #ffc53d;
  --warn-soft: rgba(255, 197, 61, 0.13);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, 0.13);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.28);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #9aa6ff; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- App chrome ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  height: 60px;
  background: rgba(10, 11, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.brand:hover { color: var(--text); }
.brand-mark {
  width: 22px; height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 1px rgba(255,255,255,.08) inset;
}

.nav-right { display: flex; align-items: center; gap: 14px; }
.nav-email {
  color: var(--text-3);
  font-size: 13px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 36px 24px 96px; }
.wrap-narrow { max-width: 940px; }

/* ---------- Auth ---------- */

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(124,140,255,.13), transparent 70%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px;
  box-shadow: var(--shadow);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

/* ---------- Typography ---------- */

h1 { font-size: 26px; line-height: 1.25; margin: 0 0 6px; letter-spacing: -0.025em; font-weight: 650; }
h2 { font-size: 16px; margin: 0; letter-spacing: -0.015em; font-weight: 620; }
.sub { color: var(--text-3); font-size: 14px; margin: 0; }
.mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------- Forms ---------- */

label {
  display: block;
  font-size: 13px;
  font-weight: 560;
  color: var(--text-2);
  margin-bottom: 7px;
}

input[type=text], input[type=email], input[type=password], textarea {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 10px 13px;
  font-size: 14.5px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #5d657a; }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 104px; line-height: 1.55; }
.field { margin-bottom: 16px; }

.otp {
  font-size: 30px;
  letter-spacing: 14px;
  text-align: center;
  font-family: var(--mono);
  padding-left: 14px;
}

.suffix-row { display: flex; align-items: stretch; gap: 0; }
.suffix-row input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}
.suffix {
  display: flex;
  align-items: center;
  padding: 0 13px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-left: none;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--text-3);
  font-size: 13.5px;
  white-space: nowrap;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: linear-gradient(180deg, var(--accent), #6675f5);
  color: #0a0b0f;
  border: none;
  border-radius: var(--r-sm);
  padding: 10px 17px;
  font-size: 14px;
  font-weight: 620;
  font-family: inherit;
  cursor: pointer;
  transition: filter .15s, opacity .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); color: #0a0b0f; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn-block { width: 100%; }

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-3); color: var(--text); filter: none; }

.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(255,107,107,.3); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); filter: none; }

.btn-sm { padding: 6px 12px; font-size: 13px; }

.btn-link {
  background: none; border: none; padding: 0;
  color: var(--accent); font: inherit; font-size: 13.5px; cursor: pointer;
}
.btn-link:hover { color: #9aa6ff; }

/* ---------- Alerts ---------- */

.alert {
  border-radius: var(--r-sm);
  padding: 11px 14px;
  font-size: 13.5px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-error { background: var(--danger-soft); color: #ffa9a9; border-color: rgba(255,107,107,.25); }
.alert-ok { background: var(--success-soft); color: #7ceec0; border-color: rgba(61,220,151,.25); }

/* ---------- Page header ---------- */

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

.crumb {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-3); font-size: 13px; margin-bottom: 10px;
}
.crumb a { color: var(--text-3); }
.crumb a:hover { color: var(--text-2); }

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px;
}
.card + .card { margin-top: 18px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}

/* ---------- Site grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}

.site-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  color: inherit;
  transition: border-color .16s, transform .16s, box-shadow .16s;
}
.site-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  color: inherit;
}
.site-card-body {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px;
}
.site-name { font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em; }
.site-host {
  color: var(--text-3); font-size: 12.5px; font-family: var(--mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 210px;
}

/* ---------- Preview thumbnails ---------- */

.thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.thumb iframe {
  position: absolute;
  top: 0; left: 0;
  width: 1280px;
  height: 800px;
  border: 0;
  transform-origin: 0 0;
  pointer-events: none;
  background: #fff;
}
.thumb-empty {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--text-3); font-size: 13px;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 9px, rgba(255,255,255,.014) 9px, rgba(255,255,255,.014) 18px),
    var(--bg-elev);
}

/* Browser-chrome framed preview on the detail page */
.preview {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface);
}
.preview-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 13px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.dots { display: flex; gap: 6px; flex-shrink: 0; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); display: block; }
.preview-url {
  flex: 1;
  background: var(--bg-elev);
  border-radius: 6px;
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preview .thumb { aspect-ratio: 16 / 10; border-bottom: none; }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  padding: 4px 10px; border-radius: 999px;
  text-transform: capitalize; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.empty { background: var(--surface-3); color: var(--text-3); }
.badge.ready { background: var(--success-soft); color: var(--success); }
.badge.failed { background: var(--danger-soft); color: var(--danger); }
.badge.generating, .badge.queued, .badge.running { background: var(--warn-soft); color: var(--warn); }
.badge.generating::before, .badge.queued::before, .badge.running::before {
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }

/* ---------- Lists ---------- */

.row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: none; }
.row:first-child { padding-top: 0; }
.row-main { min-width: 0; }
.row-title {
  font-size: 13.5px; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 440px;
}
.row-meta { color: var(--text-3); font-size: 12px; margin-top: 3px; }
.row-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ---------- Empty state ---------- */

.empty {
  text-align: center;
  padding: 64px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r);
  background: var(--surface);
}
.empty h2 { margin-bottom: 6px; }
.empty .sub { margin-bottom: 20px; }

/* ---------- Misc ---------- */

.section { margin-top: 26px; }
.stack > * + * { margin-top: 14px; }
.log {
  display: block; white-space: pre-wrap; word-break: break-word;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 11px 13px;
  font-family: var(--mono); font-size: 12px; color: var(--text-3);
  max-height: 190px; overflow-y: auto; margin-top: 10px;
}
.hint {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 13px 15px;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 16px;
}
.hint code {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--surface-3); color: var(--text);
  padding: 2px 6px; border-radius: 5px;
  word-break: break-all;
}
.dns-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.dns-table th {
  text-align: left; color: var(--text-3); font-weight: 560; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .05em; padding: 0 12px 6px 0;
}
.dns-table td { padding: 4px 12px 4px 0; font-family: var(--mono); font-size: 12.5px; color: var(--text); }

.split { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

.foot { text-align: center; margin-top: 20px; font-size: 13.5px; color: var(--text-3); }
.spacer { flex: 1; }

/* ---------- Utilities ----------
   Kept as classes rather than inline style attributes so the strict CSP
   (style-src 'self') needs no 'unsafe-inline' / 'unsafe-hashes' escape. */

.u-mt-1 { margin-top: 8px; }
.u-mt-2 { margin-top: 10px; }
.u-mt-3 { margin-top: 16px; }
.u-mb-0 { margin-bottom: 0; }
.u-mb-2 { margin-bottom: 14px; }
.u-mb-3 { margin-bottom: 22px; }
.u-mb-4 { margin-bottom: 24px; }
.u-ml-1 { margin-left: 8px; }
.u-center { text-align: center; }
.u-fine { font-size: 12.5px; }
.u-narrow { max-width: 560px; }

.form-note { font-size: 12.5px; margin-top: 8px; }
.preview-caption { font-size: 12.5px; margin-top: 10px; text-align: center; }

.progress-line {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.spinner-dot { padding: 0; background: none; }

.domain-add input {
  border-radius: var(--r-sm);
  border-right: 1px solid var(--border-strong);
}

/* ---------- Guided brief: choice chips ---------- */

.q-head { margin-bottom: 13px; }
.q-head .sub { margin-top: 3px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip { position: relative; margin: 0; cursor: pointer; }
.chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.chip span {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 520;
  transition: border-color .14s, background .14s, color .14s;
  user-select: none;
}
.chip:hover span { border-color: #46506b; color: var(--text); }
.chip input:checked + span {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #cdd4ff;
}
.chip input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Pictures ---------- */

.meter {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  margin-top: 4px;
}
.meter-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .3s;
  width: 0;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.media-item {
  position: relative;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-elev);
}
.media-item img {
  display: block;
  width: 100%;
  height: 96px;
  object-fit: cover;
  background: var(--surface-3);
}
.media-item figcaption {
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.media-name {
  font-size: 12px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.media-meta { font-size: 11px; color: var(--text-3); font-family: var(--mono); }

.media-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(10, 11, 15, .74);
  color: #fff;
  font-size: 15px;
  line-height: 20px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .14s, background .14s;
}
.media-item:hover .media-remove,
.media-remove:focus-visible { opacity: 1; }
.media-remove:hover { background: var(--danger); color: #1a0b0b; }

input[type=file] {
  font-size: 13.5px;
  color: var(--text-2);
  max-width: 100%;
}
input[type=file]::file-selector-button {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 7px 13px;
  margin-right: 11px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 560;
  cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--surface-3); }

.kind-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--surface-3);
  border-radius: 4px;
  padding: 2px 6px;
  margin-right: 7px;
  vertical-align: 1px;
}
