/* ===========================================================
   Broker Platform – User Journey  |  Styles
   =========================================================== */

:root {
  /* Light theme */
  --bg: #f6f8fb;
  --bg-soft: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f9fbfd;
  --border: #e3e8ef;
  --text: #0f1b2d;
  --text-soft: #51607a;
  --text-muted: #8794a8;
  --primary: #2563eb;
  --primary-soft: #e0ecff;
  --primary-strong: #1d4ed8;
  --accent: #0ea5a4;
  --success: #16a34a;
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 27, 45, 0.08);
  --shadow-lg: 0 20px 48px rgba(15, 27, 45, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 290px;
}

[data-theme="dark"] {
  --bg: #0b1220;
  --bg-soft: #0e1626;
  --surface: #121c2e;
  --surface-2: #0f1828;
  --border: #21304a;
  --text: #eaf0f9;
  --text-soft: #aab6cb;
  --text-muted: #748099;
  --primary: #4f8cff;
  --primary-soft: #16263f;
  --primary-strong: #6aa0ff;
  --accent: #2dd4bf;
  --success: #34d399;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform 0.25s ease;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--border);
}

.brand-logo { display: block; color: var(--text); }
.brand-logo svg { width: 150px; height: 24px; display: block; }

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-sub {
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-muted);
  padding-left: 2px;
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav::-webkit-scrollbar { width: 8px; }
.nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover { background: var(--bg-soft); color: var(--text); }

.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 600;
}

.nav-num {
  flex: 0 0 auto;
  min-width: 26px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-soft);
  border-radius: 6px;
  padding: 2px 4px;
}

.nav-link.active .nav-num { background: #fff; color: var(--primary-strong); }
[data-theme="dark"] .nav-link.active .nav-num { background: var(--surface); }

.nav-sub { padding-left: 18px; font-size: 13px; }
.nav-sub .nav-num { background: transparent; }

.sidebar-foot { padding: 14px 16px; border-top: 1px solid var(--border); }

.theme-toggle-side {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-soft);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.theme-toggle-side:hover { background: var(--border); }

.theme-icon { width: 16px; height: 16px; display: inline-block; }
.theme-icon::before { content: "🌙"; font-size: 15px; }
[data-theme="dark"] .theme-icon::before { content: "☀️"; }

/* ---------- Topbar (mobile) ---------- */
.topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 60;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-weight: 700; flex: 1; }
.nav-toggle, .theme-toggle {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  cursor: pointer;
}
.nav-toggle span {
  display: block; width: 18px; height: 2px; margin: 2px 0;
  background: var(--text); border-radius: 2px;
}

.backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(7, 12, 22, 0.5);
  z-index: 45;
}
.backdrop.show { display: block; }

/* ---------- Content ---------- */
.content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 0 0 100px;
  max-width: calc(100% - var(--sidebar-w));
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 32px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 64px 32px 56px;
  background:
    radial-gradient(1200px 400px at 80% -10%, var(--primary-soft), transparent 60%),
    linear-gradient(180deg, var(--surface), var(--bg));
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.hero-inner { max-width: 980px; margin: 0 auto; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600;
  color: var(--primary-strong);
  background: var(--primary-soft);
  padding: 6px 12px; border-radius: 999px;
  margin-bottom: 18px;
}
.hero-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.hero h1 {
  margin: 0 0 6px;
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hero .hero-sub {
  margin: 0;
  font-size: clamp(17px, 2.5vw, 22px);
  font-weight: 600;
  color: var(--text-soft);
}

/* ---------- Summary ---------- */
.summary {
  margin-top: -28px;
  position: relative;
}
.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 26px 28px;
}
.summary-card h2 {
  margin: 0 0 12px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
}
.summary-card p { margin: 0 0 12px; color: var(--text-soft); }
.summary-card p:last-child { margin-bottom: 0; }

/* ---------- Section ---------- */
.section { padding-top: 56px; }
.section-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.section-num {
  flex: 0 0 auto;
  font-weight: 800; font-size: 15px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  min-width: 44px; height: 44px; padding: 0 10px;
  border-radius: 12px;
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
}
.section-title { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.section-purpose { margin: 4px 0 0; color: var(--text-soft); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px 26px;
}

.card + .card { margin-top: 18px; }

.label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-muted);
  margin: 0 0 12px;
}

/* ---------- Note / callout ---------- */
.note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--primary-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.note-icon { flex: 0 0 auto; font-size: 16px; line-height: 1.5; }
.note-text { margin: 0; color: var(--text); font-size: 14.5px; }
.note + .media-grid, .note + div { margin-top: 16px; }

/* ---------- Feature list ---------- */
.features { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.features li {
  display: flex; align-items: center; gap: 10px;
  font-size: 14.5px; color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.features li::before {
  content: "";
  flex: 0 0 auto;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary-soft);
  position: relative;
}
.features li .check {
  position: relative; margin-left: -23px; margin-right: 5px;
  width: 18px; height: 18px; display: inline-block;
}
.features li .check::after {
  content: ""; position: absolute; left: 6px; top: 3px;
  width: 4px; height: 8px;
  border: solid var(--primary-strong); border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ---------- Two-column section layout ---------- */
.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr);
  gap: 36px;
  align-items: start;
}
.section-grid--single { grid-template-columns: 1fr; }

