/* ============================================
   Mønstrene Bag — TCM i Praksis
   Dark & Light Design — v2 Airy Hub
   ============================================ */

:root {
  /* Dark theme (default) */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a25;
  --bg-card-hover: #222233;
  --bg-elevated: #252535;

  --text-primary: #f0ece4;
  --text-secondary: #a09b90;
  --text-muted: #6b6760;
  --text-accent: #c8a96e;

  --accent-gold: #c8a96e;
  --accent-gold-dim: rgba(200, 169, 110, 0.15);
  --accent-gold-glow: rgba(200, 169, 110, 0.08);

  --border-subtle: rgba(200, 169, 110, 0.08);
  --border-light: rgba(200, 169, 110, 0.15);
  --border-active: rgba(200, 169, 110, 0.3);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-card: 0 2px 12px rgba(0,0,0,0.3);
  --shadow-elevated: 0 8px 32px rgba(0,0,0,0.4);

  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Inter', -apple-system, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Illustration palette — muted, one thread across app */
  --ill-jade: #5fa87e;       /* element accents: duset grøn */
  --ill-rose: #b87a7a;       /* duset rosa */
  --ill-indigo: #7a9ab5;     /* duset indigo */
  --ill-amber: #c09963;      /* duset amber */
  --ill-silver: #8cabba;     /* duset blå-grå */
  /* Element colors — used for accent dots, always with opacity */
  --el-wood: #5aa870;
  --el-fire: #c07070;
  --el-earth: #b8913f;
  --el-metal: #8eaabc;
  --el-water: #5d84b8;
  /* Neutral ink palette — the structural red thread */
  --ink-deep: 80, 112, 160;      /* r,g,b triplet — brug rgba(var(--ink-deep), x) */
  --ink-soft: 122, 154, 181;
  --ink-glow: 196, 213, 226;
}

/* Light theme */
[data-theme="light"] {
  --bg-primary: #f5f2ec;
  --bg-secondary: #eae6de;
  --bg-card: #ffffff;
  --bg-card-hover: #f0ece4;
  --bg-elevated: #e8e4db;

  --text-primary: #1a1815;
  --text-secondary: #5a554d;
  --text-muted: #8a857d;
  --text-accent: #9a7b3c;

  --accent-gold: #9a7b3c;
  --accent-gold-dim: rgba(154, 123, 60, 0.12);
  --accent-gold-glow: rgba(154, 123, 60, 0.06);

  --border-subtle: rgba(154, 123, 60, 0.1);
  --border-light: rgba(154, 123, 60, 0.2);
  --border-active: rgba(154, 123, 60, 0.35);

  --shadow-card: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-elevated: 0 8px 32px rgba(0,0,0,0.08);

  /* Light mode illustration palette — deeper, still muted */
  --ill-jade: #4a8a5f;
  --ill-rose: #a56868;
  --ill-indigo: #5a80a5;
  --ill-amber: #9a7c3a;
  --ill-silver: #6a8598;
  --el-wood: #4a8a5f;
  --el-fire: #b06060;
  --el-earth: #9a7c3a;
  --el-metal: #6a8598;
  --el-water: #4d6f9c;
  /* Neutral ink — lidt mørkere i lyst tema for kontrast */
  --ink-deep: 60, 88, 126;
  --ink-soft: 90, 124, 154;
  --ink-glow: 140, 170, 190;
}

/* ============================================
   Reset & Base
   ============================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.6;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

/* ============================================
   Screens
   ============================================ */

.screen {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
}

.screen.active {
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Hero — Home Screen
   ============================================ */

.hero {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.home-brand {
  text-align: center;
  padding: 28px 24px 8px;
}

.home-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.home-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-top-btn {
  width: 40px;
  height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--text-secondary);
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

.home-top-btn:hover {
  opacity: 0.7;
}

.home-top-btn .hamburger-line {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--text-secondary);
  border-radius: 1px;
}

.home-top-bar .home-brand-title {
  flex: 1;
  margin-bottom: 0;
}

body.is-screen-home .top-float-btn {
  display: none;
}

.home-brand-title {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: 2px;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.home-brand-subtitle {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ============================================
   Home Hub — Navigation Grid
   ============================================ */

.home-hub {
  flex: 1;
  padding: 32px 20px 100px;
}

.home-intro {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 32px;
  padding: 0 8px;
}

.hub-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Decorative Chinese character breathing elements */
.hub-breath {
  text-align: center;
  padding: 12px 0;
}

.breath-char {
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  font-size: 44px;
  font-weight: 300;
  color: var(--accent-gold);
  opacity: 0.55;
  letter-spacing: 8px;
}

.hub-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: left;
  font-family: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.hub-card:hover,
.hub-card:active {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

.hub-card-illustration {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  color: var(--accent-gold);
}

.hub-card-illustration svg {
  width: 100%;
  height: 100%;
}

/* Global SVG grammar for illustrations — the red thread */
.hub-card-illustration svg *,
.bottom-nav svg *,
.hamburger-link svg *,
.section-illustration svg *,
.top-float-btn svg *,
.home-top-btn svg * {
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hub-card-text {
  flex: 1;
  min-width: 0;
}

.hub-card-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.hub-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.hub-card-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.hub-card:hover .hub-card-arrow {
  opacity: 1;
  color: var(--accent-gold);
}

/* ============================================
   Section Screen Headers
   ============================================ */

.section-screen-header {
  padding: calc(64px + var(--safe-top)) 20px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  text-align: center;
}

.section-screen-header .back-btn {
  margin-bottom: 8px;
}

.section-screen-title-area {
  text-align: center;
}

.section-screen-illustration {
  width: 300px;
  height: 180px;
  margin: 0 auto 16px;
  opacity: 1;
}

.section-screen-illustration svg {
  width: 100%;
  height: 100%;
}

/* Illustration animations */
@keyframes pulse-glow {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 0.95; transform: scale(1.25); }
}

@keyframes float-drift {
  0%, 100% { transform: translateY(0); opacity: 0.55; }
  50% { transform: translateY(-8px); opacity: 1; }
}

@keyframes snake-sway {
  0%, 100% { transform: translateX(-4px); }
  50%      { transform: translateX(4px); }
}

@keyframes ray-sway {
  0%, 100% { transform: rotate(-2deg); }
  50%      { transform: rotate(2deg); }
}

@keyframes rotate-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes dash-flow {
  to { stroke-dashoffset: -40; }
}

@keyframes ripple-expand {
  0% { r: 2; opacity: 0.6; }
  100% { r: 18; opacity: 0; }
}

@keyframes orbit {
  from { transform: rotate(0deg) translateX(22px) rotate(0deg); }
  to { transform: rotate(360deg) translateX(22px) rotate(-360deg); }
}

@keyframes orbit-wide {
  from { transform: rotate(0deg) translateX(38px) rotate(0deg); }
  to { transform: rotate(360deg) translateX(38px) rotate(-360deg); }
}

@keyframes orbit-mid {
  from { transform: rotate(0deg) translateX(28px) rotate(0deg); }
  to { transform: rotate(360deg) translateX(28px) rotate(-360deg); }
}

@keyframes shimmer-line {
  0% { stroke-dashoffset: 60; opacity: 0.15; }
  50% { opacity: 0.5; }
  100% { stroke-dashoffset: -60; opacity: 0.15; }
}

@keyframes wave-drift {
  0%, 100% { d: path("M0 30 Q25 20 50 30 Q75 40 100 30"); }
  50% { d: path("M0 30 Q25 38 50 30 Q75 22 100 30"); }
}

/* Practice — ripple & thread animations */
.section-ill-practice .ripple {
  animation: ripple-expand 3s ease-out infinite;
}
.section-ill-practice .ripple:nth-child(2) { animation-delay: 1s; }
.section-ill-practice .ripple:nth-child(3) { animation-delay: 2s; }
.section-ill-practice .ripple:nth-child(4) { animation-delay: 0.5s; }
.section-ill-practice .ripple:nth-child(5) { animation-delay: 1.5s; }
.section-ill-practice .ripple:nth-child(6) { animation-delay: 2.5s; }

.section-ill-practice .thread {
  stroke-dasharray: 12 8;
  animation: shimmer-line 4s ease-in-out infinite;
}
.section-ill-practice .thread:nth-child(8) { animation-delay: 0.8s; }
.section-ill-practice .thread:nth-child(9) { animation-delay: 1.6s; }

.section-ill-practice .glow {
  animation: pulse-glow 3.5s ease-in-out infinite;
}
.section-ill-practice .glow:nth-child(11) { animation-delay: 1.2s; }

/* Organs — orbiting particles */
.section-ill-organs .orbit-particle {
  transform-origin: 100px 60px;
  animation: orbit-wide 12s linear infinite;
}
.section-ill-organs .orbit-particle:nth-of-type(2) { animation: orbit-mid 9s linear infinite reverse; transform-origin: 100px 60px; }
.section-ill-organs .orbit-particle:nth-of-type(3) { animation: orbit 7s linear infinite; transform-origin: 100px 60px; }

.section-ill-organs .ring-glow {
  animation: pulse-glow 5s ease-in-out infinite;
}
.section-ill-organs .ring-glow:nth-of-type(2) { animation-delay: 1.8s; }
.section-ill-organs .ring-glow:nth-of-type(3) { animation-delay: 3.2s; }

.section-ill-organs .center-glow {
  animation: pulse-glow 4s ease-in-out infinite;
}

/* Elements — floating nodes with flowing connections */
.section-ill-elements .el-node {
  animation: float-drift 4s ease-in-out infinite;
}
.section-ill-elements .el-node:nth-of-type(2) { animation-delay: 0.8s; }
.section-ill-elements .el-node:nth-of-type(3) { animation-delay: 1.6s; }
.section-ill-elements .el-node:nth-of-type(4) { animation-delay: 2.4s; }
.section-ill-elements .el-node:nth-of-type(5) { animation-delay: 3.2s; }

.section-ill-elements .cycle-line {
  stroke-dasharray: 8 6;
  animation: dash-flow 3.5s linear infinite;
}
.section-ill-elements .cycle-line:nth-of-type(2) { animation-delay: 0.7s; }
.section-ill-elements .cycle-line:nth-of-type(3) { animation-delay: 1.4s; }
.section-ill-elements .cycle-line:nth-of-type(4) { animation-delay: 2.1s; }
.section-ill-elements .cycle-line:nth-of-type(5) { animation-delay: 2.8s; }

/* Meridians — flowing paths with pulsing nodes */
.section-ill-meridians .flow-path {
  stroke-dasharray: 6 5;
  animation: shimmer-line 3.5s ease-in-out infinite;
}
.section-ill-meridians .flow-path:nth-of-type(2) { animation-delay: 0.5s; animation-duration: 4s; }
.section-ill-meridians .flow-path:nth-of-type(3) { animation-delay: 1s; animation-duration: 3s; }
.section-ill-meridians .flow-path:nth-of-type(4) { animation-delay: 1.5s; animation-duration: 4.5s; }
.section-ill-meridians .flow-path:nth-of-type(5) { animation-delay: 0.3s; animation-duration: 3.2s; }
.section-ill-meridians .flow-path:nth-of-type(6) { animation-delay: 0.8s; animation-duration: 3.8s; }

.section-ill-meridians .node-glow {
  animation: pulse-glow 3s ease-in-out infinite;
}
.section-ill-meridians .node-glow:nth-of-type(2) { animation-delay: 0.6s; }
.section-ill-meridians .node-glow:nth-of-type(3) { animation-delay: 1.2s; }
.section-ill-meridians .node-glow:nth-of-type(4) { animation-delay: 1.8s; }
.section-ill-meridians .node-glow:nth-of-type(5) { animation-delay: 2.4s; }

/* Overviews — gentle shimmer */
.section-ill-overviews .ov-card {
  animation: pulse-glow 4s ease-in-out infinite;
}
.section-ill-overviews .ov-card:nth-of-type(2) { animation-delay: 1s; }
.section-ill-overviews .ov-card:nth-of-type(3) { animation-delay: 2s; }
.section-ill-overviews .ov-card:nth-of-type(4) { animation-delay: 3s; }

/* Hub card + section illustration animations
   --- Stabilitet på iOS standalone (Add to Home Screen) ---
   - will-change: giver GPU-hint så animations altid starter konsekvent
   - animation-fill-mode: both → første og sidste frame er låst fra start
   - -webkit-animation fallback: ældre WebKit respekterer kun prefixed form */
.hub-card-illustration .hub-anim,
.section-screen-illustration .hub-anim {
  -webkit-animation: pulse-glow 4s ease-in-out infinite both;
  animation: pulse-glow 4s ease-in-out infinite both;
  transform-origin: center;
  transform-box: fill-box;
  will-change: transform, opacity;
}
.hub-card-illustration .hub-orbit,
.section-screen-illustration .hub-orbit {
  -webkit-animation: orbit 10s linear infinite both;
  animation: orbit 10s linear infinite both;
  will-change: transform;
}
.hub-card-illustration .hub-drift,
.section-screen-illustration .hub-drift {
  -webkit-animation: float-drift var(--dur, 3.5s) ease-in-out infinite both;
  animation: float-drift var(--dur, 3.5s) ease-in-out infinite both;
  -webkit-animation-delay: var(--delay, 0s);
  animation-delay: var(--delay, 0s);
  transform-origin: center;
  transform-box: fill-box;
  will-change: transform, opacity;
}
.hub-card-illustration .hub-flow,
.section-screen-illustration .hub-flow {
  stroke-dasharray: 8 6;
  -webkit-animation: dash-flow 1.8s linear infinite both;
  animation: dash-flow 1.8s linear infinite both;
  will-change: stroke-dashoffset;
}
.section-screen-illustration .hub-snake {
  -webkit-animation: snake-sway 6s ease-in-out infinite both;
  animation: snake-sway 6s ease-in-out infinite both;
  -webkit-animation-delay: var(--delay, 0s);
  animation-delay: var(--delay, 0s);
  will-change: transform;
}
.section-screen-illustration .ray-sway {
  -webkit-animation: ray-sway 7s ease-in-out infinite both;
  animation: ray-sway 7s ease-in-out infinite both;
  will-change: transform;
}

/* Respektér brugerens valg om reduceret bevægelse — men behold
   en blid opacity-fade så illustrationerne stadig "ånder" subtilt */
@media (prefers-reduced-motion: reduce) {
  .hub-card-illustration .hub-anim,
  .section-screen-illustration .hub-anim,
  .hub-card-illustration .hub-drift,
  .section-screen-illustration .hub-drift {
    -webkit-animation: gentle-fade 5s ease-in-out infinite both;
    animation: gentle-fade 5s ease-in-out infinite both;
    transform: none !important;
  }
  .hub-card-illustration .hub-flow,
  .section-screen-illustration .hub-flow,
  .section-screen-illustration .hub-snake,
  .section-screen-illustration .ray-sway,
  .hub-card-illustration .hub-orbit,
  .section-screen-illustration .hub-orbit {
    -webkit-animation: none;
    animation: none;
    transform: none !important;
  }
}

@keyframes gentle-fade {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 0.95; }
}

.section-screen-title-area h1 {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.section-screen-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0.5px;
}

/* ============================================
   Section Screen Content
   ============================================ */

.section-screen-content {
  flex: 1;
  padding: 28px 20px 100px;
}

/* Decorative character dividers on section screens */
.section-breath {
  text-align: center;
  padding: 20px 0;
}

.section-breath-char {
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  font-size: 24px;
  font-weight: 300;
  color: var(--accent-gold);
  opacity: 0.12;
}

.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 40px 0 24px;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-light), transparent);
}

