/* ============================================================
   References / Service Guide — modernized (global, prefix rg-)
   ------------------------------------------------------------
   Used by the shared EditReferenceTable control (segmented nav +
   content sections) on both the standalone Service Guide page
   (expanded) and the edit-page reference panel (compact .rg-embed).
   Token-driven (yourspec-tokens.css). Icons use Radzen .rzi
   (Material Symbols), loaded app-wide by RadzenTheme.
   ============================================================ */

/* Standalone page root (Service Guide). flex-shrink:0 keeps the page at
   full content height inside MainLayout's flex-column scroll container. */
.rg-refpage {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    flex-shrink: 0;
    background: var(--bg-1);
    color: var(--fg-1);
    font-family: var(--font-sans);
}

/* -- Page header ---------------------------------------------- */
.rg-head { background: var(--bg-surface); border-bottom: 1px solid var(--border-1); flex-shrink: 0; }
.rg-head__inner { padding: 22px 32px; }
.rg-crumbs { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); letter-spacing: 0.06em; text-transform: uppercase; }
.rg-crumbs .sep { margin: 0 8px; opacity: 0.5; }
.rg-head h1 { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.15; margin: 8px 0 0; }
.rg-head__lede { margin: 6px 0 0; font-size: 13.5px; color: var(--fg-2); max-width: 680px; line-height: 1.5; }

/* -- Expanded layout wrapper (page) --------------------------- */
.rg-guide { flex: 1; width: 100%; box-sizing: border-box; padding: 20px 32px 48px; min-height: 0; }

/* -- Compact / embedded mode (edit-page panel) ---------------- */
.rg-embed { height: 100%; min-height: 0; display: flex; flex-direction: column; background: var(--bg-1); font-family: var(--font-sans); color: var(--fg-1); }
.rg-embed .rg-seg-nav { margin: 0; border-radius: 0; border-left: 0; border-right: 0; border-top: 0; position: static; gap: 12px; padding: 8px 10px; flex-shrink: 0; }
.rg-embed .rg-seg-group__label { display: none; }
.rg-embed .rg-seg-group { gap: 4px; }
.rg-embed .rg-seg-group + .rg-seg-group { padding-left: 12px; margin-left: 0; border-left: 1px solid var(--border-1); }
.rg-embed .rg-seg-btn { height: 30px; font-size: 12.5px; padding: 0 12px; }
.rg-embed .rg-seg-btn .rzi { font-size: 15px; }
.rg-embed__scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px 20px; scrollbar-width: thin; }
.rg-embed .rg-section__title { font-size: 16px; }
.rg-embed .rg-section__sub { font-size: 12px; }
.rg-embed .rg-table-scroll { max-height: none; overflow-y: visible; }
.rg-embed .rg-wire-cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.rg-embed .rg-gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (max-width: 560px) { .rg-embed .rg-seg-group + .rg-seg-group { border-left: 0; padding-left: 0; } }

/* -- Segmented nav -------------------------------------------- */
.rg-seg-nav { display: flex; flex-wrap: wrap; gap: 18px; padding: 6px; background: var(--bg-surface); border: 1px solid var(--border-1); border-radius: var(--radius-2); margin-bottom: 18px; position: sticky; top: 0; z-index: 5; }
.rg-seg-group { display: inline-flex; align-items: center; gap: 6px; }
.rg-seg-group__label { font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--fg-muted); padding: 0 4px 0 6px; }
.rg-seg-group + .rg-seg-group { border-left: 1px solid var(--border-1); padding-left: 14px; }
.rg-seg-btn { appearance: none; border: 1px solid transparent; background: transparent; height: 32px; padding: 0 14px; border-radius: var(--radius-pill); font-family: var(--font-sans); font-size: 13px; font-weight: 500; color: var(--fg-2); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: background 100ms linear, color 100ms linear, border-color 100ms linear; }
.rg-seg-btn .rzi { font-size: 16px; color: var(--fg-3); }
.rg-seg-btn:hover { background: var(--bg-2); color: var(--fg-1); }
.rg-seg-btn.is-active { background: var(--ys-green-50); color: var(--fg-brand); border-color: var(--ys-green-100); }
.rg-seg-btn.is-active .rzi { color: var(--fg-brand); }

