* {
    box-sizing: border-box;
}

:root {
    color-scheme: dark;
    --bg: #080b12;
    --sidebar: #0c111b;
    --panel: #111827;
    --panel-2: #151e2f;
    --panel-3: #0e1624;
    --border: rgba(255,255,255,.08);
    --border-strong: rgba(255,255,255,.13);
    --text: #f7f9fc;
    --muted: #8f9aab;
    --accent: #6d7cff;
    --accent-2: #8d5cff;
    --success: #32d583;
    --warning: #fdb022;
    --danger: #f97066;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 85% -10%, rgba(109,124,255,.16), transparent 32%),
        var(--bg);
    color: var(--text);
}

button, input {
    font: inherit;
}

button, a {
    -webkit-tap-highlight-color: transparent;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    background: rgba(12,17,27,.92);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(18px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 12px 30px rgba(109,124,255,.28);
    font-weight: 900;
}

.brand strong,
.brand span {
    display: block;
}

.brand strong {
    font-size: 15px;
}

.brand span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.nav {
    margin-top: 34px;
    display: grid;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 13px;
    border-radius: 12px;
    color: var(--muted);
    text-decoration: none;
    transition: .2s ease;
}

.nav-item:hover,
.nav-item.active {
    color: white;
    background: rgba(109,124,255,.12);
}

.nav-icon {
    width: 22px;
    text-align: center;
}

.sidebar-card {
    margin-top: auto;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: rgba(255,255,255,.025);
}

.mini-label {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.sidebar-card strong {
    font-size: 13px;
}

.progress-track {
    margin-top: 12px;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255,255,255,.07);
}

.progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.logout-link {
    margin-top: 14px;
    padding: 11px 13px;
    border-radius: 11px;
    color: var(--muted);
    text-align: center;
    text-decoration: none;
    border: 1px solid var(--border);
}

.main-content {
    width: min(1540px, 100%);
    padding: 34px clamp(20px, 4vw, 56px) 64px;
}

.page-header,
.section-head,
.slot-top,
.url-label-row,
.file-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.page-header {
    align-items: flex-start;
    margin-bottom: 28px;
}

.eyebrow {
    color: #9aa5ff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .14em;
}

h1, h2, h3, p {
    margin-top: 0;
}

.page-header h1 {
    margin: 8px 0 8px;
    font-size: clamp(30px, 4vw, 46px);
    letter-spacing: -.04em;
}

.page-header p,
.login-heading p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.65;
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 13px;
    border: 1px solid rgba(50,213,131,.18);
    background: rgba(50,213,131,.08);
    border-radius: 999px;
    color: #a7f3cf;
    font-size: 12px;
    white-space: nowrap;
}

.pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 5px rgba(50,213,131,.10);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 36px;
}

.stat-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.015));
}

.stat-card strong,
.stat-card span {
    display: block;
}

.stat-label {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 12px;
}

.stat-card strong {
    margin-bottom: 7px;
    font-size: 30px;
    letter-spacing: -.03em;
}

.stat-card > span:last-child {
    color: var(--muted);
    font-size: 12px;
}

.section-head {
    align-items: flex-end;
    margin-bottom: 18px;
}

.section-head h2 {
    margin: 7px 0 0;
    font-size: 24px;
}

.support-note {
    color: var(--muted);
    font-size: 12px;
}

.management-panel,
.category-section {
    margin-bottom: 28px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.012)),
        rgba(17,24,39,.64);
}

.management-form {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr) auto;
    gap: 12px;
    align-items: end;
}

.management-form.two-column {
    grid-template-columns: minmax(0, 1fr) auto;
}

.management-form.compact {
    margin: 18px 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255,255,255,.018);
}

.management-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 11px;
}

.management-form .primary-button {
    white-space: nowrap;
}

.category-stack {
    display: grid;
    gap: 26px;
}

.category-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.category-header h2 {
    margin: 7px 0 0;
    font-size: 24px;
}

.empty-category {
    padding: 22px;
    border: 1px dashed var(--border-strong);
    border-radius: 14px;
    color: var(--muted);
    text-align: center;
    background: rgba(255,255,255,.014);
}

.empty-library {
    padding: 34px;
    border: 1px dashed var(--border-strong);
    border-radius: 18px;
    background: rgba(255,255,255,.018);
    text-align: center;
}

.empty-library h2 {
    margin: 8px 0;
}

.empty-library p {
    margin-bottom: 18px;
    color: var(--muted);
}

.secondary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    color: white;
    text-decoration: none;
    background: rgba(255,255,255,.06);
    font-weight: 700;
    font-size: 12px;
}

.admin-slot-list {
    display: grid;
    gap: 10px;
}

.admin-slot-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255,255,255,.018);
}

.admin-slot-row strong {
    display: block;
    margin-top: 4px;
}

.slot-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.slot-card {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.015)),
        var(--panel);
    box-shadow: 0 18px 55px rgba(0,0,0,.16);
}

.slot-number {
    color: #7e8aa0;
    font-size: 10px;
    letter-spacing: .14em;
    font-weight: 800;
}

