:root {
  --mf-green: #5f7317;
  --mf-green-dark: #34450d;
  --mf-green-soft: #eef4df;
  --mf-gold: #d6a313;
  --mf-gold-dark: #a97900;
  --mf-ink: #24251f;
  --mf-muted: #68705f;
  --mf-line: #dfe6d3;
  --mf-surface: #ffffff;
  --mf-soft: #f8faef;
}

html {
  min-height: 100%;
  font-size: 15px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  min-height: 100vh;
  color: var(--mf-ink);
  background:
    linear-gradient(180deg, rgba(238, 244, 223, 0.95), rgba(255, 255, 255, 0.96) 45%),
    #fff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  display: flex;
  flex-direction: column;
}

.app-container {
  max-width: 1080px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 1020;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--mf-line);
  backdrop-filter: blur(14px);
}

.app-brand {
  display: inline-flex;
  align-items: center;
  color: var(--mf-green-dark);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0;
}

.nav-brand-group {
  display: inline-flex;
  align-items: center;
}

.navbar-toggler {
  padding: 0.35rem;
  border: 0;
  border-radius: 0;
  margin-right: 0.65rem;
}

.navbar-toggler:focus {
  box-shadow: none;
}

.nav-link {
  color: var(--mf-muted);
  font-weight: 600;
}

.nav-link:hover,
.nav-link:focus {
  color: var(--mf-green-dark);
}

.app-main {
  flex: 1 0 auto;
  width: 100%;
  padding-top: 0.75rem;
  padding-bottom: 1.5rem;
}

.app-footer {
  padding: 1rem 0 calc(1rem + env(safe-area-inset-bottom));
  color: var(--mf-muted);
  background: #fff;
  border-top: 1px solid var(--mf-line);
}

.app-footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  text-align: center;
}

.app-version-text {
  font-size: 0.78rem;
  line-height: 1.2;
}

.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--mf-green);
  --bs-btn-border-color: var(--mf-green);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--mf-green-dark);
  --bs-btn-hover-border-color: var(--mf-green-dark);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--mf-green-dark);
  --bs-btn-active-border-color: var(--mf-green-dark);
}

.btn-outline-primary {
  --bs-btn-color: var(--mf-green-dark);
  --bs-btn-border-color: var(--mf-green);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--mf-green);
  --bs-btn-hover-border-color: var(--mf-green);
}

.form-control,
.form-select {
  min-height: 48px;
  border-color: var(--mf-line);
  border-radius: 8px;
}

.form-check-input:checked {
  background-color: var(--mf-green);
  border-color: var(--mf-green);
}

.btn:focus,
.btn:active:focus,
.nav-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--mf-green);
  box-shadow: 0 0 0 0.2rem rgba(95, 115, 23, 0.18);
}

.auth-wrap {
  display: grid;
  gap: 1.25rem;
  align-items: center;
  min-height: calc(100vh - 142px);
  padding: 0.25rem 0;
}

.auth-wrap-centered {
  display: flex;
  justify-content: center;
}

.auth-card,
.panel {
  background: var(--mf-surface);
  border: 1px solid var(--mf-line);
  border-radius: 8px;
  box-shadow: 0 16px 45px rgba(52, 69, 13, 0.1);
}

.auth-card {
  width: min(100%, 430px);
  padding: 0.9rem;
}

.login-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 0.55rem;
}

.login-brand img {
  display: block;
  width: min(100%, 168px);
  height: auto;
}

.brand-mark {
  display: inline-grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #fff;
  background: var(--mf-green);
  border-radius: 8px;
  font-weight: 800;
}

.login-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 0.5rem;
  place-items: center;
  color: var(--mf-green-dark);
  background: #fff;
  border: 3px solid var(--mf-gold);
  border-radius: 50%;
  box-shadow: 0 14px 34px rgba(95, 115, 23, 0.16);
}

.login-icon svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.app-link {
  color: var(--mf-green-dark);
  text-decoration-color: var(--mf-gold);
  text-underline-offset: 0.2rem;
}

.app-link:hover,
.app-link:focus {
  color: var(--mf-gold-dark);
}

.login-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.welcome-copy {
  color: var(--mf-muted);
}

.section-kicker {
  color: var(--mf-gold-dark);
}

.spinner-border {
  color: var(--mf-green);
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.stat-tile {
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--mf-line);
  border-radius: 8px;
}

.stat-value {
  color: var(--mf-green-dark);
  font-size: 1.45rem;
  font-weight: 800;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.action-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 1rem;
  color: var(--mf-ink);
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--mf-line);
  border-radius: 8px;
}

.action-tile:hover,
.action-tile:focus {
  color: var(--mf-green-dark);
  border-color: var(--mf-gold);
}

.install-step {
  display: flex;
  gap: 0.85rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--mf-line);
}

.install-step:last-child {
  border-bottom: 0;
}

.step-number {
  flex: 0 0 auto;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #fff;
  background: var(--mf-green);
  border-radius: 50%;
  font-weight: 700;
}

.splash-screen {
  display: grid;
  min-height: calc(100vh - 168px);
  place-items: center;
  text-align: center;
}

.splash-logo {
  display: grid;
  width: 88px;
  height: 88px;
  margin: 0 auto 1rem;
  place-items: center;
  color: #fff;
  background: var(--mf-green);
  border-radius: 22px;
  font-size: 2rem;
  font-weight: 900;
  box-shadow: 0 18px 42px rgba(95, 115, 23, 0.22);
}

.splash-brand-logo {
  display: block;
  width: min(78vw, 320px);
  height: auto;
  margin: 0 auto 1.5rem;
}

.update-banner {
  position: sticky;
  top: 57px;
  z-index: 1010;
  padding: 0.75rem 0;
  color: #fff;
  background: var(--mf-green-dark);
}

.install-banner {
  position: sticky;
  top: 57px;
  z-index: 1009;
  padding: 0.75rem 0;
  color: #fff;
  background: var(--mf-green);
}

.app-modal {
  border-radius: 8px;
}

@media (min-width: 768px) {
  .app-main {
    padding-top: 2rem;
  }

  .auth-card {
    padding: 1.75rem;
  }

  .login-brand {
    margin-bottom: 1.25rem;
  }

  .login-brand img {
    width: min(100%, 230px);
  }

  .login-icon {
    width: 84px;
    height: 84px;
    margin-bottom: 1rem;
  }

  .login-icon svg {
    width: 48px;
    height: 48px;
  }

  .action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .navbar-toggler {
    margin-right: 0.65rem;
  }
}

@media (max-width: 575.98px) {
  .navbar {
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
  }

  .app-main {
    padding-top: 0.4rem;
    padding-bottom: 0.75rem;
  }

  .app-footer {
    padding-top: 0.55rem;
  }

  .auth-card .mb-3 {
    margin-bottom: 0.5rem !important;
  }

  .auth-card .mb-4 {
    margin-bottom: 0.65rem !important;
  }

  .auth-card .mt-4 {
    margin-top: 0.7rem !important;
  }

  .login-links {
    font-size: 0.86rem;
  }

  .auth-card h1 {
    font-size: 1.2rem;
    margin-bottom: 0.55rem !important;
  }

  .auth-card .welcome-copy {
    margin-bottom: 0.75rem !important;
  }

  .form-label {
    margin-bottom: 0.18rem;
    font-size: 0.9rem;
  }

  .form-control,
  .form-select {
    min-height: 40px;
    padding-top: 0.38rem;
    padding-bottom: 0.38rem;
  }

  .btn {
    --bs-btn-padding-y: 0.38rem;
  }
}
