/* Robotwalks — shared design system
   Clean, Ollama-inspired UI with an ABB-red accent and dark/light themes. */

:root {
  --bg: #ffffff;
  --surface: #f7f7f8;
  --surface-2: #ffffff;
  --border: #e6e6e9;
  --text: #18181b;
  --text-muted: #6b7280;
  --accent: #ff000f;            /* ABB red */
  --accent-hover: #d2000c;
  --accent-soft: rgba(255, 0, 15, 0.08);
  --accent-contrast: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 1200px;
}

[data-theme="dark"] {
  --bg: #0e0e10;
  --surface: #161619;
  --surface-2: #1c1c20;
  --border: #2a2a2e;
  --text: #ededed;
  --text-muted: #9a9aa3;
  --accent: #ff2b36;            /* brighter red for dark legibility */
  --accent-hover: #ff4d56;
  --accent-soft: rgba(255, 43, 54, 0.14);
  --accent-contrast: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
}

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

html { color-scheme: light dark; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: baseline; gap: 8px; font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.brand a { color: var(--text); text-decoration: none; }
.brand .accent { color: var(--accent); }
.brand .beta { font-size: 11px; font-weight: 600; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); padding: 1px 6px; border-radius: 999px; }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.nav a { color: var(--text-muted); padding: 7px 12px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; }
.nav a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.nav a.active { color: var(--accent); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; font-size: 16px; line-height: 1;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Auth nav slot (Sign In / display-name + Sign Out). */
#rw-auth-nav { display: inline-flex; align-items: center; gap: 6px; }
.nav-user { display: inline-flex; align-items: center; gap: 7px; color: var(--text) !important; font-weight: 600; }
.nav-user:hover { color: var(--accent) !important; text-decoration: none; }
.nav-avatar { width: 24px; height: 24px; border-radius: 999px; object-fit: cover; border: 1px solid var(--border); }
.btn--sm { padding: 5px 10px; font-size: 13px; }

/* ---------- Layout ---------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 28px 24px 64px; }
.container--narrow { max-width: 820px; }

.page-intro { margin-bottom: 24px; }
.page-intro h2 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.page-intro p { color: var(--text-muted); margin-top: 4px; font-size: 15px; }

/* ---------- Buttons ---------- */
.btn {
  padding: 9px 16px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-contrast);
  font-weight: 600; font-size: 14px; cursor: pointer; transition: background 0.15s ease;
}
.btn:hover { background: var(--accent-hover); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface); border-color: var(--accent); color: var(--accent); }

/* ---------- Controls / filters ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 18px;
}
.field, select.field, input.field {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font-size: 14px; min-width: 150px;
  transition: border-color 0.15s ease;
}
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field--search { flex: 1; min-width: 200px; }
.toolbar__spacer { flex: 1; }

.result-count { color: var(--text-muted); font-size: 13px; margin: 4px 2px 18px; }
.result-count strong { color: var(--text); }

/* ---------- Card grid (CivitAI-style, media-first) ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 16px; }
.card {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden; cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  display: flex; flex-direction: column; min-width: 0;
}
.card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.card:hover .card__body h3 a { color: var(--accent); }
.card:hover .card__by { color: var(--text); }
.card:hover .card__metrics { color: var(--text); }

/* Click blink — brief flash of accent background on activation */
@keyframes card-blink {
  0%   { background: var(--surface-2); }
  30%  { background: var(--accent-soft); }
  100% { background: var(--surface-2); }
}
.card.is-clicking { animation: card-blink 0.32s ease-out forwards; }

