/* ============================================================
   Status platform — clean, modern, professional dark UI
   One cohesive design system. Driven by --bg and --accent
   (injected per-site from admin settings) so theming still works.
   ============================================================ */

:root {
    /* Theme inputs (overridden inline on <body> from settings) */
    --bg: #0a0d12;
    --accent: #6ea8fe;

    /* Surfaces derived from --bg so custom base colors still work */
    --surface: color-mix(in srgb, #ffffff 4%, var(--bg));
    --surface-2: color-mix(in srgb, #ffffff 6.5%, var(--bg));
    --surface-hover: color-mix(in srgb, #ffffff 9%, var(--bg));
    --surface-inset: color-mix(in srgb, #000000 22%, var(--bg));

    /* Accent variants */
    --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
    --accent-quiet: color-mix(in srgb, var(--accent) 9%, transparent);
    --accent-bright: color-mix(in srgb, var(--accent) 84%, white);
    --on-accent: #05080f;

    /* Lines */
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);

    /* Ink */
    --text: #eef1f6;
    --muted: rgba(238, 241, 246, 0.66);
    --faint: rgba(238, 241, 246, 0.44);

    /* Radii */
    --r-xs: 7px;
    --r-sm: 9px;
    --r: 12px;
    --r-lg: 16px;
    --pill: 999px;

    /* Shadows — deliberately subtle */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 28px 64px -28px rgba(0, 0, 0, 0.8);

    /* Status defaults (admin can override per status via --status-color) */
    --status-color: var(--accent);

    --font:
        ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

    color-scheme: dark;
    font-family: var(--font);
    --maxw: 1120px;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100dvh;
    color: var(--text);
    background:
        radial-gradient(
            1100px 560px at 50% -8%,
            color-mix(in srgb, var(--accent) 9%, transparent),
            transparent 72%
        ),
        var(--bg);
    background-attachment: fixed;
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}

h1,
h2,
h3 {
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.12;
}

::selection {
    background: var(--accent-soft);
}

:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent) 70%, white);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------------------------------------------------------------
   Layout shell
   --------------------------------------------------------------- */
.public-shell main {
    width: min(var(--maxw), calc(100% - 40px));
    margin: 0 auto;
    padding-bottom: 24px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    width: 100%;
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--border);
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 64px;
    /* full-bleed bar, but inset content to align with <main> column */
    padding: 0 max(20px, calc((100% - var(--maxw)) / 2));
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 650;
    font-size: 0.98rem;
    letter-spacing: -0.01em;
    color: var(--text);
    white-space: nowrap;
    min-width: 0;
}

.brand span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-mark,
.brand-icon {
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    border-radius: 7px;
}

