body {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f6f8fb;
    color: #1f2937;
}

.admin-surface {
    --admin-bg: #f6f8fb;
    --admin-panel: #ffffff;
    --admin-panel-soft: #f8fafc;
    --admin-border: #e5e7eb;
    --admin-border-strong: #d7dde8;
    --admin-text: #1f2937;
    --admin-muted: #667085;
    --admin-soft: #98a2b3;
    --admin-primary: #111827;
    --admin-primary-hover: #020617;
    --admin-accent: #4f46e5;
    --admin-accent-soft: #eef2ff;
    --admin-success: #047857;
    --admin-success-soft: #ecfdf3;
    --admin-warning: #b45309;
    --admin-warning-soft: #fffbeb;
    --admin-danger: #b42318;
    --admin-danger-soft: #fff1f2;
    --admin-info: #0369a1;
    --admin-info-soft: #eff6ff;
    --admin-sidebar-width: 232px;
    --admin-content-max-width: 1320px;
    color-scheme: light;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--admin-bg) !important;
    color: var(--admin-text);
}

.admin-surface > aside {
    width: var(--admin-sidebar-width) !important;
    flex: 0 0 var(--admin-sidebar-width);
    background: var(--admin-panel) !important;
    border-right: 1px solid var(--admin-border) !important;
}

.admin-surface > aside > .p-5 {
    padding: 16px !important;
}

.admin-surface > aside nav {
    padding-left: 12px !important;
    padding-right: 12px !important;
}

.admin-surface > aside .nav-item {
    padding: 11px 14px !important;
}

.admin-surface > aside .cfg-sub-item {
    padding: 8px 10px !important;
}

.admin-surface > aside .border-t {
    padding: 14px 18px !important;
}

[data-theme="dark"] body.admin-surface,
[data-theme="dark"] .admin-surface {
    --admin-bg: #101114;
    --admin-panel: #181b21;
    --admin-panel-soft: #20242d;
    --admin-control: #222731;
    --admin-border: #2b313d;
    --admin-border-strong: #3a4251;
    --admin-text: #eef2f7;
    --admin-muted: #a8b3c2;
    --admin-soft: #7d8796;
    --admin-primary: #6366f1;
    --admin-primary-hover: #4f46e5;
    --admin-accent: #a5b4fc;
    --admin-accent-soft: rgba(99, 102, 241, .16);
    --admin-success: #6ee7b7;
    --admin-success-soft: rgba(16, 185, 129, .14);
    --admin-warning: #fbbf24;
    --admin-warning-soft: rgba(245, 158, 11, .14);
    --admin-danger: #fda4af;
    --admin-danger-soft: rgba(244, 63, 94, .14);
    --admin-info: #7dd3fc;
    --admin-info-soft: rgba(14, 165, 233, .14);
    color-scheme: dark;
    background: var(--admin-bg) !important;
    color: var(--admin-text) !important;
}

[data-theme="dark"] body.admin-surface main {
    background: var(--admin-bg) !important;
}

[data-theme="dark"] body.admin-surface aside,
[data-theme="dark"] body.admin-surface header,
[data-theme="dark"] body.admin-surface .card,
[data-theme="dark"] body.admin-surface .bg-white {
    background-color: var(--admin-panel) !important;
    border-color: var(--admin-border) !important;
}

[data-theme="dark"] body.admin-surface .bg-slate-50,
[data-theme="dark"] body.admin-surface .bg-slate-100 {
    background-color: var(--admin-panel-soft) !important;
}

[data-theme="dark"] body.admin-surface .bg-white\/60,
[data-theme="dark"] body.admin-surface .bg-white\/70 {
    background-color: rgba(24, 27, 33, .86) !important;
}

[data-theme="dark"] body.admin-surface .bg-slate-50\/60,
[data-theme="dark"] body.admin-surface .hover\:bg-slate-50:hover,
[data-theme="dark"] body.admin-surface .hover\:bg-slate-50\/60:hover,
[data-theme="dark"] body.admin-surface .hover\:bg-slate-100:hover,
[data-theme="dark"] body.admin-surface .hover\:bg-slate-200:hover {
    background-color: var(--admin-panel-soft) !important;
}

[data-theme="dark"] body.admin-surface .bg-indigo-50,
[data-theme="dark"] body.admin-surface .bg-indigo-50\/40,
[data-theme="dark"] body.admin-surface .hover\:bg-indigo-50:hover,
[data-theme="dark"] body.admin-surface .hover\:bg-indigo-100:hover {
    background-color: rgba(99, 102, 241, .16) !important;
}

[data-theme="dark"] body.admin-surface .bg-violet-50,
[data-theme="dark"] body.admin-surface .hover\:bg-violet-50\/40:hover,
[data-theme="dark"] body.admin-surface .hover\:bg-violet-100:hover {
    background-color: rgba(139, 92, 246, .16) !important;
}

[data-theme="dark"] body.admin-surface .bg-blue-50,
[data-theme="dark"] body.admin-surface .bg-cyan-50,
[data-theme="dark"] body.admin-surface .hover\:bg-sky-50:hover {
    background-color: rgba(14, 165, 233, .16) !important;
}

[data-theme="dark"] body.admin-surface .bg-emerald-50,
[data-theme="dark"] body.admin-surface .hover\:bg-emerald-50:hover {
    background-color: var(--admin-success-soft) !important;
}

[data-theme="dark"] body.admin-surface .bg-amber-50,
[data-theme="dark"] body.admin-surface .bg-amber-50\/60,
[data-theme="dark"] body.admin-surface .bg-orange-50,
[data-theme="dark"] body.admin-surface .hover\:bg-amber-50:hover {
    background-color: var(--admin-warning-soft) !important;
}

