/* ============================================================
   eigentumwerk v3 — full redesign layer.
   Fraunces display serif, illustrated skyline world, animated
   how-it-works flow, marquee, portal heroes.
   Load order: main.css → v2.css → v3.css (this wins).
   ============================================================ */

@font-face {
  font-family: 'Fraunces';
  src: url('/assets/fonts/fraunces-latin.woff2') format('woff2');
  font-weight: 600 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2013-2014, U+201C-201E, U+20AC;
}
@font-face {
  font-family: 'Fraunces';
  src: url('/assets/fonts/fraunces-latin-ext.woff2') format('woff2');
  font-weight: 600 800;
  font-display: swap;
  unicode-range: U+0100-024F, U+1E00-1EFF;
}

:root {
  --font-display: 'Fraunces', Georgia, serif;
  --dusk-1: #FDF3E3;   /* warm sky top */
  --dusk-2: #F9DDBD;   /* horizon peach */
  --dusk-3: #F4C99B;
}

h1, h2, h3, .section-title, .hero-title, .brand {
  font-family: var(--font-display);
  letter-spacing: -0.015em;
}
.brand { font-weight: 600; font-size: 1.3rem; display: flex; align-items: center; gap: 10px; }
.brand img { width: 34px; height: 34px; }
/* wordmark is one flex item → no gap between "eigentum" and "werk" */
.brand-word strong { color: var(--accent); font-weight: 700; }
.brand-mark { display: none; } /* replaced by the real logo */

/* ================= HERO v3: illustrated dusk skyline ================= */
.hero {
  min-height: 100vh;
  background: linear-gradient(180deg, var(--dusk-1) 0%, var(--dusk-2) 55%, var(--dusk-3) 100%);
  padding-bottom: 0;
}
.hero .blob-a { background: radial-gradient(circle, rgba(240, 126, 79, 0.55), transparent 62%); opacity: 0.7; }
.hero .blob-b { background: radial-gradient(circle, rgba(143, 182, 163, 0.5), transparent 65%); }

/* sun */
.hero-sun {
  position: absolute; top: 12%; right: 14%;
  width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle, #FFDD9A 30%, #F2B33D 60%, transparent 72%);
  filter: blur(2px);
}

.hero-scene {
  position: absolute; left: 0; right: 0; bottom: -2px; top: auto;
  width: 100%; pointer-events: none;
}
@media (max-width: 760px) {
  /* small screens: keep the skyline from crowding the copy */
  .hero-scene { opacity: 0.5; }
}
.hero-scene svg { width: 100%; height: auto; display: block; }

