/* ==========================================================================
   Mental Health Chatbot — design system
   --------------------------------------------------------------------------
   Loaded on every page. Bootstrap 5.3 is kept for its JS components (collapse,
   dropdown, modal, popover); everything visual is defined here.

   Bootstrap's "info" colour is remapped to the brand teal, because the existing
   templates use .btn-info / .text-info / .border-info throughout.
   ========================================================================== */

/* ----- Tokens -------------------------------------------------------------- */

:root {
  color-scheme: light;

  /* Brand — a calm, clinical teal */
  --brand: #0d7f74;
  --brand-strong: #0a635a;
  --brand-deep: #073f39;
  --brand-soft: #e7f4f2;
  --brand-softer: #f2f9f8;
  --brand-ring: rgba(13, 127, 116, 0.26);

  /* Warm secondary, used for large calm surfaces */
  --sand: #f6f2ea;
  --sand-deep: #ece5d8;

  /* Neutrals */
  --bg: #f7faf9;
  --surface: #ffffff;
  --surface-2: #f4f7f6;
  --surface-3: #eaf0ee;
  --border: #e2e9e7;
  --border-strong: #cfdad7;
  --heading: #0e1c21;
  --text: #1d3037;
  --text-muted: #5f747b;
  --text-faint: #8798a0;

  /* Semantic */
  --danger: #c22d2d;
  --danger-strong: #9d2020;
  --danger-soft: #fdeded;
  --success: #14794a;
  --success-soft: #e8f6ee;
  --warning: #a06a08;
  --warning-soft: #fdf3e3;

  /* Shape + depth */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(14, 40, 45, 0.06);
  --shadow-sm: 0 1px 3px rgba(14, 40, 45, 0.07), 0 1px 2px rgba(14, 40, 45, 0.04);
  --shadow-md: 0 6px 16px -4px rgba(14, 40, 45, 0.1), 0 2px 6px rgba(14, 40, 45, 0.05);
  --shadow-lg: 0 20px 44px -16px rgba(14, 40, 45, 0.2), 0 6px 14px -8px rgba(14, 40, 45, 0.1);
  --ring: 0 0 0 3px var(--brand-ring);

  /* Type */
  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;

  --nav-h: 68px;
}

html[data-bs-theme="dark"] {
  color-scheme: dark;

  --brand: #4fd1c0;
  --brand-strong: #6fe0d0;
  --brand-deep: #b9f2ea;
  --brand-soft: #13322f;
  --brand-softer: #0f2726;
  --brand-ring: rgba(79, 209, 192, 0.3);

  --sand: #211f1b;
  --sand-deep: #2b2823;

  --bg: #0e1417;
  --surface: #151e22;
  --surface-2: #1a2429;
  --surface-3: #212d33;
  --border: #26343a;
  --border-strong: #35474e;
  --heading: #eaf2f0;
  --text: #d6e2e0;
  --text-muted: #94a8ad;
  --text-faint: #74898f;

  --danger: #f37878;
  --danger-strong: #f9a1a1;
  --danger-soft: #33191a;
  --success: #5cc98d;
  --success-soft: #14291f;
  --warning: #e0aa54;
  --warning-soft: #2b2113;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 6px 18px -4px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 22px 48px -16px rgba(0, 0, 0, 0.7);
}

/* ----- Base --------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  /* Column flex + margin-top:auto on the footer keeps it pinned to the bottom
     on short pages without any fixed positioning. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Soft ambient wash — keeps large empty pages from feeling flat */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 30rem at 12% -8%, var(--brand-softer), transparent 70%),
    radial-gradient(48rem 26rem at 108% 6%, var(--sand), transparent 68%);
  opacity: 0.9;
}

html[data-bs-theme="dark"] body::before {
  opacity: 0.5;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--heading);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
}

.display-title {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.08;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--brand);
  text-decoration-color: color-mix(in srgb, var(--brand) 35%, transparent);
  text-underline-offset: 0.18em;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--brand-strong);
}

