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

:root {
    --bg: #08111f;
    --panel: rgba(14, 24, 43, 0.88);
    --panel-2: rgba(19, 32, 57, 0.88);
    --border: rgba(163, 188, 255, 0.14);
    --text: #ebf2ff;
    --muted: #9db1d4;
    --primary: #6ea8fe;
    --primary-strong: #4e8dff;
    --success: #2fd47f;
    --warning: #ffb648;
    --info: #6ce0ff;
    --danger: #ff6f8c;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
    --radius: 24px;
}

html {
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(110, 168, 254, 0.18), transparent 30%),
        radial-gradient(circle at right center, rgba(108, 224, 255, 0.12), transparent 28%),
        linear-gradient(180deg, #07111d 0%, #091425 50%, #060d18 100%);
}

body {
    margin: 0;
    color: var(--text);
    font: 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

code {
    padding: 0.15rem 0.45rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    font-family: "SFMono-Regular", Consolas, monospace;
}

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

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    padding: 1.4rem;
    border-right: 1px solid var(--border);
    background: rgba(5, 10, 18, 0.72);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand-card,
.panel,
.stat-card,
.flash,
.notice-card,
.storage-card,
.auth-panel {
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.brand-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
}

.brand-card h1 {
    margin: 0;
    font-size: 1.1rem;
}

.brand-mark {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(110, 168, 254, 0.25), rgba(108, 224, 255, 0.18));
    font-weight: 800;
    letter-spacing: 0.08em;
}

.eyebrow {
    margin: 0 0 0.2rem;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
}

.sidebar-nav {
    display: grid;
    gap: 0.45rem;
}

.sidebar-nav a,
.ghost-link {
    padding: 0.9rem 1rem;
    border-radius: 16px;
    color: var(--muted);
    transition: 0.2s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.is-active,
.ghost-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 0.9rem;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
}

.user-pill strong,
.user-pill span {
    display: block;
}

.user-pill > div span:last-child {
    color: var(--muted);
    font-size: 0.9rem;
}

.avatar {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(110, 168, 254, 0.38), rgba(108, 224, 255, 0.16));
    font-weight: 700;
}

.content {
    padding: 1.5rem;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.3rem;
}

.topbar h2 {
    margin: 0.2rem 0 0;
    font-size: 2rem;
}

.topbar-actions {
    display: flex;
    gap: 0.8rem;
}

.flash-stack {
    display: grid;
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.flash {
    padding: 1rem 1.1rem;
}

.flash-success {
    border-color: rgba(47, 212, 127, 0.28);
}

.flash-error {
    border-color: rgba(255, 111, 140, 0.28);
}

.stats-grid,
.card-grid,
.split-layout,
.auth-layout {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.split-layout {
    grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
}

.auth-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 1080px;
}

.stat-card,
.panel {
    padding: 1.2rem;
}

.stat-card p,
.stat-card span {
    margin: 0;
    color: var(--muted);
}

.stat-card strong {
    display: block;
    margin: 0.45rem 0;
    font-size: 2rem;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-head h3 {
    margin: 0.25rem 0 0;
    font-size: 1.22rem;
}

.text-link {
    color: var(--primary);
    font-weight: 600;
}

.text-link.danger {
    color: var(--danger);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.button {
    appearance: none;
    border: 0;
    border-radius: 16px;
    padding: 0.9rem 1.15rem;
    font: inherit;
    cursor: pointer;
    transition: transform 0.12s ease, opacity 0.2s ease, background 0.2s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #06101d;
    font-weight: 700;
}

.button-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.form-grid,
.filter-bar {
    display: grid;
    gap: 1rem;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid label,
.filter-bar select {
    display: grid;
    gap: 0.5rem;
}

.form-grid label span {
    color: var(--muted);
    font-weight: 600;
}

.form-grid .full {
    grid-column: 1 / -1;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(163, 188, 255, 0.16);
    background: rgba(3, 7, 16, 0.42);
    color: var(--text);
    border-radius: 16px;
    padding: 0.95rem 1rem;
    font: inherit;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(110, 168, 254, 0.55);
    box-shadow: 0 0 0 4px rgba(110, 168, 254, 0.12);
}

.switch {
    display: flex !important;
    align-items: center;
    gap: 0.7rem;
}

.switch input {
    width: auto;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.storage-list,
.timeline,
.user-list {
    display: grid;
    gap: 0.85rem;
}

.storage-row,
.storage-card,
.timeline-item,
.user-list-item {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.035);
}

.storage-row {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
    gap: 1rem;
}

.storage-meta span,
.storage-card p,
.timeline-item small,
.user-list-item p,
.notice-card p {
    color: var(--muted);
    margin: 0.2rem 0 0;
}

.storage-progress {
    display: grid;
    gap: 0.45rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted);
}

.progress-track {
    position: relative;
    overflow: hidden;
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
}

.progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--info));
}

.table-wrap {
    overflow: auto;
    border-radius: 18px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(163, 188, 255, 0.1);
}

thead {
    background: rgba(255, 255, 255, 0.05);
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    width: fit-content;
}

.badge-success {
    background: rgba(47, 212, 127, 0.15);
    color: #93ffbf;
}

.badge-warning {
    background: rgba(255, 182, 72, 0.15);
    color: #ffd38e;
}

.badge-info {
    background: rgba(108, 224, 255, 0.14);
    color: #a6efff;
}

.badge-muted {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
}

.timeline-item {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 1rem;
    align-items: flex-start;
}

.notice-card,
.auth-panel {
    padding: 1.1rem;
}

.check-list {
    display: grid;
    gap: 0.65rem;
    margin-top: 1rem;
    color: var(--muted);
}

.table-actions,
.card-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.card-actions form,
.table-actions form {
    margin: 0;
}

.filter-bar {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 1rem;
}

@media (max-width: 1200px) {
    .stats-grid,
    .card-grid,
    .auth-layout {
        grid-template-columns: 1fr 1fr;
    }

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

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

    .sidebar {
        position: relative;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .stats-grid,
    .card-grid,
    .auth-layout,
    .filter-bar,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .storage-row,
    .timeline-item {
        grid-template-columns: 1fr;
    }

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