[data-theme="dark"] body.admin-surface .bg-red-50,
[data-theme="dark"] body.admin-surface .hover\:bg-red-50:hover,
[data-theme="dark"] body.admin-surface .hover\:bg-red-100:hover {
    background-color: var(--admin-danger-soft) !important;
}

[data-theme="dark"] body.admin-surface .bg-slate-900\/30 {
    background-color: rgba(2, 6, 23, .70) !important;
}

[data-theme="dark"] body.admin-surface .border-slate-50,
[data-theme="dark"] body.admin-surface .border-slate-100,
[data-theme="dark"] body.admin-surface .border-slate-200 {
    border-color: var(--admin-border) !important;
}

[data-theme="dark"] body.admin-surface .border-indigo-100,
[data-theme="dark"] body.admin-surface .border-indigo-200,
[data-theme="dark"] body.admin-surface .hover\:border-indigo-100:hover,
[data-theme="dark"] body.admin-surface .hover\:border-indigo-200:hover {
    border-color: rgba(129, 140, 248, .30) !important;
}

[data-theme="dark"] body.admin-surface .border-violet-100 {
    border-color: rgba(167, 139, 250, .30) !important;
}

[data-theme="dark"] body.admin-surface .border-emerald-100 {
    border-color: rgba(52, 211, 153, .28) !important;
}

[data-theme="dark"] body.admin-surface .border-amber-100,
[data-theme="dark"] body.admin-surface .border-orange-100 {
    border-color: rgba(251, 191, 36, .30) !important;
}

[data-theme="dark"] body.admin-surface .border-red-100 {
    border-color: rgba(251, 113, 133, .30) !important;
}

[data-theme="dark"] body.admin-surface .border-white {
    border-color: var(--admin-panel) !important;
}

[data-theme="dark"] body.admin-surface .divide-slate-50 > :not([hidden]) ~ :not([hidden]),
[data-theme="dark"] body.admin-surface .divide-slate-100 > :not([hidden]) ~ :not([hidden]) {
    border-color: var(--admin-border) !important;
}

[data-theme="dark"] body.admin-surface .text-slate-900,
[data-theme="dark"] body.admin-surface .text-slate-800,
[data-theme="dark"] body.admin-surface .text-slate-700,
[data-theme="dark"] body.admin-surface .text-slate-600 {
    color: var(--admin-text) !important;
}

[data-theme="dark"] body.admin-surface .text-slate-500 {
    color: var(--admin-muted) !important;
}

[data-theme="dark"] body.admin-surface .text-slate-400,
[data-theme="dark"] body.admin-surface .text-slate-300 {
    color: var(--admin-soft) !important;
}

[data-theme="dark"] body.admin-surface .text-indigo-700,
[data-theme="dark"] body.admin-surface .text-indigo-600,
[data-theme="dark"] body.admin-surface .text-indigo-500,
[data-theme="dark"] body.admin-surface .hover\:text-indigo-600:hover,
[data-theme="dark"] body.admin-surface .hover\:text-indigo-700:hover {
    color: var(--admin-accent) !important;
}

[data-theme="dark"] body.admin-surface .text-purple-700,
[data-theme="dark"] body.admin-surface .text-purple-600,
[data-theme="dark"] body.admin-surface .text-purple-500,
[data-theme="dark"] body.admin-surface .text-violet-600 {
    color: #c4b5fd !important;
}

[data-theme="dark"] body.admin-surface .text-blue-500,
[data-theme="dark"] body.admin-surface .text-cyan-600,
[data-theme="dark"] body.admin-surface .text-cyan-700 {
    color: var(--admin-info) !important;
}

[data-theme="dark"] body.admin-surface .text-emerald-700,
[data-theme="dark"] body.admin-surface .text-emerald-600,
[data-theme="dark"] body.admin-surface .text-emerald-500 {
    color: var(--admin-success) !important;
}

[data-theme="dark"] body.admin-surface .text-amber-700,
[data-theme="dark"] body.admin-surface .text-amber-600,
[data-theme="dark"] body.admin-surface .text-amber-500,
[data-theme="dark"] body.admin-surface .text-orange-500 {
    color: var(--admin-warning) !important;
}

[data-theme="dark"] body.admin-surface .text-red-600,
[data-theme="dark"] body.admin-surface .text-red-500,
[data-theme="dark"] body.admin-surface .text-red-400,
[data-theme="dark"] body.admin-surface .text-rose-400 {
    color: var(--admin-danger) !important;
}

.admin-surface main {
    background: var(--admin-bg) !important;
    width: calc(100vw - var(--admin-sidebar-width));
    min-width: 0;
    overflow-x: hidden;
    padding: 0 24px 28px !important;
}

.admin-surface main > header,
.admin-surface main > [data-section] {
    width: min(100%, var(--admin-content-max-width));
    margin-left: 0;
    margin-right: auto;
}

.admin-surface main > [data-section],
.admin-surface main > [data-section] .card,
.admin-surface main > [data-section] .grid {
    min-width: 0;
}

.admin-surface [data-section="dashboard"] > .grid {
    gap: 16px !important;
}

.admin-surface [data-section="dashboard"] > .grid.grid-cols-5 {
    grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)) !important;
}

.admin-surface [data-section="dashboard"] > .grid.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.admin-surface [data-section="dashboard"] > .grid.grid-cols-3 {
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr) !important;
}

.admin-surface [data-section="dashboard"] > .grid.grid-cols-3 > .col-span-2 {
    grid-column: auto !important;
}

.admin-surface [data-section="dashboard"] .card {
    overflow: hidden;
}

.admin-surface header {
    min-height: 64px;
    border: 1px solid var(--admin-border) !important;
    border-radius: 8px !important;
    box-shadow: none !important;
}

.admin-surface .rounded-xl,
.admin-surface .rounded-2xl {
    border-radius: 8px !important;
}

.admin-surface .shadow-lg,
.admin-surface .shadow-xl,
.admin-surface .shadow-2xl,
.admin-surface .shadow-sm {
    box-shadow: none !important;
}