.section-divider span {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* ============================================
   Section Introductions
   ============================================ */

.section-intro {
  margin-bottom: 28px;
}

.section-intro-content {
  overflow: hidden;
  transition: max-height 0.5s ease, opacity 0.3s ease;
  max-height: 600px;
  opacity: 1;
}

.section-intro-content.collapsed {
  max-height: 0;
  opacity: 0;
}

.section-intro-content p {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin: 0 0 16px 0;
}

.section-intro-content p:last-child {
  margin-bottom: 0;
}

/* Short preview shown when collapsed */
.section-intro-preview {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-secondary);
  display: none;
}

.section-intro-preview.visible {
  display: block;
}

.section-intro-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 6px 14px;
  background: var(--accent-gold-dim);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-gold);
  letter-spacing: 0.3px;
  transition: all 0.2s;
}

.section-intro-toggle:hover {
  background: rgba(200, 169, 110, 0.25);
}

.toggle-icon {
  transition: transform 0.3s ease;
}

/* ============================================
   Organ Grid
   ============================================ */

.organ-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.organ-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.organ-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--card-accent, var(--accent-gold));
  opacity: 0;
  transition: opacity 0.25s ease;
}

.organ-card:hover, .organ-card:active {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

.organ-card:hover::before, .organ-card:active::before {
  opacity: 1;
}

.organ-card-icon {
  font-size: 26px;
  margin-bottom: 8px;
  display: block;
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  font-weight: 300;
  opacity: 0.85;
}

.organ-card-name {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.organ-card-meta {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.organ-card-time {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

/* ============================================
   Meridian Grid
   ============================================ */

.meridian-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.meridian-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.meridian-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  background: var(--accent-gold);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.meridian-card:hover, .meridian-card:active {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

.meridian-card:hover::before, .meridian-card:active::before {
  opacity: 1;
}

.meridian-card-icon {
  font-size: 22px;
  margin-bottom: 8px;
  display: block;
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  font-weight: 300;
  opacity: 0.85;
}

.meridian-card-name {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.meridian-card-aka {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================
   Organ Clock
   ============================================ */

.clock-container {
  position: relative;
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  aspect-ratio: 1;
}

.clock-svg {
  width: 100%;
  height: 100%;
}

.clock-segment {
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.clock-segment:hover {
  opacity: 0.85;
}

/* Segment text sits on the always-dark backdrop ring, so its colours
   are locked to dark-theme tones for readability in both themes. */
.clock-segment text {
  font-family: var(--font-sans);
  fill: #f0ece4;
  font-size: 10px;
  font-weight: 500;
  pointer-events: none;
}

.clock-segment .clock-time {
  font-size: 8px;
  fill: #a09b90;
}

/* Centre text sits inside the inner circle, which follows the global
   theme — so use theme-aware tokens here. */
.clock-center-text {
  font-family: var(--font-serif);
  fill: var(--text-secondary);
  font-size: 11px;
  text-anchor: middle;
}

.clock-center-muted {
  fill: var(--text-muted);
}

.clock-segment-active path {
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.15));
}

.clock-center-active {
  fill: var(--accent-gold) !important;
  font-weight: 600;
}

.clock-wisdom {
  margin-top: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.clock-wisdom-label {
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--accent-gold);
  margin-bottom: 8px;
  font-weight: 500;
}

.clock-wisdom-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.clock-wisdom-clickable {
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.clock-wisdom-clickable:hover {
  border-color: var(--accent-gold);
  background: var(--bg-card-hover);
}

.clock-wisdom-clickable:active {
  transform: translateY(1px);
}

.clock-wisdom-clickable:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}

.clock-wisdom-cta {
  display: block;
  margin-top: 12px;
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--accent-gold);
  font-weight: 500;
}

/* ============================================
   Five Elements
   ============================================ */

.elements-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.element-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
}

.element-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

.element-card-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  gap: 12px;
}

.element-card-icon {
  font-size: 26px;
  flex-shrink: 0;
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  font-weight: 300;
  opacity: 0.85;
}

.element-card-info {
  flex: 1;
  min-width: 0;
}

.element-card-name {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 500;
  color: var(--text-primary);
}

.element-card-chinese {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 300;
  margin-left: 6px;
}

.element-card-organs {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.element-card-season {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  flex-shrink: 0;
}

.element-card-bar {
  height: 3px;
  opacity: 0.4;
  transition: opacity 0.2s ease;
}

.element-card:hover .element-card-bar {
  opacity: 0.8;
}

/* Foundation Cards */
.foundation-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.foundation-card {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  gap: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.foundation-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.foundation-card-icon {
  font-size: 24px;
  flex-shrink: 0;
  font-weight: 300;
  opacity: 0.85;
}

.foundation-card-info {
  flex: 1;
}

.foundation-card-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.foundation-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.foundation-card-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Practice Guide Cards */
.practice-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.practice-card {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  gap: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.practice-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.practice-card-icon {
  font-size: 22px;
  flex-shrink: 0;
  font-weight: 300;
  opacity: 0.85;
  letter-spacing: 1px;
}

.practice-card-info {
  flex: 1;
}

.practice-card-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.practice-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.practice-card-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Practice Detail Body */
.practice-detail-body {
  padding: 20px;
}

.practice-section {
  margin-bottom: 28px;
}

.practice-section:last-child {
  margin-bottom: 0;
}

.practice-section-heading {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--text-accent);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.practice-section-text {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-secondary);
  margin: 0 0 12px 0;
}

.practice-section-text:last-child {
  margin-bottom: 0;
}

/* ============================================
   Detail Header
   ============================================ */

.detail-header {
  padding: calc(64px + var(--safe-top)) 20px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 10;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--accent-gold);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 16px;
  transition: opacity 0.2s;
}

.back-btn:hover {
  opacity: 0.7;
}

.detail-title-area {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.detail-icon {
  font-size: 30px;
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  font-weight: 300;
  opacity: 0.85;
}

.detail-title-area h1 {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 400;
  color: var(--text-primary);
}

.detail-nickname {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  font-family: var(--font-serif);
}

.detail-meta {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

.meta-tag {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-tag .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

/* ============================================
   Detail Tabs
   ============================================ */

.detail-tabs {
  display: flex;
  gap: 0;
  padding: 0 20px;
  margin-top: 0;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 9;
}

.tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  letter-spacing: 0.3px;
}

.tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gold);
  opacity: 0;
  transition: opacity 0.2s;
}

.tab.active {
  color: var(--accent-gold);
}

.tab.active::after {
  opacity: 1;
}

.tab:hover:not(.active) {
  color: var(--text-secondary);
}

/* ============================================
   Tab Content
   ============================================ */

.detail-content {
  flex: 1;
  padding-bottom: 80px;
}

.tab-content {
  display: none;
  padding: 24px 20px calc(40px + var(--safe-bottom));
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

/* Description */
.description-text p {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.description-text p:first-child {
  font-size: 16px;
  color: var(--text-primary);
  line-height: 1.7;
}

/* ============================================
   Themes (Accordion)
   ============================================ */

.themes-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.theme-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s;
}

.theme-item.open {
  border-color: var(--border-light);
}

.theme-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.2s;
  gap: 12px;
}

.theme-header:hover {
  background: var(--bg-card-hover);
}

.theme-number {
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--accent-gold);
  min-width: 24px;
  font-weight: 500;
}

.theme-title {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.theme-chevron {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.theme-item.open .theme-chevron {
  transform: rotate(180deg);
}

.theme-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.theme-item.open .theme-body {
  max-height: 500px;
}

.theme-questions {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.question {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-secondary);
  padding-left: 16px;
  position: relative;
}

.question::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-gold);
  opacity: 0.6;
}

/* ============================================
   Key Points
   ============================================ */

.keypoints-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.keypoint {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.keypoint-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--accent-gold);
  margin-bottom: 6px;
}

.keypoint-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* ============================================
   Meridian Detail Meta
   ============================================ */

.meta-points {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-point {
  font-size: 11px;
  color: var(--text-muted);
}

.meta-point strong {
  color: var(--text-secondary);
  font-weight: 500;
}

/* ============================================
   Scrollbar
   ============================================ */

::-webkit-scrollbar {
  width: 4px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

/* ============================================
   Responsive
   ============================================ */

/* Desktop frame applied via body::after below */

@media (max-width: 360px) {
  .organ-grid {
    grid-template-columns: 1fr;
  }
  .meridian-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   Element Detail
   ============================================ */

.element-organs-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.element-organs-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 400;
  color: var(--text-primary);
  margin: 0 0 12px;
}

.element-organ-link {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 14px;
}

.element-organ-link:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.element-organ-icon {
  font-size: 22px;
  flex-shrink: 0;
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  font-weight: 300;
  opacity: 0.85;
}

.element-organ-info {
  flex: 1;
}

.element-organ-name {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--text-primary);
  font-weight: 500;
}

.element-organ-nickname {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.element-organ-link svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Correspondences */
.correspondences-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.correspondence-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.correspondence-label {
  font-family: var(--font-serif);
  font-size: 13px;
  color: var(--accent-gold);
  font-weight: 500;
  margin-bottom: 4px;
}

.correspondence-value {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Cycles */
.cycle-section {
  margin-bottom: 28px;
}

.cycle-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 400;
  color: var(--text-primary);
  margin: 0 0 14px;
}

.cycle-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.cycle-card-label {
  font-family: var(--font-serif);
  font-size: 13px;
  color: var(--accent-gold);
  font-weight: 500;
  margin-bottom: 6px;
}

.cycle-card-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.mini-cycle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 16px;
  padding: 12px 8px;
}

.mini-cycle-node {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

.mini-cycle-active {
  color: var(--text-primary);
  border-color: var(--node-color);
  background: color-mix(in srgb, var(--node-color) 15%, var(--bg-card));
  font-weight: 600;
}

.mini-cycle-arrow {
  color: var(--text-muted);
  font-size: 11px;
}

/* Seasonal Wisdom */
.seasonal-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.seasonal-season {
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--text-primary);
  font-weight: 400;
}

.seasonal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.seasonal-tip {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  align-items: flex-start;
}

.seasonal-tip-number {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--accent-gold);
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  opacity: 0.6;
}

.seasonal-tip-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* ============================================
   Foundation Detail
   ============================================ */

.yin-yang-pairs {
  margin-top: 24px;
}

.pairs-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 400;
  color: var(--text-primary);
  margin: 0 0 14px;
}

.pairs-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pair-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}

