/* =========================================================================
   Hixel My — Custom styles (loaded AFTER Bootstrap 5 CDN)

   Hixel platform UI is dark-first. Tokens follow the brand book at
   /docs/hixel-brand-book.md. Bootstrap handles: grid, typography, forms,
   buttons, tables, cards, alerts, badges, breadcrumbs, navbar, utilities.

   This file adds: admin shell layout, sidebar nav, topbar, and Hixel-specific
   component styles that don't exist in Bootstrap.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Hixel brand palette */
    --hixel-brand: #3BC4B8;
    --hixel-brand-deep: #2A8FA8;
    --hixel-accent-yellow: #F5C842;
    --hixel-accent-coral: #F26B73;

    /* Surface stack (dark) */
    --hixel-bg: #0B1929;
    --hixel-surface: #15243A;
    --hixel-surface-elevated: #1E3252;
    --hixel-surface-muted: #0F1D30;
    --hixel-border: #2A3F5F;
    --hixel-border-strong: #3D5478;

    /* Text */
    --hixel-ink: #FFFFFF;
    --hixel-ink-secondary: #B8C5D6;
    --hixel-ink-muted: #7A8AA3;
    --hixel-ink-on-brand: #0B1929;

    /* Semantic — pill backgrounds use 15% opacity over surface */
    --hixel-success: #3BC4B8;
    --hixel-success-bg: rgba(59, 196, 184, 0.15);
    --hixel-warning: #F5C842;
    --hixel-warning-bg: rgba(245, 200, 66, 0.15);
    --hixel-danger: #F26B73;
    --hixel-danger-bg: rgba(242, 107, 115, 0.15);
    --hixel-info: #2A8FA8;
    --hixel-info-bg: rgba(42, 143, 168, 0.15);

    /* Typography */
    --hixel-font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --hixel-font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

    /* Legacy aliases — keep CSS that uses --brand/--brand-strong/--accent working.
       --brand is the teal CTA color, --brand-strong is now used as a "deep navy
       container" surface (sidebar, topbar fallback), --accent is the yellow accent. */
    --brand: var(--hixel-brand);
    --brand-strong: var(--hixel-surface);
    --accent: var(--hixel-accent-yellow);
}

/* =========================================================================
   Bootstrap dark mode overrides — apply Hixel surface stack to all bs-* tokens
   ========================================================================= */
[data-bs-theme="dark"] {
    --bs-body-bg: var(--hixel-bg);
    --bs-body-color: var(--hixel-ink);
    --bs-body-color-rgb: 255, 255, 255;
    --bs-emphasis-color: var(--hixel-ink);
    --bs-emphasis-color-rgb: 255, 255, 255;
    --bs-secondary-color: var(--hixel-ink-secondary);
    --bs-secondary-color-rgb: 184, 197, 214;
    --bs-tertiary-color: var(--hixel-ink-muted);
    --bs-secondary-bg: var(--hixel-surface);
    --bs-secondary-bg-rgb: 21, 36, 58;
    --bs-tertiary-bg: var(--hixel-surface-muted);
    --bs-tertiary-bg-rgb: 15, 29, 48;
    --bs-border-color: var(--hixel-border);
    --bs-border-color-translucent: rgba(255, 255, 255, 0.1);
    --bs-link-color: var(--hixel-brand);
    --bs-link-hover-color: var(--hixel-brand-deep);
    --bs-link-color-rgb: 59, 196, 184;
    --bs-link-hover-color-rgb: 42, 143, 168;
    --bs-primary: var(--hixel-brand);
    --bs-primary-rgb: 59, 196, 184;
    --bs-primary-text-emphasis: var(--hixel-brand);
    --bs-primary-bg-subtle: var(--hixel-success-bg);
    --bs-primary-border-subtle: rgba(59, 196, 184, 0.3);
    --bs-success-text-emphasis: var(--hixel-success);
    --bs-success-bg-subtle: var(--hixel-success-bg);
    --bs-success-border-subtle: rgba(59, 196, 184, 0.3);
    --bs-warning-text-emphasis: var(--hixel-warning);
    --bs-warning-bg-subtle: var(--hixel-warning-bg);
    --bs-warning-border-subtle: rgba(245, 200, 66, 0.3);
    --bs-danger-text-emphasis: var(--hixel-danger);
    --bs-danger-bg-subtle: var(--hixel-danger-bg);
    --bs-danger-border-subtle: rgba(242, 107, 115, 0.3);
    --bs-info-text-emphasis: var(--hixel-info);
    --bs-info-bg-subtle: var(--hixel-info-bg);
    --bs-info-border-subtle: rgba(42, 143, 168, 0.3);
    --bs-form-valid-color: var(--hixel-success);
    --bs-form-valid-border-color: var(--hixel-success);
    --bs-form-invalid-color: var(--hixel-danger);
    --bs-form-invalid-border-color: var(--hixel-danger);
    --bs-code-color: var(--hixel-brand);
    --bs-highlight-bg: var(--hixel-warning-bg);
}

