/* ============================================================
   RESET & TOKENS
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --purple:      #7C3AED;
  --purple-lt:   #EDE9FE;
  --purple-dk:   #5B21B6;
  --sky:         #0EA5E9;
  --sky-lt:      #E0F2FE;
  --green:       #10B981;
  --amber:       #F59E0B;
  --gray-50:     #F9FAFB;
  --gray-100:    #F3F4F6;
  --gray-200:    #E5E7EB;
  --gray-400:    #9CA3AF;
  --gray-600:    #4B5563;
  --gray-900:    #111827;
  --white:       #FFFFFF;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:   0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:   0 12px 40px rgba(0,0,0,.16);
  --header-h:    60px;
  --sidebar-w:   280px;
  --font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html { scroll-behavior: smooth; }
body { font-family: var(--font); color: var(--gray-900); background: var(--gray-50); line-height: 1.6; }

/* ============================================================
   SITE HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.site-header__inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.site-header__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: var(--gray-900);
  white-space: nowrap;
  text-decoration: none;
}

/* FLOW TABS (header nav) — hidden on desktop, shown only on tablet */
.flow-tabs {
  display: none;
  gap: 4px;
  background: var(--gray-100);
  border-radius: 10px;
  padding: 4px;
}
.flow-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--gray-600);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.flow-tab:hover { background: var(--white); color: var(--gray-900); }
.flow-tab.active {
  background: var(--white);
  color: var(--purple);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}
.flow-tab__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gray-200);
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-600);
  transition: background .15s, color .15s;
}
.flow-tab.active .flow-tab__num {
  background: var(--purple);
  color: var(--white);
}

/* ============================================================
   LAYOUT
   ============================================================ */
.layout {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - var(--header-h));
}

/* ============================================================
   SIDEBAR STEPPER
   ============================================================ */
.stepper {
  position: sticky;
  top: var(--header-h);
  width: var(--sidebar-w);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 16px 12px;
  border-right: 1px solid var(--gray-200);
  background: var(--white);
  flex-shrink: 0;
}

/* Filter input */
.sidebar-filter-wrap {
  position: relative;
  margin-bottom: 12px;
}
.sidebar-filter-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--gray-400);
  pointer-events: none;
}
.sidebar-filter {
  width: 100%;
  padding: 7px 28px 7px 28px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--gray-900);
  background: var(--gray-50);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.sidebar-filter:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124,58,237,.1);
  background: var(--white);
}
.sidebar-filter::-webkit-search-cancel-button { cursor: pointer; }
.stepper__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stepper__item {
  position: relative;
}
.stepper__btn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--gray-600);
  font-size: 13px;
  line-height: 1.4;
  transition: background .12s, color .12s;
}
.stepper__btn:hover { background: var(--gray-100); color: var(--gray-900); }
.stepper__btn.active {
  background: var(--purple-lt);
  color: var(--purple-dk);
  font-weight: 600;
}
.stepper__btn.done { color: var(--gray-900); }
.stepper__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
  background: var(--gray-200);
  color: var(--gray-600);
  transition: background .12s, color .12s;
}
.stepper__btn.active .stepper__num {
  background: var(--purple);
  color: var(--white);
}
.stepper__btn.done .stepper__num {
  background: var(--green);
  color: var(--white);
}

/* ============================================================
   CONTENT AREA
   ============================================================ */
.content {
  flex: 1;
  padding: 32px 48px 140px;
  min-width: 0;
}

.flow-panel { display: none; }
.flow-panel.active { display: block; }

.flow-intro {
  margin-bottom: 32px;
}
.flow-intro h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
}
.flow-intro p {
  font-size: 16px;
  color: var(--gray-600);
  max-width: 680px;
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--gray-400);
}
.breadcrumb__sep {
  color: var(--gray-300);
  font-size: 14px;
  line-height: 1;
  user-select: none;
}
.breadcrumb__item {
  color: var(--gray-400);
  text-decoration: none;
  border-radius: 4px;
  padding: 1px 2px;
  transition: color .12s;
  white-space: nowrap;
}
.breadcrumb__item:hover { color: var(--purple); }
.breadcrumb__item--current {
  color: var(--gray-600);
  font-weight: 500;
  pointer-events: none;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}
