/* ═══════════════════════════════════════════════════════════
   MARK 5 — Design System v2.0.0
   Light Mode Video Visibility · Form Controls · Sub-Panel Drawers · Refined Aesthetics
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400;1,500&family=Josefin+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400&display=swap');

/* ── Custom Properties — Dark (default) ──────────────────── */

:root {
  --m5-bg:              #0d110b;
  --m5-surface:         #181e15;
  --m5-surface-2:       #20271c;
  --m5-cream:           #f5efe2;
  --m5-cream-muted:     rgba(245, 239, 226, 0.72);
  --m5-cream-faint:     rgba(245, 239, 226, 0.09);
  --m5-gold:            #d4b275;
  --m5-gold-bright:     #e5c58a;
  --m5-gold-glow:       rgba(212, 178, 117, 0.22);
  --m5-muted:           rgba(245, 239, 226, 0.45);

  --m5-glass:           rgba(24, 30, 21, 0.76);
  --m5-glass-border:    rgba(245, 239, 226, 0.12);
  --m5-glass-border-hi: rgba(245, 239, 226, 0.24);
  --m5-glass-shadow:    0 16px 48px rgba(0, 0, 0, 0.55);
  --m5-glass-blur:      blur(22px);

  --m5-nav-bg:          rgba(13, 17, 11, 0.85);
  --m5-nav-h:           4.2em;

  --m5-drawer-bg:       rgba(11, 14, 9, 0.98);
  --m5-overlay-bg:      rgba(8, 11, 6, 0.92);

  --m5-transition:      0.3s cubic-bezier(0.25, 1, 0.5, 1);
  --m5-radius:          16px;
  --m5-radius-pill:     50px;
  --m5-radius-nav:      44px;

  --m5-scrollbar-thumb: var(--m5-gold);
}

/* ── Light Theme Overrides ──────────────────────────────── */

[data-theme="light"] {
  --m5-bg:              #f4efe4;
  --m5-surface:         #e9e3d6;
  --m5-surface-2:       #ded8ca;
  --m5-cream:           #181e15;
  --m5-cream-muted:     rgba(24, 30, 21, 0.78);
  --m5-cream-faint:     rgba(24, 30, 21, 0.08);
  --m5-gold:            #9e7b3b;
  --m5-gold-bright:     #b38e4a;
  --m5-gold-glow:       rgba(158, 123, 59, 0.2);
  --m5-muted:           rgba(24, 30, 21, 0.48);

  --m5-glass:           rgba(255, 253, 247, 0.84);
  --m5-glass-border:    rgba(24, 30, 21, 0.12);
  --m5-glass-border-hi: rgba(24, 30, 21, 0.22);
  --m5-glass-shadow:    0 12px 36px rgba(0, 0, 0, 0.08);

  --m5-nav-bg:          rgba(244, 239, 228, 0.9);
  --m5-drawer-bg:       rgba(248, 244, 235, 0.98);
  --m5-overlay-bg:      rgba(235, 230, 218, 0.94);

  --m5-scrollbar-thumb: var(--m5-gold);
}

[data-theme="light"] body {
  background-color: var(--m5-bg);
}

/* Make video visible in light mode with subtle opacity */
[data-theme="light"] .m5-video-bg {
  display: block;
  opacity: 0;
}

[data-theme="light"] .m5-video-bg.is-loaded {
  opacity: 0.28 !important;
}

/* Soft light overlay tint allowing video movement to show softly */
[data-theme="light"] .m5-video-overlay {
  background: linear-gradient(160deg,
    rgba(244, 239, 228, 0.78) 0%,
    rgba(233, 227, 214, 0.62) 50%,
    rgba(244, 239, 228, 0.82) 100%);
}

[data-theme="light"] .m5-ambient {
  background: radial-gradient(circle, rgba(158, 123, 59, 0.1) 0%, transparent 70%);
}

/* ── Light Mode Nav Logo ────────────────────────────────── */
[data-theme="light"] .m5-nav__logo {
  content: url('/images/2026-tca-logo-black.png');
}

/* ── Reset & Base ───────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background-color: var(--m5-bg);
  color: var(--m5-cream);
  font-family: 'Josefin Sans', Arial, sans-serif;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
  min-height: 100vh;
  scrollbar-width: thin;
  scrollbar-color: var(--m5-scrollbar-thumb) transparent;
  transition: background-color 0.4s ease, color 0.4s ease;
}

body::-webkit-scrollbar { width: 6px; }
body::-webkit-scrollbar-thumb { background: var(--m5-scrollbar-thumb); border-radius: 4px; }

/* ── Video Background ───────────────────────────────────── */

.m5-video-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
  opacity: 0;
  transition: opacity 2s ease-in;
}

.m5-video-bg.is-loaded { opacity: 0.42; }

.m5-video-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg,
    rgba(10, 13, 8, 0.7) 0%,
    rgba(16, 21, 14, 0.45) 50%,
    rgba(10, 13, 8, 0.75) 100%);
  z-index: -1;
  pointer-events: none;
  transition: background 0.4s ease;
}

/* ── Typography ─────────────────────────────────────────── */

h1, h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--m5-cream);
  transition: color 0.4s ease;
}

h3, h4, h5, h6 {
  font-family: 'Josefin Sans', Arial, sans-serif;
  font-weight: 400;
  color: var(--m5-cream);
  transition: color 0.4s ease;
}

p { font-size: 1.05rem; color: var(--m5-cream-muted); line-height: 1.75; transition: color 0.4s ease; }

a {
  color: var(--m5-cream);
  text-decoration: none;
  transition: color var(--m5-transition);
}

a:hover { color: var(--m5-gold); }

/* ── Separator ──────────────────────────────────────────── */

.m5-separator {
  display: flex;
  align-items: center;
  gap: 1.2em;
  margin: 0.8em auto 1.2em;
  width: 100%;
  max-width: 18em;
}

.m5-separator::before,
.m5-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--m5-gold) 50%, transparent);
  opacity: 0.55;
}

.m5-separator__diamond {
  width: 7px;
  height: 7px;
  background: var(--m5-gold);
  transform: rotate(45deg);
  flex-shrink: 0;
  opacity: 0.8;
}

/* ── Navigation ─────────────────────────────────────────── */

.m5-nav {
  position: fixed;
  top: 0.9em;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 3em);
  max-width: 1240px;
  z-index: 200;
  background: var(--m5-nav-bg);
  backdrop-filter: var(--m5-glass-blur);
  -webkit-backdrop-filter: var(--m5-glass-blur);
  border: 1px solid var(--m5-glass-border);
  border-top-color: var(--m5-glass-border-hi);
  border-left-color: var(--m5-glass-border-hi);
  border-radius: var(--m5-radius-nav);
  box-shadow: var(--m5-glass-shadow);
  height: var(--m5-nav-h);
  transition: top var(--m5-transition), opacity var(--m5-transition),
              background var(--m5-transition), border-color var(--m5-transition);
}

.m5-nav.is-scrolled { top: 0.5em; box-shadow: 0 10px 36px rgba(0,0,0,0.5); }
.m5-nav.is-hidden { top: -5.5em; opacity: 0; }

.m5-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 1.8em;
}

.m5-nav__logo-link { display: flex; align-items: center; padding: 0; flex-shrink: 0; }
.m5-nav__logo { height: 2.6em; width: auto; object-fit: contain; transition: opacity var(--m5-transition); }
.m5-nav__logo:hover { opacity: 0.8; }

.m5-nav__links { display: flex; align-items: center; gap: 0.25em; list-style: none; }

.m5-nav__links a, .m5-nav__links button {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.5em 0.9em;
  font-size: 0.84em;
  font-weight: 600;
  font-family: 'Josefin Sans', Arial, sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--m5-cream);
  border-radius: var(--m5-radius-pill);
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--m5-transition), background var(--m5-transition);
  white-space: nowrap;
  text-decoration: none;
}

.m5-nav__links a:hover, .m5-nav__links button:hover {
  color: var(--m5-gold);
  background: var(--m5-cream-faint);
}

.m5-nav__links a i, .m5-nav__links button i { font-size: 0.95em; opacity: 0.8; }

/* Theme toggle */
.m5-theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--m5-cream);
  font-size: 1em;
  padding: 0.5em 0.8em;
  border-radius: var(--m5-radius-pill);
  transition: color var(--m5-transition), background var(--m5-transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}

.m5-theme-toggle:hover { color: var(--m5-gold); background: var(--m5-cream-faint); }
.m5-theme-toggle .icon-sun { display: none; }
.m5-theme-toggle .icon-moon { display: inline; }

[data-theme="light"] .m5-theme-toggle .icon-sun  { display: inline; }
[data-theme="light"] .m5-theme-toggle .icon-moon { display: none; }

/* Hamburger */
.m5-nav__hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4em;
  width: 2.6em;
  height: 2.6em;
}

.m5-nav__hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--m5-cream);
  border-radius: 2px;
  transform-origin: center;
  transition: transform 0.3s ease, opacity 0.3s ease, background 0.4s ease;
}

.m5-nav__hamburger.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.m5-nav__hamburger.is-active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.m5-nav__hamburger.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile overlay */
.m5-nav__overlay {
  position: fixed;
  inset: 0;
  background: var(--m5-overlay-bg);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease, background 0.4s ease;
}

.m5-nav__overlay.is-open { opacity: 1; visibility: visible; }

.m5-nav__overlay-close {
  position: absolute;
  top: 1.8em;
  right: 2em;
  background: none;
  border: none;
  color: var(--m5-cream);
  font-size: 1.6em;
  cursor: pointer;
  transition: color var(--m5-transition);
}

.m5-nav__overlay-close:hover { color: var(--m5-gold); }

.m5-nav__overlay-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6em;
  list-style: none;
}

.m5-nav__overlay-links a,
.m5-nav__overlay-links button {
  font-size: 1.8em;
  font-weight: 600;
  font-family: 'Josefin Sans', Arial, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--m5-cream);
  padding: 0.5em 2em;
  border-radius: var(--m5-radius-pill);
  display: block;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0;
  transform: translateY(14px);
  transition: color var(--m5-transition), background var(--m5-transition),
              opacity 0.35s ease, transform 0.35s ease;
  text-decoration: none;
}

.m5-nav__overlay.is-open .m5-nav__overlay-links a,
.m5-nav__overlay.is-open .m5-nav__overlay-links button { opacity: 1; transform: translateY(0); }

.m5-nav__overlay-links a:hover,
.m5-nav__overlay-links button:hover { color: var(--m5-gold); background: var(--m5-cream-faint); }

@media (max-width: 900px) {
  .m5-nav { width: calc(100% - 2em); }
  .m5-nav__links { display: none; }
  .m5-nav__hamburger { display: flex; }
}

/* ── Glass Cards ────────────────────────────────────────── */

