:root {
    --primary: #1E3A5F;
    --primary-dark: #102A43;
    --primary-soft: #E8F1FA;

    --accent: #3B82F6;
    --accent-soft: #DBEAFE;

    --bg: #F8FAFC;
    --card: #FFFFFF;

    --text: #0F172A;
    --muted: #64748B;
    --border: #E2E8F0;

    --success: #22C55E;
    --warning: #F59E0B;
    --danger: #EF4444;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);

    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    font-size: 15px;
}

a {
    color: inherit;
}

.page {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px;
}

/* TYPOGRAPHY */

h1,
h2,
h3 {
    margin-top: 0;
    color: var(--text);
}

h1 {
    font-size: 30px;
    letter-spacing: -0.03em;
}

.muted,
.help-text {
    color: var(--muted);
    line-height: 1.45;
}

/* CARDS */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}

/* BUTTONS */

.btn,
button,
.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 44px;
    padding: 10px 16px;

    border-radius: var(--radius-md);
    border: none;

    background: var(--primary);
    color: white;

    font-weight: 700;
    font-size: 15px;
    font-family: inherit;
    text-decoration: none;

    cursor: pointer;

    transition:
        background 0.15s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

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

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

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--primary-soft);
}

.btn-success {
    background: var(--success);
}

.btn-success:hover {
    background: #16A34A;
}

.btn-danger,
.logout,
button.danger {
    background: var(--danger) !important;
    color: white !important;
}

.btn-danger:hover,
.logout:hover,
button.danger:hover {
    background: #DC2626 !important;
}

/* FORMS */

label {
    display: block;
    margin-top: 16px;
    margin-bottom: 6px;

    font-weight: 700;
    color: var(--text);
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;

    padding: 10px 12px;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    background: white;
    color: var(--text);

    font: inherit;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

/* BADGES */

.badge {
    display: inline-flex;
    align-items: center;

    border-radius: 999px;

    padding: 5px 10px;

    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;

    white-space: nowrap;
}

.badge-success {
    background: #DCFCE7;
    color: #166534;
}

.badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

.badge-danger {
    background: #FEE2E2;
    color: #991B1B;
}

/* NAVBAR */

.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;

    background: var(--primary-dark);
    color: white;

    padding: 12px 20px;

    box-shadow: var(--shadow-md);
}

.navbar .nav-left,
.navbar .nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.navbar .logo {
    display: inline-flex;
    align-items: center;

    font-weight: 900;
    font-size: 17px;

    color: white;
    text-decoration: none;

    margin-right: 8px;

    white-space: nowrap;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 26px;
    height: 26px;

    margin-right: 8px;

    border-radius: 9px;

    background: var(--accent);
    color: white;

    font-size: 14px;
    font-weight: 900;
}

.logo-text {
    display: inline-flex;
    align-items: center;
}

.navbar a,
.navbar .nav-dropdown-button {
    display: inline-flex;
    align-items: center;

    min-height: 36px;
    padding: 7px 10px;

    border-radius: var(--radius-sm);

    color: #D9E2EC;

    text-decoration: none;
    font-size: 14px;
    font-weight: 700;

    background: transparent;
    border: none;

    cursor: pointer;

    font-family: inherit;

    white-space: nowrap;
}

.navbar a:hover,
.navbar .nav-dropdown-button:hover {
    background: rgba(255,255,255,0.10);
    color: white;
}

.navbar .nav-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.dropdown-chevron {
    margin-left: 5px;
    font-size: 11px;
}

.navbar .nav-dropdown-content {
    display: none;

    position: absolute;
    top: 100%;
    left: 0;

    min-width: 230px;

    background: white;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    overflow: hidden;

    box-shadow: var(--shadow-md);

    z-index: 2000;
}

.navbar .nav-dropdown-content a {
    display: block;
    width: 100%;

    color: var(--text);

    padding: 11px 14px;

    border-radius: 0;

    font-weight: 700;
}

.navbar .nav-dropdown-content a:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.navbar .nav-dropdown:hover .nav-dropdown-content {
    display: block;
}

.navbar .user {
    color: #D9E2EC;
    font-size: 14px;
    white-space: nowrap;
}

.navbar .logout {
    padding: 7px 11px;
    border-radius: var(--radius-sm);
}

/* MOBILE BOTTOM NAV */

.mobile-bottom-nav {
    display: none;
}

/* TABLES */

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

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th {
    text-align: left;

    padding: 12px;

    color: var(--muted);

    font-size: 12px;
    font-weight: 800;

    text-transform: uppercase;
    letter-spacing: 0.04em;

    border-bottom: 1px solid var(--border);

    background: #F8FAFC;
}

td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
}

tr:hover td {
    background: #F8FAFC;
}

/* MODALS */

.modal-overlay {
    position: fixed;
    inset: 0;

    background: rgba(15,23,42,0.55);

    display: none;
    align-items: center;
    justify-content: center;

    z-index: 9999;

    padding: 16px;
}

.modal-card {
    background: white;

    width: 100%;
    max-width: 420px;

    padding: 24px;

    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-md);
}

.modal-card h3 {
    margin-top: 0;
}

.modal-card p {
    color: var(--muted);
    line-height: 1.45;
}

.modal-actions {
    display: flex;
    gap: 12px;

    margin-top: 22px;
}

.modal-actions button {
    flex: 1;
    margin: 0;
}

/* SETTINGS */

.settings-container {
    max-width: 760px;
    margin: 0 auto;

    background: white;

    padding: 24px;

    border-radius: var(--radius-lg);

    border: 1px solid var(--border);

    box-shadow: var(--shadow-sm);
}

.settings-container h1 {
    margin-bottom: 8px;
}

.settings-container .button-row {
    margin-top: 28px;
}

.settings-container .checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;

    font-weight: 600;
}

.settings-container .checkbox-label input {
    width: auto;
    min-height: auto;
    margin: 0;
}

/* MOBILE */

@media (max-width: 768px) {

    .page {
        padding: 16px;
        padding-bottom: 88px;
    }

    .desktop-only,
    .desktop-nav-link {
        display: none !important;
    }

    .navbar {
        border-radius: 0;
        box-shadow: var(--shadow-sm);
        padding: 12px;
    }

    .navbar .logo {
        margin-right: 0;
    }

    .navbar .user {
        display: none;
    }

    .navbar .logout {
        min-height: 36px;
        padding: 7px 10px;
        font-size: 13px;
    }

    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;

        z-index: 1200;

        display: grid;
        grid-template-columns: repeat(4, 1fr);

        background: white;

        border-top: 1px solid var(--border);

        box-shadow: 0 -6px 20px rgba(15,23,42,0.08);
    }

    .mobile-bottom-nav a {
        min-height: 64px;
        padding: 8px 4px;

        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;

        color: var(--muted);

        text-decoration: none;
        font-size: 12px;
        font-weight: 800;
    }

    .mobile-bottom-nav a:hover {
        color: var(--primary);
        background: var(--primary-soft);
    }

    .mobile-nav-icon {
        font-size: 20px;
        line-height: 1;

        margin-bottom: 4px;

        color: var(--primary);
    }

    .card,
    .settings-container {
        padding: 16px;
        border-radius: 16px;
    }

    h1 {
        font-size: 24px;
    }

    .btn,
    button,
    .primary-button {
        width: 100%;
        min-height: 48px;
        font-size: 15px;
    }

    input,
    select,
    textarea {
        font-size: 16px;
    }

    table {
        font-size: 14px;
    }

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

@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
}