/* StoreFront Builder chrome. Radzen material-base supplies component
   styling; this file is layout + the three-pane editor. Builder CSS never
   ships to tenant sites (docs/DESIGN.md). */

:root {
    --sfb-bg: #f4f5f7;
    --sfb-surface: #ffffff;
    --sfb-border: #dde1e6;
    --sfb-ink: #1c2430;
    --sfb-text: #45505e;
    --sfb-soft: #7a8595;
    --sfb-brand: #1f3a5f;
    --sfb-accent: #c9a227;
    --sfb-danger: #b3261e;
    --sfb-radius: 8px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--sfb-bg);
    color: var(--sfb-ink);
}

.sf-app { display: flex; flex-direction: column; min-height: 100vh; }

/* ---- top bar ---- */
.sf-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    height: 52px;
    background: var(--sfb-brand);
    color: #fff;
}

.sf-brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.sf-brand span { color: var(--sfb-accent); }
.sf-topnav { display: flex; align-items: center; gap: 1rem; }
.sf-user { opacity: 0.85; font-size: 0.85rem; }
.sf-signout { color: #fff; opacity: 0.85; font-size: 0.85rem; }

.sf-banner {
    padding: 0.5rem 1.25rem;
    font-size: 0.85rem;
}

.sf-banner-pending { background: #fdf3d7; color: #6d5410; border-bottom: 1px solid #eadfb4; }
.sf-banner-billing { background: #fbe4e2; color: #7c2320; border-bottom: 1px solid #efc4c0; }
.sf-banner-billing a { color: #7c2320; font-weight: 600; margin-left: 0.4rem; }

/* ---- billing page ---- */
.sf-billing { padding: 1.5rem 1.25rem; max-width: 1100px; margin: 0 auto; width: 100%; }
.sf-billing h1 { margin: 0 0 1rem; font-size: 1.4rem; }
.sf-billing h2 { margin: 1.75rem 0 0.75rem; font-size: 1.1rem; }
.sf-billing-attention { background: #fbe4e2; color: #7c2320; border: 1px solid #efc4c0; border-radius: 8px; padding: 0.75rem 1rem; font-size: 0.9rem; margin-bottom: 1rem; }
.sf-billing-attention-pay { display: block; margin-top: 0.25rem; font-size: 0.8rem; opacity: 0.85; }
.sf-billing-message { background: #e7f0e7; color: #235023; border: 1px solid #c4dcc4; border-radius: 8px; padding: 0.75rem 1rem; font-size: 0.9rem; margin-bottom: 1rem; }
.sf-module-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.9rem; }
.sf-module-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.sf-module-meta { list-style: none; margin: 0.5rem 0 0; padding: 0; color: var(--sfb-soft); font-size: 0.85rem; display: flex; flex-direction: column; gap: 0.2rem; }
.sf-billing-plans-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.sf-cycle-toggle { display: flex; gap: 0.4rem; }
.sf-plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.9rem; }
.sf-plan-card h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.sf-plan-price { margin: 0 0 0.75rem; font-size: 1.3rem; font-weight: 700; }
.sf-plan-price span { font-size: 0.8rem; font-weight: 400; color: var(--sfb-soft); }
.sf-plan-includes { margin: 0 0 0.5rem; font-size: 0.82rem; color: var(--sfb-soft); }
.sf-plan-savings { margin: 0 0 0.5rem; font-size: 0.82rem; color: #235023; font-weight: 600; }
.sf-invoice-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--sfb-border); border-radius: 8px; font-size: 0.87rem; }
.sf-invoice-table th, .sf-invoice-table td { text-align: left; padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--sfb-border); }
.sf-invoice-table tr:last-child td { border-bottom: 0; }

.sf-main { flex: 1; display: flex; flex-direction: column; }

.sf-loading { color: var(--sfb-soft); padding: 2rem; }

/* ---- auth pages ---- */
.sf-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #16233a 0%, #1f3a5f 100%);
    padding: 1.5rem;
}

.sf-auth-card {
    background: var(--sfb-surface);
    border-radius: 12px;
    padding: 2.25rem;
    width: 100%;
    max-width: 430px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.sf-auth-brand { display: inline-block; margin-bottom: 1rem; color: var(--sfb-brand); font-size: 1.15rem; }
.sf-auth-brand span { color: var(--sfb-accent); }
.sf-auth-card h1 { margin: 0 0 0.25rem; font-size: 1.4rem; }
.sf-auth-sub { color: var(--sfb-soft); margin-top: 0; }

.sf-auth-form { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 1rem; }
.sf-auth-form label { font-size: 0.85rem; font-weight: 600; margin-top: 0.6rem; }
.sf-auth-form input[type="text"],
.sf-auth-form input[type="email"],
.sf-auth-form input[type="password"] {
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--sfb-border);
    border-radius: 6px;
    font-size: 0.95rem;
}
.sf-auth-form small { color: var(--sfb-soft); }
.sf-check { display: flex; gap: 0.4rem; align-items: center; font-size: 0.85rem; margin-top: 0.6rem; }
.sf-optional { font-weight: 400; color: var(--sfb-soft); }
.sf-auth-footer { margin-top: 1.25rem; font-size: 0.9rem; color: var(--sfb-soft); }

.sf-btn {
    border: none;
    border-radius: 6px;
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
}

.sf-btn-primary { background: var(--sfb-brand); color: #fff; }
.sf-btn-primary:hover { filter: brightness(1.1); }

.sf-alert { border-radius: 6px; padding: 0.6rem 0.8rem; font-size: 0.9rem; margin: 0.75rem 0; }
.sf-alert-error { background: #fdecea; color: var(--sfb-danger); border: 1px solid #f5c6c0; }
.sf-alert-success { background: #e8f5ec; color: #1c6b34; border: 1px solid #bfe3c9; }

/* ---- dashboard ---- */
.sf-dash { padding: 1.5rem; max-width: 1100px; margin: 0 auto; width: 100%; }
.sf-site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.sf-site-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.sf-site-card-head h2 { margin: 0; font-size: 1.1rem; }
.sf-site-meta { list-style: none; padding: 0; margin: 0.75rem 0; color: var(--sfb-text); font-size: 0.85rem; display: flex; flex-direction: column; gap: 0.3rem; }
.sf-site-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.sf-empty-card { color: var(--sfb-soft); }

/* ---- editor: three panes ---- */
.sf-editor { display: flex; flex-direction: column; height: calc(100vh - 52px); }

.sf-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 1rem;
    background: var(--sfb-surface);
    border-bottom: 1px solid var(--sfb-border);
    flex-wrap: wrap;
}

.sf-editor-toolbar .sf-toolbar-spacer { flex: 1; }
.sf-save-stamp { color: var(--sfb-soft); font-size: 0.8rem; white-space: nowrap; }
.sf-save-stamp.sf-save-error { color: var(--sfb-danger); }

.sf-editor-body { flex: 1; display: flex; min-height: 0; }

.sf-pane-left {
    width: 300px;
    min-width: 300px;
    background: var(--sfb-surface);
    border-right: 1px solid var(--sfb-border);
    overflow-y: auto;
    padding: 0.75rem;
}

.sf-pane-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #e8eaee;
}

.sf-pane-right {
    width: 340px;
    min-width: 340px;
    background: var(--sfb-surface);
    border-left: 1px solid var(--sfb-border);
    overflow-y: auto;
    padding: 0.75rem;
}

/* outline */
.sf-outline-pagebar { display: flex; gap: 0.4rem; align-items: center; margin-bottom: 0.75rem; }
.sf-outline-pagebar .rz-dropdown { flex: 1; }

.sf-outline-list { list-style: none; margin: 0; padding: 0; }

.sf-outline-section {
    border: 1px solid var(--sfb-border);
    border-radius: var(--sfb-radius);
    margin-bottom: 0.6rem;
    background: #fbfcfd;
}

.sf-outline-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.45rem;
    cursor: pointer;
    border-radius: var(--sfb-radius);
    font-size: 0.85rem;
}

.sf-outline-row:hover { background: #eef1f5; }
.sf-outline-row.sf-selected { background: #e2ebf7; outline: 1px solid #b8cdea; }
.sf-outline-row .sf-row-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-outline-row .sf-row-label.sf-hidden-item { opacity: 0.45; text-decoration: line-through; }

/* The row label is a real button (keyboard users select a row with it; the
   row's own click stays for the mouse). Reset to read as plain text. */
.sf-row-select {
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    text-align: left;
    padding: 0;
    cursor: pointer;
}

.sf-drag {
    cursor: grab;
    color: var(--sfb-soft);
    user-select: none;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0.1rem 0.15rem;
}

.sf-row-btn {
    border: none;
    background: transparent;
    color: var(--sfb-soft);
    cursor: pointer;
    padding: 0.1rem 0.25rem;
    border-radius: 4px;
    font-size: 0.8rem;
    line-height: 1.2;
}

.sf-row-btn:hover { background: #dfe4ea; color: var(--sfb-ink); }
.sf-row-btn.sf-danger:hover { color: var(--sfb-danger); }

.sf-outline-blocks { list-style: none; margin: 0; padding: 0 0.35rem 0.35rem 1.1rem; }
.sf-outline-addblock { margin: 0.2rem 0 0.4rem 1.1rem; }

/* ---- editor: direct manipulation (ultraplan round 7) ---- */

/* Left-pane tabs: Outline (the map + keyboard path) / Blocks (the tray). */
.sf-pane-tabs { margin-bottom: 0.6rem; }

/* The outline demotes to a page map: row actions appear on hover or when a
   control inside the row has focus. Opacity only, never display:none, so
   the buttons keep their place in the tab order for keyboard users. */
.sf-outline-row .sf-row-btn { opacity: 0; transition: opacity 0.12s ease; }
.sf-outline-row:hover .sf-row-btn,
.sf-outline-row:focus-within .sf-row-btn,
.sf-outline-row.sf-selected .sf-row-btn { opacity: 1; }

/* Focus rings on the outline and tray controls: brand navy on white (the
   gold accent does not reach 3:1 there). */
.sf-tray-card:focus-visible,
.sf-outline-row .sf-row-btn:focus-visible,
.sf-row-select:focus-visible { outline: 2px solid var(--sfb-brand); outline-offset: 2px; }

/* The block tray: compact cards the dealer drags onto the preview. */
.sf-tray { display: flex; flex-direction: column; gap: 0.35rem; }
.sf-tray-actions { margin: 0.4rem 0 0.7rem; }
.sf-tray-group h4 {
    margin: 0.7rem 0 0.35rem;
    font-size: 0.72rem;
    color: var(--sfb-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.sf-tray-group:first-child h4 { margin-top: 0.1rem; }

.sf-tray-card {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    width: 100%;
    text-align: left;
    border: 1px solid var(--sfb-border);
    border-radius: 8px;
    background: #fff;
    color: var(--sfb-ink);
    padding: 0.45rem 0.55rem;
    margin-bottom: 0.35rem;
    font: inherit;
    cursor: grab;
    /* pan-y: a vertical swipe on a phone scrolls the tray; editor.js lifts
       the card on a sideways pull or a hold instead. */
    touch-action: pan-y;
    user-select: none;
    transition: border-color 0.12s ease, background-color 0.12s ease;
}
.sf-tray-card:hover { border-color: var(--sfb-brand); background: #f4f8fd; }
.sf-tray-card:active { cursor: grabbing; }
.sf-tray-grip { color: var(--sfb-soft); font-size: 0.95rem; line-height: 1.25; }
.sf-tray-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.sf-tray-text strong { font-size: 0.9rem; font-weight: 600; line-height: 1.25; }
.sf-tray-text span { color: var(--sfb-text); font-size: 0.78rem; line-height: 1.3; }

.sf-tray-help { color: var(--sfb-text); font-size: 0.78rem; line-height: 1.4; margin: 0 0 0.4rem; }

/* Screen-reader-only text (the toolbar's live region). */
.sf-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* The ghost chip that follows the pointer during a tray drag (editor.js
   positions it with a transform). */
.sf-tray-ghost {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    background: var(--sfb-brand);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

/* While a tray card is lifted the iframe must not swallow the pointer: the
   Builder hit-tests against the rects the bridge reported instead. */
body.sf-dragging { cursor: grabbing; user-select: none; }
body.sf-dragging .sf-preview-frame-wrap iframe { pointer-events: none; }
body.sf-dragging .sf-tray-card { cursor: grabbing; }

@media (prefers-reduced-motion: reduce) {
    .sf-outline-row .sf-row-btn,
    .sf-tray-card,
    .sf-preview-frame-wrap { transition: none; }
}

/* preview pane */
.sf-device-bar {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    justify-content: center;
    padding: 0.4rem;
}

.sf-preview-scroll {
    --sfb-scale: 1;
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0 1rem 1rem;
}

.sf-preview-frame-wrap {
    background: #fff;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
    border-radius: 6px;
    overflow: hidden;
    height: fit-content;
    transition: width 0.15s ease;
}

/* Fixed device widths (UX-major-1): the wrap occupies the SCALED footprint
   while the iframe inside renders at the true device width (--sfb-device-w)
   and is transform-scaled down to fit; "Desktop 1280" therefore shows the
   real 1280px layout instead of clamping to the pane. --sfb-scale is set by
   editor.js from the pane width (1 when the pane is wide enough). */
.sf-preview-frame-wrap:not(.sf-preview-full) {
    width: calc(var(--sfb-device-w) * var(--sfb-scale));
    height: calc(100vh - 175px);
}

.sf-preview-frame-wrap:not(.sf-preview-full) iframe {
    width: var(--sfb-device-w);
    height: calc((100vh - 175px) / var(--sfb-scale));
    transform: scale(var(--sfb-scale));
    transform-origin: top left;
}

.sf-preview-full { width: 100%; max-width: 100%; }

.sf-preview-frame-wrap iframe {
    display: block;
    width: 100%;
    height: calc(100vh - 175px);
    border: none;
    background: #fff;
}

.sf-preview-missing { color: var(--sfb-soft); padding: 3rem 1rem; text-align: center; }

/* property panel */
.sf-panel h3 { margin: 0.25rem 0 0.75rem; font-size: 1rem; }
.sf-panel h4 { margin: 0.75rem 0 0.4rem; font-size: 0.85rem; color: var(--sfb-text); }

.sf-field { margin-bottom: 0.7rem; }
.sf-field > label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--sfb-text); margin-bottom: 0.25rem; }
.sf-field .rz-textbox, .sf-field .rz-dropdown, .sf-field .rz-spinner { width: 100%; }

.sf-subobject {
    border: 1px solid var(--sfb-border);
    border-radius: var(--sfb-radius);
    padding: 0.55rem;
    margin-bottom: 0.7rem;
    background: #fbfcfd;
}

.sf-subobject-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.4rem; }
.sf-subobject-head label { font-size: 0.8rem; font-weight: 700; color: var(--sfb-text); }

.sf-list-item {
    border: 1px solid var(--sfb-border);
    border-radius: var(--sfb-radius);
    padding: 0.55rem;
    margin-bottom: 0.5rem;
    background: #fff;
}

.sf-list-item-head { display: flex; justify-content: flex-end; gap: 0.2rem; margin-bottom: 0.3rem; }

.sf-choice-list { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; }
.sf-choice-list label { display: flex; gap: 0.4rem; align-items: center; }

.sf-panel-empty { color: var(--sfb-soft); font-size: 0.9rem; padding: 1rem 0.25rem; }

.sf-richtext-editor .rz-html-editor { min-height: 180px; }

/* add-block dialog */
.sf-addblock-group h4 { margin: 0.9rem 0 0.4rem; font-size: 0.85rem; color: var(--sfb-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.sf-addblock-item {
    display: block;
    width: 100%;
    text-align: left;
    border: 1px solid var(--sfb-border);
    border-radius: var(--sfb-radius);
    background: #fff;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.4rem;
    cursor: pointer;
}
.sf-addblock-item:hover { border-color: var(--sfb-brand); background: #f4f8fd; }
.sf-addblock-item strong { display: block; font-size: 0.92rem; }
.sf-addblock-item span { color: var(--sfb-soft); font-size: 0.8rem; }

/* settings page */
.sf-settings { padding: 1.5rem; max-width: 900px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 1rem; }
.sf-settings h1 { margin: 0; }
.sf-settings-section h2 { font-size: 1.05rem; margin: 0 0 0.75rem; }
/* Theme picker: a GRID of identity cards, sized so ten themes wrap into
   rows rather than one endless strip. The card chrome is Builder UI; the
   preview inside is painted entirely from the theme's own tokens. */
/* margin-top: the wizard's intro paragraph sat 10px off the first card row (verified live). */
.sf-theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.sf-theme-card {
    border: 2px solid var(--sfb-border);
    border-radius: var(--sfb-radius);
    padding: 0.6rem;
    cursor: pointer;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.sf-theme-card.sf-selected { border-color: var(--sfb-brand); box-shadow: 0 0 0 2px rgba(31, 58, 95, 0.15); }
.sf-theme-card strong { font-size: 0.9rem; margin-top: 0.45rem; }
.sf-theme-tagline { color: var(--sfb-soft); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
.sf-theme-summary { color: var(--sfb-soft); font-size: 0.8rem; margin: 0.25rem 0 0; line-height: 1.35; }

/* The token-painted identity preview: ground, display-voice heading sample,
   accent rule, plate + material chips. background/border/radius/typography
   arrive inline from the theme document. */
.sf-theme-preview {
    border: 1px solid transparent;
    padding: 0.6rem 0.65rem 0.55rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    min-height: 92px;
    overflow: hidden;
}
.sf-theme-preview-heading {
    font-size: 1.05rem;
    line-height: 1.1;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sf-theme-preview-rule { width: 2.2rem; min-height: 1px; }
.sf-theme-preview-sample { font-size: 0.72rem; opacity: 0.85; }
.sf-theme-preview-chips { display: flex; gap: 0.3rem; margin-top: auto; }
.sf-theme-preview-chip { width: 16px; height: 16px; border-radius: 3px; display: inline-block; }

.sf-hours-row { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.4rem; }
.sf-hours-row .sf-hours-day { width: 90px; font-size: 0.85rem; font-weight: 600; text-transform: capitalize; }

.sf-nav-row { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.4rem; }
.sf-nav-row .rz-textbox { flex: 1; }

.sf-hosts-list { list-style: none; padding: 0; margin: 0; font-size: 0.9rem; }
.sf-hosts-list li { padding: 0.3rem 0; border-bottom: 1px solid var(--sfb-border); display: flex; gap: 0.6rem; align-items: center; }

.sf-launch-row { display: flex; align-items: center; gap: 0.9rem; }
.sf-launch-note { color: var(--sfb-soft); font-size: 0.85rem; }

/* ---------- launch readiness checklist ---------- */

.sf-readiness { list-style: none; padding: 0; margin: 0; }
.sf-readiness li { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.45rem 0; border-bottom: 1px solid var(--sfb-border); }
.sf-readiness li:last-child { border-bottom: none; }
.sf-readiness li p { margin: 0.15rem 0 0; }
.sf-readiness-mark { flex: 0 0 1.1rem; font-weight: 700; line-height: 1.4; text-align: center; }
.sf-readiness-ok .sf-readiness-mark { color: #1e7d47; }
.sf-readiness-warn .sf-readiness-mark { color: var(--sfb-accent); }
.sf-readiness-blocked .sf-readiness-mark { color: var(--sfb-danger); }

.sf-readiness-findings { margin-top: 0.7rem; font-size: 0.9rem; }
.sf-readiness-findings summary { cursor: pointer; font-weight: 600; }
.sf-readiness-findings summary .sf-launch-note { font-weight: 400; margin-left: 0.35rem; }
.sf-findings { list-style: none; padding: 0.4rem 0 0; margin: 0; }
.sf-findings li { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.25rem 0; }
.sf-finding-error .sf-readiness-mark { color: var(--sfb-danger); }
.sf-finding-warning .sf-readiness-mark { color: var(--sfb-accent); }

/* The remedy link on open rows/findings: "Fix this" navigates, "Show me"
   jumps the editor to the page and block. Styled as one quiet link so the
   checklist stays a list, not a button wall. */
.sf-readiness-fix {
    display: inline-block;
    margin-left: 0.4rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--sfb-brand);
    text-decoration: underline;
    cursor: pointer;
}
.sf-readiness-locate { background: none; border: none; padding: 0; font-family: inherit; }

/* ---------- search visibility page ---------- */

.sf-seo-hero h2 { margin: 0 0 0.35rem; }
.sf-seo-hero { border-left: 4px solid var(--sfb-border); }
.sf-seo-hero-good { border-left-color: #1e7d47; }
.sf-seo-hero-bad { border-left-color: var(--sfb-danger); }
.sf-seo-hero-idle { border-left-color: var(--sfb-soft); }
.sf-seo-good { color: #1e7d47; margin: 0; }
.sf-seo-bad { color: var(--sfb-danger); margin: 0 0 0.5rem; }

/* ---------- domains page ---------- */

.sf-domain-head { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.sf-domain-head h2 { margin: 0; }
.sf-domain-subhead { font-size: 0.95rem; margin: 0.9rem 0 0.4rem; }
.sf-domain-error { color: var(--sfb-danger, #b3261e); font-size: 0.85rem; margin: 0.4rem 0 0; }
.sf-domain-records { width: 100%; border-collapse: collapse; font-size: 0.85rem; display: block; overflow-x: auto; }
.sf-domain-records th { text-align: left; color: var(--sfb-soft); font-weight: 600; padding: 0.3rem 0.6rem 0.3rem 0; }
.sf-domain-records td { padding: 0.35rem 0.6rem 0.35rem 0; border-top: 1px solid var(--sfb-border); vertical-align: middle; }
.sf-domain-records code { word-break: break-all; }

/* ---------- catalog pages ---------- */

.sf-topnav-link { color: #fff; opacity: 0.85; text-decoration: none; font-size: 0.9rem; margin-right: 0.9rem; }
.sf-topnav-link:hover { opacity: 1; text-decoration: underline; }

.sf-catalog { max-width: 1100px; margin: 0 auto; padding: 1.2rem; }
.sf-catalog h1 { margin-bottom: 0.9rem; }

.sf-catalog-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.8rem; margin-bottom: 0.9rem; }
.sf-catalog-head h1 { margin-bottom: 0; }

.sf-catalog-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.8rem; }
.sf-catalog-filters .rz-textbox { flex: 1 1 220px; }

.sf-catalog-bulkbar { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; font-size: 0.9rem; }

.sf-catalog-product-cell { display: flex; align-items: center; gap: 0.6rem; }
.sf-catalog-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 5px; border: 1px solid var(--sfb-border); background: #fff; }
.sf-catalog-thumb-empty { display: inline-block; width: 44px; height: 44px; border-radius: 5px; border: 1px dashed var(--sfb-border); background: #f3f4f6; }
.sf-catalog-subtle { color: var(--sfb-soft); font-size: 0.82rem; }

.sf-product-editor .sf-field { margin-bottom: 0.7rem; }
.sf-field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.7rem; }
.sf-switch-row { display: flex; align-items: flex-start; gap: 0.8rem; margin-bottom: 0.8rem; }
.sf-switch-row .sf-launch-note { margin: 0; }
.sf-editor-save-row { margin-top: 1rem; margin-bottom: 2rem; }

.sf-image-row { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.6rem; }
.sf-image-preview { width: 56px; height: 56px; object-fit: cover; border-radius: 5px; border: 1px solid var(--sfb-border); background: #fff; }
.sf-image-fields { flex: 1; display: grid; gap: 0.4rem; }
.sf-image-actions { display: flex; gap: 0.3rem; }

.sf-category-row { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; padding: 0.55rem 0.2rem; border-bottom: 1px solid var(--sfb-border); }
.sf-category-row-main { display: flex; flex-direction: column; gap: 0.1rem; }
.sf-category-child { padding-left: 1.6rem; }

.sf-csv-mapping { max-width: 620px; }
.sf-csv-header { width: 200px; font-size: 0.88rem; font-weight: 600; overflow-wrap: anywhere; }
.sf-csv-sample-title { margin: 0.9rem 0 0.4rem; font-size: 0.95rem; }
.sf-csv-sample { overflow-x: auto; border: 1px solid var(--sfb-border); border-radius: 6px; }
.sf-csv-sample table { border-collapse: collapse; width: 100%; font-size: 0.83rem; }
.sf-csv-sample th, .sf-csv-sample td { padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--sfb-border); text-align: left; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.sf-csv-sample th { background: #f3f4f6; position: sticky; top: 0; }

.sf-inbox-tabs { display: flex; gap: 0.5rem; margin-bottom: 0.9rem; }
.sf-inbox-card { margin-bottom: 0.7rem; }
.sf-inbox-handled { opacity: 0.62; }
.sf-inbox-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 0.6rem; margin-bottom: 0.4rem; }
.sf-inbox-meta { display: flex; align-items: center; gap: 0.5rem; }
.sf-inbox-body { font-size: 0.92rem; }
.sf-inbox-message { margin-top: 0.4rem; white-space: pre-wrap; background: #f8f9fb; border-radius: 6px; padding: 0.6rem 0.8rem; }

.sf-stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.7rem; margin-bottom: 1.4rem; }
.sf-stat-tile { display: flex; flex-direction: column; gap: 0.15rem; background: #fff; border: 1px solid var(--sfb-border); border-radius: 8px; padding: 0.85rem 1rem; text-decoration: none; color: inherit; }
.sf-stat-tile:hover { border-color: var(--sfb-brand); }
.sf-stat-value { font-size: 1.35rem; font-weight: 800; color: var(--sfb-ink, #111); }
.sf-stat-label { color: var(--sfb-soft); font-size: 0.83rem; }
.sf-stat-attention { border-color: #E6A23C; box-shadow: 0 0 0 2px rgba(230, 162, 60, 0.18); }

/* ---- fix pass 2 polish ---- */

/* Login helper line under the register link (UX-major-6 interim). */
.sf-auth-note { font-size: 0.82rem; line-height: 1.5; }

/* Top-nav active state driven by NavLink's "active" class (UX-minor-1):
   the active page, and only the active page, keeps the underline. */
.sf-topnav-link.active { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }

/* Blazor's FocusOnNavigate lands programmatic focus on each page's h1; the
   default focus ring painted a stray black rectangle around page titles
   (UX-minor-2). The focus stays (screen readers announce the page); only
   the box goes. */
.sf-main h1:focus { outline: none; }

/* Catalog rows open the product editor on click; say so (UX-minor-9). */
.sf-catalog .rz-data-grid .rz-data-row { cursor: pointer; }

/* Product editor: keep Save/Cancel and Delete at opposite ends, and let the
   description/meta textareas use the full form width instead of a cramped
   column (UX-minor-8). */
.sf-editor-save-row { justify-content: space-between; }
.sf-field .rz-textarea { width: 100%; }

/* --- Media pipeline (uploads, library, ImageRef picker) ------------------ */

/* A styled label wraps the native file input (there is no themable Radzen
   equivalent that posts through our authed client). */
.sf-upload-btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.8rem; border: 1px solid var(--sfb-border); border-radius: 5px; background: #fff; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.sf-upload-btn:hover { background: #f3f4f6; }
.sf-upload-btn input[type="file"] { display: none; }
.sf-upload-btn.sf-upload-busy { opacity: 0.6; cursor: progress; }

.sf-image-editor { display: flex; flex-direction: column; gap: 0.55rem; }
.sf-image-editor-preview { width: 100%; max-width: 220px; max-height: 130px; object-fit: contain; border-radius: 5px; border: 1px solid var(--sfb-border); background: #fff; }
.sf-image-editor-empty { display: inline-flex; align-items: center; justify-content: center; height: 64px; border-style: dashed; color: #6b7280; font-size: 0.8rem; }
.sf-image-editor-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.sf-image-editor-progress { margin: 0; font-size: 0.8rem; color: #6b7280; }
.sf-image-editor-error { margin: 0; font-size: 0.8rem; color: #b91c1c; }

.sf-media-library { display: flex; flex-direction: column; gap: 0.8rem; min-height: 320px; }
.sf-media-toolbar { display: flex; gap: 0.5rem; }
.sf-media-toolbar .rz-textbox { flex: 1; }
.sf-media-empty { color: #6b7280; font-size: 0.85rem; }
.sf-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.7rem; }
.sf-media-item { display: flex; flex-direction: column; gap: 0.3rem; padding: 0.45rem; border: 1px solid var(--sfb-border); border-radius: 6px; background: #fff; cursor: pointer; text-align: left; }
.sf-media-item:hover { border-color: #9ca3af; background: #f9fafb; }
.sf-media-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; background: #f3f4f6; }
.sf-media-name { font-size: 0.75rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-media-meta { font-size: 0.72rem; color: #6b7280; }
.sf-media-pager { display: flex; align-items: center; gap: 0.7rem; font-size: 0.8rem; color: #6b7280; }
.sf-media-footer { display: flex; justify-content: flex-end; }

/* ---------- identity hardening: security, team, join ---------- */

.sf-btn-secondary { background: #e5e7eb; color: var(--sfb-text); }
.sf-btn-secondary:hover { filter: brightness(0.96); }
.sf-btn-danger { background: var(--sfb-danger); color: #fff; }
.sf-btn-danger:hover { filter: brightness(1.08); }
.sf-btn-link { display: inline-block; text-decoration: none; }

.sf-inline-form { display: inline-block; margin: 0; }
.sf-narrow-form { max-width: 360px; }
.sf-security-subhead { font-size: 0.95rem; margin: 1.4rem 0 0.2rem; }

.sf-totp-qr { border: 1px solid var(--sfb-border); border-radius: 8px; background: #fff; padding: 8px; }
.sf-totp-key { background: #f3f4f6; padding: 0.2rem 0.45rem; border-radius: 4px; font-size: 0.9rem; letter-spacing: 0.04em; }

.sf-recovery-codes { list-style: none; padding: 0.4rem 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.5rem; max-width: 560px; }
.sf-recovery-codes code { display: block; background: #f3f4f6; border: 1px solid var(--sfb-border); border-radius: 5px; padding: 0.45rem 0.6rem; font-size: 0.95rem; text-align: center; }

.sf-invite-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.sf-team-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.sf-team-table th { text-align: left; color: var(--sfb-soft); font-size: 0.8rem; font-weight: 600; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--sfb-border); }
.sf-team-table td { padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--sfb-border); vertical-align: top; }
.sf-team-actions { display: flex; gap: 0.35rem; justify-content: flex-end; }

.sf-role-dialog { display: flex; flex-direction: column; gap: 0.5rem; }
.sf-role-dialog-note { margin: 0.4rem 0 0; }
.sf-role-dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }

.sf-nudge { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; background: #eef4fb; border: 1px solid #cfdef2; color: #1f3a5f; border-radius: 8px; padding: 0.7rem 0.9rem; margin-bottom: 1rem; font-size: 0.9rem; }
.sf-nudge-actions { display: flex; align-items: center; gap: 0.7rem; }
.sf-nudge-cta { font-weight: 600; color: #1f3a5f; }
.sf-nudge-dismiss { background: none; border: none; color: var(--sfb-soft); cursor: pointer; font-size: 0.85rem; text-decoration: underline; padding: 0; }

/* ---------- r2 fix pass: orders chrome, chips, responsive topbar ---------- */

/* Status/type chips (UX-major-2 r2): the Orders pages emitted .sf-chip with
   no Builder-side styles at all, so "New" / "FFL transfer" / "Guest" rendered
   as run-together plain text. Builder CSS never ships to tenant sites, so the
   chips live here, not in the renderer's stylesheet. */
.sf-chip {
    display: inline-block;
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--sfb-border);
    background: #eef1f5;
    color: var(--sfb-text);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.sf-chip-status-new { background: #e2ebf7; border-color: #b8cdea; color: var(--sfb-brand); }
.sf-chip-status-acknowledged { background: #fdf3d7; border-color: #eadfb4; color: #6d5410; }
.sf-chip-status-readyforpickup { background: #e7f0e7; border-color: #c4dcc4; color: #235023; }
.sf-chip-status-awaitingtransfer { background: #efe7f6; border-color: #d8c6ea; color: #4f2a72; }
.sf-chip-status-completed { background: #e7f0e7; border-color: #c4dcc4; color: #235023; }
.sf-chip-status-canceled { background: #fbe4e2; border-color: #efc4c0; color: #7c2320; }

/* Orders list rows: click-to-open needs the affordance (UX-minor-1 r2). */
.sf-order-table { display: flex; flex-direction: column; gap: 0.6rem; }
.sf-order-card { cursor: pointer; transition: box-shadow 0.12s ease, border-color 0.12s ease; }
.sf-order-card:hover { border-color: var(--sfb-brand); box-shadow: 0 2px 10px rgba(31, 58, 95, 0.14); }
.sf-order-card-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; }
.sf-order-meta { color: var(--sfb-soft); font-size: 0.85rem; }
.sf-order-total { font-weight: 700; margin-left: auto; }
.sf-orders-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.9rem; }
.sf-orders-pager { display: flex; align-items: center; gap: 0.7rem; margin-top: 0.9rem; font-size: 0.85rem; color: var(--sfb-soft); }

.sf-order-detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; margin-bottom: 0.9rem; }
.sf-order-detail-head h1 { margin: 0; }
.sf-order-section { margin-bottom: 0.8rem; }
.sf-order-lines { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 0.5rem; }
.sf-order-lines th { text-align: left; color: var(--sfb-soft); font-size: 0.8rem; font-weight: 600; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--sfb-border); }
.sf-order-lines td { padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--sfb-border); }
.sf-order-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.7rem; }
.sf-order-cancel { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.9rem; }

/* History timeline: date, actor, and note were running together
   (UX-major-2 r2 second half). */
.sf-order-history { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.sf-order-history li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; padding: 0.35rem 0; border-bottom: 1px solid var(--sfb-border); }
.sf-order-history li:last-child { border-bottom: 0; }
.sf-order-history li span { color: var(--sfb-soft); font-size: 0.85rem; }
.sf-order-history li em { flex-basis: 100%; color: var(--sfb-text); font-size: 0.85rem; }

/* Sign-out is a POST form now (CODE-minor-7 r2); the button keeps the old
   link look. */
.sf-signout-form { display: inline; margin: 0; }
button.sf-signout { background: none; border: none; padding: 0; color: #fff; opacity: 0.85; font-size: 0.85rem; font-family: inherit; cursor: pointer; text-decoration: underline; }
button.sf-signout:hover { opacity: 1; }

/* Media library delete (CODE-major-6 r2): small corner action on each tile. */
.sf-media-item-wrap { position: relative; }
.sf-media-item-wrap .sf-media-item { width: 100%; height: 100%; }
.sf-media-delete { position: absolute; top: 0.3rem; right: 0.3rem; width: 22px; height: 22px; line-height: 1; border: 1px solid var(--sfb-border); border-radius: 50%; background: #fff; color: var(--sfb-soft); font-size: 0.9rem; cursor: pointer; opacity: 0; transition: opacity 0.12s ease; }
.sf-media-item-wrap:hover .sf-media-delete, .sf-media-delete:focus-visible { opacity: 1; }
.sf-media-delete:hover { color: var(--sfb-danger); border-color: var(--sfb-danger); }

/* Invite copy-link fallback (UX-major-4 r2). */
.sf-invite-link-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.6rem; background: #f8f9fb; border: 1px solid var(--sfb-border); border-radius: 6px; padding: 0.55rem 0.7rem; }
.sf-invite-link-row code { flex: 1 1 260px; font-size: 0.78rem; overflow-wrap: anywhere; }

/* Phone-width Builder (UX-major-3 r2): the topbar wraps instead of forcing a
   ~790px document; content and tables stay inside the viewport. A dealer
   checking a new web order from a phone gets a stacked layout, not a
   sideways-panning desktop. */
@media (max-width: 860px) {
    .sf-topbar { flex-wrap: wrap; height: auto; min-height: 52px; padding: 0.45rem 0.9rem; row-gap: 0.2rem; }
    .sf-topnav { flex-wrap: wrap; gap: 0.15rem 0; row-gap: 0.15rem; }
    .sf-topnav-link { margin-right: 0.65rem; font-size: 0.85rem; }
    .sf-user { display: none; }
    .sf-catalog, .sf-settings, .sf-dash, .sf-billing { padding: 0.9rem; }
    .sf-team-table, .sf-invoice-table, .sf-order-lines { display: block; overflow-x: auto; }
    .sf-order-total { margin-left: 0; }
}
