/* ── CAPI Design System (Merged v2 + functional components) ── */

:root {
    --rail-w: 272px;
    --nav-h: 48px;
    --sub-h: 89px;
    --green: #1B5E38;
    --green-bg: #EBF4EE;
    --green-text: #1B5E38;
    --ground: #F6F8FA;
    --surface: #FFFFFF;
    --border: #D0D7DE;
    --border-light: #E8EAED;
    --text: #1F2328;
    --text-2: #656D76;
    --text-3: #8C959F;
    --tab-active: #1B5E38;
    --nav-bg: #1B2330;
    --nav-text: rgba(255,255,255,0.72);
    --nav-text-active: #FFFFFF;
    --badge-shipped-bg: #DAFBE1; --badge-shipped-text: #116329;
    --badge-progress-bg: #DDF4FF; --badge-progress-text: #0550AE;
    --badge-planned-bg: #F1F0FF; --badge-planned-text: #5435CA;
    --badge-flagged-bg: #FFECCC; --badge-flagged-text: #7D4E17;
    --avatar-1: #1B5E38; --avatar-2: #0550AE; --avatar-3: #8250DF; --avatar-4: #CF222E;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --ground: #161B22; --surface: #0D1117; --border: #30363D; --border-light: #21262D;
      --text: #E6EDF3; --text-2: #8B949E; --text-3: #6E7681;
      --green-bg: #0D2818; --green-text: #56D364; --tab-active: #56D364;
      --nav-bg: #010409;
      --badge-shipped-bg: #0D2818; --badge-shipped-text: #56D364;
      --badge-progress-bg: #051D4D; --badge-progress-text: #58A6FF;
      --badge-planned-bg: #1A1035; --badge-planned-text: #BC8CFF;
      --badge-flagged-bg: #2D1800; --badge-flagged-text: #E3A341;
    }
  }
  :root[data-theme="light"] {
    --ground: #F6F8FA; --surface: #FFFFFF; --border: #D0D7DE; --border-light: #E8EAED;
    --text: #1F2328; --text-2: #656D76; --text-3: #8C959F;
    --green: #1B5E38; --green-bg: #EBF4EE; --green-text: #1B5E38; --tab-active: #1B5E38;
    --nav-bg: #1B2330; --nav-text: rgba(255,255,255,0.72); --nav-text-active: #FFFFFF;
    --badge-shipped-bg: #DAFBE1; --badge-shipped-text: #116329;
    --badge-progress-bg: #DDF4FF; --badge-progress-text: #0550AE;
    --badge-planned-bg: #F1F0FF; --badge-planned-text: #5435CA;
    --badge-flagged-bg: #FFECCC; --badge-flagged-text: #7D4E17;
  }
  :root[data-theme="dark"] {
    --ground: #161B22; --surface: #0D1117; --border: #30363D; --border-light: #21262D;
    --text: #E6EDF3; --text-2: #8B949E; --text-3: #6E7681;
    --green-bg: #0D2818; --green-text: #56D364; --tab-active: #56D364;
    --nav-bg: #010409;
    --badge-shipped-bg: #0D2818; --badge-shipped-text: #56D364;
    --badge-progress-bg: #051D4D; --badge-progress-text: #58A6FF;
    --badge-planned-bg: #1A1035; --badge-planned-text: #BC8CFF;
    --badge-flagged-bg: #2D1800; --badge-flagged-text: #E3A341;
  }

  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--ground);
    min-height: 100vh;
  }

  /* ── Top navbar ── */
  .topnav {
    background: var(--nav-bg);
    height: var(--nav-h);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .topnav-inner {
    max-width: 1280px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    gap: 24px;
  }
  .topnav-left { display: flex; align-items: center; gap: 4px; }
  .topnav-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

  .logo-mark {
    width: 28px; height: 28px;
    background: var(--green);
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; color: #fff;
    font-family: ui-monospace, monospace;
    flex-shrink: 0;
    margin-right: 6px;
  }
  .product-name {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin-right: 20px;
    letter-spacing: -0.01em;
  }

  .topnav-items { display: flex; align-items: center; gap: 2px; }
  .topnav-item {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--nav-text);
    cursor: pointer;
    text-decoration: none;
    transition: color 0.1s, background 0.1s;
    white-space: nowrap;
    user-select: none;
  }
  .topnav-item:hover { color: var(--nav-text-active); background: rgba(255,255,255,0.08); }
  .topnav-item.active { color: var(--nav-text-active); background: rgba(255,255,255,0.1); }
  .topnav-item svg { width: 15px; height: 15px; stroke-width: 1.6; flex-shrink: 0; }
  .nav-count {
    font-size: 10px;
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
    border-radius: 20px;
    padding: 0 5px;
    min-width: 16px;
    text-align: center;
    line-height: 16px;
    font-weight: 600;
  }
  .topnav-item.active .nav-count { background: var(--green); color: #fff; }

  .nav-divider-v { width: 1px; height: 20px; background: rgba(255,255,255,0.12); margin: 0 6px; }

  .org-pill {
    display: flex; align-items: center; gap: 7px;
    padding: 4px 10px 4px 6px;
    border-radius: 20px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    cursor: pointer;
    transition: background 0.1s;
  }
  .org-pill:hover { background: rgba(255,255,255,0.13); }
  .org-avatar {
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--green);
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 700; color: #fff;
  }
  .org-label { font-size: 12px; color: rgba(255,255,255,0.8); font-weight: 500; }
  .user-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: #0550AE;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #fff;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.2);
    transition: border-color 0.1s;
  }
  .user-avatar:hover { border-color: rgba(255,255,255,0.5); }

  /* ── User dropdown ── */
  .user-menu-wrap {
    position: relative;
  }
  .user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    width: 210px;
    z-index: 200;
    overflow: hidden;
  }
  .user-dropdown.open { display: block; }
  .user-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
  }
  .user-dropdown-name { font-weight: 600; font-size: 13px; color: var(--text); }
  .user-dropdown-email { font-size: 12px; color: var(--text-3); margin-top: 1px; }
  .user-dropdown-items { padding: 4px 0; }
  .user-dropdown-item {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 8px 16px;
    font-size: 13px; color: var(--text);
    background: none; border: none;
    cursor: pointer; text-decoration: none;
    transition: background 0.1s;
    text-align: left;
  }
  .user-dropdown-item svg { width: 14px; height: 14px; stroke-width: 1.6; flex-shrink: 0; opacity: 0.7; }
  .user-dropdown-item:hover { background: var(--ground); }
  .user-dropdown-item--danger { color: #CF222E; }
  .user-dropdown-item--danger svg { opacity: 1; }

  /* ── Project sub-header ── */
  .project-subheader {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: var(--nav-h);
    z-index: 90;
  }
  .subheader-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
  }
  .breadcrumb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 0 12px;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-2);
  }
  .breadcrumb-link {
    color: var(--tab-active);
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
  }
  .breadcrumb-link:hover { text-decoration: underline; }
  .breadcrumb-sep { color: var(--text-3); font-weight: 400; }
  .breadcrumb-current { color: var(--text); font-weight: 600; }
  .project-meta { display: flex; align-items: center; gap: 10px; }

  .project-tabs {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    overflow: visible;
  }

  /* single tab (no dropdown) — styled like a browser tab: a card that sits
     on the subheader's bottom border, punching through it when active so
     the active tab reads as fused to the page content beneath it. */
  .ptab-group {
    position: relative;
    display: inline-flex;
  }
  .ptab-group-label {
    display: flex; align-items: center; gap: 5px;
    padding: 10px 18px;
    font-size: 13px; font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    margin-bottom: -1px;
    user-select: none;
    white-space: nowrap;
    transition: color 0.1s, background 0.1s;
    text-decoration: none;
    background: transparent;
  }
  .ptab-group-label svg { width: 12px; height: 12px; stroke-width: 1.8; opacity: 0.6; }
  .ptab-group:hover > .ptab-group-label { color: var(--text); background: var(--border-light); }
  .ptab-group.active > .ptab-group-label {
    color: var(--text);
    background: var(--ground);
    border-color: var(--border);
    border-bottom-color: var(--ground);
    box-shadow: inset 0 2px 0 var(--tab-active);
  }

  /* dropdown that appears on hover */
  .ptab-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 120;
    min-width: 160px;
    padding: 4px;
  }
  .ptab-group:hover .ptab-dropdown { display: block; }
  .ptab-dropdown-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 7px 12px;
    font-size: 13px; color: var(--text);
    cursor: pointer; border-radius: 4px;
    text-decoration: none; user-select: none;
    transition: background 0.1s;
  }
  .ptab-dropdown-item:hover { background: var(--ground); }
  .ptab-dropdown-item.active { font-weight: 600; }
  .ptab-dropdown-item.disabled { color: var(--text-3); cursor: default; pointer-events: none; }

  .ptab-count {
    font-size: 11px;
    background: var(--border-light);
    color: var(--text-2);
    border-radius: 20px;
    padding: 0 6px; font-weight: 500;
    min-width: 18px; text-align: center; line-height: 18px;
  }
  .ptab-group.active .ptab-count { background: var(--green); color: #fff; }
  .ptab-dropdown-item.active .ptab-count { background: var(--green); color: #fff; }

  /* ── Page banner ── */
  .page-banner {
    background: #1B2330;
    color: rgba(255,255,255,0.7);
    font-size: 12px;
    padding: 6px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .banner-dot { width: 6px; height: 6px; border-radius: 50%; background: #3FB950; flex-shrink: 0; }
  .banner-tag { color: #3FB950; font-weight: 600; }

  /* ── Content wrapper ── */
  .content-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 20px 64px;
  }

  /* ── Two-col layout ── */
  .content-grid {
    display: grid;
    grid-template-columns: 1fr var(--rail-w);
    gap: 24px;
    align-items: start;
  }
  @media (max-width: 960px) {
    .content-grid { grid-template-columns: 1fr; }
    .right-rail { display: none; }
  }

  /* ── All shared components below (identical to v1) ── */
  .badge {
    display: inline-flex; align-items: center;
    font-size: 11px; font-weight: 500;
    padding: 2px 8px; border-radius: 20px;
    border: 1px solid var(--border); color: var(--text-2);
  }
  .badge-shipped { background: var(--badge-shipped-bg); color: var(--badge-shipped-text); border-color: transparent; }
  .badge-progress { background: var(--badge-progress-bg); color: var(--badge-progress-text); border-color: transparent; }
  .badge-planned { background: var(--badge-planned-bg); color: var(--badge-planned-text); border-color: transparent; }
  .badge-flagged { background: var(--badge-flagged-bg); color: var(--badge-flagged-text); border-color: transparent; }
  .badge-open { background: var(--green-bg); color: var(--green-text); border-color: transparent; }

  .card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; margin-bottom: 16px; }
  .card-header {
    padding: 12px 16px; border-bottom: 1px solid var(--border-light);
    font-size: 13px; font-weight: 600;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
  }
  .card-body { padding: 16px; }
  .card-row {
    display: flex; align-items: center; padding: 10px 16px;
    border-bottom: 1px solid var(--border-light); gap: 10px; font-size: 13px;
  }
  .card-row:last-child { border-bottom: none; }
  .card-row .row-main { flex: 1; color: var(--text); }
  .card-row .row-sub { font-size: 12px; color: var(--text-3); }

  .check-row {
    display: grid; grid-template-columns: 20px 1fr auto;
    align-items: center; gap: 10px;
    padding: 9px 16px; border-bottom: 1px solid var(--border-light); font-size: 13px;
  }
  .check-row:last-child { border-bottom: none; }
  .check-box {
    width: 16px; height: 16px; border-radius: 4px;
    border: 1.5px solid var(--border); flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
  }
  .check-box.done { background: var(--green); border-color: var(--green); }
  .check-box.done::after {
    content: ''; width: 8px; height: 5px;
    border-left: 1.5px solid #fff; border-bottom: 1.5px solid #fff;
    transform: rotate(-45deg) translate(1px, -1px); display: block;
  }
  .check-label { color: var(--text); }
  .check-label.done { text-decoration: line-through; color: var(--text-3); }

  .stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
  .stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 6px; padding: 14px 16px;
  }
  .stat-label { font-size: 11px; color: var(--text-3); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
  .stat-value { font-size: 22px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
  .stat-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

  .right-rail .rail-section {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 6px; margin-bottom: 12px; padding: 14px 16px;
  }
  .rail-title { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
  .rail-body { font-size: 12px; color: var(--text-2); line-height: 1.6; }
  .tag-pill {
    display: inline-block; font-size: 11px; padding: 2px 8px;
    border-radius: 20px; background: var(--border-light); color: var(--text-2);
    margin: 2px 2px 2px 0; border: 1px solid var(--border);
  }
  .avatar-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
  .avatar {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; color: #fff;
  }
  .rail-file {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--text-2);
    padding: 4px 0; border-bottom: 1px solid var(--border-light);
  }
  .rail-file:last-child { border-bottom: none; }
  .rail-file svg { width: 14px; height: 14px; stroke: var(--text-3); flex-shrink: 0; }

  .data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
  .data-table th {
    text-align: left; font-size: 11px; font-weight: 600; color: var(--text-3);
    padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--ground);
  }
  .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); color: var(--text); vertical-align: middle; }
  .data-table tr:last-child td { border-bottom: none; }
  .data-table tr:hover td { background: var(--ground); }
  .field-mono { font-family: ui-monospace, monospace; font-size: 12px; color: var(--text-2); }

  .thread-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border-light); }
  .thread-item:last-child { border-bottom: none; }
  .thread-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0; margin-top: 2px;
  }
  .thread-meta { font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
  .thread-meta b { color: var(--text-2); font-weight: 600; }
  .thread-bubble {
    background: var(--ground); border: 1px solid var(--border);
    border-radius: 6px; padding: 10px 12px; font-size: 13px; color: var(--text); line-height: 1.55;
  }
  .thread-correction {
    margin-top: 8px; background: var(--badge-progress-bg); border: 1px solid var(--border);
    border-radius: 6px; padding: 8px 12px; font-size: 12px; color: var(--badge-progress-text);
    font-family: ui-monospace, monospace;
  }

  .btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px;
    background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500;
    cursor: pointer; text-decoration: none; transition: background 0.1s;
  }
  .btn:hover { background: var(--ground); }
  .btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
  .btn-primary:hover { background: #155A32; }
  .btn svg { width: 14px; height: 14px; }

  .page-title { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
  .page-sub { font-size: 14px; color: var(--text-2); margin-bottom: 20px; }
  .section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
  .section-head h3 { font-size: 14px; font-weight: 600; }

  .progress-wrap { background: var(--border-light); border-radius: 4px; height: 6px; margin: 4px 0 2px; overflow: hidden; }
  .progress-bar { height: 100%; background: var(--green); border-radius: 4px; }

  .enum-row {
    display: grid; grid-template-columns: 32px 1fr 80px 80px 90px;
    align-items: center; gap: 12px; padding: 10px 16px;
    border-bottom: 1px solid var(--border-light); font-size: 13px;
  }
  .enum-row:last-child { border-bottom: none; }
  .enum-name { font-weight: 500; color: var(--text); }
  .enum-meta { font-size: 11px; color: var(--text-3); }
  .num { font-variant-numeric: tabular-nums; text-align: right; color: var(--text-2); }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 14px; font-family: inherit;
  background: var(--surface); color: var(--text);
  transition: border-color 0.12s;
}
.form-input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(27,94,56,0.12); }
.form-textarea { resize: vertical; min-height: 72px; }
.form-hint { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-2);
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: var(--ground); white-space: nowrap;
}
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--ground); }
.col-num { color: var(--text-3); font-size: 12px; width: 40px; }
.col-mono { font-family: ui-monospace, "Cascadia Code", monospace; font-size: 12px; }

