:root {
    color-scheme: dark;
    --bg: #0b0b0c;
    --surface: #111214;
    --surface-2: #15171a;
    --text: #f3f4f6;
    --muted: #a3a7ae;
    --border: #272a30;
    --border-strong: #353942;
    --primary: #f5f5f5;
    --primary-text: #121212;
    --danger: #ef4444;
    --danger-text: #ffffff;
    --focus: #c4c8ce;
    --ring: rgba(196, 200, 206, 0.32);
    --success-bg: rgba(134, 239, 172, 0.12);
    --success-border: rgba(134, 239, 172, 0.35);
    --error-bg: rgba(248, 113, 113, 0.12);
    --error-border: rgba(248, 113, 113, 0.35);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
}

html[data-theme="light"] {
    color-scheme: light;
    --bg: #f5f5f5;
    --surface: #ffffff;
    --surface-2: #fafafa;
    --text: #16181d;
    --muted: #616874;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --primary: #171717;
    --primary-text: #ffffff;
    --danger: #dc2626;
    --danger-text: #ffffff;
    --focus: #3f3f46;
    --ring: rgba(63, 63, 70, 0.2);
    --success-bg: rgba(34, 197, 94, 0.12);
    --success-border: rgba(34, 197, 94, 0.35);
    --error-bg: rgba(220, 38, 38, 0.1);
    --error-border: rgba(220, 38, 38, 0.3);
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: "Geist", "Inter", "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(8px);
}

.topbar-inner {
    width: min(1120px, 100% - 2rem);
    margin: 0 auto;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.6rem 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    font-weight: 700;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
}

.brand-copy {
    display: grid;
    line-height: 1.1;
}

.brand-title {
    font-weight: 650;
    font-size: 1rem;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 0.77rem;
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    align-items: center;
}

.container {
    width: min(1120px, 100% - 2rem);
    margin: 1rem auto 2.5rem;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
    margin-bottom: 0.9rem;
    box-shadow: var(--shadow);
}

.hero-panel {
    background: var(--surface);
}

.panel-header {
    margin-bottom: 0.9rem;
}

.panel-header h1,
.panel-header h2 {
    margin: 0;
    letter-spacing: -0.015em;
}

.panel-header h1 {
    font-size: clamp(1.3rem, 2vw, 1.75rem);
}

.panel-header h2 {
    font-size: clamp(1.05rem, 1.6vw, 1.2rem);
}

.panel-header p {
    margin: 0.35rem 0 0;
}

.panel-header-split {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.9rem;
}

.panel-login {
    max-width: 420px;
    margin: 5rem auto;
}

.stack-form {
    display: grid;
    gap: 0.8rem;
}

label {
    display: grid;
    gap: 0.35rem;
    font-size: 0.92rem;
    color: var(--muted);
}

input[type="text"],
input[type="password"] {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 10px;
    color: var(--text);
    padding: 0.62rem 0.72rem;
    font-size: 0.95rem;
}

input[type="text"]:focus,
input[type="password"]:focus,
button:focus-visible,
a.button:focus-visible {
    outline: 0;
    border-color: var(--focus);
    box-shadow: 0 0 0 4px var(--ring);
}

.button {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
    height: 36px;
    padding: 0 0.82rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.button:hover {
    border-color: var(--border-strong);
}

.button-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-text);
    font-weight: 610;
}

.button-muted {
    background: var(--surface-2);
}

.button-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: var(--danger-text);
    font-weight: 610;
}

.button-ghost {
    background: transparent;
}

.inline-form {
    display: inline-flex;
}

.theme-toggle {
    min-width: 90px;
}

.theme-indicator {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #e5e7eb;
}

html[data-theme="light"] .theme-indicator {
    background: #3f3f46;
}

.user-chip {
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 999px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    padding: 0 0.7rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.flash {
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 0.72rem 0.8rem;
    margin-bottom: 0.9rem;
    background: var(--surface);
}

.flash-success {
    background: var(--success-bg);
    border-color: var(--success-border);
}

.flash-error {
    background: var(--error-bg);
    border-color: var(--error-border);
}

.stat-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 0.5rem;
}