hr {
  height: 1px;
  margin: 1.5rem 0;
  border: 0;
  background: var(--border);
  opacity: 1;
}

img {
  max-width: 100%;
  height: auto;
}

::selection {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--r-xs);
}

.text-muted {
  color: var(--text-muted) !important;
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 3px solid transparent;
  border-radius: var(--r-pill);
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
  background-clip: content-box;
}

/* ----- Layout helpers ----------------------------------------------------- */

.page {
  width: 100%;
  max-width: 68rem;
  margin: 0 auto;
  padding: clamp(1.75rem, 4vw, 3.5rem) 1.25rem clamp(3rem, 6vw, 5rem);
}

.page--narrow {
  max-width: 44rem;
}

.page--wide {
  max-width: 82rem;
}

.page-head {
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
}

.page-head__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  padding: 0.3rem 0.7rem 0.3rem 0.55rem;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.page-head__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.9rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.page-head__lead {
  max-width: 46rem;
  margin: 0;
  font-size: 1.075rem;
  color: var(--text-muted);
}

.stack > * + * {
  margin-top: var(--stack-gap, 1rem);
}

/* ----- Navigation --------------------------------------------------------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 1030;
  min-height: var(--nav-h);
  padding: 0.6rem 0;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.site-nav > .container-fluid {
  max-width: 82rem;
  gap: 1rem;
  padding-inline: clamp(1rem, 3vw, 2rem);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0;
  color: var(--heading);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand:hover {
  color: var(--heading);
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.7rem;
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow-sm);
  flex: none;
}

.brand__mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand__sub {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-faint);
}

.site-nav .navbar-nav {
  align-items: center;
  gap: 0.15rem;
}

.site-nav .nav-link {
  position: relative;
  padding: 0.48rem 0.85rem;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 0.925rem;
  font-weight: 550;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.site-nav .nav-link:hover,
.site-nav .nav-link:focus-visible {
  color: var(--heading);
  background: var(--surface-2);
}

.site-nav .nav-link.is-active {
  color: var(--brand-deep);
  background: var(--brand-soft);
  font-weight: 650;
}

html[data-bs-theme="dark"] .site-nav .nav-link.is-active {
  color: var(--brand);
}

/* SOS gets deliberate, unmissable emphasis */
.nav-sos {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.48rem 0.95rem !important;
  border-radius: var(--r-pill) !important;
  background: var(--danger);
  color: #fff !important;
  font-weight: 650 !important;
  box-shadow: var(--shadow-xs);
}

.nav-sos:hover,
.nav-sos:focus-visible {
  background: var(--danger-strong) !important;
  color: #fff !important;
  transform: translateY(-1px);
}

.nav-sos::before {
  content: "";
  width: 0.44rem;
  height: 0.44rem;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: sos-pulse 2.4s ease-out infinite;
}

@keyframes sos-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
  }
  70%,
  100% {
    box-shadow: 0 0 0 0.5rem rgba(255, 255, 255, 0);
  }
}

.navbar-toggler {
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.navbar-toggler:focus {
  box-shadow: var(--ring);
}

.navbar-toggler-icon {
  width: 1.1em;
  height: 1.1em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30' stroke='%235f747b' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M4 8h22M4 15h22M4 22h22'/%3E%3C/svg%3E");
}

html[data-bs-theme="dark"] .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30' stroke='%2394a8ad' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M4 8h22M4 15h22M4 22h22'/%3E%3C/svg%3E");
}

/* Theme toggle */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--heading);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.theme-toggle svg {
  width: 1.05rem;
  height: 1.05rem;
}

.theme-toggle .icon-sun {
  display: none;
}

