:root {
  --primary_bg: #F3EEE4;
  --primary: #31501D;
  --primary_light: #5A7F33;
  --forest: #1B3A23;
  --text: #171A16;
  --text-muted: #6C6E64;
  --gold: #C6A24A;
  --card: #ffffff;
  --border: rgba(27, 58, 35, 0.16);
  --aside-width: 260px;
  --aside-min: 80px;
  --sidebar-bg: #FFFEFB;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, system-ui, sans-serif;
  background: var(--primary_bg);
  color: var(--text);
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary_light); }

.aside {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--aside-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 24px rgba(27, 58, 35, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 110;
}

.aside-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem 1rem;
  position: relative;
}

.aside-logo a {
  background: var(--forest);
  border-radius: 0.75rem;
  padding: 0.45rem 0.8rem;
}

.brand-logo {
  display: block;
  height: 42px;
  width: auto;
}

.aside-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.aside-sep {
  height: 1px;
  background: var(--border);
  margin: 0 1.25rem;
}

.aside-menu, .aside-footer {
  padding: 1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.aside-menu { flex: 1; overflow: auto; }

.menu-link, .menu-link-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
}

.menu-link:hover, .menu-link-btn:hover {
  background: rgba(49, 80, 29, 0.06);
  color: var(--text);
}

.menu-link.active {
  background: rgba(49, 80, 29, 0.12);
  color: var(--text);
  position: relative;
}

.menu-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary);
  border-radius: 4px;
}

.menu-icon {
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
}

.wrapper {
  margin-left: var(--aside-width);
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 2rem 0.5rem;
}

.topbar .btn-icon {
  border: 0;
  background: transparent;
  font-size: 1.4rem;
  color: var(--text);
}

.header-mobile-logo img {
  height: 36px;
  background: var(--forest);
  border-radius: 0.6rem;
  padding: 0.3rem 0.55rem;
}

.page-title h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
}

.page-title p {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.content {
  padding: 1rem 2rem 3rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: 0 4px 24px rgba(27, 58, 35, 0.08);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-card h3 {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stat-card .value {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text);
  word-break: break-all;
}

.table {
  color: var(--text);
}

.table thead th {
  background: rgba(49, 80, 29, 0.12);
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom-color: var(--border);
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.badge-accrued, .badge-active { background: #dcfce7; color: #15803d; }
.badge-voided, .badge-inactive { background: #ffe4e6; color: #dc2626; }
.badge-neutral { background: #e2e8f0; color: #475569; }

.btn-dark, .btn-primary {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #F6F3EA !important;
  font-weight: 700;
}

.btn-dark:hover, .btn-primary:hover {
  background: var(--primary_light) !important;
  border-color: var(--primary_light) !important;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(49, 80, 29, 0.18);
}

.copy-row {
  display: flex;
  gap: 0.5rem;
}

.copy-row input { flex: 1; }

.aside-scrim {
  display: none;
}

body.aside-minimized .aside { width: var(--aside-min); }
body.aside-minimized .wrapper { margin-left: var(--aside-min); }
body.aside-minimized .menu-title,
body.aside-minimized .aside-toggle { display: none; }
body.aside-minimized .menu-link { justify-content: center; padding-left: 0.5rem; padding-right: 0.5rem; }
body.aside-minimized .aside-logo a { padding: 0.4rem; }

@media (max-width: 991.98px) {
  .aside {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: min(260px, 86vw);
    pointer-events: none;
  }
  body.drawer-on .aside {
    transform: none;
    pointer-events: auto;
  }
  body.drawer-on { overflow: hidden; }
  .aside-scrim.is-open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(14, 17, 15, 0.45);
    z-index: 105;
  }
  .wrapper { margin-left: 0; }
  .topbar { min-height: 64px; padding: 0.75rem 1rem; position: relative; }
  .page-title { display: none; }
  .header-mobile-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
  .content { padding: 1rem 1rem 2.5rem; }
  body.aside-minimized .aside { width: min(260px, 86vw); }
  body.aside-minimized .wrapper { margin-left: 0; }
  body.aside-minimized .menu-title { display: inline; }
}

/* Auth */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.auth-page::before, .auth-page::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.auth-page::before {
  width: 420px; height: 420px; top: -120px; right: -80px;
  background: rgba(198, 162, 74, 0.22);
}
.auth-page::after {
  width: 320px; height: 320px; bottom: -100px; left: -60px;
  background: rgba(27, 58, 35, 0.12);
}
.auth-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 920px;
  min-height: 560px;
  background: #fff;
  border-radius: 1.25rem;
  box-shadow: 0 24px 64px rgba(27, 58, 35, 0.14);
  overflow: hidden;
  border: 1px solid rgba(27, 58, 35, 0.12);
}
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
  background: linear-gradient(160deg, #1B3A23 0%, #132A19 100%);
  text-align: center;
}
.auth-brand img {
  width: min(170px, 55vw);
  height: auto;
}
.auth-tagline {
  margin: 1.25rem 0 0;
  color: rgba(255,255,255,0.92);
  max-width: 240px;
  line-height: 1.5;
}
.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.75rem;
}
.auth-form-inner { width: 100%; max-width: 360px; }
.auth-eyebrow {
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(49, 80, 29, 0.12);
  color: var(--primary_light);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.auth-title { margin: 0 0 0.5rem; font-size: 1.85rem; font-weight: 800; }
.auth-subtitle { margin: 0 0 2rem; color: var(--text-muted); }
.auth-label { display: block; margin-bottom: 0.45rem; font-size: 0.82rem; font-weight: 600; }
.auth-input {
  height: 48px;
  border-radius: 0.75rem;
}
.auth-submit {
  width: 100%;
  height: 48px;
  margin-top: 0.5rem;
  border: 0;
  border-radius: 0.75rem;
  background: var(--primary);
  color: #F6F3EA;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(49, 80, 29, 0.28);
}
.auth-submit:hover { background: var(--primary_light); }
.auth-footer { margin-top: 1.5rem; text-align: center; font-size: 0.8rem; color: rgba(27, 58, 35, 0.8); }
.auth-alt { margin-top: 1rem; text-align: center; font-size: 0.88rem; }

@media (max-width: 768px) {
  .auth-card { grid-template-columns: 1fr; min-height: auto; }
  .auth-brand { padding: 2rem 1.5rem 1.75rem; }
  .auth-form-wrap { padding: 2rem 1.5rem 2.25rem; }
}
