:root {
  /* brand */
  --brand-navy:       #0f1f3d;
  --brand-navy-dark:  #08142a;
  --brand-navy-light: #1a3360;
  --brand-navy-tint:  #e8edf5;
  --brand-gold:       #d4af37;
  --brand-gold-dark:  #b8972e;

  --bg:     #f1f5f9;
  --card:   #ffffff;
  --text:   #0f172a;
  --body:   #475569;
  --muted:  #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --success: #15803d;
  --warn:    #b45309;
  --error:   #b91c1c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

/* ─── Layout ─────────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 24px; }
.container.wide { max-width: 1400px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}

/* ─── Typography ─────────────────────────────────────────────── */
h1, h2, h3 { margin-top: 0; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px; }
h3 { font-size: 16px; font-weight: 600; }

/* ─── Page header ────────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-pretitle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--muted);
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  height: 26px;
  background: var(--brand-navy);
  color: var(--brand-gold);
  font-weight: 700;
  font-size: 11px;
  border-radius: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}
.page-actions { display: flex; gap: 8px; align-items: center; }

/* ─── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=color], textarea, select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: white;
  color: var(--text);
}
input[type=color] { height: 40px; padding: 4px 8px; cursor: pointer; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand-navy); outline-offset: 1px; }
textarea { resize: vertical; min-height: 80px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ─── Buttons ────────────────────────────────────────────────── */
button, .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-navy);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
button:hover, .btn:hover { background: var(--brand-navy-light); }
button:disabled, .btn:disabled { background: var(--muted); cursor: not-allowed; }

.btn-secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }

.btn-gold {
  background: var(--brand-gold);
  color: var(--brand-navy-dark);
}
.btn-gold:hover { background: var(--brand-gold-dark); }

/* ─── Error / status ─────────────────────────────────────────── */
.error-msg { color: var(--error); font-size: 13px; margin-top: 8px; }
.success-msg { color: var(--success); font-size: 13px; margin-top: 8px; }
.muted { color: var(--muted); font-size: 13px; }

/* ─── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}
.badge-draft    { background: #fef3c7; color: var(--warn); }
.badge-active   { background: #dcfce7; color: var(--success); }
.badge-archived { background: #f1f5f9; color: var(--muted); }

/* ─── Tables ─────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }
td a { color: var(--brand-navy); text-decoration: none; font-weight: 600; }
td a:hover { text-decoration: underline; }

/* ─── Login ──────────────────────────────────────────────────── */
.login-shell { max-width: 380px; margin: 80px auto; }
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
}
.auth-pretitle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--muted);
}
.auth-pretitle strong { color: var(--text); }
.auth-pretitle .sep { margin: 0 4px; }
.auth-title { font-size: 28px; font-weight: 700; margin-bottom: 6px; }
.auth-title .accent { color: var(--brand-gold); }
.auth-sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.auth-field { margin-bottom: 16px; }
.auth-submit { width: 100%; justify-content: center; margin-top: 8px; }

/* ─── Form sections ──────────────────────────────────────────── */
.form-section { margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.form-section:last-of-type { border-bottom: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ─── Service toggles ────────────────────────────────────────── */
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.service-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
}
.service-toggle:hover { border-color: var(--brand-navy); }
.service-toggle.enabled {
  border-color: var(--brand-navy);
  background: var(--brand-navy-tint);
}
.service-toggle input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }

/* ─── Detail panels ──────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 800px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-row {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  align-items: flex-start;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { font-weight: 600; min-width: 160px; flex-shrink: 0; color: var(--body); }
.detail-value { color: var(--text); word-break: break-word; }

/* ─── Color swatch ───────────────────────────────────────────── */
.color-swatch {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1px solid var(--border);
  vertical-align: middle;
  margin-right: 6px;
}

/* ─── Asset list ─────────────────────────────────────────────── */
.asset-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.asset-item:last-child { border-bottom: none; }
.asset-kind { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--muted); }

/* ─── Provisioning steps checklist ──────────────────────────── */
#provisioning-steps {
  /* Override the placeholder border once populated */
}

/* Step status badges — five valid statuses */
.step-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 80px;
  text-align: center;
}
.step-badge-pending    { background: #f1f5f9; color: var(--muted); }
.step-badge-dry_run_ok { background: #dbeafe; color: #1e40af; }
.step-badge-live_ok    { background: #dcfce7; color: var(--success); }
.step-badge-failed     { background: #fee2e2; color: var(--error); }
.step-badge-skipped    { background: #f1f5f9; color: #94a3b8; }

/* Step checklist row */
.step-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.step-row:last-child { border-bottom: none; }

.step-row-meta {
  flex: 1;
  min-width: 200px;
}
.step-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
}
.step-mode {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.step-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.step-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.step-btn:hover { background: var(--bg); border-color: var(--brand-navy); }
.step-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--bg);
}
.step-btn-primary {
  background: var(--brand-navy);
  color: white;
  border-color: var(--brand-navy);
}
.step-btn-primary:hover { background: var(--brand-navy-light); border-color: var(--brand-navy-light); }

/* Step output area — expands below the row */
.step-output {
  width: 100%;
  margin-top: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--body);
  white-space: pre-wrap;
  word-break: break-word;
  display: none;
}
.step-output.visible { display: block; }
.step-output-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 4px;
}

/* Step checklist legend */
.step-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  font-size: 12px;
  align-items: center;
  color: var(--muted);
}

/* Step loading/empty state */
.step-loading { color: var(--muted); font-size: 14px; padding: 16px 0; }

/* ─── Spinner ────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--brand-navy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