body {
    font-family: var(--hixel-font-sans);
}

code, kbd, pre, samp, .text-monospace {
    font-family: var(--hixel-font-mono);
}

/* Override Bootstrap primary with Hixel teal */
a { color: var(--hixel-brand); }
a:hover { color: var(--hixel-brand-deep); }

/* Headings — white on dark surfaces */
h1, h2, h3, h4, h5, h6 { color: var(--hixel-ink); font-weight: 600; }

/* Lead text */
.lead { max-width: 60ch; color: var(--hixel-ink-secondary); }

/* Bootstrap button overrides — primary teal with navy text */
[data-bs-theme="dark"] .btn-primary {
    --bs-btn-bg: var(--hixel-brand);
    --bs-btn-color: var(--hixel-ink-on-brand);
    --bs-btn-border-color: var(--hixel-brand);
    --bs-btn-hover-bg: var(--hixel-brand-deep);
    --bs-btn-hover-color: var(--hixel-ink);
    --bs-btn-hover-border-color: var(--hixel-brand-deep);
    --bs-btn-active-bg: var(--hixel-brand-deep);
    --bs-btn-active-color: var(--hixel-ink);
    --bs-btn-active-border-color: var(--hixel-brand-deep);
    --bs-btn-disabled-bg: var(--hixel-brand);
    --bs-btn-disabled-color: var(--hixel-ink-on-brand);
    --bs-btn-disabled-border-color: var(--hixel-brand);
}
[data-bs-theme="dark"] .btn-outline-primary {
    --bs-btn-color: var(--hixel-brand);
    --bs-btn-border-color: var(--hixel-border-strong);
    --bs-btn-bg: transparent;
    --bs-btn-hover-bg: var(--hixel-surface-elevated);
    --bs-btn-hover-color: var(--hixel-brand);
    --bs-btn-hover-border-color: var(--hixel-brand);
    --bs-btn-active-bg: var(--hixel-surface-elevated);
    --bs-btn-active-color: var(--hixel-brand);
}
[data-bs-theme="dark"] .btn-secondary {
    --bs-btn-bg: transparent;
    --bs-btn-color: var(--hixel-ink);
    --bs-btn-border-color: var(--hixel-border-strong);
    --bs-btn-hover-bg: var(--hixel-surface-elevated);
    --bs-btn-hover-color: var(--hixel-ink);
    --bs-btn-hover-border-color: var(--hixel-border-strong);
}
[data-bs-theme="dark"] .btn-danger {
    --bs-btn-bg: var(--hixel-danger);
    --bs-btn-color: var(--hixel-ink);
    --bs-btn-border-color: var(--hixel-danger);
}

/* Navbar in dark — surface bg overrides Bootstrap's bg-white/bg-body-tertiary classes */
[data-bs-theme="dark"] .navbar.bg-white,
[data-bs-theme="dark"] .navbar.bg-body-tertiary {
    background-color: var(--hixel-surface) !important;
    border-color: var(--hixel-border) !important;
}
[data-bs-theme="dark"] footer.bg-white,
[data-bs-theme="dark"] footer.bg-body-tertiary {
    background-color: var(--hixel-surface) !important;
    border-color: var(--hixel-border) !important;
}

/* Tables — dark mode uses surface as row bg, surface-elevated on hover */
[data-bs-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--hixel-ink);
    --bs-table-border-color: var(--hixel-border);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
    --bs-table-striped-color: var(--hixel-ink);
    --bs-table-hover-bg: var(--hixel-surface-elevated);
    --bs-table-hover-color: var(--hixel-ink);
}

