: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: space-between;
  gap: 0.5rem;
  padding: 1.1rem 0.85rem 1.1rem 1.1rem;
  background: linear-gradient(160deg, #1B3A23 0%, #132A19 100%);
  isolation: isolate;
}

.aside-logo + .aside-sep {
  display: none;
}

.aside-logo a {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
  background: transparent;
  border-radius: 0;
  padding: 0;
}

.brand-logo {
  display: block;
  height: 34px;
  width: auto;
  max-width: 168px;
  object-fit: contain;
  mix-blend-mode: lighten;
}

.aside-toggle {
  position: static;
  transform: none;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: rgba(246, 243, 234, 0.8);
  cursor: pointer;
}

.aside-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #F6F3EA;
}

.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 {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #1B3A23 0%, #132A19 100%);
  border-radius: 0.65rem;
  padding: 0.35rem 0.7rem;
  isolation: isolate;
}

.header-mobile-logo img {
  height: 28px;
  width: auto;
  object-fit: contain;
  mix-blend-mode: lighten;
  background: none;
  padding: 0;
  border-radius: 0;
}

.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-pending { background: #fef3c7; color: #b45309; }
.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 { display: none; }
body.aside-minimized .menu-link { justify-content: center; padding-left: 0.5rem; padding-right: 0.5rem; }
body.aside-minimized .aside-logo {
  justify-content: center;
  padding: 0.7rem 0.4rem;
}
body.aside-minimized .aside-logo a { display: none; }
body.aside-minimized .aside-toggle {
  display: flex !important;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
}

@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; }
  body.aside-minimized .aside-logo {
    justify-content: space-between;
    padding: 1.1rem 0.85rem 1.1rem 1.1rem;
  }
  body.aside-minimized .aside-logo a { display: flex; }
  body.aside-minimized .aside-toggle { display: none !important; }
}

