:root {
  --bg-a: #03283f;
  --bg-b: #0f5f73;
  --ink: #0f1720;
  --panel: #f6f4ef;
  --panel-soft: #ece7dd;
  --accent: #ea7a26;
  --accent-dark: #c75e14;
  --ok: #256f3a;
  --error: #8f1f26;
  --ring: rgba(234, 122, 38, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 20%, rgba(234, 122, 38, 0.35), transparent 35%),
    radial-gradient(circle at 80% 10%, rgba(255, 215, 160, 0.2), transparent 40%),
    linear-gradient(135deg, var(--bg-a), var(--bg-b));
}

.page-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.panel {
  width: min(860px, 100%);
  background: linear-gradient(180deg, var(--panel), var(--panel-soft));
  border-radius: 22px;
  padding: 28px;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.22),
    0 2px 0 rgba(255, 255, 255, 0.7) inset;
  animation: panelIn 420ms ease-out;
}

.panel-header {
  margin-bottom: 18px;
}

.brand {
  margin: 0 0 4px;
  font-size: 2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.eyebrow {
  margin: 0;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #214f60;
}

h1 {
  margin: 8px 0;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.1;
}

#page-title {
  font-size: clamp(1.2rem, 2.5vw, 1.7rem);
}

.subtitle {
  margin: 0;
  max-width: 70ch;
  color: #2e3f4c;
}

.vm-form {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.vm-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.95rem;
}

.vm-form input {
  border: 1px solid #bcc3c8;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fffdf9;
}

.vm-form input:focus-visible {
  border-color: var(--accent);
  outline: 3px solid var(--ring);
}

button[type="submit"] {
  grid-column: 1 / -1;
  margin-top: 6px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: #fff;
  padding: 12px 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease;
}

button[type="submit"]:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

button[type="submit"]:disabled {
  opacity: 0.7;
  cursor: wait;
}

.result {
  margin-top: 18px;
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.75);
  min-height: 46px;
  border: 1px dashed #b7bfc5;
}

.result.success {
  color: var(--ok);
  border-color: rgba(37, 111, 58, 0.35);
}

.result.error {
  color: var(--error);
  border-color: rgba(143, 31, 38, 0.35);
}

.result a {
  color: inherit;
  text-decoration-thickness: 2px;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .panel {
    padding: 20px;
  }

  .vm-form {
    grid-template-columns: 1fr;
  }
}

/* ── Narrow panel (login) ────────────────────────────────────────────── */
.panel--narrow {
  max-width: 520px;
}

.login-form {
  margin-top: 24px;
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.95rem;
}

.login-form input {
  border: 1px solid #bcc3c8;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fffdf9;
}

.login-form input:focus-visible {
  border-color: var(--accent);
  outline: 3px solid var(--ring);
}

/* ── Panel header row (title + sign-out button) ───────────────────── */
.panel-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header-row .eyebrow {
  margin: 0;
}

.signout-btn {
  border: 1px solid #bcc3c8;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 160ms ease;
}

.signout-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* ── Client selection grid ──────────────────────────────────────────────── */
.clients-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 28px;
}

.client-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 20px;
  border: 1.5px solid #dcd7cf;
  border-radius: 16px;
  background: #faf9f6;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 170ms ease;
}

.client-card:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 22px rgba(234, 122, 38, 0.16);
  transform: translateY(-3px);
}

.client-card:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.client-card__badge {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(234, 122, 38, 0.3);
}

.client-card__name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
}

.client-card__hint {
  font-size: 0.8rem;
  color: #4a6070;
  line-height: 1.4;
}

@media (max-width: 680px) {
  .clients-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Deploy page header (back link + client label) ─────────────────────── */
.header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #4a6070;
  text-decoration: none;
  transition: color 150ms ease;
}

.back-link:hover {
  color: var(--accent-dark);
}

.back-link svg {
  flex-shrink: 0;
}

/* ── Deploy form sections ────────────────────────────────────────────── */
.form-section {
  grid-column: 1 / -1;
  border: 1px solid #dcd7cf;
  border-radius: 12px;
  padding: 14px 18px 18px;
  margin: 0;
}

.form-section legend {
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #214f60;
  padding: 0 6px;
}

.form-section__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.optional-tag {
  font-weight: 400;
  font-size: 0.75rem;
  color: #7a8c96;
  margin-left: 4px;
}

.checkbox-label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  padding-top: 24px;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .form-section__grid {
    grid-template-columns: 1fr;
  }
}

/* ── Build type selection ───────────────────────────────────────────────── */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 28px;
}

@media (max-width: 680px) {
  .choice-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Bulk build page ────────────────────────────────────────────────────── */
.panel--wide {
  width: min(1180px, 100%);
}

.section-note {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: #4a6070;
}

.import-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  margin-top: 14px;
}

.ghost-btn {
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  background: transparent;
  color: var(--accent-dark);
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.ghost-btn:hover {
  background: var(--accent);
  color: #fff;
}

.ghost-btn:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.file-field {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.95rem;
}

.file-field input[type="file"] {
  border: 1px solid #bcc3c8;
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #fffdf9;
  cursor: pointer;
}

.import-status {
  margin: 14px 0 0;
  font-size: 0.88rem;
  color: #2e3f4c;
}

.issue-list {
  margin: 12px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--error);
}

.preview-wrapper {
  grid-column: 1 / -1;
  border: 1px solid #dcd7cf;
  border-radius: 12px;
  background: #fffdf9;
  overflow: hidden;
}

.preview-scroll {
  max-height: 420px;
  overflow: auto;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  white-space: nowrap;
}

.preview-table th,
.preview-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #e7e2d9;
}

.preview-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-soft);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #214f60;
}

.preview-table tbody tr:hover {
  background: rgba(234, 122, 38, 0.07);
}

.preview-table .row-index {
  color: #7a8c96;
  font-variant-numeric: tabular-nums;
}

.preview-table .cell-empty {
  color: #a9b4bb;
}