/* Bootstrap Card — dark surface */
[data-bs-theme="dark"] .card {
    --bs-card-bg: var(--hixel-surface);
    --bs-card-border-color: var(--hixel-border);
    --bs-card-cap-bg: var(--hixel-surface-muted);
    --bs-card-color: var(--hixel-ink);
    box-shadow: none;
}

/* Form controls in dark mode */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .form-check-input {
    background-color: var(--hixel-surface-muted);
    border-color: var(--hixel-border);
    color: var(--hixel-ink);
}
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: var(--hixel-surface-muted);
    border-color: var(--hixel-brand);
    box-shadow: 0 0 0 0.2rem rgba(59, 196, 184, 0.2);
    color: var(--hixel-ink);
}
[data-bs-theme="dark"] .form-control::placeholder {
    color: var(--hixel-ink-muted);
}
[data-bs-theme="dark"] .form-check-input:checked {
    background-color: var(--hixel-brand);
    border-color: var(--hixel-brand);
}

/* Breadcrumb in dark */
[data-bs-theme="dark"] .breadcrumb {
    --bs-breadcrumb-divider-color: var(--hixel-ink-muted);
    --bs-breadcrumb-item-active-color: var(--hixel-ink);
}
[data-bs-theme="dark"] .breadcrumb-item a {
    color: var(--hixel-ink-secondary);
    text-decoration: none;
}
[data-bs-theme="dark"] .breadcrumb-item a:hover {
    color: var(--hixel-brand);
}

/* Modal in dark */
[data-bs-theme="dark"] .modal-content {
    background-color: var(--hixel-surface);
    border-color: var(--hixel-border);
}
[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
    border-color: var(--hixel-border);
}

/* Dropdown in dark */
[data-bs-theme="dark"] .dropdown-menu {
    --bs-dropdown-bg: var(--hixel-surface-elevated);
    --bs-dropdown-border-color: var(--hixel-border);
    --bs-dropdown-link-color: var(--hixel-ink-secondary);
    --bs-dropdown-link-hover-bg: var(--hixel-surface-muted);
    --bs-dropdown-link-hover-color: var(--hixel-ink);
    --bs-dropdown-divider-bg: var(--hixel-border);
}

/* =========================================================================
   Legacy page helpers mapped to Bootstrap-like styling
   ========================================================================= */

.card:not(.feature-card):not(.stat-card):not(.media-card) {
    margin-bottom: 1.5rem;
    border-color: var(--bs-border-color);
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.04);
}

.card:not(.feature-card):not(.stat-card):not(.media-card):not(:has(> .card-body)) {
    padding: 1.5rem;
}

.card:not(.feature-card):not(.stat-card):not(.media-card):not(:has(> .card-body)) > :first-child {
    margin-top: 0;
}

.card:not(.feature-card):not(.stat-card):not(.media-card):not(:has(> .card-body)) > :last-child {
    margin-bottom: 0;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: calc(1.5em + 0.75rem + 2px);
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--hixel-brand);
    border-radius: var(--bs-border-radius);
    background: var(--hixel-brand);
    color: var(--hixel-ink-on-brand);
    font-weight: 500;
    line-height: 1.5;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.button:hover {
    background: var(--hixel-brand-deep);
    border-color: var(--hixel-brand-deep);
    color: var(--hixel-ink);
}

.button.secondary {
    background: transparent;
    border-color: var(--hixel-border-strong);
    color: var(--hixel-ink);
}

.button.secondary:hover {
    background: var(--hixel-surface-elevated);
    border-color: var(--hixel-brand);
    color: var(--hixel-brand);
}

.button.danger {
    background: var(--hixel-danger);
    border-color: var(--hixel-danger);
    color: var(--hixel-ink);
}

.button.danger:hover {
    background: var(--hixel-danger);
    border-color: var(--hixel-danger);
    filter: brightness(1.08);
}

.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--bs-link-color);
    text-decoration: underline;
    cursor: pointer;
}

.link-button:hover {
    color: var(--bs-link-hover-color);
}

.stacked {
    display: grid;
    gap: 1rem;
}

.field {
    display: grid;
    gap: 0.5rem;
}

.field label {
    margin: 0;
    font-weight: 500;
    color: var(--hixel-ink-secondary);
}