/* Media leads the card. */
.card__media {
  position: relative; display: block; aspect-ratio: 16 / 10; background: var(--surface);
  overflow: hidden;
}
.card__media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease; }
.card:hover .card__media img { transform: scale(1.04); }
.card__play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 40px; height: 40px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #fff; background: rgba(0, 0, 0, 0.55); padding-left: 3px;
}
.card__play--empty { background: var(--accent); position: absolute; }
.card:hover .card__play { background: var(--accent); }
/* License badge overlays the media, top-left — the primary buying signal. */
.card__lic { position: absolute; top: 8px; left: 8px; }
.card__star {
  position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 999px;
  border: none; cursor: pointer; font-size: 16px; line-height: 1;
  background: rgba(0, 0, 0, 0.5); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.card__star:hover { background: rgba(0, 0, 0, 0.72); }
.card__star.is-saved { color: #f5a623; }

.card__body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 7px; }
.card__body h3 { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__body h3 a { color: var(--text); }
.card__body h3 a:hover { color: var(--accent); text-decoration: none; }
.card__by { font-size: 12.5px; color: var(--text-muted); }
.card__integrator { color: var(--accent); font-weight: 600; }
.card__metrics { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12.5px; color: var(--text-muted); }
.card__metrics .stars { color: #f5a623; font-weight: 600; }
.card__tags { display: flex; gap: 6px; flex-wrap: wrap; }
.card__cmp {
  margin-top: 2px; align-self: flex-start; background: none; border: 1px solid var(--border);
  color: var(--text-muted); font-size: 12px; padding: 4px 10px; border-radius: var(--radius-sm); cursor: pointer;
}
.card__cmp:hover { border-color: var(--accent); color: var(--accent); }

.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tag {
  font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 999px;
  background: var(--surface); color: var(--text-muted); border: 1px solid var(--border);
}
.tag--brand { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); }

/* ---------- License badge (color-coded by openness) ---------- */
.lic { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 6px; letter-spacing: 0.01em;
  display: inline-block; border: 1px solid transparent; white-space: nowrap; }
.lic--permissive  { background: #16331f; color: #4ade80; border-color: #225c34; }
.lic--attribution { background: #33300f; color: #facc15; border-color: #5c5417; }
.lic--commercial  { background: #3a1216; color: #f87171; border-color: #6b2026; }
.lic--other       { background: var(--surface); color: var(--text-muted); border-color: var(--border); }
.lic--unknown     { background: var(--surface); color: var(--text-muted); border-color: var(--border); }
[data-theme="light"] .lic--permissive  { background: #dcfce7; color: #15803d; border-color: #86efac; }
[data-theme="light"] .lic--attribution { background: #fef9c3; color: #a16207; border-color: #fde047; }
[data-theme="light"] .lic--commercial  { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
.lic--lg { font-size: 13px; padding: 5px 12px; }

/* Primary license filter (pills) on the discover page. */
.license-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.license-filter__label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; margin-right: 2px; }
.lic-pill {
  font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
}
.lic-pill:hover { border-color: var(--accent); }
.lic-pill.active { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
/* When a colored license pill is active, keep its semantic tint legible. */
.lic-pill.lic--permissive.active { background: #22c55e; border-color: #22c55e; color: #06210f; }
.lic-pill.lic--attribution.active { background: #eab308; border-color: #eab308; color: #2a2300; }
.lic-pill.lic--commercial.active { background: #ef4444; border-color: #ef4444; color: #fff; }

.state { text-align: center; padding: 64px 20px; color: var(--text-muted); }
.state--error { color: var(--accent); }

/* ---------- Detail page ---------- */
.detail-head { margin-bottom: 8px; }
.detail-head h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.rating-inline { color: #f5a623; font-weight: 600; font-size: 14px; }

/* ---- Rating pill (replaces stars everywhere) ---- */
.rating-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 20px; padding: 0 7px;
  border-radius: 999px; border: 1.5px solid currentColor;
  font-size: 12px; font-weight: 700; line-height: 1;
  vertical-align: middle;
}

/* ---- Rating picker (review form) ---- */
.rating-picker { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 2px; }
.rating-picker__btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid var(--border); background: var(--surface-2);
  font-size: 13px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  /* --rc is set inline per button */
  color: var(--text-muted);
}
.rating-picker__btn:hover {
  color: var(--rc, var(--accent));
  border-color: var(--rc, var(--accent));
  background: color-mix(in srgb, var(--rc, var(--accent)) 14%, transparent);
}
.rating-picker__btn.selected {
  color: var(--rc, var(--accent));
  border-color: var(--rc, var(--accent));
  background: color-mix(in srgb, var(--rc, var(--accent)) 20%, transparent);
}

.panel { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin: 18px 0; }
.panel--desc { color: var(--text); font-size: 15px; line-height: 1.65; white-space: pre-wrap; }
.video-embed { padding: 0; overflow: hidden; }
.video-embed iframe { width: 100%; aspect-ratio: 16 / 9; display: block; border: 0; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-item label { display: block; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 3px; }
.detail-item span { font-size: 14px; color: var(--text); word-break: break-word; }
.detail-item--wide { grid-column: span 2; }

.section-title { font-size: 18px; font-weight: 650; margin: 28px 0 12px; }

.review { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 12px; }
.review__head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.review__head .rating-pill { font-size: 13px; }
.review__head .task { color: var(--accent); font-size: 12px; }
.review p { color: var(--text-muted); font-size: 13.5px; }
.review__meta { font-size: 11.5px; color: var(--text-muted); margin-top: 8px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font-size: 14px;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-group textarea { min-height: 90px; resize: vertical; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 180px; }
.req { color: var(--accent); }

.msg { padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 14px; }
.msg--success { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); }
.msg--error { background: rgba(220, 38, 38, 0.1); color: #dc2626; border: 1px solid #dc2626; }

/* ---------- Auth + profile pages ---------- */
.auth-card { max-width: 420px; margin: 8px auto 0; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.auth-tab {
  flex: 1; padding: 10px; background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); font-size: 15px; font-weight: 600; cursor: pointer;
}
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.char-counter { font-size: 12px; color: var(--text-muted); text-align: right; margin-top: 4px; }
.char-counter.over { color: var(--accent); }

/* Avatar uploader. */
.avatar-edit { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.avatar-preview {
  width: 88px; height: 88px; border-radius: 999px; object-fit: cover;
  border: 1px solid var(--border); background: var(--surface); flex-shrink: 0;
}
.avatar-preview--empty { display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 28px; }

/* Public profile header. */
.profile-head { display: flex; align-items: center; gap: 20px; margin-bottom: 6px; }
.profile-avatar {
  width: 96px; height: 96px; border-radius: 999px; object-fit: cover;
  border: 1px solid var(--border); background: var(--accent-soft); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 36px; color: var(--accent);
}
.profile-name { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.profile-handle { color: var(--text-muted); font-size: 14px; }
.profile-bio { margin: 12px 0; color: var(--text); white-space: pre-wrap; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13.5px; color: var(--text-muted); }
.profile-meta a { font-weight: 500; }

.divider { border: none; border-top: 1px solid var(--border); margin: 26px 0; }

/* OAuth buttons + "or" separator. */
.oauth-sep { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-muted); font-size: 13px; }
.oauth-sep::before, .oauth-sep::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.oauth-buttons { display: flex; flex-direction: column; gap: 10px; }
.oauth-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); transition: filter 0.15s ease, background 0.15s ease;
}
.oauth-btn svg { flex-shrink: 0; }
.oauth-btn:hover { filter: brightness(0.97); }
.oauth-btn--google { background: #ffffff; color: #1f1f1f; border-color: #dadce0; }
.oauth-btn--github { background: #1f2328; color: #ffffff; border-color: #1f2328; }
.oauth-btn--github:hover { background: #32383f; filter: none; }
/* Apple (reserved): .oauth-btn--apple { background:#000; color:#fff; } */

/* ---------- Discover: tabs + sidebar layout ---------- */
.discover-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.sidebar { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; position: sticky; top: 86px; }
.sidebar h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 14px 0 6px; }
.sidebar h4:first-child { margin-top: 0; }
.sidebar select, .sidebar input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font-size: 13px; margin-bottom: 4px; }

.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tab {
  padding: 9px 14px; background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); font-size: 14px; font-weight: 600; cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- License badge + chips ---------- */
.lic-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); border: 1px solid transparent; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.chip--task { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* Structured info panel on the model detail page. */
.info-panel { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.info-panel .btn { text-decoration: none; }

/* Multi-select checkbox grid (submission tags). */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px 14px; }
.check-grid label { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); margin: 0; cursor: pointer; }
.check-grid input { width: auto; }

/* ---------- Compare table ---------- */
.compare-wrap { overflow-x: auto; }
.compare-table { width: 100%; border-collapse: collapse; min-width: 520px; }
.compare-table th, .compare-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 14px; }
.compare-table th { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; width: 150px; }
.compare-table .col-name { font-weight: 700; font-size: 15px; }
.compare-table .stars { color: #f5a623; font-weight: 600; }

/* ---------- Collections + hardware grids ---------- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tile {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm); transition: border-color 0.15s ease, transform 0.15s ease;
  display: block; color: var(--text);
}
.tile:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.tile h3 { font-size: 16px; font-weight: 650; margin-bottom: 6px; color: var(--text); }
.tile p { color: var(--text-muted); font-size: 13.5px; margin-bottom: 10px; }
.tile__meta { font-size: 12.5px; color: var(--text-muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tile__count { background: var(--accent-soft); color: var(--accent); font-weight: 700; padding: 2px 9px; border-radius: 999px; font-size: 12px; }
.featured-flag { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------- Floating compare bar ---------- */
.compare-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 10px 8px 18px; box-shadow: var(--shadow-md);
}
.compare-bar__label { font-size: 13px; font-weight: 600; color: var(--text); }

/* "Save to collection" dropdown on the model page. */
.dropdown { position: relative; display: inline-block; }
.dropdown__menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 230px; z-index: 30;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); padding: 6px; display: none;
}
.dropdown__menu.open { display: block; }
.dropdown__menu button, .dropdown__menu a {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: none; background: none;
  color: var(--text); font-size: 13.5px; border-radius: var(--radius-sm); cursor: pointer; text-decoration: none;
}
.dropdown__menu button:hover, .dropdown__menu a:hover { background: var(--surface); }
.dropdown__divider { border-top: 1px solid var(--border); margin: 5px 0; }

/* ---------- Lead-capture modal (integrator referral) ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(2px);
}
.modal {
  position: relative; width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-md); padding: 26px;
}
.modal h3 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.modal__close {
  position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  cursor: pointer; font-size: 14px; line-height: 1;
}
.modal__close:hover { border-color: var(--accent); color: var(--accent); }
.btn--lg { padding: 12px 22px; font-size: 15px; width: 100%; margin-top: 6px; }

/* ---------- "Get implementation help" CTA banner ---------- */
.cta-help {
  background: linear-gradient(135deg, var(--accent-soft), transparent);
  border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 20px 22px; margin: 18px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.cta-help__text strong { font-size: 16px; }
.cta-help__text p { color: var(--text-muted); font-size: 13.5px; margin-top: 2px; }

/* ---------- Demo gallery (model page, above the fold) ---------- */
.gallery { margin: 0 0 18px; }
.gallery__main {
  position: relative; width: 100%; aspect-ratio: 16 / 9; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.gallery__main img, .gallery__main video, .gallery__main iframe { width: 100%; height: 100%; object-fit: cover; border: 0; display: block; }
.gallery__caption { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; text-align: center; }
.gallery__thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.gallery__thumb {
  position: relative; flex: 0 0 auto; width: 96px; aspect-ratio: 16 / 9; border-radius: var(--radius-sm);
  overflow: hidden; border: 2px solid transparent; cursor: pointer; background: var(--surface);
}
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumb.active { border-color: var(--accent); }
.gallery__add { display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 22px; }

/* ---------- Version selector + training details ---------- */
.version-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 14px; }
.version-bar select { min-width: 160px; }
.version-notes { font-size: 13px; color: var(--text-muted); }
.train-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.train-item label { display: block; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 3px; }
.train-item span { font-size: 14px; color: var(--text); }

/* ---------- Comments ---------- */
.comment { padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment--reply { margin-left: 30px; border-left: 2px solid var(--border); padding-left: 14px; border-bottom: none; }
.comment__head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment__avatar { width: 26px; height: 26px; border-radius: 999px; object-fit: cover; background: var(--accent-soft); }
.comment__name { font-weight: 600; font-size: 13.5px; }
.comment__date { font-size: 11.5px; color: var(--text-muted); }
.comment__body { font-size: 14px; color: var(--text); white-space: pre-wrap; }
.comment__reply-btn { font-size: 12px; color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 2px 0; }
.comment__reply-btn:hover { color: var(--accent); }

/* ---------- Integrator profile + directory ---------- */
.integrator-head { display: flex; gap: 18px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.integrator-logo {
  width: 84px; height: 84px; border-radius: var(--radius); object-fit: cover; flex-shrink: 0;
  background: var(--accent-soft); display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 800; color: var(--accent);
}
.verified-badge { font-size: 12px; font-weight: 700; color: #4ade80; }
.integrator-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13.5px; color: var(--text-muted); margin-top: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .discover-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}
@media (max-width: 640px) {
  .site-header__inner { padding: 12px 16px; gap: 12px; }
  .container { padding: 20px 16px 48px; }
  .detail-grid, .train-grid { grid-template-columns: 1fr; }
  .detail-item--wide { grid-column: span 1; }
  .field { min-width: 0; flex: 1 1 140px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
}
