html {
  font-size: 14px;
  background-color: #ffffff;
  color-scheme: light;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

:root {
  --scout-green: #2f6b3f;
  --scout-green-dark: #245433;
  --scout-green-soft: #e8f4eb;
  --scout-cream: #f8fbf6;
}

.theme-toggle-btn {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle-btn [data-theme-icon] {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
  display: none;
}

.theme-toggle-btn[data-theme="light"] [data-theme-icon="moon"],
.theme-toggle-btn[data-theme="dark"] [data-theme-icon="sun"] {
  display: block;
}

html[data-theme="dark"] {
  color-scheme: dark;
  background-color: #0f1511;
}

html[data-theme="dark"] body {
  color: #e7ece8;
  background: linear-gradient(180deg, #0f1511 0%, #0f1511 220px);
}

html[data-theme="dark"] .app-header .navbar {
  background-color: rgba(20, 30, 24, 0.96) !important;
  border-color: #32483b !important;
}

html[data-theme="dark"] .navbar-brand,
html[data-theme="dark"] .brand-subtitle,
html[data-theme="dark"] .nav-pills-custom .nav-link {
  color: #dfe9e3 !important;
}

html[data-theme="dark"] .nav-pills-custom .nav-link:hover,
html[data-theme="dark"] .nav-pills-custom .nav-link:focus,
html[data-theme="dark"] .nav-pills-custom .nav-link.active {
  background: rgba(96, 157, 114, 0.24);
  color: #f2f8f4 !important;
}

html[data-theme="dark"] .scout-card,
html[data-theme="dark"] .scout-subtle-panel,
html[data-theme="dark"] .home-hero,
html[data-theme="dark"] .guide-editor-demo,
html[data-theme="dark"] .guide-editor-help,
html[data-theme="dark"] .guide-editor-toolbar,
html[data-theme="dark"] .modal-content {
  background: #1a251f;
  border-color: #30463a;
  color: #e7ece8;
}

html[data-theme="dark"] .text-muted {
  color: #a8bbb0 !important;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .tag-picker,
html[data-theme="dark"] #wysiwyg-editor,
html[data-theme="dark"] .opkomst-content table,
html[data-theme="dark"] #wysiwyg-editor table,
html[data-theme="dark"] .table,
html[data-theme="dark"] .offcanvas,
html[data-theme="dark"] .pagination .page-link {
  background-color: #151f1a;
  border-color: #30463a;
  color: #e7ece8;
}

html[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: #202d25;
  color: #e7ece8;
}

html[data-theme="dark"] #wysiwyg-editor th,
html[data-theme="dark"] #wysiwyg-editor td,
html[data-theme="dark"] .opkomst-content th,
html[data-theme="dark"] .opkomst-content td,
html[data-theme="dark"] .guide-editor-canvas td {
  border-color: #3a5244;
}

html[data-theme="dark"] .editor-toolbar-wrapper,
html[data-theme="dark"] .editor-toolbar .btn,
html[data-theme="dark"] .btn-outline-secondary,
html[data-theme="dark"] .btn-outline-primary,
html[data-theme="dark"] .btn-outline-danger,
html[data-theme="dark"] .btn-outline-success {
  background: #17211b;
  border-color: #3a5244;
  color: #dce8e0;
}

html[data-theme="dark"] .editor-toolbar .btn:hover,
html[data-theme="dark"] .btn-outline-secondary:hover,
html[data-theme="dark"] .btn-outline-primary:hover,
html[data-theme="dark"] .btn-outline-danger:hover,
html[data-theme="dark"] .btn-outline-success:hover {
  background: #223128;
  color: #ffffff;
}

html[data-theme="dark"] .badge.text-bg-light {
  background: #24352b !important;
  color: #e7ece8 !important;
}

html[data-theme="dark"] .opkomst-form-section {
  border-color: #395146;
}

html[data-theme="dark"] .footer {
  border-top-color: #30463a !important;
}

html[data-theme="dark"] a {
  color: #9fddb3;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(47, 107, 63, 0.35);
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
  background: linear-gradient(180deg, #f7fbf7 0%, #ffffff 220px);
}

body > .container {
  flex: 1 0 auto;
  width: 100%;
}

.footer {
  position: static;
  line-height: inherit;
  margin-top: auto;
}

.app-header .navbar {
  background-color: rgba(232, 244, 235, 0.94) !important;
  backdrop-filter: blur(10px);
}

.navbar-brand {
  color: var(--scout-green-dark) !important;
  font-weight: 700;
}

.brand-logo {
  display: inline-flex;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.85rem;
  object-fit: cover;
  border: 2px solid rgba(36, 84, 51, 0.12);
  background: white;
  box-shadow: 0 8px 24px rgba(47, 107, 63, 0.2);
}

.brand-title {
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.brand-subtitle {
  color: #54705e;
}

.nav-pills-custom .nav-link {
  border-radius: 999px;
  padding: 0.55rem 1rem;
  color: #244531;
  font-weight: 600;
}

.nav-pills-custom .nav-link:hover,
.nav-pills-custom .nav-link:focus,
.nav-pills-custom .nav-link.active {
  background: rgba(47, 107, 63, 0.1);
  color: var(--scout-green-dark);
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.group-dot {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: var(--group-color, var(--scout-green));
  border: 1px solid rgba(0, 0, 0, 0.15);
  margin-right: 0.45rem;
  vertical-align: middle;
}

.header-auth-nav {
  width: 100%;
}

#mainNav {
  min-width: 0;
}

.nav-pills-custom {
  flex-wrap: wrap;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header-actions,
.section-actions,
.responsive-input-group,
.action-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.section-actions {
  align-items: center;
  justify-content: space-between;
}

.opkomst-editor-page {
  display: block;
  overflow-x: hidden;
}

.opkomst-form {
  padding: 1rem;
}

.opkomst-form-layout {
  align-items: flex-start;
}

.opkomst-col-main,
.opkomst-col-side {
  min-width: 0;
}

.opkomst-form-main {
  min-width: 0;
}

.opkomst-form-section {
  border-radius: 0.9rem;
}

.opkomst-form-section .form-label {
  font-weight: 600;
}

.opkomst-form-sidebar {
  position: sticky;
  top: 1rem;
}

.opkomst-form-sidebar .tag-picker {
  max-height: 220px;
}

.opkomst-form-actions {
  display: grid;
  gap: 0.6rem;
}

.opkomst-form-actions .btn {
  width: 100%;
}

.opkomst-mobile-actions {
  display: none;
}

.scout-subtle-panel {
  border: 1px solid #dceadf;
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(180deg, rgba(232, 244, 235, 0.75), rgba(255, 255, 255, 0.95));
}

.template-import-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.template-card {
  height: 100%;
}

.template-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  color: #54705e;
  font-size: 0.9rem;
}

.editor-toolbar-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.45rem;
  border: 1px solid #d7e6da;
  border-radius: 0.9rem;
  background: linear-gradient(180deg, #f7fbf8 0%, #eef6f0 100%);
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.editor-toolbar .btn {
  border-radius: 0.6rem !important;
  font-size: 0.8rem;
  padding: 0.35rem 0.62rem;
  min-height: 2rem;
  border-color: #cfe0d4;
  background: #fff;
}

.editor-toolbar .btn:hover,
.editor-toolbar .btn:focus {
  border-color: #98b9a0;
  background: #f3faf5;
}

.editor-toolbar-divider {
  height: 1px;
  background: #d7e6da;
  margin: 0.1rem 0;
}

.editor-toolbar-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #4f6a58;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 0.2rem;
  white-space: nowrap;
}

#wysiwyg-editor {
  border: 1px solid #d4e5d8;
  border-radius: 0.85rem;
  background: #fff;
  line-height: 1.5;
  padding: 0.85rem;
}

#wysiwyg-editor:focus {
  border-color: #8cb59a;
  box-shadow: 0 0 0 0.2rem rgba(47, 107, 63, 0.12);
}

#wysiwyg-editor small,
.opkomst-content small {
  font-size: 0.86em;
}

#wysiwyg-editor big,
.opkomst-content big {
  font-size: 1.18em;
}

.btn-primary {
  background-color: var(--scout-green);
  border-color: var(--scout-green);
}

.btn-primary:hover, .btn-primary:focus {
  background-color: var(--scout-green-dark);
  border-color: var(--scout-green-dark);
}

.scout-card {
  border-color: #d2e6d7;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 30px rgba(36, 84, 51, 0.06);
}

.home-hero {
  background: radial-gradient(circle at top right, rgba(47, 107, 63, 0.14), rgba(255, 255, 255, 0.95) 52%);
}

.home-cta-grid {
  display: grid;
  gap: 0.6rem;
}

#opkomstFilters {
  max-width: 360px;
}

.calendar-grid {
  min-height: 640px;
}

.fc .fc-toolbar-title {
  font-size: 1.1rem;
  color: var(--scout-green-dark);
}

.fc .fc-button-primary {
  background-color: var(--scout-green);
  border-color: var(--scout-green);
}

.fc .fc-button-primary:hover,
.fc .fc-button-primary:focus,
.fc .fc-button-primary:not(:disabled):active {
  background-color: var(--scout-green-dark);
  border-color: var(--scout-green-dark);
}

.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  padding: 0.5rem;
  background: #fff;
}

.tag-chip {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  border: 1px solid #d6e7db;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  background: var(--scout-green-soft);
  color: #244531;
  cursor: pointer;
}

.tag-chip input:checked + span {
  font-weight: 700;
}

.tag-chip input {
  margin-right: 0.2rem;
}

#wysiwyg-editor img,
.opkomst-content img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 0.375rem;
  margin: 0.75rem 0;
}

.opkomst-content {
  overflow-wrap: anywhere;
}

.opkomst-content table {
  display: table;
  width: 100%;
  table-layout: auto;
}

#wysiwyg-editor table,
.opkomst-content table {
  display: table;
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  background: #fff;
}

#wysiwyg-editor th,
#wysiwyg-editor td,
.opkomst-content th,
.opkomst-content td {
  border: 1px solid #d2e6d7;
  padding: 0.5rem 0.6rem;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

#wysiwyg-editor thead,
.opkomst-content thead {
  background: rgba(47, 107, 63, 0.08);
}

.responsive-table td,
.responsive-table th {
  vertical-align: top;
}

.opkomsten-table .opkomst-row td:first-child {
  border-left: 4px solid var(--group-color, var(--scout-green));
}

.editor-image-selected {
  outline: 3px solid rgba(47, 107, 63, 0.35);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Dashboard stat cards + animations */
.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
}

.stat-card {
  border-left: 4px solid var(--scout-green);
  transform: translateY(10px);
  opacity: 0;
  transition: transform 0.45s ease, opacity 0.45s ease;
}

.stat-value {
  font-size: 2rem;
  margin-bottom: 0;
  color: var(--scout-green-dark);
}

.stat-highlight {
  transform: translateY(10px);
  opacity: 0;
  transition: transform 0.5s ease, opacity 0.5s ease;
}

[data-dashboard-animate="true"].is-visible .stat-card,
[data-dashboard-animate="true"].is-visible .stat-highlight {
  transform: translateY(0);
  opacity: 1;
}

/* Guide visual editor demo */
.guide-editor-demo {
  border: 1px solid #dceadf;
  border-radius: 0.9rem;
  background: #fff;
  overflow: hidden;
}

.guide-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem;
  border-bottom: 1px solid #e2eee5;
  background: #f7fbf8;
}

.guide-editor-body {
  display: grid;
  grid-template-columns: 2fr 1fr;
}

.guide-editor-canvas {
  padding: 0.9rem;
  min-height: 220px;
  transition: box-shadow 0.25s ease;
}

.guide-editor-canvas table {
  width: 100%;
  border-collapse: collapse;
}

.guide-editor-canvas td {
  border: 1px solid #d2e6d7;
  padding: 0.5rem;
  cursor: pointer;
}

.guide-editor-canvas td.is-active {
  outline: 3px solid rgba(47, 107, 63, 0.35);
  background: #eef8f1;
}

.guide-editor-help {
  border-left: 1px solid #e2eee5;
  padding: 0.9rem;
  background: #fbfdfb;
  color: #355745;
}

.guide-demo-warning {
  box-shadow: inset 0 0 0 3px rgba(220, 53, 69, 0.35);
}

.tocht-generator-config {
  border: 1px solid #d7e6da;
  border-radius: 0.85rem;
  padding: 0.85rem;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.7);
}

