/* ===========================================================================
   PROOViD AML Onboarding Wizard
   Self-contained styles. No external fonts/CDNs.
   =========================================================================== */

:root {
  /* Palette — deep slate + a controlled compliance teal/indigo accent */
  --bg: #0d1117;
  --bg-grad-a: #0e1622;
  --bg-grad-b: #0a0e14;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #eef2f7;
  --ink: #16202e;
  --ink-soft: #44546a;
  --ink-faint: #76859a;
  --line: #dfe5ee;
  --line-strong: #c6d0de;

  --accent: #1f6feb;
  --accent-deep: #1452c4;
  --accent-tint: #e9f1ff;
  --accent-2: #0fb5a6;

  --danger: #c4314b;
  --danger-tint: #fdecef;
  --warn: #9a6700;
  --warn-tint: #fff6e0;
  --ok: #1a7f55;
  --ok-tint: #e6f6ee;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 50px -22px rgba(13, 24, 41, 0.55);
  --shadow-sm: 0 2px 6px -2px rgba(13, 24, 41, 0.18);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;

  --maxw: 1120px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(31, 111, 235, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(15, 181, 166, 0.12), transparent 55%),
    linear-gradient(160deg, var(--bg-grad-a), var(--bg-grad-b));
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  padding: clamp(16px, 4vw, 48px);
}

/* ============ Shell layout ============ */
.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 290px 1fr;
  background: var(--surface);
  border-radius: calc(var(--radius) + 6px);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ============ Sidebar ============ */
.sidebar {
  background: linear-gradient(180deg, #101a2b, #0c1320);
  color: #cdd8e8;
  padding: 30px 26px;
  display: flex;
  flex-direction: column;
  gap: 34px;
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(150deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 8px 22px -8px rgba(31, 111, 235, 0.7);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: 0.2px; color: #fff; }
.brand-sub { font-size: 0.74rem; letter-spacing: 1.4px; text-transform: uppercase; color: #8493ac; }

/* Stepper */
.stepper ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.step {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 12px;
  border-radius: 11px;
  position: relative;
  transition: background 0.18s ease;
}
.step::after {
  content: ""; position: absolute; left: 27px; top: 46px; bottom: -4px;
  width: 2px; background: rgba(255, 255, 255, 0.08);
}
.step:last-child::after { display: none; }
.step-dot {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  font-size: 0.82rem; font-weight: 600;
  color: #aebbcf;
  transition: all 0.2s ease;
}
.step-label { display: flex; flex-direction: column; line-height: 1.25; }
.step-label strong { font-size: 0.9rem; font-weight: 600; color: #d7e0ee; }
.step-label em { font-style: normal; font-size: 0.74rem; color: #7d8ca3; }

.step.is-active { background: rgba(31, 111, 235, 0.16); }
.step.is-active .step-dot {
  background: linear-gradient(150deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px -6px rgba(31, 111, 235, 0.8);
}
.step.is-active .step-label strong { color: #fff; }
.step.is-done .step-dot {
  background: rgba(15, 181, 166, 0.2);
  border-color: var(--accent-2); color: var(--accent-2);
}

.sidebar-foot {
  margin-top: auto;
  font-size: 0.74rem;
  color: #6f7e96;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-top: 16px;
}
.sidebar-foot p { margin: 0; }
.sidebar-links {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #9fb2cf;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}
.sidebar-links a:hover,
.sidebar-links a:focus-visible { color: #fff; }
.sidebar-links svg { flex: 0 0 auto; opacity: 0.85; }

.hint-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
.hint-link:hover,
.hint-link:focus-visible { text-decoration: underline; }

/* ============ Content ============ */
.content { padding: clamp(22px, 3vw, 38px); display: flex; flex-direction: column; gap: 22px; min-width: 0; }

/* Config bar */
.config-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ============ Fields ============ */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > legend {
  font-size: 0.83rem; font-weight: 600; color: var(--ink-soft);
  padding: 0;
}
.req { color: var(--danger); }
.optional { color: var(--ink-faint); font-weight: 400; }

input[type="text"], input[type="email"], input[type="url"], input[type="password"], select {
  width: 100%;
  padding: 11px 13px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2344546a' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
input.invalid, select.invalid { border-color: var(--danger); }
input.invalid:focus, select.invalid:focus { box-shadow: 0 0 0 3px var(--danger-tint); }

.hint { font-size: 0.76rem; color: var(--ink-faint); }
.error { font-size: 0.78rem; color: var(--danger); min-height: 0; }
.error:empty { display: none; }

.input-affix { position: relative; display: flex; }
.input-affix input { padding-right: 64px; }
.affix-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: none; background: var(--surface-3); color: var(--ink-soft);
  font-size: 0.76rem; font-weight: 600; cursor: pointer;
  padding: 6px 10px; border-radius: 7px;
}
.affix-btn:hover { background: var(--line); }

.config-field label { font-size: 0.8rem; }

/* ============ Panels ============ */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 2.6vw, 30px);
  animation: fade 0.25s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel-head { margin-bottom: 22px; }
.panel-head h1 { font-size: 1.32rem; margin: 0 0 5px; letter-spacing: -0.2px; }
.panel-head p { margin: 0; color: var(--ink-soft); font-size: 0.92rem; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* Checkboxes */
fieldset { border: none; margin: 0; padding: 0; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.check {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.check:hover { border-color: var(--accent); }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check-box {
  flex: 0 0 auto;
  width: 20px; height: 20px;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  display: grid; place-items: center;
  transition: all 0.15s ease;
}
.check-box::after {
  content: ""; width: 10px; height: 6px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0); transform-origin: center;
  margin-top: -2px; transition: transform 0.15s ease;
}
.check input:checked + .check-box {
  background: var(--accent); border-color: var(--accent);
}
.check input:checked + .check-box::after { transform: rotate(-45deg) scale(1); }
.check input:focus-visible + .check-box { box-shadow: 0 0 0 3px var(--accent-tint); }
.check:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }
.check-text { display: flex; flex-direction: column; line-height: 1.2; }
.check-text strong { font-size: 0.9rem; }
.check-text em { font-style: normal; font-size: 0.74rem; color: var(--ink-faint); }

/* Slider */
.slider-field { margin-top: 22px; }
.slider-row { display: flex; align-items: center; gap: 18px; }
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 6px; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) var(--fill, 85%), var(--surface-3) var(--fill, 85%));
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent);
  box-shadow: var(--shadow-sm); cursor: grab;
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent); cursor: grab;
}
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-tint); }
.slider-out {
  font-family: var(--mono); font-size: 1rem; font-weight: 600;
  min-width: 58px; text-align: center;
  padding: 7px 10px; border-radius: 9px;
  background: var(--accent-tint); color: var(--accent-deep);
}
.slider-scale { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--ink-faint); margin-top: 8px; }

/* Notes */
.note {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-soft); font-size: 0.86rem; margin-top: 18px;
}
.note svg { flex: 0 0 auto; margin-top: 1px; color: var(--ink-faint); }
.note p { margin: 0; }
.note.warn { background: var(--warn-tint); border-color: #f0dca0; color: #6f4d00; }
.note.warn svg { color: var(--warn); }
.note.warn.strong { border-width: 1.5px; }

/* Review list */
.review { display: grid; grid-template-columns: 180px 1fr; gap: 0; margin: 0; }
.review dt, .review dd {
  padding: 12px 4px; border-bottom: 1px solid var(--line); margin: 0;
}
.review dt { color: var(--ink-soft); font-weight: 600; font-size: 0.86rem; }
.review dd { font-size: 0.92rem; word-break: break-word; }
.review.compact { margin-top: 22px; }
.tagrow { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 0.74rem; font-weight: 600;
  padding: 3px 9px; border-radius: 99px;
  background: var(--accent-tint); color: var(--accent-deep);
}
.muted { color: var(--ink-faint); }

/* Submit error banner */
.banner {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--danger-tint);
  border: 1.5px solid #f1bcc6;
  border-radius: var(--radius-sm);
  color: #8c1f33;
  font-size: 0.88rem;
}
.banner strong { display: block; margin-bottom: 2px; }

/* ============ Actions ============ */
.actions { display: flex; align-items: center; gap: 12px; margin-top: 26px; }
.spacer { flex: 1; }
.btn {
  font-family: inherit; font-size: 0.92rem; font-weight: 600;
  padding: 11px 22px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid transparent;
  display: inline-flex; align-items: center; gap: 9px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-deep); }