.pair-yin {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: right;
  flex: 1;
}

.pair-divider {
  font-size: 14px;
  color: var(--accent-gold);
  flex-shrink: 0;
  opacity: 0.6;
}

.pair-yang {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: left;
  flex: 1;
}

/* Cycle Visualization */
.cycle-visual {
  margin-top: 24px;
}

.cycle-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 0;
}

.cycle-node {
  font-size: 12px;
  color: var(--text-primary);
  padding: 5px 12px;
  border-radius: 12px;
  border: 1px solid var(--node-color);
  background: color-mix(in srgb, var(--node-color) 12%, var(--bg-card));
}

.cycle-arrow {
  font-size: 10px;
  color: var(--text-muted);
}

/* Partnerships */
.partnerships {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.partnership-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--pair-color);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.partnership-element {
  font-family: var(--font-serif);
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.partnership-organs {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.partnership-yin,
.partnership-yang {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--text-primary);
  font-weight: 500;
}

.partnership-divider {
  color: var(--accent-gold);
  font-size: 12px;
  opacity: 0.6;
}

.partnership-theme {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}

/* ============================================
   Meridian Detail — Enhanced
   ============================================ */

.meridian-level {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 8px;
  text-align: center;
}

.meridian-connections-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.connection-block {
  margin-bottom: 20px;
}

.connection-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 400;
  color: var(--text-primary);
  margin: 0 0 12px;
}

/* Pathway Visualization */
.pathway-section {
  padding: 0;
}

.pathway-subtitle {
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 20px;
  text-align: center;
}

.pathway-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pathway-step {
  display: flex;
  gap: 16px;
  min-height: 56px;
}

.pathway-step-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 20px;
}

.pathway-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-gold);
  opacity: 0.7;
  flex-shrink: 0;
  margin-top: 4px;
}

.pathway-line {
  width: 1px;
  flex: 1;
  background: var(--border-light);
  margin: 4px 0;
}

.pathway-step-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
  padding-bottom: 16px;
}

.pathway-step:last-child .pathway-step-text {
  padding-bottom: 0;
}

/* Selection */
::selection {
  background: var(--accent-gold-dim);
  color: var(--text-primary);
}

/* ============================================
   Bottom Navigation
   ============================================ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  border-top: 1px solid var(--border-subtle);
  padding: 6px 0 calc(6px + var(--safe-bottom));
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(18, 18, 26, 0.92);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 9px;
  letter-spacing: 0.1px;
  line-height: 1.2;
  transition: color 0.2s;
  flex: 1;
  min-width: 0;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item span {
  display: block;
  text-align: center;
  max-width: 100%;
  overflow-wrap: break-word;
}

.bottom-nav-item svg {
  transition: color 0.2s, transform 0.2s;
}

.bottom-nav-item.active {
  color: var(--accent-gold);
}

.bottom-nav-item:not(.active):hover {
  color: var(--text-secondary);
}

/* ============================================
   Top Floating Buttons (Hamburger + Search)
   ============================================ */

