@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --maroon: #6E1B2C;
    --maroon-dark: #4A1220;
    --maroon-deep: #3A0E18;
    --cream: #F6E7C1;
    --rose: #F8EEEF;
    --bg: #F4F1F2;
    --ink: #1C1214;
    --muted: #6D6166;
    --line: #E7DDE0;
    --ok: #059669;
    --side: 268px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

button, input, textarea, select { font: inherit; }

a { color: var(--maroon); }

.login-screen {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 32px 24px;
    background:
        radial-gradient(circle at 12% 18%, rgba(110, 27, 44, 0.08), transparent 32%),
        #efe7e9;
}

.login-desk {
    width: min(980px, 100%);
    min-height: 540px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(58, 14, 24, 0.16);
}

.login-brand {
    background: linear-gradient(165deg, var(--maroon-deep) 0%, var(--maroon) 58%, #7A2438 100%);
    color: #fff;
    padding: 48px 52px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-brand img {
    width: 128px;
    height: auto;
    display: block;
}

.login-brand h1 {
    margin: 18px 0 10px;
    font-size: 34px;
    line-height: 1.15;
    letter-spacing: -0.04em;
    max-width: 360px;
}

.login-brand p {
    margin: 0;
    max-width: 440px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 16px;
    line-height: 1.6;
}

.login-kicker {
    margin: 0;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--cream);
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 44px;
    background: #fff;
}

.login-card {
    width: min(360px, 100%);
}

.login-card h2 {
    margin: 0;
    font-size: 28px;
    letter-spacing: -0.03em;
    color: var(--maroon-dark);
}

.login-card .lede {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 28px;
}

.field { display: flex; flex-direction: column; gap: 8px; }

.label {
    font-size: 13px;
    font-weight: 700;
    color: var(--maroon-dark);
}

.control,
.form-control {
    width: 100%;
    min-height: 48px;
    border: 1px solid #E4DADF;
    background: #fff;
    border-radius: 12px;
    padding: 10px 14px;
    color: var(--ink);
    outline: none;
    box-shadow: none;
}

textarea.control,
textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.control:focus,
.form-control:focus {
    border-color: var(--maroon);
    box-shadow: 0 0 0 4px rgba(110, 27, 44, 0.12);
}

.btn,
.btn-primary,
button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 16px;
    border: 0;
    border-radius: 12px;
    background: var(--maroon);
    color: #fff !important;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

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

.btn-ghost,
.btn-danger {
    background: #fff;
    color: var(--maroon-dark) !important;
    border: 1px solid var(--line);
}

.btn-danger { color: #9F1239 !important; border-color: #F1C3CB; }
.btn-danger:hover { background: #FFF1F2; }

.row-delete { margin: 0; }
.row-delete .btn { min-height: 32px; padding: 0 10px; font-size: 12px; white-space: nowrap; }

.btn-block { width: 100%; }

.alert {
    background: #FFF1F2;
    color: #9F1239;
    border: 1px solid #FECDD3;
    border-radius: 12px;
    padding: 12px 14px;
    font-weight: 600;
    margin-bottom: 16px;
}

.login-back {
    display: inline-block;
    margin-top: 18px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.admin-app {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: var(--side) 1fr;
}

.admin-side {
    background: linear-gradient(180deg, var(--maroon-deep), var(--maroon-dark) 40%, var(--maroon));
    color: #fff;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    position: sticky;
    top: 0;
    height: 100dvh;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px;
    text-decoration: none;
    color: #fff;
}

.admin-brand img {
    width: 72px;
    height: auto;
    display: block;
}

.admin-brand strong {
    display: block;
    font-size: 14px;
    letter-spacing: -0.02em;
}

.admin-brand span {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cream);
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    font-weight: 700;
}

.admin-nav a:hover,
.admin-nav a.is-active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.admin-nav svg { flex-shrink: 0; }

.admin-side .logout { margin-top: auto; }

.admin-main { min-width: 0; }

.admin-top {
    height: 72px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 28px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 5;
}

.admin-top h1 {
    margin: 0;
    font-size: 20px;
    letter-spacing: -0.03em;
    flex: 1;
}

.admin-user {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.admin-menu,
.admin-scrim { display: none; }

.admin-content { padding: 28px; }

.page-header {
    margin: 0 0 18px;
    padding: 0;
    border: 0;
    font-size: 22px;
    letter-spacing: -0.03em;
    color: var(--maroon-dark);
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.stat {
    background: #fff;
    border-radius: 18px;
    padding: 18px 20px;
    box-shadow: 0 8px 24px rgba(74, 18, 32, 0.05);
}

.stat span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.stat strong {
    display: block;
    margin-top: 6px;
    font-size: 32px;
    letter-spacing: -0.04em;
    color: var(--maroon-dark);
}

.dash-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
    align-items: start;
}

.card,
.panel {
    background: #fff;
    border: 0;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(74, 18, 32, 0.05);
    overflow: hidden;
    margin-bottom: 16px;
}

.card-accent { height: 6px; background: var(--maroon); }

.card-body,
.panel-body { padding: 18px 20px; }

.panel-heading {
    padding: 16px 20px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    font-weight: 800;
    color: var(--maroon-dark);
}

.panel-primary > .panel-heading {
    background: var(--rose);
    color: var(--maroon-dark);
}

.choice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    color: var(--maroon-dark);
    font-weight: 700;
}

.choice:last-child { border-bottom: 0; padding-bottom: 0; }

.choice small {
    display: block;
    margin-top: 2px;
    color: var(--ok);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.choice.is-closed small { color: #8A8084; }

.table-wrap { overflow-x: auto; }

table,
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.table > thead > tr > th,
.table > tbody > tr > td,
table th,
table td {
    padding: 12px 14px;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    text-align: left;
    vertical-align: middle;
}

.table > thead > tr > th,
table th {
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    background: #FBF8F8;
}

.table-striped > tbody > tr:nth-of-type(odd) { background: #FCF9F9; }

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.badge-open { background: #D1FAE5; color: #047857; }
.badge-shut { background: #F3F0F1; color: #6D6166; }

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

.actions .btn { min-height: 34px; padding: 0 10px; font-size: 12px; white-space: nowrap; }

.row { display: flex; flex-wrap: wrap; margin: 0 -8px 8px; }
.row > [class*="col-"] { width: 100%; padding: 8px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 700; color: var(--maroon-dark); }

@media (min-width: 900px) {
    .col-md-6 { width: 50%; }
    .col-lg-3 { width: 25%; }
    .col-lg-12 { width: 100%; }
}

.report-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(74, 18, 32, 0.05);
    margin-bottom: 16px;
}

.report-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 20px 0;
}

.report-delete-all { margin: 0; }

.report-head h2 {
    margin: 0;
    font-size: 16px;
    letter-spacing: -0.02em;
    color: var(--maroon-dark);
}

.report-head p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.report-filters {
    display: grid;
    grid-template-columns: minmax(160px, 220px) minmax(160px, 220px) max-content;
    gap: 12px;
    align-items: end;
    justify-content: start;
    padding: 16px 20px 18px;
}

.report-filters label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
}

.report-scroll {
    overflow: auto;
    max-height: min(68vh, 720px);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.report-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
}

.report-table th,
.report-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    vertical-align: middle;
    font-size: 13px;
    text-align: left;
}

.report-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #FBF8F8;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.report-table tbody tr:nth-child(even) { background: #FCF9F9; }

.report-table th:nth-child(1),
.report-table td:nth-child(1),
.report-table th:nth-child(n+8):nth-child(-n+17),
.report-table td:nth-child(n+8):nth-child(-n+17) {
    text-align: center;
}

.report-table th:nth-child(2),
.report-table td:nth-child(2) { min-width: 160px; }

.report-table th:nth-child(3),
.report-table td:nth-child(3) { min-width: 130px; }

.report-table .col-comment {
    min-width: 280px;
    max-width: 360px;
    white-space: normal;
    text-align: left;
    line-height: 1.45;
    overflow-wrap: break-word;
}

.report-table tr:nth-last-child(-n+3) td {
    background: #FBF8F8;
    font-weight: 700;
}

.report-table tr:last-child td {
    background: var(--rose);
    color: var(--maroon-dark);
    font-size: 18px;
}

.report-table h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
}

.report-table .report-empty {
    white-space: normal;
    text-align: left;
    color: var(--muted);
    font-weight: 600;
}

.report-foot {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px 20px 20px;
}

.legend-table {
    width: auto;
    min-width: 280px;
    border-collapse: collapse;
}

.legend-table th,
.legend-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 13px;
}

.legend-table th {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

@media (max-width: 980px) {
    .login-screen { padding: 0; background: #fff; }
    .login-desk {
        width: 100%;
        min-height: 100dvh;
        border-radius: 0;
        box-shadow: none;
        grid-template-columns: 1fr;
        align-content: start;
    }
    .login-brand {
        align-items: center;
        text-align: center;
        padding: calc(28px + env(safe-area-inset-top)) 24px 32px;
        border-bottom-left-radius: 28px;
        border-bottom-right-radius: 28px;
    }
    .login-brand img {
        width: 96px;
        margin: 0 auto;
    }
    .login-kicker { margin-top: 12px; }
    .login-brand h1 {
        max-width: 280px;
        margin: 8px auto;
        font-size: 26px;
        line-height: 1.2;
    }
    .login-brand p:not(.login-kicker) {
        max-width: 300px;
        margin-right: auto;
        margin-left: auto;
        font-size: 14px;
        line-height: 1.55;
    }
    .login-panel {
        align-items: flex-start;
        justify-content: flex-start;
        padding: 24px 20px 36px;
    }
    .login-card {
        width: min(420px, 100%);
        margin: 0 auto;
    }
    .login-card h2,
    .login-card .lede { text-align: center; }
    .login-form { margin-top: 22px; }
    .login-back { display: block; text-align: center; }
    .stats,
    .dash-grid { grid-template-columns: 1fr; }
    .admin-app { grid-template-columns: 1fr; }
    .admin-side {
        position: fixed;
        z-index: 20;
        width: min(280px, 86vw);
        transform: translateX(-105%);
        transition: transform 0.2s ease;
    }
    .admin-side.is-open { transform: none; }
    .admin-scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(28, 18, 20, 0.45);
        z-index: 15;
        opacity: 0;
        pointer-events: none;
    }
    .admin-side.is-open ~ .admin-scrim,
    .admin-app:has(.admin-side.is-open) .admin-scrim {
        opacity: 1;
        pointer-events: auto;
    }
    .admin-menu {
        display: inline-flex;
        width: 42px;
        height: 42px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: #fff;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }
    .admin-content,
    .admin-top { padding-left: 16px; padding-right: 16px; }
    .report-head { flex-direction: column; }
    .report-delete-all,
    .report-delete-all .btn { width: 100%; }
    .report-filters { grid-template-columns: 1fr; justify-content: stretch; }
    .report-filters .btn { width: 100%; }
    .report-foot { align-items: stretch; }
    .report-foot .btn,
    .legend-table { width: 100%; }
    .report-scroll { max-height: 62vh; }
    .page-header { font-size: 20px; }
}