.rg-section { display: none; }
.rg-section.is-active { display: block; animation: rg-fade 160ms ease-out; }
@keyframes rg-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* -- Section heads + prose ------------------------------------ */
.rg-section__head, .rg-body__head { margin-bottom: 16px; }
.rg-section__title { font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.rg-section__sub { margin: 4px 0 0; font-size: 13px; color: var(--fg-3); }

.rg-prose { max-width: 760px; }
.rg-prose .rg-subhead { font-family: var(--font-mono); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--fg-brand); margin: 20px 0 6px; }
.rg-prose .rg-subhead:first-child { margin-top: 0; }
.rg-prose p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.6; color: var(--fg-2); }
.rg-prose ul { margin: 0 0 10px; padding-left: 0; list-style: none; display: grid; gap: 6px; }
.rg-prose ul li { position: relative; padding-left: 18px; font-size: 13px; line-height: 1.55; color: var(--fg-2); }
.rg-prose ul li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--fg-brand); }
.rg-prose a { color: var(--fg-brand); text-decoration: none; font-weight: 500; }
.rg-prose a:hover { text-decoration: underline; }

/* -- Wire spec cards ------------------------------------------ */
.rg-wire-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 22px; }
.rg-wire-card { border: 1px solid var(--border-1); border-radius: var(--radius-2); background: var(--bg-surface); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.rg-wire-card__name { font-size: 14px; font-weight: 700; letter-spacing: -0.005em; margin: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rg-wire-card__name a { color: var(--fg-brand); text-decoration: none; }
.rg-wire-card__name a:hover { text-decoration: underline; }
.rg-wire-card__tag { font-family: var(--font-mono); font-size: 10px; color: var(--fg-3); font-weight: 500; letter-spacing: 0; }
.rg-wire-card__facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.rg-wire-card__facts li { position: relative; padding-left: 16px; font-size: 12.5px; line-height: 1.5; color: var(--fg-2); }
.rg-wire-card__facts li::before { content: ""; position: absolute; left: 0; top: 7px; width: 4px; height: 4px; border-radius: 50%; background: var(--border-strong); }
.rg-wire-card__specs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; padding-top: 10px; border-top: 1px solid var(--border-2); }
.rg-spec-chip { font-family: var(--font-mono); font-size: 10px; background: var(--bg-2); border: 1px solid var(--border-1); border-radius: var(--radius-1); padding: 2px 7px; color: var(--fg-2); display: inline-flex; align-items: center; gap: 4px; }
.rg-spec-chip .rzi { font-size: 12px; color: var(--fg-3); }

/* -- Catalog / data table ------------------------------------- */
.rg-table-card { border: 1px solid var(--border-1); border-radius: var(--radius-2); background: var(--bg-surface); overflow: hidden; }
.rg-table-toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border-1); background: var(--bg-surface); flex-wrap: wrap; }
.rg-table-toolbar h3 { margin: 0; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.rg-table-toolbar h3 .rzi { font-size: 17px; color: var(--fg-3); }
.rg-table-count { font-family: var(--font-mono); font-size: 10px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.rg-table-search { margin-left: auto; display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--bg-1); border: 1px solid var(--border-1); border-radius: var(--radius-2); min-width: 180px; max-width: 280px; transition: border-color 120ms linear, box-shadow 120ms linear; }
.rg-table-search:focus-within { border-color: var(--fg-brand); box-shadow: var(--shadow-focus); }
.rg-table-search input { border: 0; outline: 0; background: transparent; font: inherit; font-size: 12.5px; color: var(--fg-1); flex: 1; min-width: 0; }
.rg-table-search input::placeholder { color: var(--fg-muted); }
.rg-table-search .rzi { color: var(--fg-3); font-size: 15px; }

.rg-table-scroll { overflow-x: auto; max-height: 460px; overflow-y: auto; }
.rg-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.rg-table thead th { position: sticky; top: 0; z-index: 1; background: var(--bg-2); border-bottom: 1px solid var(--border-1); font-family: var(--font-mono); font-weight: 500; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-3); text-align: left; padding: 8px 12px; white-space: nowrap; vertical-align: middle; }
.rg-table thead th.num { text-align: right; }
.rg-table tbody td { padding: 7px 12px; border-bottom: 1px solid var(--border-2); vertical-align: middle; color: var(--fg-1); }
.rg-table tbody tr:last-child td { border-bottom: 0; }
.rg-table tbody tr:hover td { background: var(--ys-green-50); }
.rg-table td.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--fg-2); }
.rg-table td.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.rg-table td.price { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--fg-1); white-space: nowrap; }
.rg-table .rg-disc { color: var(--ys-green-600); font-size: 11px; margin-left: 3px; vertical-align: -1px; cursor: help; }
.rg-table a { color: var(--fg-brand); text-decoration: none; font-weight: 500; }
.rg-table a:hover { text-decoration: underline; }
.rg-table th.group { text-align: center; background: var(--ys-green-50); color: var(--ys-green-700); border-bottom: 1px solid var(--ys-green-100); }