html[data-bs-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

html[data-bs-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* ----- Buttons ------------------------------------------------------------ */

.btn {
  --bs-btn-padding-y: 0.6rem;
  --bs-btn-padding-x: 1.15rem;
  --bs-btn-font-size: 0.95rem;
  --bs-btn-font-weight: 600;
  --bs-btn-border-radius: var(--r-sm);
  letter-spacing: -0.005em;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background-color 0.15s ease,
    border-color 0.15s ease, color 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-lg {
  --bs-btn-padding-y: 0.8rem;
  --bs-btn-padding-x: 1.6rem;
  --bs-btn-font-size: 1.02rem;
  --bs-btn-border-radius: var(--r-md);
}

.btn-sm {
  --bs-btn-padding-y: 0.4rem;
  --bs-btn-padding-x: 0.8rem;
  --bs-btn-font-size: 0.85rem;
}

/* Brand (remaps Bootstrap "info") */
.btn-info {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--brand-strong);
  --bs-btn-hover-border-color: var(--brand-strong);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--brand-strong);
  --bs-btn-active-border-color: var(--brand-strong);
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--brand);
  --bs-btn-disabled-border-color: var(--brand);
  box-shadow: var(--shadow-sm);
}

html[data-bs-theme="dark"] .btn-info {
  --bs-btn-color: #06231f;
  --bs-btn-hover-color: #06231f;
  --bs-btn-active-color: #06231f;
  --bs-btn-disabled-color: #06231f;
}

.btn-info:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-info:active {
  transform: translateY(1px);
}

.btn-outline-info {
  --bs-btn-color: var(--brand-deep);
  --bs-btn-border-color: var(--border-strong);
  --bs-btn-bg: var(--surface);
  --bs-btn-hover-color: var(--brand-deep);
  --bs-btn-hover-bg: var(--brand-soft);
  --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-color: var(--brand-deep);
  --bs-btn-active-bg: var(--brand-soft);
  --bs-btn-active-border-color: var(--brand);
}

html[data-bs-theme="dark"] .btn-outline-info {
  --bs-btn-color: var(--brand);
  --bs-btn-hover-color: var(--brand-deep);
  --bs-btn-active-color: var(--brand-deep);
}

.btn-outline-secondary {
  --bs-btn-color: var(--text);
  --bs-btn-border-color: var(--border-strong);
  --bs-btn-bg: var(--surface);
  --bs-btn-hover-color: var(--heading);
  --bs-btn-hover-bg: var(--surface-2);
  --bs-btn-hover-border-color: var(--text-faint);
  --bs-btn-active-color: var(--heading);
  --bs-btn-active-bg: var(--surface-3);
  --bs-btn-active-border-color: var(--text-faint);
}

.btn-secondary {
  --bs-btn-color: var(--heading);
  --bs-btn-bg: var(--surface-3);
  --bs-btn-border-color: var(--border-strong);
  --bs-btn-hover-color: var(--heading);
  --bs-btn-hover-bg: var(--border);
  --bs-btn-hover-border-color: var(--text-faint);
}

.btn-danger {
  --bs-btn-bg: var(--danger);
  --bs-btn-border-color: var(--danger);
  --bs-btn-hover-bg: var(--danger-strong);
  --bs-btn-hover-border-color: var(--danger-strong);
  --bs-btn-active-bg: var(--danger-strong);
  --bs-btn-active-border-color: var(--danger-strong);
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
}

.btn-outline-danger {
  --bs-btn-color: var(--danger);
  --bs-btn-border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  --bs-btn-bg: transparent;
  --bs-btn-hover-color: var(--danger-strong);
  --bs-btn-hover-bg: var(--danger-soft);
  --bs-btn-hover-border-color: var(--danger);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--danger);
  --bs-btn-active-border-color: var(--danger);
}

.btn-outline-success {
  --bs-btn-color: var(--success);
  --bs-btn-border-color: color-mix(in srgb, var(--success) 38%, var(--border));
  --bs-btn-bg: var(--surface);
  --bs-btn-hover-color: var(--success);
  --bs-btn-hover-bg: var(--success-soft);
  --bs-btn-hover-border-color: var(--success);
  --bs-btn-active-color: var(--success);
  --bs-btn-active-bg: var(--success-soft);
  --bs-btn-active-border-color: var(--success);
}

/* Oversized call to action */
.btn-hero {
  --bs-btn-padding-y: 0.95rem;
  --bs-btn-padding-x: 2.1rem;
  --bs-btn-font-size: 1.06rem;
  --bs-btn-border-radius: var(--r-md);
  gap: 0.55rem;
  display: inline-flex;
  align-items: center;
}