/* ── Type badges ── */
.type-badge {
  display: inline-block; padding: 2px 7px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.type-text     { background: var(--type-text-bg);   color: var(--type-text-fg); }
.type-number   { background: var(--type-number-bg);  color: var(--type-number-fg); }
.type-select   { background: var(--type-select-bg);  color: var(--type-select-fg); }
.type-geo      { background: var(--type-geo-bg);     color: var(--type-geo-fg); }
.type-media    { background: var(--type-media-bg);   color: var(--type-media-fg); }
.type-date     { background: var(--type-date-bg);    color: var(--type-date-fg); }
.type-meta     { background: var(--type-meta-bg);    color: var(--type-meta-fg); }

/* ── Status badges ── */
.status-badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.status-active   { background: #DAFBE1; color: #116329; }
.status-draft    { background: #F1F0FF; color: #5435CA; }
.status-archived { background: #F6F8FA; color: #656D76; }
.status-planning { background: #F1F0FF; color: #5435CA; }
.status-paused   { background: #FFECCC; color: #7D4E17; }
.status-completed{ background: #DAFBE1; color: #116329; }

/* ── Upload zone ── */
.upload-zone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 48px 24px; text-align: center;
  background: var(--surface); cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--green); background: var(--green-bg);
}
.upload-icon { font-size: 40px; margin-bottom: 12px; line-height: 1; }
.upload-zone p { color: var(--text-2); margin-bottom: 4px; }
.upload-zone .link { color: var(--green); cursor: pointer; text-decoration: underline; }

/* ── Empty states ── */
.empty-state {
  padding: 48px 24px; text-align: center;
  color: var(--text-2);
}
.empty-state .empty-icon { font-size: 32px; margin-bottom: 12px; }
.empty-state p { margin-bottom: 16px; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  /* Above Leaflet's own stacking context (.leaflet-pane 400, its zoom
     controls 1000) — otherwise a modal opened on a page with an embedded
     map (e.g. Analyze's point-map view) renders invisibly behind it. */
  z-index: 1100;
}
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; width: 100%; max-width: 440px;
  padding: 24px; box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ── Alert ── */
.alert {
  padding: 10px 14px; border-radius: 6px;
  font-size: 13px; margin-bottom: 16px;
  border: 1px solid;
}
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: #FFCDD2; }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); border-color: #FFD8A8; }
.alert-success { background: var(--green-bg); color: var(--green-text); border-color: transparent; }

/* ── Breadcrumb ── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); margin-bottom: 16px; }
.breadcrumb a { color: var(--green); }
.breadcrumb-sep { color: var(--text-3); }

/* ── Login page ── */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 40px; width: 100%; max-width: 360px;
}
.login-logo {
  width: 44px; height: 44px; background: var(--green); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 20px; color: #fff;
  font-family: ui-monospace, monospace; margin: 0 auto 20px;
}
.login-title { text-align: center; font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.login-sub { text-align: center; font-size: 13px; color: var(--text-2); margin-bottom: 28px; }

/* ── Spinner ── */
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-dark {
  border-color: rgba(0,0,0,0.12); border-top-color: var(--green);
}

/* ── Misc ── */
.text-muted  { color: var(--text-2); }
.text-small  { font-size: 12px; }
.req-mark    { color: var(--green); font-weight: 700; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }

/* ── Filter tabs (status filters, submissions, corrections) ── */
.filter-tabs {
  display: flex; gap: 2px;
  background: var(--ground); border: 1px solid var(--border);
  border-radius: 6px; padding: 2px;
}
.filter-tab {
  padding: 4px 10px; border-radius: 4px; border: none;
  font-size: 12px; font-weight: 500; cursor: pointer;
  color: var(--text-2); background: transparent;
  transition: background 0.1s, color 0.1s;
}
.filter-tab:hover { color: var(--text); background: var(--surface); }
.filter-tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* ── Module library category sidebar ── */
.mod-cat-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 6px 10px; border-radius: 6px; border: none;
  font-size: 13px; font-weight: 500; cursor: pointer; text-align: left;
  color: var(--text-2); background: transparent;
  transition: background 0.1s, color 0.1s;
}
.mod-cat-btn:hover { background: var(--ground); color: var(--text); }
.mod-cat-btn--active { background: var(--border-light); color: var(--text); }
.mod-cat-count {
  font-size: 11px; font-weight: 600; color: var(--text-3);
  background: var(--border-light); border-radius: 10px;
  padding: 1px 6px; min-width: 20px; text-align: center;
}
.mod-cat-btn--active .mod-cat-count { background: var(--green-bg); color: var(--green-text); }

/* ── Button small ── */
.btn-sm {
  padding: 3px 8px; font-size: 12px;
}

/* ── Missing CSS variables ── */
:root {
  --danger: #CF222E;
  --danger-bg: #FFECEC;
  --warning-text: #7D4E17;
  --warning-bg: #FFECCC;
  --red: #CF222E;
  --orange: #D97706;
}
/* ── Form Builder (v3) ── full-screen, own chrome, no topnav/subheader ── */

#bldr-root {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column;
  background: var(--bg); overflow: hidden;
}

/* Top bar */
.bldr-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; height: 52px; flex-shrink: 0;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.bldr-back {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 6px;
  color: var(--text-2); text-decoration: none;
  border: 1px solid var(--border); transition: background 0.1s; flex-shrink: 0;
}
.bldr-back:hover { background: var(--hover); color: var(--text); }
.bldr-title-input {
  font-size: 14px; font-weight: 600; color: var(--text);
  background: transparent; border: 1px solid transparent;
  border-radius: 4px; padding: 4px 8px; min-width: 160px; max-width: 240px;
  font-family: inherit; transition: border-color 0.15s;
}
.bldr-title-input:hover { border-color: var(--border); }
.bldr-title-input:focus { border-color: var(--green); outline: none; background: var(--bg); }
.bldr-tabs {
  display: flex; gap: 2px; margin-left: 8px; height: 100%; align-items: center;
}
.bldr-tab {
  padding: 6px 14px; border-radius: 6px; border: none;
  background: transparent; font-size: 13px; font-weight: 500;
  color: var(--text-2); cursor: pointer; font-family: inherit;
  display: flex; align-items: center; gap: 5px;
  transition: background 0.1s, color 0.1s;
}
.bldr-tab:hover { color: var(--text); background: var(--hover); }
.bldr-tab.active { background: var(--text); color: var(--surface); }
.bldr-tab-count {
  font-size: 11px; opacity: 0.7; font-weight: 600;
}
.bldr-tab-count-warn {
  background: #D97706; color: #fff; opacity: 1; border-radius: 8px;
  padding: 0 5px; min-width: 15px; text-align: center; display: none;
}
.bldr-tab.active .bldr-tab-count-warn { background: rgba(255,255,255,0.25); }
.bldr-save-status {
  display: flex; align-items: center; gap: 5px; font-size: 12px;
  color: var(--text-3); margin-right: 4px; white-space: nowrap;
}
.bldr-save-status svg { color: var(--text-3); }
.bldr-nav-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 6px; font-size: 13px;
  font-weight: 500; cursor: pointer; font-family: inherit;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  transition: background 0.1s, color 0.1s; white-space: nowrap;
}
.bldr-nav-btn:hover { background: var(--hover); color: var(--text); }
.bldr-nav-btn.primary { background: var(--text); color: var(--surface); border-color: transparent; font-weight: 600; }
.bldr-nav-btn.primary:hover { opacity: 0.85; }
.bldr-nav-btn-icon { padding: 6px 9px; }

/* Three-panel + left nav rail layout */
.bldr-panels {
  display: flex; flex: 1; overflow: hidden; position: relative;
}

/* Left nav rail — switches what the left panel shows (sections/lookup/logic/media/settings) */
.bldr-nav-rail {
  width: 48px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 12px;
}
.bldr-navrail-btn {
  position: relative; width: 34px; height: 34px; border-radius: 8px; border: none; background: transparent;
  color: var(--text-2); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.1s, color 0.1s;
}
.bldr-navrail-btn:hover { background: var(--hover); color: var(--text); }
.bldr-navrail-btn.active { background: var(--green); color: #fff; }
.bldr-navrail-badge {
  position: absolute; top: -3px; right: -3px; background: var(--green); color: #fff;
  font-size: 9px; font-weight: 700; border-radius: 8px; min-width: 14px; height: 14px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
  border: 1.5px solid var(--surface);
}
.bldr-navrail-btn.active .bldr-navrail-badge { border-color: var(--green); background: #fff; color: var(--green); }

/* Left: sections */
.bldr-left {
  width: 264px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  overflow: hidden;
}
.bldr-left-head {
  padding: 14px 14px 10px; display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--text-3);
  flex-shrink: 0;
}
.bldr-sec-count { color: var(--text-3); font-weight: 500; }
.bldr-panel-icon-btn {
  background: none; border: none; cursor: pointer; color: var(--text-2);
  padding: 3px; border-radius: 4px; display: flex;
}
.bldr-panel-icon-btn:hover { color: var(--green); background: var(--hover); }
.bldr-left-search {
  margin: 0 14px 10px; display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px;
  background: var(--bg); flex-shrink: 0;
}
.bldr-search-input {
  border: none; background: transparent; outline: none; font-size: 13px;
  color: var(--text); flex: 1; font-family: inherit; min-width: 0;
}
.bldr-search-input::placeholder { color: var(--text-3); }
.bldr-sections-list { overflow-y: auto; flex: 1; padding: 0 8px; display: flex; flex-direction: column; gap: 2px; }
.bldr-section-item {
  display: flex; align-items: center; gap: 8px; padding: 8px;
  border-radius: 8px; cursor: pointer; transition: background 0.1s;
  position: relative;
}
.bldr-section-item:hover { background: var(--hover); }
.bldr-section-item.active { background: var(--green-bg); }
.bldr-section-drag {
  color: var(--text-3); font-size: 10px; opacity: 0; letter-spacing: -2px;
  cursor: grab; flex-shrink: 0; width: 8px;
}
.bldr-section-item:hover .bldr-section-drag { opacity: 0.5; }
.bldr-section-badge {
  width: 26px; height: 26px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 10px; font-weight: 700; font-family: ui-monospace, monospace;
}
.bldr-section-item.active .bldr-section-badge { box-shadow: 0 0 0 2px var(--green-bg); }
.bldr-section-info { flex: 1; min-width: 0; }
.bldr-section-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bldr-section-item.active .bldr-section-name { color: var(--green-text); }
.bldr-section-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.bldr-section-sugg {
  background: #D97706; color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 8px; min-width: 16px; height: 16px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.bldr-section-rename {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  opacity: 0; flex-shrink: 0; padding: 2px; border-radius: 4px; line-height: 0;
  transition: opacity 0.1s, color 0.1s;
}
.bldr-section-item:hover .bldr-section-rename { opacity: 0.6; }
.bldr-section-rename:hover { opacity: 1 !important; color: var(--green-text); }
.bldr-section-item.bldr-drag-over { box-shadow: inset 0 2px 0 var(--green); }
.bldr-q-card.bldr-drag-over { box-shadow: inset 0 2px 0 var(--green); }
.bldr-q-card.bldr-dragging { opacity: 0.4; }
.bldr-drag-handle {
  color: var(--text-3); cursor: grab; flex-shrink: 0;
  display: flex; align-items: center; opacity: 0.5;
}
.bldr-drag-handle:hover { opacity: 1; }
.bldr-drag-handle:active { cursor: grabbing; }
.bldr-left-footer { padding: 10px; border-top: 1px solid var(--border-light); flex-shrink: 0; }
.bldr-add-section-btn {
  width: 100%; padding: 8px; border-radius: 6px; border: 1px dashed var(--border);
  background: transparent; color: var(--text-2); font-size: 12px; font-weight: 500;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; transition: background 0.1s, border-color 0.1s;
}
.bldr-add-section-btn:hover { background: var(--hover); border-color: var(--green); color: var(--green-text); }

/* Center: canvas */
.bldr-center { flex: 1; overflow-y: auto; background: var(--bg); }
.bldr-canvas-wrap { max-width: 840px; margin: 0 auto; padding: 28px 32px 100px; }

.bldr-sec-header { margin-bottom: 18px; }
.bldr-sec-breadcrumb { font-size: 12px; color: var(--text-3); font-weight: 500; margin-bottom: 6px; }
.bldr-sec-cat { color: var(--text-3); }
.bldr-sec-title-row { display: flex; align-items: center; gap: 6px; }
.bldr-sec-nav {
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); display: flex; align-items: center;
  justify-content: center; cursor: pointer; flex-shrink: 0; transition: background 0.1s;
}
.bldr-sec-nav:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.bldr-sec-nav:disabled { opacity: 0.35; cursor: default; }
.bldr-sec-title-input {
  font-size: 22px; font-weight: 700; color: var(--text); background: transparent;
  border: 1px solid transparent; border-radius: 6px; padding: 3px 6px; flex: 1;
  font-family: inherit; min-width: 0; transition: border-color 0.15s;
}
.bldr-sec-title-input:hover { border-color: var(--border); }
.bldr-sec-title-input:focus { border-color: var(--green); outline: none; background: var(--surface); }
.bldr-sugg-badge {
  display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  color: #D97706; background: rgba(217,119,6,0.1); border: 1px solid rgba(217,119,6,0.25);
  padding: 4px 10px; border-radius: 20px; flex-shrink: 0; white-space: nowrap;
}
.bldr-sec-desc-input {
  width: 100%; margin-top: 6px; background: transparent; border: none; outline: none;
  font-size: 13px; font-style: italic; color: var(--text-3); font-family: inherit;
  padding: 2px 6px;
}
.bldr-sec-desc-input:focus { color: var(--text-2); }

/* Type toolbar */
.bldr-type-toolbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px; margin-bottom: 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
}
.bldr-toolbar-add-btn {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px;
  background: var(--green); color: #fff; border: none; border-radius: 6px;
  font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background 0.1s; white-space: nowrap;
}
.bldr-toolbar-add-btn:hover { background: #114c2b; }
.bldr-toolbar-sep { width: 1px; align-self: stretch; background: var(--border-light); margin: 2px 2px; }
.bldr-toolbar-btn {
  display: flex; align-items: center; gap: 5px; padding: 6px 10px;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--text-2); cursor: pointer;
  font-family: inherit; transition: background 0.1s, border-color 0.1s; white-space: nowrap;
}
.bldr-toolbar-btn:hover { background: var(--hover); border-color: var(--border); color: var(--text); }
.bldr-toolbar-icon { width: 13px; height: 13px; display: flex; flex-shrink: 0; }
.bldr-toolbar-icon svg { width: 100%; height: 100%; }
.bldr-toolbar-more {
  margin-left: auto; background: transparent; border: none; color: var(--text-3);
  cursor: pointer; font-size: 15px; font-weight: 700; padding: 4px 8px; border-radius: 6px;
  letter-spacing: 1px;
}
.bldr-toolbar-more:hover { background: var(--hover); color: var(--text); }

/* Cards container */
.bldr-cards { display: flex; flex-direction: column; gap: 10px; }
.bldr-empty-state {
  text-align: center; padding: 60px 24px; background: var(--surface);
  border: 1.5px dashed var(--border); border-radius: 8px;
}

/* Collapsed card — one-liner */
.bldr-q-card.collapsed {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
}
.bldr-q-card.collapsed:hover { border-color: rgba(128,128,128,0.4); background: var(--hover); }
.bldr-q-num-sm {
  font-family: ui-monospace, monospace; font-size: 11px; font-weight: 700;
  color: var(--text-3); flex-shrink: 0; width: 28px;
}
.bldr-q-label-col {
  flex: 1; min-width: 0; font-size: 13.5px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bldr-q-chips { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* Expanded card */
.bldr-q-card.expanded {
  display: flex; gap: 12px; background: var(--surface);
  border: 1.5px solid var(--green); border-radius: 10px; padding: 18px;
  box-shadow: 0 0 0 3px var(--green-bg);
}
.bldr-q-number {
  font-family: ui-monospace, monospace; font-size: 12px; font-weight: 700;
  color: var(--green-text); background: var(--green-bg); border-radius: 6px;
  width: 30px; height: 24px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px;
}
.bldr-q-main { flex: 1; min-width: 0; }
.bldr-label-large {
  width: 100%; background: transparent; border: none; outline: none; resize: none;
  color: var(--text); font-size: 17px; font-weight: 600; font-family: inherit;
  padding: 0; line-height: 1.4; display: block; overflow: hidden;
}
.bldr-label-large::placeholder { color: var(--text-3); font-weight: 400; }
.bldr-hint-input {
  width: 100%; background: transparent; border: none; outline: none;
  color: var(--text-2); font-size: 13.5px; font-family: inherit; padding: 4px 0 0;
}
.bldr-hint-input::placeholder { color: var(--text-3); }

.bldr-q-meta-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.bldr-type-chip {
  display: flex; align-items: center; gap: 5px;
  font-family: ui-monospace, monospace; font-size: 11px; font-weight: 600;
  background: var(--bg); color: var(--text-2); padding: 3px 8px;
  border-radius: 5px; border: 1px solid var(--border-light);
  cursor: pointer; user-select: none; transition: background 0.1s; white-space: nowrap;
}
.bldr-type-chip:hover { background: var(--hover); }
.bldr-type-chip-sm { font-size: 10.5px; padding: 2px 6px; cursor: default; }
.bldr-varname-input {
  font-family: ui-monospace, monospace; font-size: 12px;
  background: transparent; border: none; border-bottom: 1px dashed var(--border);
  color: var(--text-2); outline: none; width: 130px;
  padding: 1px 0; transition: border-color 0.1s;
}
.bldr-varname-input:focus { border-bottom-color: var(--green); color: var(--text); }
.bldr-varname-badge {
  font-family: ui-monospace, monospace; font-size: 10.5px; color: var(--text-3);
}
.bldr-status-badge {
  font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 10px;
  letter-spacing: 0.02em; white-space: nowrap;
}
.bldr-badge-required { background: var(--green-bg); color: var(--green-text); }
.bldr-badge-conditional { background: rgba(106,27,154,0.12); color: #6A1B9A; }
.bldr-badge-sensitive { background: rgba(217,119,6,0.12); color: #D97706; }

.bldr-card-action {
  width: 24px; height: 24px; border-radius: 6px; border: none; background: transparent;
  color: var(--text-3); display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: background 0.1s, color 0.1s;
}
.bldr-card-action:hover { background: var(--hover); color: var(--text); }
.bldr-card-delete:hover { background: rgba(207,34,40,0.1); color: #CF222E; }

.bldr-response-preview {
  margin-top: 10px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border-light);
  border-radius: 6px; font-size: 12px; color: var(--text-3); font-family: ui-monospace, monospace;
}

/* ADD rows */
.bldr-addrows { display: flex; flex-direction: row; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.bldr-addrow { border-radius: 6px; overflow: hidden; flex: 0 0 auto; }
.bldr-addrow.open { flex: 1 1 100%; }
.bldr-addrow-head {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px;
  cursor: pointer; border-radius: 6px; transition: background 0.1s, border-color 0.1s;
  border: 1px solid var(--border-light);
}
.bldr-addrow-head:hover { background: var(--hover); border-color: var(--border); }
.bldr-addrow.open .bldr-addrow-head { background: var(--bg); border-color: transparent; }
.bldr-addrow-icon { width: 12px; height: 12px; display: flex; flex-shrink: 0; color: var(--text-3); }
.bldr-addrow-icon svg { width: 100%; height: 100%; }
.bldr-addrow-label {
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--text-3);
  white-space: nowrap;
}
.bldr-addrow.open .bldr-addrow-label { color: var(--text); font-size: 12.5px; flex: 1; }
.bldr-addrow-close {
  background: none; border: none; cursor: pointer; color: var(--text-3);
  padding: 2px; display: flex; border-radius: 4px;
}
.bldr-addrow-close:hover { color: #CF222E; background: rgba(207,34,40,0.08); }
.bldr-addrow-body { padding: 10px 8px 4px; background: var(--bg); border-radius: 0 0 6px 6px; }
.bldr-training-ta {
  width: 100%; min-height: 64px; resize: vertical; font-size: 13px; line-height: 1.5;
}

/* Choices in canvas */
.bldr-lookup-selector {
  display: flex; align-items: center; gap: 6px; margin-top: 12px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border-light);
}
.bldr-lookup-select {
  flex: 1; background: var(--ground); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 12.5px; padding: 5px 8px;
  font-family: inherit;
}
.bldr-lookup-shared-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: var(--green-text); background: var(--green-bg); border-radius: 4px;
  padding: 2px 6px; flex-shrink: 0;
}
.bldr-choices { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.bldr-choice-row { display: flex; align-items: center; gap: 8px; }
.bldr-choice-dot {
  width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid var(--border);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.bldr-choice-dot--check { border-radius: 3px; }
.bldr-choice-input {
  background: transparent; border: none; color: var(--text); font-size: 13.5px;
  outline: none; flex: 1; font-family: inherit; padding: 1px 0;
}
.bldr-choice-del {
  background: none; border: none; cursor: pointer; color: #CF222E;
  opacity: 0; transition: opacity 0.15s; padding: 2px;
}
.bldr-choice-row:hover .bldr-choice-del { opacity: 0.7; }
.bldr-choice-del:hover { opacity: 1 !important; }
.bldr-choice-add {
  display: flex; align-items: center; gap: 8px; opacity: 0.5; cursor: pointer; margin-top: 2px;
}
.bldr-choice-add:hover { opacity: 0.85; }

/* Right: properties panel */
.bldr-right {
  width: 288px; flex-shrink: 0; background: var(--surface);
  border-left: 1px solid var(--border); overflow-y: auto;
}
.bldr-props-empty { padding: 40px 16px; color: var(--text-3); font-size: 13px; text-align: center; }
.bldr-props-scroll { padding: 16px; }
.bldr-props-qname {
  font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 2px;
  padding-right: 20px; line-height: 1.35;
}
.bldr-props-section-head {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; color: var(--text-3);
  margin: 14px 0 10px; display: flex; align-items: center; gap: 6px;
}
.bldr-props-group-head {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--text-2);
  display: flex; align-items: center; justify-content: space-between;
  margin: 16px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border-light);
}
.bldr-props-collapse-btn {
  background: none; border: none; cursor: pointer; color: var(--text-3); display: flex; padding: 2px;
}
.bldr-props-group { display: flex; flex-direction: column; gap: 12px; }
.bldr-prop-field { display: flex; flex-direction: column; gap: 5px; }
.bldr-prop-label {
  font-size: 12px; font-weight: 600; color: var(--text-2);
  display: flex; align-items: center; gap: 5px;
}
.bldr-prop-help {
  width: 13px; height: 13px; border-radius: 50%; background: var(--bg); color: var(--text-3);
  font-size: 9.5px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); cursor: help; font-weight: 700;
}
.bldr-prop-input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 7px 10px; font-size: 13px; color: var(--text);
  width: 100%; font-family: inherit; box-sizing: border-box;
  transition: border-color 0.1s, box-shadow 0.1s;
}
.bldr-prop-input:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px var(--green-bg); }
select.bldr-prop-input { appearance: auto; padding: 6px 8px; }
.bldr-prop-mono { font-family: ui-monospace, monospace; font-size: 12px; }
.bldr-prop-raw { font-size: 11px; color: var(--text-3); font-family: ui-monospace, monospace; }
.bldr-prop-raw code { color: var(--text-2); }

/* Toggle switch */
.bldr-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer;
}
.bldr-toggle-label { font-size: 13px; font-weight: 500; color: var(--text); }
.bldr-toggle { position: relative; display: inline-block; width: 34px; height: 20px; flex-shrink: 0; cursor: pointer; }
.bldr-toggle input { opacity: 0; width: 0; height: 0; }
.bldr-toggle-slider {
  position: absolute; inset: 0; background: var(--border); border-radius: 20px;
  transition: background 0.15s; cursor: pointer;
}
.bldr-toggle-slider::before {
  content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; transition: transform 0.15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.bldr-toggle input:checked + .bldr-toggle-slider { background: var(--green); }
.bldr-toggle input:checked + .bldr-toggle-slider::before { transform: translateX(14px); }

/* Type selector modal */
.bldr-type-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px;
  cursor: pointer; border-radius: 6px; transition: background 0.1s;
}
.bldr-type-row:hover { background: var(--bg); }
.bldr-type-icon { color: var(--text-2); width: 17px; height: 17px; flex-shrink: 0; display: flex; }
.bldr-type-icon svg { width: 100%; height: 100%; }