.m5-glass {
  background: var(--m5-glass);
  backdrop-filter: var(--m5-glass-blur);
  -webkit-backdrop-filter: var(--m5-glass-blur);
  border: 1px solid var(--m5-glass-border);
  border-top-color: var(--m5-glass-border-hi);
  border-left-color: var(--m5-glass-border-hi);
  border-radius: var(--m5-radius);
  box-shadow: var(--m5-glass-shadow);
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.m5-glass--compact { padding: 1.6em; }
.m5-glass--md      { padding: 2.2em; }
.m5-glass--lg      { padding: 2.8em; }

.m5-glass__label {
  font-size: 0.76em;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--m5-gold);
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin-bottom: 1em;
  opacity: 0.9;
}

/* ── Form Controls ─────────────────────────────────────── */

.m5-label {
  display: block;
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--m5-gold);
  margin-bottom: 0.55em;
  text-align: left;
}

.m5-input, .m5-select {
  width: 100%;
  height: 3.2em;
  padding: 0 1.2em;
  font-family: 'Josefin Sans', Arial, sans-serif;
  font-size: 0.98em;
  color: var(--m5-cream);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--m5-glass-border-hi);
  border-radius: 12px;
  outline: none;
  transition: border-color var(--m5-transition), box-shadow var(--m5-transition);
}

[data-theme="light"] .m5-input,
[data-theme="light"] .m5-select {
  background: rgba(255, 255, 255, 0.75);
}

.m5-select option {
  background: var(--m5-surface-2);
  color: var(--m5-cream);
}

.m5-input:focus, .m5-select:focus {
  border-color: var(--m5-gold);
  box-shadow: 0 0 18px var(--m5-gold-glow);
}

/* ── Buttons ─────────────────────────────────────────────  */

.m5-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  height: 3.2em;
  padding: 0 2.2em;
  font-family: 'Josefin Sans', Arial, sans-serif;
  font-size: 0.88em;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--m5-cream);
  background: transparent;
  border: 1px solid var(--m5-gold);
  border-radius: var(--m5-radius-pill);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--m5-transition);
  white-space: nowrap;
}

.m5-btn:hover {
  background: var(--m5-gold-glow);
  color: var(--m5-gold);
  box-shadow: 0 0 24px var(--m5-gold-glow);
}

.m5-btn--filled {
  background: var(--m5-gold);
  color: #0d110b;
  border-color: var(--m5-gold);
  font-weight: 700;
}

.m5-btn--filled:hover {
  background: var(--m5-gold-bright);
  border-color: var(--m5-gold-bright);
  color: #0d110b;
  box-shadow: 0 0 28px rgba(212, 178, 117, 0.4);
}

.m5-btn--ghost { border-color: var(--m5-glass-border-hi); }
.m5-btn--ghost:hover { border-color: var(--m5-gold); color: var(--m5-gold); }

/* ── Hero Sections ──────────────────────────────────────── */

.m5-hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: 6.5em 2em 5em;
}

.m5-hero--center { padding-top: 0; }

.m5-hero__eyebrow {
  font-size: 0.82em;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--m5-gold);
  margin-bottom: 0.6em;
}

.m5-hero__title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 300;
  font-size: clamp(3.8rem, 9.5vw, 7.8rem);
  line-height: 0.98;
  letter-spacing: -0.01em;
  margin-bottom: 0.15em;
  color: var(--m5-cream);
}

.m5-hero__title em { font-style: italic; color: var(--m5-gold); }

.m5-hero__subtitle {
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  max-width: 42em;
  color: var(--m5-cream-muted);
  line-height: 1.75;
  margin-bottom: 2em;
}

.m5-hero__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2em;
  flex-wrap: wrap;
}

/* ── Scroll Reveal ──────────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.75s ease, transform 0.75s ease;
}

.reveal.is-visible { opacity: 1; transform: translateY(0); }
.reveal--delay-1 { transition-delay: 0.1s; }
.reveal--delay-2 { transition-delay: 0.2s; }
.reveal--delay-3 { transition-delay: 0.3s; }
.reveal--delay-4 { transition-delay: 0.4s; }

/* ── Prose (Paragraph Pages) ────────────────────────────── */

.m5-prose {
  max-width: 72ch;
  margin: 0 auto;
  padding: 3em 3.5em;
}

.m5-prose h1 {
  font-size: clamp(2.8rem, 5.5vw, 4.8rem);
  margin-bottom: 0.4em;
}

.m5-prose h2 {
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  margin-top: 2.2em;
  margin-bottom: 0.6em;
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--m5-glass-border);
}

.m5-prose h3 {
  font-size: 1rem;
  margin-top: 1.6em;
  margin-bottom: 0.5em;
  color: var(--m5-gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}

.m5-prose p { margin-bottom: 1.4em; color: var(--m5-cream-muted); font-size: 1.08rem; line-height: 1.8; }

.m5-prose > p:first-of-type::first-letter {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 3.8em;
  float: left;
  line-height: 0.72;
  margin: 0.05em 0.12em 0 0;
  color: var(--m5-gold);
}

.m5-prose ul, .m5-prose ol { padding-left: 1.6em; color: var(--m5-cream-muted); margin-bottom: 1.4em; }
.m5-prose li { margin-bottom: 0.5em; font-size: 1.05rem; }
.m5-prose strong { color: var(--m5-cream); font-weight: 600; }
.m5-prose a { color: var(--m5-gold); text-decoration: underline; text-underline-offset: 3px; }

/* ── Dashboard Layout & Widgets ─────────────────────────── */

.m5-dashboard-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.m5-dashboard-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--m5-nav-h) + 1.8em) 2em 2.5em;
}

.m5-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.45fr 1fr;
  gap: 2.2em;
  width: 100%;
  max-width: 92em;
  margin: 0 auto;
  align-items: center;
}

@media (max-width: 1150px) {
  .m5-dashboard-grid {
    grid-template-columns: 1fr 1fr;
    max-width: 54em;
    gap: 1.8em;
  }
  .m5-welcome-col { grid-column: 1 / -1; order: -1; }
}

@media (max-width: 680px) {
  .m5-dashboard-grid { grid-template-columns: 1fr; max-width: 40em; gap: 1.5em; }
  .m5-dashboard-main { padding-left: 1.4em; padding-right: 1.4em; }
}

.m5-widget { padding: 2.2em; }

.m5-widget__label {
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--m5-gold);
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin-bottom: 1.2em;
  opacity: 0.9;
}

/* ── Weather Widget ─────────────────────────────────────── */

.m5-weather__temp {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(3.5rem, 7vw, 5rem);
  font-weight: 300;
  line-height: 1;
  color: var(--m5-cream);
}

.m5-weather__location {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2.1em;
  font-weight: 400;
  font-style: italic;
  color: var(--m5-cream);
  margin: 0.1em 0 0.5em;
}

.m5-weather__current {
  display: flex;
  align-items: center;
  gap: 1.4em;
  margin: 0.6em 0 1.2em;
}

.m5-weather__desc { border-left: 2px solid var(--m5-gold); padding-left: 1.2em; }
.m5-weather__condition { font-size: 1.15em; font-weight: 600; color: var(--m5-cream); margin: 0 0 0.3em; }
.m5-weather__crating { font-size: 0.88em; color: var(--m5-cream-muted); margin: 0; }

.m5-weather__details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5em;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 12px;
  padding: 1.1em 0.9em;
  margin-top: 0.5em;
  border: 1px solid var(--m5-glass-border);
}

[data-theme="light"] .m5-weather__details { background: rgba(0, 0, 0, 0.05); }

.m5-weather__detail { display: flex; flex-direction: column; align-items: center; gap: 0.35em; }
.m5-weather__detail-icon { color: var(--m5-gold); font-size: 1.15em; }
.m5-weather__detail-label { font-size: 0.72em; letter-spacing: 0.1em; text-transform: uppercase; color: var(--m5-muted); }
.m5-weather__detail-value { font-size: 1.05em; font-weight: 600; color: var(--m5-cream); }

/* ── Welcome Widget ─────────────────────────────────────── */

.m5-welcome { text-align: center; padding: 1em 1em 1em; }

.m5-welcome__greeting {
  font-size: 0.82em;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--m5-gold);
  margin-bottom: 0.3em;
}

.m5-welcome__name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 300;
  font-size: clamp(3.2rem, 5.8vw, 5.2rem);
  line-height: 1.05;
  margin-bottom: 0.25em;
}

.m5-welcome__name em { font-style: italic; color: var(--m5-gold); }

/* ── Link Search ────────────────────────────────────────── */

.m5-link-search-wrap {
  position: relative;
  width: 100%;
  max-width: 28em;
  margin: 0 auto;
}

.m5-link-search__bar {
  display: flex;
  align-items: center;
  gap: 0.75em;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(219, 178, 126, 0.35);
  border-radius: var(--m5-radius-pill);
  padding: 0.75em 1.4em;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(219, 178, 126, 0.24), 0 0 45px rgba(219, 178, 126, 0.1);
  animation: m5GlowPulse 4s ease-in-out infinite alternate;
  transition: border-color var(--m5-transition), box-shadow var(--m5-transition), transform 0.2s ease, background 0.4s ease;
}

@keyframes m5GlowPulse {
  0% {
    box-shadow: 0 0 16px rgba(219, 178, 126, 0.2), 0 0 35px rgba(219, 178, 126, 0.08);
    border-color: rgba(219, 178, 126, 0.3);
  }
  100% {
    box-shadow: 0 0 28px rgba(219, 178, 126, 0.38), 0 0 60px rgba(219, 178, 126, 0.18);
    border-color: rgba(219, 178, 126, 0.6);
  }
}

.m5-link-search__bar:hover {
  border-color: var(--m5-gold);
  box-shadow: 0 0 32px rgba(219, 178, 126, 0.5), 0 0 70px rgba(219, 178, 126, 0.25);
  transform: scale(1.015);
}

[data-theme="light"] .m5-link-search__bar { background: rgba(255, 255, 255, 0.65); }

.m5-link-search__bar:focus-within {
  border-color: var(--m5-gold);
  box-shadow: 0 0 26px var(--m5-gold-glow);
}

.m5-link-search__icon { color: var(--m5-gold); font-size: 1.1em; flex-shrink: 0; pointer-events: none; opacity: 0.85; }

.m5-link-search__input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--m5-cream);
  font-family: 'Josefin Sans', Arial, sans-serif;
  font-size: 1.02em;
  letter-spacing: 0.03em;
  padding: 0;
}

.m5-link-search__input::placeholder { color: var(--m5-muted); font-style: italic; }

.m5-link-search__results {
  position: absolute;
  top: calc(100% + 0.6em);
  left: 0;
  right: 0;
  background: var(--m5-drawer-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--m5-glass-border-hi);
  border-radius: 18px;
  list-style: none;
  z-index: 50;
  display: none;
  overflow: hidden;
  box-shadow: var(--m5-glass-shadow);
}