.rg-swatch-cell { display: inline-flex; align-items: center; gap: 7px; }
.rg-swatch { width: 13px; height: 13px; border-radius: 3px; flex-shrink: 0; border: 1px solid rgba(0,0,0,0.18); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15); }
.rg-stock { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; white-space: nowrap; }
.rg-stock::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.rg-stock--in { color: var(--ys-green-700); }
.rg-stock--in::before { background: var(--ys-green-600); }
.rg-stock--low { color: #9a6a00; }
.rg-stock--low::before { background: var(--ys-amber); }
.rg-stock--no { color: var(--ys-red); }
.rg-stock--no::before { background: var(--ys-red); }

.rg-table-empty { padding: 36px 16px; text-align: center; color: var(--fg-3); font-size: 13px; }
.rg-table-note { padding: 8px 12px; font-size: 11px; color: var(--fg-muted); background: var(--bg-2); border-top: 1px solid var(--border-2); font-family: var(--font-mono); letter-spacing: 0.02em; }

/* -- Marking sample gallery + lightbox ------------------------ */
.rg-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; margin-top: 12px; }
.rg-sample { border: 1px solid var(--border-1); border-radius: var(--radius-2); overflow: hidden; background: var(--bg-surface); cursor: zoom-in; margin: 0; transition: border-color 120ms linear, box-shadow 120ms linear, transform 120ms linear; }
.rg-sample:hover { border-color: var(--fg-2); box-shadow: 0 3px 10px rgba(0,0,0,0.06); transform: translateY(-1px); }
.rg-sample img { display: block; width: 100%; height: auto; background: var(--bg-2); }
.rg-sample__cap { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 7px 10px; border-top: 1px solid var(--border-2); }
.rg-sample__type { font-size: 11.5px; font-weight: 600; color: var(--fg-1); }
.rg-sample__color { font-family: var(--font-mono); font-size: 10px; color: var(--fg-3); display: inline-flex; align-items: center; gap: 5px; }

.rg-lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(15,20,18,0.82); display: flex; align-items: center; justify-content: center; padding: 32px; }
.rg-lightbox img { max-width: 90vw; max-height: 80vh; border-radius: var(--radius-2); box-shadow: 0 24px 60px rgba(0,0,0,0.4); }
.rg-lightbox__cap { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); font-family: var(--font-mono); font-size: 12px; color: #fff; background: rgba(0,0,0,0.5); padding: 6px 14px; border-radius: var(--radius-pill); }
.rg-lightbox__close { position: absolute; top: 20px; right: 24px; appearance: none; border: 0; background: rgba(255,255,255,0.12); color: #fff; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.rg-lightbox__close:hover { background: rgba(255,255,255,0.22); }
.rg-lightbox__close .rzi { font-size: 22px; }

/* -- Info note ------------------------------------------------ */
.rg-note { display: flex; gap: 10px; align-items: flex-start; background: var(--bg-tint); border-left: 3px solid var(--fg-brand); padding: 12px 14px; border-radius: 0 var(--radius-2) var(--radius-2) 0; margin-bottom: 16px; }
.rg-note .rzi { color: var(--fg-brand); font-size: 18px; flex-shrink: 0; }
.rg-note p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--fg-2); }

@media (max-width: 760px) {
    .rg-head__inner, .rg-guide { padding-left: 16px; padding-right: 16px; }
    .rg-seg-nav { gap: 10px; }
    .rg-seg-group + .rg-seg-group { border-left: 0; padding-left: 0; }
    .rg-table-search { margin-left: 0; width: 100%; max-width: none; }
}