.admin-surface .card {
    background: var(--admin-panel) !important;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .035);
}

.admin-surface .card:hover {
    border-color: var(--admin-border-strong);
}

.admin-surface .nav-item,
.admin-surface .cfg-sub-item {
    border-radius: 8px !important;
    color: var(--admin-muted);
}

.admin-surface .nav-item:hover,
.admin-surface .cfg-sub-item:hover {
    background: var(--admin-panel-soft);
    color: var(--admin-primary) !important;
}

.admin-surface .sidebar-active {
    background: var(--admin-accent-soft) !important;
    border-right: 0 !important;
    box-shadow: inset 3px 0 0 var(--admin-accent) !important;
    color: var(--admin-accent) !important;
}

.admin-surface #config-submenu,
.admin-surface #ai-config-submenu {
    border-left-color: var(--admin-border) !important;
    margin-top: 4px;
    padding-top: 4px;
    padding-bottom: 4px;
}

.admin-surface #admin-logo-wrap {
    border-radius: 8px !important;
}

#admin-logo-wrap.admin-logo-image-loaded {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
}

#admin-logo-wrap.admin-logo-image-loaded img {
    display: block;
}

.admin-surface input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
.admin-surface select,
.admin-surface textarea {
    min-height: 36px;
    background: var(--admin-control, var(--admin-panel)) !important;
    border: 1px solid var(--admin-border) !important;
    border-radius: 8px !important;
    color: var(--admin-text) !important;
    box-shadow: none !important;
}

[data-theme="dark"] body.admin-surface header a[href="/app.html#dialogue"] {
    background: var(--admin-accent-soft) !important;
    color: var(--admin-accent) !important;
}

.admin-surface input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):focus,
.admin-surface select:focus,
.admin-surface textarea:focus {
    border-color: var(--admin-accent) !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .10) !important;
}

.admin-surface input::placeholder,
.admin-surface textarea::placeholder {
    color: var(--admin-soft) !important;
}

.admin-surface button {
    border-radius: 8px !important;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

.admin-surface .admin-text-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px;
    background: transparent;
    border: 0;
    line-height: 1.2;
    color: var(--admin-accent) !important;
}

.admin-surface .admin-text-action:hover {
    background: var(--admin-accent-soft);
}

.admin-surface button:active {
    transform: translateY(1px);
}

.admin-surface button.bg-indigo-600,
.admin-surface button.bg-slate-900,
.admin-surface button.bg-gradient-to-r,
.admin-surface button[type="submit"]:not(.btn-cancel) {
    background: var(--admin-primary) !important;
    color: #fff !important;
    box-shadow: none !important;
}

[data-theme="dark"] .admin-surface button.bg-indigo-600,
[data-theme="dark"] .admin-surface button.bg-slate-900,
[data-theme="dark"] .admin-surface button.bg-gradient-to-r,
[data-theme="dark"] .admin-surface button[type="submit"]:not(.btn-cancel) {
    color: #fff !important;
}

.admin-surface button.bg-indigo-600:hover,
.admin-surface button.bg-slate-900:hover,
.admin-surface button.bg-gradient-to-r:hover,
.admin-surface button[type="submit"]:not(.btn-cancel):hover {
    background: var(--admin-primary-hover) !important;
    opacity: 1 !important;
}

.admin-surface button.bg-white,
.admin-surface button.bg-slate-50,
.admin-surface .admin-pager-button {
    background: var(--admin-panel) !important;
    border: 1px solid var(--admin-border) !important;
    color: var(--admin-muted) !important;
}

.admin-surface button.bg-white:hover,
.admin-surface button.bg-slate-50:hover,
.admin-surface .admin-pager-button:hover:not(:disabled) {
    background: var(--admin-panel-soft) !important;
    color: var(--admin-text) !important;
}

.admin-surface button:disabled {
    opacity: .45 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

.admin-surface .admin-section-head {
    background: var(--admin-panel);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 18px !important;
}

.admin-surface .admin-filterbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: var(--admin-panel-soft);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    padding: 8px;
}

.admin-surface .admin-section-head > .admin-filterbar {
    margin-left: auto;
}

.admin-surface .admin-filterbar > div {
    min-width: 150px;
    flex: 1 1 150px;
}

.admin-surface .admin-filterbar > .flex.items-end {
    min-width: 110px;
    flex: 0 0 110px;
}

.admin-surface .admin-filterbar > input,
.admin-surface .admin-filterbar > select {
    width: auto;
    min-width: 140px;
}

.admin-surface .admin-table-card {
    overflow: auto !important;
}

.admin-surface .admin-table {
    min-width: 880px;
    border-collapse: separate;
    border-spacing: 0;
}

.admin-surface .admin-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--admin-panel-soft) !important;
    color: var(--admin-muted) !important;
    font-size: 11px !important;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
}

.admin-surface .admin-table tbody td {
    border-top: 1px solid var(--admin-border);
    color: var(--admin-muted);
    vertical-align: middle;
}

.admin-surface .admin-table tbody tr:first-child td {
    border-top: 0;
}

.admin-surface .admin-table tbody tr:hover {
    background: var(--admin-panel-soft) !important;
}

.admin-surface .admin-table tbody td button {
    min-height: 26px;
    padding: 4px 8px;
    border: 1px solid transparent;
    background: transparent;
}

.admin-surface .admin-table tbody td button:hover {
    background: var(--admin-panel);
    border-color: var(--admin-border);
}

.admin-surface .admin-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: 999px !important;
    border: 1px solid transparent;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.admin-surface .admin-badge-success,
.admin-surface span.bg-emerald-100.text-emerald-600 {
    background: var(--admin-success-soft) !important;
    border-color: rgba(4, 120, 87, .18);
    color: var(--admin-success) !important;
}