/* 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 {
  position: relative;
  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;
  overflow: hidden;
  isolation: isolate;
}
.auth-brand::before,
.auth-brand::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.auth-brand::before {
  width: 220px;
  height: 220px;
  top: -60px;
  left: -60px;
  background: rgba(255, 255, 255, 0.08);
}
.auth-brand::after {
  width: 160px;
  height: 160px;
  bottom: -40px;
  right: -30px;
  background: rgba(255, 255, 255, 0.06);
}
.auth-brand-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}
.auth-brand img {
  width: min(170px, 55vw);
  height: auto;
  mix-blend-mode: lighten;
}
.auth-tagline {
  margin: 1.25rem 0 0;
  color: rgba(255,255,255,0.92);
  max-width: 240px;
  line-height: 1.5;
}
.auth-brand-inner .auth-tagline {
  margin: 0;
}
.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.75rem;
}
.auth-form-inner { width: 100%; max-width: 360px; position: relative; }
.auth-form-content {
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.auth-form-content.is-hiding {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  position: absolute;
  width: 100%;
  visibility: hidden;
}
.auth-success {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem 0 0.5rem;
  animation: authSuccessIn 0.45s ease forwards;
}
.auth-success.is-visible { display: flex; }
@keyframes authSuccessIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-success-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--primary) 0%, var(--primary_light) 100%);
  color: #F6F3EA;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  box-shadow: 0 14px 32px rgba(49, 80, 29, 0.35);
  animation: authSuccessPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}
@keyframes authSuccessPop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.auth-success-icon svg {
  width: 34px;
  height: 34px;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: authCheckDraw 0.45s ease 0.35s forwards;
}
@keyframes authCheckDraw {
  to { stroke-dashoffset: 0; }
}
.auth-success-title {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 800;
}
.auth-success-text {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 280px;
}
.auth-success-loader {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: rgba(49, 80, 29, 0.1);
  color: var(--primary_light);
  font-size: 0.8rem;
  font-weight: 600;
}
.auth-success-loader .spinner-border {
  width: 1rem;
  height: 1rem;
  border-width: 0.15em;
}
.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;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 10px 24px rgba(49, 80, 29, 0.28);
}
.auth-submit:hover:not(:disabled) { background: var(--primary_light); }
.auth-submit:disabled { opacity: 0.75; cursor: not-allowed; }

.swal2-container {
  z-index: 2000;
}
.swal2-container.swal2-backdrop-show,
.swal2-container.swal2-noanimation {
  background: rgba(19, 42, 25, 0.46) !important;
}
.swal2-container:has(.swal2-toast) {
  background: transparent !important;
  pointer-events: none;
}
.swal2-container:has(.swal2-toast) .swal2-popup {
  pointer-events: auto;
}
.swal2-popup {
  width: min(24.5rem, calc(100vw - 2rem)) !important;
  padding: 1.65rem 1.4rem 1.3rem !important;
  border-radius: 1.2rem !important;
  border: 1px solid rgba(27, 58, 35, 0.12);
  background: #FFFEFB !important;
  box-shadow: 0 28px 64px rgba(19, 42, 25, 0.22) !important;
  font-family: Inter, system-ui, sans-serif !important;
  position: relative;
}
.swal2-popup::before {
  content: "";
  position: absolute;
  top: 0;
  left: 1.35rem;
  right: 1.35rem;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--gold);
}
.swal2-popup.swal2-toast::before { display: none; }
.swal2-popup.swal2-toast {
  width: auto !important;
  min-width: 12.5rem;
  padding: 0.7rem 0.9rem !important;
  border-radius: 0.9rem !important;
  box-shadow: 0 14px 36px rgba(19, 42, 25, 0.18) !important;
}
.swal2-title {
  padding: 0 0 0.2rem !important;
  font-size: 1.18rem !important;
  font-weight: 800 !important;
  color: var(--text) !important;
  line-height: 1.3 !important;
}
.swal2-html-container {
  margin: 0.15rem 0 0 !important;
  font-size: 0.92rem !important;
  font-weight: 500 !important;
  color: var(--text-muted) !important;
  line-height: 1.5 !important;
}
.swal2-actions {
  width: 100%;
  margin: 1.15rem 0 0 !important;
  gap: 0.5rem;
}
.swal2-styled,
.swal2-confirm,
.swal2-cancel {
  margin: 0 !important;
  min-width: 6.5rem;
  border: 0 !important;
  border-radius: 0.7rem !important;
  padding: 0.62rem 1.2rem !important;
  font-size: 0.88rem !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}
.swal2-styled.swal2-confirm,
.swal2-confirm {
  background: var(--primary) !important;
  color: #F6F3EA !important;
  box-shadow: 0 8px 20px rgba(49, 80, 29, 0.22) !important;
}
.swal2-styled.swal2-confirm:hover,
.swal2-confirm:hover {
  background: var(--primary_light) !important;
}
.swal2-styled.swal2-cancel,
.swal2-cancel {
  background: rgba(27, 58, 35, 0.08) !important;
  color: var(--text) !important;
}
.swal2-icon {
  margin: 0.35rem auto 0.85rem !important;
  border-width: 0.25em !important;
}
.swal2-icon.swal2-success {
  border-color: transparent !important;
  color: var(--primary);
}
.swal2-icon.swal2-success .swal2-success-ring {
  border-color: rgba(49, 80, 29, 0.22) !important;
}
.swal2-icon.swal2-success [class^=swal2-success-line] {
  background-color: var(--primary) !important;
}
.swal2-icon.swal2-success .swal2-success-fix,
.swal2-icon.swal2-success [class^=swal2-success-circular-line] {
  background-color: #FFFEFB !important;
}
.swal2-icon.swal2-error {
  border-color: rgba(180, 35, 24, 0.28) !important;
  color: #b42318;
}
.swal2-icon.swal2-error [class^=swal2-x-mark-line] {
  background-color: #b42318 !important;
}
.swal2-icon.swal2-warning {
  border-color: rgba(198, 162, 74, 0.45) !important;
  color: var(--gold);
}
.swal2-timer-progress-bar {
  background: var(--primary) !important;
}
.swal2-popup.swal2-toast .swal2-title {
  font-size: 0.9rem !important;
  font-weight: 700 !important;
}
.swal2-popup.swal2-toast .swal2-icon {
  margin: 0 0.55rem 0 0 !important;
}

.dummy-banner {
  margin: 0 0 1.15rem;
  padding: 0.55rem 0.9rem;
  border-radius: 0.7rem;
  background: rgba(198, 162, 74, 0.18);
  color: var(--forest);
  font-size: 0.82rem;
  font-weight: 600;
}

.dummy-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 140;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(27, 58, 35, 0.14);
  border-radius: 999px;
  background: #FFFEFB;
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 14px 36px rgba(19, 42, 25, 0.16);
  cursor: pointer;
}
.dummy-fab:hover {
  background: #F6F3EA;
}
.dummy-fab.is-on {
  background: var(--forest);
  color: #F6F3EA;
  border-color: transparent;
}
.dummy-fab.is-on:hover {
  background: #1B3A23;
}
.dummy-fab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(198, 162, 74, 0.22);
}
.dummy-fab.is-on .dummy-fab-dot {
  background: #F6F3EA;
  box-shadow: 0 0 0 3px rgba(246, 243, 234, 0.16);
}

@media (max-width: 991.98px) {
  .dummy-fab {
    right: 1rem;
    bottom: 1rem;
  }
}

.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; }
}
