/*
 * Graphite Racing Platform — Release 5.1 Product Polish
 * Shared premium presentation layer for Storefront, Rider Platform and ERP.
 * Business/domain styles remain in their owning stylesheets; this file only
 * normalizes interaction, depth, accessibility and responsive behaviour.
 */

:root {
    --g51-orange: #ff6a00;
    --g51-orange-hot: #ff8528;
    --g51-orange-soft: rgba(255, 106, 0, .12);
    --g51-bg: #08090b;
    --g51-surface: rgba(20, 21, 24, .82);
    --g51-surface-strong: rgba(27, 28, 32, .94);
    --g51-surface-soft: rgba(255, 255, 255, .035);
    --g51-line: rgba(255, 255, 255, .095);
    --g51-line-strong: rgba(255, 255, 255, .16);
    --g51-text: #f5f6f7;
    --g51-muted: rgba(231, 235, 240, .62);
    --g51-dim: rgba(231, 235, 240, .42);
    --g51-success: #57d28b;
    --g51-warning: #f6be55;
    --g51-danger: #ff6d72;
    --g51-info: #69aefc;
    --g51-radius-sm: 12px;
    --g51-radius-md: 17px;
    --g51-radius-lg: 24px;
    --g51-radius-xl: 30px;
    --g51-shadow-sm: 0 1px 1px rgba(0, 0, 0, .24), 0 10px 30px rgba(0, 0, 0, .12);
    --g51-shadow-md: 0 1px 0 rgba(255, 255, 255, .055) inset, 0 22px 60px rgba(0, 0, 0, .26);
    --g51-shadow-lg: 0 1px 0 rgba(255, 255, 255, .075) inset, 0 34px 100px rgba(0, 0, 0, .42);
    --g51-ease: cubic-bezier(.2, .72, .2, 1);
    --g51-spring: cubic-bezier(.18, .89, .32, 1.18);
    --g51-fast: 150ms var(--g51-ease);
    --g51-motion: 260ms var(--g51-ease);
}

html {
    color-scheme: dark;
    background: var(--g51-bg);
    scroll-behavior: smooth;
    scrollbar-color: rgba(255, 255, 255, .2) transparent;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body.storefront,
body.admin-shell {
    min-height: 100vh;
    background:
        radial-gradient(900px 520px at 84% -12%, rgba(255, 106, 0, .085), transparent 68%),
        radial-gradient(760px 440px at -8% 38%, rgba(90, 116, 150, .055), transparent 70%),
        var(--g51-bg);
    color: var(--g51-text);
}

body::after {
    position: fixed;
    z-index: -1;
    inset: 0;
    opacity: .018;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
    pointer-events: none;
    content: "";
}

::selection { background: rgba(255, 106, 0, .3); color: #fff; }

.g51-skip-link {
    position: fixed;
    z-index: 7000;
    top: 10px;
    left: 12px;
    padding: 10px 14px;
    border-radius: 11px;
    background: var(--g51-orange);
    color: #111 !important;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    transform: translateY(-160%);
    transition: transform var(--g51-fast);
}

.g51-skip-link:focus { transform: none; }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 3px solid rgba(255, 132, 48, .46) !important;
    outline-offset: 3px;
    box-shadow: 0 0 0 1px rgba(8, 9, 11, .8), 0 0 0 6px rgba(255, 106, 0, .12) !important;
}

:where(button, a, input, select, textarea, summary) {
    -webkit-tap-highlight-color: transparent;
}

:where(img, video) {
    max-width: 100%;
}

/* Premium shell glass */
.platform-header,
.erp-header {
    background: linear-gradient(180deg, rgba(19, 20, 23, .88), rgba(11, 12, 14, .8)) !important;
    border-color: rgba(255, 255, 255, .085) !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 14px 44px rgba(0, 0, 0, .2) !important;
    backdrop-filter: saturate(135%) blur(22px);
    -webkit-backdrop-filter: saturate(135%) blur(22px);
}

.erp-context-bar,
.dashboard-nav,
.garage-vehicle-nav {
    backdrop-filter: saturate(125%) blur(18px);
    -webkit-backdrop-filter: saturate(125%) blur(18px);
}

.platform-profile__menu,
.platform-header__more-menu,
.erp-profile__menu,
.admin-popover,
.gr-dropdown,
.gr-context-menu {
    border-color: var(--g51-line-strong) !important;
    background: linear-gradient(155deg, rgba(35, 36, 40, .96), rgba(15, 16, 19, .97)) !important;
    box-shadow: var(--g51-shadow-lg) !important;
    backdrop-filter: blur(28px) saturate(135%);
    -webkit-backdrop-filter: blur(28px) saturate(135%);
}

/* One surface language across every product generation. */
:where(
    .panel, .dashboard-card, .dashboard-section, .dashboard-mini-card,
    .product-card, .featured-card, .marketplace-card, .market-card, .service-card,
    .garage-panel, .garage-motorcycle-card, .garage-part-card,
    .rider-card, .vehicle-card, .order-card, .purchase-card,
    .rp-panel, .rp-card, .rp-metric, .rp-feed-item,
    .erp-panel, .erp-metric-tile, .erp-file-list > a,
    .gr-card, .gr-metric, .gr-queue-card, .gr-dashboard-section,
    .card, .mini-card, .overview-card, .chart-box, .form-section,
    .settings-panel, .audit-panel
) {
    border-color: var(--g51-line) !important;
    background-color: var(--g51-surface);
    box-shadow: var(--g51-shadow-sm);
}

:where(
    .panel, .dashboard-card, .dashboard-section, .dashboard-mini-card,
    .product-card, .featured-card, .marketplace-card, .market-card, .service-card,
    .garage-panel, .garage-motorcycle-card, .garage-part-card,
    .rider-card, .vehicle-card, .order-card, .purchase-card,
    .rp-panel, .rp-card, .erp-panel, .erp-metric-tile,
    .gr-card, .gr-metric, .gr-queue-card, .gr-dashboard-section
) {
    position: relative;
    isolation: isolate;
    overflow: clip;
}

:where(.rp-panel, .erp-panel, .gr-card, .dashboard-section, .panel)::after {
    position: absolute;
    z-index: -1;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255, 255, 255, .035), transparent 30%, transparent 72%, rgba(255, 106, 0, .025));
    pointer-events: none;
    content: "";
}

[data-premium-card] {
    --g51-tilt-x: 0deg;
    --g51-tilt-y: 0deg;
    --g51-lift: 0px;
    transform: perspective(900px) translate3d(0, var(--g51-lift), 0) rotateX(var(--g51-tilt-x)) rotateY(var(--g51-tilt-y));
    transform-style: preserve-3d;
    transition:
        transform var(--g51-motion),
        border-color var(--g51-motion),
        background-color var(--g51-motion),
        box-shadow var(--g51-motion),
        filter var(--g51-motion);
    will-change: transform;
}

[data-premium-card]:hover {
    --g51-lift: -3px;
    border-color: rgba(255, 255, 255, .17) !important;
    box-shadow: var(--g51-shadow-md);
    filter: brightness(1.025);
}

[data-premium-card] :where(img, .rp-card__image, .product-photo, .marketplace-card__image) {
    transition: transform 480ms var(--g51-ease), filter 320ms var(--g51-ease);
}

[data-premium-card]:hover :where(img, .rp-card__image, .product-photo, .marketplace-card__image) {
    transform: scale(1.018);
}

:where(.product-card, .featured-card, .marketplace-card, .market-card, .service-card, .rp-card, .garage-part-card) img {
    background: linear-gradient(145deg, #202226, #111215);
}

:where(.product-card, .featured-card, .marketplace-card, .market-card, .service-card, .rp-card) :where(h2, h3, .product-title, .featured-name) {
    letter-spacing: -.018em;
    text-wrap: balance;
}

/* Buttons feel dense and physical while keeping the established orange ratio. */
:where(
    .btn, .dashboard-button, .rp-button, body.admin-shell .btn,
    .btn-secondary, .btn-outline, .rp-button--ghost,
    body.admin-shell .btn-secondary, body.admin-shell .btn-outline
) {
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
    transition:
        transform var(--g51-fast),
        filter var(--g51-fast),
        border-color var(--g51-fast),
        background-color var(--g51-fast),
        box-shadow var(--g51-fast) !important;
}

:where(.btn, .dashboard-button, .rp-button, body.admin-shell .btn):hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.08) saturate(1.04);
    box-shadow: 0 12px 28px rgba(255, 106, 0, .2), 0 1px 0 rgba(255, 255, 255, .16) inset !important;
}