.m5-link-search__results.is-visible { display: block; animation: m5FadeSlide 0.2s ease forwards; }

.m5-link-search__item a {
  display: flex;
  align-items: center;
  gap: 0.85em;
  padding: 0.8em 1.4em;
  font-size: 1em;
  color: var(--m5-cream);
  transition: background var(--m5-transition), color var(--m5-transition);
}

.m5-link-search__item a:hover,
.m5-link-search__item.is-active a { background: var(--m5-cream-faint); color: var(--m5-gold); }

/* ── Bible Widget ───────────────────────────────────────── */

.m5-bible__ref {
  font-size: 0.88em;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--m5-gold);
  margin-bottom: 0.9em;
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.m5-bible__text {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.55em;
  font-style: italic;
  font-weight: 400;
  line-height: 1.7;
  color: var(--m5-cream);
  position: relative;
  padding: 0 1.2em;
}

.m5-bible__quote-l, .m5-bible__quote-r {
  position: absolute;
  font-size: 0.65em;
  opacity: 0.25;
  color: var(--m5-gold);
}

.m5-bible__quote-l { left: -2px; top: -8px; }
.m5-bible__quote-r { right: -2px; bottom: -10px; }

.m5-bible__version {
  margin-top: 1.2em;
  font-size: 0.78em;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--m5-muted);
  padding-top: 0.9em;
  border-top: 1px solid var(--m5-glass-border);
}

/* ── Settings Drawer ────────────────────────────────────── */

.m5-drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(440px, 100vw);
  height: 100vh;
  background: var(--m5-drawer-bg);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border-left: 1px solid var(--m5-glass-border-hi);
  z-index: 400;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), background 0.4s ease;
  overflow-y: auto;
}

.m5-drawer.is-open { transform: translateX(0); }

.m5-drawer__backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 390;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.m5-drawer__backdrop.is-open { opacity: 1; visibility: visible; }

.m5-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2.2em 2.2em 1.6em;
  border-bottom: 1px solid var(--m5-glass-border);
  flex-shrink: 0;
}

.m5-drawer__title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2em;
  font-weight: 400;
  color: var(--m5-cream);
}

.m5-drawer__close {
  background: none; border: none;
  color: var(--m5-cream-muted);
  font-size: 1.4em;
  cursor: pointer;
  padding: 0.3em;
  transition: color var(--m5-transition);
}

.m5-drawer__close:hover { color: var(--m5-gold); }

.m5-drawer__body { flex: 1; padding: 1.8em 2.2em 2.4em; overflow-y: auto; }
.m5-drawer__section { margin-bottom: 2em; }

.m5-drawer__section-title {
  font-size: 0.74em;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--m5-gold);
  margin-bottom: 0.9em;
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--m5-glass-border);
}

.m5-drawer__link {
  display: flex;
  align-items: center;
  gap: 0.85em;
  padding: 0.8em 1.1em;
  color: var(--m5-cream);
  border-radius: 12px;
  font-size: 1.02em;
  letter-spacing: 0.04em;
  transition: background var(--m5-transition), color var(--m5-transition);
  margin-bottom: 0.35em;
  text-decoration: none;
}

.m5-drawer__link i { width: 1.3em; text-align: center; color: var(--m5-gold); opacity: 0.8; font-size: 0.95em; }
.m5-drawer__link:hover { background: var(--m5-cream-faint); color: var(--m5-gold); }

/* ── Modals ─────────────────────────────────────────────── */

.m5-modal-wrap {
  position: fixed; inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--m5-overlay-bg);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease, background 0.4s ease;
}

.m5-modal-wrap.is-open { opacity: 1; visibility: visible; }

.m5-modal {
  width: 90%;
  max-width: 40em;
  padding: 3.2em 2.8em;
  background: var(--m5-glass);
  border: 1px solid var(--m5-glass-border-hi);
  border-radius: 26px;
  box-shadow: 0 28px 90px rgba(0,0,0,0.55);
  text-align: center;
  transform: translateY(30px);
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1), background 0.4s ease;
}

.m5-modal-wrap.is-open .m5-modal { transform: translateY(0); }
.m5-modal h2 { font-size: 2.4em; margin-bottom: 0.6em; color: var(--m5-gold); }
.m5-modal p { font-size: 1.08em; line-height: 1.7; text-transform: none; margin-bottom: 1.5em; }

.m5-modal__close {
  margin-top: 1.6em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.m5-modal__close svg {
  width: 3.2rem;
  fill: var(--m5-cream-muted);
  transition: fill var(--m5-transition), transform var(--m5-transition);
}

.m5-modal__close:hover svg { fill: var(--m5-gold); transform: scale(1.1); }

.m5-modal--scroll { max-height: 90vh; display: flex; flex-direction: column; padding-bottom: 1.8em; }

.m5-modal__scroll-body {
  flex: 1;
  overflow-y: auto;
  text-align: left;
  background: rgba(0,0,0,0.15);
  border-radius: 14px;
  border: 1px solid var(--m5-glass-border);
  margin: 1em 0 0;
  scrollbar-width: thin;
  scrollbar-color: var(--m5-gold) transparent;
}

[data-theme="light"] .m5-modal__scroll-body { background: rgba(255,255,255,0.4); }

/* ── Footer ─────────────────────────────────────────────── */

.m5-footer {
  text-align: center;
  padding: 2.2em 1.5em 3.2em;
  border-top: 1px solid var(--m5-glass-border);
  margin-top: auto;
}

.m5-footer__links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8em 2em;
  flex-wrap: wrap;
  margin-bottom: 0.6em;
  list-style: none;
}

.m5-footer__links a {
  font-size: 0.82em;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--m5-cream-muted);
  transition: color var(--m5-transition);
}

.m5-footer__links a:hover { color: var(--m5-gold); }

/* ── Ambient Glow ───────────────────────────────────────── */

.m5-ambient {
  position: fixed;
  width: 80vw; height: 80vw;
  max-width: 900px; max-height: 900px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 178, 117, 0.1) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
  transition: background 0.4s ease;
}

/* ── Utilities ──────────────────────────────────────────── */

.m5-text-gold { color: var(--m5-gold); }
.m5-text-muted { color: var(--m5-cream-muted); }
.m5-text-center { text-align: center; }

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

.m5-fade-in { animation: m5FadeIn 0.8s ease forwards; }
.m5-fade-in--delay-1 { animation-delay: 0.1s; opacity: 0; }
.m5-fade-in--delay-2 { animation-delay: 0.25s; opacity: 0; }
.m5-fade-in--delay-3 { animation-delay: 0.4s; opacity: 0; }
.m5-fade-in--delay-4 { animation-delay: 0.55s; opacity: 0; }


/* ── Mark 5 Admin & Directory Extensions (v2.1.0) ── */
.m5-admin-shell {
    width: 100%;
    max-width: 88em;
    margin: 0 auto;
    padding: 2em 1.5em 5em;
    box-sizing: border-box;
    position: relative;
    z-index: 2;
}

.m5-admin-header-card {
    padding: 2.2em 2.4em;
    margin-bottom: 2em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5em;
    border-radius: 20px;
}

.m5-admin-title {
    font-family: var(--m5-font-serif, "Cinzel Decorative", Georgia, serif);
    font-size: 2.3em;
    font-weight: 700;
    color: var(--m5-gold);
    margin: 0;
    line-height: 1.15;
    letter-spacing: 0.04em;
}

.m5-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.2em;
    margin-bottom: 2em;
}

.m5-kpi-card {
    padding: 1.4em 1.6em;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 1.2em;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.m5-kpi-card:hover {
    transform: translateY(-2px);
    border-color: var(--m5-gold);
}

.m5-kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(219, 178, 126, 0.12);
    border: 1px solid rgba(219, 178, 126, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    color: var(--m5-gold);
    flex-shrink: 0;
}

.m5-kpi-num {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--m5-cream);
    line-height: 1.1;
}

.m5-kpi-label {
    font-size: 0.78em;
    color: var(--m5-cream-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.2em;
}

.m5-admin-toolbar {
    padding: 1.2em 1.5em;
    border-radius: 16px;
    margin-bottom: 1.5em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1em;
}

.m5-user-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.m5-user-table th {
    background: rgba(0, 0, 0, 0.4);
    color: var(--m5-gold);
    padding: 1.1em 1.4em;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--m5-border);
}

.m5-user-table td {
    padding: 1.1em 1.4em;
    border-bottom: 1px solid var(--m5-border-faint);
    color: var(--m5-cream);
    font-size: 0.92em;
    vertical-align: middle;
}

.m5-user-row {
    cursor: pointer;
    transition: background 0.15s ease;
}

.m5-user-row:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

.m5-drawer-wrap {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.m5-drawer-wrap.is-open {
    display: flex;
    opacity: 1;
}

.m5-drawer {
    width: 100%;
    max-width: 580px;
    height: 100%;
    background: var(--m5-surface, #131b17);
    border-left: 1px solid var(--m5-border);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.6);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-sizing: border-box;
}

.m5-drawer-wrap.is-open .m5-drawer {
    transform: translateX(0);
}


/* ── Mark 5 AI Omnibar & Search Card (v2.2.0) ── */
.m5-link-search__ai-trigger {
    display: flex;
    align-items: center;
    gap: 0.8em;
    padding: 0.8em 1.2em;
    cursor: pointer;
    background: rgba(219, 178, 126, 0.08);
    border-top: 1px solid var(--m5-border);
    transition: background 0.2s ease;
    color: var(--m5-cream);
    font-size: 0.92em;
}

.m5-link-search__ai-trigger:hover,
.m5-link-search__ai-trigger.is-active {
    background: rgba(219, 178, 126, 0.18);
    color: var(--m5-gold);
}

.m5-link-search__ai-trigger i {
    color: var(--m5-gold);
    font-size: 1.1em;
}

.m5-link-search__ai-card {
    background: rgba(18, 26, 22, 0.95);
    border: 1px solid rgba(219, 178, 126, 0.35);
    border-radius: 14px;
    margin: 0.6em;
    padding: 1.2em 1.4em;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    text-align: left;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.m5-ai-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8em;
    padding-bottom: 0.6em;
    border-bottom: 1px solid var(--m5-border-faint);
}

.m5-ai-card-title {
    font-size: 0.85em;
    font-weight: 700;
    color: var(--m5-gold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.m5-ai-card-actions {
    display: flex;
    gap: 0.4em;
}

.m5-ai-card-body {
    font-size: 0.94em;
    line-height: 1.6;
    color: var(--m5-cream);
    word-break: break-word;
}

.m5-ai-card-body p {
    margin: 0 0 0.6em;
}

.m5-ai-card-body p:last-child {
    margin-bottom: 0;
}

.m5-ai-card-body ul, .m5-ai-card-body ol {
    margin: 0.4em 0 0.8em 1.4em;
    padding: 0;
}

.m5-ai-card-body li {
    margin-bottom: 0.3em;
}

.m5-ai-card-body code {
    background: rgba(0, 0, 0, 0.4);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.88em;
}

.m5-ai-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-top: 1em;
    padding-top: 0.8em;
    border-top: 1px solid var(--m5-border-faint);
}

.m5-ai-source-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--m5-border);
    color: var(--m5-cream-muted);
    padding: 0.3em 0.7em;
    border-radius: 20px;
    font-size: 0.78em;
    text-decoration: none;
    transition: all 0.2s ease;
}