.admin-surface .admin-badge-warning,
.admin-surface span.bg-amber-100.text-amber-600,
.admin-surface span.bg-orange-100.text-orange-500 {
    background: var(--admin-warning-soft) !important;
    border-color: rgba(180, 83, 9, .18);
    color: var(--admin-warning) !important;
}

.admin-surface .admin-badge-danger,
.admin-surface span.bg-red-100.text-red-500,
.admin-surface span.bg-red-100.text-red-600 {
    background: var(--admin-danger-soft) !important;
    border-color: rgba(180, 35, 24, .16);
    color: var(--admin-danger) !important;
}

.admin-surface .admin-badge-info,
.admin-surface span.bg-indigo-100.text-indigo-600,
.admin-surface span.bg-blue-100.text-blue-500,
.admin-surface span.bg-cyan-100.text-cyan-600 {
    background: var(--admin-info-soft) !important;
    border-color: rgba(3, 105, 161, .16);
    color: var(--admin-info) !important;
}

.admin-surface .admin-badge-muted,
.admin-surface span.bg-slate-100.text-slate-400,
.admin-surface span.bg-slate-100.text-slate-500,
.admin-surface span.bg-slate-200.text-slate-500 {
    background: var(--admin-panel-soft) !important;
    border-color: var(--admin-border);
    color: var(--admin-muted) !important;
}

.admin-surface .modal-overlay {
    background: rgba(15, 23, 42, .38) !important;
    backdrop-filter: blur(6px);
}

.admin-surface .modal-overlay > div,
.admin-surface .confirm-dialog .box {
    background: var(--admin-panel) !important;
    border: 1px solid var(--admin-border);
    border-radius: 10px !important;
    box-shadow: 0 22px 70px rgba(15, 23, 42, .16) !important;
}

.admin-surface .confirm-dialog .btns button {
    border-radius: 8px !important;
}

.admin-surface .confirm-dialog .btns .btn-cancel {
    background: var(--admin-panel-soft) !important;
    color: var(--admin-muted) !important;
}

.admin-surface .confirm-dialog .btns .btn-ok {
    background: var(--admin-primary) !important;
    color: #fff !important;
    box-shadow: none !important;
}

[data-theme="dark"] .admin-surface .confirm-dialog .btns .btn-ok {
    color: #fff !important;
}

.admin-surface .confirm-dialog .btns .btn-ok.danger {
    background: var(--admin-danger) !important;
    color: #fff !important;
}

.admin-image-preview-button {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    border-radius: 8px;
    color: var(--admin-soft);
    background: transparent;
    transition: background-color .16s ease, color .16s ease, transform .16s ease;
}

.admin-image-preview-button:hover {
    color: var(--admin-accent);
    background: var(--admin-accent-soft);
    transform: translateY(-1px);
}

.admin-image-preview-dialog {
    width: min(920px, calc(100vw - 40px));
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

@media (max-width: 1280px) {
    .admin-surface {
        --admin-sidebar-width: 216px;
    }

    .admin-surface main {
        padding: 0 18px 22px !important;
    }

    .admin-surface #admin-logo-wrap {
        width: 156px !important;
        height: 52px !important;
    }

    .admin-surface [data-section="dashboard"] > .grid.grid-cols-3,
    .admin-surface [data-section="dashboard"] > .grid.grid-cols-2 {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}

@media (max-width: 980px) {
    .admin-surface {
        --admin-sidebar-width: 196px;
    }

    .admin-surface > aside .nav-item {
        gap: 10px !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .admin-surface main > header {
        flex-wrap: wrap;
        gap: 12px;
    }
}

.admin-image-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--admin-border);
}

.admin-image-preview-header h3 {
    margin: 0;
    color: var(--admin-text);
    font-size: 15px;
    font-weight: 850;
    line-height: 22px;
}

.admin-image-preview-header p {
    margin: 4px 0 0;
    color: var(--admin-soft);
    font-size: 11px;
    line-height: 16px;
}

.admin-image-preview-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.admin-image-preview-download,
.admin-image-preview-close {
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 8px;
    border: 1px solid var(--admin-border);
    background: var(--admin-panel-soft);
    color: var(--admin-muted);
    font-size: 12px;
    font-weight: 750;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

.admin-image-preview-download {
    padding: 0 12px;
}

.admin-image-preview-close {
    width: 34px;
}

.admin-image-preview-download:hover,
.admin-image-preview-close:hover {
    color: var(--admin-text);
    border-color: var(--admin-border-strong);
    transform: translateY(-1px);
}

.admin-image-preview-stage {
    min-height: 360px;
    max-height: min(64vh, 680px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: var(--admin-panel-soft);
    overflow: hidden;
}

.admin-image-preview-stage img {
    max-width: 100%;
    max-height: min(58vh, 620px);
    display: block;
    border-radius: 10px;
    object-fit: contain;
    box-shadow: 0 18px 50px rgba(15, 23, 42, .18);
}

.admin-image-preview-thumbs {
    display: flex;
    gap: 8px;
    padding: 12px 20px 0;
    overflow-x: auto;
}

.admin-image-preview-thumb {
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    padding: 2px;
    border-radius: 10px;
    border: 2px solid transparent;
    background: var(--admin-panel-soft);
    overflow: hidden;
    opacity: .72;
    transition: border-color .16s ease, opacity .16s ease, transform .16s ease;
}

.admin-image-preview-thumb:hover,
.admin-image-preview-thumb.is-active {
    opacity: 1;
    border-color: var(--admin-accent);
    transform: translateY(-1px);
}

.admin-image-preview-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 7px;
    object-fit: cover;
}

.admin-image-preview-caption {
    padding: 14px 20px 20px;
}

.admin-image-preview-caption-label {
    margin-bottom: 6px;
    color: var(--admin-soft);
    font-size: 10px;
    font-weight: 850;
}

.admin-image-preview-caption p {
    max-height: 96px;
    margin: 0;
    overflow: auto;
    color: var(--admin-muted);
    font-size: 12px;
    line-height: 20px;
    white-space: pre-wrap;
}

[data-theme="dark"] .admin-image-preview-stage img {
    box-shadow: 0 18px 50px rgba(0, 0, 0, .32);
}

.admin-model-rank-dialog {
    width: min(760px, calc(100vw - 40px));
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.admin-model-rank-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 20px 20px;
    overflow: auto;
}

.admin-model-rank-row {
    display: grid;
    grid-template-columns: 28px 36px minmax(0, 1fr) 76px 56px;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 10px 12px;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    background: var(--admin-panel-soft);
}

.admin-model-rank-place {
    font-size: 12px;
    font-weight: 850;
}

.admin-model-rank-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 8px;
    overflow: hidden;
    font-size: 11px;
    font-weight: 850;
}