.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.field select,
.field textarea,
.filter-bar input,
.filter-bar select,
.inline-form select {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
    background-clip: padding-box;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    appearance: none;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
.field select:focus,
.field textarea:focus,
.filter-bar input:focus,
.filter-bar select:focus,
.inline-form select:focus {
    border-color: var(--hixel-brand);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(59, 196, 184, 0.2);
}

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.alert.error {
    color: var(--bs-danger-text-emphasis);
    background: var(--bs-danger-bg-subtle);
    border: 1px solid var(--bs-danger-border-subtle);
}

.alert.success {
    color: var(--bs-success-text-emphasis);
    background: var(--bs-success-bg-subtle);
    border: 1px solid var(--bs-success-border-subtle);
}

.data,
.data-table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: collapse;
    vertical-align: top;
}

.data thead th,
.data-table thead th {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--hixel-surface-muted);
    color: var(--hixel-ink-muted);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data tbody td,
.data-table tbody td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.data tbody tr:hover,
.data-table tbody tr:hover {
    background: var(--hixel-surface-elevated);
}

.filter-bar label {
    display: grid;
    gap: 0.375rem;
    min-width: 160px;
    margin: 0;
    font-weight: 500;
    color: var(--hixel-ink-secondary);
}

.badge-default {
    background: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
}

.badge-success {
    background: var(--bs-success-bg-subtle);
    color: var(--bs-success-text-emphasis);
}

.tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab-bar a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    background: var(--bs-body-bg);
}

.tab-bar a.active {
    background: var(--hixel-brand);
    border-color: var(--hixel-brand);
    color: var(--hixel-ink-on-brand);
}

.tab-bar.tab-strip {
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.tab-bar.tab-strip a {
    padding: 0.5rem 1.25rem;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    margin-bottom: -1px;
    background: transparent;
    color: var(--hixel-ink-secondary);
    font-weight: 500;
    text-decoration: none;
}

.tab-bar.tab-strip a:hover {
    color: var(--hixel-ink);
    background: transparent;
}

.tab-bar.tab-strip a.active {
    background: transparent;
    border-color: transparent transparent var(--hixel-brand) transparent;
    color: var(--hixel-brand);
}

/* =========================================================================
   Custom components (not in Bootstrap)
   ========================================================================= */

/* Status pill — semantic color at 15% over surface, full color text */
.status-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    background: var(--hixel-info-bg);
    color: var(--hixel-info);
}
.status-pill.active     { background: var(--hixel-success-bg); color: var(--hixel-success); }
.status-pill.suspended  { background: var(--hixel-danger-bg);  color: var(--hixel-danger); }
.status-pill.succeeded  { background: var(--hixel-success-bg); color: var(--hixel-success); }
.status-pill.failed     { background: var(--hixel-danger-bg);  color: var(--hixel-danger); }
.status-pill.running    { background: var(--hixel-success-bg); color: var(--hixel-success); }
.status-pill.pending,
.status-pill.provisioning { background: var(--hixel-warning-bg); color: var(--hixel-warning); }

/* KV list */
.kv-list { list-style: none; padding: 0; margin: 0; }
.kv-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--bs-border-color); }
.kv-list li:last-child { border-bottom: 0; }
.kv-list .key { color: var(--hixel-ink-muted); }
.kv-list .value { font-weight: 500; color: var(--hixel-ink); }

