/* Vaxon Black — professional dark UI */
:root {
    --bg: #08090c;
    --surface: #0f1117;
    --surface-2: #141820;
    --border: #1e2430;
    --border-light: #2a3140;
    --text: #e2e6ef;
    --text-secondary: #8b93a7;
    --text-tertiary: #5c6478;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-muted: rgba(37, 99, 235, 0.12);
    --danger: #dc6b6b;
    --success: #4ade80;
    --warning: #d4a853;
    --radius: 6px;
    --radius-lg: 8px;
    --font: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, monospace;
    --header-h: 56px;
    --max-w: 1120px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #60a5fa; }
img { max-width: 100%; display: block; }

/* ── Header ── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 32px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
    flex-shrink: 0;
}

.brand img {
    width: 28px;
    height: 28px;
    border-radius: 4px;
}

.brand .black {
    color: var(--text-secondary);
    font-weight: 500;
}

.nav {
    display: flex;
    gap: 0;
    flex: 1;
}

.nav a {
    color: var(--text-secondary);
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius);
    transition: color 0.12s, background 0.12s;
}

.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active {
    color: var(--text);
    background: var(--surface-2);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    white-space: nowrap;
    line-height: 1.4;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    border-color: var(--border-light);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--surface-2);
    border-color: var(--border-light);
    color: var(--text);
}

.btn-danger {
    background: transparent;
    border-color: rgba(220, 107, 107, 0.4);
    color: var(--danger);
}

.btn-danger:hover { background: rgba(220, 107, 107, 0.08); }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-block { width: 100%; }

/* ── Layout ── */
.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 32px 24px 64px;
}

.container-narrow { max-width: 720px; }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.page-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
}

.page-sub {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.card-pad { padding: 20px 24px; }

.section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Forms ── */
label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.input, select.input, textarea.input {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.12s;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
}

.input::placeholder { color: var(--text-tertiary); }
textarea.input { resize: vertical; min-height: 100px; }
select.input option { background: var(--surface); }

.field { margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
}

.checkbox-row input { width: 14px; height: 14px; accent-color: var(--accent); }
.checkbox-row label { margin: 0; font-size: 13px; }

.error-text { color: var(--danger); font-size: 12px; margin-top: 4px; }

/* ── Alerts ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid;
}

.alert-success {
    background: rgba(74, 222, 128, 0.06);
    border-color: rgba(74, 222, 128, 0.25);
    color: var(--success);
}

.alert-error {
    background: rgba(220, 107, 107, 0.06);
    border-color: rgba(220, 107, 107, 0.25);
    color: var(--danger);
}

.alert code {
    user-select: all;
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 12px;
}

/* ── Auth ── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 32px 28px;
}

.auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    text-align: center;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.auth-logo img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
}

.auth-logo h1 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.auth-logo h1 span { color: var(--text-secondary); font-weight: 500; }
.auth-logo p { color: var(--text-secondary); font-size: 13px; }

.auth-links {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-links a { font-weight: 500; }

/* ── Page header (catalog) ── */
.page-header {
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
}

.page-header p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 6px;
    max-width: 540px;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.toolbar .input {
    max-width: 320px;
    flex: 1;
}

/* ── Plugin grid ── */
.plugin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.plugin-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.15s;
    color: var(--text);
}

.plugin-card:hover {
    border-color: var(--border-light);
}