/* Preview tab */
.bldr-preview-wrap { display: flex; justify-content: center; padding: 32px; flex: 1; overflow-y: auto; }
.bldr-preview-card {
  width: 420px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px; box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  height: fit-content;
}
.bldr-preview-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.bldr-preview-section-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em; color: var(--green-text);
  margin: 20px 0 12px; text-transform: uppercase;
}
.bldr-preview-section-label:first-of-type { margin-top: 0; }
.bldr-preview-field { margin-bottom: 20px; }
.bldr-preview-label { font-weight: 500; font-size: 14px; margin-bottom: 4px; }
.bldr-preview-hint { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.bldr-preview-input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); font-size: 14px; font-family: inherit;
  outline: none; box-sizing: border-box;
}
.bldr-preview-choice { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; cursor: pointer; font-size: 14px; }

/* Review tab */
.bldr-review-item { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border-light); }
.bldr-review-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.bldr-review-varname { font-weight: 600; font-size: 13px; color: var(--text); }
.bldr-health-warn {
  display: flex; gap: 10px; padding: 12px; border-radius: 6px; font-size: 13px;
  background: rgba(217,119,6,0.08); border: 1px solid rgba(217,119,6,0.2); color: #D97706;
}
.bldr-health-ok {
  display: flex; gap: 10px; padding: 12px; border-radius: 6px; font-size: 13px;
  background: var(--green-bg); border: 1px solid rgba(27,94,56,0.2); color: var(--green-text);
}
.bldr-tx-cell { padding: 10px 12px; border-bottom: 1px solid var(--border-light); }
.bldr-tx-mono { font-family: ui-monospace, monospace; color: var(--text-2); }