.m5-ai-source-chip:hover {
    background: rgba(219, 178, 126, 0.15);
    border-color: var(--m5-gold);
    color: var(--m5-gold);
}

.m5-ai-shimmer {
    display: flex;
    flex-direction: column;
    gap: 0.6em;
    padding: 0.5em 0;
}

.m5-ai-shimmer-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(255,255,255,0.06) 0%, rgba(219,178,126,0.18) 50%, rgba(255,255,255,0.06) 100%);
    background-size: 200% 100%;
    animation: m5Shimmer 1.5s infinite;
}

@keyframes m5Shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ── Backstage Intelligence Chat Modal (v2.3.0) ────────── */
.m5-chat-modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5em;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.m5-chat-modal-wrap.is-open {
  display: flex;
  opacity: 1;
}

.m5-chat-modal {
  width: 100%;
  max-width: 52em;
  max-height: 88vh;
  background: var(--m5-surface, #131b17);
  border: 1px solid rgba(219, 178, 126, 0.4);
  border-radius: 22px;
  box-shadow: 0 0 40px rgba(219, 178, 126, 0.18), 0 20px 60px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transform: scale(0.96) translateY(-10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.m5-chat-modal-wrap.is-open .m5-chat-modal {
  transform: scale(1) translateY(0);
}

.m5-chat-header {
  padding: 1.2em 1.6em;
  border-bottom: 1px solid var(--m5-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
}

.m5-chat-title {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--m5-font-serif, "Cinzel Decorative", Georgia, serif);
  font-size: 1.18em;
  color: var(--m5-gold);
  margin: 0;
  letter-spacing: 0.04em;
}

.m5-chat-quick-tray {
  padding: 0.6em 1.4em;
  border-bottom: 1px solid var(--m5-border-faint);
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  gap: 0.6em;
  overflow-x: auto;
  align-items: center;
}

.m5-chat-quick-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.4em 0.85em;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--m5-border);
  border-radius: 20px;
  color: var(--m5-cream);
  font-size: 0.84em;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.m5-chat-quick-pill:hover {
  background: rgba(219, 178, 126, 0.18);
  border-color: var(--m5-gold);
  color: var(--m5-gold);
}

.m5-chat-feed {
  flex: 1;
  overflow-y: auto;
  padding: 1.6em;
  display: flex;
  flex-direction: column;
  gap: 1.2em;
  max-height: 52vh;
}

.m5-chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  line-height: 1.6;
}

.m5-chat-msg--user {
  align-self: flex-end;
  background: rgba(219, 178, 126, 0.16);
  border: 1px solid rgba(219, 178, 126, 0.35);
  color: var(--m5-cream);
  padding: 0.8em 1.2em;
  border-radius: 18px 18px 4px 18px;
  font-size: 0.96em;
}

.m5-chat-msg--ai {
  align-self: flex-start;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--m5-border);
  color: var(--m5-cream);
  padding: 1.2em 1.4em;
  border-radius: 18px 18px 18px 4px;
  font-size: 0.94em;
  width: 95%;
  box-sizing: border-box;
}

.m5-chat-ai-author {
  font-size: 0.78em;
  font-weight: 700;
  color: var(--m5-gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 0.4em;
  margin-bottom: 0.6em;
}

/* Rich Markdown inside Chat Responses */
.m5-chat-markdown h1, .m5-chat-markdown h2, .m5-chat-markdown h3, .m5-chat-markdown h4 {
  color: var(--m5-gold);
  margin: 0.8em 0 0.4em;
  font-weight: 600;
  line-height: 1.25;
}
.m5-chat-markdown h1 { font-size: 1.3em; }
.m5-chat-markdown h2 { font-size: 1.18em; }
.m5-chat-markdown h3 { font-size: 1.05em; }

.m5-chat-markdown p {
  margin: 0 0 0.8em;
}
.m5-chat-markdown p:last-child {
  margin-bottom: 0;
}

.m5-chat-markdown ul, .m5-chat-markdown ol {
  margin: 0.4em 0 0.8em 1.4em;
  padding: 0;
}
.m5-chat-markdown li {
  margin-bottom: 0.35em;
}

.m5-chat-markdown blockquote {
  border-left: 3px solid var(--m5-gold);
  padding-left: 1em;
  margin: 0.8em 0;
  color: var(--m5-cream-muted);
  font-style: italic;
}

.m5-chat-markdown pre {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--m5-border);
  border-radius: 10px;
  padding: 1em;
  overflow-x: auto;
  margin: 0.8em 0;
  position: relative;
}

.m5-chat-markdown code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.2em 0.4em;
  border-radius: 4px;
}

.m5-chat-markdown pre code {
  background: transparent;
  padding: 0;
}

.m5-chat-markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8em 0;
  font-size: 0.9em;
}

.m5-chat-markdown th, .m5-chat-markdown td {
  padding: 0.6em 0.8em;
  border: 1px solid var(--m5-border);
  text-align: left;
}

.m5-chat-markdown th {
  background: rgba(219, 178, 126, 0.12);
  color: var(--m5-gold);
  font-weight: 600;
}

.m5-chat-input-area {
  padding: 1em 1.4em 1.2em;
  border-top: 1px solid var(--m5-border);
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 0.6em;
}

.m5-chat-input-bar {
  display: flex;
  align-items: center;
  gap: 0.6em;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--m5-border);
  border-radius: 14px;
  padding: 0.5em 0.8em 0.5em 1.1em;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.m5-chat-input-bar:focus-within {
  border-color: var(--m5-gold);
  box-shadow: 0 0 18px rgba(219, 178, 126, 0.25);
}

.m5-chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--m5-cream);
  font-size: 0.96em;
  padding: 0.4em 0;
}

.m5-chat-send-btn {
  background: rgba(219, 178, 126, 0.2);
  border: 1px solid var(--m5-gold);
  color: var(--m5-gold);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 0.95em;
  flex-shrink: 0;
}

.m5-chat-send-btn:hover {
  background: var(--m5-gold);
  color: #121815;
}

.m5-chat-chips {
  display: flex;
  gap: 0.5em;
  overflow-x: auto;
  padding-bottom: 0.2em;
}

.m5-chat-chip-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--m5-border-faint);
  color: var(--m5-cream-muted);
  border-radius: 16px;
  padding: 0.3em 0.8em;
  font-size: 0.78em;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.m5-chat-chip-btn:hover {
  background: rgba(219, 178, 126, 0.15);
  border-color: var(--m5-gold);
  color: var(--m5-gold);
}


/* ── Backstage Intelligence Full-Screen Overlay & Typography (v2.4.0) ── */
.m5-fullscreen-overlay-wrap {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(8, 14, 11, 0.94);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  display: none;
  opacity: 0;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.m5-fullscreen-overlay-wrap.is-open {
  display: block;
  opacity: 1;
}

.m5-fullscreen-container {
  width: 100%;
  max-width: 62em;
  height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 1.8em 2em 1.8em;
  position: relative;
}

.m5-fullscreen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1.2em;
  border-bottom: 1px solid var(--m5-border);
  flex-shrink: 0;
}

.m5-fullscreen-brand {
  display: flex;
  align-items: center;
  gap: 0.9em;
}

.m5-fullscreen-crest {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(219, 178, 126, 0.14);
  border: 1px solid rgba(219, 178, 126, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--m5-gold);
  font-size: 1.25em;
  box-shadow: 0 0 16px rgba(219, 178, 126, 0.2);
}