.tocht-preview-canvas {
  width: 100%;
  max-width: 100%;
  border: 1px solid #d2e6d7;
  border-radius: 0.75rem;
  background: #ffffff;
}

html[data-theme="dark"] .tocht-generator-config {
  border-color: #3a5244;
  background: #18221c;
}

html[data-theme="dark"] .tocht-preview-canvas {
  border-color: #3a5244;
  background: #ffffff;
}

.app-header .navbar-toggler {
  border: 1px solid rgba(36, 84, 51, 0.35);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 0.65rem;
  padding: 0.4rem 0.55rem;
}

.app-header .navbar-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(47, 107, 63, 0.25);
}

.app-header .navbar-toggler-icon {
  width: 1.2rem;
  height: 1.2rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2836,84,51,0.95%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

html[data-theme="dark"] .app-header .navbar-toggler {
  border-color: #5f8f70;
  background: #244531;
}

html[data-theme="dark"] .app-header .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28242,248,244,0.96%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

@media (max-width: 991.98px) {
  .navbar > .container {
    align-items: flex-start;
  }

  #mainNav {
    width: 100%;
    padding-top: 0.75rem;
  }

  .nav-pills-custom {
    gap: 0.5rem;
  }

  .nav-pills-custom .nav-link {
    display: block;
  }

  .header-actions {
    margin-top: 1rem;
    width: 100%;
  }

  .header-auth-nav .nav-item,
  .header-auth-nav form,
  .header-auth-nav .btn {
    width: 100%;
  }

  .opkomst-form-sidebar {
    position: static;
  }
}

