:root {
    --bg: #f6f8f6;
    --surface: #ffffff;
    --surface-soft: #fbfcfb;
    --border: #e2e8e2;
    --border-strong: #d4ddd4;
    --text: #1d2921;
    --muted: #68746c;
    --muted-2: #8a948d;
    --green: #2f6b3b;
    --green-dark: #24552e;
    --green-soft: #e9f2ea;
    --shadow: 0 1px 2px rgba(24, 39, 28, .04), 0 8px 24px rgba(24, 39, 28, .045);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

body { min-height: 100vh; }
button, input { font: inherit; }

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

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 22px 14px 16px;
}

.sidebar-brand {
    padding: 5px 12px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
}

.sidebar-brand-title {
    font-size: 16px;
    font-weight: 750;
    letter-spacing: -.01em;
}

.sidebar-brand-subtitle {
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
}

.main-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    padding-right: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 11px;
    border-radius: 7px;
    color: #46534a;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.nav-item:hover { background: #f2f6f2; }
.nav-item.active { background: var(--green-soft); color: var(--green-dark); }

.nav-section-title {
    margin: 18px 11px 6px;
    color: var(--muted-2);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.sidebar-footer {
    margin-top: auto;
    padding: 14px 8px 0;
    border-top: 1px solid var(--border);
}

.admin-name {
    padding: 0 4px;
    color: var(--muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-button {
    width: 100%;
    margin-top: 9px;
    height: 36px;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: var(--surface);
    color: #46534a;
    cursor: pointer;
    font-size: 12px;
    font-weight: 650;
}

.logout-button:hover { background: #f5f7f5; }

.content {
    width: 100%;
    max-width: 1540px;
    padding: 34px 40px 52px;
}

.page-header {
    margin-bottom: 25px;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--green);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

h1, h2 { margin: 0; letter-spacing: -.025em; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 17px; line-height: 1.3; }

.page-description {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    min-height: 124px;
    padding: 17px 18px;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
    box-shadow: var(--shadow);
}

.stat-label {
    color: #59655d;
    font-size: 12px;
    font-weight: 650;
}

.stat-value {
    margin-top: 11px;
    font-size: 29px;
    line-height: 1;
    letter-spacing: -.035em;
}

.stat-note {
    margin-top: auto;
    color: var(--muted-2);
    font-size: 11px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 18px;
    align-items: start;
}

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

.panel-header {
    min-height: 64px;
    padding: 17px 18px 14px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
}

.panel-meta {
    color: var(--muted-2);
    font-size: 11px;
    white-space: nowrap;
    padding-top: 2px;
}

.loading-state, .empty-state {
    padding: 32px 18px;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
}

th, td {
    padding: 11px 13px;
    border-bottom: 1px solid #edf1ed;
    text-align: left;
    vertical-align: middle;
}

th {
    background: var(--surface-soft);
    color: #748078;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
}

td {
    color: #334037;
    line-height: 1.4;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafcf9; }

td:first-child {
    width: 58px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

td:nth-child(2) {
    width: 92px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

td:nth-child(5) {
    width: 105px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

td:nth-child(6) {
    width: 105px;
    white-space: nowrap;
}

.side-panels {
    display: grid;
    gap: 18px;
}

.placeholder-panel {
    min-height: 176px;
    padding-bottom: 20px;
}

.placeholder-panel p {
    margin: 0;
    padding: 0 18px 18px;
    color: var(--muted);
    line-height: 1.55;
    font-size: 13px;
}

.alert {
    margin-bottom: 18px;
    padding: 11px 13px;
    border-radius: 7px;
    font-size: 13px;
}

.error-alert {
    background: #fff5f4;
    border: 1px solid #efd1cd;
    color: #96352d;
}

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

.login-card {
    width: min(100%, 420px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 14px 40px rgba(24, 39, 28, .08);
}

.brand { margin-bottom: 28px; }
.brand-title { font-size: 21px; font-weight: 700; }
.brand-subtitle { margin-top: 4px; color: var(--muted); }

.login-card h1 { margin-bottom: 8px; }
.intro { margin: 0 0 24px; color: var(--muted); }

label {
    display: block;
    margin: 16px 0 7px;
    font-size: 13px;
    font-weight: 650;
}

input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #cfd8cf;
    border-radius: 7px;
    background: #fff;
}

input:focus {
    outline: 2px solid #cfe0d1;
    border-color: #719278;
}

.login-card button[type="submit"] {
    width: 100%;
    height: 44px;
    margin-top: 23px;
    border: 0;
    border-radius: 7px;
    background: var(--green);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.login-card button[type="submit"]:disabled { opacity: .6; cursor: wait; }

.error { margin: 14px 0 0; color: #b42318; font-size: 13px; }

@media (max-width: 1120px) {
    .content { padding-left: 28px; padding-right: 28px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .side-panels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 210px minmax(0, 1fr); }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .content { padding: 28px 22px 42px; }
}

@media (max-width: 700px) {
    .app-shell { display: block; }
    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        padding: 14px;
    }
    .sidebar-brand { padding: 3px 8px 13px; margin-bottom: 10px; }
    .main-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .nav-section-title { grid-column: 1 / -1; margin-top: 11px; }
    .sidebar-footer { margin-top: 12px; }
    .content { padding: 24px 15px 36px; }
    .side-panels { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .main-nav { grid-template-columns: 1fr; }
    .nav-section-title { grid-column: auto; }
    h1 { font-size: 26px; }
}