.plugin-thumb {
    height: 140px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.plugin-thumb img { width: 100%; height: 100%; object-fit: cover; }

.plugin-thumb .placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 600;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.plugin-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.plugin-name {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.plugin-tagline {
    color: var(--text-secondary);
    font-size: 13px;
    flex: 1;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.plugin-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid;
    letter-spacing: 0.02em;
}

.badge-blue {
    background: var(--accent-muted);
    border-color: rgba(37, 99, 235, 0.3);
    color: #93c5fd;
}

.badge-gold {
    background: rgba(212, 168, 83, 0.1);
    border-color: rgba(212, 168, 83, 0.35);
    color: var(--warning);
}

.badge-green {
    background: rgba(74, 222, 128, 0.08);
    border-color: rgba(74, 222, 128, 0.25);
    color: var(--success);
}

.badge-gray {
    background: var(--surface-2);
    border-color: var(--border-light);
    color: var(--text-secondary);
}

.badge-red {
    background: rgba(220, 107, 107, 0.08);
    border-color: rgba(220, 107, 107, 0.3);
    color: var(--danger);
}

.badge-setup {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
    color: #c4b5fd;
}

.badge-config {
    background: rgba(45, 212, 191, 0.08);
    border-color: rgba(45, 212, 191, 0.28);
    color: #5eead4;
}

.badge-build {
    background: rgba(251, 146, 60, 0.1);
    border-color: rgba(251, 146, 60, 0.32);
    color: #fdba74;
}

/* ── Type filter tabs ── */
.type-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 18px;
    padding-bottom: 0;
}

.type-tab {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-radius: var(--radius);
    transition: color 0.12s, background 0.12s, border-color 0.12s;
}

.type-tab:hover {
    color: var(--text);
    background: var(--surface-2);
}

.type-tab.active {
    color: var(--text);
    background: var(--surface-2);
    border-color: var(--border-light);
    box-shadow: inset 2px 0 0 var(--accent);
}

.mb-3 { margin-bottom: 18px; }

/* ── Plugin detail ── */
.plugin-hero {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 28px;
    align-items: start;
}

.plugin-hero-img {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface-2);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.plugin-hero-img img { width: 100%; height: 100%; object-fit: cover; }

.plugin-hero-img .placeholder {
    font-size: 40px;
    font-weight: 600;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.desc {
    color: var(--text-secondary);
    font-size: 14px;
    white-space: pre-line;
    line-height: 1.65;
}

.meta-list {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 12px;
}

.meta-list dt {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 2px;
}

.meta-list dd { font-weight: 500; color: var(--text); margin: 0; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }

table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th {
    text-align: left;
    padding: 10px 16px;
    color: var(--text-tertiary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* ── Admin ── */
.admin-layout {
    display: flex;
    min-height: calc(100vh - var(--header-h) - 1px);
}

.sidebar {
    width: 200px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    padding: 16px 0;
    background: var(--surface);
}

.sidebar .group-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin: 20px 16px 6px;
    font-weight: 600;
}

.sidebar .group-label:first-child { margin-top: 0; }

.sidebar a {
    display: block;
    padding: 8px 16px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    border-left: 2px solid transparent;
    transition: color 0.12s, background 0.12s, border-color 0.12s;
}

.sidebar a:hover {
    color: var(--text);
    background: var(--surface-2);
}

.sidebar a.active {
    color: var(--text);
    background: var(--surface-2);
    border-left-color: var(--accent);
}

.admin-content {
    flex: 1;
    padding: 24px 28px 48px;
    min-width: 0;
    background: var(--bg);
}

/* ── Stats ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.stat-card .label {
    color: var(--text-tertiary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card .value {
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.03em;
    margin-top: 4px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.empty-state .empty-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.empty-state .empty-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 6px;
}

/* ── Pagination ── */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 28px;
}

.pagination a, .pagination span {
    padding: 6px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 13px;
    background: var(--surface);
}

.pagination a:hover {
    border-color: var(--border-light);
    color: var(--text);
}

.pagination .disabled { opacity: 0.4; pointer-events: none; }

/* ── Footer ── */
.footer {
    border-top: 1px solid var(--border);
    padding: 20px 24px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 12px;
    background: var(--surface);
}

.footer a { color: var(--text-secondary); }

/* ── VIP notice ── */
.vip-banner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--warning);
    color: var(--text-secondary);
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 20px;
}

.vip-banner a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }

.vip-banner strong { color: var(--text); font-weight: 600; }

/* ── Utils ── */
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 18px; }
.mb-4 { margin-bottom: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.font-bold { font-weight: 600; }
.inline-form { display: inline; }

.back-link {
    font-size: 13px;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 20px;
}

.back-link:hover { color: var(--text); }

@media (max-width: 900px) {
    .plugin-hero { grid-template-columns: 1fr; }
    .plugin-hero-img { max-width: 160px; }
    .admin-layout { flex-direction: column; }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        display: flex;
        flex-wrap: wrap;
        padding: 8px;
    }
    .sidebar .group-label { display: none; }
    .sidebar a {
        border-left: none;
        border-radius: var(--radius);
        padding: 6px 12px;
    }
    .sidebar a.active { border-left: none; background: var(--accent-muted); }
    .admin-content { padding: 20px 16px 40px; }
    .form-grid { grid-template-columns: 1fr; }
    .nav { display: none; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar .input { max-width: none; }
}
