:root {
    --bg: #f3f3f4;
    --surface: #ffffff;
    --text: #141414;
    --muted: #6b7280;
    --primary: #e30613;
    --primary-dark: #b8050f;
    --primary-light: #fff1f2;
    --accent: #0a0a0a;
    --accent-soft: #1a1a1a;
    --danger: #c1121f;
    --border: #e4e4e7;
    --shadow: 0 10px 30px rgba(10, 10, 10, 0.08);
    --shadow-strong: 0 16px 40px rgba(10, 10, 10, 0.14);
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a {
    color: var(--primary);
    transition: color 0.15s ease;
}

a:hover {
    color: var(--primary-dark);
}

h1, h2, h3 {
    line-height: 1.2;
}

h1 {
    font-weight: 800;
    letter-spacing: -0.02em;
}

.container {
    width: min(1100px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.5rem 0 3rem;
}

.container-wide {
    width: min(1440px, calc(100% - 2rem));
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--text);
}

.brand-logo {
    display: block;
    height: 2.75rem;
    width: auto;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

.admin-sidebar {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-soft) 100%);
    border-right: none;
    box-shadow: var(--shadow-strong);
    padding: 1.25rem 1rem;
    color: #f5f5f5;
}

.admin-sidebar .brand {
    padding: 0 0.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1rem;
    color: #ffffff;
}

