:root {
    --bg: #f5f1e8;
    --panel: #fffaf0;
    --ink: #1c2421;
    --muted: #5b6a63;
    --accent: #2b6c6a;
    --accent-dark: #1e4c4b;
    --highlight: #f0c86e;
    --shadow: 0 18px 45px rgba(28, 36, 33, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Trebuchet MS", "Gill Sans", "Candara", sans-serif;
    color: var(--ink);
    background: radial-gradient(circle at top left, #fdf8ee 0%, #f2e7d4 45%, #e8dcc8 100%);
}

h1, h2, h3 {
    font-family: "Palatino Linotype", "Book Antiqua", "Palatino", serif;
    margin: 0 0 8px;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, #1f4d49, #143d39);
    color: #f3efe6;
    padding: 28px 22px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: var(--highlight);
    color: #1f1a10;
    display: grid;
    place-items: center;
    font-weight: 700;
    letter-spacing: 1px;
}

.brand-mark.large {
    width: 60px;
    height: 60px;
    font-size: 22px;
}

.brand-title {
    font-size: 20px;
    font-weight: 700;
}

.brand-subtitle {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #d7d2c8;
}

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

.nav-link {
    color: #f3efe6;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    transition: transform 0.2s ease, background 0.2s ease;
}

.nav-link:hover {
    transform: translateX(4px);
    background: rgba(255, 255, 255, 0.16);
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-pill {
    background: rgba(255, 255, 255, 0.16);
    padding: 8px 12px;
    border-radius: 999px;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
}

.logout {
    color: #f5f1e8;
    text-decoration: none;
    font-size: 13px;
}

.content {
    padding: 32px 40px 60px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.page-kicker {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--muted);
}

.topbar-actions {
    display: flex;
    gap: 12px;
}

.primary, button.primary {
    background: var(--accent);
    color: #fdfbf5;
    border: none;
    padding: 10px 18px;
    border-radius: 14px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 50px rgba(28, 36, 33, 0.18);
}

.ghost {
    background: transparent;
    border: 1px solid #c7c0b0;
    color: var(--ink);
    padding: 8px 14px;
    border-radius: 12px;
    cursor: pointer;
}

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

.stat-card,
.card,
.auth-card {
    background: var(--panel);
    padding: 22px;
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
}

.stat-foot {
    margin-top: 6px;
    color: var(--muted);
    font-size: 14px;
}

.card-header p {
    margin: 0;
    color: var(--muted);
}

.card-actions {
    margin-top: 18px;
}

.search-bar {
    display: flex;
    gap: 12px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.search-bar input {
    flex: 1;
    min-width: 180px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #d4cdbd;
}

.search-bar button {
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid #d4cdbd;
    background: #fff7e0;
    cursor: pointer;
}

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

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

th, td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid #e5ddcd;
    font-size: 14px;
}

th {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 11px;
    color: var(--muted);
}

.empty {
    text-align: center;
    padding: 24px;
    color: var(--muted);
}

.pagination {
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.pager-links a {
    margin-left: 10px;
    text-decoration: none;
    color: var(--accent-dark);
    font-weight: 600;
}

.alert {
    background: #fbe7e0;
    color: #7b2f1c;
    padding: 10px 12px;
    border-radius: 12px;
    margin-bottom: 12px;
}

.alert.success {
    background: #e0f0e8;
    color: #1f5a3f;
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.modal.show {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 22, 20, 0.5);
}

.modal-card {
    position: relative;
    background: var(--panel);
    padding: 20px;
    border-radius: 18px;
    width: min(520px, 92vw);
    box-shadow: var(--shadow);
    animation: floatIn 0.3s ease;
}

@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.icon-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
}

.modal-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 14px;
}

.modal-form input {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #d4cdbd;
}

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

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at top, #fef6e8 0%, #f2dcc1 60%, #e7cfae 100%);
}

.auth-card {
    width: min(420px, 92vw);
}

.auth-brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.auth-form {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.auth-form input {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #d4cdbd;
}

.auth-hint {
    margin-top: 16px;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        position: sticky;
        top: 0;
        z-index: 5;
    }

    .nav {
        flex-direction: row;
    }

    .content {
        padding: 24px;
    }
}

@media (max-width: 640px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    table {
        min-width: 560px;
    }
}