@media (max-width: 767.98px) {
  .scout-card {
    padding: 1rem;
  }

  .row {
    overflow-x: hidden;
  }

  .page-header,
  .page-header-actions,
  .section-actions,
  .responsive-input-group,
  .action-buttons {
    flex-direction: column;
    align-items: stretch;
    overflow-x: hidden;
  }

  .page-header .btn,
  .page-header-actions .btn,
  .section-actions .btn,
  .responsive-input-group .btn,
  .action-buttons .btn {
    width: 100%;
  }

  .tag-picker {
    max-height: none;
  }

  .opkomst-form {
    padding: 0.85rem;
    overflow-x: hidden;
  }

  .opkomst-form-layout {
    gap: 0.85rem !important;
    overflow-x: hidden;
  }

  .opkomst-form-main {
    gap: 0.85rem !important;
    min-width: 0;
    overflow-x: hidden;
  }

  .opkomst-form-section {
    padding: 0.75rem 0.8rem;
    border-radius: 0.75rem;
    overflow-x: hidden;
  }

  .opkomst-form-section h2 {
    font-size: 1rem;
  }

  .opkomst-col-side {
    order: 2;
    overflow-x: hidden;
  }

  .opkomst-col-main {
    order: 1;
    overflow-x: hidden;
  }

  .form-control,
  .form-select,
  .input-group {
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .ai-generate-group {
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .ai-generate-group .form-control {
    min-width: 0;
    flex: 1 1 100%;
  }

  .opkomst-form-actions {
    display: none;
  }

  .opkomst-mobile-actions {
    display: grid;
    gap: 0.55rem;
  }

  .opkomst-mobile-actions .btn {
    width: 100%;
  }

  .template-import-panel {
    grid-template-columns: 1fr;
  }

  .home-cta-grid .btn {
    width: 100%;
  }

  .editor-toolbar-wrapper {
    padding: 0.4rem;
    border-radius: 0.75rem;
    overflow-x: hidden;
  }

  .editor-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.1rem;
    overflow-y: hidden;
  }

  .editor-toolbar .btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  #wysiwyg-editor {
    min-height: 180px !important;
    font-size: 0.95rem;
    padding: 0.7rem;
    overflow-x: hidden;
    max-width: 100%;
  }

  #wysiwyg-editor table,
  .opkomst-content table {
    display: table;
    width: 100%;
    table-layout: auto;
    overflow-x: auto;
  }

  #wysiwyg-editor th,
  #wysiwyg-editor td,
  .opkomst-content th,
  .opkomst-content td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: calc(100vw - 2rem);
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table tr {
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid #d2e6d7;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 8px 20px rgba(36, 84, 51, 0.08);
  }

  .responsive-table td {
    border: 0;
    padding: 0.35rem 0 !important;
    text-align: left !important;
  }

  .opkomsten-table.responsive-table tr {
    margin-bottom: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.75rem;
    border-left: 4px solid var(--group-color, var(--scout-green));
  }

  .opkomsten-table.responsive-table td {
    padding: 0.22rem 0 !important;
    font-size: 0.92rem;
  }

  .opkomsten-table .action-buttons {
    gap: 0.4rem;
  }

  .opkomsten-table .btn {
    padding: 0.3rem 0.55rem;
    font-size: 0.82rem;
  }

  .calendar-grid {
    min-height: 520px;
  }

  .fc .fc-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }

  .fc .fc-toolbar-title {
    font-size: 1rem;
    text-align: center;
  }

  .responsive-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.2rem;
    color: #54705e;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .responsive-table td form,
  .responsive-table td form .btn {
    display: block;
    width: 100%;
  }

  .guide-editor-body {
    grid-template-columns: 1fr;
  }

  .guide-editor-help {
    border-left: 0;
    border-top: 1px solid #e2eee5;
  }
}

