:root {
  --av-green: #1f6f5c;
  --av-green-dark: #185948;
}

body {
  font-size: 0.95rem;
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
}

[data-bs-theme="dark"] .app-nav {
  background: linear-gradient(90deg, #0c352c, #124b3d);
}

[data-bs-theme="dark"] .card {
  border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .table {
  --bs-table-bg: transparent;
}

[data-bs-theme="dark"] .btn-outline-secondary {
  --bs-btn-color: #ced4da;
  --bs-btn-border-color: #6c757d;
}

[data-bs-theme="dark"] .alert-secondary,
[data-bs-theme="dark"] .alert-light {
  background-color: #212529;
  border-color: #343a40;
  color: #dee2e6;
}

.app-nav {
  background: linear-gradient(90deg, var(--av-green-dark), var(--av-green));
}

.app-nav .nav-link {
  color: rgba(255, 255, 255, 0.85);
}

.app-nav .nav-link:hover {
  color: #fff;
}

.card {
  border-radius: 0.6rem;
}

.table > :not(caption) > * > * {
  padding: 0.45rem 0.5rem;
}

.stat-card .display-6 {
  font-size: 1.7rem;
  line-height: 1.2;
}

.badge-status {
  font-weight: 500;
}

.master-card {
  border-left: 4px solid var(--av-green);
}

textarea {
  min-height: 80px;
}

.obs-error { border-left: 4px solid #dc3545; }
.obs-warning { border-left: 4px solid #ffc107; }
.obs-info { border-left: 4px solid #0dcaf0; }
.obs-critical { border-left: 4px solid #6f42c1; }

.tiny {
  font-size: 0.78rem;
}

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
}

/* Theme switch */
.theme-switch .form-check-input,
.theme-switch .form-check-label {
  cursor: pointer;
}

.theme-switch .form-check-input {
  width: 2.2em;
  height: 1.1em;
}

.app-nav .theme-switch {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.brand-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 991.98px) {
  .brand-truncate {
    max-width: 46vw;
  }
}

.app-nav .theme-switch .form-check-input {
  background-color: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.6);
}

.app-nav .theme-switch .form-check-input:checked {
  background-color: #ffc107;
  border-color: #ffc107;
}

.app-nav .theme-switch .form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

/* Mobile bottom navigation */
.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1035;
  display: flex;
  background: var(--bs-body-bg);
  border-top: 1px solid var(--bs-border-color);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  padding: 0.4rem 0.2rem;
  font-size: 0.68rem;
  color: var(--bs-secondary-color);
  text-decoration: none;
}

.mobile-nav a i {
  font-size: 1.2rem;
}

.mobile-nav a.active {
  color: var(--av-green);
  font-weight: 600;
}

[data-bs-theme="dark"] .mobile-nav a.active {
  color: #4fd1a5;
}

@media (max-width: 991.98px) {
  main {
    padding-bottom: 5.2rem !important;
  }

  .navbar-brand {
    font-size: 1rem;
  }

  h1.h4 {
    font-size: 1.15rem;
  }

  .table > :not(caption) > * > * {
    padding: 0.4rem 0.35rem;
  }
}

@media (max-width: 575.98px) {
  .card-body {
    padding: 0.85rem;
  }

  .stat-card .display-6 {
    font-size: 1.35rem;
  }
}