.admin-sidebar .brand-logo {
    height: 3rem;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.admin-nav-icon {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.admin-nav a:hover {
    background: rgba(227, 6, 19, 0.18);
    color: #ffffff;
}

.admin-sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-user {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    padding: 0 0.5rem;
}

.admin-sidebar-footer button {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.admin-sidebar-footer button:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.admin-mobile-header {
    display: none;
}

.admin-backdrop {
    display: none;
}

.admin-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-content {
    width: min(1100px, calc(100% - 3rem));
    margin: 0 auto;
    padding: 1.5rem 0 3rem;
    flex: 1;
}

.site-header {
    background: var(--accent);
    border-bottom: 3px solid var(--primary);
    box-shadow: var(--shadow-strong);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.85rem 0;
}

.site-header .brand {
    margin-right: auto;
    color: #ffffff;
}

.site-header .brand-logo {
    height: 3rem;
}

.nav {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.nav a {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.5rem 0.85rem;
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav a:hover {
    background: rgba(227, 6, 19, 0.22);
    color: #ffffff;
}

.user-panel {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-panel button,
button,
.button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 0.65rem 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-weight: 600;
    transition: background 0.15s ease, transform 0.1s ease;
}

button:hover,
.button:hover {
    background: var(--primary-dark);
}

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

.button.secondary {
    background: var(--accent-soft);
}

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

button.danger,
.button.danger {
    background: var(--danger);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-top: 1rem;
}

.card h2 {
    margin-top: 0;
    color: var(--accent);
}

.card.narrow {
    max-width: 560px;
    margin-inline: auto;
    border-top: 4px solid var(--primary);
}

.registration-card {
    width: 100%;
    padding: 2rem;
}

.registration-form {
    gap: 1.75rem;
}

.registration-form .form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem 1.5rem;
}

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

.form-section {
    border: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1rem;
}

.form-section legend {
    font-size: 1.05rem;
    font-weight: 700;
    padding: 0;
    margin-bottom: 0.25rem;
    color: var(--text);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 1.25rem;
}

.form-field {
    display: grid;
    gap: 0.35rem;
    min-width: 0;
}

.form-field label {
    font-weight: 600;
}

.form-field-span-2 {
    grid-column: span 2;
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.form-hint {
    margin: -0.35rem 0 0.5rem;
    font-size: 0.9rem;
}

.form-delete {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

@media (max-width: 1100px) {
    .registration-form .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .registration-form .form-grid {
        grid-template-columns: 1fr;
    }
}

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

.form {
    display: grid;
    gap: 0.75rem;
}

.form label {
    font-weight: 600;
}

.form input,
.form select,
.form textarea {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form input:focus,
.form select:focus,
.form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.15);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

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

.table th {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    background: #fafafa;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wide {
    min-width: 1600px;
    font-size: 0.9rem;
}

.table-wide th,
.table-wide td {
    white-space: nowrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border-top: 3px solid var(--primary);
}

.stat-card h2 {
    margin: 0;
    font-size: 2rem;
    color: var(--primary);
}

.details {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 0.75rem 1rem;
}

.muted { color: var(--muted); }

.alert {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
}

.alert.success {
    background: #dcfce7;
    color: #166534;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.85rem;
    background: #e5e7eb;
}

.badge.pending { background: #fef3c7; }
.badge.validated { background: #dcfce7; }
.badge.rejected { background: #fee2e2; }

.actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.auth-page,
.public-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background:
        radial-gradient(circle at top right, rgba(227, 6, 19, 0.12), transparent 45%),
        linear-gradient(160deg, var(--accent) 0%, var(--accent-soft) 55%, #2a2a2a 100%);
}

.auth-page .card,
.public-page .card {
    box-shadow: var(--shadow-strong);
}

.auth-actions {
    margin: 1.25rem 0 0;
    text-align: center;
}

.public-site {
    min-height: 100vh;
    background:
        radial-gradient(circle at 0% 0%, rgba(227, 6, 19, 0.05), transparent 40%),
        var(--bg);
}

.registration-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 1.5rem 0;
    padding: 1.5rem;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-strong);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.registration-banner h2 {
    margin: 0 0 0.35rem;
}

.registration-banner p {
    margin: 0;
    opacity: 0.9;
}

.registration-banner-cta {
    background: white;
    color: var(--primary-dark);
    font-weight: 700;
    white-space: nowrap;
}

.registration-banner-cta:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.news-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.news-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.news-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.news-item h3 {
    margin: 0.35rem 0;
    color: var(--accent);
}

.news-item p {
    margin: 0;
}

.news-date {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
}

.errors {
    color: var(--danger);
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
}

.stats-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1.25rem 0 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.stats-tab {
    padding: 0.55rem 1rem;
    border-radius: 8px 8px 0 0;
    text-decoration: none;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 600;
}

.stats-tab:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.stats-tab.active {
    color: var(--primary);
    background: var(--primary-light);
    border-bottom: 2px solid var(--primary);
}

.stats-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stats-kpi-grid-compact {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.stats-kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.stats-kpi-card header {
    background: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    text-align: center;
}

.stats-kpi-card p {
    margin: 0;
    padding: 1.25rem 0.75rem;
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
}

.stats-warning {
    color: var(--primary);
    font-size: 2rem;
    line-height: 1;
}

.stats-charts-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.stats-chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: var(--shadow);
}

.stats-chart-card h2 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    text-align: center;
}

.stats-chart-wide {
    margin-top: 1rem;
}

.stats-chart-medium {
    max-width: 480px;
    margin: 0 auto;
}

@media (max-width: 900px) {
    .stats-kpi-grid,
    .stats-charts-row,
    .stats-charts-row-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }

    .admin-mobile-header {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.65rem 1rem;
        background: var(--accent);
        border-bottom: 3px solid var(--primary);
        box-shadow: var(--shadow);
        position: sticky;
        top: 0;
        z-index: 20;
    }

    .admin-mobile-brand {
        color: #ffffff;
        font-size: 0.95rem;
    }

    .admin-mobile-brand .brand-logo {
        height: 2rem;
    }

    .admin-nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        height: 2.5rem;
        padding: 0;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 8px;
        color: #ffffff;
        flex-shrink: 0;
    }

    .admin-nav-toggle svg {
        width: 1.25rem;
        height: 1.25rem;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
    }

    .admin-nav-toggle:hover {
        background: rgba(227, 6, 19, 0.35);
    }

    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 40;
        width: min(280px, 88vw);
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        padding-top: 1rem;
    }

    .admin-layout.nav-open .admin-sidebar {
        transform: translateX(0);
    }

    .admin-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 30;
        background: rgba(10, 10, 10, 0.45);
    }

    .admin-backdrop[hidden] {
        display: none;
    }

    .admin-content {
        width: 100%;
        padding: 1rem 1rem 2rem;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header h1,
    .page-header h2 {
        margin: 0;
    }

    .page-header .button {
        width: 100%;
        text-align: center;
    }

    .card {
        padding: 1rem;
    }

    .card .page-header {
        margin-bottom: 0.5rem;
    }

    .actions {
        flex-direction: column;
    }

    .actions .button {
        width: 100%;
        text-align: center;
    }

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

    .form-field-span-2,
    .form-field-span-full {
        grid-column: span 1;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .button,
    .form-actions button {
        width: 100%;
        text-align: center;
    }

    .details {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .details dt,
    .details dd {
        margin: 0;
    }

    .stats-tabs {
        gap: 0.25rem;
    }

    .stats-tab {
        flex: 1 1 auto;
        text-align: center;
        font-size: 0.85rem;
        padding: 0.5rem 0.65rem;
    }

    .stat-card h2 {
        font-size: 1.75rem;
    }

    .table-scroll {
        margin: 0 -0.25rem;
    }

    .table th,
    .table td {
        padding: 0.55rem 0.45rem;
        font-size: 0.9rem;
    }
}