.section-main { min-width: 0; display: flex; flex-direction: column; gap: 18px; }

.section-aside { position: sticky; top: 96px; min-width: 0; }
.aside-figure { margin: 0; }
.aside-figure img {
  width: 100%; height: auto; display: block;
  border-radius: var(--radius-sm);
}

/* Step buttons (accordion: description shows under the active step) */
.steps-controls { display: flex; flex-direction: column; }
.step-list { display: flex; flex-direction: column; gap: 8px; }

.step-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  transition: border-color 0.15s;
}
.step-item.active { border-color: var(--primary); }

.step-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--text-soft);
  background: transparent;
  border: 0;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.step-row:hover { background: var(--bg-soft); color: var(--text); }
.step-item.active .step-row {
  background: var(--primary-soft);
  color: var(--text);
}
.step-row-num {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--text-muted);
  font-size: 12px; font-weight: 700;
  text-transform: uppercase;
}
.step-item.active .step-row-num { background: var(--primary); color: #fff; }
.step-row-title { font-weight: 600; font-size: 14.5px; }

.step-row-desc {
  display: none;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-soft);
  padding: 12px 16px 14px;
  border-top: 1px solid var(--border);
}
.step-item.active .step-row-desc { display: block; }

/* ---------- Media ---------- */
.media-grid { display: grid; gap: 16px; grid-template-columns: 1fr; margin-top: 16px; }

.media-figure { margin: 0; }
.media-figure img, .media-figure video {
  width: 100%; height: auto; display: block;
  border-radius: var(--radius-sm);
}
.media-cap { margin-top: 8px; font-size: 12.5px; color: var(--text-muted); text-align: center; }

.placeholder {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background:
    repeating-linear-gradient(45deg, transparent, transparent 12px, var(--surface-2) 12px, var(--surface-2) 24px);
  min-height: 220px;
  display: grid; place-items: center; text-align: center;
  padding: 28px; gap: 8px;
  color: var(--text-muted);
  transition: border-color 0.15s, color 0.15s;
}
.placeholder:hover { border-color: var(--primary); color: var(--text-soft); }
.placeholder .ph-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 22px;
  box-shadow: var(--shadow-sm);
}
.placeholder .ph-title { font-weight: 600; color: var(--text-soft); font-size: 14px; }
.placeholder .ph-hint { font-size: 12px; }
.placeholder .ph-hint code {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 6px; padding: 1px 6px; font-size: 11.5px; color: var(--text-soft);
}

/* ---------- Subsections ---------- */
.subsections { margin-top: 20px; display: grid; gap: 18px; }
.subcard {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 20px 22px;
}
.subhead { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.sub-num {
  font-size: 12px; font-weight: 700; color: var(--primary-strong);
  background: var(--primary-soft); border-radius: 6px; padding: 3px 8px;
}
.sub-title { margin: 0; font-size: 17px; font-weight: 700; }
.sub-purpose { margin: 0 0 4px; color: var(--text-soft); font-size: 14px; }

/* ---------- Flow ---------- */
.flow { padding-top: 64px; }
.flow-card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 28px;
}
.flow-card h2 { margin: 0 0 4px; font-size: 22px; font-weight: 800; }
.flow-intro { margin: 0 0 22px; color: var(--text-soft); }

.flow-diagram { margin-top: 22px; }

/* Vertical timeline */
.vflow { list-style: none; margin: 0; padding: 0; }
.vflow-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 0;
}
.vflow-node {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 0 0 4px var(--surface);
}
/* connecting line between nodes */
.vflow-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 14px; top: 50%;
  width: 2px; height: 100%;
  background: var(--border);
  z-index: 0;
}
.vflow-label {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow-sm);
}
.vflow--accent .vflow-node { background: var(--accent); box-shadow: 0 0 0 4px var(--surface-2); }
.branch-col .vflow-label { background: var(--surface); }

/* Stage wrapper */
.flow-stage { padding: 4px 0; }
.flow-stage-title {
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 12px;
}

/* Connector label between stages */
.flow-connector {
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  margin: 8px 0;
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-muted);
}
.flow-connector::before,
.flow-connector::after {
  content: ""; height: 1px; flex: 1; background: var(--border);
}

/* Branch split */
.flow-split {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 18px;
  margin: 4px 0;
}
.branch-col {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  background: var(--surface-2);
}
.branch-label {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 12px;
}
.flow-or {
  align-self: center;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px; font-weight: 800; color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}

/* ---------- Footer ---------- */
.foot {
  margin-top: 64px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .topbar { display: flex; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-foot { display: none; }
  .content { margin-left: 0; max-width: 100%; }
  .wrap, .hero, .hero-inner, .summary-card { padding-left: 20px; padding-right: 20px; }
  .hero { padding-top: 40px; }
}

@media (max-width: 900px) {
  .section-grid { grid-template-columns: 1fr; gap: 22px; }
  .section-aside { position: static; }
}

@media (max-width: 720px) {
  .flow-split { grid-template-columns: 1fr; }
  .flow-or { justify-self: center; }
}

@media (max-width: 560px) {
  .section-num { min-width: 38px; height: 38px; font-size: 13px; }
  .section-title { font-size: 20px; }
  .card { padding: 18px; }
  .features { grid-template-columns: 1fr; }
}