.hero-front { padding-top: 4vh; }
.hero-title { font-size: clamp(2.6rem, 6.4vw, 4.8rem); font-weight: 700; }
.hero-title .gradient-text {
  background: linear-gradient(92deg, #C74E1F 5%, #E2673A 35%, #B8860B 70%, #0F6B66 105%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { font-size: 1.18rem; max-width: 52ch; color: #5A4A3A; }
.eyebrow { background: rgba(199, 78, 31, 0.12); color: #A6431C; }

/* ================= Marquee: statute ticker ================= */
.marquee {
  background: var(--ink); color: rgba(250, 246, 239, 0.85);
  overflow: hidden; padding: 14px 0; white-space: nowrap;
  font: 600 0.9rem/1 var(--font); letter-spacing: 0.04em;
}
.marquee-track { display: inline-block; padding-left: 100%; }
.marquee span { margin-right: 48px; }
.marquee b { color: var(--amber); font-weight: 700; }
@media (prefers-reduced-motion: no-preference) {
  .marquee-track { animation: marquee 38s linear infinite; }
  @keyframes marquee { to { transform: translateX(-100%); } }
}
@media (prefers-reduced-motion: reduce) {
  .marquee-track { padding-left: 0; }
}

/* ================= How it works: animated flow ================= */
.howit { padding: 110px 0 90px; position: relative; overflow: hidden; }
.howit-steps {
  margin-top: 56px; position: relative;
  display: grid; gap: 26px; grid-template-columns: repeat(4, 1fr);
}
.howit-connector {
  position: absolute; top: 44px; left: 6%; width: 88%; height: 60px;
  pointer-events: none;
}
.howit-connector path {
  fill: none; stroke: var(--terracotta); stroke-width: 2.5;
  stroke-dasharray: 7 9; opacity: 0.6;
}
.howit-pulse { fill: var(--terracotta); }
.step {
  text-align: center; position: relative; z-index: 1;
  padding: 0 8px;
}
.step-num {
  width: 88px; height: 88px; margin: 0 auto 18px;
  display: grid; place-items: center;
  border-radius: 28px;
  background: var(--surface);
  border: 1.5px solid rgba(35, 49, 58, 0.08);
  box-shadow: var(--shadow-sm);
  font-size: 2rem;
  transition: transform 300ms var(--ease-smooth), box-shadow 300ms var(--ease-smooth);
}
.step:hover .step-num { transform: translateY(-6px) rotate(-3deg); box-shadow: var(--shadow-lg); }
.step h3 { font-size: 1.12rem; margin-bottom: 8px; }
.step p { color: var(--text-soft); font-size: 0.94rem; }
.step .who {
  display: inline-block; margin-bottom: 10px; padding: 3px 12px; border-radius: 999px;
  font: 700 0.72rem/1.7 var(--font); letter-spacing: 0.06em; text-transform: uppercase;
}
.who-you   { background: rgba(199, 78, 31, 0.13); color: #A6431C; }
.who-pm    { background: rgba(15, 107, 102, 0.12); color: var(--teal); }
.who-owner { background: rgba(242, 179, 61, 0.2); color: #8a6414; }
@media (max-width: 900px) {
  .howit-steps { grid-template-columns: 1fr 1fr; }
  .howit-connector { display: none; }
}
@media (max-width: 540px) { .howit-steps { grid-template-columns: 1fr; } }

/* ================= Scene band (tools / CTA backdrop) ================= */
.cta-box { position: relative; overflow: hidden; }
.cta-box .cta-scene {
  position: absolute; inset: auto 0 0 0; opacity: 0.22; pointer-events: none;
}
.cta-box > * { position: relative; z-index: 1; }

/* ================= Portal heroes (owner / PM landing) ================= */
.portal-hero {
  position: relative; overflow: hidden;
  margin: -36px -24px 32px;                /* bleed over .app-main padding */
  padding: 56px 32px 0;
  background: linear-gradient(180deg, var(--dusk-1), var(--dusk-2) 70%, var(--dusk-3));
  border-radius: 0 0 28px 28px;
}
.portal-hero h1 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
.portal-hero p { color: #5A4A3A; max-width: 60ch; }
.portal-hero .portal-scene { margin-top: 26px; }
.portal-hero .portal-scene svg { width: 100%; height: auto; display: block; }
.portal-hero .badge-role {
  display: inline-block; margin-bottom: 14px; padding: 5px 14px; border-radius: 999px;
  background: rgba(15, 107, 102, 0.14); color: var(--teal);
  font: 700 0.78rem/1.6 var(--font); letter-spacing: 0.05em; text-transform: uppercase;
}

/* Cards get the serif headline too */
.card h3 { font-family: var(--font-display); font-weight: 600; }

/* Blog article headlines */
.article h1, .article-body h2 { font-family: var(--font-display); }

/* Footer: skyline silhouette on top edge */
.site-footer { position: relative; }
.footer-skyline { display: block; width: 100%; height: auto; margin-bottom: -1px; }

/* ============================================================
   v4 additions: native scroll-timeline, scrollytelling,
   glassmorphism 2.0, organic grid, featured card, GmbH footer
   ============================================================ */

/* ---- Reading progress bar: pure CSS scroll-timeline, zero JS ---- */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    body::before {
      content: '';
      position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 200;
      transform-origin: 0 50%;
      background: linear-gradient(90deg, var(--terracotta), var(--amber));
      animation: grow-progress linear both;
      animation-timeline: scroll(root);
    }
    @keyframes grow-progress {
      from { transform: scaleX(0); }
      to   { transform: scaleX(1); }
    }
  }
}

/* ---- Glassmorphism 2.0: soft, tactile, low-contrast ---- */
.glass {
  background: rgba(250, 246, 239, 0.55);
  border: 1px solid rgba(250, 246, 239, 0.65);
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(10, 74, 70, 0.25);
}
@supports (backdrop-filter: blur(18px)) {
  .glass { background: rgba(250, 246, 239, 0.32); backdrop-filter: blur(18px) saturate(1.25); }
}

/* ---- Scrollytelling: pinned dark stage, chapters swap ---- */
.scrolly-stage {
  background:
    radial-gradient(720px circle at 82% 8%, rgba(242, 179, 61, 0.18), transparent 60%),
    linear-gradient(160deg, #0E4B47, #0A3A37 65%, #082E2C);
  padding: 90px 0;
  min-height: 100vh;
  display: grid; align-items: center;
}
.scrolly-inner {
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 56px; align-items: center;
}
.chapter {
  padding: 26px 0;
  transition: opacity 420ms var(--ease-smooth), transform 420ms var(--ease-smooth);
  border-bottom: 1px solid rgba(250, 246, 239, 0.12);
}
/* dimming/hiding only when the GSAP experience actually runs (no-JS safe) */
.gsap-on .chapter { opacity: 0.28; }
.gsap-on .chapter.is-active { opacity: 1; transform: translateX(10px); }
.chapter-num {
  font: 700 0.8rem/1 var(--font); letter-spacing: 0.14em; color: var(--amber);
}
.chapter h3 { color: var(--cream); margin: 10px 0 8px; font-size: 1.3rem; }
.chapter p { color: rgba(250, 246, 239, 0.75); max-width: 46ch; }

.scrolly-visual {
  position: relative; min-height: 340px; padding: 28px;
  display: grid; align-items: center;
}
.scrolly-card {
  grid-area: 1 / 1;
  display: grid; gap: 10px; padding: 26px;
  background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow-lg);
  transition: opacity 480ms var(--ease-smooth), transform 480ms var(--ease-smooth);
}
.gsap-on .scrolly-card { opacity: 0; transform: translateY(26px) scale(0.96); }
.gsap-on .scrolly-card.is-active { opacity: 1; transform: none; }
/* fail-safe: the first story card is always visible, so the glass
   panel can never appear empty even if scripts are stale/blocked */
.gsap-on .scrolly-card:first-child { opacity: 1; transform: none; }
.gsap-on .scrolly-card:first-child:not(.is-active):has(~ .scrolly-card.is-active) { opacity: 0; }
/* no-JS / reduced experience: cards stack instead of layering */
body:not(.gsap-on) .scrolly-card { grid-area: auto; margin-bottom: 14px; }
.scrolly-card strong { font-family: var(--font-display); font-size: 1.5rem; letter-spacing: -0.01em; }
.sc-line { height: 10px; border-radius: 5px; background: var(--cream-deep); }
.sc-line.short { width: 60%; }
.sc-bar { height: 12px; border-radius: 6px; background: var(--cream-deep); overflow: hidden; }
.sc-bar i { display: block; height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, var(--teal), var(--sage)); }
.ts-label { color: var(--text-soft); font-size: 0.85rem; }
.sc-ring {
  width: 84px; height: 84px; border-radius: 50%;
  background: conic-gradient(var(--terracotta) 0 50%, var(--cream-deep) 50% 100%);
  mask: radial-gradient(circle, transparent 55%, #000 56%);
  -webkit-mask: radial-gradient(circle, transparent 55%, #000 56%);
}
@media (max-width: 900px) {
  .scrolly-inner { grid-template-columns: 1fr; }
  .scrolly-stage { min-height: 0; }
  .chapter { opacity: 1; transform: none; }
  .scrolly-card { position: static; opacity: 1; transform: none; margin-bottom: 14px; }
}

/* ---- Featured article of the week ---- */
.featured-band { padding: 90px 0 30px; }
.featured-card {
  display: block; position: relative; overflow: hidden;
  padding: 44px 48px; border-radius: 26px; margin: 26px 0 10px;
  background:
    radial-gradient(480px circle at 90% -20%, rgba(242, 179, 61, 0.35), transparent 60%),
    linear-gradient(120deg, #FDF3E3, #F9DDBD);
  border: 1.5px solid rgba(226, 103, 58, 0.3);
  transition: transform 300ms var(--ease-smooth), box-shadow 300ms var(--ease-smooth);
}
.featured-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.featured-flag {
  display: inline-block; margin-bottom: 14px; padding: 5px 14px; border-radius: 999px;
  background: var(--terracotta); color: #fff;
  font: 700 0.78rem/1.6 var(--font); letter-spacing: 0.05em; text-transform: uppercase;
}
.featured-card h2 { font-size: clamp(1.4rem, 3vw, 2rem); color: var(--text); max-width: 26ch; }
.featured-card p { margin-top: 10px; color: var(--text-soft); max-width: 70ch; }
.featured-more { display: inline-block; margin-top: 16px; font-weight: 700; color: var(--terracotta); }

/* ---- Symmetric grid: even rhythm, generous space, no tilt,
       equal card heights within every row ---- */
.bento { gap: 28px; align-items: stretch; }
.bento .card { display: flex; flex-direction: column; }
.bento .card p { flex: 1; }
.tool-card { min-height: 230px; }
.section-title { position: relative; display: inline-block; }
.section-title::after {
  content: ''; position: absolute; left: 2px; right: -6px; bottom: 4px; height: 12px;
  background: rgba(242, 179, 61, 0.35); z-index: -1; border-radius: 3px;
}
.section-head { text-align: center; }
.section-head .section-sub { margin-left: auto; margin-right: auto; }
.section-badge { display: block; width: 54px; height: 54px; margin: 0 auto 20px; }

/* ---- Story: horizontal management year ---- */
.yeartrack { padding: 100px 0 60px; overflow: hidden; }
.yeartrack-viewport { margin-top: 42px; }
.yeartrack-row {
  display: flex; gap: 24px; padding: 10px 24px 30px;
  width: max-content;
}
.ycard {
  position: relative; flex: 0 0 340px;
  background: var(--surface); border-radius: 20px;
  padding: 30px 28px 60px;
  border: 1px solid rgba(35, 49, 58, 0.08);
  box-shadow: var(--shadow-sm);
}
.ycard-month {
  display: inline-block; padding: 4px 14px; border-radius: 999px; margin-bottom: 14px;
  background: rgba(15, 107, 102, 0.12); color: var(--teal);
  font: 700 0.8rem/1.6 var(--font); letter-spacing: 0.08em; text-transform: uppercase;
}
.ycard h3 { font-family: var(--font-display); font-size: 1.25rem; margin-bottom: 8px; }
.ycard p { color: var(--text-soft); font-size: 0.95rem; }
.ycard-idx {
  position: absolute; right: 22px; bottom: 14px;
  font: 700 2.2rem/1 var(--font-display); color: rgba(226, 103, 58, 0.18);
}
@media (max-width: 900px) {
  .yeartrack-viewport { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ycard { flex-basis: 280px; }
}

/* ---- Story: featured card shine sweep ---- */
.featured-card::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 90px;
  transform: skewX(-18deg); left: -140px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
}
@media (prefers-reduced-motion: no-preference) {
  .featured-card::after { animation: shine 5.5s ease-in-out infinite; }
  @keyframes shine {
    0%, 74% { left: -140px; }
    92%, 100% { left: 115%; }
  }
}

/* ---- Story: footer city windows twinkle ---- */
.footer-skyline .fw { fill: #F2B33D; }
@media (prefers-reduced-motion: no-preference) {
  .footer-skyline .fw { animation: twinkle 4.2s ease-in-out infinite; }
  .footer-skyline .fw:nth-child(odd) { animation-delay: 1.3s; }
  .footer-skyline .fw:nth-child(3n) { animation-delay: 2.4s; }
  .footer-skyline .fw:nth-child(5n) { animation-delay: 3.1s; }
  @keyframes twinkle {
    0%, 100% { opacity: 0.25; }
    50% { opacity: 0.95; }
  }
}

/* ============================================================
   Dark mode. System preference by default, manual override via
   html[data-theme]. The city scene becomes a night scene.
   ============================================================ */
/* form controls follow the ACTIVE theme, never the OS alone —
   prevents dark inputs appearing on a light page */
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) { color-scheme: dark; }
}

html[data-theme="dark"] {
  --bg: #131A1E; --surface: #1D262B; --text: #EFE9DE; --text-soft: #9FAAB0;
  --cream-deep: #232E34;
  --dusk-1: #101820; --dusk-2: #152430; --dusk-3: #1B3038;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4); --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.55);
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #131A1E; --surface: #1D262B; --text: #EFE9DE; --text-soft: #9FAAB0;
    --cream-deep: #232E34;
    --dusk-1: #101820; --dusk-2: #152430; --dusk-3: #1B3038;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4); --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.55);
  }
}

/* Component adjustments driven by the same conditions */
html[data-theme="dark"] .site-header,
html[data-theme="dark"] .app-header { background: rgba(19, 26, 30, 0.85); border-bottom-color: rgba(239, 233, 222, 0.08); }
html[data-theme="dark"] .brand, html[data-theme="dark"] .nav-links a { color: var(--text-soft); }
html[data-theme="dark"] .brand { color: var(--text); }
html[data-theme="dark"] .hero-sun { background: radial-gradient(circle, #E8ECF2 25%, #B9C4D6 50%, transparent 70%); opacity: 0.85; }
html[data-theme="dark"] .hero-sub { color: var(--text-soft); }
html[data-theme="dark"] .hero-title { color: var(--text); }
html[data-theme="dark"] .card, html[data-theme="dark"] .kpi, html[data-theme="dark"] .panel,
html[data-theme="dark"] .ycard, html[data-theme="dark"] .auth-card, html[data-theme="dark"] .event-card,
html[data-theme="dark"] .scrolly-card, html[data-theme="dark"] .table-wrap {
  border-color: rgba(239, 233, 222, 0.09);
}
html[data-theme="dark"] table.data th { background: #232E34; }
html[data-theme="dark"] table.data th, html[data-theme="dark"] table.data td { border-bottom-color: rgba(239, 233, 222, 0.08); }
html[data-theme="dark"] .form input, html[data-theme="dark"] .form textarea, html[data-theme="dark"] .form select,
html[data-theme="dark"] .tool-box input, html[data-theme="dark"] .tool-box select {
  background: #162025; color: var(--text); border-color: rgba(239, 233, 222, 0.2);
}
html[data-theme="dark"] .btn-ghost { color: var(--text); border-color: rgba(239, 233, 222, 0.25); }
html[data-theme="dark"] .trust-inner, html[data-theme="dark"] .law-quote, html[data-theme="dark"] .tool-result { background: #232E34; }
html[data-theme="dark"] .featured-card {
  background: radial-gradient(480px circle at 90% -20%, rgba(242, 179, 61, 0.16), transparent 60%),
              linear-gradient(120deg, #1D262B, #232E34);
  border-color: rgba(226, 103, 58, 0.4);
}
html[data-theme="dark"] .featured-card h2 { color: var(--text); }
html[data-theme="dark"] .glass { background: rgba(19, 26, 30, 0.5); border-color: rgba(239, 233, 222, 0.12); }
html[data-theme="dark"] .ew-chat-panel { background: var(--surface); border-color: rgba(239, 233, 222, 0.1); }
html[data-theme="dark"] .ew-msg-bot { background: #232E34; color: var(--text); }
html[data-theme="dark"] .ew-chat-form input { background: #162025; color: var(--text); border-color: rgba(239, 233, 222, 0.2); }
html[data-theme="dark"] .portal-hero p { color: var(--text-soft); }
html[data-theme="dark"] .eyebrow { background: rgba(242, 179, 61, 0.15); color: var(--amber); }
html[data-theme="dark"] .lang-switch a.active { color: var(--text); }

/* ---- Theme toggle + mobile burger ---- */
.theme-toggle {
  border: 0; background: transparent; cursor: pointer;
  font-size: 1.15rem; line-height: 1; padding: 6px;
  border-radius: 50%; transition: transform 240ms var(--ease-smooth);
}
.theme-toggle:hover { transform: rotate(18deg) scale(1.15); }

.nav-burger { display: none; border: 0; background: none; cursor: pointer; padding: 8px; }
.nav-burger span {
  display: block; width: 22px; height: 2.5px; margin: 4px 0;
  border-radius: 2px; background: var(--text);
  transition: transform 240ms var(--ease-smooth), opacity 240ms var(--ease-smooth);
}
@media (max-width: 860px) {
  .nav-burger { display: block; }
  .site-header .nav-links {
    display: none;
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--surface);
    border-bottom: 1px solid rgba(35, 49, 58, 0.1);
    box-shadow: var(--shadow-lg);
    padding: 8px 0;
  }
  .site-header.nav-open .nav-links { display: flex; }
  .site-header .nav-links a { display: block; padding: 14px 24px; font-size: 1.05rem; }
  .site-header.nav-open .nav-burger span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .site-header.nav-open .nav-burger span:nth-child(2) { opacity: 0; }
  .site-header.nav-open .nav-burger span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
}

/* ---- Cursor trail: tiny apartment buildings follow the pointer ---- */
.trail-bldg {
  position: fixed; z-index: 55; pointer-events: none;
  border-radius: 2px 2px 0 0;
  background-image:
    radial-gradient(circle at 30% 28%, #F2B33D 1.3px, transparent 1.8px),
    radial-gradient(circle at 70% 55%, #F2B33D 1.3px, transparent 1.8px),
    radial-gradient(circle at 30% 78%, rgba(250, 246, 239, 0.6) 1.1px, transparent 1.6px),
    linear-gradient(180deg, #2A7E77, #12615B);
  opacity: 0;
  transform-origin: 50% 100%;
  animation: bldg-pop 1s ease-out forwards;
}
@keyframes bldg-pop {
  0%   { opacity: 0; transform: scaleY(0.2) rotate(var(--rot, 0deg)); }
  18%  { opacity: 0.9; transform: scaleY(1.05) rotate(var(--rot, 0deg)); }
  55%  { opacity: 0.75; transform: scaleY(1) translateY(-6px) rotate(var(--rot, 0deg)); }
  100% { opacity: 0; transform: scaleY(1) translateY(-22px) rotate(var(--rot, 0deg)); }
}
@media (prefers-reduced-motion: reduce) { .trail-bldg { display: none; } }

/* keep copy clear of the skyline on mid heights/widths (desktop) */
.hero-front { padding-bottom: clamp(120px, 24vh, 260px); }
@media (min-width: 761px) and (max-width: 1100px) {
  .hero-scene { opacity: 0.75; }
}
/* long German words in cards */
.card h3, .step h3, .ycard h3 { hyphens: auto; overflow-wrap: anywhere; }

/* ============================================================
   MOBILE — professional pass (≤ 640px)
   Priority: header fits one clean row, hero is balanced and the
   CTA is visible without scrolling, sections breathe evenly.
   ============================================================ */
@media (max-width: 640px) {
  .container { padding: 0 18px; }

  /* ---- Header: compact, single tidy row ---- */
  .site-header .nav { height: 58px; gap: 8px; }
  .brand { font-size: 1.06rem; gap: 7px; }
  .brand img { width: 28px; height: 28px; }
  .nav-actions { gap: 9px; }
  .theme-toggle { font-size: 1.05rem; padding: 3px; }
  .lang-switch { font-size: 0.8rem; }
  .lang-switch a { padding: 2px 2px; }
  .nav-actions .btn-ghost { padding: 8px 14px; font-size: 0.85rem; border-width: 1px; }
  .nav-burger { padding: 6px; }

  /* ---- Hero: shorter, the CTA sits above the fold ---- */
  .hero { min-height: auto; padding: 86px 0 0; }
  .hero-front { padding-top: 6px; padding-bottom: 150px; }
  /* skyline: a thin decorative band pinned to the bottom, never over the copy */
  .hero-scene svg { max-height: 118px; object-fit: cover; object-position: bottom; }
  .hero .eyebrow { font-size: 0.8rem; margin-bottom: 14px; }
  .hero-title { font-size: 2.1rem; line-height: 1.12; letter-spacing: -0.02em; max-width: none; }
  .hero-sub { font-size: 1.02rem; margin-top: 18px; max-width: none; }
  .hero-cta { margin-top: 26px; flex-direction: column; align-items: stretch; gap: 12px; }
  .hero-cta .btn-xl { width: 100%; text-align: center; padding: 16px; font-size: 1.02rem; }
  .cta-note { text-align: center; }
  .hero-sun { width: 92px; height: 92px; top: 8%; right: 7%; }
  .hero-scene { opacity: 0.45; }

  /* ---- Consistent vertical rhythm for every section ---- */
  .features, .howit, .yeartrack, .trust, .cta-final,
  .pricing-hero, .pricing-grid-wrap, .paper-compare, .trust-band, .faq,
  .tour-hero, .tour-step, .featured-band, .scrolly-stage, .related-articles {
    padding-top: 52px; padding-bottom: 52px;
  }
  .section-title { font-size: 1.62rem; line-height: 1.15; }
  .section-sub { font-size: 1rem; }
  .section-badge { width: 46px; height: 46px; margin-bottom: 14px; }

  /* ---- Marquee: smaller ticker ---- */
  .marquee { padding: 11px 0; font-size: 0.78rem; }
  .marquee span { margin-right: 30px; }

  /* ---- Cards & grids already stack; tighten spacing ---- */
  .bento { gap: 16px; }
  .card { padding: 24px 22px; }
  .kpi-grid { gap: 14px; }

  /* ---- Pricing on mobile ---- */
  .price-card { padding: 26px 22px; }
  .price-featured { transform: none; }
  .price-amount { font-size: 2.3rem; }
  .cta-box { padding: 40px 24px; }
  .cta-box h2 { font-size: 1.5rem; }

  /* ---- Tour mockups: full width, comfortable ---- */
  .tour-num { width: 40px; height: 40px; }
  .tour-text h2 { font-size: 1.3rem; }

  /* ---- Footer ---- */
  .footer-legalline { font-size: 0.78rem; }

  /* ---- Chat FAB smaller, out of the way of CTAs ---- */
  #ew-chat { bottom: 14px; right: 14px; }
  .ew-chat-fab { width: 52px; height: 52px; }
}

/* Very small phones (≤ 380px): shave the header a touch more */
@media (max-width: 380px) {
  .brand { font-size: 0.98rem; }
  .brand img { width: 26px; height: 26px; }
  .nav-actions { gap: 7px; }
  .nav-actions .btn-ghost { padding: 7px 11px; font-size: 0.8rem; }
  .hero-title { font-size: 1.92rem; }
  .section-title { font-size: 1.5rem; }
}

/* ---- Animation catalog completions (see ANIMATIONS.md) ---- */
@media (prefers-reduced-motion: no-preference) {
  /* #20 sun/moon breathes */
  .hero-sun { animation: sun-breathe 7s ease-in-out infinite alternate; }
  @keyframes sun-breathe { from { transform: scale(1); opacity: 0.9; } to { transform: scale(1.12); opacity: 1; } }

  /* #21 scroll cue bounces */
  .scroll-cue { animation: cue-bounce 2.2s ease-in-out infinite; }
  @keyframes cue-bounce { 0%, 100% { transform: translateY(0); opacity: 0.55; } 50% { transform: translateY(10px); opacity: 1; } }

  /* #24 tool result pops in when a calculation lands */
  .tool-result:not([hidden]) { animation: result-pop 420ms var(--ease-smooth); }
  @keyframes result-pop { from { opacity: 0; transform: translateY(14px) scale(0.98); } }

  /* #25 chat panel springs open */
  .ew-chat-panel:not([hidden]) { animation: chat-pop 360ms var(--ease-smooth); transform-origin: 100% 100%; }
  @keyframes chat-pop { from { opacity: 0; transform: translateY(16px) scale(0.92); } }
}

/* #22 nav links: underline slides in (motion-safe by nature) */
.nav-links a { position: relative; }
.nav-links a::after {
  content: ''; position: absolute; left: 0; right: 100%; bottom: -4px; height: 2px;
  background: var(--terracotta); transition: right 260ms var(--ease-smooth);
}
.nav-links a:hover::after { right: 0; }

/* #23 logo: door lights up, mark tips its hat */
.brand img { transition: transform 300ms var(--ease-smooth), filter 300ms var(--ease-smooth); }
.brand:hover img { transform: rotate(-6deg) scale(1.08); filter: drop-shadow(0 0 6px rgba(242, 179, 61, 0.7)); }

/* #26 marquee pauses for reading on hover */
.marquee:hover .marquee-track { animation-play-state: paused; }

/* #27 table rows glide on hover (portals) */
table.data tbody tr, table.data tr { transition: background-color 200ms var(--ease-smooth); }
table.data tr:hover td { background: rgba(15, 107, 102, 0.05); }

.scroll-cue {
  position: absolute; left: 50%; bottom: 26px; z-index: 4;
  width: 30px; height: 30px; margin-left: -15px;
  border-right: 3px solid rgba(35, 49, 58, 0.5);
  border-bottom: 3px solid rgba(35, 49, 58, 0.5);
  transform: rotate(45deg); pointer-events: none;
}
html[data-theme="dark"] .scroll-cue { border-color: rgba(239, 233, 222, 0.5); }

/* ============================================================
   Form controls, unified: selects and date/time pickers match
   text fields exactly; checkboxes compact and brand-colored.
   ============================================================ */
/* safety net: every select loses the native OS control (the dark
   "zigzag" background) regardless of which container it sits in */
select { appearance: none; -webkit-appearance: none; background-color: var(--surface); color: var(--text); }
html[data-theme="dark"] select { background-color: #162025; color: var(--text); }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) select { background-color: #162025; color: var(--text); } }

.form select, .tool-box select, .inline-form select {
  width: 100%;
  padding: 12px 40px 12px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(35, 49, 58, 0.16);
  font: 400 1rem var(--font);
  background-color: var(--surface);
  color: var(--text);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' fill='none'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%235A6B75' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}
.inline-form select { width: auto; padding: 8px 34px 8px 12px; border-radius: 10px; font-size: 0.9rem; }
.form select:focus, .tool-box select:focus, .inline-form select:focus {
  outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(15, 107, 102, 0.12);
}

/* date & time: same field styling, native picker (best on every device) */
.form input[type="date"], .form input[type="datetime-local"], .form input[type="time"],
.tool-box input[type="date"] {
  min-height: 49px; cursor: pointer;
}
::-webkit-calendar-picker-indicator {
  width: 18px; height: 18px; cursor: pointer; opacity: 0.65;
}
::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* checkboxes: never full-width, brand accent, aligned with their text */
input[type="checkbox"] {
  width: 19px !important; height: 19px; margin: 0; flex: 0 0 auto;
  accent-color: var(--terracotta); cursor: pointer;
}
.check, label.check {
  display: flex; align-items: center; gap: 10px;
  font-weight: 500; cursor: pointer; width: auto;
}
.check input { margin-top: 0 !important; }

html[data-theme="dark"] .form select, html[data-theme="dark"] .tool-box select,
html[data-theme="dark"] .inline-form select {
  background-color: #162025; color: var(--text); border-color: rgba(239, 233, 222, 0.2);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' fill='none'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%239FAAB0' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* ============================================================
   Story sections simplified: no pinning, free scroll flow
   ============================================================ */
.scrolly-stage { min-height: 0; padding: 80px 0; }
.gsap-on .chapter { opacity: 1; transform: none; }
.gsap-on .scrolly-card { opacity: 1; transform: none; }
.scrolly-card { grid-area: auto; margin-bottom: 14px; }
.scrolly-visual { align-content: start; }
.yeartrack .yeartrack-viewport { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ============================================================
   Pricing page
   ============================================================ */
.pricing-hero { padding: 120px 0 40px; }
.pricing-hero .section-title { max-width: 22ch; }
.pricing-grid-wrap { padding: 20px 0 70px; }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; align-items: stretch; }
.price-card {
  background: var(--surface); border: 1px solid rgba(35, 49, 58, 0.1);
  border-radius: 22px; padding: 32px 28px; display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm); position: relative;
}
.price-featured {
  border: 2px solid var(--terracotta);
  box-shadow: 0 20px 50px rgba(226, 103, 58, 0.2);
  transform: translateY(-8px);
}
.price-badge {
  align-self: flex-start; font: 700 0.72rem/1.6 var(--font); letter-spacing: 0.08em;
  text-transform: uppercase; padding: 4px 12px; border-radius: 999px;
  background: rgba(15, 107, 102, 0.12); color: var(--teal); margin-bottom: 14px;
}
.price-badge-hot { background: var(--terracotta); color: #fff; }
.price-card h2 { font-size: 1.3rem; margin-bottom: 6px; }
.price-amount { font: 800 2.6rem/1 var(--font-display); color: var(--text); margin: 8px 0 2px; letter-spacing: -0.02em; }
.price-per { font: 400 0.95rem var(--font); color: var(--text-soft); letter-spacing: 0; }
.price-sub { color: var(--text-soft); font-size: 0.92rem; margin-bottom: 18px; }
.price-feats { list-style: none; display: grid; gap: 9px; margin: 0 0 22px; padding: 0; flex: 1; }
.price-feats li { font-size: 0.95rem; color: var(--text); }
.btn-block { display: block; text-align: center; width: 100%; }
.price-note { text-align: center; font-size: 0.82rem; color: var(--text-soft); margin-top: 10px; }
.price-pilot { background: linear-gradient(160deg, var(--cream), var(--cream-deep)); }
html[data-theme="dark"] .price-pilot { background: linear-gradient(160deg, #232E34, #1D262B); }
@media (max-width: 860px) { .pricing-grid { grid-template-columns: 1fr; } .price-featured { transform: none; } }

/* Paper comparison */
.paper-compare { padding: 70px 0; background: var(--cream-deep); }
html[data-theme="dark"] .paper-compare { background: #16202533; }
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 36px; }
.compare-col { border-radius: 20px; padding: 30px 28px; }
.compare-paper { background: var(--surface); border: 1px solid rgba(35, 49, 58, 0.12); }
.compare-digital { background: linear-gradient(135deg, #0F6B66, #0A4A46); color: var(--cream); }
.compare-col h3 { font-size: 1.2rem; margin-bottom: 16px; }
.compare-col ul { list-style: none; display: grid; gap: 12px; padding: 0; }
.compare-col li { font-size: 0.98rem; }
.compare-digital li { color: rgba(250, 246, 239, 0.9); }
.compare-total { font-weight: 800; font-size: 1.15rem !important; padding-top: 8px; }
.compare-x { color: #A6431C; font-weight: 600; }
.compare-check { color: var(--amber); font-weight: 700; }
@media (max-width: 700px) { .compare-grid { grid-template-columns: 1fr; } }

/* Trust band */
.trust-band { padding: 80px 0; background: var(--ink); }
.trust-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 40px; }
.trust-card { background: rgba(250, 246, 239, 0.05); border: 1px solid rgba(250, 246, 239, 0.1); border-radius: 16px; padding: 24px; }
.trust-icon { font-size: 1.8rem; }
.trust-card h3 { color: var(--cream); font-size: 1.1rem; margin: 12px 0 6px; }
.trust-card p { color: rgba(250, 246, 239, 0.7); font-size: 0.92rem; }
@media (max-width: 860px) { .trust-grid { grid-template-columns: 1fr; } }

/* FAQ */
.faq { padding: 80px 0; }
.faq-item { border-bottom: 1px solid rgba(35, 49, 58, 0.12); padding: 18px 0; max-width: 800px; margin: 0 auto; }
.faq-item summary { font-weight: 700; font-size: 1.05rem; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.faq-item summary::after { content: '+'; color: var(--terracotta); font-size: 1.4rem; }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { margin-top: 12px; color: var(--text-soft); max-width: 720px; }

/* ============================================================
   Product walkthrough (tour) + UI mockups
   ============================================================ */
.tour-hero { padding: 120px 0 30px; }
.tour-hero .section-title { max-width: 24ch; }
.tour-step { padding: 50px 0; }
.tour-alt { background: var(--cream-deep); }
html[data-theme="dark"] .tour-alt { background: #16202533; }
.tour-inner { display: grid; grid-template-columns: 1fr 1.1fr; gap: 48px; align-items: center; }
.tour-alt .tour-inner { direction: rtl; } .tour-alt .tour-text, .tour-alt .tour-visual { direction: ltr; }
.tour-num {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px;
  background: var(--terracotta); color: #fff; font: 800 1.3rem var(--font-display); margin-bottom: 12px;
}
.tour-text h2 { font-size: 1.5rem; margin: 10px 0 10px; }
.tour-text p { color: var(--text-soft); font-size: 1.02rem; }
.tour-text .who { display: inline-block; margin-left: 10px; }

/* UI mockup */
.mock { background: var(--surface); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid rgba(35,49,58,0.1); }
.mock-bar { background: #E6E0D2; padding: 9px 12px; display: flex; align-items: center; gap: 6px; }
html[data-theme="dark"] .mock-bar { background: #2A343A; }
.mock-dot { width: 10px; height: 10px; border-radius: 50%; }
.mock-url { margin-left: 10px; font: 400 0.72rem var(--font-mono, monospace); color: var(--text-soft); background: var(--surface); padding: 3px 10px; border-radius: 6px; }
.mock-head { padding: 12px 16px; border-bottom: 1px solid rgba(35,49,58,0.08); font-family: var(--font-display); font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.mock-logo { width: 20px; height: 20px; border-radius: 5px; background: linear-gradient(135deg,#12716B,#0A4A46); }
.mock-body { padding: 20px; min-height: 200px; }
.mk-bar { display: block; height: 9px; border-radius: 5px; margin: 7px 0; }
.mk-card { display: grid; gap: 8px; }
.mk-narrow { max-width: 260px; margin: 0 auto; text-align: center; }
.mk-keys, .mk-photo, .mk-doc { font-size: 1.6rem; }
.mk-btn { background: var(--terracotta); color: #fff; text-align: center; padding: 9px; border-radius: 9px; font-weight: 700; font-size: 0.85rem; margin-top: 6px; }
.mk-btn.mk-sm { padding: 7px; font-size: 0.78rem; }
.mk-emergency { background: #A32D2D; }
.mk-welcome { font-size: 1.1rem; font-weight: 700; margin-bottom: 14px; }
.mk-kpis { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 14px; }
.mk-kpi { background: var(--cream-deep); border-radius: 10px; padding: 12px; text-align: center; }
html[data-theme="dark"] .mk-kpi { background: #232E34; }
.mk-kpi b { display: block; font: 800 1.1rem var(--font-display); }
.mk-kpi span { font-size: 0.72rem; color: var(--text-soft); }
.mk-kpi.mk-ok b { color: var(--teal); }
.mk-event, .mk-doc { background: var(--cream-deep); border-radius: 10px; padding: 12px; }
html[data-theme="dark"] .mk-event, html[data-theme="dark"] .mk-doc { background: #232E34; }
.mk-tag { display: inline-block; background: rgba(15,107,102,0.14); color: var(--teal); font: 700 0.68rem var(--font); padding: 3px 9px; border-radius: 20px; margin-bottom: 8px; }
.mk-tag.mk-t2 { background: rgba(226,103,58,0.14); color: var(--terracotta); }
.mk-tag.mk-t3 { background: rgba(242,179,61,0.2); color: #8a6414; }
.mk-input, .mk-select { background: var(--cream-deep); border: 1px solid rgba(35,49,58,0.14); border-radius: 8px; padding: 9px 12px; font-size: 0.82rem; color: var(--text-soft); }
html[data-theme="dark"] .mk-input, html[data-theme="dark"] .mk-select { background: #162025; }
.mk-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mk-col { display: grid; gap: 6px; align-content: start; }
.mk-photo { background: var(--cream-deep); border-radius: 8px; padding: 14px; text-align: center; }
.mk-accept, .mk-check { background: rgba(15,107,102,0.12); color: var(--teal); border-radius: 8px; padding: 9px; text-align: center; font-weight: 700; font-size: 0.82rem; }
.mk-resolved { display: inline-block; background: rgba(39,80,10,0.14); color: #27500A; font-weight: 800; padding: 6px 16px; border-radius: 20px; margin-bottom: 14px; }
.mk-timeline { display: grid; gap: 8px; margin-bottom: 14px; }
.mk-doc { display: flex; align-items: center; justify-content: space-between; }
.mk-seal { font-size: 0.72rem; color: var(--teal); font-weight: 700; }
@media (max-width: 860px) { .tour-inner { grid-template-columns: 1fr; } .tour-alt .tour-inner { direction: ltr; } }

/* ---- Roles & responsibility notice ---- */
.responsibility-box {
  background: var(--cream-deep); border: 1px solid rgba(35, 49, 58, 0.1);
  border-left: 4px solid var(--teal); border-radius: 0 12px 12px 0;
  padding: 18px 22px; margin: 16px 0; font-size: 0.92rem;
}
.responsibility-box .label { font-weight: 700; color: var(--teal); text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.78rem; margin-bottom: 8px; }
.responsibility-box ul { margin: 10px 0 10px 20px; display: grid; gap: 6px; }
.responsibility-box li { color: var(--text-soft); }
.responsibility-box a { color: var(--teal); font-weight: 600; }
html[data-theme="dark"] .responsibility-box { background: #232E34; border-left-color: var(--teal); }
.emergency-check { background: rgba(226, 103, 58, 0.08); border-radius: 10px; padding: 12px 14px; align-items: flex-start; }
.emergency-check span { font-weight: 400; font-size: 0.9rem; }

/* ---- Blog: breadcrumb, in-article CTA, related ---- */
.breadcrumb { font-size: 0.85rem; color: var(--text-soft); margin-bottom: 14px; }
.breadcrumb a { color: var(--teal); }
.article-cta {
  margin: 40px 0; padding: 28px 32px; border-radius: 18px;
  background: linear-gradient(120deg, #FDF3E3, #F9DDBD);
  border: 1.5px solid rgba(226, 103, 58, 0.25);
}
html[data-theme="dark"] .article-cta {
  background: linear-gradient(120deg, #1D262B, #232E34);
  border-color: rgba(226, 103, 58, 0.4);
}
.article-cta strong { font-size: 1.15rem; display: block; margin-bottom: 6px; }
.article-cta p { margin-bottom: 16px; }
.article-cta .btn { margin-right: 10px; }
.related-articles { padding: 20px 24px 80px; }
.related-articles h2 { margin-bottom: 22px; }

/* ---- Ticket photo grid ---- */
.photo-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.photo-grid img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 12px; box-shadow: var(--shadow-sm);
  transition: transform 240ms var(--ease-smooth), box-shadow 240ms var(--ease-smooth);
}
.photo-grid a:hover img { transform: scale(1.03); box-shadow: var(--shadow-lg); }

/* ---- Detailed GmbH footer ---- */
.footer-grid {
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
}
.footer-col h4 {
  font: 700 0.78rem/1.6 var(--font); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--amber); margin-bottom: 14px;
}
.footer-col ul { list-style: none; display: grid; gap: 9px; }
.footer-col a { color: rgba(250, 246, 239, 0.75); font-size: 0.93rem; }
.footer-col a:hover { color: var(--amber); }
.footer-legalline {
  grid-column: 1 / -1; margin-top: 26px; padding-top: 22px;
  border-top: 1px solid rgba(250, 246, 239, 0.14);
  font-size: 0.82rem; color: rgba(250, 246, 239, 0.55); line-height: 1.8;
}
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 540px) { .footer-grid { grid-template-columns: 1fr; } }

/* ============================================================
   MANAGER COMMS, FLASH, WYSIWYG, BADGES  (dashboard components)
   ============================================================ */

/* ---- small button + count bubble ---- */
.btn-sm { padding: 7px 14px; font-size: 0.85rem; border-radius: 10px; }
.nav-badge {
  display: inline-block; min-width: 18px; height: 18px; padding: 0 5px;
  margin-left: 6px; border-radius: 9px; vertical-align: middle;
  background: var(--terracotta); color: #fff;
  font: 700 0.72rem/18px var(--font); text-align: center;
}
.nav-badge-inline { margin-left: 8px; background: var(--teal); }
.badge-error { background: rgba(226, 103, 58, 0.16); color: #A6431C; }

/* ---- flash messages (auto-dismiss 20s; failures stick with a resend) ---- */
.flash-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.flash {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 12px; font-size: 0.95rem;
  border: 1px solid transparent; box-shadow: 0 6px 20px rgba(20, 30, 25, 0.10);
  animation: flash-in 260ms var(--ease-smooth);
}
.flash-text { flex: 1; }
.flash-success, .flash-info { background: rgba(15, 107, 102, 0.12); color: var(--teal-deep); border-color: rgba(15, 107, 102, 0.22); }
.flash-warn  { background: rgba(242, 179, 61, 0.18); color: #7A5A12; border-color: rgba(242, 179, 61, 0.4); }
.flash-error { background: rgba(226, 103, 58, 0.15); color: #A6431C; border-color: rgba(226, 103, 58, 0.32); }
.flash-action { margin: 0; }
.flash-action button { white-space: nowrap; }
.flash-close { border: 0; background: none; color: inherit; cursor: pointer; font-size: 1.3rem; line-height: 1; padding: 0 2px; opacity: 0.55; }
.flash-close:hover { opacity: 1; }
.flash-out { animation: flash-out 320ms var(--ease-smooth) forwards; }
@keyframes flash-in  { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes flash-out { to { opacity: 0; transform: translateY(-6px); height: 0; margin: 0; padding-top: 0; padding-bottom: 0; } }
@media (prefers-reduced-motion: reduce) { .flash, .flash-out { animation: none; } }

/* ---- WYSIWYG editor (textarea.rich → toolbar + contenteditable) ---- */
.ew-editor { border: 1px solid rgba(35, 49, 58, 0.18); border-radius: 12px; overflow: hidden; background: var(--surface); }
.ew-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; background: var(--cream-deep); border-bottom: 1px solid rgba(35, 49, 58, 0.1); }
.ew-btn { border: 0; background: none; color: var(--text); cursor: pointer; min-width: 30px; padding: 5px 9px; border-radius: 7px; font-size: 0.85rem; }
.ew-btn:hover { background: rgba(15, 107, 102, 0.12); }
.ew-content { min-height: 130px; padding: 12px 14px; font-size: 0.98rem; line-height: 1.55; color: var(--text); outline: none; }
.ew-content:focus { box-shadow: inset 0 0 0 2px rgba(15, 107, 102, 0.25); }
.ew-content:empty:before { content: attr(data-placeholder); color: var(--text-soft); }
.ew-content h3 { font-size: 1.1rem; margin: 0.4em 0 0.2em; }
.ew-content ul, .ew-content ol { margin: 0.4em 0 0.4em 1.4em; }
.ew-content blockquote { border-left: 3px solid var(--teal); margin: 0.5em 0; padding-left: 12px; color: var(--text-soft); }
.ew-content img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 8px 0; }
textarea.ew-source { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; border: 0; opacity: 0; overflow: hidden; pointer-events: none; }

/* ---- rich announcement body in the owner portal ---- */
.event-body { color: var(--text-soft); font-size: 0.97rem; line-height: 1.62; }
.event-body p { margin: 0.5em 0; }
.event-body h3, .event-body h4 { color: var(--text); margin: 0.6em 0 0.2em; }
.event-body ul, .event-body ol { margin: 0.4em 0 0.4em 1.3em; }
.event-body blockquote { border-left: 3px solid var(--teal); margin: 0.5em 0; padding-left: 12px; }

/* ---- manager task list ---- */
.task-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.task-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 14px 16px; border: 1px solid rgba(35, 49, 58, 0.1); border-radius: 12px; background: var(--surface);
}
.task-item.task-done { opacity: 0.55; }
.task-main { display: flex; gap: 12px; align-items: flex-start; }
.task-kind { font-size: 1.15rem; line-height: 1.4; }
.task-body { margin: 6px 0 0; color: var(--text-soft); font-size: 0.9rem; }
.task-meta { display: block; margin-top: 6px; }

/* ---- superadmin request cards ---- */
.request-list { display: flex; flex-direction: column; gap: 16px; }
.request-card.request-done { opacity: 0.6; }
.request-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.request-form { margin-top: 14px; align-items: end; }

/* ---- owner ticket rows ---- */
.ticket-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 26px; }
.ticket-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border: 1px solid rgba(35, 49, 58, 0.1); border-radius: 12px; background: var(--surface);
  color: var(--text); text-decoration: none; transition: border-color 160ms var(--ease-smooth);
}
.ticket-row:hover { border-color: var(--teal); }
.ticket-title { flex: 1; font-weight: 600; }
.ticket-date { white-space: nowrap; }
.comms-table .row-failed td { background: rgba(226, 103, 58, 0.05); }

/* ---- dark-mode surfaces/borders for the new components ---- */
html[data-theme="dark"] .task-item,
html[data-theme="dark"] .ticket-row,
html[data-theme="dark"] .ew-editor { border-color: rgba(239, 233, 222, 0.14); }
html[data-theme="dark"] .ew-toolbar { background: #232E34; border-bottom-color: rgba(239, 233, 222, 0.1); }
html[data-theme="dark"] .ew-btn:hover { background: rgba(239, 233, 222, 0.1); }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .task-item,
  html:not([data-theme="light"]) .ticket-row,
  html:not([data-theme="light"]) .ew-editor { border-color: rgba(239, 233, 222, 0.14); }
  html:not([data-theme="light"]) .ew-toolbar { background: #232E34; border-bottom-color: rgba(239, 233, 222, 0.1); }
}

/* ============================================================
   MOBILE — dashboard / portal pass (≤ 640px)
   ============================================================ */
@media (max-width: 640px) {
  .app-main { padding: 24px 16px 72px; }
  /* hero bleed must match the reduced app-main padding */
  .portal-hero { margin-left: -16px; margin-right: -16px; }
  .page-head h1 { font-size: 1.55rem; }
  .app-header { position: relative; }
  .app-header .nav-links { top: 58px; }
  .app-header .nav-actions .btn-ghost { padding: 8px 12px; font-size: 0.82rem; }

  /* flash comfortable on small screens */
  .flash { flex-wrap: wrap; }
  .flash-action { order: 3; width: 100%; }
  .flash-action button { width: 100%; }

  /* editor toolbar becomes a horizontal scroller */
  .ew-toolbar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ew-btn { flex: 0 0 auto; }

  /* forms + two-column grids stack */
  .form-row { grid-template-columns: 1fr; }
  .grid-2col { gap: 18px; }
  .panel { padding: 20px 18px; }

  /* comms table → stacked cards (labels come from data-label) */
  .comms-table thead { display: none; }
  .comms-table, .comms-table tbody, .comms-table tr, .comms-table td { display: block; width: auto; }
  .comms-table tr { border: 1px solid rgba(35, 49, 58, 0.12); border-radius: 12px; padding: 8px 12px; margin: 10px; }
  .comms-table td { border: 0; padding: 5px 0; display: flex; justify-content: space-between; gap: 14px; text-align: right; overflow-wrap: anywhere; min-width: 0; }
  .comms-table td .hint { overflow-wrap: anywhere; }
  .comms-table td:before { content: attr(data-label); font-weight: 600; color: var(--text-soft); text-align: left; flex: 0 0 auto; }
  .comms-table td[data-label=""] { justify-content: flex-end; }
  .comms-table td[data-label=""]:before { content: ""; }

  .task-item { flex-direction: column; align-items: stretch; }
  .task-item form, .task-item .badge { align-self: flex-start; }
  .ticket-row { flex-wrap: wrap; gap: 6px 12px; }
  html[data-theme="dark"] .comms-table tr { border-color: rgba(239, 233, 222, 0.14); }
}

/* ============================================================
   OWNER PORTAL — new-announcement banner, accordions, pager
   ============================================================ */

/* rich bodies always stay inside their container/viewport */
.event-body { max-width: 100%; overflow-wrap: anywhere; }
.event-body img { max-width: 100%; height: auto; border-radius: 10px; }

/* ---- "new announcement" header banner ---- */
.new-banner {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 18px;
  margin: 6px 0 18px; padding: 18px 22px;
  border-radius: 16px; border: 1px solid rgba(226, 103, 58, 0.35);
  background:
    radial-gradient(circle at 88% 20%, rgba(242, 179, 61, 0.35), transparent 55%),
    linear-gradient(100deg, rgba(226, 103, 58, 0.16), rgba(15, 107, 102, 0.14));
}
.new-banner-art {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at 12% 110%, rgba(143, 182, 163, 0.35), transparent 40%);
}
.new-banner-text { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.new-banner-text p { width: 100%; margin: 2px 0 0; color: var(--text-soft); font-size: 0.95rem; }
.new-banner-date { color: var(--text-soft); font-size: 0.9rem; }
.chip-new {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--terracotta); color: #fff;
  font: 700 0.72rem/1.4 var(--font); letter-spacing: 0.06em;
  animation: chip-pulse 2s ease-in-out infinite;
}
@keyframes chip-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(226, 103, 58, 0.45); }
  50%      { box-shadow: 0 0 0 7px rgba(226, 103, 58, 0); }
}
@media (prefers-reduced-motion: reduce) { .chip-new { animation: none; } }

/* ---- accordion ---- */
.acc-group { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
details.acc {
  border: 1px solid rgba(35, 49, 58, 0.12); border-radius: 14px;
  background: var(--surface); overflow: hidden;
  transition: border-color 200ms var(--ease-smooth), box-shadow 200ms var(--ease-smooth);
}
details.acc[open] { border-color: var(--teal); box-shadow: var(--shadow-sm); }
details.acc.acc-new { border-color: rgba(226, 103, 58, 0.5); }
details.acc summary {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; cursor: pointer; list-style: none;
  font-weight: 600; color: var(--text);
}
details.acc summary::-webkit-details-marker { display: none; }
.acc-title { flex: 1; min-width: 0; overflow-wrap: break-word; }
.acc-chev {
  flex: 0 0 auto; width: 10px; height: 10px;
  border-right: 2.5px solid var(--text-soft); border-bottom: 2.5px solid var(--text-soft);
  transform: rotate(45deg); transition: transform 240ms var(--ease-smooth);
}
details.acc[open] .acc-chev { transform: rotate(225deg); }
.acc-body {
  padding: 4px 18px 18px;
  border-top: 1px dashed rgba(35, 49, 58, 0.12);
  animation: acc-open 260ms var(--ease-smooth);
}
@keyframes acc-open { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .acc-body { animation: none; } }
.acc-body .legal-ref { margin: 10px 0 4px; }
.btn-pdf { margin-top: 12px; display: inline-block; }

/* small screens: summary wraps — meta row on top, title on its own line */
@media (max-width: 640px) {
  details.acc summary { flex-wrap: wrap; row-gap: 4px; position: relative; padding-right: 48px; }
  details.acc summary .acc-title { flex: 1 1 100%; order: 5; }
  details.acc summary .acc-chev { position: absolute; right: 20px; top: 24px; }
  details.acc summary time { margin-left: auto; }
}

/* ---- pager ---- */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 6px 0 20px; }
.pager-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface); border: 1px solid rgba(35, 49, 58, 0.15);
  color: var(--text); font-size: 1.2rem; text-decoration: none;
}
.pager-btn:hover { border-color: var(--teal); color: var(--teal); }
.pager-info { color: var(--text-soft); font-size: 0.9rem; }

/* ---- dark mode ---- */
html[data-theme="dark"] details.acc,
html[data-theme="dark"] .pager-btn { border-color: rgba(239, 233, 222, 0.14); }
html[data-theme="dark"] details.acc[open] { border-color: var(--teal); }
html[data-theme="dark"] .acc-body { border-top-color: rgba(239, 233, 222, 0.12); }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) details.acc,
  html:not([data-theme="light"]) .pager-btn { border-color: rgba(239, 233, 222, 0.14); }
  html:not([data-theme="light"]) details.acc[open] { border-color: var(--teal); }
  html:not([data-theme="light"]) .acc-body { border-top-color: rgba(239, 233, 222, 0.12); }
}