.m5-fullscreen-title {
  font-family: var(--m5-font-serif, "Cinzel Decorative", Georgia, serif);
  font-size: 1.4em;
  color: var(--m5-gold);
  margin: 0;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.m5-fullscreen-subtitle {
  font-size: 0.78em;
  color: var(--m5-cream-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: block;
  margin-top: 0.1em;
}

.m5-fullscreen-close {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--m5-border);
  color: var(--m5-cream-muted);
  padding: 0.5em 0.9em;
  border-radius: 10px;
  font-size: 0.85em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  transition: all 0.2s ease;
}

.m5-fullscreen-close:hover {
  background: rgba(219, 178, 126, 0.2);
  border-color: var(--m5-gold);
  color: var(--m5-gold);
}

/* Matched quick links tray */
.m5-fullscreen-quick-tray {
  padding: 0.8em 0;
  display: flex;
  gap: 0.6em;
  overflow-x: auto;
  align-items: center;
  flex-shrink: 0;
}

/* Chat Feed */
.m5-fullscreen-feed {
  flex: 1;
  overflow-y: auto;
  padding: 2em 0.5em 2em 0;
  display: flex;
  flex-direction: column;
  gap: 2em;
  scroll-behavior: smooth;
}

/* Custom scrollbar */
.m5-fullscreen-feed::-webkit-scrollbar {
  width: 6px;
}
.m5-fullscreen-feed::-webkit-scrollbar-track {
  background: transparent;
}
.m5-fullscreen-feed::-webkit-scrollbar-thumb {
  background: rgba(219, 178, 126, 0.25);
  border-radius: 6px;
}

.m5-fs-msg {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  animation: m5FadeSlide 0.25s ease forwards;
}

.m5-fs-msg--user {
  align-self: flex-end;
  max-width: 82%;
  background: rgba(219, 178, 126, 0.18);
  border: 1px solid rgba(219, 178, 126, 0.38);
  color: var(--m5-cream);
  padding: 1.1em 1.6em;
  border-radius: 22px 22px 6px 22px;
  font-size: 1.08em;
  font-weight: 500;
  line-height: 1.6;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.m5-fs-msg--ai {
  align-self: flex-start;
  width: 100%;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(219, 178, 126, 0.22);
  border-radius: 22px;
  padding: 1.8em 2.2em;
  box-sizing: border-box;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.m5-fs-ai-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2em;
  padding-bottom: 0.8em;
  border-bottom: 1px solid rgba(219, 178, 126, 0.15);
}

.m5-fs-ai-author {
  font-size: 0.88em;
  font-weight: 700;
  color: var(--m5-gold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 0.55em;
}

/* Enhanced Markdown Typography */
.m5-fs-markdown {
  font-size: 1.08em;
  line-height: 1.85;
  color: #f7f3ec;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0.015em;
  word-break: break-word;
}

.m5-fs-markdown p {
  margin: 0 0 1.1em;
}
.m5-fs-markdown p:last-child {
  margin-bottom: 0;
}

.m5-fs-markdown h1,
.m5-fs-markdown h2,
.m5-fs-markdown h3,
.m5-fs-markdown h4 {
  font-family: var(--m5-font-serif, "Cinzel Decorative", Georgia, serif);
  color: var(--m5-gold);
  margin: 1.4em 0 0.6em;
  font-weight: 700;
  line-height: 1.3;
}
.m5-fs-markdown h1 { font-size: 1.5em; border-bottom: 1px solid var(--m5-border-faint); padding-bottom: 0.4em; }
.m5-fs-markdown h2 { font-size: 1.32em; }
.m5-fs-markdown h3 { font-size: 1.15em; }

.m5-fs-markdown ul,
.m5-fs-markdown ol {
  margin: 0.8em 0 1.2em 1.8em;
  padding: 0;
}
.m5-fs-markdown li {
  margin-bottom: 0.5em;
}

.m5-fs-markdown blockquote {
  border-left: 3px solid var(--m5-gold);
  padding: 0.6em 1.2em;
  margin: 1.2em 0;
  background: rgba(219, 178, 126, 0.06);
  border-radius: 0 8px 8px 0;
  color: #ddd3c3;
  font-style: italic;
}

.m5-fs-markdown pre {
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(219, 178, 126, 0.3);
  border-radius: 12px;
  padding: 1.2em 1.4em;
  overflow-x: auto;
  margin: 1.2em 0;
}

.m5-fs-markdown code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.25em 0.5em;
  border-radius: 6px;
  color: #ffd699;
}

.m5-fs-markdown pre code {
  background: transparent;
  padding: 0;
  color: var(--m5-cream);
  font-size: 0.92em;
}

.m5-fs-markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: 0.95em;
}

.m5-fs-markdown th,
.m5-fs-markdown td {
  padding: 0.8em 1em;
  border: 1px solid var(--m5-border);
  text-align: left;
}

.m5-fs-markdown th {
  background: rgba(219, 178, 126, 0.15);
  color: var(--m5-gold);
  font-weight: 700;
}

/* Dynamic Follow-Up Suggestions Tray */
.m5-fs-followups {
  margin-top: 1.5em;
  padding-top: 1.2em;
  border-top: 1px solid rgba(219, 178, 126, 0.18);
  display: flex;
  flex-direction: column;
  gap: 0.6em;
}

.m5-fs-followup-label {
  font-size: 0.78em;
  font-weight: 700;
  color: var(--m5-gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 0.4em;
}

.m5-fs-followup-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em;
}

.m5-fs-followup-btn {
  background: rgba(219, 178, 126, 0.1);
  border: 1px solid rgba(219, 178, 126, 0.35);
  color: var(--m5-cream);
  padding: 0.5em 1em;
  border-radius: 20px;
  font-size: 0.85em;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.m5-fs-followup-btn:hover {
  background: var(--m5-gold);
  color: #121815;
  border-color: var(--m5-gold);
  transform: translateY(-1px);
}

/* Input Bar at Bottom */
.m5-fullscreen-bottom {
  padding-top: 1em;
  flex-shrink: 0;
  position: relative;
}

.m5-fullscreen-input-bar {
  display: flex;
  align-items: center;
  gap: 0.9em;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(219, 178, 126, 0.45);
  border-radius: 20px;
  padding: 0.75em 1.2em 0.75em 1.4em;
  box-shadow: 0 0 30px rgba(219, 178, 126, 0.18);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.m5-fullscreen-input-bar:focus-within {
  border-color: var(--m5-gold);
  box-shadow: 0 0 35px rgba(219, 178, 126, 0.35);
}

.m5-fullscreen-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--m5-cream);
  font-size: 1.06em;
  font-family: inherit;
  padding: 0.3em 0;
}

.m5-fullscreen-input::placeholder {
  color: var(--m5-cream-muted);
  opacity: 0.7;
}

.m5-fullscreen-send-btn {
  background: rgba(219, 178, 126, 0.25);
  border: 1px solid var(--m5-gold);
  color: var(--m5-gold);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 1.05em;
  flex-shrink: 0;
}

.m5-fullscreen-send-btn:hover {
  background: var(--m5-gold);
  color: #121815;
}

.m5-fullscreen-hint {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75em;
  color: var(--m5-cream-muted);
  margin-top: 0.6em;
  padding: 0 0.5em;
}

/* Streaming Cursor & Micro-Interactions */
.m5-streaming-cursor {
  display: inline-block;
  width: 7px;
  height: 1.15em;
  background-color: var(--m5-gold, #dbb27e);
  margin-left: 4px;
  vertical-align: -0.15em;
  animation: m5CursorPulse 0.8s infinite ease-in-out;
  border-radius: 2px;
}
@keyframes m5CursorPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.m5-fs-copy-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(219, 178, 126, 0.2);
  color: var(--m5-cream-muted, #c2b9a7);
  font-size: 0.82em;
  font-weight: 600;
  padding: 0.3em 0.7em;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}
.m5-fs-copy-btn:hover {
  background: rgba(219, 178, 126, 0.15);
  color: var(--m5-gold, #dbb27e);
  border-color: var(--m5-gold, #dbb27e);
}

/* ElevenLabs Voice Agent - Garrison Equipment Elevated Floating Layout */
elevenlabs-convai,
#el-agent {
  position: fixed !important;
  bottom: 96px !important;
  right: 28px !important;
  z-index: 800 !important;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.45));
  transition: opacity 0.25s ease, bottom 0.3s ease !important;
}

body:has(.m5-fullscreen-overlay-wrap.is-open) elevenlabs-convai,
body:has(#m5-chat-fullscreen.is-open) #el-agent {
  opacity: 1 !important;
  pointer-events: auto !important;
  z-index: 100005 !important;
}

@media (max-width: 768px) {
  elevenlabs-convai,
  #el-agent {
    bottom: 112px !important;
    right: 18px !important;
  }
}

/* Smooth Streaming Font & Motion Enhancements */
.m5-fs-markdown {
  text-rendering: optimizeLegibility !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
}

.m5-fullscreen-feed {
  scroll-behavior: smooth !important;
}

.m5-streaming-cursor {
  box-shadow: 0 0 8px rgba(219, 178, 126, 0.6) !important;
}

/* ══════════════════════════════════════════════════════════════════════
   BACKSTAGE INTELLIGENCE: LIGHT THEME & MOBILE RESPONSIVENESS
   ══════════════════════════════════════════════════════════════════════ */

/* ── Light Mode Overrides ─────────────────────────────────────────── */
[data-theme="light"] .m5-fullscreen-overlay-wrap {
  background: rgba(246, 242, 235, 0.96) !important;
}

[data-theme="light"] .m5-fullscreen-header {
  border-bottom-color: rgba(24, 30, 21, 0.12) !important;
}

[data-theme="light"] .m5-fullscreen-crest {
  background: rgba(158, 123, 59, 0.12) !important;
  border-color: rgba(158, 123, 59, 0.35) !important;
  color: #8c6a2e !important;
  box-shadow: 0 0 16px rgba(158, 123, 59, 0.15) !important;
}

[data-theme="light"] .m5-fullscreen-title {
  color: #8c6a2e !important;
}

[data-theme="light"] .m5-fullscreen-subtitle {
  color: rgba(24, 30, 21, 0.62) !important;
}

[data-theme="light"] .m5-fullscreen-close {
  background: rgba(24, 30, 21, 0.05) !important;
  border-color: rgba(24, 30, 21, 0.15) !important;
  color: #242d20 !important;
}

[data-theme="light"] .m5-fullscreen-close:hover {
  background: rgba(158, 123, 59, 0.18) !important;
  border-color: #8c6a2e !important;
  color: #8c6a2e !important;
}

[data-theme="light"] .m5-fullscreen-feed::-webkit-scrollbar-thumb {
  background: rgba(158, 123, 59, 0.35) !important;
}

