:root {
    --bg: #0f1419;
    --surface: #1a2332;
    --surface-2: #243044;
    --border: #2f3f56;
    --text: #e8edf4;
    --muted: #8b9cb3;
    --accent: #e85d4c;
    --accent-hover: #f07062;
    --success: #3ecf8e;
    --error: #ff6b6b;
    --radius: 12px;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(ellipse 120% 80% at 50% -20%, #2a1f28 0%, var(--bg) 55%);
    color: var(--text);
    line-height: 1.5;
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 2rem;
}

.auth-card, .panel, .stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-card {
    width: min(420px, 100%);
    padding: 2rem;
}

.brand, .brand-inline {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.brand h1, .hero h1 {
    margin: 0 0 0.25rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.brand p, .panel-desc, .muted {
    color: var(--muted);
    margin: 0;
    font-size: 0.9rem;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #c43d2f);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
}

.brand-mark.sm {
    width: 36px;
    height: 36px;
    font-size: 0.7rem;
}

.topbar {
    border-bottom: 1px solid var(--border);
    background: rgba(15, 20, 25, 0.85);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-inner, .page {
    width: min(1100px, calc(100% - 2rem));
    margin: 0 auto;
}

.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    gap: 1rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page { padding: 2rem 0 3rem; }

.hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    padding: 1rem 1.25rem;
    min-width: 160px;
    text-align: center;
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    margin-top: 0.25rem;
}

.grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 1.25rem;
    align-items: start;
}

.panel { padding: 1.25rem; }
.panel-wide { grid-column: span 1; }

.panel h2 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}

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

.search-row {
    display: flex;
    gap: 0.5rem;
}

.form label {
    display: block;
    margin-bottom: 1rem;
}

.form label span {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.form label em {
    font-style: normal;
    color: var(--accent);
}

input, select, textarea {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(232, 93, 76, 0.45);
    border-color: var(--accent);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    width: 100%;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

.btn-ghost:hover { background: var(--surface-2); }
.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-error {
    background: rgba(255, 107, 107, 0.12);
    border: 1px solid rgba(255, 107, 107, 0.35);
    color: #ffb4b4;
}

.result {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.result.success {
    background: rgba(62, 207, 142, 0.12);
    border: 1px solid rgba(62, 207, 142, 0.35);
    color: #9ef0c8;
}

.result.error {
    background: rgba(255, 107, 107, 0.12);
    border: 1px solid rgba(255, 107, 107, 0.35);
    color: #ffb4b4;
}

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

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

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

.data-table th {
    background: var(--surface-2);
    color: var(--muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table .loading, .data-table .empty {
    text-align: center;
    color: var(--muted);
    padding: 2rem;
}

.pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

@media (max-width: 900px) {
    .grid { grid-template-columns: 1fr; }
    .hero { flex-direction: column; }
}