.brand-mark {
    background: linear-gradient(
        140deg,
        var(--accent),
        color-mix(in srgb, var(--accent) 50%, #b06ef2)
    );
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.brand-icon {
    object-fit: cover;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.site-nav a {
    padding: 8px 12px;
    border-radius: var(--r-sm);
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 550;
    transition:
        color 0.15s ease,
        background 0.15s ease;
}

.site-nav a:hover {
    color: var(--text);
    background: var(--surface-2);
}

.site-footer {
    width: min(var(--maxw), calc(100% - 40px));
    margin: 56px auto 0;
    padding: 28px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--border);
    color: var(--faint);
    font-size: 0.88rem;
}

.site-footer span:first-child {
    color: var(--muted);
    font-weight: 600;
}

/* ---------------------------------------------------------------
   Buttons
   --------------------------------------------------------------- */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 16px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.05s ease;
}

.button:hover {
    background: var(--surface-hover);
    border-color: color-mix(in srgb, #ffffff 20%, var(--border-strong));
}

.button:active {
    transform: translateY(1px);
}

.button.primary {
    background: var(--accent);
    border-color: transparent;
    color: var(--on-accent);
    font-weight: 650;
}

.button.primary:hover {
    background: var(--accent-bright);
}

.button.secondary,
.button.subtle {
    background: var(--surface);
    border-color: var(--border);
    color: var(--muted);
    font-weight: 550;
}

.button.subtle:hover,
.button.secondary:hover {
    color: var(--text);
    background: var(--surface-2);
    border-color: var(--border-strong);
}

.button.danger {
    background: color-mix(in srgb, #ff5a6a 10%, transparent);
    border-color: color-mix(in srgb, #ff5a6a 32%, transparent);
    color: #ff9aa3;
}

.button.danger:hover {
    background: color-mix(in srgb, #ff5a6a 18%, transparent);
    color: #ffb7bd;
}

.button.danger.subtle {
    background: transparent;
}

/* ---------------------------------------------------------------
   Type helpers
   --------------------------------------------------------------- */
.section-kicker {
    display: inline-block;
    margin: 0 0 10px;
    color: color-mix(in srgb, var(--accent) 88%, white);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 0.86rem;
}

/* ---------------------------------------------------------------
   Hero / page heads
   --------------------------------------------------------------- */
.page-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    padding: 52px 0 30px;
    border-bottom: 1px solid var(--border);
}

.page-hero.home-page-hero {
    display: block;
    border-bottom: 0;
    padding-bottom: 8px;
}

.page-hero h1 {
    margin: 0;
    max-width: 22ch;
    font-size: clamp(2rem, 4.4vw, 3.1rem);
    font-weight: 680;
}

.page-hero p {
    margin: 14px 0 0;
    max-width: 60ch;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.6;
}

.page-hero-badge {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
}

/* ---------------------------------------------------------------
   Status legend
   --------------------------------------------------------------- */
.status-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin: 22px 0 8px;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
}

.legend-label {
    color: var(--faint);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.legend-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ---------------------------------------------------------------
   Status pills + status colors
   --------------------------------------------------------------- */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: max-content;
    padding: 5px 11px;
    border-radius: var(--pill);
    border: 1px solid
        color-mix(
            in srgb,
            var(--status-color, var(--accent)) 30%,
            var(--border)
        );
    background: color-mix(
        in srgb,
        var(--status-color, var(--accent)) 13%,
        transparent
    );
    color: color-mix(in srgb, var(--status-color, var(--accent)) 60%, white);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: var(--pill);
    background: var(--status-color, var(--accent));
    box-shadow: 0 0 0 3px
        color-mix(in srgb, var(--status-color, var(--accent)) 22%, transparent);
}

.status-undetected {
    --status-color: #21c197;
}
.status-use_at_own_risk {
    --status-color: #f2c33d;
}
.status-testing {
    --status-color: #5b96ff;
}
.status-updating {
    --status-color: #ff8a3d;
}
.status-offline {
    --status-color: #ff5a6a;
}

/* Previous -> new status line */
.status-change-line,
.status-change-mini {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.status-change-line span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--pill);
    border: 1px solid
        color-mix(
            in srgb,
            var(--status-color, var(--accent)) 30%,
            var(--border)
        );
    background: color-mix(
        in srgb,
        var(--status-color, var(--accent)) 12%,
        transparent
    );
    color: color-mix(in srgb, var(--status-color, var(--accent)) 62%, white);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-change-line span::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: var(--pill);
    background: var(--status-color, var(--accent));
}

.status-change-line b {
    color: var(--faint);
    font-weight: 600;
}

/* status-change pills sit on their own line, left-aligned, between meta and title */
.status-change-line.large {
    margin: 12px 0 2px;
}

/* ---------------------------------------------------------------
   Sections (status board + updates feed)
   --------------------------------------------------------------- */
.status-atlas,
.updates-flow {
    padding: 36px 0 8px;
}

.status-atlas.status-page-atlas,
.updates-flow.standalone-flow {
    padding-top: 28px;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.section-heading .section-kicker {
    margin-bottom: 6px;
}

.section-heading h2 {
    margin: 0;
    font-size: clamp(1.3rem, 2.4vw, 1.7rem);
    font-weight: 640;
}

/* ---------------------------------------------------------------
   Category accordion + product rows
   --------------------------------------------------------------- */
.category-ledger {
    display: grid;
    gap: 12px;
}

.category-card {
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
    overflow: hidden;
    transition: border-color 0.15s ease;
}

.category-card:hover {
    border-color: var(--border-strong);
}

.category-card summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    cursor: pointer;
    list-style: none;
    transition: background 0.15s ease;
}

.category-card summary:hover {
    background: var(--surface-2);
}

.category-card summary::-webkit-details-marker {
    display: none;
}

.category-title,
.product-title {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
}

.category-title strong,
.product-title strong {
    display: block;
    font-size: 1rem;
    font-weight: 600;
}

.category-title small,
.product-title small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.45;
}

.category-meta,
.product-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

.category-meta > span:first-child {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--pill);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.chevron {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    color: var(--faint);
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.category-card[open] .chevron {
    transform: rotate(180deg);
}

.category-products {
    display: grid;
    padding: 0 20px 8px;
}

.product-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 0;
    border-top: 1px solid var(--border);
}

.product-meta {
    justify-content: flex-end;
}

.product-meta time,
.timestamp-line {
    color: var(--faint);
    font-size: 0.84rem;
    white-space: nowrap;
}

/* ---------------------------------------------------------------
   Icons
   --------------------------------------------------------------- */
.category-icon,
.product-icon {
    flex: 0 0 auto;
    border-radius: 10px;
    border: 1px solid var(--border);
    object-fit: cover;
    background: var(--surface-2);
}

.category-icon {
    width: 44px;
    height: 44px;
}

.product-icon {
    width: 38px;
    height: 38px;
}

.text-icon {
    display: inline-grid;
    place-items: center;
    color: var(--accent-bright);
    font-weight: 700;
    text-transform: uppercase;
    background: var(--accent-quiet);
    border-color: color-mix(in srgb, var(--accent) 24%, var(--border));
}

/* ---------------------------------------------------------------
   Timeline / updates feed
   --------------------------------------------------------------- */
.timeline-stream {
    display: grid;
    gap: 12px;
}

.timeline-card {
    position: relative;
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 14px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
}

.timeline-pin {
    position: relative;
    z-index: 1;
    width: 11px;
    height: 11px;
    margin: 6px auto 0;
    border-radius: var(--pill);
    background: var(--status-color, var(--accent));
    box-shadow: 0 0 0 5px
        color-mix(in srgb, var(--status-color, var(--accent)) 14%, transparent);
}

.timeline-card::before {
    content: "";
    position: absolute;
    /* align with pin center: 20px card padding + 13px (half of 26px rail) */
    left: 33px;
    top: 40px;
    bottom: 16px;
    width: 1px;
    background: linear-gradient(180deg, var(--border-strong), transparent);
}

.timeline-content {
    min-width: 0;
    /* meta on the left, status-change pills top-right; everything else full width */
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 16px;
    align-items: start;
}

.timeline-content > * {
    grid-column: 1 / -1;
    min-width: 0;
}

.timeline-content > .post-meta {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
}

.timeline-content > .status-change-line.large {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    margin: 0;
}

.timeline-content h2,
.timeline-content h3 {
    margin: 8px 0 4px;
    font-size: clamp(1.1rem, 1.8vw, 1.35rem);
    font-weight: 620;
}

.timeline-content p {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--faint);
    font-size: 0.8rem;
}