.btn.primary:disabled { background: var(--line-strong); color: var(--surface); cursor: not-allowed; }
.btn.ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink-soft); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--ink-faint); }
.btn.copy {
  background: var(--surface-3); color: var(--ink-soft);
  padding: 9px 16px; font-size: 0.84rem; border-color: var(--line);
}
.btn.copy:hover { background: var(--line); }
.btn.copy.copied { background: var(--ok-tint); color: var(--ok); border-color: #aedcc4; }

/* Spinner */
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45); border-top-color: #fff;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn.is-loading .spinner { display: inline-block !important; }
.btn.is-loading { pointer-events: none; opacity: 0.9; }

/* ============ Success screen ============ */
.success .panel-head { text-align: left; }
.success-badge {
  width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center; margin-bottom: 14px;
  background: var(--ok-tint); color: var(--ok);
}
.cred { margin-top: 16px; }
.cred-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.cred-row { display: flex; gap: 10px; align-items: stretch; }
.cred-value {
  flex: 1; min-width: 0;
  font-family: var(--mono); font-size: 0.9rem;
  padding: 11px 13px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1.5px solid var(--line);
  overflow-x: auto; white-space: nowrap; display: flex; align-items: center;
}
.cred.secret .cred-value {
  background: #0e1622; color: #9be7dd; border-color: #1c2a3e;
}

/* ============ Toast ============ */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(12px);
  background: #16202e; color: #fff;
  padding: 12px 20px; border-radius: 11px;
  font-size: 0.88rem; font-weight: 500;
  box-shadow: var(--shadow); opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ Responsive ============ */
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 18px; padding: 22px 24px; }
  .stepper { flex: 1; }
  .stepper ol { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .step::after { display: none; }
  .step { padding: 8px 10px; }
  .step-label em { display: none; }
  .sidebar-foot { flex-basis: 100%; border-top: none; padding-top: 0; }
}
@media (max-width: 620px) {
  body { padding: 0; }
  .shell { border-radius: 0; min-height: 100vh; }
  .config-bar { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .checks { grid-template-columns: 1fr; }
  .review { grid-template-columns: 1fr; }
  .review dt { border-bottom: none; padding-bottom: 0; }
  .review dd { padding-top: 4px; }
  .step-label strong { font-size: 0.82rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