/* Translation tab — single language + dropdown, list rows instead of a matrix */
.bldr-tx-row {
  display: grid; grid-template-columns: 1fr 1.4fr 1.4fr; gap: 16px; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--border-light);
}
.bldr-tx-row:last-child { border-bottom: none; }
.bldr-tx-row-indent .bldr-tx-varname { padding-left: 16px; color: var(--text-3); font-size: 12px; }
.bldr-tx-head {
  background: var(--bg); font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.03em;
}
.bldr-tx-varname { font-family: ui-monospace, monospace; font-size: 12.5px; color: var(--text-2); }
.bldr-tx-base { font-size: 13px; color: var(--text); }
.bldr-tx-input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 10px; font-size: 13px; color: var(--text); font-family: inherit;
  width: 100%; box-sizing: border-box; transition: border-color 0.1s;
}
.bldr-tx-input:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px var(--green-bg); }

/* Lookup Tables view (left nav rail) */
.bldr-lookup-card {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  border-radius: 8px; cursor: pointer; transition: background 0.1s;
}
.bldr-lookup-card:hover { background: var(--hover); }
.bldr-lookup-avatar {
  width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0; color: #fff;
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.bldr-lookup-name { font-size: 13px; font-weight: 600; color: var(--text); }
.bldr-lookup-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.bldr-lookup-del {
  background: none; border: none; cursor: pointer; color: var(--text-3);
  padding: 4px; border-radius: 4px; opacity: 0; flex-shrink: 0; transition: opacity 0.15s, color 0.1s;
}
.bldr-lookup-card:hover .bldr-lookup-del { opacity: 0.7; }
.bldr-lookup-del:hover { opacity: 1 !important; color: #CF222E; }
.bldr-lookup-more { color: var(--text-3); font-size: 13px; flex-shrink: 0; }

/* Logic Flow view (left nav rail) */
.bldr-logic-scroll { padding: 14px; overflow-y: auto; flex: 1; }
.bldr-logic-desc { font-size: 12px; color: var(--text-3); line-height: 1.5; margin: 0 0 16px; }
.bldr-logic-section-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--text-2);
  margin-bottom: 8px; text-transform: uppercase;
}
.bldr-logic-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.bldr-logic-item {
  display: flex; gap: 8px; align-items: flex-start; padding: 8px; border-radius: 6px;
  background: var(--bg); border: 1px solid var(--border-light);
}
.bldr-logic-pill {
  flex-shrink: 0; font-size: 10px; font-weight: 700; border-radius: 5px;
  width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
}
.bldr-logic-pill-if { background: var(--green-bg); color: var(--green-text); }
.bldr-logic-pill-check { background: rgba(37,99,168,0.12); color: #2563a8; }
.bldr-logic-expr { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--text); word-break: break-word; }
.bldr-logic-target { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.bldr-logic-empty { font-size: 12px; color: var(--text-3); padding: 4px 0 0; }

/* Form Settings view (left nav rail) */
.bldr-settings-scroll { padding: 14px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; flex: 1; }

/* Calculated Value card */
.bldr-calc-label { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }

/* Repeat count control (Roster) */
.bldr-repeatcount {
  margin-top: 14px; padding: 12px; background: var(--bg); border: 1px solid var(--border-light);
  border-radius: 8px;
}
.bldr-repeatcount-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.03em; color: var(--text-2); margin-bottom: 8px; }