[data-theme="light"] .m5-fs-msg--user {
  background: rgba(158, 123, 59, 0.16) !important;
  border-color: rgba(158, 123, 59, 0.38) !important;
  color: #181e15 !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .m5-fs-msg--ai {
  background: #ffffff !important;
  border-color: rgba(158, 123, 59, 0.22) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .m5-fs-ai-header {
  border-bottom-color: rgba(158, 123, 59, 0.16) !important;
}

[data-theme="light"] .m5-fs-ai-author {
  color: #8c6a2e !important;
}

[data-theme="light"] .m5-fs-copy-btn {
  background: rgba(24, 30, 21, 0.05) !important;
  border-color: rgba(24, 30, 21, 0.15) !important;
  color: #3b4636 !important;
}

[data-theme="light"] .m5-fs-copy-btn:hover {
  background: rgba(158, 123, 59, 0.14) !important;
  border-color: #8c6a2e !important;
  color: #8c6a2e !important;
}

[data-theme="light"] .m5-fs-markdown {
  color: #1a2217 !important;
}

[data-theme="light"] .m5-fs-markdown h1,
[data-theme="light"] .m5-fs-markdown h2,
[data-theme="light"] .m5-fs-markdown h3,
[data-theme="light"] .m5-fs-markdown h4 {
  color: #8c6a2e !important;
  border-bottom-color: rgba(24, 30, 21, 0.1) !important;
}

[data-theme="light"] .m5-fs-markdown strong {
  color: #121810 !important;
}

[data-theme="light"] .m5-fs-markdown blockquote {
  background: rgba(158, 123, 59, 0.08) !important;
  border-left-color: #9e7b3b !important;
  color: #2c3627 !important;
}

[data-theme="light"] .m5-fs-markdown code {
  background: rgba(24, 30, 21, 0.06) !important;
  color: #7a581e !important;
  border: 1px solid rgba(24, 30, 21, 0.1) !important;
}

[data-theme="light"] .m5-fs-markdown pre {
  background: #1e241c !important;
  border-color: rgba(158, 123, 59, 0.3) !important;
}

[data-theme="light"] .m5-fs-markdown pre code {
  background: transparent !important;
  color: #f4efe4 !important;
  border: none !important;
}

[data-theme="light"] .m5-fs-markdown th {
  background: rgba(158, 123, 59, 0.12) !important;
  color: #8c6a2e !important;
  border-color: rgba(24, 30, 21, 0.14) !important;
}

[data-theme="light"] .m5-fs-markdown td {
  border-color: rgba(24, 30, 21, 0.1) !important;
  color: #1a2217 !important;
}

[data-theme="light"] .m5-fs-followups {
  border-top-color: rgba(158, 123, 59, 0.16) !important;
}

[data-theme="light"] .m5-fs-followup-label {
  color: #8c6a2e !important;
}

[data-theme="light"] .m5-fs-followup-btn {
  background: rgba(158, 123, 59, 0.08) !important;
  border-color: rgba(158, 123, 59, 0.32) !important;
  color: #1a2217 !important;
}

[data-theme="light"] .m5-fs-followup-btn:hover {
  background: #9e7b3b !important;
  border-color: #9e7b3b !important;
  color: #ffffff !important;
}

[data-theme="light"] .m5-fullscreen-input-bar {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(158, 123, 59, 0.45) !important;
  box-shadow: 0 4px 24px rgba(158, 123, 59, 0.15) !important;
}

[data-theme="light"] .m5-fullscreen-input-bar:focus-within {
  border-color: #8c6a2e !important;
  box-shadow: 0 6px 28px rgba(158, 123, 59, 0.28) !important;
}

[data-theme="light"] .m5-fullscreen-input {
  color: #181e15 !important;
}

[data-theme="light"] .m5-fullscreen-input::placeholder {
  color: rgba(24, 30, 21, 0.48) !important;
}

[data-theme="light"] .m5-fullscreen-send-btn {
  background: rgba(158, 123, 59, 0.16) !important;
  border-color: #9e7b3b !important;
  color: #8c6a2e !important;
}

[data-theme="light"] .m5-fullscreen-send-btn:hover {
  background: #9e7b3b !important;
  color: #ffffff !important;
}

[data-theme="light"] .m5-fullscreen-hint {
  color: rgba(24, 30, 21, 0.55) !important;
}

[data-theme="light"] .m5-fullscreen-hint kbd {
  background: rgba(24, 30, 21, 0.08) !important;
  color: #242d20 !important;
}

[data-theme="light"] .m5-fs-quick-pill,
[data-theme="light"] .m5-chat-quick-pill {
  background: rgba(255, 255, 255, 0.85) !important;
  border-color: rgba(158, 123, 59, 0.3) !important;
  color: #1a2217 !important;
}

[data-theme="light"] .m5-fs-quick-pill:hover,
[data-theme="light"] .m5-chat-quick-pill:hover {
  background: rgba(158, 123, 59, 0.18) !important;
  color: #8c6a2e !important;
}

/* ── Mobile Responsive Overrides (Phones & Tablets) ──────────────── */
@media (max-width: 768px) {
  .m5-fullscreen-container {
    height: 100vh;
    height: 100dvh;
    padding: 1em 1em 0.8em;
    padding: env(safe-area-inset-top, 14px) env(safe-area-inset-right, 12px) max(env(safe-area-inset-bottom, 10px), 10px) env(safe-area-inset-left, 12px);
  }

  .m5-fullscreen-header {
    padding-bottom: 0.8em;
  }

  .m5-fullscreen-crest {
    width: 36px;
    height: 36px;
    font-size: 1.05em;
    border-radius: 10px;
  }

  .m5-fullscreen-title {
    font-size: 1.12em;
  }

  .m5-fullscreen-subtitle {
    display: none;
  }

  .m5-fullscreen-close {
    padding: 0.45em 0.65em;
    font-size: 0.8em;
  }

  .m5-fullscreen-close span {
    display: none; /* Hide 'ESC' text on touch devices */
  }

  .m5-fullscreen-feed {
    padding: 1.2em 0.2em 1.2em 0;
    gap: 1.2em;
  }

  .m5-fs-msg--user {
    max-width: 90%;
    padding: 0.85em 1.1em;
    font-size: 0.98em;
    border-radius: 18px 18px 4px 18px;
  }

  .m5-fs-msg--ai {
    padding: 1.2em 1.1em;
    border-radius: 18px;
  }

  .m5-fs-markdown {
    font-size: 0.98em;
    line-height: 1.7;
  }

  .m5-fs-markdown pre {
    padding: 0.9em 1em;
    border-radius: 8px;
    font-size: 0.85em;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .m5-fs-markdown table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.88em;
  }

  .m5-fullscreen-bottom {
    padding-top: 0.6em;
  }

  .m5-fullscreen-input-bar {
    padding: 0.55em 0.75em 0.55em 1em;
    border-radius: 16px;
    gap: 0.65em;
  }

  .m5-fullscreen-input {
    font-size: 16px; /* Prevents auto-zoom on iOS Safari on input focus */
  }

  .m5-fullscreen-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 0.95em;
  }

  .m5-fullscreen-hint {
    display: none; /* Conserve vertical screen space on mobile keyboards */
  }

  .m5-fs-followups {
    margin-top: 1.1em;
    padding-top: 0.9em;
  }

  .m5-fs-followup-chips {
    gap: 0.45em;
  }

  .m5-fs-followup-btn {
    padding: 0.5em 0.85em;
    font-size: 0.82em;
    border-radius: 16px;
  }
}

/* ── In-App PDF Document & Manual Viewer ──────────────────────────── */
.m5-pdf-modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5em;
  box-sizing: border-box;
}

.m5-pdf-modal-container {
  width: 100%;
  max-width: 68em;
  height: 88vh;
  height: 88dvh;
  background: #121914;
  border: 1px solid rgba(219, 178, 126, 0.35);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.75);
  overflow: hidden;
}

[data-theme="light"] .m5-pdf-modal-container {
  background: #ffffff !important;
  border-color: rgba(158, 123, 59, 0.35) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15) !important;
}

.m5-pdf-modal-header {
  padding: 0.8em 1.2em;
  border-bottom: 1px solid rgba(219, 178, 126, 0.18);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

[data-theme="light"] .m5-pdf-modal-header {
  border-bottom-color: rgba(24, 30, 21, 0.1) !important;
}

.m5-pdf-modal-body {
  flex: 1;
  width: 100%;
  height: 100%;
  background: #252826;
}

[data-theme="light"] .m5-pdf-modal-body {
  background: #eae6de !important;
}

@media (max-width: 768px) {
  .m5-pdf-modal-wrap {
    padding: 0.8em;
  }
  .m5-pdf-modal-container {
    height: 94vh;
    height: 94dvh;
    border-radius: 14px;
  }
  .m5-pdf-modal-header {
    padding: 0.6em 0.8em;
  }
}

/* ── Admin Prompt / Persona Testing Bar ──────────────────────────── */
.m5-admin-persona-bar {
  display: flex;
  align-items: center;
  gap: 0.5em;
  background: rgba(219, 178, 126, 0.08);
  border: 1px dashed rgba(219, 178, 126, 0.4);
  padding: 0.22em 0.6em;
  border-radius: 8px;
}

.m5-admin-persona-tag {
  font-size: 0.76em;
  font-weight: 700;
  color: var(--m5-gold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0.35em;
  white-space: nowrap;
}

.m5-admin-persona-dropdown {
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(219, 178, 126, 0.35);
  color: var(--m5-cream);
  font-size: 0.8em;
  font-weight: 600;
  padding: 0.3em 0.6em;
  border-radius: 6px;
  cursor: pointer;
  outline: none;
  font-family: inherit;
}

.m5-admin-persona-dropdown option {
  background: #18201b;
  color: #f7f3ec;
}

[data-theme="light"] .m5-admin-persona-bar {
  background: rgba(158, 123, 59, 0.08) !important;
  border-color: rgba(158, 123, 59, 0.4) !important;
}

[data-theme="light"] .m5-admin-persona-dropdown {
  background: #ffffff !important;
  border-color: rgba(158, 123, 59, 0.35) !important;
  color: #1a2217 !important;
}

[data-theme="light"] .m5-admin-persona-dropdown option {
  background: #ffffff;
  color: #1a2217;
}

@media (max-width: 768px) {
  .m5-admin-persona-bar {
    width: 100%;
    margin-top: 0.3em;
    justify-content: space-between;
  }
  .m5-admin-persona-dropdown {
    flex: 1;
    max-width: 70%;
  }
}


/* ── Full AI Chat Application Shell & Sidebar Layout (v2.4.2) ── */
.m5-chat-app-shell {
  display: flex;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
  background: var(--m5-bg, #0d120c);
}

.m5-chat-sidebar {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: rgba(12, 17, 13, 0.96);
  border-right: 1px solid rgba(219, 178, 126, 0.18);
  position: relative;
  z-index: 20;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), width 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.m5-sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2em 1.2em 0.8em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.m5-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7em;
}

.m5-sidebar-title {
  font-family: var(--m5-font-serif, "Cinzel Decorative", Georgia, serif);
  font-size: 1.05em;
  color: var(--m5-gold);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.m5-sidebar-close-mobile {
  display: none;
  background: transparent;
  border: none;
  color: var(--m5-cream-muted);
  font-size: 1.2em;
  cursor: pointer;
  padding: 0.2em 0.4em;
  border-radius: 6px;
  transition: color 0.15s;
}

.m5-sidebar-close-mobile:hover {
  color: var(--m5-gold);
}

.m5-sidebar-action {
  padding: 0.9em 1.1em 0.6em;
}

.m5-btn-new-chat {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  padding: 0.75em 1em;
  background: linear-gradient(135deg, rgba(219, 178, 126, 0.16), rgba(219, 178, 126, 0.05));
  border: 1px solid rgba(219, 178, 126, 0.4);
  border-radius: 10px;
  color: var(--m5-gold);
  font-weight: 600;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.m5-btn-new-chat:hover {
  background: var(--m5-gold);
  color: #101610;
  border-color: var(--m5-gold);
  box-shadow: 0 4px 18px rgba(219, 178, 126, 0.3);
  transform: translateY(-1px);
}

.m5-sessions-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.6em 0.8em;
  display: flex;
  flex-direction: column;
  gap: 0.35em;
}

.m5-sessions-list::-webkit-scrollbar {
  width: 4px;
}
.m5-sessions-list::-webkit-scrollbar-thumb {
  background: rgba(219, 178, 126, 0.2);
  border-radius: 4px;
}

.m5-sessions-loading,
.m5-sessions-empty {
  text-align: center;
  padding: 2.5em 1em;
  color: var(--m5-cream-muted);
  font-size: 0.86em;
  line-height: 1.5;
}

.m5-session-item {
  display: flex;
  align-items: center;
  gap: 0.65em;
  padding: 0.65em 0.8em;
  border-radius: 9px;
  color: var(--m5-cream-muted);
  font-size: 0.88em;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
  border: 1px solid transparent;
  user-select: none;
}

.m5-session-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.m5-session-item.is-active {
  background: rgba(219, 178, 126, 0.14);
  color: var(--m5-gold);
  border-color: rgba(219, 178, 126, 0.35);
  font-weight: 600;
}

.m5-session-icon {
  font-size: 0.9em;
  opacity: 0.8;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.m5-session-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m5-session-actions {
  display: none;
  align-items: center;
  gap: 0.25em;
  flex-shrink: 0;
}

.m5-session-item:hover .m5-session-actions,
.m5-session-item.is-active .m5-session-actions {
  display: flex;
}

.m5-session-action-btn {
  background: transparent;
  border: none;
  color: var(--m5-cream-muted);
  font-size: 0.82em;
  padding: 0.25em 0.4em;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.m5-session-action-btn:hover {
  color: var(--m5-gold);
  background: rgba(219, 178, 126, 0.15);
}

.m5-session-action-btn--delete:hover {
  color: #ff7676;
  background: rgba(255, 80, 80, 0.15);
}

.m5-sidebar-bottom {
  padding: 0.9em 1.2em;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.m5-sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-size: 0.85em;
  color: var(--m5-cream-muted);
}

.m5-sidebar-user-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.m5-sidebar-backdrop {
  display: none;
}

.m5-chat-main-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  background: transparent;
  padding: 1.2em 2em 1.4em;
  box-sizing: border-box;
}

.m5-sidebar-toggle-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--m5-border);
  color: var(--m5-gold);
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.m5-sidebar-toggle-btn:hover {
  background: rgba(219, 178, 126, 0.18);
  border-color: var(--m5-gold);
}

.m5-header-new-btn {
  background: rgba(219, 178, 126, 0.12);
  border: 1px solid rgba(219, 178, 126, 0.35);
  color: var(--m5-gold);
  padding: 0.5em 0.9em;
  border-radius: 9px;
  font-size: 0.84em;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  transition: all 0.2s ease;
}

.m5-header-new-btn:hover {
  background: var(--m5-gold);
  color: #101610;
}

/* Light mode styles */
[data-theme="light"] .m5-chat-app-shell {
  background: #f7f4ed !important;
}

[data-theme="light"] .m5-chat-sidebar {
  background: #ede8dc !important;
  border-right-color: rgba(140, 106, 46, 0.22) !important;
}

[data-theme="light"] .m5-sidebar-top {
  border-bottom-color: rgba(140, 106, 46, 0.15) !important;
}

[data-theme="light"] .m5-sidebar-title {
  color: #8c6a2e !important;
}

[data-theme="light"] .m5-btn-new-chat {
  background: linear-gradient(135deg, rgba(140, 106, 46, 0.14), rgba(140, 106, 46, 0.05)) !important;
  border-color: rgba(140, 106, 46, 0.4) !important;
  color: #8c6a2e !important;
}

[data-theme="light"] .m5-btn-new-chat:hover {
  background: #8c6a2e !important;
  color: #ffffff !important;
}

[data-theme="light"] .m5-session-item {
  color: #3b4437 !important;
}

[data-theme="light"] .m5-session-item:hover {
  background: rgba(0, 0, 0, 0.05) !important;
  color: #181e15 !important;
}

[data-theme="light"] .m5-session-item.is-active {
  background: rgba(140, 106, 46, 0.15) !important;
  color: #8c6a2e !important;
  border-color: rgba(140, 106, 46, 0.35) !important;
}

[data-theme="light"] .m5-sidebar-bottom {
  border-top-color: rgba(140, 106, 46, 0.15) !important;
  background: rgba(0, 0, 0, 0.03) !important;
}

[data-theme="light"] .m5-sidebar-toggle-btn {
  background: rgba(140, 106, 46, 0.08) !important;
  border-color: rgba(140, 106, 46, 0.25) !important;
  color: #8c6a2e !important;
}

[data-theme="light"] .m5-header-new-btn {
  background: rgba(140, 106, 46, 0.1) !important;
  border-color: rgba(140, 106, 46, 0.35) !important;
  color: #8c6a2e !important;
}

[data-theme="light"] .m5-header-new-btn:hover {
  background: #8c6a2e !important;
  color: #ffffff !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .m5-chat-main-pane {
    padding: 0.8em 0.9em 1em;
  }
  .m5-chat-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 82%;
    max-width: 320px;
    transform: translateX(-100%);
    box-shadow: 6px 0 28px rgba(0, 0, 0, 0.65);
  }
  .m5-sidebar-open .m5-chat-sidebar {
    transform: translateX(0);
  }
  .m5-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 15;
  }
  .m5-sidebar-open .m5-sidebar-backdrop {
    display: block;
  }
  .m5-sidebar-close-mobile {
    display: block;
  }
  .m5-hide-mobile {
    display: none !important;
  }
}