.admin-model-rank-main {
    min-width: 0;
}

.admin-model-rank-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
    color: var(--admin-text);
    font-size: 12px;
    font-weight: 750;
}

.admin-model-rank-title span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-model-rank-title strong {
    flex: 0 0 auto;
    color: var(--admin-muted);
    font-size: 11px;
    font-weight: 850;
}

.admin-model-rank-points {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    color: var(--admin-text);
}

.admin-model-rank-points strong {
    font-size: 12px;
    font-weight: 850;
}

.admin-model-rank-points span,
.admin-model-rank-share {
    color: var(--admin-soft);
    font-size: 10px;
    font-weight: 750;
}

.admin-model-rank-share {
    text-align: right;
}

@media (max-width: 720px) {
    .admin-model-rank-row {
        grid-template-columns: 24px 34px minmax(0, 1fr);
    }

    .admin-model-rank-points,
    .admin-model-rank-share {
        display: none;
    }
}

.admin-surface .admin-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    max-width: 360px;
    border-radius: 8px;
    border: 1px solid var(--admin-border);
    background: var(--admin-panel);
    color: var(--admin-text);
    box-shadow: 0 16px 48px rgba(15, 23, 42, .14);
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 700;
}

.admin-surface .admin-toast-success {
    border-color: rgba(4, 120, 87, .20);
    color: var(--admin-success);
}

/* AI provider hierarchy: provider card -> connection config -> categorized models. */
.admin-surface .ai-provider-page-card {
    padding: 18px !important;
}

.admin-surface .ai-provider-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.admin-surface .ai-provider-item {
    --provider-accent: #4f46e5;
    --provider-accent-soft: #f5f7ff;
    overflow: hidden;
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    background: var(--admin-panel);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .045);
}

.admin-surface .ai-provider-card-head {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--admin-border);
    background: var(--admin-panel);
}

.admin-surface .ai-provider-identity,
.admin-surface .ai-provider-model-identity,
.admin-surface .ai-provider-title-row,
.admin-surface .ai-provider-summary,
.admin-surface .ai-provider-card-actions,
.admin-surface .ai-provider-enable,
.admin-surface .ai-provider-model-badges,
.admin-surface .ai-provider-counts,
.admin-surface .ai-provider-model-preview {
    display: flex;
    align-items: center;
}

.admin-surface .ai-provider-identity {
    min-width: 0;
    gap: 11px;
}

.admin-surface .ai-provider-icon-preview {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    background: var(--admin-panel-soft);
    color: var(--provider-accent);
    font-size: 10px;
    font-weight: 900;
    box-shadow: none;
}

.admin-surface .ai-provider-icon-preview img,
.admin-surface .ai-provider-model-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.admin-surface .ai-provider-title-block,
.admin-surface .ai-provider-model-title {
    min-width: 0;
}

.admin-surface .ai-provider-order {
    display: block;
    margin-bottom: 2px;
    color: var(--admin-soft);
    font-size: 9px;
    line-height: 12px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.admin-surface .ai-provider-title-row {
    min-width: 0;
    gap: 8px;
}

.admin-surface .ai-provider-display-name {
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--admin-text);
    font-size: 14px;
    line-height: 19px;
    font-weight: 850;
}

.admin-surface .ai-provider-state {
    height: 18px;
    display: inline-flex;
    align-items: center;
    padding: 0 6px;
    border-radius: 5px;
    font-size: 9px;
    line-height: 1;
    font-weight: 850;
    white-space: nowrap;
}

.admin-surface .ai-provider-state.is-on {
    background: transparent;
    color: var(--admin-success);
}

.admin-surface .ai-provider-state.is-off {
    background: transparent;
    color: var(--admin-danger);
}

.admin-surface .ai-provider-summary {
    gap: 7px;
    margin-top: 3px;
    color: var(--admin-soft);
    font-size: 10px;
    line-height: 14px;
    font-weight: 700;
}

.admin-surface .ai-provider-summary span + span::before {
    content: '·';
    margin-right: 7px;
    color: var(--admin-border-strong);
}

.admin-surface .ai-provider-summary b {
    color: var(--admin-muted);
    font-weight: 900;
}

.admin-surface .ai-provider-card-actions {
    flex: 0 0 auto;
    gap: 10px;
}