/* Container (Group / Roster) nested field list */
.bldr-container-children { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }
.bldr-container-children-head {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--text-3); margin-bottom: 8px;
}
.bldr-container-empty { font-size: 12px; color: var(--text-3); padding: 6px 0; }
.bldr-child-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--border-light); margin-bottom: 6px;
}
.bldr-child-icon { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-3); display: flex; }
.bldr-child-icon svg { width: 100%; height: 100%; }
.bldr-child-label {
  flex: 1; min-width: 60px; background: transparent; border: none; outline: none;
  font-size: 13px; color: var(--text); font-family: inherit; padding: 2px 0;
}
.bldr-child-label::placeholder { color: var(--text-3); }
.bldr-child-type.bldr-type-chip-sm { cursor: pointer; flex-shrink: 0; }
.bldr-child-name {
  width: 90px; flex-shrink: 0; font-family: ui-monospace, monospace; font-size: 11px;
  background: var(--bg); border: 1px solid var(--border-light); border-radius: 4px;
  padding: 3px 6px; color: var(--text-2); outline: none;
}
.bldr-child-req {
  display: flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--text-3);
  flex-shrink: 0; cursor: pointer; user-select: none;
}
.bldr-child-req-cb { accent-color: var(--green); cursor: pointer; }
.bldr-child-del {
  background: none; border: none; cursor: pointer; color: var(--text-3); padding: 3px;
  border-radius: 4px; flex-shrink: 0; transition: color 0.1s, background 0.1s;
}
.bldr-child-del:hover { color: #CF222E; background: rgba(207,34,40,0.08); }
.bldr-child-add {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 6px;
  border: 1px dashed var(--border); background: transparent; color: var(--text-2);
  font-size: 12px; font-weight: 500; cursor: pointer; font-family: inherit;
  transition: background 0.1s, border-color 0.1s;
}
.bldr-child-add:hover { background: var(--hover); border-color: var(--green); color: var(--green-text); }

/* Matrix grid editor */
.bldr-matrix-grid { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }
.bldr-matrix-section-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--text-3);
  text-transform: uppercase; margin-bottom: 8px;
}
.bldr-matrix-col-row, .bldr-matrix-row-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.bldr-matrix-col-label, .bldr-matrix-row-label {
  flex: 1; background: var(--bg); border: 1px solid var(--border-light); border-radius: 6px;
  padding: 6px 9px; font-size: 13px; color: var(--text); font-family: inherit; outline: none;
  min-width: 0;
}
.bldr-matrix-col-label:focus, .bldr-matrix-row-label:focus { border-color: var(--green); }
.bldr-matrix-col-type { flex-shrink: 0; width: 110px; }
.bldr-matrix-col-list { flex-shrink: 0; }
.bldr-matrix-col-del, .bldr-matrix-row-del {
  background: none; border: none; cursor: pointer; color: var(--text-3); padding: 4px;
  border-radius: 4px; flex-shrink: 0; transition: color 0.1s, background 0.1s;
}
.bldr-matrix-col-del:hover, .bldr-matrix-row-del:hover { color: #CF222E; background: rgba(207,34,40,0.08); }
.bldr-matrix-add-col, .bldr-matrix-add-row {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 6px;
  border: 1px dashed var(--border); background: transparent; color: var(--text-2);
  font-size: 12px; font-weight: 500; cursor: pointer; font-family: inherit;
  transition: background 0.1s, border-color 0.1s; margin-top: 2px;
}
.bldr-matrix-add-col:hover, .bldr-matrix-add-row:hover { background: var(--hover); border-color: var(--green); color: var(--green-text); }

/* Logic Flow — calculation pill */
.bldr-logic-pill-calc { background: rgba(0,105,92,0.12); color: #00695C; }

/* Preview tab — nested group box + matrix table */
.bldr-preview-group {
  margin-top: 8px; padding: 12px; border: 1px dashed var(--border); border-radius: 8px;
  background: var(--bg); display: flex; flex-direction: column; gap: 14px;
}
.bldr-preview-matrix-wrap { overflow-x: auto; margin-top: 4px; }
.bldr-preview-matrix { border-collapse: collapse; font-size: 12.5px; width: 100%; }
.bldr-preview-matrix th, .bldr-preview-matrix td {
  border: 1px solid var(--border-light); padding: 6px 10px; text-align: center; white-space: nowrap;
}
.bldr-preview-matrix th { background: var(--bg); font-weight: 600; color: var(--text-2); }
.bldr-preview-matrix td:first-child { text-align: left; font-weight: 500; color: var(--text); }

/* Mobile-style Preview tab */
.bldr-preview-wrap { flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; padding: 24px 24px 60px; gap: 20px; }
.bldr-pv-toolbar { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.bldr-pv-toolbar-group { display: flex; align-items: center; gap: 8px; }
.bldr-pv-toolbar-label { font-size: 12px; font-weight: 600; color: var(--text-2); }

.bldr-phone {
  width: 380px; background: #fff; color: #1a1a1a; border-radius: 28px; overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35), 0 0 0 8px #111;
  display: flex; flex-direction: column; min-height: 640px;
}
.bldr-phone-status {
  background: #111; color: #fff; padding: 14px 20px; font-size: 13px; font-weight: 600;
  text-align: center; letter-spacing: 0.01em;
}
.bldr-pv-progress { display: flex; gap: 3px; padding: 10px 16px 0; }
.bldr-pv-progress-seg { flex: 1; height: 4px; border-radius: 2px; background: #e6e6e6; }
.bldr-pv-progress-seg.filled { background: var(--green); }
.bldr-pv-body { flex: 1; padding: 18px 20px 24px; overflow-y: auto; }
.bldr-pv-breadcrumb { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: #8a8a8a; margin-bottom: 6px; }
.bldr-pv-section-title { font-size: 20px; font-weight: 700; color: #111; margin-bottom: 18px; }

.bldr-pv-item { margin-bottom: 22px; }
.bldr-pv-qnum { font-size: 14.5px; font-weight: 600; color: #111; margin-bottom: 4px; }
.bldr-pv-qnum-note { font-weight: 400; color: #8a8a8a; font-size: 12.5px; }
.bldr-pv-hint { font-size: 12.5px; color: #8a8a8a; margin-bottom: 8px; }
.bldr-pv-sublabel { font-size: 13px; font-weight: 500; color: #333; margin-bottom: 4px; }
.bldr-pv-static { font-size: 13px; color: #8a8a8a; padding: 10px 0; }
.bldr-pv-error-text { font-size: 12px; color: #CF222E; font-weight: 500; margin-top: 5px; }

.bldr-pv-input {
  width: 100%; box-sizing: border-box; padding: 12px 14px; border: 1.5px solid #e0e0e0; border-radius: 10px;
  font-size: 14px; color: #111; font-family: inherit; outline: none; background: #fff;
  transition: border-color 0.15s;
}
.bldr-pv-input:focus { border-color: #111; }
.bldr-pv-input-error { border-color: #CF222E !important; background: rgba(207,34,40,0.04); }

.bldr-pv-choices { display: flex; flex-direction: column; gap: 8px; }
.bldr-pv-choices.bldr-pv-input-error .bldr-pv-choice-row { border-color: #CF222E; }
.bldr-pv-choice-row {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px solid #e0e0e0;
  border-radius: 10px; cursor: pointer; font-size: 14px; color: #222; transition: border-color 0.15s, background 0.15s;
}
.bldr-pv-choice-row:hover { border-color: #bbb; }
.bldr-pv-choice-row.checked { border-color: var(--green); background: rgba(27,94,56,0.05); }
.bldr-pv-choice-row input { accent-color: var(--green); width: 16px; height: 16px; flex-shrink: 0; }

.bldr-pv-roster-box { border: 1.5px dashed #ddd; border-radius: 12px; padding: 14px; margin-top: 8px; }
.bldr-pv-roster-field { margin-bottom: 14px; }
.bldr-pv-roster-field:last-child { margin-bottom: 0; }

.bldr-pv-nav {
  display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid #eee; background: #fff;
}
.bldr-pv-nav-btn {
  flex: 1; padding: 12px; border-radius: 10px; border: 1.5px solid #e0e0e0; background: #fff;
  color: #333; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background 0.15s, opacity 0.15s;
}
.bldr-pv-nav-btn:disabled { opacity: 0.35; cursor: default; }
.bldr-pv-nav-btn.primary { background: var(--green); color: #fff; border-color: transparent; }
.bldr-pv-nav-btn.primary:hover { background: #114c2b; }

/* ── Landing page ── self-contained marketing theme, escapes .content-wrap.
   Light by default; dark palette below mirrors the inner app's dark tokens
   (--ground/--surface/--text/--green-text etc.) for visual continuity. */
.lp-page {
  --lp-bg: #f8f9f5;
  --lp-surface: #ffffff;
  --lp-text: #111111;
  --lp-text-muted: #666666;
  --lp-text-light: #999999;
  --lp-green-dark: #0f5132;
  --lp-green-light: #e8f2ec;
  --lp-yellow: #fbbf24;
  --lp-yellow-light: #fdf6e3;
  --lp-yellow-dark: #d97706;
  --lp-border: #e5e7eb;
  --lp-gradient: linear-gradient(135deg, #16643c 0%, #0f766e 50%, #0c4428 100%);
  --lp-icon-yellow-bg: var(--lp-yellow-light); --lp-icon-yellow-text: var(--lp-yellow-dark);
  --lp-icon-green-bg: var(--lp-green-light);   --lp-icon-green-text: var(--lp-green-dark);
  --lp-icon-blue-bg: #eff6ff;   --lp-icon-blue-text: #1d4ed8;
  --lp-icon-purple-bg: #f3e8ff; --lp-icon-purple-text: #7e22ce;
  --lp-icon-gray-bg: #f3f4f6;   --lp-icon-gray-text: #374151;

  position: fixed; inset: 0; z-index: 10; overflow-y: auto;
  background: var(--lp-bg); color: var(--lp-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5; -webkit-font-smoothing: antialiased;
  transition: background 0.15s, color 0.15s;
}

@media (prefers-color-scheme: dark) {
  .lp-page {
    --lp-bg: #161B22; --lp-surface: #0D1117; --lp-text: #E6EDF3; --lp-text-muted: #8B949E; --lp-text-light: #6E7681;
    --lp-green-dark: #56D364; --lp-green-light: #0D2818; --lp-yellow-dark: #fbbf24; --lp-border: #30363D;
    --lp-icon-yellow-bg: #2D1800; --lp-icon-yellow-text: #E3A341;
    --lp-icon-green-bg: #0D2818; --lp-icon-green-text: #56D364;
    --lp-icon-blue-bg: #051D4D; --lp-icon-blue-text: #58A6FF;
    --lp-icon-purple-bg: #1A1035; --lp-icon-purple-text: #BC8CFF;
    --lp-icon-gray-bg: #21262D; --lp-icon-gray-text: #8B949E;
  }
}
.lp-page[data-theme="dark"] {
  --lp-bg: #161B22; --lp-surface: #0D1117; --lp-text: #E6EDF3; --lp-text-muted: #8B949E; --lp-text-light: #6E7681;
  --lp-green-dark: #56D364; --lp-green-light: #0D2818; --lp-yellow-dark: #fbbf24; --lp-border: #30363D;
  --lp-icon-yellow-bg: #2D1800; --lp-icon-yellow-text: #E3A341;
  --lp-icon-green-bg: #0D2818; --lp-icon-green-text: #56D364;
  --lp-icon-blue-bg: #051D4D; --lp-icon-blue-text: #58A6FF;
  --lp-icon-purple-bg: #1A1035; --lp-icon-purple-text: #BC8CFF;
  --lp-icon-gray-bg: #21262D; --lp-icon-gray-text: #8B949E;
}
.lp-page[data-theme="light"] {
  --lp-bg: #f8f9f5; --lp-surface: #ffffff; --lp-text: #111111; --lp-text-muted: #666666; --lp-text-light: #999999;
  --lp-green-dark: #0f5132; --lp-green-light: #e8f2ec; --lp-yellow-dark: #d97706; --lp-border: #e5e7eb;
  --lp-icon-yellow-bg: #fdf6e3; --lp-icon-yellow-text: #d97706;
  --lp-icon-green-bg: #e8f2ec; --lp-icon-green-text: #0f5132;
  --lp-icon-blue-bg: #eff6ff; --lp-icon-blue-text: #1d4ed8;
  --lp-icon-purple-bg: #f3e8ff; --lp-icon-purple-text: #7e22ce;
  --lp-icon-gray-bg: #f3f4f6; --lp-icon-gray-text: #374151;
}

.lp-container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.lp-center { text-align: center; display: flex; flex-direction: column; align-items: center; }

.lp-nav { background: var(--lp-surface); border-bottom: 1px solid var(--lp-border); position: sticky; top: 0; z-index: 5; }
.lp-nav-inner { height: 64px; display: flex; align-items: center; justify-content: space-between; }
.lp-nav-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; color: var(--lp-text); }
.lp-nav-logo-mark {
  width: 28px; height: 28px; border-radius: 7px; background: var(--lp-gradient); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700;
}
.lp-nav-actions { display: flex; align-items: center; gap: 12px; }

.lp-theme-toggle {
  display: flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 8px; border: 1px solid var(--lp-border); background: var(--lp-surface); color: var(--lp-text-muted);
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.lp-theme-toggle:hover { background: var(--lp-bg); color: var(--lp-text); }
.lp-theme-icon-moon { display: none; }
.lp-page[data-theme="dark"] .lp-theme-icon-sun { display: none; }
.lp-page[data-theme="dark"] .lp-theme-icon-moon { display: block; }

.lp-hero { padding: 72px 0 56px; }
.lp-badge {
  display: inline-flex; align-items: center; gap: 6px; background: var(--lp-green-light); color: var(--lp-green-dark);
  padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
}
.lp-title { font-size: 50px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; margin: 24px 0 20px; max-width: 600px; }
.lp-highlight { color: var(--lp-yellow-dark); }
.lp-subtitle { font-size: 17px; color: var(--lp-text-muted); max-width: 600px; margin-bottom: 32px; }
.lp-actions { display: flex; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.lp-micro-copy { font-size: 12px; color: var(--lp-text-light); }

.lp-btn {
  display: inline-flex; align-items: center; justify-content: center; padding: 12px 22px; border-radius: 8px;
  font-size: 14.5px; font-weight: 600; text-decoration: none; transition: all 0.15s; cursor: pointer; border: none;
  font-family: inherit;
}
.lp-btn-primary { background: var(--lp-gradient); color: #fff; box-shadow: 0 2px 8px rgba(15,118,110,0.25); }
.lp-btn-primary:hover { opacity: 0.94; box-shadow: 0 4px 14px rgba(15,118,110,0.35); transform: translateY(-1px); }
.lp-btn-secondary { background: var(--lp-surface); color: var(--lp-text); border: 1px solid var(--lp-border); }
.lp-btn-secondary:hover { background: #f9fafb; }
.lp-btn-sm { padding: 8px 16px; font-size: 13px; }
.lp-btn-lg { padding: 15px 30px; font-size: 16px; }

.lp-hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
.lp-hero-left { text-align: left; }

.lp-video-placeholder {
  position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1); border: 1px solid var(--lp-border);
  display: flex; align-items: center; justify-content: center;
  background-image: linear-gradient(135deg, #111 0%, #1f2937 100%);
}
.lp-play-btn {
  width: 64px; height: 64px; border-radius: 50%; background: var(--lp-green-dark); color: #fff;
  border: none; display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: transform 0.2s, background 0.2s; box-shadow: 0 4px 12px rgba(15,81,50,0.4);
}
.lp-play-btn:hover { transform: scale(1.1); background: #16643c; }
.lp-video-overlay {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 16px 24px;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent); color: #fff;
  display: flex; justify-content: space-between; font-size: 13px; font-weight: 500;
}
.lp-video-duration { color: #a1a1aa; }

@media (max-width: 992px) {
  .lp-hero-grid { grid-template-columns: 1fr; text-align: center; }
  .lp-hero-left { text-align: center; display: flex; flex-direction: column; align-items: center; }
  .lp-title, .lp-subtitle { max-width: 100%; }
  .lp-actions { justify-content: center; }
  .lp-video-placeholder { margin: 0 auto; }
}

.lp-process { padding: 72px 0; }
.lp-process-steps { position: relative; padding-top: 12px; }
.lp-process-line { position: absolute; top: 50%; left: 10%; right: 10%; height: 2px; background: var(--lp-border); transform: translateY(-50%); z-index: 0; }
.lp-process-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; position: relative; z-index: 1; }
.lp-process-step {
  background: var(--lp-surface); padding: 28px 22px; border-radius: 12px; border: 1px solid var(--lp-border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.03); text-align: center; display: flex; flex-direction: column; align-items: center;
  transition: transform 0.15s, box-shadow 0.15s;
}
.lp-process-step:hover { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(0,0,0,0.06); }
.lp-step-icon {
  width: 44px; height: 44px; background: var(--lp-bg); border-radius: 11px; display: flex; align-items: center;
  justify-content: center; color: var(--lp-text); margin-bottom: 16px; border: 1px solid var(--lp-border);
}
.lp-step-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.lp-step-desc { font-size: 13px; color: var(--lp-text-muted); line-height: 1.5; max-width: 200px; }

@media (max-width: 992px) {
  .lp-process-grid { grid-template-columns: 1fr; gap: 20px; }
  .lp-process-line { display: none; }
}

.lp-features { background: var(--lp-surface); border-top: 1px solid var(--lp-border); padding: 72px 0 88px; }
.lp-section-header { text-align: center; margin-bottom: 44px; }
.lp-section-kicker { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; color: var(--lp-text-light); margin-bottom: 10px; }
.lp-section-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.lp-feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.lp-fcard { background: var(--lp-bg); border-radius: 12px; padding: 28px; box-shadow: 0 4px 20px rgba(0,0,0,0.03); border: 1px solid var(--lp-border); }
.lp-card-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.lp-icon-yellow { background: var(--lp-icon-yellow-bg); color: var(--lp-icon-yellow-text); }
.lp-icon-green { background: var(--lp-icon-green-bg); color: var(--lp-icon-green-text); }
.lp-icon-blue { background: var(--lp-icon-blue-bg); color: var(--lp-icon-blue-text); }
.lp-icon-purple { background: var(--lp-icon-purple-bg); color: var(--lp-icon-purple-text); }
.lp-icon-gray { background: var(--lp-icon-gray-bg); color: var(--lp-icon-gray-text); }
.lp-fcard h3 { font-size: 16.5px; font-weight: 700; margin: 18px 0 10px; letter-spacing: -0.01em; }
.lp-fcard p { font-size: 13.5px; color: var(--lp-text-muted); line-height: 1.6; }

@media (max-width: 992px) { .lp-feature-grid { grid-template-columns: 1fr; } }

.lp-security { background: var(--lp-gradient); color: #fff; padding: 72px 0; }
.lp-security h2 { font-size: 26px; font-weight: 700; margin-bottom: 14px; letter-spacing: -0.01em; }
.lp-security p { color: #a7f3d0; max-width: 580px; margin: 0 auto 52px; font-size: 14.5px; }
.lp-security-grid { display: flex; justify-content: center; gap: 64px; flex-wrap: wrap; }
.lp-sec-item h3 { font-size: 36px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.lp-sec-item span { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; color: #a7f3d0; }

@media (max-width: 768px) { .lp-security-grid { flex-direction: column; gap: 32px; } }

.lp-cta { padding: 80px 0; }
.lp-cta h2 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 12px; }
.lp-cta p { font-size: 15px; color: var(--lp-text-muted); margin-bottom: 28px; max-width: 480px; }

.lp-footer { background: var(--lp-surface); padding: 64px 0 32px; border-top: 1px solid var(--lp-border); }
.lp-footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 48px; }
.lp-footer-logo {
  width: 30px; height: 30px; background: var(--lp-gradient); color: #fff; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: 15px; margin-bottom: 18px;
}
.lp-footer-brand p { color: var(--lp-text-muted); font-size: 13px; line-height: 1.6; max-width: 280px; }
.lp-footer-links h4 { font-size: 13px; font-weight: 700; margin-bottom: 18px; }
.lp-footer-links ul { list-style: none; padding: 0; margin: 0; font-size: 13px; color: var(--lp-text-muted); }
.lp-footer-links li { margin-bottom: 10px; }
.lp-footer-links a { color: var(--lp-text-muted); text-decoration: none; transition: color 0.15s; }
.lp-footer-links a:hover { color: var(--lp-green-dark); }
.lp-footer-bottom { border-top: 1px solid var(--lp-border); padding-top: 20px; font-size: 12px; color: var(--lp-text-light); }

@media (max-width: 768px) {
  .lp-footer-grid { grid-template-columns: 1fr; }
  .lp-title { font-size: 40px; }
}

/* ── Help section (/help) ───────────────────────────────────────────── */
.help-cat-nav {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 24px;
}
.help-cat-btn {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  color: var(--text-2); background: var(--surface);
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.help-cat-btn:hover { color: var(--text); border-color: var(--text-3); }
.help-cat-btn--active { background: var(--green); border-color: var(--green); color: #fff; }

.help-group { margin-bottom: 28px; }
.help-group-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); margin-bottom: 10px;
}
.help-card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px;
}
.help-card {
  display: block; padding: 14px 16px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border);
  text-decoration: none; color: inherit;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.help-card:hover { border-color: var(--green); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.help-card-title { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.help-card-summary { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }

.help-breadcrumb {
  display: flex; align-items: center; gap: 6px; font-size: 12.5px;
  color: var(--text-3); margin-bottom: 14px;
}
.help-breadcrumb a { color: var(--text-2); text-decoration: none; }
.help-breadcrumb a:hover { color: var(--green); }
.help-breadcrumb-sep { color: var(--text-3); }

.help-article-card { padding: 28px 32px; margin-bottom: 20px; }

.help-article { font-size: 14.5px; line-height: 1.75; color: var(--text); max-width: 720px; }
.help-article h3 {
  font-size: 15px; font-weight: 700; color: var(--text); margin: 26px 0 10px;
}
.help-article h3:first-child { margin-top: 0; }
.help-article p { margin: 0 0 14px; }
.help-article ul, .help-article ol { margin: 0 0 14px; padding-left: 22px; }
.help-article li { margin-bottom: 8px; }
.help-article strong { color: var(--text); font-weight: 700; }
.help-article em { color: var(--text-2); }
.help-article a { color: var(--green-text); text-decoration: none; border-bottom: 1px solid var(--green-bg); }
.help-article a:hover { border-bottom-color: var(--green-text); }

.help-article-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.help-article-nav-link {
  display: flex; flex-direction: column; gap: 3px; padding: 12px 16px;
  border: 1px solid var(--border); border-radius: 8px; text-decoration: none;
  color: inherit; transition: border-color 0.12s;
}
.help-article-nav-link:hover { border-color: var(--green); }
.help-article-nav-link--right { text-align: right; align-items: flex-end; }
.help-article-nav-dir { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.help-article-nav-title { font-size: 13px; font-weight: 600; color: var(--text); }

/* Small "?" help icon used for contextual entry points on complex screens */
.help-icon-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--border); color: var(--text-3);
  text-decoration: none; font-size: 12px; font-weight: 700;
  flex-shrink: 0; transition: color 0.12s, border-color 0.12s;
}
.help-icon-link:hover { color: var(--green-text); border-color: var(--green-text); }

@media (max-width: 640px) {
  .help-article-card { padding: 20px; }
  .help-article-nav { grid-template-columns: 1fr; }
}

/* Analyze — query-builder sidebar + results */
.az-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-3); margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}
.az-summary {
  font-size: 13px; color: var(--text-2); margin-bottom: 12px;
}
.az-summary strong { color: var(--text); font-weight: 600; }

.az-panel-heading { display: flex; align-items: center; gap: 5px; min-width: 0; }
.az-panel-title { font-size: 14px; font-weight: 600; color: var(--text); }
.az-panel-icon {
  font-size: 12px; color: var(--text-3); cursor: help; flex-shrink: 0;
}

@media (max-width: 860px) {
  .az-layout { grid-template-columns: 1fr !important; }
  .az-builder { position: static !important; }
  .az-panels { grid-template-columns: 1fr !important; }
}