/* Wizard step indicator */
.wizard-nav { list-style: none; margin: 0 0 24px; padding: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wizard-step { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 8px; background: var(--hixel-surface-muted); border: 1px solid var(--bs-border-color); font-size: 0.875rem; color: var(--hixel-ink-muted); }
.wizard-step-number { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 999px; background: var(--bs-border-color); color: var(--hixel-ink-muted); font-weight: 600; font-size: 0.75rem; }
.wizard-step.current { background: var(--hixel-brand); color: var(--hixel-ink-on-brand); border-color: var(--hixel-brand); font-weight: 600; }
.wizard-step.current .wizard-step-number { background: var(--hixel-ink-on-brand); color: var(--hixel-brand); }
.wizard-step.done { background: var(--hixel-success-bg); color: var(--hixel-success); border-color: rgba(59, 196, 184, 0.3); }
.wizard-step.done .wizard-step-number { background: var(--hixel-success); color: var(--hixel-ink-on-brand); }
.wizard-step.done a { color: var(--hixel-success); text-decoration: none; font-weight: 500; }
.wizard-step.future { opacity: 0.6; }

/* URL preview */
.url-preview { display: block; margin-top: 8px; padding: 10px 14px; background: var(--hixel-surface-muted); border: 1px solid var(--bs-border-color); border-radius: 8px; font-family: var(--hixel-font-mono); font-size: 0.875rem; color: var(--hixel-brand); }

/* Feature card */
.feature-card { padding: 16px; border: 1px solid var(--bs-border-color); border-radius: 8px; margin-bottom: 12px; background: var(--hixel-surface); }
.feature-card.selected { border-color: var(--hixel-brand); background: var(--hixel-surface-elevated); }
.feature-card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.feature-card .price { font-weight: 600; color: var(--hixel-brand); }

/* Placeholder card */
.placeholder-card { background: var(--hixel-surface); border: 1px dashed var(--bs-border-color); border-radius: 8px; padding: 48px 32px; text-align: center; color: var(--hixel-ink-secondary); }
.placeholder-card h2 { color: var(--hixel-ink); margin-top: 0; }
.placeholder-card p { max-width: 60ch; margin: 0 auto 16px; }

/* Card header actions */
.card-section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-section-header > * {
    margin-bottom: 0;
}

.card-section-header-copy {
    min-width: 0;
}

.page-action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem 0 1.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    background: var(--hixel-surface);
    box-shadow: none;
    position: sticky;
    top: 1rem;
    z-index: 10;
}

.page-action-bar__title {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--hixel-ink-muted);
}

.page-action-bar__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-left: auto;
}

.sortable-grid-table__handle-col {
    width: 1%;
}

.sortable-grid-table__position-col {
    width: 1%;
    white-space: nowrap;
}

.sortable-grid-row {
    cursor: default;
}

.sortable-grid-row--dragging {
    opacity: 0.55;
}

.sortable-grid-handle {
    cursor: grab;
}

.sortable-grid-handle:active {
    cursor: grabbing;
}

.sortable-grid-position {
    display: inline-flex;
    min-width: 2rem;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: var(--hixel-surface-muted);
    color: var(--hixel-ink);
    font-size: 0.75rem;
    font-weight: 500;
    font-family: var(--hixel-font-mono);
}

/* Dashboard stat grid */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 24px 0; }
.stat-card { background: var(--hixel-surface); border: 1px solid var(--bs-border-color); border-radius: 8px; padding: 20px; box-shadow: none; }
.stat-card .stat-label { font-size: 0.75rem; color: var(--hixel-ink-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; font-weight: 500; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; color: var(--hixel-ink); line-height: 1.1; }
.stat-card .stat-sub { font-size: 0.85rem; color: var(--hixel-ink-secondary); margin-top: 6px; }

.slug-blacklist-job-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem 1rem;
}

.slug-blacklist-job-summary > div {
    display: grid;
    gap: 0.25rem;
}

.slug-blacklist-job-summary .key {
    color: var(--hixel-ink-muted);
    font-size: 0.85rem;
}

.slug-blacklist-job-summary .value {
    color: var(--hixel-ink);
    font-weight: 500;
}

.slug-blacklist-activity-table td,
.slug-blacklist-activity-table th {
    white-space: nowrap;
}

.slug-blacklist-activity-table td:first-child,
.slug-blacklist-activity-table th:first-child {
    white-space: normal;
}