.admin-surface .ai-provider-enable {
    gap: 6px;
    color: var(--admin-muted);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.admin-surface .ai-provider-remove {
    height: 28px;
    padding: 0 9px;
    border: 1px solid rgba(180, 35, 24, .14);
    border-radius: 8px;
    background: transparent;
    color: var(--admin-danger);
    font-size: 10px;
    font-weight: 850;
}

.admin-surface .ai-provider-remove:hover {
    background: var(--admin-danger-soft);
}

.admin-surface .ai-provider-config-block {
    padding: 12px 16px 14px;
    background: var(--admin-panel);
}

.admin-surface .ai-provider-section-heading {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
}

.admin-surface .ai-provider-section-heading span,
.admin-surface .ai-provider-model-section-title > div:first-child > span {
    color: var(--admin-text);
    font-size: 11px;
    line-height: 16px;
    font-weight: 900;
}

.admin-surface .ai-provider-section-heading small,
.admin-surface .ai-provider-model-section-title > div:first-child > small {
    color: var(--admin-soft);
    font-size: 10px;
    line-height: 14px;
    font-weight: 650;
}

.admin-surface .ai-provider-config-grid label,
.admin-surface .ai-provider-model > div > label {
    color: var(--admin-muted) !important;
    font-weight: 800 !important;
}

.admin-surface .ai-provider-config-grid input,
.admin-surface .ai-provider-config-grid select,
.admin-surface .ai-provider-model input[type="text"],
.admin-surface .ai-provider-model input[type="number"],
.admin-surface .ai-provider-model select {
    border-color: var(--admin-border) !important;
    border-radius: 8px !important;
}

.admin-surface .ai-provider-model-section {
    padding: 11px 16px 14px;
    border-top: 1px solid var(--admin-border);
    background: var(--admin-panel-soft);
}

.admin-surface .ai-provider-model-section-head {
    min-height: 34px;
    gap: 16px;
}

.admin-surface .ai-provider-model-section-title {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.admin-surface .ai-provider-model-section-title > div:first-child {
    display: flex;
    flex-direction: column;
}

.admin-surface .ai-provider-counts {
    gap: 0;
    flex-wrap: wrap;
}

.admin-surface .ai-provider-counts span {
    height: 18px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    border: 0;
    border-right: 1px solid var(--admin-border);
    border-radius: 0;
    background: transparent;
    color: var(--admin-soft);
    font-size: 9px;
    font-weight: 800;
}

.admin-surface .ai-provider-counts span:first-child {
    padding-left: 0;
}

.admin-surface .ai-provider-counts span:last-child {
    padding-right: 0;
    border-right: 0;
}

.admin-surface .ai-provider-counts b {
    color: var(--admin-muted);
    font-size: 10px;
    font-weight: 950;
}

.admin-surface .ai-provider-toggle,
.admin-surface .ai-provider-discover-models,
.admin-surface .ai-provider-add-model {
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 850;
    white-space: nowrap;
    transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.admin-surface .ai-provider-toggle {
    border: 1px solid var(--admin-border-strong);
    background: var(--admin-panel);
    color: var(--admin-muted);
}

.admin-surface .ai-provider-discover-models {
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #4338ca;
}

.admin-surface .ai-provider-discover-models:hover {
    border-color: #a5b4fc;
    background: #e0e7ff;
}

.admin-surface .ai-provider-discover-models:disabled {
    cursor: wait;
    opacity: .65;
}

.admin-surface .ai-provider-toggle:hover {
    border-color: var(--provider-accent);
    color: var(--provider-accent);
}

.admin-surface .ai-provider-toggle svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    transition: transform .16s ease;
}

.admin-surface .ai-provider-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.admin-surface .ai-provider-add-model {
    border: 1px solid transparent;
    background: var(--admin-primary);
    color: #fff;
}

.admin-surface .ai-provider-add-model:hover {
    background: var(--admin-primary-hover);
}

.admin-surface .ai-provider-model-preview {
    min-height: 31px;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 9px;
}

.admin-surface .ai-provider-model-preview.hidden {
    display: none !important;
}

.admin-surface .ai-provider-model-chip {
    min-width: 0;
    height: 29px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 9px;
    border: 1px solid var(--admin-border);
    border-left-width: 3px;
    border-radius: 8px;
    background: var(--admin-panel);
    color: var(--admin-text);
}

.admin-surface .ai-provider-model-chip.is-dialogue {
    border-left-color: #4f46e5;
}

.admin-surface .ai-provider-model-chip.is-image {
    border-left-color: #db2777;
}

.admin-surface .ai-provider-model-chip.is-mixed {
    border-left-color: #7c3aed;
}

.admin-surface .ai-provider-model-chip.is-unassigned {
    border-left-color: #94a3b8;
}

.admin-surface .ai-provider-model-chip.is-disabled {
    opacity: .48;
}

.admin-surface .ai-provider-model-chip strong {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    font-weight: 850;
}

.admin-surface .ai-provider-model-chip small {
    color: var(--admin-soft);
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}

.admin-surface .ai-provider-model-more,
.admin-surface .ai-provider-model-empty {
    color: var(--admin-soft);
    font-size: 10px;
    font-weight: 800;
}

.admin-surface .ai-provider-model-more {
    height: 27px;
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--admin-panel);
}

.admin-surface .ai-provider-models {
    margin-top: 10px;
}

.admin-surface .ai-provider-model {
    position: relative;
    grid-template-columns: minmax(170px, 1fr) minmax(190px, 1.1fr) 132px 145px 82px !important;
    gap: 10px !important;
    overflow: hidden;
    padding: 0 12px 10px !important;
    border-color: var(--admin-border) !important;
    border-radius: 10px !important;
    background: var(--admin-panel) !important;
    box-shadow: none;
}

.admin-surface .ai-provider-model.is-disabled {
    opacity: .68;
}

.admin-surface .ai-provider-model-head,
.admin-surface .ai-provider-model-controls,
.admin-surface .ai-provider-model-capabilities {
    grid-column: 1 / -1 !important;
}

.admin-surface .ai-provider-model-head {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 -12px 1px;
    padding: 7px 12px;
    border-bottom: 1px solid var(--admin-border);
    background: #f8fafc;
}

.admin-surface .ai-provider-model-identity {
    min-width: 0;
    gap: 8px;
}

.admin-surface .ai-provider-model-number {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 22px;
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    background: var(--admin-panel);
    color: var(--admin-muted);
    font-size: 9px;
    font-weight: 900;
}

.admin-surface .ai-provider-model-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    overflow: hidden;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    background: var(--admin-panel);
    color: var(--provider-accent);
    font-size: 8px;
    font-weight: 900;
}

