:root {
  --bg: #020617;
  --bg-alt: #0b1220;
  --card: #020617;
  --card-elevated: #020617;
  --ink: #e5e7eb;
  --muted: #94a3b8;
  --line: rgba(148, 163, 184, 0.35);
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, .12);
  --accent-ink: #0f172a;
  --danger: #f97373;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.6);
  --ring: 0 0 0 1px rgba(56, 189, 248, .5);
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(56, 189, 248, .15), transparent 55%),
    radial-gradient(circle at bottom, #020617, #020617 65%);
  color: var(--ink);
  display: flex;
  align-items: stretch;
  justify-content: center;
}

/* Stack panels: builds on top, form on bottom */
.page-shell {
  width: 100%;
  max-width: 1120px;
  margin: 1.5rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (max-width: 600px) {
  .page-shell {
    margin: 1rem .75rem 2rem;
  }
}

.panel {
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, .12), transparent 55%),
    radial-gradient(circle at bottom right, rgba(129, 140, 248, .15), transparent 55%),
    var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, .4);
  box-shadow: var(--shadow-soft);
  padding: 1.25rem 1.5rem 1.25rem;
  backdrop-filter: blur(18px);
}

@media (max-width: 600px) {
  .panel {
    padding: 1rem;
  }
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1rem;
}

.panel-header h1,
.panel-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: .02em;
}

.badge {
  padding: .15rem .6rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, .6);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  white-space: nowrap;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .75rem;
  font-size: .78rem;
  color: var(--muted);
}

.pill-row span {
  padding: .15rem .5rem;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, .7);
  border: 1px solid rgba(148, 163, 184, .4);
}

.flash {
  margin: .3rem 0 .65rem;
  padding: .4rem .6rem;
  border-radius: var(--radius-md);
  font-size: .72rem;
  background: rgba(22, 163, 74, .1);
  border: 1px solid rgba(22, 163, 74, .4);
  color: #bbf7d0;
}

.empty-state {
  font-size: .8rem;
  color: var(--muted);
  margin: .5rem 0 0;
}

/* ===== BUILD LIST (CARD LAYOUT) ===== */

.build-list {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin-top: .25rem;
}

.build-item {
  border-radius: var(--radius-md);
  border: 1px solid rgba(51, 65, 85, .9);
  padding: .65rem .75rem;
  background: rgba(15, 23, 42, .82);
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: .75rem;
  transition: all .12s ease-out;
}

.build-item:hover {
  border-color: rgba(56, 189, 248, .7);
  box-shadow: 0 14px 30px rgba(15, 23, 42, .9);
  transform: translateY(-1px);
}

.build-main {
  flex: 1 1 auto;
  min-width: 0;
}

.build-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .25rem;
}

.build-title {
  font-size: .9rem;
  font-weight: 600;
}

.build-brand-line {
  margin-top: .1rem;
  font-size: .74rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  align-items: center;
}

.build-brand-line .dot {
  opacity: .7;
}

.build-brand-line .sku {
  font-style: italic;
}

.build-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: .2rem;
}

.build-tag {
  font-size: .72rem;
  padding: .12rem .45rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, .9);
  border: 1px solid rgba(51, 65, 85, 1);
}

.build-tag.subtle {
  opacity: .8;
}

.build-side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: .35rem;
  text-align: right;
  min-width: 120px;
}

.price-block {
  font-size: .78rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .1rem;
}

.price-main {
  font-weight: 600;
}

.price-old {
  font-size: .7rem;
  text-decoration: line-through;
  color: var(--muted);
}

.price-contact {
  font-size: .75rem;
  color: var(--muted);
}

/* mobile stacking for build cards */
@media (max-width: 640px) {
  .build-item {
    flex-direction: column;
    align-items: stretch;
  }

  .build-side {
    align-items: flex-start;
    text-align: left;
    flex-direction: row;
    justify-content: space-between;
  }
}

/* ===== STATUS PILL & BUTTONS ===== */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .1rem .55rem;
  border-radius: 999px;
  font-size: .7rem;
  border: 1px solid rgba(148, 163, 184, .5);
}

.status-dot {
  width: .4rem;
  height: .4rem;
  border-radius: 999px;
  background: #22c55e;
}

.status-pill.hidden .status-dot {
  background: #f97316;
}

.status-pill.hidden {
  opacity: .8;
}

.btn {
  appearance: none;
  border: none;
  border-radius: var(--radius-pill);
  padding: .45rem .9rem;
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--accent-soft);
  color: var(--accent);
  transition: transform .1s ease, box-shadow .1s ease, background .15s ease;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, .3);
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(15, 23, 42, .9);
  background: rgba(56, 189, 248, .15);
}

.btn-ghost {
  background: transparent;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, .7);
  color: var(--muted);
  box-shadow: none;
}

.btn-ghost:hover {
  background: rgba(15, 23, 42, .85);
  border-color: rgba(148, 163, 184, 1);
}

.btn-danger {
  background: rgba(248, 113, 113, .08);
  color: var(--danger);
  box-shadow: 0 0 0 1px rgba(248, 113, 113, .3);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, .14);
  box-shadow: 0 12px 32px rgba(127, 29, 29, .9);
}

/* ===== FORM ===== */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem .9rem;
  margin-bottom: .75rem;
}

@media (max-width: 720px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .78rem;
}

label {
  color: var(--muted);
  font-size: .75rem;
}

.field-help {
  font-size: .7rem;
  color: var(--muted);
  opacity: .95;
  line-height: 1.4;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, .7);
  background: rgba(15, 23, 42, .9);
  color: var(--ink);
  padding: .5rem .6rem;
  font-size: .8rem;
  outline: none;
  box-sizing: border-box;
}

input:focus,
select:focus,
textarea:focus {
  box-shadow: var(--ring);
  border-color: rgba(56, 189, 248, .7);
}

textarea {
  min-height: 72px;
  resize: vertical;
}

.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-top: .5rem;
  flex-wrap: wrap;
}

.note {
  font-size: .72rem;
  color: var(--muted);
}

a.link {
  color: var(--accent);
  text-decoration: none;
}

a.link:hover {
  text-decoration: underline;
}

.thumb-preview {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
  color: var(--muted);
}

.thumb-preview img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid rgba(148, 163, 184, .7);
}