/* ── Matched Quick Links Popup List (Above Input Bar) ── */
.m5-fullscreen-quick-tray {
  display: none;
  flex-direction: column;
  background: rgba(14, 20, 15, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(219, 178, 126, 0.35);
  border-radius: 16px;
  padding: 0.75em 0.9em;
  margin-bottom: 0.75em;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(219, 178, 126, 0.12);
  max-height: 260px;
  overflow: hidden;
  animation: m5PopupFade 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

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

.m5-quick-links-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.5em;
  margin-bottom: 0.4em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--m5-gold);
}

.m5-quick-links-count {
  font-size: 0.85em;
  color: var(--m5-cream-muted);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15em 0.55em;
  border-radius: 10px;
}

.m5-quick-links-list {
  display: flex;
  flex-direction: column;
  gap: 0.35em;
  overflow-y: auto;
  max-height: 200px;
  padding-right: 0.2em;
}

.m5-quick-links-list::-webkit-scrollbar {
  width: 4px;
}
.m5-quick-links-list::-webkit-scrollbar-thumb {
  background: rgba(219, 178, 126, 0.25);
  border-radius: 4px;
}

.m5-quick-link-item {
  display: flex;
  align-items: center;
  gap: 0.8em;
  padding: 0.6em 0.8em;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  text-decoration: none;
  color: var(--m5-cream);
  transition: all 0.18s ease;
}

.m5-quick-link-item:hover {
  background: rgba(219, 178, 126, 0.14);
  border-color: rgba(219, 178, 126, 0.4);
  transform: translateX(3px);
  color: #ffffff;
}

.m5-quick-link-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(219, 178, 126, 0.12);
  border: 1px solid rgba(219, 178, 126, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--m5-gold);
  font-size: 0.9em;
  flex-shrink: 0;
}

.m5-quick-link-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1em;
}

.m5-quick-link-name {
  font-weight: 600;
  font-size: 0.88em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #f5f2eb;
}

.m5-quick-link-url {
  font-size: 0.74em;
  color: var(--m5-cream-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m5-quick-link-action {
  display: flex;
  align-items: center;
  gap: 0.35em;
  font-size: 0.74em;
  color: var(--m5-gold);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.m5-quick-link-item:hover .m5-quick-link-action {
  opacity: 1;
}

/* Light mode overrides */
[data-theme="light"] .m5-fullscreen-quick-tray {
  background: rgba(255, 255, 255, 0.97) !important;
  border-color: rgba(140, 106, 46, 0.35) !important;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12), 0 0 15px rgba(140, 106, 46, 0.1) !important;
}

[data-theme="light"] .m5-quick-links-header {
  border-bottom-color: rgba(140, 106, 46, 0.15) !important;
  color: #8c6a2e !important;
}

[data-theme="light"] .m5-quick-links-count {
  color: #4a5446 !important;
  background: rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .m5-quick-link-item {
  background: rgba(0, 0, 0, 0.02) !important;
  border-color: rgba(0, 0, 0, 0.06) !important;
  color: #1a2217 !important;
}

[data-theme="light"] .m5-quick-link-item:hover {
  background: rgba(140, 106, 46, 0.12) !important;
  border-color: rgba(140, 106, 46, 0.35) !important;
  color: #101610 !important;
}

[data-theme="light"] .m5-quick-link-icon {
  background: rgba(140, 106, 46, 0.1) !important;
  border-color: rgba(140, 106, 46, 0.25) !important;
  color: #8c6a2e !important;
}

[data-theme="light"] .m5-quick-link-name {
  color: #1a2217 !important;
}

[data-theme="light"] .m5-quick-link-url {
  color: #5c6858 !important;
}

[data-theme="light"] .m5-quick-link-action {
  color: #8c6a2e !important;
}


/* ── Mobile Header & Responsiveness Overhaul (v2.4.2) ── */
.m5-fullscreen-header {
  display: flex !important;
  flex-direction: column !important;
  padding-bottom: 0.8em !important;
  border-bottom: 1px solid var(--m5-border);
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
}

.m5-header-nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 0.75em;
  min-width: 0;
}

.m5-header-brand-wrap {
  display: flex;
  align-items: center;
  gap: 0.65em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.m5-header-title-box {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.m5-fullscreen-title {
  font-family: var(--m5-font-serif, "Cinzel Decorative", Georgia, serif);
  font-size: 1.25em;
  color: var(--m5-gold);
  margin: 0;
  letter-spacing: 0.03em;
  font-weight: 700;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 100%;
  display: block;
}

.m5-fullscreen-subtitle {
  font-size: 0.75em;
  color: var(--m5-cream-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: block;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  margin-top: 0.1em;
  max-width: 100%;
}

.m5-header-actions {
  display: flex;
  align-items: center;
  gap: 0.6em;
  flex-shrink: 0;
}

.m5-desktop-persona {
  display: flex !important;
}

.m5-mobile-persona {
  display: none !important;
}

@media (max-width: 768px) {
  .m5-chat-main-pane {
    padding: max(0.75em, env(safe-area-inset-top)) 0.85em max(0.75em, env(safe-area-inset-bottom)) !important;
  }

  .m5-fullscreen-header {
    padding-bottom: 0.5em !important;
  }

  .m5-header-nav-row {
    gap: 0.5em !important;
  }

  .m5-desktop-persona {
    display: none !important;
  }

  .m5-mobile-persona {
    display: flex !important;
    width: 100%;
    margin-top: 0.45em;
    padding: 0.3em 0.65em;
    box-sizing: border-box;
    justify-content: space-between;
    align-items: center;
  }

  .m5-mobile-persona .m5-admin-persona-dropdown {
    flex: 1;
    max-width: 72%;
  }

  .m5-fullscreen-crest {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.95em !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }

  .m5-sidebar-toggle-btn {
    width: 34px !important;
    height: 34px !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }

  .m5-fullscreen-title {
    font-size: 0.95em !important;
    max-width: 100% !important;
  }

  .m5-fullscreen-subtitle {
    display: none !important;
  }

  .m5-header-new-btn {
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }

  .m5-fullscreen-close {
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }

  .m5-fs-msg {
    max-width: 100% !important;
  }

  .m5-fullscreen-input-bar {
    padding: 0.6em 1em !important;
  }

  .m5-fullscreen-input {
    font-size: 0.96em !important;
  }

  .m5-fullscreen-hint {
    display: none !important;
  }
}


/* ── Native Voice Dictation, Image Attachment & Advanced Tools (v2.4.3) ── */
.m5-input-action-btn {
  background: transparent;
  border: none;
  color: var(--m5-gold);
  width: 36px;
  height: 36px;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05em;
  transition: all 0.2s ease;
  flex-shrink: 0;
  outline: none;
}

.m5-input-action-btn:hover {
  background: rgba(219, 178, 126, 0.16);
  color: #ffffff;
}

#m5-mic-btn.is-listening {
  background: #ff4757 !important;
  color: #ffffff !important;
  animation: m5PulseMic 1.2s infinite alternate ease-in-out;
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(255, 71, 87, 0.6);
}

@keyframes m5PulseMic {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7); }
  100% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(255, 71, 87, 0); }
}

.m5-attachment-preview {
  display: flex;
  gap: 0.6em;
  align-items: center;
  margin-bottom: 0.6em;
}

.m5-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.65em;
  background: rgba(14, 20, 15, 0.95);
  border: 1px solid rgba(219, 178, 126, 0.4);
  border-radius: 10px;
  padding: 0.35em 0.75em 0.35em 0.45em;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  animation: m5FadeSlide 0.2s ease;
}