.stat-label {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}

.plugin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
}

.plugin-card {
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 12px;
    padding: 0.82rem;
    display: grid;
    gap: 0.55rem;
}

.plugin-card h2 {
    margin: 0;
    line-height: 1.25;
    font-size: 1.02rem;
}

.plugin-card h2 a:hover {
    text-decoration: underline;
}

.plugin-card-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.plugin-card-meta strong {
    color: var(--text);
}

.card-link {
    width: 100%;
}

.drop-upload {
    position: relative;
    border: 1px dashed var(--border-strong);
    border-radius: 12px;
    padding: 1.2rem 1rem;
    text-align: center;
    background: var(--surface-2);
    transition: border-color 0.15s ease;
    cursor: pointer;
}

.drop-upload.dragover {
    border-color: var(--focus);
}

.drop-title {
    display: block;
    font-weight: 600;
    font-size: 1rem;
}

.drop-subtitle {
    display: block;
    margin-top: 0.26rem;
    color: var(--muted);
    font-size: 0.86rem;
}

.drop-upload input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.overview-grid,
.metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.7rem;
}

.overview-item,
.metadata-card {
    padding: 0;
    border: 0;
    background: transparent;
}

.overview-item h3,
.metadata-card h3 {
    margin: 0 0 0.4rem;
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.overview-item p {
    margin: 0;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    border-radius: 10px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 680px;
}

.compact-table {
    min-width: 0;
}

.table th,
.table td {
    border-bottom: 1px solid var(--border);
    padding: 0.58rem;
    vertical-align: top;
    text-align: left;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table th {
    color: var(--muted);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 540;
}

.compact-table th {
    width: 38%;
}

.tag {
    display: inline-flex;
    align-items: center;
    margin-left: 0.4rem;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text);
    border-radius: 999px;
    padding: 0.12rem 0.42rem;
    font-size: 0.68rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.info-box {
    border-radius: 10px;
    background: var(--surface-2);
    padding: 0.72rem;
    margin: 0.72rem 0 0.9rem;
}

code,
pre {
    font-family: "JetBrains Mono", "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

pre {
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #0d0d0f;
    color: #f3f4f6;
    padding: 0.8rem;
    overflow: auto;
    font-size: 0.82rem;
    line-height: 1.5;
}

html[data-theme="light"] pre {
    background: #f8fafc;
    color: #111827;
}

.muted {
    color: var(--muted);
}

.slug {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
    font-family: "JetBrains Mono", "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

.empty-state {
    border: 1px dashed var(--border-strong);
    border-radius: 12px;
    padding: 1rem 0.9rem;
    text-align: center;
    display: grid;
    gap: 0.75rem;
    justify-items: center;
}

@media (max-width: 960px) {
    .topbar-inner,
    .container {
        width: min(1120px, 100% - 1.4rem);
    }

    .panel-header-split {
        flex-direction: column;
    }
}

@media (max-width: 720px) {
    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .brand-subtitle {
        display: none;
    }

    .plugin-grid {
        grid-template-columns: 1fr;
    }

    .table {
        min-width: 600px;
    }
}

@media (max-width: 560px) {
    .topbar-actions .button,
    .topbar-actions .inline-form,
    .topbar-actions .user-chip {
        width: 100%;
    }

    .topbar-actions .user-chip {
        justify-content: center;
    }

    .panel-header .action-row,
    .stack-form .action-row {
        width: 100%;
    }

    .panel-header .action-row > .button,
    .panel-header .action-row > form,
    .stack-form .action-row > .button,
    .stack-form .action-row > form {
        width: 100%;
    }

    .panel-header .action-row > form .button,
    .stack-form .action-row > form .button {
        width: 100%;
    }

    .table {
        min-width: 520px;
    }
}
