:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --text: #172033;
    --muted: #667085;
    --border: #d9e2ef;
    --primary: #176b87;
    --primary-dark: #0f4f64;
    --green: #16825d;
    --blue: #2563eb;
    --amber: #b7791f;
    --red: #c2413a;
    --shadow: 0 10px 30px rgba(28, 43, 70, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #eef7f6 0%, #f6f8fb 48%, #eef3f9 100%);
}

.auth-box {
    width: min(440px, 100%);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 28px;
}

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

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--primary);
    color: #ffffff;
    font-weight: 800;
}

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

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: #102a3a;
    color: #e8f1f6;
    padding: 18px 14px;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar .brand-title {
    font-weight: 750;
}

.sidebar .brand-subtitle {
    color: #abc4d2;
    font-size: 12px;
}

.nav {
    display: grid;
    gap: 4px;
    margin-top: 18px;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    color: #cfe0e9;
}

.nav a:hover,
.nav a.is-active {
    background: rgba(255, 255, 255, 0.11);
    color: #ffffff;
}

.nav-key {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 11px;
    font-weight: 700;
}

.main {
    min-width: 0;
}

.topbar {
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.page {
    padding: 26px 28px 44px;
}

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

.page-title {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
}

.page-subtitle {
    color: var(--muted);
    margin-top: 4px;
}

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

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

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

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

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.card-body {
    padding: 18px;
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.15;
}

.stat-label {
    color: var(--muted);
    margin-top: 4px;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

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

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

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

th {
    color: #475467;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0;
    background: var(--panel-soft);
}

tr:last-child td {
    border-bottom: 0;
}

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

.form-grid .is-full {
    grid-column: 1 / -1;
}

label {
    display: block;
    color: #344054;
    font-weight: 650;
    margin-bottom: 7px;
}

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

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

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(23, 107, 135, 0.18);
    border-color: var(--primary);
}

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

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel-soft);
}

.check-row input {
    width: auto;
    min-height: auto;
    margin-top: 3px;
}

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

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

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

.button.secondary:hover {
    background: #eef3f8;
}

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

.button.small {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 13px;
}

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

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

.badge.is-green {
    background: #e7f7ef;
    color: var(--green);
}

.badge.is-blue {
    background: #e9f1ff;
    color: var(--blue);
}

.badge.is-amber {
    background: #fff4dd;
    color: var(--amber);
}

.badge.is-red {
    background: #fdecea;
    color: var(--red);
}

.badge.is-gray {
    background: #eef2f6;
    color: #526071;
}

.notice {
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 14px;
}

.notice.success {
    background: #e7f7ef;
    color: #116149;
    border: 1px solid #b8e4cd;
}

.notice.error {
    background: #fdecea;
    color: #a13732;
    border: 1px solid #fac5c0;
}

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

.nowrap {
    white-space: nowrap;
}

.detail-list {
    display: grid;
    gap: 10px;
}

.detail-row {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 14px;
}

.bar-list {
    display: grid;
    gap: 10px;
}

.bar-row {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 38px;
    gap: 10px;
    align-items: center;
}

.bar-track {
    height: 9px;
    background: #e5edf5;
    border-radius: 999px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: var(--primary);
}

@media (max-width: 1100px) {
    .grid.cols-4,
    .grid.cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

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

    .sidebar {
        position: static;
        height: auto;
    }

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

    .topbar,
    .page-head,
    .toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .grid.cols-4,
    .grid.cols-3,
    .grid.cols-2,
    .form-grid,
    .check-list {
        grid-template-columns: 1fr;
    }

    .page {
        padding: 20px 16px 36px;
    }
}
