:root {
  --brand: #1f6f43;
  --brand-dark: #154d2f;
  --sidebar-bg: #16281f;
  --sidebar-fg: #c9d6cf;
  --surface: #ffffff;
  --page-bg: #f3f5f4;
  --bs-primary: #1f6f43;
  --bs-primary-rgb: 31, 111, 67;
  --bs-link-color: #1f6f43;
  --bs-link-color-rgb: 31, 111, 67;
  --bs-link-hover-color: #154d2f;
}
body { background: var(--page-bg); font-size: .925rem; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-active-bg: var(--brand-dark); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand-dark); }
.text-bg-primary { background-color: var(--brand) !important; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

/* layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 245px; background: var(--sidebar-bg) !important; color: var(--sidebar-fg); flex-shrink: 0; }
.sidebar.offcanvas-lg { --bs-offcanvas-width: 245px; --bs-offcanvas-bg: var(--sidebar-bg); }
@media (min-width: 992px) { .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; visibility: visible !important; transform: none !important; } }
.sidebar-brand { padding: 1rem 1.1rem .75rem; border-bottom: 1px solid rgba(255,255,255,.08); position: relative; }
.sidebar-brand a { color: #fff; font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.sidebar-brand small { display: block; color: #8fa89a; font-size: .75rem; margin-top: 2px; }
.sidebar-brand .btn-close { position: absolute; right: 1rem; top: 1rem; }
.sidebar-nav { padding: .5rem 0 2rem; }
.sidebar-nav a { display: flex; gap: .6rem; align-items: center; color: var(--sidebar-fg); text-decoration: none; padding: .38rem 1.1rem; font-size: .88rem; border-left: 3px solid transparent; }
.sidebar-nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar-nav a.active { background: rgba(46, 160, 98, .18); color: #fff; border-left-color: #2ea062; }
.nav-section { text-transform: uppercase; font-size: .68rem; letter-spacing: .08em; color: #6f8a7b; padding: .9rem 1.1rem .25rem; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--surface); border-bottom: 1px solid #e3e7e5; padding: .55rem 1.25rem; display: flex; align-items: center; gap: .75rem; position: sticky; top: 0; z-index: 1020; }
.topbar-title { font-weight: 600; color: #333; }
.content { padding: 1.25rem; max-width: 1500px; width: 100%; }
@media (max-width: 576px) { .content { padding: .75rem; } }

/* page bits */
.page-header { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; align-items: flex-end; margin-bottom: 1rem; }
.page-header h1 { font-size: 1.35rem; margin: 0; font-weight: 650; }
.page-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.card { border: 1px solid #e3e7e5; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.card-header { background: #fafbfa; font-weight: 600; }
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: #6c757d; font-weight: 600; white-space: nowrap; background: #fafbfa; }
.table td { vertical-align: middle; }
.table-card { background: var(--surface); border: 1px solid #e3e7e5; border-radius: .5rem; overflow-x: auto; }
.filters { background: var(--surface); border: 1px solid #e3e7e5; border-radius: .5rem; padding: .75rem; margin-bottom: 1rem; }
.filters .form-control, .filters .form-select { font-size: .85rem; }
.kpi { background: var(--surface); border: 1px solid #e3e7e5; border-radius: .5rem; padding: .9rem 1rem; height: 100%; display: block; color: inherit; text-decoration: none; }
.kpi:hover { border-color: var(--brand); }
.kpi .kpi-label { font-size: .78rem; color: #6c757d; }
.kpi .kpi-value { font-size: 1.6rem; font-weight: 700; color: #1d2b24; line-height: 1.2; }
.kpi i { font-size: 1.3rem; color: var(--brand); float: right; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: #7b8780; }
.empty-state i { font-size: 2rem; display: block; margin-bottom: .5rem; }
.dl-grid { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
.dl-grid dt { color: #6c757d; font-weight: 500; }
.dl-grid dd { margin: 0; }
.steps { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: 1rem; }
.steps span { font-size: .78rem; padding: .25rem .65rem; border-radius: 1rem; background: #e9ecea; color: #6c757d; }
.steps span.done { background: #d4eddc; color: #1f6f43; }
.steps span.now { background: var(--brand); color: #fff; }
.line-row { background: #fbfcfb; border: 1px solid #e3e7e5; border-radius: .5rem; padding: .75rem; margin-bottom: .6rem; }
.metric-row { margin-top: .35rem; }
.best-row { background: #eaf6ee !important; }
.form-label { font-weight: 500; font-size: .85rem; margin-bottom: .2rem; }
.required::after { content: " *"; color: #c0392b; }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem;
  background: linear-gradient(135deg, #16281f 0%, #1f6f43 100%); }
.auth-card { width: 100%; max-width: 440px; background: #fff; border-radius: .75rem; padding: 2rem; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.auth-card.wide { max-width: 620px; }
.auth-card h1 { font-size: 1.4rem; font-weight: 700; }
.auth-wrap .alert { width: 100%; max-width: 440px; }
.week-grid td { min-width: 120px; font-size: .78rem; vertical-align: top; }
.week-grid .trip-chip { background: #e3f1e8; border-left: 3px solid var(--brand); padding: 2px 4px; margin-bottom: 3px; border-radius: 3px; }
.week-grid .today { background: #fffbea; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.brand-logo { max-height: 30px; max-width: 110px; background: #fff; border-radius: 4px; padding: 2px; }
.sidebar-version { color: #5d7568; font-size: .7rem; padding: 1rem 1.1rem 0; }
.tree-loc ul { list-style: none; padding-left: 1.2rem; border-left: 1px dashed #c4d0c9; margin-left: .5rem; }
.tree-loc > ul { border-left: 0; padding-left: 0; margin-left: 0; }
.tree-loc li { margin: .3rem 0; }
.kpi-sm .kpi-value { font-size: 1.3rem; }
.chart-box { position: relative; height: 260px; }
.nav-pills { --bs-nav-pills-link-active-bg: var(--brand); --bs-nav-link-color: var(--brand); --bs-nav-link-hover-color: var(--brand-dark); }

.app-footer { font-size: .75rem; color: #8a948f; padding: 12px 24px 18px; text-align: center; }
@media print { .app-footer { display: none; } }

/* ---- v3.1 grouped, collapsible menu */
.nav-tools { display: flex; gap: .35rem; padding: .6rem .8rem .2rem; }
.nav-tools .form-control { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.12); color: #fff; }
.nav-tools .form-control::placeholder { color: #8fa89a; }
.nav-tool-btn { color: #8fa89a; border: 1px solid rgba(255,255,255,.12); }
.nav-tool-btn:hover { color: #fff; }
.nav-group { border-bottom: 1px solid rgba(255,255,255,.04); }
button.nav-section { display: flex; width: 100%; align-items: center; gap: .5rem; background: none; border: 0; text-align: left;
  cursor: pointer; color: #9fb7a9; padding: .65rem 1.1rem .5rem; }
button.nav-section:hover { color: #fff; }
button.nav-section .bi:first-child { font-size: .85rem; }
.nav-chev { margin-left: auto; transition: transform .15s; font-size: .7rem; }
.nav-group.open .nav-chev { transform: rotate(180deg); }
.nav-group .nav-items { display: none; padding-bottom: .35rem; }
.nav-group.open .nav-items, .nav-group.filtering .nav-items { display: block; }
.nav-group.has-active button.nav-section { color: #fff; }
.sidebar-nav a.nav-hidden, .nav-group.nav-hidden { display: none !important; }