.breadcrumb__home {
  display: inline-flex;
  align-items: center;
  color: var(--gray-400);
  text-decoration: none;
  transition: color .12s;
}
.breadcrumb__home:hover { color: var(--purple); }

/* ============================================================
   STEP CARDS
   ============================================================ */
.step-card {
  display: none;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 0;
  box-shadow: var(--shadow-sm);
}
.step-card.active { display: block; }

.step-card__header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.step-card__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--purple);
  color: var(--white);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.step-card__title {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
}

.step-card__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}
.step-card__body--full {
  grid-template-columns: 1fr;
}
.step-card__text { font-size: 16px; line-height: 1.7; color: var(--gray-600); }
.step-card__text p { margin-bottom: 12px; }
.step-card__text p:last-child { margin-bottom: 0; }
.step-card__text ul, .step-card__text ol {
  padding-left: 20px;
  margin-bottom: 12px;
}
.step-card__text li { margin-bottom: 4px; }
.step-card__text strong { color: var(--gray-900); font-weight: 600; }
.step-card__text code {
  background: var(--gray-100);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12.5px;
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  color: var(--purple-dk);
}

/* Screenshot */
.step-card__screenshot {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--gray-200);
  cursor: zoom-in;
  transition: box-shadow .2s;
  background: var(--gray-100);
}
.step-card__screenshot:hover { box-shadow: var(--shadow-md); }
.step-card__screenshot img {
  width: 100%;
  height: auto;
  display: block;
}
.step-card__screenshot--placeholder {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--gray-400);
  font-size: 13px;
}
.step-card__screenshot-zoom {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,.55);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  opacity: 1;
  transition: background .2s, transform .15s;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.step-card__screenshot-zoom:hover { background: rgba(124,58,237,.85); transform: scale(1.05); }
.step-card__screenshot-caption {
  padding: 8px 12px;
  font-size: 11.5px;
  color: var(--gray-400);
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
}

/* Right column wrapper (screenshot + below-screenshot callouts) */
.step-card__right-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}
.step-card__below-screenshot {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.step-card__below-screenshot .pro-tip {
  margin: 0;
}

/* Pro tip */
.pro-tip {
  display: flex;
  gap: 10px;
  background: var(--sky-lt);
  border-left: 3px solid var(--sky);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 14px;
  margin-top: 16px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--gray-900);
}
.pro-tip__icon { flex-shrink: 0; font-size: 16px; }

