:root {
  color-scheme: dark;
  --bg: #050b14;
  --panel: rgba(10, 20, 35, 0.86);
  --panel-strong: #0b1424;
  --border: rgba(83, 232, 191, 0.18);
  --text: #e8fff8;
  --muted: #8aa3b4;
  --teal: #16f2b3;
  --green: #22c55e;
  --pink: #ec4899;
  --gold: #f9c74f;
  --danger: #fb7185;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(22, 242, 179, 0.16), transparent 34rem),
    radial-gradient(circle at top right, rgba(236, 72, 153, 0.12), transparent 30rem),
    linear-gradient(180deg, #050b14 0%, #02060d 100%);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--border);
  background: rgba(3, 8, 16, 0.86);
  backdrop-filter: blur(18px);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand small { display: block; color: var(--muted); margin-top: 2px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: #00120d;
  font-weight: 900;
  background: linear-gradient(135deg, var(--teal), var(--green));
  box-shadow: 0 0 34px rgba(22, 242, 179, 0.32);
}

nav { display: flex; align-items: center; gap: 18px; color: var(--muted); }
nav a:hover { color: var(--teal); }
nav form { margin: 0; }
nav button { color: var(--muted); background: transparent; border: 0; cursor: pointer; }
nav button:hover { color: var(--teal); }

.page-shell { width: min(1180px, calc(100% - 32px)); margin: 32px auto 80px; }
.panel {
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  border-radius: 28px;
  padding: clamp(20px, 4vw, 34px);
  margin-bottom: 24px;
}

.hero h1 { max-width: 820px; font-size: clamp(36px, 6vw, 72px); line-height: 0.92; margin: 8px 0 18px; letter-spacing: -0.06em; }
h1, h2 { margin: 0; letter-spacing: -0.04em; }
.eyebrow { margin: 0 0 8px; color: var(--teal); font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 800; }
.muted { color: var(--muted); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.hidden { display: none !important; }

.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.field { display: grid; gap: 8px; }
.field span { color: #c9f9ed; font-weight: 700; }
.field.wide, .button.wide { grid-column: 1 / -1; }
.checkbox-field { align-content: end; grid-template-columns: auto 1fr; align-items: center; }
.custom-size-panel {
  border: 1px solid rgba(138, 163, 180, 0.2);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
}
.custom-size-panel summary { cursor: pointer; color: #c9f9ed; font-weight: 850; }
.custom-size-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 12px; }
.custom-size-note { align-self: end; margin: 0; }
input, textarea, select {
  width: 100%;
  color: var(--text);
  background: #071120;
  border: 1px solid rgba(138, 163, 180, 0.28);
  border-radius: 16px;
  padding: 13px 14px;
  outline: none;
}
textarea { resize: vertical; min-height: 180px; }
input:focus, textarea:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(22, 242, 179, 0.1); }
input:disabled, select:disabled { opacity: 0.58; cursor: not-allowed; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 13px 18px;
  font-weight: 850;
  cursor: pointer;
}
.button.primary { color: #02120d; background: linear-gradient(135deg, var(--teal), var(--green)); }
.button.secondary { color: white; background: linear-gradient(135deg, var(--pink), #8b5cf6); }
.button.ghost { color: var(--text); background: rgba(255, 255, 255, 0.04); border-color: var(--border); }
.button.small { padding: 8px 10px; border-radius: 10px; font-size: 0.84rem; }
.button:disabled { opacity: 0.45; cursor: not-allowed; }

.cost-pill { border: 1px solid var(--border); background: rgba(22, 242, 179, 0.08); color: var(--teal); padding: 10px 12px; border-radius: 999px; font-weight: 850; }
.alert { border-radius: 16px; padding: 12px 14px; margin: 14px 0; border: 1px solid; }
.alert-error { border-color: rgba(251, 113, 133, 0.42); background: rgba(251, 113, 133, 0.11); color: #fecdd3; }
.alert-warning { border-color: rgba(249, 199, 79, 0.42); background: rgba(249, 199, 79, 0.11); color: #fde68a; }

.progress-track { height: 14px; background: #071120; border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--green)); transition: width 0.3s ease; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 18px; }
.status-tile { padding: 14px; border-radius: 16px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.04); }
.status { border-radius: 999px; padding: 4px 8px; font-size: 0.75rem; text-transform: uppercase; font-weight: 900; }
.status.queued { color: #cbd5e1; background: rgba(148, 163, 184, 0.14); }
.status.generating { color: #a7f3d0; background: rgba(16, 185, 129, 0.16); }
.status.done { color: #bbf7d0; background: rgba(34, 197, 94, 0.17); }
.status.failed { color: #fecdd3; background: rgba(251, 113, 133, 0.17); }

.image-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.image-card { overflow: hidden; border: 1px solid var(--border); background: var(--panel-strong); border-radius: 22px; box-shadow: var(--shadow); }
.image-frame { aspect-ratio: 16 / 10.67; display: grid; place-items: center; background: #02060d; }
.image-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.placeholder { color: var(--muted); text-transform: uppercase; letter-spacing: 0.16em; font-weight: 900; }
.card-body { padding: 16px; }
.card-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; font-weight: 850; }
details { color: var(--muted); margin: 10px 0; }
details summary { color: var(--text); cursor: pointer; font-weight: 800; }
details p { white-space: pre-wrap; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 10px; border-bottom: 1px solid rgba(138, 163, 180, 0.16); }
th { color: var(--teal); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(460px, 100%); border: 1px solid var(--border); background: var(--panel); border-radius: 28px; padding: 32px; box-shadow: var(--shadow); }
.stack { display: grid; gap: 14px; }

@media (max-width: 900px) {
  .form-grid, .image-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .topbar, .section-heading { align-items: flex-start; flex-direction: column; }
  nav { flex-wrap: wrap; }
  .form-grid, .image-grid, .custom-size-grid { grid-template-columns: 1fr; }
}