.top-float-btn {
  position: fixed;
  top: calc(14px + var(--safe-top));
  width: 40px;
  height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 90;
  padding: 0;
  transition: opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.top-float-btn:hover {
  opacity: 0.7;
}

.top-float-left {
  left: 16px;
}

.top-float-right {
  right: 16px;
}

.top-float-right-2 {
  right: 64px;
}

.top-float-right svg,
.top-float-right-2 svg {
  color: var(--text-secondary);
}

.hamburger-line {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--text-secondary);
  border-radius: 1px;
  transition: transform 0.3s, opacity 0.3s;
}

#hamburger-btn.open .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(4.5px, 4.5px);
}

#hamburger-btn.open .hamburger-line:nth-child(2) {
  opacity: 0;
}

#hamburger-btn.open .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(4.5px, -4.5px);
}

/* ============================================
   Search Overlay
   ============================================ */

.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 15, 0.97);
  z-index: 250;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  display: flex;
  flex-direction: column;
}

.search-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.search-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-top: calc(var(--safe-top) + 12px);
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}

.search-input-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text-primary);
  caret-color: var(--accent-gold);
}

.search-input::placeholder {
  color: var(--text-muted);
  font-size: 14px;
}

.search-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.search-close:hover {
  color: var(--text-primary);
}

.search-results {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px calc(16px + var(--safe-bottom));
}

.search-placeholder {
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-serif);
  font-size: 15px;
  padding-top: 60px;
}

.search-result-group {
  margin-bottom: 20px;
}

.search-result-group-label {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.search-result-item:hover,
.search-result-item:active {
  background: var(--accent-gold-dim);
}

.search-result-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  font-weight: 300;
  opacity: 0.85;
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-name {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--text-primary);
}

.search-result-name mark {
  background: none;
  color: var(--accent-gold);
  font-weight: 500;
}

.search-result-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-no-results {
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-serif);
  font-size: 15px;
  padding-top: 60px;
}

/* ============================================
   Overview Section
   ============================================ */