@media (max-width: 575.98px) {
  .app-header .navbar {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .navbar-brand {
    max-width: calc(100% - 4rem);
    gap: 0.75rem !important;
    align-items: flex-start !important;
  }

  .brand-logo {
    width: 2.25rem;
    height: 2.25rem;
  }

  .brand-title {
    font-size: 0.95rem;
  }

  .brand-subtitle {
    display: block;
    max-width: 13rem;
    white-space: normal;
    font-size: 0.8rem;
  }

  .editor-toolbar .btn {
    flex: 0 0 auto;
  }

  body {
    overflow-x: hidden;
  }

  body > .container {
    overflow-x: hidden;
    max-width: 100vw;
  }
}

html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
  transition: background-color 220ms ease, color 220ms ease, border-color 220ms ease, fill 220ms ease, box-shadow 220ms ease;
}

html[data-theme="dark"] .table {
  --bs-table-color: #e7ece8;
  --bs-table-bg: #151f1a;
  --bs-table-border-color: #3a5244;
  --bs-table-striped-bg: #202d25;
  --bs-table-striped-color: #e7ece8;
  --bs-table-hover-bg: #24352c;
  --bs-table-hover-color: #f2f6f3;
}

html[data-theme="dark"] .table > :not(caption) > * > * {
  background-color: var(--bs-table-bg);
  color: var(--bs-table-color);
  border-bottom-color: var(--bs-table-border-color);
}

