/* Synchronize system dark mode preference when no explicit data-theme is set */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg-body: #0f172a;
    --color-surface: #1e293b;
    --color-surface-alt: #0f172a;
    --color-primary: #93c5fd;
    --color-primary-dark: #60a5fa;
    --color-secondary: #fbbf24;
    --color-text-main: #f8fafc;
    --color-text-muted: #cbd5e1;
    --color-border: #334155;
    --color-nav-bg: rgba(15, 23, 42, 0.88);
    --color-tag-bg: rgba(147, 197, 253, 0.12);
    --color-hero-start: #0f172a;
    --color-hero-end: #1e293b;
  }
  :root:not([data-theme="light"]) .btn-custom-primary {
    color: #0f172a;
    font-weight: 600;
  }
  :root:not([data-theme="light"]) .btn-outline-dark {
    color: var(--color-text-main);
    border-color: var(--color-border);
  }
  :root:not([data-theme="light"]) .bg-white {
    background-color: #0f172a !important;
  }
  :root:not([data-theme="light"]) .bg-light {
    background-color: #162032 !important;
  }
  :root:not([data-theme="light"]) .text-dark {
    color: var(--color-text-main) !important;
  }
  :root:not([data-theme="light"]) .text-muted {
    color: var(--color-text-muted) !important;
  }
}

/* Grid & utility classes omitted by tree-shaken bootstrap-custom.min.css */
.col-6 {
  flex: 0 0 auto;
  width: 50%;
}
@media (min-width: 768px) {
  .col-md-3 {
    flex: 0 0 auto;
    width: 25%;
  }
  .col-md-4 {
    flex: 0 0 auto;
    width: 33.33333333%;
  }
}
@media (min-width: 992px) {
  .col-lg-5 {
    flex: 0 0 auto;
    width: 41.66666667%;
  }
  .col-lg-7 {
    flex: 0 0 auto;
    width: 58.33333333%;
  }
}
.g-2 {
  --bs-gutter-x: 0.5rem;
  --bs-gutter-y: 0.5rem;
}
.g-3 {
  --bs-gutter-x: 1rem;
  --bs-gutter-y: 1rem;
}
.w-100 {
  width: 100% !important;
}
.p-3 {
  padding: 1rem !important;
}
.mt-1 {
  margin-top: 0.25rem !important;
}
.small {
  font-size: 0.875rem;
}
.h6 {
  font-size: 1rem;
}
.border {
  border-color: var(--color-border) !important;
}
.text-success {
  color: #15803d !important;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .text-success {
    color: #4ade80 !important;
  }
}
:root[data-theme="dark"] .text-success {
  color: #4ade80 !important;
}

/* Header with guaranteed high contrast in both light and dark modes */
.hh-header {
  background: linear-gradient(135deg, #132a13 0%, #1b4332 55%, #2d6a4f 100%);
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.hh-header h1,
.hh-header p {
  color: #ffffff !important;
}

.hh-header .btn-outline-light {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.55) !important;
  font-weight: 600;
}

.hh-header .btn-outline-light:hover,
.hh-header .btn-outline-light:focus-visible {
  background-color: #ffffff !important;
  color: #1b4332 !important;
  border-color: #ffffff !important;
}

.hh-header .btn-light {
  background-color: #ffffff !important;
  color: #132a13 !important;
  border: 1px solid #ffffff !important;
  font-weight: 700;
}

.hh-header .btn-light:hover,
.hh-header .btn-light:focus-visible {
  background-color: #d8f3dc !important;
  color: #081c15 !important;
  border-color: #d8f3dc !important;
}

.hh-badge-demo {
  background-color: rgba(209, 250, 229, 0.18);
  color: #ecfdf5 !important;
  border: 1px solid rgba(209, 250, 229, 0.5);
  padding: 0.45rem 0.85rem;
  font-weight: 600;
}

/* Tabs */
.hh-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 0.75rem;
}

.hh-tab {
  background-color: var(--color-surface);
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.55rem 1.15rem;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.hh-tab:hover {
  border-color: #2d6a4f;
}

.hh-tab.active {
  background-color: #2d6a4f;
  color: #ffffff;
  border-color: #2d6a4f;
}

.btn-outline-secondary {
  color: var(--color-text-main);
  background-color: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  font-weight: 500;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus-visible {
  background-color: #2d6a4f;
  color: #ffffff;
  border-color: #2d6a4f;
}

.project-select-btn.active,
.inv-filter-btn.active {
  background-color: #2d6a4f !important;
  color: #ffffff !important;
  border-color: #2d6a4f !important;
}

/* Goals & Progress */
.hh-goal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  background-color: var(--color-surface-alt);
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: var(--color-text-main);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.hh-goal-item:hover {
  border-color: #52b788;
}

.hh-goal-item.completed .hh-goal-title {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

.hh-progress-track {
  width: 100%;
  height: 10px;
  background-color: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}

.hh-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2d6a4f, #52b788);
  transition: width 0.25s ease;
}

.hh-session-card {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--color-border);
  border-left: 4px solid #2d6a4f;
  background-color: var(--color-surface-alt);
  color: var(--color-text-main);
  border-radius: 0.375rem;
}

.hh-form .form-control {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  background-color: var(--color-surface-alt);
  color: var(--color-text-main);
  font-size: 0.92rem;
}

.hh-form .form-control:focus {
  outline: 2px solid #52b788;
  outline-offset: 1px;
  border-color: #52b788;
}

.hh-form .form-label {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--color-text-main);
}