.overview-tabs {
  display: flex;
  gap: 4px;
  padding: 0 0 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.overview-tabs::-webkit-scrollbar { display: none; }

.overview-tab {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 8px 16px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.overview-tab.active {
  background: var(--accent-gold-dim);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.overview-tab-content {
  display: none;
}

.overview-tab-content.active {
  display: block;
}

.overview-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.overview-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.overview-card:hover,
.overview-card:active {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.overview-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.overview-card-icon {
  font-size: 26px;
  flex-shrink: 0;
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  font-weight: 300;
  opacity: 0.85;
}

.overview-card-title-area {
  flex: 1;
  min-width: 0;
}

.overview-card-name {
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--text-primary);
  font-weight: 500;
}

.overview-card-chinese {
  font-size: 14px;
  color: var(--text-muted);
  margin-left: 4px;
}

.overview-card-meta {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.overview-card-signs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.overview-sign {
  background: var(--bg-elevated);
  border-radius: 12px;
  padding: 4px 10px;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.overview-sign-more {
  background: var(--accent-gold-dim);
  color: var(--accent-gold);
  font-weight: 600;
}

/* Overview Detail */

.ov-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 20px;
}

.ov-info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.ov-info-row:last-child {
  border-bottom: none;
}

.ov-info-label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.ov-info-value {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--text-primary);
  text-align: right;
  margin-left: 16px;
}

.ov-section {
  margin-bottom: 24px;
}

.ov-section-title {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.ov-section-text {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.ov-signs-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ov-sign-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 6px 14px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
}

.ov-table {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 12px;
}

@media (min-width: 600px) {
  .ov-table {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.ov-table-col {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.ov-table-col-header {
  background: var(--accent-gold-dim);
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ov-table-cell {
  padding: 8px 14px;
  font-family: var(--font-serif);
  font-size: 13.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  line-height: 1.5;
}

.ov-table-cell:last-child {
  border-bottom: none;
}

.ov-link-full {
  display: block;
  width: 100%;
  background: var(--accent-gold-dim);
  border: 1px solid var(--accent-gold);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--accent-gold);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.ov-link-full:hover,
.ov-link-full:active {
  background: rgba(200, 169, 110, 0.25);
}

/* Symptom Reference Table */

.symptom-ref-intro {
  padding: 0 0 12px;
}

.symptom-ref-intro p {
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--text-muted);
  font-style: italic;
}

.symptom-ref-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin: 0 0 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.symptom-ref-item.open {
  border-color: var(--border-light);
}

.symptom-ref-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.symptom-ref-name {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--text-primary);
  font-weight: 500;
}

.symptom-ref-chevron {
  color: var(--text-muted);
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.symptom-ref-item.open .symptom-ref-chevron {
  transform: rotate(180deg);
}

.symptom-ref-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.symptom-ref-item.open .symptom-ref-body {
  max-height: 300px;
}

.symptom-ref-organs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 10px;
}

.symptom-ref-organ-tag {
  background: var(--accent-gold-dim);
  border: 1px solid rgba(200, 169, 110, 0.25);
  border-radius: 14px;
  padding: 5px 12px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-gold);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.symptom-ref-organ-tag:hover,
.symptom-ref-organ-tag:active {
  background: rgba(200, 169, 110, 0.3);
}

/* Pattern reference (Overblik > Mønstre tab) */
.pattern-ref-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin: 0 0 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.pattern-ref-item.open {
  border-color: var(--border-light);
}

.pattern-ref-header {
  position: relative;
  padding: 14px 40px 14px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pattern-ref-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.pattern-ref-name {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 500;
}

.pattern-ref-chinese {
  font-size: 14px;
  color: var(--accent-gold);
  opacity: 0.85;
}

.pattern-ref-plain {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 3px;
}

.pattern-ref-chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.pattern-ref-item.open .pattern-ref-chevron {
  transform: translateY(-50%) rotate(180deg);
}

.pattern-ref-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.pattern-ref-item.open .pattern-ref-body {
  max-height: 3000px;
  padding: 0 16px 14px;
}

.pattern-ref-summary {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
  margin: 0 0 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.pattern-ref-section {
  margin-bottom: 12px;
}

.pattern-ref-section:last-child {
  margin-bottom: 0;
}

.pattern-ref-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent-gold);
  margin-bottom: 5px;
}

.pattern-ref-text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
}

.symptom-ref-note {
  padding: 0 16px 14px;
  font-family: var(--font-serif);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  font-style: italic;
}

/* Conversation Structure */

.conversation-structure {
  padding: 0;
}

.conversation-header-info {
  margin-bottom: 20px;
}

.conversation-title {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 6px;
}

.conversation-subtitle {
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--text-muted);
  font-style: italic;
}

.conversation-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 16px;
  position: relative;
}

.conversation-section-number {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  background: var(--accent-gold-dim);
  border: 1px solid rgba(200, 169, 110, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-gold);
}

.conversation-section-heading {
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 14px;
  padding-right: 40px;
}

.conversation-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.conversation-item {
  padding-left: 12px;
  border-left: 2px solid var(--accent-gold-dim);
}

.conversation-item-label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-gold);
  margin-bottom: 3px;
}

.conversation-item-text {
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============================================
   Hamburger Overlay & Menu
   ============================================ */

.hamburger-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.hamburger-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.hamburger-menu {
  position: absolute;
  top: 0;
  left: 0;
  width: min(320px, 85vw);
  height: 100%;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.hamburger-overlay.open .hamburger-menu {
  transform: translateX(0);
}

.hamburger-header {
  position: relative;
  padding: calc(20px + var(--safe-top)) 20px 22px;
  border-bottom: 1px solid var(--border-subtle);
}

.hamburger-letterhead {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.hamburger-seal {
  width: 56px;
  height: 56px;
  object-fit: contain;
  opacity: 0.92;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.18));
}

.hamburger-brand {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.hamburger-close {
  position: absolute;
  top: calc(14px + var(--safe-top));
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.hamburger-close:hover {
  color: var(--text-primary);
}

.hamburger-section {
  padding: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.hamburger-section-label {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
}

.hamburger-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 8px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-serif);
  font-size: 15.5px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.hamburger-link:hover {
  background: var(--accent-gold-dim);
  color: var(--text-primary);
}

.hamburger-link svg {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color 0.2s;
}

.hamburger-link:hover svg {
  color: var(--accent-gold);
}

.hamburger-footer {
  margin-top: auto;
  padding: 24px 20px calc(24px + var(--safe-bottom));
  text-align: center;
  border-top: 1px solid var(--border-subtle);
}

.hamburger-footer p {
  font-family: var(--font-serif);
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.hamburger-version {
  font-family: var(--font-sans) !important;
  font-size: 11px !important;
  color: var(--text-muted);
  opacity: 0.5;
  margin-top: 4px;
}

/* ============================================
   Desktop App Frame (768px+)
   ============================================ */

@media (min-width: 768px) {
  /* Centrer alle skærme */
  .screen {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
  }

  /* Centrer bundnavigation */
  .bottom-nav {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
  }

  /* Centrer floating buttons inden for rammen */
  .top-float-left {
    left: calc(50% - 320px + 16px);
  }

  .top-float-right {
    right: calc(50% - 320px + 16px);
  }

  .top-float-right-2 {
    right: calc(50% - 320px + 64px);
  }

  /* Tynd vertikal ramme langs begge sider */
  body::after {
    content: '';
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 640px;
    margin: 0 auto;
    border-left: 1.5px solid var(--accent-gold);
    border-right: 1.5px solid var(--accent-gold);
    pointer-events: none;
    z-index: 150;
    opacity: 0.15;
  }

  /* Flyt hamburger-menu ind i rammen */
  .hamburger-menu {
    left: calc(50% - 320px);
  }

  .hamburger-overlay {
    max-width: 640px;
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
  }

  /* Centrer søge-overlay */
  .search-overlay .search-container {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ============================================
   Light Theme Overrides
   (for hardcoded dark rgba values)
   ============================================ */

[data-theme="light"] .bottom-nav {
  background: rgba(234, 230, 222, 0.94);
}

[data-theme="light"] .search-overlay {
  background: rgba(245, 242, 236, 0.98);
}

[data-theme="light"] .hamburger-overlay {
  background: rgba(0, 0, 0, 0.3);
}

/* Clock backdrop stays dark in both themes, so use the same active glow. */

/* Theme transition */
html[data-theme-transitioning] * {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* ============================================
   Symptom Analysis — Featured Practice Card
   ============================================ */
.practice-card-featured {
  background: linear-gradient(135deg,
    var(--accent-gold-glow) 0%,
    var(--bg-card) 100%);
  border-color: var(--border-active);
  position: relative;
  overflow: hidden;
}

.practice-card-featured::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    rgba(200, 169, 110, 0.06) 0%,
    transparent 60%);
  pointer-events: none;
}

.practice-card-featured .practice-card-icon {
  color: var(--accent-gold);
  opacity: 1;
  font-size: 24px;
}

.practice-card-featured .practice-card-title {
  color: var(--text-accent);
}

.practice-card-featured .practice-card-arrow {
  color: var(--accent-gold);
}

[data-theme="light"] .practice-card-featured {
  background: linear-gradient(135deg,
    rgba(154, 123, 60, 0.06) 0%,
    var(--bg-card) 100%);
}

/* ============================================
   Symptom Analysis — Screen Body
   ============================================ */
.symptom-analysis-body {
  padding: 20px 20px 80px;
}

.sa-intro {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.sa-disclaimer {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-left: 2px solid var(--accent-gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 14px;
  margin-bottom: 24px;
  font-style: italic;
}

/* Counter row */
.sa-counter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.sa-counter {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.sa-reset-btn {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s ease;
}

.sa-reset-btn:hover,
.sa-reset-btn:active {
  border-color: var(--border-active);
  color: var(--text-primary);
}

/* Symptom domain stack — sections always visible, no accordion */
.sa-symptom-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 24px;
}

.sa-domain {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sa-domain-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 2px 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.sa-domain-title {
  flex: 1;
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-accent);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.sa-domain-meta {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  transition: color 0.18s ease;
}

.sa-domain.has-selection .sa-domain-header {
  border-bottom-color: var(--accent-gold);
}

.sa-domain.has-selection .sa-domain-meta {
  color: var(--accent-gold);
  font-weight: 500;
}

.sa-domain-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sa-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.sa-chip:hover {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
}

.sa-chip-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: transparent;
  color: transparent;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.sa-chip.selected {
  background: var(--accent-gold-dim);
  border-color: var(--accent-gold);
  color: var(--text-primary);
}

.sa-chip.selected .sa-chip-check {
  background: var(--accent-gold);
  color: var(--bg-primary);
}

.sa-chip.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* Analyse button */
.sa-action-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.sa-action-hint-text {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-style: italic;
  color: var(--text-secondary);
  text-align: center;
}

.sa-action-hint-text[hidden] {
  display: none;
}

.sa-analyse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--accent-gold-dim);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 500;
  font-family: var(--font-sans);
  letter-spacing: 0.3px;
  cursor: not-allowed;
  transition: all 0.2s ease;
  min-width: 220px;
}

.sa-analyse-btn.ready {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--bg-primary);
  cursor: pointer;
  box-shadow: 0 4px 16px var(--accent-gold-glow);
}

.sa-analyse-btn.ready:hover,
.sa-analyse-btn.ready:active {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

[data-theme="light"] .sa-analyse-btn.ready {
  color: #ffffff;
}

/* Results */
.sa-results {
  margin-top: 8px;
  scroll-margin-top: 240px;
}

.sa-results-inner {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  animation: sa-fade-in 0.4s ease;
}

@keyframes sa-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.sa-results-heading {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  color: var(--text-accent);
  margin: 0 0 4px 0;
}

.sa-results-subheading {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 500;
  color: var(--text-accent);
  margin: 28px 0 4px 0;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}

.sa-results-lead {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 16px 0;
}

.sa-results-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sa-result-row {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--row-accent, var(--accent-gold));
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.sa-tier-1 {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
}

.sa-result-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.sa-result-tier {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
}

.sa-tier-1 .sa-result-tier {
  color: var(--accent-gold);
  background: var(--accent-gold-dim);
}

.sa-result-organ-icon {
  font-size: 22px;
  font-weight: 300;
  color: var(--row-accent, var(--accent-gold));
  letter-spacing: 1px;
}

.sa-result-organ-name {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.sa-result-hits {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.sa-result-bar {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}

.sa-result-bar-fill {
  height: 100%;
  background: var(--row-accent, var(--accent-gold));
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sa-result-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--row-accent, var(--border-light));
  color: var(--row-accent, var(--text-secondary));
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.18s ease;
}

.sa-result-link:hover,
.sa-result-link:active {
  filter: brightness(1.12);
  background: color-mix(in srgb, var(--row-accent, var(--accent-gold)) 12%, transparent);
}

/* Element resonance card */
.sa-element-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--el-accent, var(--accent-gold));
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit;
  transition: all 0.18s ease;
}

.sa-element-card:hover,
.sa-element-card:active {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  transform: translateY(-1px);
}

.sa-element-icon {
  font-size: 28px;
  font-weight: 300;
  color: var(--el-accent, var(--accent-gold));
  letter-spacing: 1px;
  flex-shrink: 0;
  line-height: 1;
}

.sa-element-info {
  flex: 1;
  min-width: 0;
}

.sa-element-name {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.sa-element-chinese {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
}

.sa-element-meta {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.sa-element-organs {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}

.sa-element-pct {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--el-accent, var(--accent-gold));
  background: var(--bg-elevated);
  border-radius: 999px;
  padding: 4px 10px;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

.sa-element-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Pattern resonance list */
.sa-pattern-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.sa-pattern-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--accent-gold);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.sa-pattern-card:hover {
  border-color: var(--border-active);
}

.sa-pattern-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  background: transparent;
  border: 0;
  color: inherit;
  padding: 14px 38px 14px 14px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  position: relative;
  transition: background 0.18s ease;
}

.sa-pattern-header:hover,
.sa-pattern-header:active {
  background: var(--bg-card-hover);
}

.sa-pattern-title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.sa-pattern-name {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 500;
  color: var(--text-primary);
}

.sa-pattern-chinese {
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.sa-pattern-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sa-pattern-tag {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-radius: 999px;
  padding: 2px 8px;
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
}

.sa-pattern-tag-nature {
  color: var(--accent-gold);
  background: var(--accent-gold-dim);
}

.sa-pattern-score {
  margin-left: auto;
  font-size: 12px;
  color: var(--accent-gold);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}

.sa-pattern-hits {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.sa-pattern-hits-label {
  color: var(--text-secondary);
  margin-right: 2px;
}

.sa-pattern-hits-label + * {
  margin-right: 8px;
}

.sa-pattern-chevron {
  position: absolute;
  right: 14px;
  top: 18px;
  color: var(--text-muted);
  transition: transform 0.25s ease;
}

.sa-pattern-card.open .sa-pattern-chevron {
  transform: rotate(180deg);
  color: var(--text-secondary);
}

.sa-pattern-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
  border-top: 1px solid transparent;
}

.sa-pattern-card.open .sa-pattern-body {
  max-height: 1500px;
  border-top-color: var(--border-subtle);
  padding: 14px 14px 16px;
}

.sa-pattern-summary {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0 0 18px 0;
}

.sa-pattern-plain {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
  font-style: italic;
  margin: 4px 0 8px;
}

.sa-pattern-homepractice {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.sa-pattern-homepractice-title {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--accent-gold);
  margin-bottom: 12px;
  font-weight: 500;
}

.hp-section {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border-subtle);
}

.hp-section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.hp-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent-gold);
  margin-bottom: 4px;
}

.hp-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
  margin: 0;
}

.session-card-intensity {
  color: var(--accent-gold);
  font-weight: 500;
}

.sa-pattern-section {
  margin-bottom: 14px;
}

.sa-pattern-section:last-child {
  margin-bottom: 0;
}

.sa-pattern-section-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent-gold);
  margin-bottom: 6px;
}

.sa-pattern-section-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
}

.sa-pattern-symptoms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sa-pattern-symptom {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border-radius: 999px;
  padding: 3px 10px;
  letter-spacing: 0.2px;
}

.sa-pattern-symptom-key {
  background: var(--accent-gold-dim);
  color: var(--accent-gold);
  font-weight: 500;
}

/* Meridian resonance list */
.sa-meridian-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.sa-meridian-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--accent-gold);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit;
  transition: all 0.18s ease;
}

.sa-meridian-card:hover,
.sa-meridian-card:active {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  transform: translateY(-1px);
}

.sa-meridian-icon {
  font-size: 22px;
  font-weight: 300;
  color: var(--accent-gold);
  letter-spacing: 1px;
  flex-shrink: 0;
  line-height: 1;
}

.sa-meridian-info {
  flex: 1;
  min-width: 0;
}

