@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Karla:wght@400;500;600&display=swap');

:root {
    --bg: #050a30;
    --accent: #5bb5a5;
    --accent-strong: #4aa394;
    --accent-soft: rgba(91, 181, 165, 0.22);
    --text: #ffffff;
    --muted: rgba(255, 255, 255, 0.78);
    --surface: rgba(255, 255, 255, 0.12);
    --surface-strong: rgba(255, 255, 255, 0.18);
    --border: rgba(255, 255, 255, 0.18);
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    --glow: 0 0 30px rgba(91, 181, 165, 0.25);
}

body[data-theme="light"] {
    --bg: #f2f5f8;
    --text: #0f172a;
    --muted: rgba(15, 23, 42, 0.7);
    --surface: #ffffff;
    --surface-strong: #f8fafc;
    --border: rgba(15, 23, 42, 0.12);
    --shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
    --glow: 0 0 24px rgba(91, 181, 165, 0.2);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Space Grotesk", "Karla", "Segoe UI", sans-serif;
    color: var(--text);
    font-size: 16px;
    background: radial-gradient(1200px 600px at 20% -10%, rgba(255, 255, 255, 0.06), transparent 60%),
        radial-gradient(900px 700px at 80% 10%, rgba(255, 255, 255, 0.04), transparent 60%),
        var(--bg);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.04), transparent 60%);
    pointer-events: none;
    z-index: 0;
}

body[data-theme="light"]::before {
    background: linear-gradient(120deg, rgba(15, 23, 42, 0.04), transparent 60%);
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 36px;
    background: linear-gradient(135deg, var(--surface-strong), var(--surface));
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.brand {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.logo {
    width: 38px;
    height: 32px;
    color: var(--accent);
    flex-shrink: 0;
}

.logo-large {
    width: 72px;
    height: 60px;
}

.user-meta {
    font-size: 13px;
    color: var(--text);
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.shell {
    display: flex;
    flex: 1;
    padding: 32px 36px 60px;
    gap: 24px;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    align-items: flex-start;
}

.nav {
    min-width: 180px;
    flex: 0 0 180px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: sticky;
    top: 24px;
    align-self: flex-start;
}

.nav-link {
    padding: 12px 16px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    animation: rise 0.5s ease both;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.nav-link::before {
    content: '';
    width: 10px;
    display: inline-block;
}

.nav-link:hover {
    background: var(--surface-strong);
    transform: translateX(2px);
}

.nav-link.active {
    background: var(--surface-strong);
    border-color: var(--accent);
    font-weight: 700;
}

.nav-link.active::before {
    content: '>';
}

.main {
    flex: 1;
    background: var(--surface-strong);
    border-radius: 24px;
    padding: 28px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    backdrop-filter: blur(16px);
    animation: rise 0.6s ease both;
    min-width: 0;
}

.auth .shell {
    justify-content: center;
}

.auth .main {
    max-width: 520px;
    width: 100%;
}

.auth h1 {
    display: none;
}

.login-card {
    border-color: rgba(91, 181, 165, 0.5);
    box-shadow: var(--glow);
}

h1 {
    margin-top: 0;
    font-size: 32px;
    letter-spacing: 0.5px;
}

h2 {
    margin: 28px 0 12px;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: var(--text);
    padding-left: 10px;
    border-left: 3px solid var(--accent);
}

p {
    line-height: 1.6;
    color: var(--text);
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    background: var(--surface);
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--border);
    animation: rise 0.6s ease both;
}

.table th,
.table td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    color: var(--text);
}

.table th {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 12px;
    background: var(--surface-strong);
}

.table tbody tr {
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    background: var(--accent-soft);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 18px;
    margin-top: 14px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    animation: rise 0.6s ease both;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.form-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.stat-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-top: 6px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-card h3 {
    margin: 8px 0 0;
    font-size: 34px;
    letter-spacing: 0.5px;
}

strong {
    font-weight: 600;
}

label {
    font-size: 13px;
    color: var(--muted);
    display: block;
    margin-bottom: 6px;
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    font-size: 15px;
    background: var(--surface-strong);
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select option {
    background: var(--bg);
    color: var(--text);
}

input::placeholder,
textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91, 181, 165, 0.25);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, rgba(91, 181, 165, 0.85), rgba(91, 181, 165, 0.65));
    border: 1px solid rgba(91, 181, 165, 0.7);
    box-shadow: var(--glow);
    color: #ffffff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, rgba(91, 181, 165, 0.95), rgba(91, 181, 165, 0.75));
}

body[data-theme="light"] .btn-primary {
    background: linear-gradient(135deg, #5bb5a5, #4aa394);
    border-color: #4aa394;
}

.btn-secondary {
    background: var(--surface);
    border: 1px solid var(--border);
}

.btn-warning {
    background: #f0b429;
    color: var(--text);
}

.btn-danger {
    background: #e63946;
    color: var(--text);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.inline-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.section-actions {
    margin-top: 14px;
}

.mini-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.mini-form select {
    min-width: 120px;
}

.mini-form input {
    min-width: 120px;
}

.mini-form .btn {
    padding: 8px 12px;
    font-size: 12px;
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--muted);
}

.flash {
    padding: 12px 16px;
    border-radius: 16px;
    margin-bottom: 12px;
    font-size: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    animation: flash-in 0.4s ease both;
}

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

.flash.error {
    border-color: rgba(230, 57, 70, 0.6);
    background: rgba(230, 57, 70, 0.15);
}

@keyframes flash-in {
    0% {
        opacity: 0;
        transform: translateY(-8px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--text);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid rgba(91, 181, 165, 0.4);
}

.thread {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.thread-item {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px;
    background: var(--surface);
}

.thread-meta {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}

.cookie-banner {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 900px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
    animation: slide-up 0.6s ease both;
    z-index: 9999;
}

.cookie-banner.is-hidden {
    display: none;
}

.cookie-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    color: var(--text);
    flex: 1;
}

.cookie-content strong {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.theme-toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 9998;
}

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

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slide-up {
    0% {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes slide-down {
    0% {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
}

@media (max-width: 900px) {
    .shell {
        flex-direction: column;
    }

    .nav {
        flex-direction: row;
        flex-wrap: wrap;
        position: static;
    }

    .nav-link {
        transform: none;
    }
}

@media (max-width: 720px) {
    .cookie-banner {
        flex-direction: column;
        align-items: flex-start;
    }

    .theme-toggle {
        bottom: 90px;
        right: 16px;
    }
}

@media (max-width: 600px) {
    .header,
    .shell {
        padding: 18px;
    }

    .main {
        padding: 20px;
    }
}
