:root {
    --ink-900: #172033;
    --ink-700: #33415f;
    --paper: #f7f4ef;
    --paper-soft: #fffdf8;
    --line: #d9d3c9;
    --brand: #0d8f8a;
    --brand-strong: #0a6f6b;
    --accent: #cb6b2c;
    --danger: #c53b2c;
    --shadow: 0 12px 28px rgba(23, 32, 51, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", sans-serif;
    color: var(--ink-900);
    background:
        radial-gradient(circle at 15% 10%, rgba(13, 143, 138, 0.15), transparent 35%),
        radial-gradient(circle at 90% 0%, rgba(203, 107, 44, 0.18), transparent 40%),
        linear-gradient(170deg, #f6f3ec 0%, #f5efe4 45%, #f1ede9 100%);
}

h1,
h2,
h3 {
    font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
    letter-spacing: 0.2px;
}

.background-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 85% 20%, rgba(13, 143, 138, 0.08), transparent 38%),
        radial-gradient(circle at 8% 86%, rgba(203, 107, 44, 0.09), transparent 38%);
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
    max-width: 1280px;
    margin: 20px auto;
    padding: 0 14px 30px;
}

.topbar {
    background: rgba(255, 253, 248, 0.72);
    border: 1px solid rgba(217, 211, 201, 0.8);
    border-radius: 16px;
    padding: 16px 18px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    box-shadow: var(--shadow);
    backdrop-filter: blur(6px);
}

.eyebrow {
    margin: 0 0 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: var(--ink-700);
    font-weight: 700;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(24px, 4.5vw, 38px);
}

.subtitle {
    margin: 6px 0 0;
    color: var(--ink-700);
    font-size: 14px;
}

.topbar-right {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.notif-dropdown {
    position: relative;
}

.notif-toggle {
    list-style: none;
    cursor: pointer;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid #bee7e5;
    background: #e8f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.notif-toggle::-webkit-details-marker {
    display: none;
}

.notif-toggle svg {
    width: 20px;
    height: 20px;
    fill: #1b5f63;
}

.notif-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #c53b2c;
    color: #fff;
    border: 2px solid #f9fffe;
    font-size: 11px;
    font-weight: 700;
    display: grid;
    place-items: center;
    padding: 0 5px;
    line-height: 1;
}

.notif-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: min(340px, calc(100vw - 36px));
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fffefb;
    box-shadow: var(--shadow);
    padding: 10px;
    z-index: 20;
}

.notif-panel h3 {
    margin: 2px 2px 10px;
    font-size: 16px;
}

.notif-empty {
    margin: 0;
    font-size: 13px;
    color: var(--ink-700);
}

.notif-item {
    display: block;
    text-decoration: none;
    border: 1px solid #ece6db;
    border-left: 4px solid #c7b59a;
    border-radius: 10px;
    padding: 9px 10px;
    color: var(--ink-900);
    margin-top: 7px;
}

.notif-item strong {
    display: block;
    font-size: 13px;
    margin-bottom: 2px;
}

.notif-item small {
    display: block;
    font-size: 12px;
    color: #4d5b78;
}

.notif-item.warning {
    border-left-color: #c98e1c;
    background: #fff8e9;
}

.notif-item.danger {
    border-left-color: #c53b2c;
    background: #fff0ee;
}

.notif-item.success {
    border-left-color: #2f8b58;
    background: #eefaf2;
}

.badge {
    background: #e8fbf9;
    color: #0b5956;
    border: 1px solid #ade3df;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 700;
}

.module-nav {
    margin-top: 12px;
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nav-pill {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 999px;
    text-decoration: none;
    color: #174350;
    background: #e8f9f9;
    border: 1px solid #bee7e5;
    font-size: 13px;
    font-weight: 700;
}

.nav-pill.active {
    color: #fff;
    background: linear-gradient(130deg, var(--brand) 0%, var(--brand-strong) 100%);
    border-color: transparent;
}

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

.stat-card {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.92), rgba(254, 248, 240, 0.95));
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: var(--shadow);
}

.stat-card p {
    margin: 0;
    font-size: 13px;
    color: var(--ink-700);
}

.stat-card h3 {
    margin: 6px 0 4px;
    font-size: clamp(22px, 3.6vw, 30px);
}

.stat-card small {
    color: #4d5b78;
    font-size: 12px;
}

.card {
    background: rgba(255, 253, 248, 0.88);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(3px);
}

.filter-card {
    margin-bottom: 12px;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.card h2 {
    margin: 0;
    font-size: 21px;
}

.chip {
    background: #f9f1dd;
    border: 1px solid #e7cf9c;
    color: #7b5517;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
}

.inline-summary {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--ink-700);
}