.sa-meridian-name {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.sa-meridian-nick {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
}

.sa-meridian-hits {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* Notes list */
.sa-notes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sa-note-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.sa-note-symptom {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.sa-note-organs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.sa-note-organ {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.3px;
}

.sa-note-text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
  font-style: italic;
}

/* Next step block */
.sa-next-step {
  margin-top: 24px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  text-align: center;
}

.sa-next-step-heading {
  font-family: var(--font-serif);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-accent);
  margin-bottom: 8px;
}

.sa-next-step-body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0 0 14px 0;
}

.sa-next-step-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--row-accent, var(--accent-gold));
  border: 1px solid var(--row-accent, var(--accent-gold));
  color: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.18s ease;
}

.sa-next-step-cta:hover,
.sa-next-step-cta:active {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

[data-theme="light"] .sa-next-step-cta {
  color: #ffffff;
}

/* Copy summary button */
.sa-result-actions {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.sa-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-size: 14px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.18s ease;
}

.sa-copy-btn:hover,
.sa-copy-btn:active {
  border-color: var(--border-active);
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.sa-copy-btn.copied {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  background: var(--accent-gold-dim);
}

.sa-copy-btn.copied svg {
  display: none;
}

/* Smaller screens */
@media (max-width: 360px) {
  .sa-result-header {
    gap: 6px;
  }
  .sa-result-organ-name {
    font-size: 17px;
  }
  .sa-analyse-btn {
    width: 100%;
    min-width: 0;
  }
}

/* ============================================
   Client History (Phase 1)
   ============================================ */

/* Save button alongside copy button */
.sa-save-btn,
.sa-client-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 14px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.18s ease;
}

.sa-save-btn:hover,
.sa-save-btn:active,
.sa-client-btn:hover,
.sa-client-btn:active {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

/* Single-primary "Gem analyse" button on SA results */
.sa-result-actions-single {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.sa-save-btn-primary {
  background: var(--accent-gold-dim);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  padding: 14px 22px;
  font-size: 15px;
}

.sa-save-btn-primary:hover,
.sa-save-btn-primary:active {
  background: var(--accent-gold);
  color: var(--bg-primary);
}

.sa-result-actions-note {
  max-width: 520px;
  margin: 0 8px;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  font-style: italic;
}

/* Post-save panel — replaces the Gem-button after a successful save,
   so practitioner has direct access to the most likely next steps. */
.sa-post-save {
  width: 100%;
  max-width: 520px;
  background: var(--accent-gold-dim);
  border: 1px solid var(--accent-gold);
  border-radius: var(--radius-md);
  padding: 22px 22px 18px;
  text-align: left;
}

.sa-post-save-confirm {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--accent-gold);
  margin-bottom: 18px;
}

.sa-post-save-confirm strong {
  color: var(--text-primary);
  font-weight: 600;
}

.sa-post-save-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--accent-gold);
  color: var(--bg-card);
  border-radius: 50%;
  flex-shrink: 0;
}

.sa-post-save-heading {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--text-primary);
  margin: 0 0 14px;
}

.sa-post-save-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.sa-post-save-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
}

.sa-post-save-btn:hover,
.sa-post-save-btn:active {
  border-color: var(--accent-gold);
  background: var(--bg-card-hover);
}

.sa-post-save-btn-primary {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--bg-primary);
}

.sa-post-save-btn-primary:hover,
.sa-post-save-btn-primary:active {
  filter: brightness(1.06);
  background: var(--accent-gold);
}

[data-theme="light"] .sa-post-save-btn-primary {
  color: #ffffff;
}

.sa-post-save-btn svg {
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--accent-gold);
}

.sa-post-save-btn-primary svg {
  color: inherit;
}

.sa-post-save-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sa-post-save-label {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
}

.sa-post-save-hint {
  font-size: 12px;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.4;
}

.sa-post-save-btn-primary .sa-post-save-hint {
  color: inherit;
  opacity: 0.85;
}

.sa-post-save-secondary {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-style: italic;
  cursor: pointer;
  padding: 6px 0 0;
  text-align: left;
}

.sa-post-save-secondary:hover {
  color: var(--accent-gold);
  text-decoration: underline;
}

/* Brief 'Kopieret ✓' confirmation state on the secondary post-save button. */
.sa-post-save-btn-copied {
  border-color: var(--accent-gold);
  background: var(--accent-gold);
  color: var(--bg-primary);
}

.sa-post-save-btn-copied svg,
.sa-post-save-btn-copied .sa-post-save-hint {
  color: inherit;
}

[data-theme="light"] .sa-post-save-btn-copied {
  color: #ffffff;
}

.sa-action-text {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  line-height: 1.2;
}

.sa-action-hint {
  font-size: 11px;
  font-style: italic;
  opacity: 0.7;
  margin-top: 2px;
  font-weight: 400;
}

.sa-result-actions {
  flex-wrap: wrap;
  gap: 10px;
}

/* Clients list screen */
.clients-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 0 32px;
}

.clients-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 32px;
}

.client-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 18px 18px;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: var(--font-sans);
  text-align: left;
}

.client-card:hover {
  border-color: var(--accent-gold);
  background: var(--bg-card-hover);
}

.client-card-id {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--text-primary);
  font-weight: 500;
  flex: 0 0 auto;
  min-width: 80px;
}

.client-card-meta {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
}

.client-card-chevron {
  color: var(--text-secondary);
  flex: 0 0 auto;
  opacity: 0.6;
}

.clients-empty {
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
  padding: 32px 16px;
}

/* Element decoration row on info screens */
.info-element-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 4px 0 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.info-element-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 500;
  border: 1.5px solid;
  user-select: none;
}

.info-element-tree { color: #5cc98e; border-color: rgba(92, 201, 142, 0.4); background: rgba(92, 201, 142, 0.06); }
.info-element-fire { color: #e88585; border-color: rgba(232, 133, 133, 0.4); background: rgba(232, 133, 133, 0.06); }
.info-element-earth { color: #deb87a; border-color: rgba(222, 184, 122, 0.4); background: rgba(222, 184, 122, 0.06); }
.info-element-metal { color: #a8c4d6; border-color: rgba(168, 196, 214, 0.4); background: rgba(168, 196, 214, 0.06); }
.info-element-water { color: #7ba4da; border-color: rgba(123, 164, 218, 0.4); background: rgba(123, 164, 218, 0.06); }

/* FAQ Q&A items */
.info-qa-item {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.info-qa-item:last-child {
  border-bottom: 0;
  margin-bottom: 0;
}

.info-qa-q {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--accent-gold);
  margin-bottom: 6px;
  font-weight: 500;
}

.info-qa-a {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0;
}

.clients-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.18s ease;
}

.clients-action-btn:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.clients-disclaimer {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  font-style: italic;
  opacity: 0.75;
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 24px;
}

/* Client detail */
.client-detail-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 0 32px;
}

/* Progression block (Phase 2) */
.client-progress {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 22px 22px 18px;
  margin-bottom: 32px;
}

.client-progress-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0 0 4px;
  letter-spacing: 0.4px;
}

.client-progress-lead {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 16px;
  font-style: italic;
}

.progress-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.progress-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.progress-meta-col {
  flex: 0 0 auto;
  min-width: 64px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-top: 2px;
}

.progress-num {
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--accent-gold);
  font-weight: 500;
}

.progress-date {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-secondary);
}

.progress-bar-col {
  flex: 1;
  min-width: 0;
}

.progress-bar-track {
  height: 8px;
  background: var(--bg-card-hover);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.progress-pattern-name {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.4;
}

.progress-pattern-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.progress-pattern-intensity {
  color: var(--accent-gold);
  font-weight: 500;
}

.progress-pattern-none {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  opacity: 0.7;
}

/* Element balance row (Phase 2 — pentagons) */
.element-balance {
  margin-bottom: 18px;
}

.client-progress-polyvagal {
  margin-top: 22px;
}

/* The 'other track' Forløb sits below the session list with a quiet
   label so it doesn't compete with the focused track's context. */
.client-progress-other-label {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 36px 0 12px;
}

.pv-progress-ladders {
  margin-bottom: 18px;
}

.pv-progress-ladders-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent-gold);
  margin-bottom: 10px;
}

.pv-progress-ladders-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 2px 2px 6px;
  color: var(--text-secondary);
}

.pv-progress-cell {
  flex: 0 0 auto;
  width: 86px;
  text-align: center;
}

.pv-progress-ladder {
  width: 86px;
  height: 92px;
  display: block;
}

.pv-progress-cell-meta {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 4px;
  letter-spacing: 0.4px;
}

.element-balance-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent-gold);
  margin-bottom: 10px;
}

.element-balance-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 2px 2px 6px;
}

.element-pentagon-cell {
  flex: 0 0 auto;
  width: 86px;
  text-align: center;
}

.element-pentagon {
  width: 86px;
  height: 86px;
  display: block;
}

.element-pentagon-meta {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Symptom diff */
.symptom-diff {
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
}

.symptom-diff-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent-gold);
  margin-bottom: 8px;
}

.diff-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.diff-row:last-child {
  margin-bottom: 0;
}

.diff-arrow {
  font-size: 14px;
  font-weight: 500;
  flex: 0 0 auto;
}

.diff-new .diff-arrow {
  color: #5cc98e;
}

.diff-gone .diff-arrow {
  color: #7ba4da;
}

.diff-label {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 0 0 auto;
}

.diff-syms {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.diff-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 11px;
  border: 1px solid var(--border-light);
}

.diff-chip-new {
  border-color: rgba(92, 201, 142, 0.5);
  color: #5cc98e;
}

