:root {
    --ink: #172026;
    --muted: #5d6b75;
    --line: #d9e1e7;
    --panel: #ffffff;
    --bg: #f4f7f6;
    --nav: #10232b;
    --nav-soft: #1d3942;
    --teal: #0f766e;
    --teal-dark: #115e59;
    --amber: #b7791f;
    --red: #b42318;
    --blue: #2563eb;
    --green: #15803d;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--bg);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.45;
}

a {
    color: inherit;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    flex: 0 0 250px;
    padding: 22px 16px;
    color: #f7fbfb;
    background: var(--nav);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: var(--radius);
    color: #ffffff;
    background: var(--teal);
    font-weight: 700;
}

.brand strong {
    display: block;
    font-size: 18px;
}

.brand small,
.eyebrow {
    color: #a8c0c6;
    font-size: 12px;
    letter-spacing: 0;
}

.nav-list {
    display: grid;
    gap: 6px;
}

.nav-list a {
    padding: 10px 12px;
    border-radius: var(--radius);
    color: #dce9eb;
    text-decoration: none;
}

.nav-list a:hover,
.nav-list a.active {
    background: var(--nav-soft);
    color: #ffffff;
}

.main-panel {
    width: 100%;
    min-width: 0;
    padding: 26px;
}

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

.topbar h1 {
    margin: 2px 0 0;
    font-size: 28px;
    letter-spacing: 0;
}

.eyebrow {
    margin: 0;
    color: var(--muted);
    text-transform: uppercase;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid var(--teal);
    border-radius: var(--radius);
    color: #ffffff;
    background: var(--teal);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

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

.button.secondary,
button.secondary {
    border-color: var(--line);
    color: var(--ink);
    background: #ffffff;
}

.button.ghost {
    border-color: var(--line);
    color: var(--ink);
    background: transparent;
}

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

.panel,
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: 0 8px 24px rgba(15, 35, 42, 0.06);
}

.panel {
    padding: 20px;
    margin-bottom: 20px;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.panel-header h2 {
    margin: 0;
    font-size: 20px;
}

.panel-header p {
    margin: 4px 0 0;
    color: var(--muted);
}

.grid {
    display: grid;
    gap: 18px;
}

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

.two-column {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.card {
    padding: 18px;
}

.stat-label {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 13px;
}

.stat-number {
    margin: 0;
    font-size: 30px;
    font-weight: 800;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.form-grid .wide {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-weight: 700;
    font-size: 13px;
}

.field-title {
    margin: 0 0 8px;
    color: var(--muted);
    font-weight: 700;
    font-size: 13px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    background: #ffffff;
    font-weight: 400;
}

.checkbox-option input {
    width: auto;
    min-height: auto;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 9px 10px;
    color: var(--ink);
    background: #ffffff;
    font: inherit;
}

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

.actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

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

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

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    background: #f8faf9;
    font-size: 12px;
    text-transform: uppercase;
}

td form {
    display: inline;
}

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

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge.success {
    color: #0f5132;
    background: #d1fae5;
}

.badge.warning {
    color: #744210;
    background: #fef3c7;
}

.badge.danger {
    color: #842029;
    background: #fee2e2;
}

.badge.info {
    color: #1e3a8a;
    background: #dbeafe;
}

.badge.neutral {
    color: #374151;
    background: #e5e7eb;
}

.alert {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-weight: 700;
}

.alert.success {
    color: #0f5132;
    background: #d1fae5;
}

.alert.error {
    color: #842029;
    background: #fee2e2;
}

.empty-state {
    padding: 18px;
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: #ffffff;
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 20px;
    background: #eaf1ef;
}

.login-card {
    width: min(440px, 100%);
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: 0 12px 34px rgba(15, 35, 42, 0.10);
}

.login-card h1 {
    margin: 0 0 6px;
    font-size: 30px;
}

.login-card p {
    margin: 0 0 18px;
    color: var(--muted);
}

@media (max-width: 980px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        width: 100%;
        padding: 14px;
    }

    .nav-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .main-panel {
        padding: 18px;
    }

    .stats-grid,
    .two-column,
    .form-grid,
    .checkbox-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .nav-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .panel-header {
        display: block;
    }

    .user-menu {
        width: 100%;
        justify-content: space-between;
    }
}
