html, body {
  font-family: "DM Sans", "Helvetica Neue", Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  letter-spacing: 0.01em;
}

body {
  background-image: linear-gradient(180deg, #FAF8F6 0%, #FDFCFB 100%);
  background-attachment: fixed;
  font-size: 15.25px;
  font-family: "DM Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #434C58;
}

.app-shell {
  min-height: 100vh;
  background: linear-gradient(160deg, rgba(250, 248, 246, 0.92) 0%, rgba(253, 252, 251, 0.86) 55%, rgba(240, 244, 240, 0.82) 100%);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 16rem;
  max-width: 75vw;
  height: 100vh;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  z-index: 40;
}

.sidebar.is-open {
  transform: translateX(0);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.35);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 30;
  display: none;
}

.sidebar-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
  display: block;
}

.main-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  width: 100%;
  flex: 1;
  max-width: 100vw;
  overflow-x: hidden;
}

.main-shell main {
  flex: 1;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  margin-top: 0;
}

.app-elevate {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 8px 24px rgba(0, 0, 0, 0.06);
}

.app-card {
  border-radius: 16px;
  background: rgba(245, 242, 237, 0.9);
  backdrop-filter: saturate(140%) blur(6px);
  border: 1px solid rgba(191, 176, 160, 0.24);
  position: relative;
}

.app-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.8'/%3E%3C/svg%3E");
  pointer-events: none;
}

.dark .app-card {
  background: rgba(17, 24, 39, 0.86);
  border-color: rgba(255, 255, 255, 0.08);
}

.dark .app-card::after {
  opacity: 0.05;
}