.diff-chip-gone {
  border-color: rgba(123, 164, 218, 0.5);
  color: #7ba4da;
  text-decoration: line-through;
  text-decoration-color: rgba(123, 164, 218, 0.4);
}

.diff-stable {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}

.client-sessions-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-bottom: 32px;
}

.session-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.session-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: transparent;
  border: 0;
  padding: 14px 16px;
  cursor: pointer;
  font-family: var(--font-sans);
  text-align: left;
  color: inherit;
}

.session-card-header:hover {
  background: var(--bg-card-hover);
}

.session-card-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 0 0 auto;
  min-width: 88px;
}

.session-card-num {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--accent-gold);
  font-weight: 500;
}

.session-card-date {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.session-card-summary {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.session-card-organ {
  font-size: 14px;
  color: var(--text-primary);
}

.session-card-pattern {
  font-size: 13px;
  color: var(--text-secondary);
}

.session-card-pattern-none {
  font-style: italic;
  opacity: 0.7;
}

.session-card-pct {
  color: var(--accent-gold);
  font-weight: 500;
}

.session-card-chevron {
  color: var(--text-secondary);
  flex: 0 0 auto;
  transition: transform 0.2s ease;
}

.session-card.open .session-card-chevron {
  transform: rotate(180deg);
}

.session-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.session-card.open .session-card-body {
  max-height: 1500px;
  border-top: 1px solid var(--border-subtle);
  padding: 14px 16px 16px;
}

.session-card-section {
  margin-bottom: 12px;
}

.session-card-section:last-of-type {
  margin-bottom: 8px;
}

.session-card-section-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent-gold);
  margin-bottom: 6px;
}

.session-card-row {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.session-card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.session-card-chip {
  font-size: 12px;
  padding: 3px 9px;
  background: var(--bg-card-hover);
  color: var(--text-secondary);
  border-radius: 12px;
}

.session-card-notes {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.55;
  background: var(--bg-card-hover);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
}

/* Session followup section (Phase C) */
.session-followup {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.followup-lead {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  margin: 0 0 14px;
}

.followup-row {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border-subtle);
}

.followup-row:last-of-type {
  border-bottom: 0;
  margin-bottom: 8px;
}

.followup-area-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent-gold);
  margin-bottom: 6px;
}

.followup-question {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.followup-question:last-child {
  margin-bottom: 0;
}

.followup-question-label {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 0 0 auto;
  min-width: 56px;
}

.followup-pills {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}

.followup-pill {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  border-radius: 14px;
  padding: 4px 11px;
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.followup-pill:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.followup-pill.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--bg-primary);
  font-weight: 500;
}

[data-theme="light"] .followup-pill.active {
  color: #ffffff;
}

.followup-notes-row {
  margin-top: 12px;
}

.followup-notes-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent-gold);
  margin-bottom: 6px;
}

.followup-notes {
  width: 100%;
  background: var(--bg-card-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--text-primary);
  line-height: 1.5;
  resize: vertical;
  min-height: 50px;
}

.followup-notes:focus {
  outline: none;
  border-color: var(--accent-gold);
}

.session-delete-btn {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  margin-top: 6px;
  transition: all 0.18s ease;
}

.session-delete-btn:hover {
  border-color: #c43c3c;
  color: #c43c3c;
}

.session-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0 6px;
}

/* Brief gold pulse on the just-saved session when arriving at client-detail
   from the post-save panel — so the practitioner spots which session is
   the new one. */
@keyframes sessionCardPulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-gold-glow); border-color: var(--accent-gold); }
  60%  { box-shadow: 0 0 0 8px transparent; border-color: var(--accent-gold); }
  100% { box-shadow: 0 0 0 0 transparent; border-color: var(--border-light); }
}

.session-card-pulse {
  animation: sessionCardPulse 2.2s ease-out;
}

.session-action-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-card-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
}

.session-action-btn:hover,
.session-action-btn:active {
  border-color: var(--accent-gold);
  background: var(--accent-gold-dim);
}

/* Brief "Kopieret ✓" confirmation state on the copy button. */
.session-action-btn-copied {
  border-color: var(--accent-gold);
  background: var(--accent-gold);
}

.session-action-btn-copied .session-action-label,
.session-action-btn-copied .session-action-hint {
  color: var(--bg-card);
}

.session-action-btn-copied svg {
  color: var(--bg-card) !important;
}

.session-action-btn svg {
  flex: 0 0 auto;
  color: var(--accent-gold);
  margin-top: 1px;
}

.session-action-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.session-action-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}

.session-action-hint {
  font-size: 12px;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.4;
}

.client-delete-btn {
  display: block;
  margin: 24px auto 0;
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.18s ease;
}

.client-delete-btn:hover {
  border-color: #c43c3c;
  color: #c43c3c;
}

/* Save dialog */
.save-dialog {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.save-dialog.open {
  display: flex;
}

.save-dialog[hidden] {
  display: none;
}

.save-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

.save-dialog-panel {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 22px 22px 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.save-dialog-title {
  font-family: var(--font-serif);
  font-size: 22px;
  margin: 0 0 16px;
  color: var(--text-primary);
}

.save-dialog-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card-hover);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 18px;
}

.save-dialog-tab {
  flex: 1;
  background: transparent;
  border: 0;
  border-radius: calc(var(--radius-sm) - 2px);
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s ease;
}

.save-dialog-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.save-dialog-tab:hover:not(.active) {
  color: var(--text-primary);
}

.save-dialog[data-mode="existing"] [data-mode-only="new"],
.save-dialog[data-mode="new"] [data-mode-only="existing"] {
  display: none;
}

.save-dialog-field {
  margin-bottom: 14px;
}

.save-dialog-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-gold);
  margin-bottom: 6px;
}

.save-dialog-input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--text-primary);
}

.save-dialog-input:focus {
  outline: none;
  border-color: var(--accent-gold);
}

.save-dialog-textarea {
  resize: vertical;
  min-height: 70px;
  font-family: var(--font-sans);
  line-height: 1.5;
}

.save-dialog-hint {
  font-size: 11px;
  color: var(--text-secondary);
  margin: 4px 0 0;
  font-style: italic;
}

.save-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

.save-dialog-btn {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 14px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.18s ease;
}

.save-dialog-cancel {
  background: transparent;
  color: var(--text-secondary);
}

.save-dialog-cancel:hover {
  color: var(--text-primary);
}

.save-dialog-commit {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--bg-primary);
  font-weight: 500;
}

.save-dialog-commit:hover {
  filter: brightness(1.08);
}

[data-theme="light"] .save-dialog-commit {
  color: #ffffff;
}

/* Save toast */
.save-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--accent-gold);
  color: var(--bg-primary);
  padding: 12px 22px;
  border-radius: 18px;
  max-width: min(520px, calc(100vw - 32px));
  text-align: center;
  line-height: 1.4;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  z-index: 1100;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.save-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

[data-theme="light"] .save-toast {
  color: #ffffff;
}

/* ============================================
   Polyvagal analysis — ladder, state bars, pattern card
   ============================================ */

.practice-card-polyvagal .practice-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-gold);
}

.pv-detail-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-gold);
}

.pv-ladder {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  margin: 18px 0 24px;
  color: var(--text-primary);
}

.pv-ladder-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 180px;
}

/* Lille indfoldelig info-blok der forklarer stigen for behandlere
   der lige er begyndt at bruge polyvagal-rammen. */
.pv-ladder-info {
  margin: 0 0 22px;
  background: var(--bg-card);
  border: 1px solid var(--accent-gold-dim);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-family: var(--font-sans);
}

.pv-ladder-info summary {
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-gold);
}

.pv-ladder-info summary::-webkit-details-marker { display: none; }

.pv-ladder-info summary::after {
  content: '+';
  margin-left: 8px;
  font-size: 14px;
}

.pv-ladder-info[open] summary::after { content: '−'; }

.pv-ladder-info-body {
  margin-top: 12px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.pv-ladder-info-body p { margin: 0 0 10px; }
.pv-ladder-info-body ul { margin: 0 0 10px; padding-left: 20px; }
.pv-ladder-info-body li { margin-bottom: 4px; }
.pv-ladder-info-body strong { color: var(--text-primary); }
.pv-ladder-info-body em { font-style: italic; color: var(--accent-gold); }

.pv-pattern-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--pv-state-color, var(--accent-gold));
  border-radius: var(--radius-md);
  padding: 22px 22px 18px;
  margin-bottom: 22px;
}

.pv-pattern-eyebrow {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pv-state-color, var(--accent-gold));
  margin-bottom: 6px;
}

.pv-pattern-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 4px;
  color: var(--text-primary);
}

.pv-pattern-plain {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.pv-pattern-summary {
  font-family: var(--font-serif);
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0 0 14px;
}

.pv-pattern-details {
  margin: 12px 0 16px;
  padding: 10px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-sans);
}

.pv-pattern-details summary {
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-gold);
  padding: 4px 0;
  list-style: none;
}

.pv-pattern-details summary::-webkit-details-marker {
  display: none;
}

.pv-pattern-details[open] summary::after {
  content: '−';
  margin-left: 8px;
}

.pv-pattern-details summary::after {
  content: '+';
  margin-left: 8px;
  font-size: 14px;
}

.pv-pattern-section {
  margin: 12px 0;
}

.pv-pattern-section-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.pv-pattern-section p {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-primary);
  margin: 0;
}

.pv-symptom-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pv-symptom-chip-tag {
  font-family: var(--font-sans);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--bg-card-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.pv-symptom-chip-tag.pv-symptom-chip-key {
  background: var(--accent-gold-dim);
  color: var(--accent-gold);
  border-color: var(--accent-gold);
}

.pv-homepractice {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--accent-gold-dim);
}