.admin-surface .ai-provider-model-title {
    display: flex;
    flex-direction: column;
}

.admin-surface .ai-provider-model-title strong,
.admin-surface .ai-provider-model-title small {
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-surface .ai-provider-model-title strong {
    color: var(--admin-text);
    font-size: 11px;
    line-height: 15px;
    font-weight: 900;
}

.admin-surface .ai-provider-model-title small {
    margin-top: 1px;
    color: var(--admin-soft);
    font-size: 9px;
    line-height: 12px;
    font-weight: 650;
}

.admin-surface .ai-provider-model-badges {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 4px;
}

.admin-surface .ai-provider-badge {
    height: 20px;
    display: inline-flex;
    align-items: center;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 9px;
    line-height: 1;
    font-weight: 850;
    white-space: nowrap;
}

.admin-surface .ai-provider-badge-protocol {
    border: 1px solid var(--admin-border-strong);
    background: var(--admin-panel);
    color: var(--admin-muted);
}

.admin-surface .ai-provider-badge-dialogue {
    background: #eef2ff;
    color: #4338ca;
}

.admin-surface .ai-provider-badge-image {
    background: #fdf2f8;
    color: #be185d;
}

.admin-surface .ai-provider-badge-unassigned {
    background: #f1f5f9;
    color: #64748b;
}

.admin-surface .ai-provider-badge-disabled {
    background: var(--admin-danger-soft);
    color: var(--admin-danger);
}

.admin-surface .ai-provider-model-controls {
    min-height: 34px;
    display: grid !important;
    grid-template-columns: minmax(120px, .7fr) minmax(250px, 1.35fr) minmax(220px, 1.15fr) auto;
    gap: 14px !important;
    align-self: stretch;
    align-items: center;
    margin-top: 1px;
    padding: 8px 0 0 !important;
    border-top: 1px solid var(--admin-border);
}

.admin-surface .ai-provider-control-group {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.admin-surface .ai-provider-control-group > span {
    flex: 0 0 auto;
    padding-right: 12px;
    border-right: 1px solid var(--admin-border);
    color: var(--admin-soft);
    font-size: 9px;
    font-weight: 850;
}

.admin-surface .ai-provider-control-group label {
    color: var(--admin-muted);
    font-weight: 750;
}

.admin-surface .ai-provider-model-controls [data-remove-provider-model] {
    justify-self: end;
    padding: 3px 6px;
}

.admin-surface .ai-provider-model-capabilities {
    display: grid !important;
    grid-template-columns: 72px repeat(7, minmax(62px, 1fr));
    align-items: center;
    gap: 10px !important;
    margin-top: 0;
    border-top-color: var(--admin-border) !important;
}

.admin-surface .ai-provider-model-capabilities > span {
    padding-right: 12px;
    border-right: 1px solid var(--admin-border);
}

.admin-surface .ai-provider-page-card > button[type="submit"] {
    display: block;
    min-width: 92px;
    margin-left: auto;
}

[data-theme="dark"] .admin-surface .ai-provider-item {
    --provider-accent-soft: rgba(99, 102, 241, .09);
    box-shadow: none;
}

[data-theme="dark"] .admin-surface .ai-provider-icon-preview {
    border-color: var(--admin-border);
    background: var(--admin-control);
    box-shadow: none;
}

[data-theme="dark"] .admin-surface .ai-provider-badge-dialogue {
    background: rgba(99, 102, 241, .18);
    color: #c7d2fe;
}

[data-theme="dark"] .admin-surface .ai-provider-badge-image {
    background: rgba(219, 39, 119, .16);
    color: #f9a8d4;
}

[data-theme="dark"] .admin-surface .ai-provider-badge-unassigned {
    background: rgba(148, 163, 184, .12);
    color: #94a3b8;
}

[data-theme="dark"] .admin-surface .ai-provider-discover-models {
    border-color: rgba(129, 140, 248, .32);
    background: rgba(99, 102, 241, .14);
    color: #c7d2fe;
}

[data-theme="dark"] .admin-surface .ai-provider-model-head {
    background: rgba(148, 163, 184, .055);
}

/* Provider model discovery picker. */
.ai-model-discovery-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, .38);
    backdrop-filter: blur(4px);
}

.ai-model-discovery-dialog {
    width: min(720px, 100%);
    max-height: min(720px, calc(100vh - 40px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--admin-border);
    border-radius: 14px;
    background: var(--admin-panel);
    color: var(--admin-text);
    box-shadow: 0 24px 64px rgba(15, 23, 42, .2);
}

.ai-model-discovery-head,
.ai-model-discovery-toolbar,
.ai-model-discovery-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
}

.ai-model-discovery-head {
    border-bottom: 1px solid var(--admin-border);
}

.ai-model-discovery-head strong,
.ai-model-discovery-head small {
    display: block;
}

.ai-model-discovery-head strong {
    font-size: 14px;
    font-weight: 900;
}

.ai-model-discovery-head small {
    margin-top: 3px;
    color: var(--admin-soft);
    font-size: 10px;
}

.ai-model-discovery-head > button {
    width: 30px;
    height: 30px;
    color: var(--admin-soft);
    font-size: 21px;
    line-height: 1;
}

.ai-model-discovery-toolbar {
    padding-top: 12px;
    padding-bottom: 10px;
    background: var(--admin-panel-soft);
}

.ai-model-discovery-toolbar label {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    background: var(--admin-panel);
}

.ai-model-discovery-toolbar svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: var(--admin-soft);
    stroke-width: 1.6;
}

.ai-model-discovery-toolbar input {
    width: 100%;
    height: 34px;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 11px;
    outline: none;
}

