/* Shared design system for the builder's own pages (landing, login,
   dashboard, studio). Customer-generated apps never load this -- they are
   fully self-contained by design. Dark, modern, zero external assets. */

:root {
  --bg: #0a0c12;
  --surface: #121521;
  --surface-2: #191d2d;
  --border: #262b40;
  --border-strong: #333a57;
  --text: #e9ecf5;
  --muted: #9aa1b8;
  --faint: #6b7290;
  --accent: #6d78ff;
  --accent-2: #a855f7;
  --accent-grad: linear-gradient(135deg, #6d78ff, #a855f7);
  --success: #34d399;
  --danger: #f87171;
  --warn: #fbbf24;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; letter-spacing: -0.02em; }
p { margin: 0 0 12px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: rgba(109, 120, 255, 0.35); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: 600 14px/1 var(--font);
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s, transform 0.05s, border-color 0.15s;
}
.btn:hover { filter: brightness(1.15); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent-grad); border-color: transparent; color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: transparent; border-color: rgba(248, 113, 113, 0.4); color: var(--danger); }
.btn-sm { padding: 7px 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 14px 24px; font-size: 16px; border-radius: 12px; }

/* ---- Inputs ---- */
.input, .textarea, select.input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 13px;
  font: 400 14px/1.5 var(--font);
}
.textarea { resize: vertical; min-height: 96px; }
.input:focus, .textarea:focus, select.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109, 120, 255, 0.18);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
label.field { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }

/* ---- Surfaces ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 12px/1 var(--font);
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
}
.chip[data-tone='good'] { color: var(--success); border-color: rgba(52, 211, 153, 0.35); }
.chip[data-tone='warn'] { color: var(--warn); border-color: rgba(251, 191, 36, 0.35); }
.chip[data-tone='accent'] { color: #b9c0ff; border-color: rgba(109, 120, 255, 0.45); }

/* ---- Header nav ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 12, 18, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent-grad);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  flex: none;
}
.topbar .spacer { flex: 1; }

/* ---- Toast ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 16px);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  max-width: min(520px, calc(100vw - 32px));
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-kind='error'] { border-color: rgba(248, 113, 113, 0.5); }
.toast[data-kind='success'] { border-color: rgba(52, 211, 153, 0.5); }

/* ---- Progress shimmer used while a build streams ---- */
.build-progress {
  border: 1px solid rgba(109, 120, 255, 0.4);
  background: linear-gradient(110deg, var(--surface) 40%, rgba(109, 120, 255, 0.12) 50%, var(--surface) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--muted);
}
.build-progress strong { color: var(--text); display: block; margin-bottom: 3px; font-size: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