.pv-homepractice-title {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 12px;
}

.pv-hp-row {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}

.pv-hp-glyph {
  width: 28px;
  height: 28px;
  border: 1px solid var(--accent-gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-gold);
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 500;
  margin-top: 2px;
}

/* Anker = co-regulering = polyvagal-arbejdets vigtigste muskel.
   Markér rækken visuelt så den ikke forsvinder midt på listen. */
.pv-hp-row-anchor {
  background: var(--accent-gold-dim);
  border-radius: var(--radius-sm);
  padding: 12px 14px 10px;
  margin-bottom: 14px;
  margin-left: -14px;
  margin-right: -14px;
  border-left: 3px solid var(--accent-gold);
}

.pv-hp-row-anchor .pv-hp-glyph {
  background: var(--accent-gold);
  color: var(--bg-card);
}

.pv-hp-accent-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-gold);
  color: var(--bg-card);
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  vertical-align: middle;
}

.pv-hp-label {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 2px;
}

.pv-hp-text {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0;
}

.pv-other-patterns {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 18px;
}

.pv-other-patterns-label {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.pv-other-pattern {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.pv-other-pattern:last-child {
  border-bottom: none;
}

.pv-other-pattern-name {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--text-primary);
}

.pv-other-pattern-score {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-secondary);
}

.pv-no-match {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 18px;
}

.pv-no-match p {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.pv-disclaimer-note {
  margin-top: 22px;
  padding: 14px 18px;
  background: var(--bg-card-hover);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 12px;
  font-style: italic;
  line-height: 1.5;
  color: var(--text-muted);
  text-align: center;
}

/* ============================================
   Client Handout — printable home practice document
   ============================================ */

#screen-client-handout {
  background: var(--bg-secondary);
  padding-bottom: 64px;
}

.handout-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  /* Top padding clears the floating hamburger / theme / search buttons
     (top: 14+safe-top, 40px tall = ends at 54+safe-top). */
  padding: calc(64px + var(--safe-top)) 20px 12px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--accent-gold-dim);
}

.handout-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.handout-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--accent-gold-dim);
  border-radius: 14px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.handout-tool-text {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.25;
}

.handout-tool-label {
  font-weight: 500;
  color: var(--text-primary);
}

.handout-tool-btn:hover .handout-tool-label,
.handout-tool-btn-primary .handout-tool-label {
  color: inherit;
}

.handout-tool-hint {
  font-size: 11px;
  font-style: italic;
  opacity: 0.85;
}

.handout-tool-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--accent-gold);
}

.handout-tool-btn-primary {
  background: var(--accent-gold-dim);
  color: var(--accent-gold);
  border-color: var(--accent-gold);
}

.handout-tool-btn-primary:hover {
  background: var(--accent-gold);
  color: var(--bg-primary);
}

.handout-page-wrap {
  display: flex;
  justify-content: center;
  padding: 28px 16px 48px;
}

.handout-document {
  width: 100%;
  max-width: 720px;
  background: #fbf7ee;
  color: #1a1815;
  border-radius: 6px;
  padding: 56px 56px 48px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2);
  font-family: 'Cormorant Garamond', Georgia, serif;
  line-height: 1.55;
}

[data-theme="light"] .handout-document {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06);
}

.handout-letterhead {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(154, 123, 60, 0.35);
  margin-bottom: 28px;
}

.handout-seal-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
}

.handout-seal {
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
}

.handout-seal-ladder {
  width: 56px;
  height: 76px;
  color: #9a7b3c;
}

.handout-letterhead-text {
  flex: 1;
  min-width: 0;
}

.handout-eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9a7b3c;
  margin-bottom: 4px;
}

.handout-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 30px;
  font-weight: 500;
  line-height: 1.15;
  margin: 0 0 8px;
  color: #1a1815;
}

.handout-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: #5a554d;
  letter-spacing: 0.04em;
}

.handout-meta-sep {
  opacity: 0.5;
}

.handout-meta-client {
  outline: none;
  border-bottom: 1px dashed transparent;
  padding: 0 2px;
  cursor: text;
  min-width: 60px;
}

.handout-meta-client:hover,
.handout-meta-client:focus {
  border-bottom-color: rgba(154, 123, 60, 0.5);
}

.handout-meta-client:empty::before,
.handout-signature:empty::before {
  content: attr(data-placeholder);
  color: #b0a89a;
  font-style: italic;
}

.handout-section {
  margin-bottom: 26px;
}

.handout-h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 20px;
  font-weight: 500;
  margin: 0 0 12px;
  color: #1a1815;
  letter-spacing: 0.01em;
}

.handout-lede {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 17px;
  font-style: italic;
  line-height: 1.6;
  color: #2a2620;
  margin: 0;
}

.handout-practices {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.handout-practice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
}

/* Anker-rækken på polyvagal-handouts og share-siden — vigtigste
   element for de fleste klienter, så fremhævet visuelt. */
.handout-practice-accent {
  background: rgba(154, 123, 60, 0.10);
  border-radius: 6px;
  padding: 14px 16px;
  border-left: 3px solid #9a7b3c;
}

.handout-practice-accent .handout-practice-glyph {
  background: #9a7b3c;
  color: #fbf7ee;
  border-color: #9a7b3c;
}

.handout-practice-accent .handout-practice-label::after {
  content: 'vigtigste anker';
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #9a7b3c;
  color: #fbf7ee;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  vertical-align: middle;
  font-style: normal;
}

.handout-practice-glyph {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(154, 123, 60, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 14px;
  font-weight: 500;
  color: #9a7b3c;
  flex-shrink: 0;
  margin-top: 2px;
}

.handout-practice-body {
  min-width: 0;
}

.handout-practice-label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #9a7b3c;
  margin-bottom: 4px;
}

.handout-practice-text {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 16px;
  line-height: 1.6;
  color: #1a1815;
  margin: 0;
}

.handout-footer {
  margin-top: 36px;
}

.handout-rule {
  width: 32px;
  height: 1px;
  background: rgba(154, 123, 60, 0.5);
  margin: 0 auto 18px;
}

.handout-footer-text {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 14px;
  font-style: italic;
  line-height: 1.6;
  color: #5a554d;
  margin: 0 0 22px;
  white-space: pre-line;
}

.handout-signature-line {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 8px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 16px;
  color: #2a2620;
}

.handout-signature-dash {
  color: #9a7b3c;
}

.handout-signature {
  outline: none;
  border-bottom: 1px dashed transparent;
  padding: 0 4px;
  min-width: 120px;
  cursor: text;
}

.handout-signature:hover,
.handout-signature:focus {
  border-bottom-color: rgba(154, 123, 60, 0.5);
}

@media (max-width: 600px) {
  .handout-page-wrap {
    padding: 16px 10px 40px;
  }
  .handout-document {
    padding: 32px 26px 32px;
  }
  .handout-letterhead {
    gap: 16px;
  }
  .handout-seal {
    width: 56px;
    height: 56px;
  }
  .handout-title {
    font-size: 24px;
  }
  .handout-toolbar {
    padding: calc(60px + var(--safe-top)) 14px 12px;
  }
  .handout-tool-btn {
    padding: 9px 11px;
    font-size: 12px;
  }
  .handout-tool-hint {
    display: none;
  }
}

/* Print: only the document, on white paper, in colour. */
@media print {
  @page {
    margin: 16mm;
    size: A4;
  }
  html, body {
    background: #ffffff !important;
    color: #1a1815 !important;
  }
  body * {
    visibility: hidden !important;
  }
  /* In-app handout */
  #screen-client-handout,
  #screen-client-handout * {
    visibility: visible !important;
  }
  #screen-client-handout {
    position: absolute;
    inset: 0;
    background: #ffffff !important;
    padding: 0 !important;
  }
  /* Standalone share.html — the client's view */
  #share-page,
  #share-page * {
    visibility: visible !important;
  }
  #share-page {
    position: absolute;
    inset: 0;
    background: #ffffff !important;
    padding: 0 !important;
  }
  .no-print,
  .top-float-btn,
  .bottom-nav,
  .hamburger-overlay,
  .save-dialog,
  .save-toast,
  .search-overlay {
    display: none !important;
    visibility: hidden !important;
  }
  .handout-page-wrap {
    padding: 0 !important;
  }
  .handout-document {
    max-width: none;
    width: 100%;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
    background: #ffffff !important;
    color: #1a1815 !important;
  }
  .handout-section,
  .handout-practice {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .handout-meta-client,
  .handout-signature {
    border-bottom: none !important;
  }
  .handout-meta-client:empty::before,
  .handout-signature:empty::before {
    content: '';
  }
}

/* ============================================
   Backup dialog (Sikkerhedskopi af arkiv)
   ============================================ */
.backup-dialog {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.backup-dialog[hidden] {
  display: none;
}

.backup-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  cursor: pointer;
}

.backup-dialog-panel {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 26px 26px 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.backup-dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  -webkit-tap-highlight-color: transparent;
}

.backup-dialog-close:hover {
  color: var(--text-primary);
}

.backup-dialog-title {
  font-family: var(--font-serif);
  font-size: 22px;
  margin: 0 0 10px;
  color: var(--text-primary);
}

.backup-dialog-lead {
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0 0 18px;
}

.backup-dialog-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.backup-dialog-actions .clients-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: var(--bg-card-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.backup-dialog-actions .clients-action-btn:hover {
  border-color: var(--accent-gold);
  background: var(--accent-gold-dim);
  color: var(--accent-gold);
}

.backup-dialog-hint {
  font-family: var(--font-sans);
  font-size: 12px;
  font-style: italic;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0;
}