/* Media grid */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 8px; }
.media-card { display: flex; flex-direction: column; text-decoration: none; color: var(--hixel-ink); background: var(--hixel-surface); border: 1px solid var(--bs-border-color); border-radius: 8px; overflow: hidden; transition: transform 0.1s, border-color 0.1s; }
.media-card:hover { transform: translateY(-2px); border-color: var(--hixel-brand); }
.media-thumb { aspect-ratio: 4/3; background: var(--hixel-surface-muted); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-meta { padding: 10px 12px; }
.media-title { font-weight: 500; color: var(--hixel-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }

/* Media picker */
.media-picker__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 0;
}

.media-picker__summary-body {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.media-picker__summary-preview {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.media-picker__summary-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-picker__summary-preview.is-empty {
    color: var(--bs-secondary-color);
}

/* HTML editor */
.html-editor__source {
    display: none;
    min-height: 12rem;
    border: 0;
    border-top: 1px solid var(--bs-border-color);
    border-radius: 0 0 var(--bs-border-radius) var(--bs-border-radius);
    box-shadow: none !important;
    resize: vertical;
}

.html-editor {
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    background: var(--bs-body-bg);
}

.html-editor:focus-within {
    border-color: var(--hixel-brand);
    box-shadow: 0 0 0 0.2rem rgba(59, 196, 184, 0.2);
}

.html-editor__toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding: 0.625rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-tertiary-bg);
}

.html-editor__tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    min-height: 2.25rem;
    padding: 0.375rem 0.625rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 6px;
    background: var(--hixel-surface);
    color: var(--hixel-ink-secondary);
}

.html-editor__tool:hover {
    background: var(--hixel-surface-elevated);
    color: var(--hixel-ink);
}

.html-editor__tool.is-active {
    background: var(--hixel-brand);
    border-color: var(--hixel-brand);
    color: var(--hixel-ink-on-brand);
}

.html-editor__surface {
    min-height: 12rem;
    padding: 0.875rem 1rem;
    border: 0;
    border-radius: 0 0 var(--bs-border-radius) var(--bs-border-radius);
    box-shadow: none !important;
    overflow-y: auto;
}

.html-editor__surface:focus {
    outline: 0;
}

.html-editor__surface:empty::before {
    content: attr(data-placeholder);
    color: var(--bs-secondary-color);
}

.html-editor__surface h2,
.html-editor__surface h3,
.html-editor__surface p,
.html-editor__surface ul,
.html-editor__surface ol,
.html-editor__surface blockquote {
    margin-bottom: 0.75rem;
}

.html-editor__surface blockquote {
    padding-left: 1rem;
    border-left: 3px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
}

.html-editor--show-source .html-editor__surface {
    display: none;
}

.html-editor--show-source .html-editor__source {
    display: block;
}

