:root {
    --bg: #f4f6f4;
    --panel: #ffffff;
    --ink: #18221f;
    --muted: #66736d;
    --line: #dfe6e1;
    --brand: #2f6f4e;
    --brand-dark: #24563d;
    --gold: #c18a32;
    --danger: #b94747;
    --sidebar: #eef4ed;
    --sidebar-ink: #263b32;
}

body {
    color: var(--ink);
    background: var(--bg);
    letter-spacing: 0;
}

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

.app-sidebar {
    background: var(--sidebar);
    color: var(--sidebar-ink);
    min-height: 100vh;
    padding: 18px 14px;
    position: sticky;
    top: 0;
    border-right: 1px solid #d6e3d9;
}

.brand-block {
    color: var(--sidebar-ink);
    text-decoration: none;
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 10px 18px;
    border-bottom: 1px solid #d6e3d9;
    margin-bottom: 14px;
}

.brand-block:hover { color: var(--brand-dark); }
.brand-block strong { display: block; line-height: 1.1; }
.brand-block small { display: block; color: #6a7d72; margin-top: 3px; }

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: #eef5ef;
    color: var(--brand);
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    overflow: hidden;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-mark i { font-size: 1.55rem; }

.sidebar-nav a {
    color: #3e554a;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    margin: 2px 0;
    font-weight: 500;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: #dfeae2;
    color: #173d2a;
}

.sidebar-nav a.active {
    box-shadow: inset 3px 0 0 var(--gold);
}

.sidebar-nav i { width: 20px; text-align: center; }

.nav-section {
    color: #789083;
    font-size: .72rem;
    text-transform: uppercase;
    font-weight: 700;
    margin: 18px 12px 6px;
}

.app-content { min-width: 0; }

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

.page-container {
    padding: 24px;
}

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

.page-title h1 {
    font-size: 1.65rem;
    margin: 0;
}

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

.status-pill {
    background: #eaf2ed;
    color: var(--brand-dark);
    border: 1px solid #cadbd0;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: .8rem;
    font-weight: 700;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
}

.metric-card,
.panel,
.card {
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(24,34,31,.05);
}

.metric-card {
    background: var(--panel);
    padding: 18px;
    min-height: 128px;
}

.metric-card .metric-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #e9f2ed;
    color: var(--brand);
    margin-bottom: 14px;
}

.metric-card.warning .metric-icon { background: #fff5df; color: #9d6d20; }
.metric-card.danger .metric-icon { background: #fbe8e8; color: var(--danger); }
.metric-card.gold .metric-icon { background: #fff2db; color: var(--gold); }

.metric-label {
    color: var(--muted);
    font-size: .85rem;
    margin-bottom: 4px;
}

.metric-value {
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.1;
}

.metric-note {
    color: var(--muted);
    font-size: .78rem;
    margin-top: 8px;
}

.table th {
    color: #53625b;
    font-size: .78rem;
    text-transform: uppercase;
    background: #f7faf8;
    border-top: 0;
}

.table td { vertical-align: middle; }

.btn-primary,
.btn-success {
    background: var(--brand);
    border-color: var(--brand);
}

.btn-primary:hover,
.btn-success:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

.auth-shell {
    min-height: 100vh;
    background:
        linear-gradient(110deg, rgba(60,82,68,.74), rgba(107,137,111,.58)),
        url("https://images.unsplash.com/photo-1566073771259-6a8506099945?auto=format&fit=crop&w=1800&q=80") center/cover;
}

.auth-layout {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(820px, 100%);
    display: grid;
    grid-template-columns: .92fr 1.08fr;
    background: rgba(255,255,255,.62);
    backdrop-filter: blur(8px);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 28px 70px rgba(0,0,0,.28);
}

.login-story {
    background: rgba(244, 248, 243, .52);
    color: var(--ink);
    padding: 34px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.login-story h1 {
    font-size: 2rem;
    margin: 18px 0 12px;
}

.login-story p { color: #60736a; }
.login-story .brand-mark {
    width: 160px;
    height: 160px;
    background: transparent;
    border: 0;
    border-radius: 0;
}

.login-form {
    padding: 34px;
    background: rgba(255,255,255,.68);
}

.auth-alerts {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: min(520px, calc(100% - 32px));
    z-index: 30;
}

.avatar-option {
    display: inline-flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-right: 6px;
    cursor: pointer;
}

.avatar-option input { display: none; }
.avatar-option:has(input:checked) {
    border-color: var(--brand);
    background: #e9f2ed;
}

@media (max-width: 992px) {
    .app-shell { grid-template-columns: 1fr; }
    .app-sidebar {
        min-height: auto;
        position: static;
    }
    .sidebar-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px;
    }
    .nav-section { grid-column: 1 / -1; }
    .topbar { position: static; }
}

@media (max-width: 768px) {
    .page-container { padding: 16px; }
    .page-title { display: block; }
    .login-panel { grid-template-columns: 1fr; }
    .login-story { padding: 24px; }
    .login-form { padding: 24px; }
}