:where(.btn-secondary, .btn-outline, .rp-button--ghost, body.admin-shell .btn-secondary, body.admin-shell .btn-outline):hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, .22) !important;
    background: rgba(255, 255, 255, .075) !important;
}

:where(.btn, .dashboard-button, .rp-button, button):active:not(:disabled) {
    transform: translateY(1px) scale(.985);
    transition-duration: 70ms !important;
}

:where(button, input[type="submit"], .btn, .rp-button)[disabled],
.is-submitting :where(button[type="submit"], input[type="submit"]) {
    cursor: wait !important;
    opacity: .62;
}

.is-submitting :where(button[type="submit"], .rp-button[type="submit"], .btn[type="submit"])::after {
    display: inline-block;
    width: .9em;
    height: .9em;
    margin-left: .55em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: -.12em;
    animation: g51-spin .65s linear infinite;
    content: "";
}

@keyframes g51-spin { to { transform: rotate(360deg); } }

/* Forms */
:where(body.storefront, body.admin-shell) :where(input, select, textarea) {
    border-color: var(--g51-line) !important;
    background-color: rgba(6, 7, 9, .54) !important;
    color: var(--g51-text) !important;
    transition: border-color var(--g51-fast), background-color var(--g51-fast), box-shadow var(--g51-fast) !important;
}

:where(body.storefront, body.admin-shell) :where(input, select, textarea):hover:not(:disabled) {
    border-color: var(--g51-line-strong) !important;
    background-color: rgba(8, 9, 11, .72) !important;
}

:where(body.storefront, body.admin-shell) :where(input, select, textarea)::placeholder {
    color: rgba(231, 235, 240, .36) !important;
}

:where(body.storefront, body.admin-shell) label {
    text-wrap: pretty;
}

/* Tables and dense ERP lists */
.gr-table-region {
    max-width: 100%;
    overflow: auto;
    border: 1px solid var(--g51-line);
    border-radius: var(--g51-radius-md);
    background: rgba(11, 12, 14, .55);
    overscroll-behavior-inline: contain;
}

.gr-table-region > table { margin: 0 !important; border: 0 !important; }

:where(body.storefront, body.admin-shell) table tbody tr {
    transition: background-color var(--g51-fast), box-shadow var(--g51-fast);
}

:where(body.storefront, body.admin-shell) table tbody tr:hover {
    background: rgba(255, 255, 255, .032);
    box-shadow: 3px 0 0 rgba(255, 106, 0, .5) inset;
}

:where(body.storefront, body.admin-shell) table :where(th, td) {
    border-color: rgba(255, 255, 255, .075) !important;
}

/* Productive empty states — JS supplies the contextual copy/action when needed. */
:where(.empty-state, .rp-empty, .erp-empty, .gr-empty, .request-empty, .compact-empty) {
    display: grid;
    min-height: 170px;
    place-items: center;
    align-content: center;
    gap: 9px;
    padding: clamp(24px, 5vw, 48px) !important;
    border: 1px dashed rgba(255, 255, 255, .14) !important;
    border-radius: var(--g51-radius-lg) !important;
    background:
        radial-gradient(circle at 50% 18%, rgba(255, 106, 0, .075), transparent 44%),
        rgba(255, 255, 255, .018) !important;
    color: var(--g51-muted) !important;
    text-align: center;
}

.gr-empty-state__icon {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    margin-bottom: 4px;
    border: 1px solid rgba(255, 106, 0, .2);
    border-radius: 17px;
    background: linear-gradient(145deg, rgba(255, 106, 0, .16), rgba(255, 106, 0, .035));
    color: #ff9a55;
    box-shadow: 0 16px 34px rgba(0, 0, 0, .2), 0 1px 0 rgba(255, 255, 255, .07) inset;
}

.gr-empty-state__icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.65; }
.gr-empty-state__title { margin: 4px 0 0; color: var(--g51-text); font-size: clamp(17px, 2vw, 21px); letter-spacing: -.02em; }
.gr-empty-state__description { max-width: 520px; margin: 0; color: var(--g51-muted); line-height: 1.58; text-wrap: pretty; }
.gr-empty-state__hint { max-width: 520px; margin: 2px 0 0; color: var(--g51-dim); font-size: 12px; line-height: 1.5; }
.gr-empty-state__action { margin-top: 8px; }

/* Skeleton and reveal utilities */
.g51-skeleton {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    background: rgba(255, 255, 255, .055);
}

.g51-skeleton::after {
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .09) 48%, transparent 78%);
    transform: translateX(-110%);
    animation: g51-shimmer 1.5s infinite;
    content: "";
}

@keyframes g51-shimmer { to { transform: translateX(110%); } }

.g51-reveal {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 480ms var(--g51-ease), transform 480ms var(--g51-ease);
}

.g51-reveal.is-visible { opacity: 1; transform: none; }

.g51-page-progress {
    position: fixed;
    z-index: 5000;
    top: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--g51-orange), #ffb26f);
    box-shadow: 0 0 18px rgba(255, 106, 0, .62);
    opacity: 0;
    transition: width 500ms var(--g51-ease), opacity 180ms ease;
    pointer-events: none;
}

.g51-page-progress.is-active { width: 72%; opacity: 1; }
.g51-page-progress.is-complete { width: 100%; opacity: 0; }

/* Spotlight / Search Everywhere 2 */
.g51-command-backdrop {
    position: fixed;
    z-index: 6000;
    inset: 0;
    display: grid;
    align-items: start;
    justify-items: center;
    padding: min(13vh, 112px) 18px 24px;
    background: rgba(3, 4, 6, .69);
    opacity: 0;
    visibility: hidden;
    backdrop-filter: blur(18px) saturate(115%);
    -webkit-backdrop-filter: blur(18px) saturate(115%);
    transition: opacity 190ms ease, visibility 190ms ease;
}

.g51-command-backdrop.is-open { opacity: 1; visibility: visible; }

.g51-command {
    width: min(760px, 100%);
    max-height: min(720px, 80vh);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 26px;
    background: linear-gradient(155deg, rgba(34, 35, 40, .975), rgba(13, 14, 17, .985));
    box-shadow: 0 50px 160px rgba(0, 0, 0, .7), 0 1px 0 rgba(255, 255, 255, .09) inset;
    transform: translateY(-12px) scale(.985);
    transition: transform 240ms var(--g51-spring);
}

.g51-command-backdrop.is-open .g51-command { transform: none; }

.g51-command__search {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    padding: 17px 19px;
    border-bottom: 1px solid var(--g51-line);
}

.g51-command__search svg { width: 22px; height: 22px; fill: none; stroke: var(--g51-muted); stroke-width: 1.8; }
.g51-command__search input { min-height: 44px !important; padding: 0 !important; border: 0 !important; outline: 0 !important; background: transparent !important; box-shadow: none !important; color: #fff; font-size: clamp(17px, 2vw, 21px); }
.g51-command__search kbd,
.g51-command__footer kbd { padding: 3px 7px; border: 1px solid var(--g51-line); border-radius: 7px; background: rgba(255, 255, 255, .045); color: var(--g51-dim); font: 11px/1.4 inherit; }

.g51-command__body { min-height: 250px; max-height: min(560px, 62vh); overflow: auto; padding: 9px; }
.g51-command__status { display: grid; min-height: 230px; place-items: center; padding: 36px; color: var(--g51-muted); text-align: center; }
.g51-command__status strong { display: block; margin-bottom: 6px; color: var(--g51-text); font-size: 17px; }
.g51-command__group + .g51-command__group { margin-top: 7px; }
.g51-command__group-title { display: flex; justify-content: space-between; padding: 8px 10px 5px; color: var(--g51-dim); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.g51-command__result {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    min-height: 58px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 14px;
    color: inherit;
    text-decoration: none;
}

.g51-command__result:hover,
.g51-command__result.is-active {
    border-color: rgba(255, 106, 0, .25);
    background: rgba(255, 106, 0, .095);
}

.g51-command__result-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; background: rgba(255, 255, 255, .055); color: #ff9a55; font-weight: 800; }
.g51-command__result-copy { min-width: 0; }
.g51-command__result-copy strong,
.g51-command__result-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g51-command__result-copy strong { color: var(--g51-text); font-size: 13px; }
.g51-command__result-copy span { margin-top: 3px; color: var(--g51-muted); font-size: 11px; }
.g51-command__result-arrow { color: var(--g51-dim); }
.g51-command__footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--g51-line); color: var(--g51-dim); font-size: 11px; }
.g51-command__footer span { display: inline-flex; align-items: center; gap: 6px; }