.slot-top h3 {
    margin: 5px 0 0;
    font-size: 20px;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.status span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.status.active {
    color: #b7f7d5;
    background: rgba(50,213,131,.10);
}

.status.active span {
    background: var(--success);
}

.status.empty {
    color: #ffd98a;
    background: rgba(253,176,34,.10);
}

.status.empty span {
    background: var(--warning);
}

.texture-preview {
    position: relative;
    margin: 16px 0;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid var(--border);
    background:
        linear-gradient(45deg, #151d2a 25%, transparent 25%),
        linear-gradient(-45deg, #151d2a 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #151d2a 75%),
        linear-gradient(-45deg, transparent 75%, #151d2a 75%),
        #0d1420;
    background-size: 26px 26px;
    background-position: 0 0, 0 13px, 13px -13px, -13px 0;
}

.texture-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-overlay {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(4,8,15,.74);
    backdrop-filter: blur(10px);
    color: #c7ced8;
    font-size: 10px;
}

.empty-state {
    height: 100%;
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
    color: var(--muted);
}

.empty-state strong,
.empty-state span {
    display: block;
}

.empty-state strong {
    margin-top: 8px;
    color: #d7deea;
    font-size: 13px;
}

.empty-state span {
    margin-top: 4px;
    font-size: 11px;
}

.upload-symbol {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: white;
    background: rgba(109,124,255,.18);
    border: 1px solid rgba(109,124,255,.25);
}

.url-block label,
.file-drop strong,
.file-drop span {
    display: block;
}

.url-label-row {
    margin-bottom: 8px;
}

.url-label-row label {
    color: var(--muted);
    font-size: 11px;
}

.url-label-row span {
    color: #aeb6c3;
    font-size: 10px;
}

.url-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    min-width: 0;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-radius: 11px;
    outline: none;
    background: var(--panel-3);
    color: #d9e0eb;
}

input:focus {
    border-color: rgba(109,124,255,.62);
    box-shadow: 0 0 0 3px rgba(109,124,255,.10);
}

button {
    border: 0;
    cursor: pointer;
}

.copy-button {
    padding: 0 15px;
    border-radius: 11px;
    background: rgba(255,255,255,.07);
    color: white;
    font-weight: 700;
}

.file-meta {
    margin: 15px 0;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.file-meta > div {
    min-width: 0;
}

.file-meta span,
.file-meta strong {
    display: block;
}

.file-meta span {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 10px;
}

.file-meta strong {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
}

.upload-form {
    display: grid;
    gap: 10px;
}

.file-drop {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px;
    border: 1px dashed var(--border-strong);
    border-radius: 12px;
    background: rgba(255,255,255,.018);
    cursor: pointer;
}

.file-drop input {
    width: 34px;
    color: transparent;
}

.file-drop input::file-selector-button {
    width: 34px;
    height: 34px;
    margin: 0;
    border: 0;
    border-radius: 9px;
    background: rgba(109,124,255,.18);
    color: transparent;
    cursor: pointer;
}

.file-drop strong {
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.file-drop span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.primary-button {
    width: 100%;
    padding: 12px 15px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    font-weight: 800;
    box-shadow: 0 12px 26px rgba(109,124,255,.18);
}

.alert {
    margin-bottom: 18px;
    padding: 13px 15px;
    border-radius: 12px;
    font-size: 13px;
}

.alert.success {
    border: 1px solid rgba(50,213,131,.22);
    background: rgba(50,213,131,.08);
    color: #b7f7d5;
}

.alert.error {
    border: 1px solid rgba(249,112,102,.22);
    background: rgba(249,112,102,.08);
    color: #ffc2bd;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 30;
    transform: translate(-50%, 20px);
    opacity: 0;
    padding: 11px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #151e2f;
    color: white;
    font-size: 12px;
    pointer-events: none;
    transition: .25s ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Login */
.login-page {
    overflow: hidden;
}

.login-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.15fr .85fr;
}

.login-visual {
    display: grid;
    place-items: center;
    padding: 60px;
    background:
        linear-gradient(rgba(8,11,18,.42), rgba(8,11,18,.72)),
        radial-gradient(circle at 30% 30%, rgba(109,124,255,.38), transparent 34%),
        radial-gradient(circle at 70% 65%, rgba(141,92,255,.28), transparent 28%),
        #0d1320;
}

.login-visual-inner {
    width: min(620px, 100%);
}

.login-visual h1 {
    margin: 14px 0 18px;
    font-size: clamp(42px, 6vw, 76px);
    line-height: .98;
    letter-spacing: -.055em;
}

.login-visual p {
    max-width: 590px;
    color: #b0bac8;
    font-size: 16px;
    line-height: 1.7;
}

.feature-list {
    display: grid;
    gap: 13px;
    margin-top: 34px;
    color: #dce3ed;
}

.feature-list span {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    margin-right: 9px;
    border-radius: 50%;
    background: rgba(50,213,131,.12);
    color: #8df0bd;
}

.login-panel {
    display: grid;
    place-items: center;
    padding: 32px;
    background: #0b1018;
}

.login-card {
    width: min(420px, 100%);
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(17,24,39,.86);
    box-shadow: 0 30px 80px rgba(0,0,0,.28);
}

.login-brand {
    margin-bottom: 36px;
}

.login-heading h2 {
    margin-bottom: 8px;
    font-size: 28px;
}

.login-card form {
    margin-top: 24px;
}

.login-card label {
    display: block;
    margin-bottom: 8px;
    color: #bcc5d1;
    font-size: 12px;
}

.login-card .primary-button {
    margin-top: 14px;
}

@media (max-width: 1050px) {
    .slot-grid {
        grid-template-columns: 1fr;
    }

    .management-form {
        grid-template-columns: 1fr;
    }

    .login-layout {
        grid-template-columns: 1fr;
    }

    .login-visual {
        display: none;
    }
}

@media (max-width: 780px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        padding: 16px;
        flex-direction: row;
        align-items: center;
        gap: 14px;
    }

    .nav,
    .sidebar-card {
        display: none;
    }

    .logout-link {
        margin: 0 0 0 auto;
    }

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

    .page-header,
    .section-head {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 520px) {
    .main-content {
        padding: 24px 14px 48px;
    }

    .slot-card {
        padding: 14px;
    }

    .file-meta {
        align-items: flex-start;
        flex-direction: column;
    }

    .header-badge {
        display: none;
    }
}