.row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 12px;
}

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

.grid-form > * {
    min-width: 0;
}

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

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-700);
}

label.check {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
}

input,
select,
button,
.btn-danger,
.btn-small {
    width: 100%;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    font-size: 14px;
    font-family: inherit;
}

input,
select {
    background: var(--paper-soft);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(13, 143, 138, 0.18);
}

button,
.btn-small {
    border: 0;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    background: linear-gradient(130deg, var(--brand) 0%, var(--brand-strong) 100%);
}

button:hover,
.btn-small:hover {
    filter: brightness(1.05);
}

.btn-danger {
    width: auto;
    border: 0;
    color: #fff;
    text-decoration: none;
    text-align: center;
    font-weight: 700;
    background: linear-gradient(130deg, #d14535 0%, #a82e22 100%);
}

.btn-small {
    padding: 8px 10px;
    font-size: 12px;
    min-width: 52px;
}

.btn-small.danger {
    background: linear-gradient(130deg, #e1604c 0%, #bf3827 100%);
}

.button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.csv-break {
    grid-column: 1 / -1;
    height: 0;
}

.csv-action-btn {
    width: 100%;
}

.inline-form {
    display: inline;
}

.inline-form.two-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.inline-form.two-buttons .btn-small {
    width: auto;
}

.table-wrap {
    margin-top: 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
}

table {
    width: 100%;
    min-width: 1040px;
    border-collapse: collapse;
}

thead th {
    position: sticky;
    top: 0;
    background: #eaf6f5;
    color: #234445;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

th,
td {
    border-bottom: 1px solid #ece6db;
    padding: 11px 10px;
    text-align: left;
    white-space: nowrap;
    font-size: 13px;
}

tbody tr:nth-child(even) {
    background: #fcfaf6;
}

.alert {
    border-radius: 12px;
    padding: 11px 12px;
    margin: 12px 0;
    font-size: 14px;
    font-weight: 700;
}

.alert.success {
    background: #eaf9f1;
    border: 1px solid #99d7b0;
    color: #1b5f39;
}

.alert.error {
    background: #fcefea;
    border: 1px solid #efbeb7;
    color: #8c2318;
}

.auth-wrap {
    min-height: 95vh;
    display: grid;
    place-items: center;
}

.auth-panel {
    width: min(1260px, 100%);
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 0.78fr 1.22fr;
    box-shadow: var(--shadow);
    background: #fff;
}

.auth-info {
    padding: 26px;
    color: #fff;
    background:
        linear-gradient(155deg, rgba(13, 143, 138, 0.92) 0%, rgba(10, 111, 107, 0.92) 50%, rgba(16, 89, 86, 0.95) 100%),
        linear-gradient(45deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0));
}

.auth-info h1 {
    margin: 0;
    font-size: clamp(11px, 1.35vw, 17px);
    line-height: 1.15;
    letter-spacing: 0;
    white-space: nowrap;
}


.auth-info p {
    margin: 10px 0 12px;
    line-height: 1.45;
}

.auth-info ul {
    margin: 0;
    padding-left: 18px;
    line-height: 1.65;
}

.auth-form-wrap {
    padding: 42px;
    background: #fffefb;
}

.auth-form-wrap h2 {
    margin: 0 0 16px;
    font-size: 30px;
}

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

.auth-form input,
.auth-form button {
    padding: 14px 14px;
    font-size: 16px;
}

.muted {
    margin-top: 12px;
    font-size: 13px;
    color: #526079;
}

.grid-form .muted {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.muted code {
    display: block;
    margin-top: 4px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.reveal {
    animation: fadeUp 0.6s ease both;
}

.reveal-1 {
    animation-delay: 0.06s;
}

.reveal-2 {
    animation-delay: 0.14s;
}

.reveal-3 {
    animation-delay: 0.22s;
}

.reveal-4 {
    animation-delay: 0.3s;
}

.reveal-5 {
    animation-delay: 0.38s;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 940px) {
    .auth-panel {
        grid-template-columns: 1fr;
    }

    .auth-info {
        padding-bottom: 18px;
    }
}

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

    .topbar {
        padding: 14px;
    }

    .topbar-right {
        width: 100%;
    }

    .notif-panel {
        right: 0;
    }

    .btn-danger {
        width: 100%;
    }

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

    .csv-break {
        display: none;
    }
}

@media (max-width: 460px) {
    .container {
        margin-top: 12px;
        padding: 0 10px 20px;
    }

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

    .module-nav {
        gap: 6px;
    }

    .nav-pill {
        font-size: 12px;
        padding: 7px 10px;
    }
}