.btn-hero svg {
  width: 1.1rem;
  height: 1.1rem;
}

/* ----- Surfaces ----------------------------------------------------------- */

.card,
.surface {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card {
  --bs-card-bg: var(--surface);
  --bs-card-border-color: var(--border);
  --bs-card-border-radius: var(--r-lg);
  --bs-card-inner-border-radius: var(--r-lg);
  --bs-card-color: var(--text);
}

.surface--pad {
  padding: clamp(1.35rem, 3vw, 2.1rem);
}

.surface--lift {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.surface--lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
  gap: 1.1rem;
}

.feature__icon {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: 1rem;
  border-radius: var(--r-md);
  background: var(--brand-soft);
  color: var(--brand-deep);
}

html[data-bs-theme="dark"] .feature__icon {
  color: var(--brand);
}

.feature__icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.feature h3 {
  font-size: 1.06rem;
  margin-bottom: 0.4rem;
}

.feature p {
  margin: 0;
  font-size: 0.94rem;
  color: var(--text-muted);
}

/* ----- Forms -------------------------------------------------------------- */

.form-control-label,
.form-label,
form label:not(.form-check-label) {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--heading);
  font-size: 0.9rem;
  font-weight: 600;
}

.form-control,
.form-select {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background-color: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control-lg,
.form-select-lg {
  padding: 0.8rem 1rem;
  font-size: 1rem;
  border-radius: var(--r-sm);
}

.form-control::placeholder {
  color: var(--text-faint);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--brand);
  background-color: var(--surface);
  color: var(--text);
  box-shadow: var(--ring);
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--danger);
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent);
}

.invalid-feedback {
  font-size: 0.85rem;
  color: var(--danger);
}

textarea.form-control {
  min-height: 8rem;
  line-height: 1.65;
  resize: vertical;
}

fieldset,
legend {
  border: 0;
  padding: 0;
  margin: 0;
}

/* Legacy legend styling from the templates, restyled */
legend {
  float: none;
  width: auto;
  font-family: var(--font-display) !important;
  font-size: clamp(1.8rem, 4vw, 2.3rem) !important;
  font-weight: 600 !important;
  color: var(--heading);
  letter-spacing: -0.02em;
  border: 0 !important;
  margin-bottom: 1.5rem !important;
}

.form-check-input {
  width: 1.1em;
  height: 1.1em;
  margin-top: 0.25em;
  border: 1px solid var(--border-strong);
  background-color: var(--surface);
}

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

.form-check-input:focus {
  border-color: var(--brand);
  box-shadow: var(--ring);
}

.form-check-label {
  color: var(--text);
  font-size: 0.95rem;
}

input[type="file"].form-control-file {
  display: block;
  width: 100%;
  padding: 0.85rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
}

input[type="file"].form-control-file:hover {
  border-color: var(--brand);
  background: var(--brand-softer);
}

/* Auth split card */
.auth {
  display: grid;
  place-items: center;
  min-height: calc(100vh - var(--nav-h));
  padding: clamp(1.5rem, 4vw, 3rem) 1.25rem;
}

.auth__card {
  display: grid;
  grid-template-columns: 0.85fr 1fr;
  width: 100%;
  max-width: 58rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.auth__aside {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 2rem;
  color: #fff;
  background: linear-gradient(160deg, var(--brand-strong), var(--brand-deep));
  overflow: hidden;
}

.auth__aside img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.28;
  mix-blend-mode: luminosity;
}

.auth__aside-body {
  position: relative;
}

.auth__aside blockquote {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  line-height: 1.35;
}

.auth__aside p {
  margin: 0;
  font-size: 0.88rem;
  opacity: 0.85;
}

.auth__body {
  padding: clamp(1.75rem, 4vw, 2.75rem);
}