/* Icon-label table (toolbar) */
.icon-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 12px 0; }
.icon-table th {
  text-align: left;
  padding: 6px 10px;
  background: var(--gray-100);
  color: var(--gray-600);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.icon-table td { padding: 8px 10px; border-bottom: 1px solid var(--gray-100); vertical-align: top; word-break: break-word; }
.icon-table tr:last-child td { border-bottom: none; }
.icon-table td:first-child { font-size: 16px; text-align: center; width: 44px; color: var(--gray-600); white-space: nowrap; }
.icon-table td:nth-child(2) { font-weight: 600; color: var(--gray-900); }

/* Component category grid */
.comp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.comp-chip {
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12.5px;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 6px;
}
.comp-chip--event { background: var(--purple-lt); color: var(--purple-dk); }
.comp-chip--reg { background: #FEF3C7; color: #92400E; }

/* ============================================================
   BOTTOM NAV
   ============================================================ */
.progress-wrap {
  flex: 1;
  height: 4px;
  background: var(--gray-200);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--purple);
  border-radius: 99px;
  transition: width .3s ease;
  width: 0%;
}
.flow-nav {
  position: sticky;
  bottom: 24px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 24px rgba(0,0,0,.10);
  margin-top: 32px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}
.btn--primary { background: var(--purple); color: var(--white); }
.btn--primary:hover { background: var(--purple-dk); }
.btn--ghost {
  background: transparent;
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
}
.btn--ghost:hover { background: var(--gray-100); color: var(--gray-900); }
.btn:disabled { opacity: .4; cursor: default; pointer-events: none; }

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 24px;
  border: none;
  background: rgba(0, 0, 0, .82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.lightbox::backdrop { display: none; }
.lightbox:not([open]) { display: none; }
.lightbox__close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: rgba(0,0,0,.5);
  border: none;
  color: white;
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  transition: background .15s;
}
.lightbox__close:hover { background: rgba(255,255,255,.3); }
.lightbox__img {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  object-fit: contain;
}
.lightbox__caption {
  color: rgba(255,255,255,.7);
  font-size: 13px;
  text-align: center;
  max-width: 600px;
}

/* ============================================================
   SIDEBAR GROUP ACCORDION (Component Library)
   ============================================================ */
.stepper__group-header { list-style: none; }
.stepper__group-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  margin: 4px 0 2px;
  border: none;
  border-radius: 6px;
  background: var(--gray-100, #f3f4f6);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-primary, #111827);
  transition: background 0.12s;
}
.stepper__group-btn:hover { background: #e5e7eb; }
.stepper__group-header.active .stepper__group-btn { background: #ede9fe; color: var(--accent, #7C3AED); }
.stepper__group-label { display: flex; align-items: center; gap: 6px; }
.stepper__group-icon { font-size: 14px; }
.stepper__group-arrow {
  font-size: 10px;
  opacity: 0.6;
  display: inline-block;
  transition: transform 0.28s ease;
}
.stepper__group-btn.expanded .stepper__group-arrow { transform: rotate(90deg); }

.stepper__group-items-li { list-style: none; }
.stepper__group-items {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s ease;
}
.stepper__group-items.expanded { grid-template-rows: 1fr; }
.stepper__group-items-inner { overflow: hidden; list-style: none; margin: 0; padding: 0; }

.stepper__item--sub .stepper__btn { padding-left: 24px; font-size: 12px; }

/* ============================================================
   COMPONENT LIBRARY SUB-TABS (kept for legacy, hidden)
   ============================================================ */
.comp-sub-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0 0 24px;
  padding: 0 40px;
}
.comp-sub-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.comp-sub-tab:hover {
  border-color: var(--accent);
  background: var(--bg);
}
.comp-sub-tab.active {
  border-color: var(--accent);
  background: #f5f3ff;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
.comp-sub-tab__icon { font-size: 28px; flex-shrink: 0; }
.comp-sub-tab__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.comp-sub-tab__label { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.comp-sub-tab__desc  { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }
.comp-sub-tab__count { font-size: 22px; font-weight: 700; color: var(--accent); flex-shrink: 0; line-height: 1; }

/* ============================================================
   COMPONENT CATEGORY BADGES
   ============================================================ */
.comp-category-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
}
.comp-category-badge--event   { background: #dbeafe; color: #1e40af; }
.comp-category-badge--layout  { background: #f3e8ff; color: #6d28d9; }
.comp-category-badge--basic   { background: #d1fae5; color: #065f46; }
.comp-category-badge--reg     { background: #fee2e2; color: #991b1b; }

/* ============================================================
   FIELD REFERENCE ACCORDIONS (Flow 4 Site Settings)
   ============================================================ */
.field-group {
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 8px;
  margin: 12px 0;
  overflow: hidden;
}
.field-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  list-style: none;
  background: var(--gray-50, #f9fafb);
  user-select: none;
}
.field-group > summary::-webkit-details-marker { display: none; }
.field-group > summary::after {
  content: '▸';
  font-size: 10px;
  opacity: 0.5;
  transition: transform 0.2s ease;
}
.field-group[open] > summary { border-bottom: 1px solid var(--gray-200, #e5e7eb); background: #fff; }
.field-group[open] > summary::after { transform: rotate(90deg); }
.field-group__body { padding: 4px 0; }
.field-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 4px 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-100, #f3f4f6);
  align-items: start;
}
.field-row:last-child { border-bottom: none; }
.field-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #111827);
  line-height: 1.4;
}
.field-token {
  display: block;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 10px;
  color: var(--gray-400, #9ca3af);
  margin-top: 2px;
}
.field-desc {
  font-size: 13px;
  color: var(--text-secondary, #4b5563);
  line-height: 1.55;
}
.field-desc strong { color: var(--text-primary, #111827); }
.field-section-intro {
  font-size: 13px;
  color: var(--text-secondary, #4b5563);
  line-height: 1.6;
  padding: 0 0 8px;
  margin: 0;
}

/* ============================================================
   SEARCH
   ============================================================ */
.search-wrap {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}
.search-input {
  width: 200px;
  padding: 7px 12px 7px 32px;
  border: 1.5px solid var(--gray-200, #e5e7eb);
  border-radius: 8px;
  font-size: 13px;
  color: var(--gray-900, #111827);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 10px center;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
  width: 260px;
}
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 340px;
  background: #fff;
  border: 1.5px solid var(--gray-200, #e5e7eb);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 200;
  overflow: hidden;
}
.search-result-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-100, #f3f4f6);
  transition: background 0.1s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover,
.search-result-item--active { background: #f5f3ff; }
.search-result-item__flow {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7c3aed;
}
.search-result-item__title {
  font-size: 13px;
  color: var(--gray-900, #111827);
  font-weight: 500;
}
.search-results__empty {
  padding: 14px;
  font-size: 13px;
  color: var(--gray-500, #6b7280);
  text-align: center;
}
mark.search-highlight {
  background: #fde68a;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
  font-weight: inherit;
  animation: highlight-pulse 0.4s ease;
}
@keyframes highlight-pulse {
  0%   { background: #f59e0b; }
  100% { background: #fde68a; }
}

/* ============================================================
   MEDIA PRIVACY NOTE
   ============================================================ */
.media-privacy-note {
  margin: 16px 0;
  padding: 16px 18px;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-left: 4px solid #10B981;
  border-radius: var(--radius-md);
}
.media-privacy-note__heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #065F46;
  margin-bottom: 10px;
}
.media-privacy-note ul {
  padding-left: 18px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.media-privacy-note li {
  font-size: 14px;
  line-height: 1.6;
  color: #064E3B;
}

/* ============================================================
   FAQ LIST
   ============================================================ */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.faq-item {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--white);
}
.faq-item[open] {
  border-color: var(--purple);
}
.faq-item--warning[open] {
  border-color: var(--amber);
  background: #FFFBEB;
}
.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.faq-question::-webkit-details-marker { display: none; }
.faq-question::after {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: var(--gray-200) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 3.5l3 3 3-3' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' fill='none'/%3E%3C/svg%3E") center/10px no-repeat;
  border-radius: 50%;
  transition: transform .2s ease, background-color .15s;
}
.faq-item[open] .faq-question::after {
  transform: rotate(180deg);
  background-color: var(--purple-lt);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 3.5l3 3 3-3' stroke='%237C3AED' stroke-width='1.5' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");
}
.faq-item--warning[open] .faq-question::after {
  background-color: #FEF3C7;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 3.5l3 3 3-3' stroke='%23D97706' stroke-width='1.5' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");
}
.faq-answer {
  padding: 0 20px 16px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--gray-600);
  border-top: 1px solid var(--gray-100);
  padding-top: 14px;
}
.faq-item--warning[open] .faq-question {
  color: #92400E;
}
.faq-item--warning .faq-answer {
  color: #78350F;
}

/* ============================================================
   TIPS LIST
   ============================================================ */
.tips-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tips-list li {
  padding: 12px 14px;
  background: var(--gray-50, #f9fafb);
  border-left: 3px solid #7c3aed;
  border-radius: 0 8px 8px 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--gray-800, #1f2937);
}
.tips-list li strong { color: var(--gray-900, #111827); }

/* ============================================================
   HAMBURGER BUTTON (hidden on desktop)
   ============================================================ */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: background .15s;
}
.hamburger-btn:hover { background: var(--gray-100); }
.hamburger-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--gray-600);
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
.hamburger-btn[aria-expanded="true"] .hamburger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger-btn[aria-expanded="true"] .hamburger-bar:nth-child(2) {
  opacity: 0;
}
.hamburger-btn[aria-expanded="true"] .hamburger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================
   MOBILE NAV DRAWER
   ============================================================ */
.mobile-nav {
  display: none;
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  z-index: 99;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-md);
  flex-direction: column;
  padding: 8px 0;
  transform: translateY(-8px);
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
  pointer-events: none;
}
.mobile-nav.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
/* Section header row */
.mobile-nav-section {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 20px;
  border: none;
  background: transparent;
  color: var(--gray-700, #374151);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .12s, color .12s;
}
.mobile-nav-section:hover { background: var(--gray-50); color: var(--gray-900); }
.mobile-nav-section.active {
  color: var(--purple);
  font-weight: 600;
}
.mobile-nav-section .flow-tab__num {
  background: var(--gray-200);
  color: var(--gray-600);
  flex-shrink: 0;
}
.mobile-nav-section.active .flow-tab__num {
  background: var(--purple);
  color: var(--white);
}
.mobile-nav-section__label { flex: 1; }
.mobile-nav-chevron {
  flex-shrink: 0;
  color: var(--gray-400);
  transition: transform .2s ease;
}
.mobile-nav-section.active .mobile-nav-chevron,
.mobile-nav-section[aria-expanded="true"] .mobile-nav-chevron {
  transform: rotate(180deg);
  color: var(--purple);
}

/* Steps sub-list */
.mobile-nav-steps {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
  background: var(--gray-50);
  border-top: 1px solid transparent;
}
.mobile-nav-steps.open {
  max-height: 600px;
  border-top-color: var(--gray-100);
}
.mobile-nav-step {
  display: block;
  width: 100%;
  padding: 9px 20px 9px 52px;
  border: none;
  background: transparent;
  color: var(--gray-600);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  text-align: left;
  transition: background .1s, color .1s;
  border-bottom: 1px solid var(--gray-100);
}
.mobile-nav-step:last-child { border-bottom: none; }
.mobile-nav-step:hover {
  background: var(--white);
  color: var(--purple);
}

.mobile-nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 98;
  background: rgba(0,0,0,.25);
}
.mobile-nav-backdrop.open { display: block; }

/* ============================================================
   SIDEBAR GROUP HEADERS (2nd level — Component Library & Site Settings)
   ============================================================ */
.sidebar-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% - 12px);
  padding: 4px 8px 4px 12px;
  margin: 6px 0 2px 12px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  transition: color .1s;
}
.sidebar-group-header:hover { color: var(--gray-600); }
.sidebar-group-header.expanded { color: var(--purple-dk); }

/* Rotate chevron: closed = pointing right, open = pointing down */
.sidebar-group-header .sidebar-flow-chevron {
  transform: rotate(-90deg);
  transition: transform .2s ease;
  flex-shrink: 0;
}
.sidebar-group-header.expanded .sidebar-flow-chevron { transform: rotate(0deg); }

.sidebar-group-label { flex: 1; }

.sidebar-group-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
}
.sidebar-group-items.open { max-height: 800px; }

/* ============================================================
   SIDEBAR FLOW TOGGLES (desktop only) — Document360 tree style
   ============================================================ */
.sidebar-flows {
  display: flex;
  flex-direction: column;
}

/* Top-level section row (rendered as <a> for deep-linkability) */
.sidebar-flow-section {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--gray-800);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  transition: background .1s, color .1s;
}
.sidebar-flow-section:hover { background: var(--gray-100); }
.sidebar-flow-section.active { color: var(--purple-dk); font-weight: 600; }
.sidebar-flow-section .flow-tab__num { display: none; }
.sidebar-flow-section__label { flex: 1; }
.sidebar-flow-chevron {
  flex-shrink: 0;
  color: var(--gray-400);
  font-size: 10px;
  transition: transform .2s ease;
}
.sidebar-flow-section[aria-expanded="true"] .sidebar-flow-chevron {
  transform: rotate(180deg);
  color: var(--gray-600);
}

/* Steps sub-list */
.sidebar-flow-steps {
  max-height: 0;
  overflow: hidden;
  transition: max-height .28s ease;
}
.sidebar-flow-steps.open { max-height: 1200px; }

.sidebar-flow-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 5px 8px 5px 20px;
  border: none;
  border-left: 2px solid var(--gray-200);
  margin-left: 12px;
  background: transparent;
  color: var(--gray-600);
  font-size: 12.5px;
  font-weight: 400;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: color .1s, border-color .1s;
}
.sidebar-flow-step:hover { color: var(--gray-900); border-left-color: var(--gray-400); }
.sidebar-flow-step.active {
  color: var(--purple-dk);
  font-weight: 600;
  border-left-color: var(--purple);
}
.sidebar-flow-step.done { color: var(--gray-700); }

/* Step number badge */
.sidebar-flow-step .stepper__num {
  background: var(--gray-200);
  color: var(--gray-600);
  flex-shrink: 0;
  font-size: 10px;
  width: 16px;
  height: 16px;
  margin-top: 2px;
}
.sidebar-flow-step.active .stepper__num {
  background: var(--purple);
  color: var(--white);
}
.sidebar-flow-step.done .stepper__num {
  background: var(--green);
  color: var(--white);
}

/* ============================================================
   RESPONSIVE — TABLET
   ============================================================ */
@media (max-width: 960px) {
  .stepper { display: none; }
  .content { padding: 24px 20px; }
  .step-card__body { grid-template-columns: 1fr; }
  .flow-tabs { display: flex; overflow-x: auto; }
  .flow-tab { font-size: 12.5px; padding: 6px 12px; }
}

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */
@media (max-width: 640px) {
  /* Single-row header */
  :root { --header-h: 56px; }

  .site-header__inner {
    padding: 0 12px 0 16px;
    gap: 8px;
  }

  /* Hide desktop tabs, show hamburger */
  .flow-tabs { display: none; }
  .hamburger-btn { display: flex; }

  /* Show mobile drawer */
  .mobile-nav { display: flex; }

  /* Shrink search input */
  .search-wrap { margin-left: auto; }
  .search-input { width: 120px; font-size: 12px; }
  .search-input:focus { width: 140px; }

  .search-results {
    top: calc(100% + 4px);
    width: 280px;
    right: 0;
  }

  /* Main layout */
  .layout { grid-template-columns: 1fr; }
  .stepper { display: none; }
  .content { padding: 16px 16px 90px; }
  /* Step card */
  .step-card { padding: 16px; border-radius: 10px; }
  .step-card__body { grid-template-columns: 1fr; gap: 16px; }
  .step-card__header { gap: 10px; margin-bottom: 12px; }
  .step-card__badge { width: 28px; height: 28px; font-size: 12px; min-width: 28px; }
  .step-card__title { font-size: 16px; }
  .step-card__text { font-size: 13px; }

  /* Screenshot fills width */
  .step-card__screenshot { margin-top: 0; }
  .step-card__right-col { display: flex; flex-direction: column; gap: 12px; }

  /* Nav */
  .flow-nav { padding: 12px 16px; margin: 0; gap: 8px; }
  .btn { padding: 8px 14px; font-size: 13px; }
  .progress-wrap { flex: 1; }

  /* Flow intro */
  .flow-intro { padding: 16px 0 8px; }
  .flow-intro h1 { font-size: 20px; }
  .flow-intro p { font-size: 13px; }

  /* Tables scroll horizontally */
  .icon-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; font-size: 12px; }

  /* Field groups */
  .field-row { grid-template-columns: 1fr; gap: 2px; }
  .field-name { font-size: 12px; padding-bottom: 2px; }
  .field-desc { font-size: 12.5px; }

  /* Pro tip */
  .pro-tip { font-size: 12.5px; padding: 10px 12px; }

  /* Tips list */
  .tips-list li { font-size: 13px; }
}