html[data-theme="dark"] .table thead th {
  background-color: #1e2b23;
  color: #f2f6f3;
  border-bottom-color: #425a4b;
}

html[data-theme="dark"] .table-responsive {
  border-color: #30463a;
}

html[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: #202d25;
  color: #e7ece8;
}

html[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(even) > * {
  background-color: #18221c;
  color: #e7ece8;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .card-body,
html[data-theme="dark"] .offcanvas,
html[data-theme="dark"] .modal-content {
  background-color: #1a251f;
  color: #e7ece8;
  border-color: #30463a;
}

/* Better placeholder contrast in dark mode */
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder,
html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] .form-select::placeholder {
  color: #9db2a6 !important;
  opacity: 1;
}

/* Stronger table surfaces for pages like Opkomsten/UserManager */
html[data-theme="dark"] .table,
html[data-theme="dark"] .table > :not(caption) > * > * {
  background-color: #151f1a !important;
  color: #e7ece8 !important;
  border-color: #3a5244 !important;
}

html[data-theme="dark"] .table thead th {
  background-color: #1e2b23 !important;
  color: #f2f6f3 !important;
  border-color: #425a4b !important;
}

html[data-theme="dark"] .responsive-table tr {
  background: #18221c !important;
  border-color: #3a5244 !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22) !important;
}

html[data-theme="dark"] .responsive-table td::before {
  color: #9db2a6 !important;
}

/* FullCalendar dark mode (Agenda tab) */
html[data-theme="dark"] .fc,
html[data-theme="dark"] .fc .fc-scrollgrid,
html[data-theme="dark"] .fc-theme-standard td,
html[data-theme="dark"] .fc-theme-standard th {
  border-color: #3a5244 !important;
}

html[data-theme="dark"] .fc .fc-scrollgrid,
html[data-theme="dark"] .fc .fc-daygrid-day-frame,
html[data-theme="dark"] .fc .fc-col-header-cell,
html[data-theme="dark"] .fc .fc-timegrid-slot,
html[data-theme="dark"] .fc .fc-list,
html[data-theme="dark"] .fc .fc-list-table,
html[data-theme="dark"] .fc .fc-list-day-cushion,
html[data-theme="dark"] .fc .fc-daygrid-day,
html[data-theme="dark"] .fc .fc-daygrid-body {
  background-color: #151f1a !important;
  color: #e7ece8 !important;
}

html[data-theme="dark"] .fc .fc-toolbar-title,
html[data-theme="dark"] .fc .fc-col-header-cell-cushion,
html[data-theme="dark"] .fc .fc-daygrid-day-number,
html[data-theme="dark"] .fc .fc-list-day-text,
html[data-theme="dark"] .fc .fc-list-day-side-text,
html[data-theme="dark"] .fc .fc-list-event-time,
html[data-theme="dark"] .fc .fc-list-event-title,
html[data-theme="dark"] .fc .fc-timegrid-axis-cushion,
html[data-theme="dark"] .fc .fc-timegrid-slot-label-cushion {
  color: #e7ece8 !important;
}

html[data-theme="dark"] .fc .fc-day-today {
  background: rgba(96, 157, 114, 0.18) !important;
}

html[data-theme="dark"] .fc .fc-list-event:hover td,
html[data-theme="dark"] .fc .fc-daygrid-day:hover {
  background: #223128 !important;
}

html[data-theme="dark"] .tag-chip {
  background: #1e2c24;
  color: #e7ece8;
  border-color: #3c5648;
}

html[data-theme="dark"] .tag-chip input {
  accent-color: #7ad198;
}

html[data-theme="dark"] .tag-chip input:checked + span {
  color: #c5f0d1;
}

html[data-theme="dark"] .guide-editor-canvas {
  background: #17211b;
  color: #e7ece8;
}

html[data-theme="dark"] .guide-editor-canvas td.is-active {
  background: #274036;
  color: #f2f6f3;
  outline-color: rgba(122, 209, 152, 0.55);
}

html[data-theme="dark"] .guide-editor-help {
  background: #1a251f;
  color: #d9e6de;
  border-color: #3a5244;
}

html[data-theme="dark"] .guide-editor-toolbar .btn {
  background: #1a251f;
  border-color: #3a5244;
  color: #dce8e0;
}

html[data-theme="dark"] .guide-editor-toolbar .btn:hover,
html[data-theme="dark"] .guide-editor-toolbar .btn:focus,
html[data-theme="dark"] .guide-editor-toolbar .btn:active {
  background: #24352b;
  color: #ffffff;
  border-color: #4a6657;
}

html[data-theme="dark"] .guide-demo-warning {
  box-shadow: inset 0 0 0 3px rgba(255, 140, 158, 0.45);
}

@media (min-width: 992px) {
  .header-auth-nav {
    width: auto;
  }

  .nav-pills-custom {
    column-gap: 0.45rem;
    row-gap: 0.45rem;
  }

  .nav-pills-custom .nav-link {
    padding: 0.45rem 0.8rem;
    font-size: 0.95rem;
  }
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    color-scheme: dark;
    background-color: #0f1511;
  }

  html:not([data-theme]) body {
    color: #e7ece8;
    background-color: #0f1511;
    background-image: linear-gradient(180deg, #0f1511 0%, #0f1511 220px);
  }
}

/* AI Modal Styling */
.ai-modal-btn {
  font-size: 1.1rem;
}

#aiPreviewTitle, #aiPreviewDescription, #aiPreviewLocation {
  white-space: pre-wrap;
  word-break: break-word;
}