.post-meta > span:not(.status-pill) {
    padding: 3px 9px;
    border: 1px solid var(--border);
    border-radius: var(--pill);
    background: var(--surface-2);
    color: var(--muted);
    font-weight: 500;
}

.post-meta time {
    color: var(--faint);
}

/* ---------------------------------------------------------------
   Rich text / images
   --------------------------------------------------------------- */
.rich-text {
    color: var(--muted);
    line-height: 1.7;
}

.rich-text p {
    margin: 0 0 0.9em;
}

.rich-text p:last-child {
    margin-bottom: 0;
}

.rich-text ul,
.rich-text ol {
    margin: 0 0 0.9em;
    padding-left: 1.25rem;
}

.rich-text li {
    margin: 0.2em 0;
}

.rich-text strong {
    color: var(--text);
    font-weight: 600;
}

.rich-text a {
    color: var(--accent-bright);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.small-rich {
    font-size: 0.92rem;
}

.post-image {
    width: 100%;
    aspect-ratio: 16 / 8;
    object-fit: cover;
    border-radius: var(--r);
    border: 1px solid var(--border);
    margin: 14px 0;
}

.compact-image {
    aspect-ratio: 16 / 9;
}

/* ---------------------------------------------------------------
   Empty state + simple panel
   --------------------------------------------------------------- */
.empty-state {
    padding: 28px 24px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--r);
    background: var(--surface);
    color: var(--muted);
    text-align: left;
}

.empty-mark {
    width: 28px;
    height: 4px;
    border-radius: var(--pill);
    background: linear-gradient(
        90deg,
        var(--accent),
        color-mix(in srgb, var(--accent) 40%, transparent)
    );
}

