:root {
    --bg: #0a0a0f;
    --bg-elevated: #131318;
    --sidebar-bg: #0d0d12;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #e8e9ec;
    --text-muted: #9498a3;
    --accent: #34d399;
    --accent-strong: #10b981;
    --accent-soft: rgba(52, 211, 153, 0.12);
    --danger: #f87171;
    --radius: 10px;
    --sidebar-width: 240px;
}

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

html {
    -webkit-font-smoothing: antialiased;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

h1, h2, h3 {
    margin: 0 0 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; margin-top: 2.25rem; }
h2:first-child { margin-top: 0; }

p {
    margin: 0 0 1rem;
    color: var(--text-muted);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-shell.no-sidebar {
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 2rem 1.25rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2rem;
    padding: 0 0.25rem;
}

.standalone-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1.75rem;
}

.brand-mark {
    color: var(--accent);
    font-size: 1.2rem;
    line-height: 1;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.nav-link {
    display: block;
    padding: 0.65rem 0.9rem;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background: var(--bg-elevated);
    color: var(--text);
    text-decoration: none;
}

.nav-link.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.nav-link.logout {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: center;
    padding: 3.5rem 2rem;
}

.main .content {
    width: 100%;
    max-width: 860px;
}

.main.main-standalone {
    flex: none;
    padding: 0;
}

.content.content-card {
    max-width: 380px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

/* Forms */

form {
    margin: 1.5rem 0;
}

label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 1.1rem;
}

label input,
label select {
    display: block;
    width: 100%;
    margin-top: 0.4rem;
}

input,
select {
    background: var(--bg);
    border: 1px solid var(--border-strong);
    color: var(--text);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    font-family: inherit;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

form br {
    display: none;
}

button {
    background: var(--accent-strong);
    color: #04120b;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
}

button:hover {
    background: var(--accent);
}

button:active {
    transform: translateY(1px);
}

button.btn-danger {
    background: var(--danger);
    color: #2a0b0b;
}

button.btn-danger:hover {
    background: #fca5a5;
}

/* Tables */

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0 1.5rem;
    font-size: 0.9rem;
}

th, td {
    text-align: left;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

tr:hover td {
    background: var(--bg-elevated);
}

/* Flash messages */

.flashes {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.flashes li {
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-left: 3px solid var(--accent);
    color: var(--text);
    padding: 0.7rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

/* Responsive */

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

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 1rem;
    }

    .nav-links {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .nav-link.logout {
        margin-top: 0;
        border-top: none;
        padding-top: 0.65rem;
    }

    .main {
        padding: 1.5rem 1rem;
    }
}