html[data-theme="dark"] #aiPreview {
  background: #17211b;
}

html[data-theme="dark"] #aiPreview .alert-info {
  background-color: #1e2c24;
  border-color: #3a5244;
  color: #d9e6de;
}

html[data-theme="dark"] #aiPreviewTitle,
html[data-theme="dark"] #aiPreviewDescription,
html[data-theme="dark"] #aiPreviewLocation {
  background-color: #0f1511 !important;
  color: #e7ece8 !important;
  border-color: #3a5244 !important;
}

html[data-theme="dark"] #aiPrompt {
  background-color: #151f1a;
  border-color: #30463a;
  color: #e7ece8;
}

html[data-theme="dark"] .modal-content {
  background-color: #1a251f;
  color: #e7ece8;
}

html[data-theme="dark"] .modal-header {
  border-bottom-color: #3a5244;
}

html[data-theme="dark"] .modal-footer {
  border-top-color: #3a5244;
}

.ai-generate-group {
  flex-wrap: nowrap;
}

.ai-generate-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  padding: 0.8rem 1rem;
  border-width: 2px;
  white-space: nowrap;
}

.ai-generate-btn .ai-generate-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.ai-generate-btn .ai-generate-text {
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

html[data-theme="dark"] .ai-generate-btn {
  background: #2f6b3f;
  border-color: #4b9860;
  color: #f5fff8;
}

html[data-theme="dark"] .ai-generate-btn:hover,
html[data-theme="dark"] .ai-generate-btn:focus {
  background: #378149;
  border-color: #63b07a;
  color: #ffffff;
}

@media (max-width: 576px) {
  .ai-generate-group {
    flex-wrap: wrap;
  }

  .ai-generate-group .form-control {
    width: 100%;
    flex: 1 0 100%;
  }

  .ai-generate-btn {
    width: 100%;
    justify-content: center;
  }
}