.ai-model-discovery-toolbar > button {
    height: 34px;
    padding: 0 11px;
    border: 1px solid var(--admin-border);
    background: var(--admin-panel);
    color: var(--admin-muted);
    font-size: 10px;
    font-weight: 800;
}

.ai-model-discovery-list {
    min-height: 180px;
    overflow-y: auto;
    padding: 6px 16px 12px;
}

.ai-model-discovery-item {
    min-height: 48px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-bottom: 1px solid var(--admin-border);
    cursor: pointer;
}

.ai-model-discovery-item:hover {
    background: var(--admin-panel-soft);
}

.ai-model-discovery-item.is-added {
    cursor: default;
    opacity: .55;
}

.ai-model-discovery-item strong,
.ai-model-discovery-item small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-model-discovery-item strong {
    font-size: 11px;
    font-weight: 850;
}

.ai-model-discovery-item small {
    margin-top: 2px;
    color: var(--admin-soft);
    font-size: 9px;
}

.ai-model-discovery-meta,
.ai-model-discovery-item em {
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--admin-panel-soft);
    color: var(--admin-muted);
    font-size: 9px;
    font-style: normal;
    font-weight: 800;
}

.ai-model-discovery-item em {
    color: var(--admin-success);
}

.ai-model-discovery-empty {
    padding: 70px 10px;
    color: var(--admin-soft);
    font-size: 11px;
    text-align: center;
}

.ai-model-discovery-foot {
    border-top: 1px solid var(--admin-border);
    background: var(--admin-panel-soft);
}

.ai-model-discovery-foot > span {
    color: var(--admin-muted);
    font-size: 10px;
    font-weight: 750;
}

.ai-model-discovery-foot > div {
    display: flex;
    gap: 8px;
}

.ai-model-discovery-foot button {
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--admin-border);
    background: var(--admin-panel);
    color: var(--admin-muted);
    font-size: 10px;
    font-weight: 850;
}

.ai-model-discovery-foot [data-confirm-model-discovery] {
    border-color: var(--admin-primary);
    background: var(--admin-primary);
    color: #fff;
}

.ai-model-discovery-foot [data-confirm-model-discovery]:disabled {
    cursor: not-allowed;
    opacity: .45;
}

@media (max-width: 640px) {
    .ai-model-discovery-overlay {
        padding: 10px;
    }

    .ai-model-discovery-toolbar,
    .ai-model-discovery-foot {
        align-items: stretch;
        flex-direction: column;
    }

    .ai-model-discovery-toolbar > button,
    .ai-model-discovery-foot > div,
    .ai-model-discovery-foot button {
        width: 100%;
    }

    .ai-model-discovery-item {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .ai-model-discovery-meta {
        display: none;
    }
}

@media (max-width: 1280px) {
    .admin-surface .ai-provider-config-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .admin-surface .ai-provider-model {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .admin-surface .ai-provider-model-controls,
    .admin-surface .ai-provider-model-head,
    .admin-surface .ai-provider-model-capabilities {
        grid-column: 1 / -1 !important;
    }
}

@media (max-width: 980px) {
    .admin-surface .ai-provider-card-head,
    .admin-surface .ai-provider-model-section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-surface .ai-provider-card-actions,
    .admin-surface .ai-provider-model-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .admin-surface .ai-provider-model-section-title {
        align-items: flex-start;
        flex-direction: column;
        gap: 7px;
    }

    .admin-surface .ai-provider-model-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-surface .ai-provider-model-controls [data-remove-provider-model] {
        justify-self: start;
    }

    .admin-surface .ai-provider-model-capabilities {
        grid-template-columns: 72px repeat(4, minmax(62px, 1fr));
    }
}

@media (max-width: 720px) {
    .admin-surface .ai-provider-page-card {
        padding: 12px !important;
    }

    .admin-surface .ai-provider-config-grid,
    .admin-surface .ai-provider-model {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .admin-surface .ai-provider-config-grid .col-span-2,
    .admin-surface .ai-provider-model-controls,
    .admin-surface .ai-provider-model-head,
    .admin-surface .ai-provider-model-capabilities {
        grid-column: 1 / -1 !important;
    }

    .admin-surface .ai-provider-model-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-surface .ai-provider-model-badges {
        justify-content: flex-start;
    }

    .admin-surface .ai-provider-model-chip small,
    .admin-surface .ai-provider-enable span {
        display: none;
    }

    .admin-surface .ai-provider-model-controls,
    .admin-surface .ai-provider-model-capabilities {
        display: flex !important;
    }

    .admin-surface .ai-provider-control-group {
        width: 100%;
        flex-wrap: wrap;
    }

    .admin-surface .ai-provider-model-controls [data-remove-provider-model] {
        margin-left: 0;
    }
}

.admin-surface .admin-toast-error {
    border-color: rgba(180, 35, 24, .20);
    color: var(--admin-danger);
}

.admin-surface .admin-toast-warn {
    border-color: rgba(180, 83, 9, .20);
    color: var(--admin-warning);
}

.vip-tag {
    background: #fff7ed;
    color: #9a3412;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border: 1px solid #fed7aa;
    border-radius: 999px;
}

.admin-avatar-fallback,
.admin-model-icon {
    background: var(--admin-accent-soft);
    color: var(--admin-accent);
}

.admin-rank-index-0 { color: #b45309; }
.admin-rank-index-1 { color: #0369a1; }
.admin-rank-index-2 { color: #047857; }
.admin-rank-index-3 { color: var(--admin-muted); }
.admin-rank-index-4 { color: var(--admin-soft); }

.admin-model-name {
    max-width: 120px;
}

.admin-muted-count {
    color: var(--admin-soft);
}

.admin-progress-track {
    background: var(--admin-panel-soft);
}

.admin-progress-fill {
    background: var(--admin-accent);
}

.chart-gradient {
    fill: url(#chart-gradient);
}