.app-hover {
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.app-hover:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.btn-primary {
  background: #728B70;
  color: #fff;
  border-radius: 0.65rem;
  padding: 0.6rem 1rem;
  box-shadow: 0 6px 20px rgba(114, 139, 112, 0.2);
}

.btn-primary:hover {
  background: #627760;
  box-shadow: 0 10px 24px rgba(114, 139, 112, 0.28);
}

.btn-primary.soft {
  background: rgba(114, 139, 112, 0.15);
  color: #5C715A;
  box-shadow: none;
  border: 1px solid rgba(114, 139, 112, 0.25);
}

.btn-primary.soft:hover {
  background: rgba(114, 139, 112, 0.22);
  color: #495849;
}

.btn-outline {
  border: 1px solid #D3DAE1;
  border-radius: 0.65rem;
  padding: 0.6rem 1rem;
  background: #fff;
  color: #434C58;
}
.btn-outline:hover {
  background: #f9fafb;
}

.dark .btn-outline {
  background: #111827;
  border-color: #374151;
}

.dark .btn-outline:hover {
  background: #1f2937;
}

.app-glass {
  backdrop-filter: saturate(140%) blur(6px);
  background-image: linear-gradient(180deg, rgba(250, 248, 246, 0.92) 0%, rgba(250, 248, 246, 0.72) 100%);
}

.section-title {
  font-family: "Fraunces", "Playfair Display", "Georgia", serif;
  letter-spacing: -0.01em;
  color: #434C58;
}

.muted-label {
  color: rgba(100, 115, 133, 0.85);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.stat-stack {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.stat-value {
  font-weight: 600;
  color: #434C58;
  font-size: 1.2rem;
}

.stat-caption {
  font-size: 0.82rem;
  color: rgba(100, 115, 133, 0.9);
}

.stat-progress {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(114, 139, 112, 0.18);
  overflow: hidden;
}

.stat-progress::after {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--progress, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, #D17F65 0%, #D19F3A 50%, #728B70 100%);
  transition: width 0.4s ease;
}

.badge-soft {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(114, 139, 112, 0.12);
  color: #5C715A;
  font-weight: 500;
  font-size: 0.75rem;
}

.badge-soft.clay {
  background: rgba(209, 127, 101, 0.12);
  color: #A84F3B;
}

.badge-soft.mustard {
  background: rgba(209, 159, 58, 0.14);
  color: #936525;
}

.family-serif {
  font-family: "Fraunces", "Playfair Display", "Georgia", serif;
}

.family-sans {
  font-family: "DM Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

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

.grid-auto-fit-lg {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 2rem 2.25rem;
}

.dashboard-hero {
  background: linear-gradient(135deg, rgba(243, 238, 232, 0.95) 0%, rgba(240, 244, 240, 0.85) 55%, rgba(252, 242, 242, 0.8) 100%);
  border-radius: 24px;
  border: 1px solid rgba(191, 176, 160, 0.24);
}

.dashboard-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0.03;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='5'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.65'/%3E%3C/svg%3E");
  pointer-events: none;
}

.kpi-card {
  padding: 1.4rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(207, 195, 180, 0.38);
  box-shadow: 0 18px 45px -24px rgba(74, 64, 57, 0.4);
}

.dark .kpi-card {
  background: rgba(17, 24, 39, 0.8);
  border-color: rgba(148, 163, 184, 0.18);
}

:root {
  --app-chart-grid: rgba(191,176,160,.22);
  --app-chart-ticks:#647385;
  /* Export brand palette as CSS variables for JS */
  --brand-sand-50:#FDFCFB;
  --brand-sand-100:#FAF8F6;
  --brand-sand-200:#F5F2ED;
  --brand-sand-300:#EDE8E2;
  --brand-sand-400:#E2DAD0;
  --brand-sand-500:#D4C9BD;
  --brand-sand-600:#BFB0A0;
  --brand-sand-700:#A69382;
  --brand-sand-800:#8B7868;
  --brand-sand-900:#6F5F52;
  --brand-sand-950:#4A4039;
  --brand-clay-400:#E0A08A;
  --brand-clay-500:#D17F65;
  --brand-clay-600:#C46449;
  --brand-clay-700:#A84F3B;
  --brand-sage-500:#8FA68C;
  --brand-sage-600:#728B70;
  --brand-mist-200:#E6EAEE;
  --brand-mist-300:#D3DAE1;
  --brand-mist-600:#7B8CA0;
  --brand-mist-700:#647385;
  --brand-mist-900:#434C58;
  --brand-mustard-500:#D19F3A;
  /* Primary mapping for runtime consumers */
  --brand-primary:#728B70;
  --brand-primary-hover: #627760;
}

.dark :root {
  --app-chart-grid: rgba(243,244,246,.15);
  --app-chart-ticks:#d1d5db;
}

input[type], select, textarea {
  border-radius: 10px !important;
  border-color: #D3DAE1 !important;
  background: rgba(255, 255, 255, 0.9);
}

.dark input[type], .dark select, .dark textarea {
  background: rgba(17, 24, 39, 0.9);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(114, 139, 112, 0.25);
  box-shadow: 0 0 0 3px rgba(114, 139, 112, 0.15);
}

.select-pill {
  border-radius: 999px;
  border: 1px solid rgba(114, 139, 112, 0.25);
  background: rgba(245, 242, 237, 0.65);
  padding: 0.45rem 1.2rem;
  color: #5C715A;
}

.select-pill:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(114, 139, 112, 0.18);
  border-color: rgba(114, 139, 112, 0.4);
}

.select-pill option {
  color: #3B473A;
}

::placeholder {
  color: rgba(100, 115, 133, 0.75);
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Fraunces", "Playfair Display", "Georgia", serif;
  letter-spacing: -0.012em;
  font-weight: 500;
  color: #434C58;
}

.text-gradient-warm {
  background: linear-gradient(135deg, #728B70 0%, #D19F3A 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

table thead th {
  position: sticky;
  top: 0;
  background: rgba(245, 242, 237, 0.92);
  backdrop-filter: blur(4px);
}

table tbody tr:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.03);
}

table tbody tr {
  border-bottom: 1px solid rgba(214, 219, 224, 0.35);
}

.app-section-header {
  background: #FDFCFB;
  border-bottom: 1px solid rgba(191, 176, 160, 0.35);
}

.meter {
  height: 10px;
  border-radius: 999px;
  background: #F0F4F0;
}

.meter-fill {
  height: 10px;
  border-radius: 999px;
  background: #728B70;
}

.meter-fill.low {
  background: rgba(209, 127, 101, 0.85);
}

.meter-fill.medium {
  background: rgba(209, 159, 58, 0.9);
}

.meter-fill.good {
  background: rgba(114, 139, 112, 0.9);
}

.sidebar .nav-link {
  color: #647385;
}

.sidebar .nav-link i {
  color: #7B8CA0;
}

.sidebar .nav-link:hover {
  background: rgba(242, 244, 242, 0.95);
  color: #5C715A;
}

.sidebar .nav-link:hover i {
  color: #728B70;
}

.sidebar .nav-link.is-active {
  color: #5C715A;
  background: #F0F4F0;
  box-shadow: inset 3px 0 0 #728B70;
  font-weight: 600;
}

.sidebar .nav-link.is-active i {
  color: #728B70;
}

a {
  color: #5C715A;
}

a:hover {
  color: #495849;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (max-width: 1024px) {
  .main-shell {
    margin-left: 0 !important;
    width: 100%;
  }
  header.sticky {
    position: fixed;
    inset: 0 0 auto;
    width: 100%;
    z-index: 20;
  }
  .main-shell main {
    margin-top: 4.25rem;
  }
}
@media (min-width: 1024px) {
  .sidebar {
    transform: none;
  }
  .sidebar-backdrop {
    display: none !important;
  }
  .main-shell {
    margin-left: 16rem;
    width: calc(100vw - 16rem);
    max-width: calc(100vw - 16rem);
    overflow-x: hidden;
  }
  header.sticky {
    position: sticky;
  }
  .main-shell main {
    margin-top: 0;
  }
}