@media (max-width: 767.98px) {
  .auth__card {
    grid-template-columns: 1fr;
  }
  .auth__aside {
    min-height: 9rem;
    padding: 1.25rem;
  }
  .auth__aside blockquote {
    font-size: 1.1rem;
  }
}

/* ----- Flash messages ----------------------------------------------------- */

.flash-stack {
  position: fixed;
  top: calc(var(--nav-h) + 0.75rem);
  left: 50%;
  z-index: 1080;
  display: grid;
  gap: 0.5rem;
  width: min(30rem, calc(100vw - 2rem));
  transform: translateX(-50%);
  pointer-events: none;
}

.flash-stack .alert {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-size: 0.93rem;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: flash-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes flash-in {
  from {
    opacity: 0;
    transform: translateY(-0.6rem) scale(0.98);
  }
}

.flash-stack .alert::before {
  content: "";
  flex: none;
  width: 0.3rem;
  align-self: stretch;
  margin: -0.85rem 0 -0.85rem -1rem;
  border-radius: var(--r-md) 0 0 var(--r-md);
  background: var(--brand);
}

.flash-stack .alert-success::before {
  background: var(--success);
}
.flash-stack .alert-danger::before {
  background: var(--danger);
}
.flash-stack .alert-warning::before {
  background: var(--warning);
}
.flash-stack .alert-info::before {
  background: var(--brand);
}

.flash-stack .btn-close {
  margin-left: auto;
  padding: 0.25rem;
  opacity: 0.5;
}

.flash-stack .btn-close:hover {
  opacity: 1;
}

/* ----- Bootstrap component polish ---------------------------------------- */

.dropdown-menu {
  --bs-dropdown-bg: var(--surface);
  --bs-dropdown-border-color: var(--border);
  --bs-dropdown-border-radius: var(--r-md);
  --bs-dropdown-link-color: var(--text);
  --bs-dropdown-link-hover-bg: var(--brand-soft);
  --bs-dropdown-link-hover-color: var(--brand-deep);
  --bs-dropdown-link-active-bg: var(--brand);
  --bs-dropdown-link-active-color: #fff;
  --bs-dropdown-padding-y: 0.4rem;
  max-height: 22rem;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.dropdown-item {
  padding: 0.5rem 0.85rem;
  border-radius: var(--r-xs);
  font-size: 0.925rem;
  width: auto;
  margin-inline: 0.35rem;
}

.modal-content {
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.modal-header,
.modal-footer {
  border-color: var(--border);
  padding: 1.15rem 1.5rem;
}

.modal-body {
  padding: 0.5rem 1.5rem 1.25rem;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
}

.btn-close {
  --bs-btn-close-focus-shadow: var(--ring);
}

html[data-bs-theme="dark"] .btn-close {
  filter: invert(1) grayscale(1) brightness(2);
}

.popover {
  --bs-popover-bg: var(--surface);
  --bs-popover-border-color: var(--border);
  --bs-popover-border-radius: var(--r-md);
  --bs-popover-header-bg: var(--surface-2);
  --bs-popover-body-color: var(--text-muted);
  --bs-popover-max-width: 22rem;
  box-shadow: var(--shadow-lg);
  font-family: var(--font-sans);
}

.popover-header {
  color: var(--heading);
  font-weight: 650;
  border-bottom-color: var(--border);
}

/* ----- Footer ------------------------------------------------------------- */

.site-footer {
  margin-top: auto;
  padding: 2.5rem 1.25rem 2rem;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  max-width: 82rem;
  margin: 0 auto;
}

.site-footer__note {
  max-width: 34rem;
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  font-size: 0.88rem;
}

.site-footer__links a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer__links a:hover {
  color: var(--brand);
}

/* Safety banner — appears above the footer on content pages */
.safety-note {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  max-width: 82rem;
  margin: 0 auto;
  padding: 1rem 1.15rem;
  border: 1px solid color-mix(in srgb, var(--danger) 22%, var(--border));
  border-radius: var(--r-md);
  background: var(--danger-soft);
  font-size: 0.9rem;
  color: var(--text);
}

.safety-note svg {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.15rem;
  color: var(--danger);
}

.safety-note a {
  color: var(--danger-strong);
  font-weight: 650;
}

/* ----- About page --------------------------------------------------------- */

.about-intro {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  align-items: center;
  gap: clamp(1.75rem, 4vw, 3.25rem);
}

.about-intro__media {
  display: grid;
  place-items: center;
  padding: clamp(1.25rem, 3vw, 2rem);
  border-radius: var(--r-xl);
  background: linear-gradient(150deg, var(--brand-soft), var(--sand));
}

html[data-bs-theme="dark"] .about-intro__media {
  background: linear-gradient(150deg, #14403a, #211f1b);
}

.about-intro__media img {
  width: 100%;
  max-width: 15rem;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  border: 5px solid var(--surface);
  box-shadow: var(--shadow-md);
  background: #000;
}

.callout {
  display: flex;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--r-sm);
  background: var(--brand-softer);
}

.callout svg {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.2rem;
  color: var(--brand);
}

.callout p {
  margin: 0;
  font-size: 0.93rem;
}

@media (max-width: 767.98px) {
  .about-intro {
    grid-template-columns: 1fr;
  }
}

/* ----- Helplines (SOS page) ---------------------------------------------- */

.helpline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.1rem;
}

.helpline {
  padding: 1.35rem 1.4rem;
  border: 1px solid var(--border);
  border-top: 3px solid var(--danger);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.helpline:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.helpline__name {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
  font-weight: 650;
}

.helpline__meta {
  margin: 0 0 0.9rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.helpline__tel {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--r-pill);
  background: var(--danger);
  color: #fff;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.helpline__tel:hover {
  background: var(--danger-strong);
  color: #fff;
}

.helpline__tel svg {
  width: 0.95rem;
  height: 0.95rem;
}

.helpline__alt {
  margin: 0.55rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.helpline__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 0.9rem;
  font-size: 0.86rem;
}

/* ----- Journal ----------------------------------------------------------- */

.journal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.journal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 1.15rem;
}

.journal-card {
  display: flex;
  flex-direction: column;
  padding: 1.35rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.journal-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.journal-card__mood {
  display: inline-flex;
  align-self: flex-start;
  padding: 0.28rem 0.7rem;
  margin-bottom: 0.75rem;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 0.8rem;
  font-weight: 650;
  text-decoration: none;
}

html[data-bs-theme="dark"] .journal-card__mood {
  color: var(--brand);
}

.journal-card__date {
  margin: 0 0 0.6rem;
  font-size: 0.8rem;
  color: var(--text-faint);
}

.journal-card__excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0 0 1.15rem;
  font-size: 0.93rem;
  color: var(--text-muted);
}

.journal-card__foot {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.journal-card__foot img {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.journal-card__author {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
}

.journal-entry__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding-top: 1.25rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.journal-entry__body {
  font-size: 1.04rem;
  line-height: 1.8;
  white-space: pre-line;
}

.pagination-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  margin-top: 2.5rem;
}

.pagination-row .btn {
  min-width: 2.5rem;
}

/* Empty state */
.empty-state {
  padding: clamp(2.5rem, 6vw, 4rem) 1.5rem;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.empty-state__icon {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  margin: 0 auto 1.15rem;
  border-radius: var(--r-md);
  background: var(--brand-soft);
  color: var(--brand-deep);
}

html[data-bs-theme="dark"] .empty-state__icon {
  color: var(--brand);
}

.empty-state__icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

/* ----- Account ----------------------------------------------------------- */

.profile-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  padding: clamp(1.35rem, 3vw, 2rem);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: linear-gradient(140deg, var(--brand-softer), var(--surface) 60%);
  box-shadow: var(--shadow-sm);
}

html[data-bs-theme="dark"] .profile-card {
  background: linear-gradient(140deg, #12302c, var(--surface) 65%);
}

.profile-card__avatar {
  width: 6rem;
  height: 6rem;
  border-radius: var(--r-lg);
  object-fit: cover;
  border: 3px solid var(--surface);
  box-shadow: var(--shadow-md);
}

.profile-card__name {
  margin: 0 0 0.15rem;
  font-size: 1.3rem;
}

.profile-card__email {
  margin: 0 0 0.15rem;
  color: var(--text-muted);
  font-size: 0.93rem;
}

.profile-card__id {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--text-faint);
}

.profile-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-left: auto;
}

.danger-zone {
  margin-top: 2.5rem;
  padding: 1.35rem 1.4rem;
  border: 1px solid color-mix(in srgb, var(--danger) 25%, var(--border));
  border-radius: var(--r-md);
  background: var(--danger-soft);
}

.danger-zone h2 {
  font-size: 1.02rem;
  margin-bottom: 0.35rem;
}

.danger-zone p {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.danger-zone__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* ----- Error pages ------------------------------------------------------- */

.error-page {
  display: grid;
  place-items: center;
  min-height: calc(100vh - var(--nav-h) - 8rem);
  padding: 3rem 1.25rem;
  text-align: center;
}

.error-page__code {
  font-family: var(--font-display);
  font-size: clamp(4.5rem, 16vw, 8rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--brand);
  opacity: 0.22;
}

.error-page__title {
  margin-top: -0.5rem;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}

.error-page p {
  max-width: 32rem;
  margin-inline: auto;
  color: var(--text-muted);
}

/* ----- Hero (home page) --------------------------------------------------- */

.hero {
  padding: clamp(2.25rem, 6vw, 5rem) 1.25rem clamp(1.5rem, 4vw, 3rem);
}

.hero__inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: clamp(2rem, 5vw, 4rem);
  max-width: 82rem;
  margin: 0 auto;
}

.hero__title {
  font-size: clamp(2.4rem, 6vw, 4rem);
  margin-bottom: 1.1rem;
}

.hero__accent {
  color: var(--brand);
  font-style: italic;
}

.hero__lead {
  max-width: 34rem;
  margin-bottom: 1.9rem;
  font-size: 1.1rem;
  color: var(--text-muted);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.hero__trust {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.hero__trust li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.hero__trust svg {
  flex: none;
  width: 1rem;
  height: 1rem;
  color: var(--brand);
}

/* Visual */
.hero__visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 24rem;
}

.hero__orb {
  position: absolute;
  inset: 8% 6%;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--brand-soft), var(--sand));
  filter: blur(0.5px);
}

html[data-bs-theme="dark"] .hero__orb {
  background: linear-gradient(150deg, #14403a, #211f1b);
}

.hero__portrait {
  position: relative;
  width: min(20rem, 62%);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  border: 6px solid var(--surface);
  box-shadow: var(--shadow-lg);
  background: #000;
}

.hero__chip {
  position: absolute;
  display: grid;
  gap: 0.1rem;
  max-width: 15rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: chip-float 6s ease-in-out infinite;
}

.hero__chip strong {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--brand-deep);
}

html[data-bs-theme="dark"] .hero__chip strong {
  color: var(--brand);
}

.hero__chip span {
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.hero__chip--a {
  top: 6%;
  right: -2%;
  border-bottom-right-radius: var(--r-xs);
}

.hero__chip--b {
  bottom: 5%;
  left: -4%;
  border-bottom-left-radius: var(--r-xs);
  animation-delay: 1.6s;
}

@keyframes chip-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-0.5rem);
  }
}

@media (max-width: 991.98px) {
  .hero__inner {
    grid-template-columns: 1fr;
  }

  .hero__visual {
    order: -1;
    min-height: 17rem;
  }

  .hero__portrait {
    width: min(14rem, 52%);
  }

  .hero__chip {
    max-width: 12rem;
  }

  .hero__chip--a {
    right: 0;
  }

  .hero__chip--b {
    left: 0;
  }

  .hero__lead {
    margin-inline: auto;
  }
}

@media (max-width: 575.98px) {
  .hero__chip {
    display: none;
  }
}

/* "or" divider used inside the entry modal */
.entry-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.15rem 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.entry-divider::before,
.entry-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ----- Motion ------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