body.g51-command-open { overflow: hidden; }

/* Lightweight first-run onboarding. */
.g51-onboarding {
    position: fixed;
    z-index: 5500;
    right: 20px;
    bottom: 20px;
    width: min(390px, calc(100vw - 28px));
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 24px;
    background: linear-gradient(150deg, rgba(35, 36, 40, .98), rgba(13, 14, 17, .985));
    box-shadow: var(--g51-shadow-lg);
    opacity: 0;
    transform: translateY(18px) scale(.98);
    transition: opacity 260ms ease, transform 320ms var(--g51-spring);
}

.g51-onboarding.is-visible { opacity: 1; transform: none; }
.g51-onboarding__progress { height: 2px; background: rgba(255, 255, 255, .06); }
.g51-onboarding__progress span { display: block; width: 33.33%; height: 100%; background: var(--g51-orange); transition: width var(--g51-motion); }
.g51-onboarding__body { padding: 22px; }
.g51-onboarding__eyebrow { color: #ff9a55; font-size: 10px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.g51-onboarding h2 { margin: 8px 0; color: #fff; font-size: 22px; letter-spacing: -.025em; }
.g51-onboarding p { margin: 0; color: var(--g51-muted); font-size: 13px; line-height: 1.6; }
.g51-onboarding__actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 18px; }
.g51-onboarding__actions button { min-height: 38px; padding: 8px 13px; border: 1px solid var(--g51-line); border-radius: 11px; background: rgba(255, 255, 255, .045); color: #fff; font: inherit; font-size: 12px; font-weight: 750; cursor: pointer; }
.g51-onboarding__actions button:last-child { border-color: rgba(255, 106, 0, .42); background: linear-gradient(135deg, #ff7414, #c74600); }

/* Dashboard Intelligence: a short, ranked plan instead of a wall of counts. */
.g51-intelligence {
    padding: clamp(19px, 3vw, 28px);
    border: 1px solid var(--g51-line);
    border-radius: var(--g51-radius-lg);
    background:
        radial-gradient(520px 220px at 8% 0%, rgba(255, 106, 0, .09), transparent 70%),
        linear-gradient(145deg, rgba(28, 29, 33, .9), rgba(13, 14, 16, .9));
    box-shadow: var(--g51-shadow-md);
}

.g51-intelligence__head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.g51-intelligence__head h2 { margin: 4px 0 0; font-size: clamp(21px, 2.5vw, 30px); }
.g51-intelligence__head p { margin: 4px 0 0; color: var(--g51-muted); font-size: 13px; }
.g51-intelligence__list { display: grid; gap: 7px; }
.g51-intelligence__item {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 62px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, .065);
    border-radius: 15px;
    background: rgba(255, 255, 255, .022);
    color: inherit;
    text-decoration: none;
    transition: transform var(--g51-fast), border-color var(--g51-fast), background var(--g51-fast);
}
.g51-intelligence__item:hover { transform: translateX(3px); border-color: rgba(255, 106, 0, .3); background: rgba(255, 106, 0, .06); }
.g51-intelligence__icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; background: rgba(255, 255, 255, .055); color: var(--g51-muted); font-weight: 850; }
.g51-intelligence__copy { min-width: 0; }
.g51-intelligence__copy strong, .g51-intelligence__copy span { display: block; }
.g51-intelligence__copy strong { color: var(--g51-text); font-size: 13px; }
.g51-intelligence__copy span { margin-top: 3px; color: var(--g51-muted); font-size: 11px; }
.g51-intelligence__value { color: #fff; font-size: 20px; font-weight: 850; font-variant-numeric: tabular-nums; }
.g51-intelligence__item--danger .g51-intelligence__icon { background: rgba(255, 109, 114, .11); color: var(--g51-danger); }
.g51-intelligence__item--warning .g51-intelligence__icon { background: rgba(246, 190, 85, .1); color: var(--g51-warning); }
.g51-intelligence__item--info .g51-intelligence__icon { background: rgba(105, 174, 252, .1); color: var(--g51-info); }
.g51-intelligence__item--success .g51-intelligence__icon { background: rgba(87, 210, 139, .1); color: var(--g51-success); }

/* Graph Explorer is presented as a relationship map, not a utility list. */
.rp-graph-explorer {
    position: relative;
    display: grid;
    min-height: 330px;
    place-items: center;
    overflow: hidden;
    padding: 34px 20px;
    border: 1px solid var(--g51-line);
    border-radius: var(--g51-radius-lg);
    background:
        linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
        radial-gradient(circle at 50% 48%, rgba(255,106,0,.11), transparent 42%),
        rgba(6, 7, 9, .42);
    background-size: 28px 28px, 28px 28px, auto, auto;
}
.rp-graph-explorer::after { position: absolute; inset: 14% 20%; border: 1px solid rgba(255, 106, 0, .12); border-radius: 50%; content: ""; pointer-events: none; }
.rp-graph-node { position: relative; z-index: 2; display: grid; gap: 4px; min-width: 126px; max-width: 190px; padding: 12px; border: 1px solid var(--g51-line); border-radius: 14px; background: rgba(25, 26, 30, .94); box-shadow: var(--g51-shadow-sm); color: inherit; text-align: left; text-decoration: none; }
.rp-graph-node small { color: #ff9a55; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.rp-graph-node strong { overflow: hidden; color: var(--g51-text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.rp-graph-node--root { z-index: 3; min-width: 190px; padding: 17px; border-color: rgba(255, 106, 0, .38); background: linear-gradient(145deg, rgba(255, 106, 0, .16), rgba(25, 26, 30, .96)); box-shadow: 0 22px 60px rgba(0,0,0,.4), 0 0 0 8px rgba(255,106,0,.035); text-align: center; }
.rp-graph-links { position: absolute; z-index: 1; inset: 16px; }
.rp-graph-links .rp-graph-node { position: absolute; }
.rp-graph-links .rp-graph-node::before { position: absolute; z-index: -1; width: 90px; height: 1px; background: linear-gradient(90deg, rgba(255,106,0,.5), rgba(255,255,255,.08)); content: ""; transform-origin: left; }
.rp-graph-links .rp-graph-node:nth-child(1) { top: 2%; left: 5%; }
.rp-graph-links .rp-graph-node:nth-child(2) { top: 1%; right: 4%; }
.rp-graph-links .rp-graph-node:nth-child(3) { top: 42%; right: 0; }
.rp-graph-links .rp-graph-node:nth-child(4) { right: 7%; bottom: 0; }
.rp-graph-links .rp-graph-node:nth-child(5) { bottom: 0; left: 7%; }
.rp-graph-links .rp-graph-node:nth-child(6) { top: 43%; left: 0; }
.rp-graph-links .rp-graph-node:nth-child(n+7) { display: none; }
.rp-graph-links .rp-graph-node:nth-child(1)::before, .rp-graph-links .rp-graph-node:nth-child(5)::before, .rp-graph-links .rp-graph-node:nth-child(6)::before { right: -68px; top: 50%; }
.rp-graph-links .rp-graph-node:nth-child(2)::before, .rp-graph-links .rp-graph-node:nth-child(3)::before, .rp-graph-links .rp-graph-node:nth-child(4)::before { left: -68px; top: 50%; transform: rotate(180deg); }

/* Knowledge workspace */
.g51-knowledge-search { max-width: 680px; margin-top: 22px; }
.g51-knowledge-search > label { color: var(--g51-muted); font-size: 12px; font-weight: 700; }
.g51-knowledge-search__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.g51-knowledge-filters { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px; overflow: visible; }
.g51-knowledge-filters > label { display: flex; align-items: center; gap: 9px; color: var(--g51-muted); font-size: 12px; }
.g51-knowledge-filters select { min-width: 180px; }
.g51-knowledge-featured { display: grid; grid-template-columns: minmax(240px, .72fr) minmax(0, 1.28fr); min-height: 330px; }
.g51-knowledge-featured__visual { display: grid; min-height: 280px; place-items: center; background: radial-gradient(circle, rgba(255,106,0,.28), transparent 58%), linear-gradient(145deg, #22170f, #101114); }
.knowledge-page .knowledge-hero__monogram { width:clamp(76px,14vw,118px);height:clamp(76px,14vw,118px);max-width:70%;max-height:70%;border-radius:30%;padding:8px;box-sizing:border-box;font-size:clamp(30px,5vw,46px);line-height:1;text-align:center;overflow-wrap:anywhere; }
.g51-knowledge-featured__visual > img { width: 100%; height: 100%; min-height: 280px; object-fit: cover; }
.g51-knowledge-featured__visual span { display: grid; width: 132px; height: 132px; place-items: center; border: 1px solid rgba(255,255,255,.12); border-radius: 40px; background: linear-gradient(145deg, #ff7b1a, #502000); box-shadow: 0 30px 80px rgba(255,106,0,.22); color: #fff; font-size: 54px; font-weight: 900; }
.g51-knowledge-featured__copy { display: grid; align-content: center; justify-items: start; gap: 12px; padding: clamp(24px, 4vw, 52px); }
.g51-knowledge-featured__copy .rp-title { font-size: clamp(27px, 4vw, 46px); }
.g51-knowledge-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g51-knowledge-grid .rp-card { min-height: 210px; align-content: start; padding: 18px; }
.g51-knowledge-card__cover { margin: -18px -18px 4px; aspect-ratio: 16 / 9; overflow: hidden; border-bottom: 1px solid var(--g51-line); background: #0b0c0e; }
.g51-knowledge-card__cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.g51-knowledge-grid .rp-card > p { line-height: 1.55; }
.g51-knowledge-card__meta { display: flex; justify-content: space-between; gap: 8px; color: #ff9a55; font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.g51-knowledge-flow { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr) auto minmax(0,1fr); align-items: center; gap: 12px; padding: 18px; border: 1px solid var(--g51-line); border-radius: var(--g51-radius-lg); background: rgba(255,255,255,.022); }
.g51-knowledge-flow > span { display: grid; grid-template-columns: 34px minmax(0,1fr); column-gap: 10px; align-items: center; }
.g51-knowledge-flow b { grid-row: 1/3; display: grid; width: 34px; height: 34px; place-items: center; border-radius: 11px; background: var(--g51-orange-soft); color: #ff9a55; }
.g51-knowledge-flow strong, .g51-knowledge-flow small { display: block; }
.g51-knowledge-flow strong { color: var(--g51-text); font-size: 12px; }
.g51-knowledge-flow small { margin-top: 3px; color: var(--g51-dim); font-size: 10px; }
.g51-knowledge-flow > i { color: var(--g51-dim); font-style: normal; }
.g51-knowledge-create > summary { padding-bottom: 20px; cursor: pointer; list-style: none; }
.g51-knowledge-create > summary::-webkit-details-marker { display: none; }
.g51-knowledge-editor__grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.g51-knowledge-editor label { display: grid; gap: 6px; color: var(--g51-muted); font-size: 11px; font-weight: 750; }
.g51-knowledge-editor__body { min-height: 280px; }
.g51-knowledge-cover-field { display: grid; gap: 9px; padding: 14px; border: 1px solid var(--g51-line); border-radius: 14px; background: rgba(255,255,255,.018); }
.g51-knowledge-cover-field > label:first-child { display: grid; gap: 3px; }
.g51-knowledge-cover-field small { color: var(--g51-dim); font-weight: 500; line-height: 1.5; }
.g51-knowledge-cover-preview { display: grid; width: min(100%,480px); aspect-ratio: 16 / 9; max-height: 270px; place-items: center; overflow: hidden; border: 1px dashed var(--g51-line-strong); border-radius: 13px; background: #0b0c0e; color: var(--g51-dim); font-size: 11px; }
.g51-knowledge-cover-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.g51-knowledge-cover-preview.has-image { border-style: solid; }
.g51-knowledge-cover-remove { display: flex !important; grid-template-columns: auto minmax(0,1fr); align-items: center; width: max-content; gap: 7px !important; color: var(--g51-muted); }
.g51-knowledge-cover-remove input { margin: 0; }
.g51-rich-editor { display: grid; gap: 7px; }
.g51-rich-editor__workspace { overflow: hidden; border: 1px solid var(--g51-line); border-radius: 16px; background: rgba(7,8,10,.62); transition: border-color var(--g51-fast), box-shadow var(--g51-fast); }
.g51-rich-editor__workspace:focus-within { border-color: rgba(255,106,0,.52); box-shadow: 0 0 0 3px rgba(255,106,0,.1), var(--g51-shadow-sm); }
.g51-rich-editor__toolbar { display: flex; align-items: center; gap: 6px; overflow-x: auto; padding: 9px; border-bottom: 1px solid var(--g51-line); background: rgba(255,255,255,.025); scrollbar-width: thin; }
.g51-rich-editor__toolbar select { flex: 0 0 150px; min-height: 34px; padding: 6px 28px 6px 9px; font-size: 11px; }
.g51-rich-editor__group { display: inline-flex; flex: 0 0 auto; gap: 3px; padding-left: 6px; border-left: 1px solid var(--g51-line); }
.g51-rich-editor__toolbar button { min-height: 34px; padding: 6px 9px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--g51-muted); font: inherit; font-size: 11px; cursor: pointer; white-space: nowrap; transition: color var(--g51-fast), border-color var(--g51-fast), background var(--g51-fast), transform var(--g51-fast); }
.g51-rich-editor__toolbar button:hover, .g51-rich-editor__toolbar button:focus-visible { border-color: var(--g51-line-strong); background: rgba(255,255,255,.06); color: #fff; }
.g51-rich-editor__toolbar button:active { transform: scale(.96); }
.g51-rich-editor__history { margin-left: auto; }
.g51-rich-editor__surface { min-height: 360px; max-height: 70vh; overflow: auto; padding: clamp(18px,3vw,30px); color: var(--g51-text); font-size: 15px; line-height: 1.75; outline: 0; }
.g51-rich-editor__surface:empty::before { color: var(--g51-dim); content: attr(data-placeholder); pointer-events: none; }
.g51-rich-editor__surface[aria-invalid="true"] { box-shadow: inset 0 0 0 1px var(--g51-danger); }
.g51-rich-editor__status { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--g51-line); color: var(--g51-dim); font-size: 10px; }
.g51-rich-editor__status strong { color: var(--g51-muted); }
.g51-rich-editor__status[data-error]::before { color: var(--g51-danger); content: attr(data-error); }
.g51-rich-editor__status[data-error] > span:first-child { display: none; }
.g51-rich-editor.is-over-limit .g51-rich-editor__status strong { color: var(--g51-danger); }
.g51-rich-editor__surface h2, .g51-article-body h2 { margin: 1.5em 0 .55em; color: #fff; font-size: clamp(24px,3vw,34px); line-height: 1.18; letter-spacing: -.025em; }
.g51-rich-editor__surface h3, .g51-article-body h3 { margin: 1.35em 0 .5em; color: #fff; font-size: clamp(19px,2.4vw,25px); line-height: 1.25; }
.g51-rich-editor__surface h4, .g51-article-body h4 { margin: 1.2em 0 .45em; color: #fff; font-size: 17px; }
.g51-rich-editor__surface p, .g51-article-body p { margin: 0 0 1em; }
.g51-rich-editor__surface ul, .g51-rich-editor__surface ol, .g51-article-body ul, .g51-article-body ol { display: grid; gap: 7px; margin: 1em 0; padding-left: 25px; }
.g51-rich-editor__surface blockquote, .g51-article-body blockquote { margin: 1.2em 0; padding: 14px 18px; border-left: 3px solid var(--g51-orange); border-radius: 0 13px 13px 0; background: var(--g51-orange-soft); color: #f2e5dc; }
.g51-rich-editor__surface pre, .g51-article-body pre { overflow: auto; margin: 1.2em 0; padding: 15px; border: 1px solid var(--g51-line); border-radius: 13px; background: #090a0c; color: #e7e9ed; font: 12px/1.65 ui-monospace,SFMono-Regular,Consolas,monospace; white-space: pre-wrap; }
.g51-rich-editor__surface code, .g51-article-body code { padding: .12em .35em; border-radius: 5px; background: rgba(255,255,255,.07); color: #ffc194; font-family: ui-monospace,SFMono-Regular,Consolas,monospace; }
.g51-rich-editor__surface a, .g51-article-body a { color: #ff9a55; text-decoration-color: rgba(255,154,85,.45); text-underline-offset: 3px; }
.g51-rich-editor__surface details, .g51-article-body details { margin: 1.2em 0; overflow: hidden; border: 1px solid var(--g51-line); border-radius: 13px; background: rgba(255,255,255,.025); }
.g51-rich-editor__surface details > summary, .g51-article-body details > summary { padding: 12px 14px; color: #fff; font-weight: 750; cursor: pointer; }
.g51-rich-editor__surface details > :not(summary), .g51-article-body details > :not(summary) { margin-right: 14px; margin-left: 14px; }
.g51-knowledge-attachments { padding: 14px; border: 1px dashed var(--g51-line-strong); border-radius: 14px; background: rgba(255,255,255,.018); }
.g51-knowledge-attachments > span:first-child { display: grid; gap: 3px; }
.g51-knowledge-attachments small { color: var(--g51-dim); font-weight: 500; line-height: 1.5; }
.g51-knowledge-attachments__selection { overflow-wrap: anywhere; color: #ffad76; font-size: 10px; font-weight: 650; }
.g51-knowledge-editor__footer, .g51-knowledge-guest { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.g51-knowledge-editor__footer p { max-width: 620px; margin: 0; color: var(--g51-muted); font-size: 11px; line-height: 1.5; }
.g51-knowledge-status { padding: 3px 7px; border-radius: 999px; background: rgba(255,255,255,.05); color: var(--g51-muted); }
.g51-knowledge-status--pending { background: rgba(246,190,85,.1); color: var(--g51-warning); }
.g51-knowledge-status--published { background: rgba(87,210,139,.1); color: var(--g51-success); }
.g51-knowledge-status--rejected { background: rgba(255,109,114,.1); color: var(--g51-danger); }
.g51-knowledge-card--pending { border-style: dashed !important; }
.g51-knowledge-draft-preview { margin-top: auto; border-top: 1px solid var(--g51-line); }
.g51-knowledge-draft-preview > summary { padding-top: 12px; color: #ff9a55; font-size: 10px; font-weight: 750; cursor: pointer; }
.g51-knowledge-draft-preview > .g51-article-body { max-height: 360px; overflow: auto; margin-top: 12px; padding: 14px; border-radius: 12px; background: rgba(0,0,0,.18); }
.g51-article-body { color: var(--g51-text); font-size: 15px; line-height: 1.75; overflow-wrap: anywhere; }
.g51-article-body > :first-child { margin-top: 0; }
.g51-article-body > :last-child { margin-bottom: 0; }
.g51-knowledge-reader { overflow: visible; }
.g51-knowledge-reader__cover { width: min(1040px,calc(100% - 48px)); aspect-ratio: 16 / 7; max-height: 430px; margin: 24px auto 0; overflow: hidden; border: 1px solid var(--g51-line); border-radius: 14px; background: #0b0c0e; }
.g51-knowledge-reader__cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.g51-knowledge-reader__head { display: grid; justify-items: start; gap: 12px; padding: clamp(24px,4vw,48px); border-bottom: 1px solid var(--g51-line); background: linear-gradient(135deg,rgba(255,106,0,.08),rgba(255,255,255,.014) 45%,transparent); }
.g51-knowledge-reader__head h1 { max-width: 960px; margin: 0; color: #fff; font-size: clamp(32px,4.4vw,58px); line-height: 1.08; overflow-wrap: anywhere; }
.g51-knowledge-reader__head > p { max-width: 850px; margin: 0; color: var(--g51-muted); font-size: 17px; line-height: 1.7; }
.g51-knowledge-reader__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.g51-knowledge-reader__author { display: inline-flex; align-items: center; gap: 9px; color: #fff; font-size: 12px; }
.g51-knowledge-reader__author img,.g51-knowledge-reader__author i { display: grid; width: 34px; height: 34px; place-items: center; overflow: hidden; border-radius: 8px; background: var(--g51-orange-soft); color: #ff9a55; font-style: normal; object-fit: cover; }
.g51-knowledge-reader__content { width: min(780px,calc(100% - 40px)); margin: 0 auto; padding: clamp(30px,5vw,58px) 0; font-size: 16px; line-height: 1.78; }
.g51-knowledge-reader__files { display: grid; gap: 18px; padding: clamp(24px,4vw,44px); border-top: 1px solid var(--g51-line); background: rgba(255,255,255,.018); }
.g51-knowledge-reader__files h2 { margin: 5px 0 0; color: #fff; font-size: 22px; }
.g51-knowledge-reader__footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 20px clamp(20px,4vw,44px); border-top: 1px solid var(--g51-line); }
@media(max-width:620px){.g51-knowledge-reader__head{padding:24px 18px}.g51-knowledge-reader__head h1{font-size:32px}.g51-knowledge-reader__head>p,.g51-knowledge-reader__content{font-size:15px}.g51-knowledge-reader__content{width:calc(100% - 36px);padding-block:34px}.g51-knowledge-reader__footer .rp-button{width:100%}}
.g51-rich-editor__surface figure, .g51-article-body figure { display: grid; gap: 8px; margin: 1.25em 0; }
.g51-rich-editor__surface figure img, .g51-article-body figure img, .g51-article-body > img { display: block; width: auto; max-width: 100%; max-height: 560px; margin-inline: auto; object-fit: contain; border: 1px solid var(--g51-line); border-radius: 12px; background: #0b0c0e; }
.g51-rich-editor__surface figcaption, .g51-article-body figcaption { color: var(--g51-dim); font-size: 11px; line-height: 1.5; text-align: center; }
.g51-knowledge-files { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 14px; }
.g51-knowledge-file { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 11px; border: 1px solid var(--g51-line); border-radius: 13px; background: rgba(255,255,255,.025); color: inherit; text-decoration: none; transition: border-color var(--g51-fast), background var(--g51-fast), transform var(--g51-fast); }
.g51-knowledge-file:hover { border-color: rgba(255,106,0,.35); background: var(--g51-orange-soft); transform: translateY(-1px); }
.g51-knowledge-file__icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 11px; background: rgba(255,106,0,.11); color: #ff9a55; font-size: 10px; font-weight: 900; text-transform: uppercase; }
.g51-knowledge-file strong, .g51-knowledge-file small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g51-knowledge-file strong { color: #fff; font-size: 11px; }
.g51-knowledge-file small { margin-top: 3px; color: var(--g51-dim); font-size: 9px; }
.g51-knowledge-file > span:last-child { color: #ff9a55; font-size: 11px; }

/* Knowledge moderation workspace */
.g51-knowledge-mod-stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
.g51-knowledge-mod-stats a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; border: 1px solid var(--g51-line); border-radius: 13px; color: var(--g51-muted); text-decoration: none; }
.g51-knowledge-mod-stats a.is-active, .g51-knowledge-mod-stats a:hover { border-color: rgba(255,106,0,.3); background: var(--g51-orange-soft); color: #fff; }
.g51-knowledge-mod-stats strong { color: #fff; font-size: 19px; }
.g51-knowledge-mod-filter { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: end; gap: 10px; }
.g51-knowledge-mod-filter label { display: grid; gap: 6px; }
.g51-knowledge-mod-list { display: grid; gap: 12px; }
.g51-knowledge-mod-card { padding: 16px; }
.g51-knowledge-mod-summary { display: grid; grid-template-columns: 176px minmax(0,1fr); align-items: start; gap: 14px; min-width: 0; }
.g51-knowledge-mod-cover { display: grid; width: 176px; height: 100px; place-items: center; border: 1px solid var(--g51-line); border-radius: 10px; background: #0b0c0e; color: #ff9a55; font-size: 20px; font-weight: 900; object-fit: cover; }
.g51-knowledge-mod-cover--empty { background: linear-gradient(145deg,rgba(255,106,0,.16),rgba(255,255,255,.025)); }
.g51-knowledge-mod-card > header { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 18px; }
.g51-knowledge-mod-card h2 { margin: 8px 0 5px; font-size: 19px; line-height: 1.2; }
.g51-knowledge-mod-card header p { max-width: 800px; margin: 0; color: var(--g51-muted); line-height: 1.55; }
.g51-knowledge-mod-author { display: grid; align-content: start; min-width: 190px; gap: 3px; text-align: right; }
.g51-knowledge-mod-author small, .g51-knowledge-mod-author time { color: var(--g51-dim); font-size: 10px; }
.g51-knowledge-mod-card > details { margin-top: 11px; border: 1px solid var(--g51-line); border-radius: 11px; }
.g51-knowledge-mod-card > details summary { padding: 12px; cursor: pointer; color: var(--g51-muted); font-size: 11px; font-weight: 750; }
.g51-knowledge-mod-body { max-height: 440px; overflow: auto; padding: 16px; border-top: 1px solid var(--g51-line); color: var(--g51-text); line-height: 1.65; white-space: normal; }
.g51-knowledge-mod-body > img, .g51-knowledge-mod-body figure img { max-height: 300px; }
.g51-knowledge-mod-card > footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--g51-line); }
.g51-knowledge-reject { display: flex; flex: 1 1 420px; gap: 8px; }
.g51-knowledge-reject input { flex: 1 1 auto; }

.g51-community-knowledge .rp-card { grid-template-rows: auto auto 1fr auto; align-content: start; }
.g51-community-knowledge .rp-card__image { aspect-ratio: 16 / 9; }
.g51-community-knowledge .rp-card > p { display: -webkit-box; overflow: hidden; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.g51-community-knowledge .rp-card > small { color: var(--g51-dim); font-size: 9px; }
.g51-community-knowledge__fallback { display: grid; width: 64px; height: 64px; place-items: center; border: 1px solid rgba(255,106,0,.3); border-radius: 18px; background: rgba(255,106,0,.08); color: #ff9a55; font-size: 18px; font-weight: 900; }
.g51-knowledge-inspector-cover { aspect-ratio: 16 / 8; max-height: 240px; margin: 0; overflow: hidden; border: 1px solid var(--g51-line); border-radius: 12px; background: #0b0c0e; }
.g51-knowledge-inspector-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.g51-knowledge-inspector-article .g51-article-body { position: relative; max-height: 440px; overflow: hidden; }
.g51-knowledge-inspector-article .g51-article-body::after { position: absolute; right: 0; bottom: 0; left: 0; height: 110px; background: linear-gradient(transparent,rgba(14,14,15,.99)); content: ""; pointer-events: none; }
.g51-knowledge-inspector-more { display: flex; position: relative; z-index: 1; justify-content: center; margin-top: -28px; padding: 10px; border: 1px solid var(--g51-line); border-radius: 10px; background: rgba(255,255,255,.045); color: #ff9a55; font-size: 11px; font-weight: 800; text-decoration: none; }
.g51-knowledge-vote-panel { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 14px; padding: 18px 24px; border-top: 1px solid var(--g51-line); background: rgba(255,255,255,.018); }
.g51-knowledge-vote-panel > div:first-child { display: grid; gap: 3px; margin-right: 8px; }
.g51-knowledge-vote-panel strong { color: var(--g51-text); font-size: 13px; }
.g51-knowledge-vote-panel small { color: var(--g51-dim); font-size: 10px; }
.g51-knowledge-votes { display: inline-flex; align-items: center; gap: 6px; }
.g51-knowledge-votes form { margin: 0; }
.g51-knowledge-vote { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 58px; height: 38px; padding: 0 11px; border: 1px solid var(--g51-line); border-radius: 10px; background: rgba(255,255,255,.035); color: var(--g51-muted); font: inherit; font-size: 0; text-decoration: none; cursor: default; }
.g51-knowledge-vote::before { font-size: 15px; content: "\1F44D"; }
.g51-knowledge-vote--down::before { content: "\1F44E"; }
button.g51-knowledge-vote { cursor: pointer; transition: border-color var(--g51-fast),background var(--g51-fast),color var(--g51-fast),transform var(--g51-fast); }
button.g51-knowledge-vote:hover { border-color: rgba(87,210,139,.4); background: rgba(87,210,139,.08); color: var(--g51-success); }
button.g51-knowledge-vote:active { transform: scale(.96); }
.g51-knowledge-vote.is-active { border-color: rgba(87,210,139,.48); background: rgba(87,210,139,.12); color: var(--g51-success); }
.g51-knowledge-vote--down.is-active, button.g51-knowledge-vote--down:hover { border-color: rgba(255,109,114,.45); background: rgba(255,109,114,.1); color: var(--g51-danger); }
.g51-knowledge-vote span { font-size: 11px; font-weight: 850; }
.g51-knowledge-inspector-votes { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--g51-line); border-radius: 11px; background: rgba(255,255,255,.025); }
.g51-knowledge-inspector-votes > strong { color: var(--g51-muted); font-size: 11px; }
.g51-community-knowledge .rp-card > small { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.g51-community-knowledge__score { flex: 0 0 auto; color: #ff9a55; font-size: 10px; }

/* Community discovery layer */
.g51-community-discovery { display: grid; gap: 16px; margin-bottom: 18px; padding: clamp(19px, 3vw, 28px); border: 1px solid var(--g51-line); border-radius: var(--g51-radius-lg); background: radial-gradient(700px 260px at 0 0, rgba(255,106,0,.1), transparent 66%), linear-gradient(145deg, rgba(28,29,33,.9), rgba(13,14,16,.92)); box-shadow: var(--g51-shadow-md); }
.g51-community-discovery__head { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.g51-community-discovery__head h1 { margin: 5px 0 0; font-size: clamp(28px, 4vw, 46px); }
.g51-community-discovery__head p { margin: 6px 0 0; color: var(--g51-muted); font-size: 13px; }
.g51-stories { display: flex; gap: 15px; overflow-x: auto; padding: 3px 2px 9px; scrollbar-width: thin; }
.g51-story { display: grid; flex: 0 0 76px; justify-items: center; gap: 3px; color: inherit; text-align: center; text-decoration: none; }
.g51-story__ring { display: grid; width: 64px; height: 64px; place-items: center; border-radius: 50%; background: conic-gradient(from 20deg, #ff6a00, #ffad6e, #593020, #ff6a00); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.g51-story__ring > span { display: grid; width: 57px; height: 57px; place-items: center; overflow: hidden; border: 3px solid #151619; border-radius: inherit; background: linear-gradient(145deg,#ff7613,#4d2102); color: #fff; font-weight: 850; }
.g51-story__ring img { width: 100%; height: 100%; object-fit: cover; }
.g51-story strong, .g51-story small { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g51-story strong { margin-top: 4px; color: var(--g51-text); font-size: 11px; }
.g51-story small { color: var(--g51-dim); font-size: 9px; }
.g51-community-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) repeat(2, minmax(210px, .75fr)); gap: 10px; }
.g51-community-featured, .g51-community-ranking { min-width: 0; padding: 14px; border: 1px solid var(--g51-line); border-radius: 17px; background: rgba(255,255,255,.022); }
.g51-community-section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; color: #ff9a55; font-size: 10px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.g51-community-section-title strong { color: var(--g51-dim); font-size: 9px; }
.g51-community-feed { display: grid; gap: 6px; }
.g51-community-post { display: block; padding: 10px; border-radius: 12px; color: inherit; text-decoration: none; transition: background var(--g51-fast); }
.g51-community-post:hover { background: rgba(255,255,255,.045); }
.g51-community-post > strong { color: var(--g51-text); font-size: 12px; }
.g51-community-post p { display: -webkit-box; margin: 5px 0; overflow: hidden; color: var(--g51-muted); font-size: 11px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.g51-community-post small { color: var(--g51-dim); font-size: 9px; }
.g51-community-list { display: grid; gap: 3px; }
.g51-community-list > a { display: grid; grid-template-columns: 24px minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 8px 6px; border-radius: 11px; color: inherit; text-decoration: none; }
.g51-community-list > a:hover { background: rgba(255,255,255,.04); }
.g51-community-list b { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 8px; background: rgba(255,106,0,.09); color: #ff9a55; font-size: 10px; }
.g51-community-list span { min-width: 0; }
.g51-community-list span strong, .g51-community-list span small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g51-community-list span strong { color: var(--g51-text); font-size: 11px; }
.g51-community-list span small { margin-top: 2px; color: var(--g51-dim); font-size: 9px; }
.g51-community-list em { color: var(--g51-muted); font-size: 10px; font-style: normal; }
.g51-community-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.g51-community-create { position: relative; }
.g51-community-create > summary { list-style: none; }
.g51-community-create > summary::-webkit-details-marker { display: none; }
.g51-community-create > form { position: absolute; z-index: 20; top: calc(100% + 9px); right: 0; width: min(500px,calc(100vw - 38px)); padding: 16px; border: 1px solid var(--g51-line-strong); border-radius: 17px; background: rgba(20,21,24,.98); box-shadow: var(--g51-shadow-lg); }
.g51-community-create > form p { margin: 0; color: var(--g51-dim); font-size: 10px; line-height: 1.45; }
.g51-community-entity-form { width: min(520px,80vw); margin-top: 12px; }
.g51-community-media { display: grid; grid-template-columns: 96px minmax(0,1fr); align-items: center; gap: 12px; padding: 10px; border: 1px dashed var(--g51-line-strong); border-radius: 15px; background: rgba(255,255,255,.02); cursor: pointer; }
.g51-community-media__preview { display: grid; width: 96px; height: 64px; place-items: center; overflow: hidden; border-radius: 11px; background: rgba(255,106,0,.08); color: #ff9a55; font-size: 24px; }
.g51-community-media--logo .g51-community-media__preview { width: 72px; height: 72px; border-radius: 20px; }
.g51-community-media__preview img { width: 100%; height: 100%; object-fit: cover; }
.g51-community-media > span:last-child { display: grid; min-width: 0; gap: 3px; }
.g51-community-media strong { color: var(--g51-text); font-size: 12px; }
.g51-community-media small { color: var(--g51-dim); font-size: 10px; }
.g51-community-media input { margin-top: 6px; font-size: 10px; }
.g51-club-card { align-content: start; }
.g51-club-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.g51-club-logo { display: grid; width: 62px; height: 62px; place-items: center; overflow: hidden; border: 1px solid var(--g51-line); border-radius: 19px; background: linear-gradient(145deg,rgba(255,106,0,.18),rgba(255,255,255,.025)); color: #ff9a55; font-size: 24px; font-weight: 900; }
.g51-club-logo img, .space-icon img { width: 100%; height: 100%; object-fit: cover; }
.g51-event-detail { display: grid; grid-template-columns: minmax(280px,420px) minmax(0,1fr); align-items: stretch; }
.g51-event-detail__cover { display: block; grid-column: 1; grid-row: 1 / 3; width: 100%; height: 100%; min-height: 420px; max-height: 560px; box-sizing: border-box; padding: 14px; object-fit: contain; object-position: center; background: radial-gradient(circle at 50% 40%,rgba(255,106,0,.11),transparent 52%),#090a0c; border: 0; border-right: 1px solid var(--g51-line); }
.g51-event-detail > .rp-panel__head, .g51-event-detail > .rp-panel__body { grid-column: 2; }
.g51-event-detail > .rp-panel__head { align-self: end; padding-top: 28px; }
.g51-event-detail > .rp-panel__body { align-self: start; }
.g51-event-card__image { aspect-ratio: 16 / 10; box-sizing: border-box; padding: 8px; background: radial-gradient(circle at 50% 40%,rgba(255,106,0,.1),transparent 55%),#090a0c; }
.g51-event-card__image img { object-fit: contain; object-position: center; }
@media (max-width: 760px) { .g51-event-detail { grid-template-columns: 1fr; } .g51-event-detail__cover { grid-column: 1; grid-row: auto; width: 100%; height: min(64vh,500px); min-height: 260px; padding: 8px; border-right: 0; border-bottom: 1px solid var(--g51-line); } .g51-event-detail > .rp-panel__head, .g51-event-detail > .rp-panel__body { grid-column: 1; } .g51-event-detail > .rp-panel__head { padding-top: 20px; } .g51-event-card__image { aspect-ratio: 4 / 3; } }
.space-icon { overflow: hidden; }

/* Marketplace trust, seller activity and listing history */
.g51-market-trust { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.g51-market-badge { display: inline-flex; align-items: center; min-height: 25px; padding: 4px 8px; border: 1px solid var(--g51-line); border-radius: 999px; background: rgba(255,255,255,.035); color: var(--g51-muted); font-size: 9px; font-weight: 750; }
.g51-market-badge--success { border-color: rgba(87,210,139,.24); background: rgba(87,210,139,.08); color: var(--g51-success); }
.g51-market-seller { display: grid; gap: 12px; margin-block: 18px; padding: 14px; border: 1px solid var(--g51-line); border-radius: 17px; background: linear-gradient(145deg, rgba(255,255,255,.04), rgba(255,106,0,.025)); }
.g51-market-seller > div:first-child { display: flex; align-items: center; gap: 10px; }
.g51-market-seller > div:first-child > span:last-child { min-width: 0; }
.g51-market-seller > div:first-child small, .g51-market-seller > div:first-child strong { display: block; }
.g51-market-seller > div:first-child small { color: var(--g51-dim); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.g51-market-seller > div:first-child strong { margin-top: 2px; color: var(--g51-text); font-size: 13px; }
.g51-market-seller__avatar { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border-radius: 14px; background: linear-gradient(145deg,#ff7613,#4d2102); color: #fff; font-weight: 850; }
.g51-market-seller__signals { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; }
.g51-market-seller__signals > span { min-width: 0; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.035); text-align: center; }
.g51-market-seller__signals strong, .g51-market-seller__signals small { display: block; }
.g51-market-seller__signals strong { color: var(--g51-text); font-size: 14px; font-variant-numeric: tabular-nums; }
.g51-market-seller__signals small { margin-top: 2px; overflow: hidden; color: var(--g51-dim); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.g51-market-seller > p { margin: 0; color: var(--g51-muted); font-size: 10px; line-height: 1.5; }
.g51-market-history { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--g51-line); }
.g51-market-history h2 { margin: 0 0 11px; font-size: 14px; }
.g51-market-history > div { display: grid; }
.g51-market-history p { position: relative; display: grid; grid-template-columns: 10px minmax(0,1fr) auto; gap: 8px; align-items: center; margin: 0; padding: 7px 0; color: var(--g51-muted); font-size: 10px; }
.g51-market-history p > span { width: 7px; height: 7px; border-radius: 50%; background: var(--g51-orange); box-shadow: 0 0 0 4px rgba(255,106,0,.09); }
.g51-market-history p strong { color: var(--g51-text); font-size: 10px; }
.g51-market-history time { color: var(--g51-dim); white-space: nowrap; }

/* Better typography and hierarchy without changing document content. */
:where(body.storefront, body.admin-shell) :where(h1, h2, h3) {
    color: var(--g51-text);
    text-wrap: balance;
}

:where(body.storefront, body.admin-shell) h1 { letter-spacing: -.035em; }
:where(body.storefront, body.admin-shell) h2 { letter-spacing: -.025em; }
:where(.muted, .rp-copy, .hero-text, .dashboard-section__note, .footer-note-mini) { color: var(--g51-muted) !important; }
:where(.gr-metric__value, .erp-metric-tile strong, .rp-metric strong, .dashboard-stat-value, .price) { font-variant-numeric: tabular-nums; letter-spacing: -.035em; }

/* Adaptive density */
@media (max-width: 1024px) {
    :where(.rp-grid, .vehicle-layout, .garage-layout, .marketplace-layout) { grid-template-columns: 1fr !important; }
    :where(.rp-metrics, .erp-metric-wall, .gr-metric-grid) { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    :where(.rp-cards, .products-grid, .marketplace-grid, .services-grid) { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .g51-knowledge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .g51-community-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .g51-community-featured { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
    :root { --g51-radius-lg: 20px; --g51-radius-xl: 24px; }
    body.storefront,
    body.admin-shell { background: var(--g51-bg); }
    :where(.rp-shell, .store-wrap, main.content, .admin-workspace) { max-width: 100%; }
    :where(.rp-metrics, .erp-metric-wall, .gr-metric-grid, .gr-queue-grid) { grid-template-columns: 1fr !important; }
    :where(.rp-cards, .products-grid, .marketplace-grid, .services-grid, .public-garage) { grid-template-columns: 1fr !important; }
    :where(.rp-panel__head, .section-head, .page-head, .gr-dashboard-section__header) { align-items: stretch !important; flex-direction: column; }
    :where(.rp-panel__body, .rp-panel__head) { padding-inline: 17px; }
    :where(.empty-state, .rp-empty, .erp-empty, .gr-empty, .request-empty) { min-height: 150px; padding: 26px 18px !important; }
    .g51-command-backdrop { align-items: end; padding: 0; }
    .g51-command { width: 100%; max-height: 88dvh; border-right: 0; border-bottom: 0; border-left: 0; border-radius: 24px 24px 0 0; }
    .g51-command__body { max-height: 68dvh; }
    .g51-command__search { padding: 14px; }
    .g51-command__search kbd { display: none; }
    .g51-onboarding { right: 14px; bottom: 14px; }
    .g51-intelligence__head { align-items: stretch; flex-direction: column; }
    .g51-intelligence__item { grid-template-columns: 36px minmax(0, 1fr) auto; }
    .rp-graph-explorer { min-height: auto; place-items: stretch; }
    .rp-graph-explorer::after { display: none; }
    .rp-graph-node--root { width: 100%; max-width: none; }
    .rp-graph-links { position: static; display: grid; grid-template-columns: 1fr; gap: 7px; margin-top: 10px; }
    .rp-graph-links .rp-graph-node { position: static; display: grid; max-width: none; }
    .rp-graph-links .rp-graph-node::before { display: none; }
    .g51-knowledge-search__row { grid-template-columns: 1fr; }
    .g51-knowledge-filters { align-items: stretch; flex-direction: column; }
    .g51-knowledge-filters > label { align-items: stretch; flex-direction: column; }
    .g51-knowledge-featured { grid-template-columns: 1fr; }
    .g51-knowledge-featured__visual { min-height: 190px; }
    .g51-knowledge-grid { grid-template-columns: 1fr; }
    .g51-community-discovery__head { align-items: stretch; flex-direction: column; }
    .g51-community-grid { grid-template-columns: 1fr; }
    .g51-community-featured { grid-column: auto; }
    .g51-market-seller__signals { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .g51-knowledge-flow { grid-template-columns: 1fr; }
    .g51-knowledge-flow > i { display: none; }
    .g51-knowledge-editor__grid { grid-template-columns: 1fr; }
    .g51-rich-editor__surface { min-height: 300px; padding: 16px; }
    .g51-rich-editor__history { margin-left: 0; }
    .g51-knowledge-files { grid-template-columns: 1fr; }
    .g51-knowledge-editor__footer, .g51-knowledge-guest { align-items: stretch; flex-direction: column; }
    .g51-knowledge-mod-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .g51-knowledge-mod-filter { grid-template-columns: 1fr; }
    .g51-knowledge-mod-card > header { grid-template-columns: 1fr; }
    .g51-knowledge-mod-summary { grid-template-columns: 112px minmax(0,1fr); }
    .g51-knowledge-mod-cover { width: 112px; height: 76px; }
    .g51-knowledge-mod-author { min-width: 0; text-align: left; }
    .g51-knowledge-reject { align-items: stretch; flex-direction: column; }
    .g51-knowledge-vote-panel { align-items: stretch; flex-direction: column; }
    .g51-community-knowledge .rp-card > small { align-items: flex-start; flex-direction: column; }
    .g51-community-create > form { position: fixed; z-index: 6500; top: auto; right: 14px; bottom: 14px; left: 14px; width: auto; }
    .g51-community-entity-form { width: min(100%,86vw); }
}

@media (pointer: coarse) {
    [data-premium-card] { transform: none !important; }
    [data-premium-card]:hover { filter: none; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .001ms !important; }
    .g51-reveal { opacity: 1; transform: none; }
    [data-premium-card] { transform: none !important; }
}

@media (prefers-contrast: more) {
    :root { --g51-line: rgba(255, 255, 255, .28); --g51-muted: rgba(255, 255, 255, .82); }
    :where(.empty-state, .rp-empty, .erp-empty, .gr-empty) { border-style: solid !important; }
}

/* Knowledge stays inside the viewport on narrow phones. */
@media (max-width: 620px) {
    body.knowledge-page {
        overflow-x: hidden;
    }

    body.knowledge-page .rp-shell {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding-inline: 12px;
    }

    body.knowledge-page :where(.rp-panel, .rp-hero, .g51-knowledge-flow,
        .g51-knowledge-featured, .g51-knowledge-create, .g51-knowledge-filters,
        .g51-knowledge-grid, .g51-knowledge-editor, .g51-rich-editor,
        .g51-rich-editor__workspace) {
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }

    body.knowledge-page .rp-hero__copy,
    body.knowledge-page .g51-knowledge-featured__copy,
    body.knowledge-page .rp-panel__body,
    body.knowledge-page .rp-panel__head {
        min-width: 0;
        box-sizing: border-box;
    }

    body.knowledge-page .rp-hero__title,
    body.knowledge-page .rp-title,
    body.knowledge-page .rp-copy,
    body.knowledge-page .g51-knowledge-featured__copy p,
    body.knowledge-page .g51-knowledge-editor__footer p {
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    body.knowledge-page .g51-knowledge-search,
    body.knowledge-page .g51-knowledge-search__row,
    body.knowledge-page .g51-knowledge-editor__grid,
    body.knowledge-page .g51-knowledge-editor label,
    body.knowledge-page .g51-knowledge-cover-field,
    body.knowledge-page .g51-knowledge-attachments {
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
    }

    body.knowledge-page .g51-knowledge-search__row .rp-button,
    body.knowledge-page .g51-knowledge-editor__footer .rp-button,
    body.knowledge-page .g51-knowledge-guest .rp-button {
        width: 100%;
        max-width: 100%;
        white-space: normal;
    }

    body.knowledge-page .g51-knowledge-filters {
        width: 100%;
        min-width: 0;
    }

    body.knowledge-page .g51-knowledge-filters .rp-tabs {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    body.knowledge-page .g51-knowledge-filters > label,
    body.knowledge-page .g51-knowledge-filters select,
    body.knowledge-page .g51-knowledge-cover-preview,
    body.knowledge-page .g51-knowledge-cover-field input[type="file"] {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    body.knowledge-page .g51-knowledge-flow > span {
        min-width: 0;
    }

    body.knowledge-page .g51-knowledge-flow strong,
    body.knowledge-page .g51-knowledge-flow small,
    body.knowledge-page .g51-knowledge-card__meta,
    body.knowledge-page .g51-knowledge-status {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    body.knowledge-page .g51-knowledge-card__cover,
    body.knowledge-page .g51-knowledge-featured__visual {
        max-width: 100%;
    }

    body.knowledge-page :where(.g51-article-body, .g51-rich-editor__surface) {
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    body.knowledge-page :where(.g51-article-body img, .g51-article-body video,
        .g51-rich-editor__surface img, .g51-rich-editor__surface video) {
        display: block;
        width: auto;
        max-width: 100%;
        height: auto;
    }

    body.knowledge-page .g51-knowledge-file {
        grid-template-columns: 34px minmax(0, 1fr);
        min-width: 0;
    }

    body.knowledge-page .g51-knowledge-file > span:last-child {
        grid-column: 2;
    }

    body.knowledge-page .g51-knowledge-reader__cover {
        width: calc(100% - 24px);
        max-width: calc(100% - 24px);
        margin-top: 12px;
    }
}

@media print {
    .g51-command-backdrop, .g51-onboarding, .g51-page-progress { display: none !important; }
    body::after { display: none; }
    [data-premium-card] { transform: none !important; box-shadow: none !important; }
}