.m5-attachment-thumb {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(219, 178, 126, 0.25);
}

.m5-attachment-name {
  font-size: 0.82em;
  color: var(--m5-cream);
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.m5-attachment-remove {
  background: transparent;
  border: none;
  color: #ff6b6b;
  cursor: pointer;
  padding: 0.2em 0.35em;
  font-size: 0.9em;
  transition: color 0.15s;
}

.m5-attachment-remove:hover {
  color: #ff4757;
}

.m5-fs-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4em;
  flex-wrap: wrap;
}

/* Light mode overrides */
[data-theme="light"] .m5-input-action-btn {
  color: #8c6a2e !important;
}

[data-theme="light"] .m5-input-action-btn:hover {
  background: rgba(140, 106, 46, 0.12) !important;
}

[data-theme="light"] .m5-attachment-chip {
  background: #ffffff !important;
  border-color: rgba(140, 106, 46, 0.35) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .m5-attachment-name {
  color: #1a2217 !important;
}

@media (max-width: 768px) {
  .m5-input-action-btn {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.95em !important;
  }
}

/* ── Fast & Pro AI Intelligence Mode Switcher ── */
.m5-model-switcher {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(219, 178, 126, 0.25);
  border-radius: 9999px;
  padding: 2px;
  gap: 2px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.m5-model-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.38em;
  padding: 0.28em 0.72em;
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: 0.03em;
  border-radius: 9999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--m5-cream-muted, #94a3b8);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  line-height: 1.2;
}

.m5-model-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.m5-model-btn.is-active[data-mode="fast"] {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(217, 119, 6, 0.28));
  color: #fef08a;
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

.m5-model-btn.is-active[data-mode="pro"] {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.24), rgba(126, 34, 206, 0.3));
  color: #e9d5ff;
  border-color: rgba(168, 85, 247, 0.55);
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.3);
}

/* Light Mode Styling */
[data-theme="light"] .m5-model-switcher {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(184, 134, 11, 0.3);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .m5-model-btn {
  color: #64748b;
}

[data-theme="light"] .m5-model-btn:hover {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .m5-model-btn.is-active[data-mode="fast"] {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
  box-shadow: 0 1px 3px rgba(146, 64, 14, 0.15);
}

[data-theme="light"] .m5-model-btn.is-active[data-mode="pro"] {
  background: #f3e8ff;
  color: #6b21a8;
  border-color: #d8b4fe;
  box-shadow: 0 1px 3px rgba(107, 33, 168, 0.15);
}

/* Author Mode Tags in AI Message Header */
.m5-author-mode-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  font-size: 0.72em;
  font-weight: 600;
  padding: 0.15em 0.5em;
  border-radius: 6px;
  margin-left: 0.45em;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.m5-tag-fast {
  background: rgba(245, 158, 11, 0.15);
  color: #fef08a;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.m5-tag-pro {
  background: rgba(168, 85, 247, 0.18);
  color: #e9d5ff;
  border: 1px solid rgba(168, 85, 247, 0.38);
}

[data-theme="light"] .m5-tag-fast {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

[data-theme="light"] .m5-tag-pro {
  background: #f3e8ff;
  color: #6b21a8;
  border-color: #e9d5ff;
}

/* Sidebar Session Mode Badges */
.m5-session-mode-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72em;
  padding: 0.1em 0.32em;
  border-radius: 4px;
  margin-left: 0.35em;
  font-weight: 600;
  vertical-align: middle;
  flex-shrink: 0;
}

.m5-badge-fast {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.14);
}

.m5-badge-pro {
  color: #c084fc;
  background: rgba(168, 85, 247, 0.18);
}

/* Mobile Responsiveness for Model Switcher */
@media (max-width: 768px) {
  .m5-model-switcher {
    padding: 2px;
    gap: 2px;
  }
  .m5-model-btn {
    padding: 0.25em 0.55em;
    font-size: 0.74em;
  }
}

@media (max-width: 480px) {
  .m5-model-btn span {
    display: none;
  }
  .m5-model-btn {
    padding: 0.32em 0.5em;
    font-size: 0.85em;
  }
}

/* ── Thinking / Working Indicator Animation ── */
.m5-thinking-indicator {
  display: flex;
  align-items: center;
  gap: 0.9em;
  padding: 0.85em 1.15em;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(219, 178, 126, 0.2);
  margin: 0.4em 0 0.8em;
  max-width: 380px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: m5ThinkingFadeIn 0.3s ease-out forwards;
}

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

.m5-thinking-avatar {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
}

.m5-thinking-pulse-bolt {
  color: #fef08a;
  font-size: 1.05em;
  animation: m5BoltPulse 1.6s ease-in-out infinite;
}

.m5-thinking-pulse-gem {
  color: #e9d5ff;
  font-size: 1.05em;
  animation: m5GemPulse 1.6s ease-in-out infinite;
}

@keyframes m5BoltPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.4)); }
  50% { transform: scale(1.15); filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.85)); }
}

@keyframes m5GemPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 4px rgba(168, 85, 247, 0.4)); }
  50% { transform: scale(1.15); filter: drop-shadow(0 0 14px rgba(168, 85, 247, 0.9)); }
}

.m5-thinking-glow {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(219, 178, 126, 0.25) 0%, transparent 70%);
  animation: m5GlowOrbit 2.4s linear infinite;
}

.m5-thinking-indicator--pro .m5-thinking-glow {
  background: radial-gradient(circle, rgba(168, 85, 247, 0.3) 0%, transparent 70%);
}

@keyframes m5GlowOrbit {
  0% { transform: rotate(0deg) scale(0.9); opacity: 0.6; }
  50% { transform: rotate(180deg) scale(1.15); opacity: 1; }
  100% { transform: rotate(360deg) scale(0.9); opacity: 0.6; }
}

.m5-thinking-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4em;
}

.m5-thinking-status {
  display: flex;
  align-items: center;
  gap: 0.35em;
  font-size: 0.82em;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--m5-cream-muted, #cbd5e1);
}

.m5-thinking-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.25s ease;
}

.m5-thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 2px;
}

.m5-thinking-dots span {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  animation: m5DotPulse 1.4s infinite ease-in-out both;
}

.m5-thinking-dots span:nth-child(1) { animation-delay: -0.32s; }
.m5-thinking-dots span:nth-child(2) { animation-delay: -0.16s; }
.m5-thinking-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes m5DotPulse {
  0%, 80%, 100% {
    transform: scale(0.7);
    opacity: 0.3;
  }
  40% {
    transform: scale(1.25);
    opacity: 1;
  }
}

.m5-thinking-shimmer-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.m5-thinking-shimmer-wave {
  position: absolute;
  top: 0;
  left: -100%;
  height: 100%;
  width: 60%;
  background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.85), transparent);
  border-radius: 9999px;
  animation: m5ShimmerSlide 1.5s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

.m5-thinking-indicator--pro .m5-thinking-shimmer-wave {
  background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.9), transparent);
}

@keyframes m5ShimmerSlide {
  0% { left: -60%; }
  100% { left: 120%; }
}

/* Light Theme */
[data-theme="light"] .m5-thinking-indicator {
  background: rgba(0, 0, 0, 0.035);
  border-color: rgba(184, 134, 11, 0.24);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .m5-thinking-avatar {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .m5-thinking-status {
  color: #475569;
}

[data-theme="light"] .m5-thinking-shimmer-bar {
  background: rgba(0, 0, 0, 0.07);
}

[data-theme="light"] .m5-thinking-shimmer-wave {
  background: linear-gradient(90deg, transparent, rgba(217, 119, 6, 0.85), transparent);
}

[data-theme="light"] .m5-thinking-indicator--pro .m5-thinking-shimmer-wave {
  background: linear-gradient(90deg, transparent, rgba(126, 34, 206, 0.85), transparent);
}

/* ── Full Voice Conversation Mode & ElevenLabs Integration ── */
.m5-header-voice-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.42em;
  padding: 0.32em 0.85em;
  border-radius: 9999px;
  background: rgba(219, 178, 126, 0.12);
  border: 1px solid rgba(219, 178, 126, 0.4);
  color: var(--m5-gold, #dbb27e);
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(219, 178, 126, 0.15);
  flex-shrink: 0;
}

.m5-header-voice-btn:hover {
  background: rgba(219, 178, 126, 0.26);
  border-color: var(--m5-gold, #dbb27e);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(219, 178, 126, 0.35);
  transform: translateY(-1px);
}

.m5-header-voice-btn.is-active {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #34d399;
  color: #ffffff;
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.5);
  animation: m5PulseVoiceGreen 1.6s infinite;
}

@keyframes m5PulseVoiceGreen {
  0%, 100% { box-shadow: 0 0 12px rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 0 22px rgba(16, 185, 129, 0.8); }
}

[data-theme="light"] .m5-header-voice-btn {
  background: rgba(140, 106, 46, 0.12);
  border-color: rgba(140, 106, 46, 0.4);
  color: #8c6a2e;
}

[data-theme="light"] .m5-header-voice-btn:hover {
  background: rgba(140, 106, 46, 0.22);
  color: #1a2217;
}

/* Hands-Free Full Voice Mode Loop Banner */
.m5-voice-loop-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6em 1em;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(5, 150, 105, 0.25));
  border: 1px solid rgba(52, 211, 153, 0.45);
  border-radius: 12px;
  margin-bottom: 0.6em;
  color: #ecfdf5;
  font-size: 0.84em;
  font-weight: 500;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.25);
  animation: m5ThinkingFadeIn 0.3s ease-out;
}

.m5-voice-loop-pulse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.3);
  color: #34d399;
  animation: m5PulseVoiceGreen 1.4s infinite;
  margin-right: 0.6em;
}

.m5-voice-loop-exit {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 0.25em 0.65em;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85em;
  transition: all 0.15s;
}

.m5-voice-loop-exit:hover {
  background: rgba(239, 68, 68, 0.35);
  border-color: #ef4444;
}