/* OperationsHub service item */
.service-item-truncate {
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.service-item-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.service-item-gallery-card {
    position: relative;
    width: 120px;
}

.service-item-gallery-media,
.service-item-gallery-placeholder {
    width: 120px;
    height: 90px;
    border-radius: 6px;
    border: 1px solid var(--bs-border-color);
}

.service-item-gallery-media {
    object-fit: cover;
}

.service-item-gallery-placeholder {
    background: var(--bs-tertiary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bs-secondary-color);
    font-size: 0.8em;
}

.service-item-gallery-remove {
    position: absolute;
    top: 4px;
    right: 4px;
}

.service-item-gallery-title {
    font-size: 0.75em;
    color: var(--bs-secondary-color);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.service-item-summary-card {
    margin-top: 16px;
}

.service-item-summary-copy {
    flex: 1;
}

.media-picker__summary-glyph {
    font-size: 1.5rem;
}

.media-picker__summary-copy {
    min-width: 0;
}

.media-picker__summary-title {
    font-weight: 500;
    color: var(--hixel-ink);
}

.media-picker__summary-meta {
    color: var(--hixel-ink-muted);
    font-size: 0.9rem;
}

.media-picker__summary-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.media-picker__toolbar {
    margin-bottom: 1rem;
}

.media-picker__upload {
    margin-bottom: 1rem;
}

.media-picker__upload.card {
    padding: 0;
}

.media-picker__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.media-picker__option {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    background: var(--hixel-surface);
    overflow: hidden;
    text-align: left;
    color: var(--hixel-ink);
    transition: transform 0.12s ease, border-color 0.12s ease;
}

.media-picker__option:hover {
    transform: translateY(-2px);
    border-color: var(--hixel-brand);
}

.media-picker__option.is-selected {
    border-color: var(--hixel-brand);
    box-shadow: 0 0 0 2px rgba(59, 196, 184, 0.25);
}

.media-picker__option-preview {
    aspect-ratio: 4 / 3;
    background: var(--bs-tertiary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.media-picker__option-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-picker__option-glyph {
    font-size: 2rem;
    color: var(--bs-secondary-color);
}

.media-picker__option-copy {
    padding: 0.75rem;
}

.media-picker__option-title {
    font-weight: 500;
    color: var(--hixel-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-picker__option-meta {
    font-size: 0.85rem;
    color: var(--hixel-ink-muted);
}

/* Filter bar */
.filter-bar { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; margin: 0 0 16px; padding: 12px 16px; background: var(--hixel-surface-muted); border: 1px solid var(--bs-border-color); border-radius: 8px; }

/* Help text */
.help { display: block; color: var(--hixel-ink-muted); font-size: 0.85rem; margin-top: 4px; }

/* Env badge — semantic mapping: SIT=warning, STAGE=info, PROD=success */
.env-badge { display: inline-block; padding: 2px 10px; border-radius: 4px; font-size: 0.7rem; font-weight: 500; letter-spacing: 0.05em; font-family: var(--hixel-font-mono); background: var(--hixel-surface-muted); color: var(--hixel-ink-muted); border: none; }
.env-badge.env-sit   { background: var(--hixel-warning-bg); color: var(--hixel-warning); }
.env-badge.env-stage { background: var(--hixel-info-bg);    color: var(--hixel-info); }
.env-badge.env-prod  { background: var(--hixel-success-bg); color: var(--hixel-success); }

/* Tab bar */
.tab-bar a { text-decoration: none; font-weight: 500; }

/* Badge extensions — kind = info teal, purpose = yellow accent */
.badge-kind { background: var(--hixel-info-bg); color: var(--hixel-info); }
.badge-purpose { background: var(--hixel-warning-bg); color: var(--hixel-warning); }

/* =========================================================================
   Admin shell — sidebar + top bar layout
   ========================================================================= */

body.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

.admin-sidebar {
    background: var(--hixel-surface);
    color: var(--hixel-ink-secondary);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 20px 0;
    overflow-y: auto;
    border-right: 1px solid var(--hixel-border);
}
.admin-sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--hixel-ink);
    font-weight: 600;
    font-size: 1.1rem;
    padding: 0 20px 16px;
    text-decoration: none;
    border-bottom: 1px solid var(--hixel-border);
    margin-bottom: 12px;
}
.admin-sidebar .brand img.brand-monogram { height: 28px; width: auto; flex-shrink: 0; }
.admin-sidebar .brand > span { color: var(--hixel-ink); }
.admin-sidebar .brand > span > span { color: var(--hixel-brand); }

.admin-nav { flex: 1; display: flex; flex-direction: column; }
.admin-nav > ul { list-style: none; margin: 0; padding: 0; flex: 1; }
.admin-nav a { display: block; padding: 10px 20px; color: var(--hixel-ink-secondary); text-decoration: none; font-size: 0.875rem; font-weight: 500; transition: background 0.12s, color 0.12s; border-left: 3px solid transparent; }
.admin-nav a:hover { background: var(--hixel-surface-elevated); color: var(--hixel-ink); }
.admin-nav li.active > a { background: var(--hixel-surface-elevated); color: var(--hixel-ink); border-left-color: var(--hixel-brand); font-weight: 600; }

.admin-nav-section { margin: 6px 0; }
.admin-nav-section-header { padding: 12px 20px 6px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--hixel-ink-muted); font-weight: 500; }
.admin-nav-section > ul { list-style: none; margin: 0; padding: 0; }
.admin-nav-section > ul > li > a { padding-left: 32px; }

.admin-nav-footer { padding: 16px 20px; border-top: 1px solid var(--hixel-border); margin-top: 12px; }
.admin-nav-footer a { padding: 0; border: none; color: var(--hixel-ink-muted); font-size: 0.85rem; }
.admin-nav-footer a:hover { background: transparent; color: var(--hixel-ink); }

.admin-main { display: flex; flex-direction: column; min-height: 100vh; }

.admin-topbar {
    background: var(--hixel-surface);
    border-bottom: 1px solid var(--hixel-border);
    padding: 14px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-content { flex: 1; padding: 32px; max-width: 1200px; width: 100%; }

/* Responsive */
@media (max-width: 960px) {
    body.admin-shell { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; height: auto; }
    .admin-content { padding: 20px; }

    .media-picker__summary {
        flex-direction: column;
        align-items: stretch;
    }

    .media-picker__summary-actions {
        justify-content: flex-start;
    }
}
