html {
  font-size: 14px;
}

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

html {
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-bottom: 0;
}

body > .container {
  flex: 1 0 auto;
}

.footer {
  flex-shrink: 0;
}

html.dark body {
  background-color: #111827;
  color: #f9fafb;
}

html.dark .navbar,
html.dark .card,
html.dark .footer {
  background-color: #1f2937 !important;
  color: #f9fafb;
}

html.dark .text-dark {
  color: #f9fafb !important;
}

html.dark .text-muted {
  color: #9ca3af !important;
}

html.dark .border-bottom,
html.dark .border-top {
  border-color: #374151 !important;
}

html.dark .navbar-light .navbar-toggler-icon {
  filter: invert(1);
}

html.dark .navbar-brand {
  color: #f9fafb !important;
}

html.dark .btn-outline-secondary {
  color: #d1d5db;
  border-color: #6b7280;
}

html.dark .btn-outline-secondary:hover {
  background-color: #374151;
  color: #f9fafb;
}

html.dark .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

html.dark .form-control {
  background-color: #1f2937;
  border-color: #4b5563;
  color: #f9fafb;
}

html.dark .form-control:focus {
  background-color: #1f2937;
  color: #f9fafb;
}

.nav-link.active {
  font-weight: 600;
  text-decoration: underline;
}

/* ── Dark mode: comprehensive overrides ─────────────────────────── */

/* Tables */
html.dark .table,
html.dark .table-striped {
  color: #f9fafb;
}

html.dark .table thead th {
  background-color: #1f2937;
  color: #e5e7eb;
  border-color: #374151;
}

html.dark .table td,
html.dark .table th {
  border-color: #374151;
  color: #f9fafb;
}

html.dark .table-striped > tbody > tr:nth-of-type(odd) {
  background-color: rgba(255, 255, 255, 0.03);
  color: #f9fafb;
}

html.dark .table-striped > tbody > tr:nth-of-type(even) {
  background-color: #1f2937;
}

html.dark .table-sm td,
html.dark .table-sm th {
  color: #f9fafb;
}

/* Alerts */
html.dark .alert-secondary {
  background-color: #374151;
  border-color: #4b5563;
  color: #e5e7eb;
}

html.dark .alert-success {
  background-color: #064e3b;
  border-color: #065f46;
  color: #a7f3d0;
}

html.dark .alert-danger {
  background-color: #7f1d1d;
  border-color: #991b1b;
  color: #fecaca;
}

html.dark .alert-warning {
  background-color: #78350f;
  border-color: #92400e;
  color: #fde68a;
}

/* Form select */
html.dark .form-select {
  background-color: #1f2937;
  border-color: #4b5563;
  color: #f9fafb;
}

/* List group */
html.dark .list-group-item {
  background-color: #1f2937;
  border-color: #374151;
  color: #f9fafb;
}

html.dark .list-group-item-action:hover,
html.dark .list-group-item-action:focus {
  background-color: #374151;
  color: #f9fafb;
}

/* Nav pills (admin nav) */
html.dark .nav-pills .nav-link {
  color: #9ca3af;
}

html.dark .nav-pills .nav-link:hover {
  color: #e5e7eb;
}

html.dark .nav-pills .nav-link.active {
  background-color: #2563eb;
  color: #ffffff;
}

/* Code / pre */
html.dark code,
html.dark pre {
  background-color: #1f2937;
  color: #e5e7eb;
}

/* bg-white override (navbar, etc.) */
html.dark .bg-white {
  background-color: #1f2937 !important;
}

/* Links */
html.dark a {
  color: #60a5fa;
}

html.dark a:hover {
  color: #93c5fd;
}

html.dark .btn-outline-primary {
  color: #60a5fa;
  border-color: #60a5fa;
}

html.dark .btn-outline-primary:hover {
  background-color: #1e40af;
  color: #ffffff;
  border-color: #1e40af;
}

html.dark .btn-outline-danger {
  color: #f87171;
  border-color: #f87171;
}

html.dark .btn-outline-danger:hover {
  background-color: #991b1b;
  color: #ffffff;
  border-color: #991b1b;
}

/* Page-level classes (PolicyTuning, PolicyEventDetail, ChatSessionDetail) */
html.dark .page {
  color: #f9fafb;
}

html.dark .muted {
  color: #9ca3af;
}

html.dark .empty-state {
  color: #9ca3af;
}

/* Chat transcript (ChatSessionDetail) */
html.dark .chat-transcript {
  color: #f9fafb;
}

html.dark .chat-message-label {
  color: #e5e7eb;
}

html.dark .chat-message-body {
  color: #f9fafb;
}

html.dark .chat-message-meta {
  color: #9ca3af;
}

/* Card deep overrides */
html.dark .card-header {
  background-color: #1f2937;
  border-color: #374151;
  color: #f9fafb;
}

html.dark .card-body {
  background-color: #1f2937;
  color: #f9fafb;
}

html.dark .card-title {
  color: #f9fafb;
}

html.dark .card-text {
  color: #e5e7eb;
}

html.dark .card {
  border-color: #374151;
}

/* Log container (overrides inline style in Logs.cshtml) */
html.dark .log-container {
  background-color: #111827 !important;
  border-color: #374151 !important;
  color: #f9fafb;
}

/* Dropdown */
html.dark .dropdown-menu {
  background-color: #1f2937;
  border-color: #374151;
}

html.dark .dropdown-item {
  color: #e5e7eb;
}

html.dark .dropdown-item:hover,
html.dark .dropdown-item:focus {
  background-color: #374151;
  color: #f9fafb;
}

/* Input group */
html.dark .input-group-text {
  background-color: #374151;
  border-color: #4b5563;
  color: #e5e7eb;
}

/* Modal */
html.dark .modal-content {
  background-color: #1f2937;
  border-color: #374151;
  color: #f9fafb;
}

html.dark .modal-header {
  border-color: #374151;
}

html.dark .modal-footer {
  border-color: #374151;
}