.empty-state h3 {
    margin: 12px 0 6px;
    font-size: 1.05rem;
    color: var(--text);
}

.empty-state p {
    margin: 0;
    color: var(--faint);
}

.simple-panel {
    width: min(620px, calc(100% - 40px));
    margin: 96px auto;
    padding: 36px;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.simple-panel .section-kicker {
    color: #ff9aa3;
}

.simple-panel h1 {
    margin: 0 0 12px;
    font-size: clamp(1.6rem, 3.5vw, 2.2rem);
}

.simple-panel p {
    color: var(--muted);
    margin: 0 0 22px;
}

/* ---------------------------------------------------------------
   Flash messages
   --------------------------------------------------------------- */
.flash-wrap {
    display: grid;
    gap: 8px;
    padding: 16px 0 0;
}

.flash {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.92rem;
}

.flash.success {
    border-color: color-mix(in srgb, #21c197 38%, transparent);
    background: color-mix(in srgb, #21c197 10%, transparent);
    color: #7ee3c4;
}

.flash.warning {
    border-color: color-mix(in srgb, #f2c33d 38%, transparent);
    background: color-mix(in srgb, #f2c33d 10%, transparent);
    color: #f4d27a;
}

.flash.error {
    border-color: color-mix(in srgb, #ff5a6a 38%, transparent);
    background: color-mix(in srgb, #ff5a6a 10%, transparent);
    color: #ffa6ad;
}

/* ---------------------------------------------------------------
   Generic cards / panels
   --------------------------------------------------------------- */
.panel,
.glass-panel,
.post-card,
.mini-card,
.metric-card {
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
}

.panel {
    padding: 22px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.section-head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 620;
}

.section-head a {
    color: color-mix(in srgb, var(--accent) 88%, white);
    font-size: 0.88rem;
    font-weight: 600;
}

.section-head .muted {
    font-weight: 400;
}

/* ---------------------------------------------------------------
   Forms
   --------------------------------------------------------------- */
.field {
    display: grid;
    gap: 7px;
}

.field > span {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 600;
}

.input,
.textarea,
.select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    background: var(--surface-inset);
    color: var(--text);
    outline: none;
    box-sizing: border-box;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
}

.input,
.select {
    min-height: 42px;
    line-height: 1.25;
}

.select {
    appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238b95a5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.input::placeholder,
.textarea::placeholder {
    color: var(--faint);
}

.textarea {
    min-height: 170px;
    resize: vertical;
    line-height: 1.55;
}

.input:focus,
.textarea:focus,
.select:focus {
    border-color: color-mix(in srgb, var(--accent) 70%, white);
    box-shadow: 0 0 0 3px var(--accent-soft);
    background: color-mix(in srgb, #000000 14%, var(--bg));
}

.field-error {
    display: grid;
    gap: 2px;
    color: #ffa6ad;
    font-size: 0.84rem;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 550;
    cursor: pointer;
}

.check-row input {
    width: 17px;
    height: 17px;
    accent-color: var(--accent);
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.color-fields .input {
    min-height: 46px;
    padding: 5px;
    cursor: pointer;
}

.theme-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.9rem;
}

.theme-preview span {
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    border-radius: 7px;
    border: 1px solid var(--border-strong);
    background: var(--swatch-color);
}

.theme-preview strong {
    font-weight: 550;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

/* ---------------------------------------------------------------
   Admin shell
   --------------------------------------------------------------- */
.admin-shell {
    display: grid;
    grid-template-columns: 244px minmax(0, 1fr);
    min-height: 100dvh;
}

.admin-sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 20px 16px;
    border-right: 1px solid var(--border);
    background: var(--surface);
}

.admin-brand {
    padding: 4px 6px;
    font-size: 0.98rem;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.admin-nav a,
.sidebar-footer a,
.link-button {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 550;
    text-align: left;
    cursor: pointer;
    transition:
        color 0.15s ease,
        background 0.15s ease;
}

.admin-nav a:hover,
.sidebar-footer a:hover,
.link-button:hover {
    color: var(--text);
    background: var(--surface-2);
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 4px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.admin-main {
    width: min(1180px, calc(100% - 56px));
    margin: 0 auto;
    padding: 14px 0 72px;
}

.admin-topbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 56px;
    color: var(--muted);
    text-align: right;
}

.admin-topbar .muted {
    margin: 0;
    font-size: 0.78rem;
}

.admin-topbar strong {
    font-weight: 600;
    color: var(--text);
}

.admin-flash {
    padding-top: 0;
}

.admin-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 0 22px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--border);
}

.admin-page-head.compact-head {
    padding-top: 8px;
}

.admin-page-head h1 {
    margin: 0;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 660;
}

.admin-page-head p {
    margin: 10px 0 0;
    max-width: 64ch;
    color: var(--muted);
    font-size: 0.98rem;
}

/* ---------------------------------------------------------------
   Admin metrics + grids
   --------------------------------------------------------------- */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.metric-card {
    padding: 20px;
}

.metric-card span {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 600;
}

.metric-card strong {
    display: block;
    margin-top: 10px;
    font-size: 2.1rem;
    font-weight: 660;
    line-height: 1;
    letter-spacing: -0.02em;
}

.admin-grid,
.editor-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.85fr);
    gap: 20px;
    align-items: start;
    margin-bottom: 24px;
}

.form-panel {
    display: grid;
    gap: 15px;
}

.form-panel h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 620;
}

.form-panel.narrow {
    width: min(720px, 100%);
}

/* ---------------------------------------------------------------
   Admin lists
   --------------------------------------------------------------- */
.admin-list {
    display: grid;
}

.admin-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.admin-list-row:last-child {
    border-bottom: 0;
}

.admin-list-row > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.admin-list-row strong {
    font-weight: 600;
}

.admin-list-row span {
    color: var(--muted);
    font-size: 0.88rem;
}

.admin-list-row time {
    color: var(--faint);
    font-size: 0.84rem;
    white-space: nowrap;
}

.row-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.row-actions .button {
    min-height: 34px;
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* ---------------------------------------------------------------
   Status composer + Discord v2 preview
   --------------------------------------------------------------- */
.status-composer {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
    gap: 20px;
    align-items: start;
    margin-bottom: 24px;
}

.composer-form {
    gap: 16px;
}

.composer-form .two-col {
    align-items: start;
}

.composer-form .two-col .field > .select {
    height: 42px;
}

.category-toggle-row {
    margin-top: 10px;
}

.category-toggle-help {
    margin: 8px 0 0;
}

.composer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.preview-panel,
.status-v2-preview {
    position: sticky;
    top: 16px;
}

.v2-message {
    --preview-color: var(--accent);
    display: grid;
    grid-template-columns: 4px minmax(0, 1fr);
    margin-top: 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r);
    overflow: hidden;
    background: var(--surface-inset);
}

.v2-accent {
    background: var(--preview-color);
}

.v2-body {
    display: grid;
    gap: 12px;
    padding: 18px;
}

.v2-body h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.15rem;
    font-weight: 640;
}

.v2-icon {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--preview-color);
    color: var(--on-accent);
    font-weight: 800;
    font-size: 0.9rem;
}

.v2-block {
    display: grid;
    gap: 6px;
}

.v2-block strong {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.v2-block code,
.preview-rich {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: color-mix(in srgb, #000000 30%, var(--bg));
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.88rem;
    line-height: 1.45;
    white-space: pre-wrap;
}

.preview-rich {
    min-height: 70px;
    font-family: var(--font);
    color: var(--muted);
}

.v2-divider {
    height: 1px;
    background: var(--border);
}

.v2-link,
.v2-footer {
    color: var(--faint);
    font-size: 0.85rem;
}

.v2-image {
    width: 100%;
    aspect-ratio: 16 / 7;
    object-fit: cover;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
}


.v2-translate-preview {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.v2-translate-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.v2-translate-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    font-size: 1.1rem;
}

.translate-settings-panel {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.translate-settings-help {
    margin: 0 0 12px;
}

.translate-languages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.translate-language-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: 1.35rem;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.translate-language-chip:hover {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}

/* ---------------------------------------------------------------
   Update history (admin)
   --------------------------------------------------------------- */
.history-panel {
    margin-bottom: 24px;
}

.status-history-grid {
    display: grid;
    gap: 12px;
}

.history-card {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
}

.history-thumb {
    width: 88px;
    height: 66px;
    border-radius: var(--r-sm);
    object-fit: cover;
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.history-thumb-fallback {
    display: grid;
    place-items: center;
}

.history-thumb-fallback span {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent-quiet);
    border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
    color: var(--accent-bright);
    font-weight: 700;
}

.history-main {
    min-width: 0;
}

.history-main h3 {
    margin: 6px 0 4px;
    font-size: 1.05rem;
    font-weight: 620;
}

.history-main p {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 0.92rem;
}

.history-actions {
    justify-content: flex-end;
}

/* ---------------------------------------------------------------
   Docs panel
   --------------------------------------------------------------- */
.docs-panel {
    margin-top: 22px;
}

.docs-panel h2 {
    margin: 0 0 4px;
    font-size: 1.05rem;
    font-weight: 620;
}

.docs-panel ol {
    margin: 12px 0 0;
    padding-left: 1.2rem;
    color: var(--muted);
    line-height: 1.7;
}

.docs-panel code {
    padding: 1px 6px;
    border-radius: 5px;
    background: var(--surface-inset);
    font-family: var(--mono);
    font-size: 0.86em;
}

/* ---------------------------------------------------------------
   Motion (restrained, respects user preference)
   --------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
    .category-card,
    .timeline-card,
    .panel,
    .metric-card,
    .history-card,
    .status-legend,
    .v2-message {
        animation: rise-in 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    .timeline-card:nth-child(2),
    .panel:nth-child(2),
    .history-card:nth-child(2) {
        animation-delay: 55ms;
    }
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------------------------------------------------------------
   Responsive
   --------------------------------------------------------------- */
@media (max-width: 980px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    /* admin sidebar becomes a clean sticky top bar */
    .admin-sidebar {
        position: sticky;
        top: 0;
        z-index: 30;
        height: auto;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px 16px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        background: color-mix(in srgb, var(--bg) 86%, transparent);
        backdrop-filter: saturate(160%) blur(14px);
    }

    .admin-brand {
        padding: 2px;
    }

    /* nav scrolls horizontally instead of wrapping into a messy block */
    .admin-nav {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 4px;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        margin: 0 -4px;
        padding: 0 4px 2px;
    }

    .admin-nav::-webkit-scrollbar {
        display: none;
    }

    .admin-nav a {
        width: auto;
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .sidebar-footer {
        margin-top: 0;
        padding-top: 10px;
        border-top: 1px solid var(--border);
        grid-auto-flow: column;
        justify-content: start;
        gap: 6px;
    }

    .sidebar-footer a,
    .sidebar-footer form,
    .sidebar-footer .link-button {
        width: auto;
    }

    .sidebar-footer form {
        display: inline-flex;
    }

    .admin-main {
        width: min(100%, calc(100% - 40px));
    }

    .admin-grid,
    .editor-grid,
    .status-composer {
        grid-template-columns: 1fr;
    }

    .preview-panel,
    .status-v2-preview {
        position: static;
    }

    .metric-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 720px) {
    .public-shell main,
    .site-footer {
        width: min(var(--maxw), calc(100% - 28px));
    }

    .page-hero,
    .section-heading,
    .admin-page-head,
    .composer-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-hero-badge {
        align-items: flex-start;
    }

    .metric-grid,
    .two-col {
        grid-template-columns: 1fr;
    }

    .admin-list-row {
        flex-direction: column;
        align-items: flex-start;
    }

    /* keep status pills on the right edge, even on mobile */
    .product-row {
        gap: 12px;
    }

    .product-title {
        flex: 1;
        min-width: 0;
    }

    .product-meta {
        flex-direction: column;
        align-items: flex-end;
        gap: 6px;
        flex: 0 0 auto;
    }

    /* on mobile the timeline stacks: status-change pills get their own line */
    .timeline-content {
        display: block;
    }

    .timeline-content > .status-change-line.large {
        margin: 12px 0 2px;
    }

    /* compact history cards: small thumbnail, no giant banners */
    .history-card {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 12px;
    }

    .history-thumb {
        width: 52px;
        height: 52px;
        aspect-ratio: auto;
        flex: 0 0 auto;
    }

    .history-thumb-fallback span {
        width: 36px;
        height: 36px;
    }

    .history-main {
        flex: 1;
        min-width: 0;
    }

    .row-actions,
    .history-actions {
        justify-content: flex-start;
    }

    .history-actions {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .site-nav a {
        padding: 7px 9px;
        font-size: 0.86rem;
    }
}
