/* ══════════════════════════════════════════════════════════
   CSRD NG911 Documentation — Shared Design System
   Clean, minimal, documentation-first design
   ══════════════════════════════════════════════════════════ */
:root {
  /* ── Brand ── */
  --navy: #1a1a2e;
  --navy-light: #2d2d44;
  --navy-mid: #23233a;
  --teal: #0d9488;
  --teal-light: #14b8a6;
  --teal-glow: rgba(13, 148, 136, .06);
  --teal-soft: #f0fdfa;
  --teal-border: rgba(13, 148, 136, .18);

  /* ── Neutrals ── */
  --gray: #64748b;
  --gray-light: #94a3b8;
  --gray-dark: #475569;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  /* ── Surfaces ── */
  --bg-page: #fafbfc;
  --bg-card: #ffffff;
  --bg-sidebar: #f4f6f8;
  --bg-hero: #f0f7fa;
  --white: #ffffff;

  /* ── Accents (reduced palette for readability) ── */
  --accent: #4b7a8c;
  --accent-glow: rgba(75, 122, 140, .06);
  --border: #e5e9ef;
  --border-strong: #cbd5e1;
  --red: #dc6b6b;
  --amber: #c49552;
  --green: #5a9e6f;
  --purple: #7c7fa8;
  --pink: #a8708e;
  --indigo: #717499;

  /* ── Layout ── */
  --sidebar-w: 250px;
  --content-max: 920px;

  /* ── Code ── */
  --code-bg: #0f172a;
  --code-border: #1e293b;

  /* ── Elevation ── */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .03);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, .05);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, .08);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
}

/* ── RESET ── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}

html {
  scroll-behavior: smooth;
  font-size: 15.5px
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale
}

/* ── PROGRESS BAR ── */
#progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--teal), var(--accent));
  z-index: 999;
  width: 0;
  transition: width .15s linear
}

/* ══════════════════════════════════════
   SIDEBAR — Simple, text-focused
   ══════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: #dae1e9;
  color: var(--text-primary);
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border)
}

.sidebar::-webkit-scrollbar {
  width: 4px
}

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

.sidebar-brand {
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center
}

.sidebar-brand img {
  width: 100px;
  margin-bottom: 6px;
  transition: transform .3s
}

.sidebar-brand:hover img {
  transform: scale(1.02)
}

.sidebar-brand h2 {
  font-family: 'Poppins', sans-serif;
  font-size: .6rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--teal);
  font-weight: 700
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 22px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 500;
  transition: all .2s;
  border-left: 3px solid transparent
}

.sidebar-nav a:hover {
  color: var(--teal);
  background: var(--teal-glow)
}

.sidebar-nav a.active {
  color: var(--teal);
  border-left-color: var(--teal);
  background: var(--teal-glow);
  font-weight: 600
}

.sidebar-nav a i {
  width: 16px;
  text-align: center;
  font-size: .78rem;
  color: var(--gray-light);
  transition: color .2s;
  flex-shrink: 0
}

.sidebar-nav a.active i {
  color: var(--teal)
}

.sidebar-nav a:hover i {
  color: var(--teal)
}

.nav-group-label {
  padding: 22px 22px 6px;
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--gray)
}

.nav-group-label+.nav-sub-label {
  padding-top: 8px
}

.nav-sub-label {
  padding: 12px 22px 4px;
  font-size: .58rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--teal);
  opacity: .7
}

.sidebar-nav a.nav-indent {
  padding-left: 34px;
  font-size: .8rem
}

.sidebar-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  font-size: .68rem;
  color: var(--text-muted);
  text-align: center
}

/* ══════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════ */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh
}

/* ── HERO (Hub page — contained card) ── */
.hero-wrapper {
  padding: 32px 40px 8px;
  position: relative;
  z-index: 50;
}

.hero-card {
  background: linear-gradient(160deg, #e0eef5 0%, #dce9e8 30%, #e4eef5 60%, #edf2f7 100%);
  border-radius: var(--radius-lg);
  padding: 40px 44px 28px;
  max-width: var(--content-max);
  margin: 0 auto;
  position: relative;
  animation: heroIn .6s cubic-bezier(.22, 1, .36, 1) both;
}

.hero-card-inner {
  display: flex;
  align-items: center;
  gap: 24px;
}

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

.hero-graphic {
  flex-shrink: 0;
  width: 280px;
}

.hero-graphic img {
  width: 100%;
  height: auto;
  display: block;
  animation: heroIn .6s .15s cubic-bezier(.22, 1, .36, 1) both;
}

.hero-card h1 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 6px;
  color: var(--navy);
}

.hero-card h1 span {
  color: var(--teal);
}

.hero-card .subtitle {
  font-size: .95rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

/* ── SEARCH BAR ── */
.hero-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  max-width: 420px;
  transition: all .25s;
  box-shadow: var(--shadow-xs);
}

.hero-search:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-glow), var(--shadow-sm);
}

.hero-search i {
  color: var(--gray-light);
  font-size: .85rem;
  flex-shrink: 0;
}

.hero-search input {
  border: none;
  outline: none;
  font-family: inherit;
  font-size: .88rem;
  color: var(--text-primary);
  background: transparent;
  width: 100%;
}

.hero-search input::placeholder {
  color: var(--text-muted);
}

/* Keep the old .hero class for sub-pages that reuse it */
.hero {
  background: linear-gradient(160deg, #eef6f9 0%, #e8f4f0 30%, #f2f7fb 60%, var(--bg-page) 100%);
  color: var(--text-primary);
  padding: 48px 48px 44px;
  position: relative;
  overflow: hidden;
}

.hero-canvas {
  display: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: linear-gradient(to top, var(--bg-page), transparent);
  z-index: 2;
}

.hero-content {
  position: relative;
  z-index: 3;
  max-width: 720px;
}

.hero h1,
.hero-card h1 {
  font-family: 'Poppins', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 6px;
  color: var(--navy);
}

.hero h1 span,
.hero-card h1 span {
  color: var(--teal);
}

.hero .subtitle {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.hero p {
  font-size: .88rem;
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.8;
}

@keyframes heroIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-stats {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
  animation: heroIn .6s .18s cubic-bezier(.22, 1, .36, 1) both
}

.hero-stat {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  min-width: 120px;
  text-align: center;
  transition: all .25s;
  box-shadow: var(--shadow-xs)
}

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

.hero-stat .stat-num {
  font-family: 'Poppins', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--teal);
  display: block;
  line-height: 1
}

.hero-stat .stat-label {
  font-size: .65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-top: 3px;
  font-weight: 500
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 18px;
  animation: heroIn .6s .24s cubic-bezier(.22, 1, .36, 1) both
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 600;
  background: var(--teal-glow);
  border: 1px solid var(--teal-border);
  color: var(--teal);
  transition: all .2s
}

.badge:hover {
  background: rgba(13, 148, 136, .1)
}

.badge i {
  font-size: .62rem;
  opacity: .6
}

/* ══════════════════════════════════════
   NAV CARDS (Hub page — 2-col grid)
   ══════════════════════════════════════ */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 40px;
}

.nav-card {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 24px 20px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: all .25s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 0, 0, .04);
}

.nav-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, .1), 0 2px 6px rgba(0, 0, 0, .06);
  transform: translateY(-2px);
  border-color: rgba(13, 148, 136, .25);
}

.nav-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--light-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
  color: var(--teal);
}

.nav-card-body {
  flex: 1;
  min-width: 0;
}

.nav-card-body h4 {
  font-family: 'Poppins', sans-serif;
  font-size: .95rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}

.nav-card-body p {
  font-size: .82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.nav-card-chevron {
  font-size: .75rem;
  color: var(--gray-light);
  flex-shrink: 0;
  transition: transform .2s;
}

.nav-card:hover .nav-card-chevron {
  transform: translateX(3px);
  color: var(--teal);
}

/* ── PAGE HEADER (sub-pages) ── */
.page-header {
  background: linear-gradient(160deg, #eef6f9 0%, #f2f7fb 50%, var(--bg-page) 100%);
  color: var(--text-primary);
  padding: 32px 48px 30px;
  position: relative;
  overflow: hidden
}

.page-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: linear-gradient(to top, var(--bg-page), transparent);
  z-index: 2
}

.page-header .page-header-content {
  position: relative;
  z-index: 3;
  max-width: var(--content-max)
}

.page-header h1 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 4px;
  color: var(--navy);
  animation: heroIn .5s cubic-bezier(.22, 1, .36, 1) both
}

.page-header h1 span {
  color: var(--teal)
}

.page-header .subtitle {
  font-size: .84rem;
  font-weight: 400;
  color: var(--text-secondary);
  animation: heroIn .5s .06s cubic-bezier(.22, 1, .36, 1) both
}

/* ── BREADCRUMB ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  animation: heroIn .4s cubic-bezier(.22, 1, .36, 1) both
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: .76rem;
  font-weight: 500;
  transition: color .2s
}

.breadcrumb a:hover {
  color: var(--teal)
}

.breadcrumb .sep {
  color: var(--border-strong);
  font-size: .5rem
}

.breadcrumb .current {
  color: var(--teal);
  font-size: .76rem;
  font-weight: 600
}

/* ── DETAIL HEADER BANNER ── */
.detail-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 6px;
  animation: heroIn .5s .08s cubic-bezier(.22, 1, .36, 1) both
}

.detail-banner .banner-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--white);
  flex-shrink: 0
}

.detail-banner .banner-info h1 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 2px
}

.detail-banner .banner-tags {
  display: flex;
  gap: 7px;
  flex-wrap: wrap
}

.banner-tag {
  padding: 3px 11px;
  border-radius: 20px;
  font-size: .66rem;
  font-weight: 600;
  background: var(--teal-glow);
  color: var(--teal);
  border: 1px solid var(--teal-border)
}

/* ══════════════════════════════════════
   CONTENT — Generous whitespace
   ══════════════════════════════════════ */
.content-wrap {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 32px 56px
}

section {
  padding-top: 40px
}

section:first-child {
  padding-top: 24px
}

section h2 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 3px solid var(--teal);
  display: inline-block
}

section h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  margin: 26px 0 10px
}

section h4 {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 16px 0 8px
}

section p,
section li {
  font-size: .88rem;
  color: var(--text-secondary);
  line-height: 1.8
}

section ul,
section ol {
  padding-left: 20px;
  margin: 6px 0 12px
}

section li {
  margin-bottom: 4px
}

/* ── REVEAL ── */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .5s cubic-bezier(.22, 1, .36, 1), transform .5s cubic-bezier(.22, 1, .36, 1)
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0)
}

.reveal-delay-1 {
  transition-delay: .07s
}

.reveal-delay-2 {
  transition-delay: .14s
}

.reveal-delay-3 {
  transition-delay: .21s
}

.reveal-delay-4 {
  transition-delay: .28s
}

/* ══════════════════════════════════════
   CARDS — Large, spacious, clickable
   ══════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 10px 0;
  transition: all .25s cubic-bezier(.22, 1, .36, 1);
  position: relative;
  overflow: hidden
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--accent));
  opacity: 0;
  transition: opacity .25s
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--teal-border)
}

.card:hover::before {
  opacity: 1
}

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

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .92rem;
  color: var(--white);
  flex-shrink: 0
}

.card-icon.teal {
  background: var(--teal)
}

.card-icon.blue {
  background: var(--accent)
}

.card-icon.amber {
  background: var(--amber)
}

.card-icon.red {
  background: var(--red)
}

.card-icon.green {
  background: var(--green)
}

.card-icon.navy {
  background: #2d3e50
}

.card-icon.purple {
  background: var(--purple)
}

.card-icon.pink {
  background: var(--pink)
}

.card-icon.indigo {
  background: var(--indigo)
}

.card-icon.lg {
  width: 46px;
  height: 46px;
  font-size: 1.1rem;
  border-radius: var(--radius)
}

.card-header h4 {
  margin: 0;
  font-size: .92rem;
  font-weight: 700;
  color: var(--navy)
}

.card-header .card-tag {
  margin-left: auto;
  font-size: .66rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--teal-glow);
  color: var(--teal);
  white-space: nowrap
}

/* ── LINK CARDS ── */
a.link-card {
  display: block;
  text-decoration: none;
  color: inherit
}

a.link-card .card {
  cursor: pointer
}

a.link-card .card .card-arrow {
  margin-left: auto;
  color: var(--border-strong);
  font-size: .82rem;
  transition: transform .3s, color .3s
}

a.link-card .card:hover .card-arrow {
  transform: translateX(4px);
  color: var(--teal)
}

a.link-card .card-sub {
  font-size: .76rem;
  color: var(--text-muted);
  margin-top: 2px
}

/* ── BREAKDOWN CARDS ── */
.breakdown-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 10px 0;
  transition: all .25s;
  border-left: 4px solid var(--teal)
}

.breakdown-card:hover {
  box-shadow: var(--shadow-sm)
}

.breakdown-card h4 {
  font-family: 'Poppins', sans-serif;
  font-size: .9rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 8px
}

.breakdown-card .breakdown-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px
}

.breakdown-card .meta-tag {
  font-size: .68rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--bg-page);
  color: var(--text-muted);
  border: 1px solid var(--border)
}

.breakdown-card p {
  font-size: .86rem;
  color: var(--text-secondary);
  margin-bottom: 8px
}

.breakdown-card .breakdown-detail {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border)
}

.breakdown-card .breakdown-detail strong {
  display: block;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 4px
}

.breakdown-card .breakdown-detail ul {
  margin: 4px 0 10px;
  padding-left: 18px;
  font-size: .84rem
}

.breakdown-card .breakdown-detail li {
  margin-bottom: 3px
}

/* ══════════════════════════════════════
   GRIDS
   ══════════════════════════════════════ */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px
}

/* ══════════════════════════════════════
   TABLES — Clean, soft, scannable
   ══════════════════════════════════════ */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 16px;
  font-size: .82rem
}

thead th {
  background: #f1f5f9;
  color: var(--text-primary);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 2px solid var(--border)
}

thead th:first-child {
  border-radius: var(--radius-sm) 0 0 0
}

thead th:last-child {
  border-radius: 0 var(--radius-sm) 0 0
}

tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-secondary)
}

tbody tr {
  transition: background .15s
}

tbody tr:hover {
  background: var(--teal-glow)
}

tbody tr:nth-child(even) {
  background: #fafbfc
}

tbody tr:nth-child(even):hover {
  background: var(--teal-glow)
}

/* ═══ Schema Guide – Collapsible Field Groups ═══ */
.field-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  margin-top: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.field-group-header:hover {
  background: var(--teal-glow);
  border-color: var(--teal);
  box-shadow: var(--shadow-sm);
}

.field-group-header .group-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.field-group-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.field-group-header .field-count {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(100, 116, 139, 0.08);
  padding: 3px 10px;
  border-radius: 20px;
}

.field-group-header .toggle-icon {
  color: var(--text-muted);
  font-size: 0.8rem;
  transition: transform 0.3s ease;
}

.field-group-header.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.field-group-body {
  overflow: hidden;
  max-height: 2000px;
  transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
  opacity: 1;
  padding: 0 4px;
}

.field-group-body.collapsed {
  max-height: 0;
  opacity: 0;
  padding: 0;
}

.field-group-body table {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.field-group-body table td:first-child code {
  font-weight: 600;
  color: var(--teal);
  font-size: 0.82rem;
}

td code,
p code,
li code {
  font-family: 'Fira Code', monospace;
  font-size: .76rem;
  background: #eef2f7;
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--navy)
}

/* ══════════════════════════════════════
   CODE BLOCKS
   ══════════════════════════════════════ */
.code-block {
  position: relative;
  margin: 12px 0 18px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--code-border)
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  background: #1e293b;
  font-size: .68rem;
  font-weight: 600;
  color: var(--gray-light);
  border-bottom: 1px solid var(--code-border)
}

.code-header .lang-tag {
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--teal-light)
}

.copy-btn {
  background: none;
  border: 1px solid #334155;
  color: var(--gray-light);
  padding: 3px 9px;
  border-radius: 5px;
  font-size: .62rem;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit
}

.copy-btn:hover {
  border-color: var(--teal);
  color: var(--teal-light)
}

.copy-btn.copied {
  border-color: var(--green);
  color: var(--green)
}

.code-block pre {
  margin: 0;
  padding: 14px;
  background: var(--code-bg);
  overflow-x: auto;
  font-family: 'Fira Code', monospace;
  font-size: .76rem;
  line-height: 1.6;
  color: #e2e8f0;
  tab-size: 2
}

.kw {
  color: #ff7b72
}

.fn {
  color: #d2a8ff
}

.str {
  color: #a5d6ff
}

.cm {
  color: #8b949e;
  font-style: italic
}

.num {
  color: #79c0ff
}

.op {
  color: #ff7b72
}

.var {
  color: #ffa657
}

.bi {
  color: #79c0ff
}

/* ── COLLAPSIBLE ── */
details {
  margin: 6px 0
}

details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: .88rem;
  color: var(--navy);
  padding: 9px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 7px;
  user-select: none;
  transition: color .2s
}

details summary:hover {
  color: var(--teal)
}

details summary::before {
  content: '\f054';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: .58rem;
  color: var(--teal);
  transition: transform .25s;
  width: 14px;
  text-align: center
}

details[open] summary::before {
  transform: rotate(90deg)
}

details .detail-content {
  padding: 2px 0 10px 22px
}

/* ══════════════════════════════════════
   ARCHITECTURE DIAGRAM
   ══════════════════════════════════════ */
.arch-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin: 20px 0 28px
}

.arch-box {
  padding: 12px 24px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: .82rem;
  text-align: center;
  min-width: 200px;
  position: relative;
  color: var(--white);
  transition: transform .3s, box-shadow .3s
}

.arch-box:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-md)
}

.arch-box.default {
  background: linear-gradient(135deg, var(--navy), var(--navy-light))
}

.arch-box.qa {
  background: linear-gradient(135deg, var(--teal), #0f766e)
}

.arch-box.muni {
  background: linear-gradient(135deg, var(--accent), #2563eb)
}

.arch-box small {
  display: block;
  font-weight: 400;
  font-size: .68rem;
  opacity: .85;
  margin-top: 2px
}

.arch-arrow {
  width: 2px;
  height: 22px;
  background: linear-gradient(to bottom, var(--teal), var(--accent));
  position: relative;
  animation: arrowPulse 2.5s ease-in-out infinite
}

@keyframes arrowPulse {

  0%,
  100% {
    opacity: .4
  }

  50% {
    opacity: 1
  }
}

.arch-arrow::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--accent)
}

.arch-arrow-label {
  font-size: .64rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 1px 0
}

.muni-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center
}

.muni-row .arch-box {
  min-width: 105px;
  padding: 9px 12px;
  font-size: .74rem
}

/* ══════════════════════════════════════
   PIPELINE
   ══════════════════════════════════════ */
.pipeline {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 16px 0 24px;
  overflow-x: auto;
  padding-bottom: 4px
}

.pipeline-step {
  flex-shrink: 0;
  padding: 11px 16px;
  border-radius: var(--radius);
  text-align: center;
  min-width: 110px;
  font-size: .76rem;
  font-weight: 600;
  color: var(--white);
  position: relative;
  transition: transform .3s, box-shadow .3s;
  cursor: default
}

.pipeline-step:hover {
  transform: scale(1.04);
  box-shadow: var(--shadow-md)
}

.pipeline-step small {
  display: block;
  font-weight: 400;
  font-size: .64rem;
  opacity: .85;
  margin-top: 2px
}

.pipeline-step.s1 {
  background: linear-gradient(135deg, var(--indigo), #4f46e5)
}

.pipeline-step.s2 {
  background: linear-gradient(135deg, var(--teal), #0f766e)
}

.pipeline-step.s3 {
  background: linear-gradient(135deg, var(--purple), #7c3aed)
}

.pipeline-step.s4 {
  background: linear-gradient(135deg, var(--accent), #2563eb)
}

.pipeline-step.s5 {
  background: linear-gradient(135deg, var(--pink), #db2777)
}

.pipeline-arrow {
  flex-shrink: 0;
  width: 28px;
  height: 2px;
  position: relative;
  overflow: visible
}

.pipeline-arrow::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--border);
  border-radius: 2px
}

.pipeline-arrow::after {
  content: '';
  position: absolute;
  right: -3px;
  top: 50%;
  transform: translateY(-50%);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid var(--gray-light)
}

.pipeline-arrow .dot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal-light);
  transform: translateY(-50%);
  animation: dotTravel 2s ease-in-out infinite
}

@keyframes dotTravel {
  0% {
    left: 0;
    opacity: 0
  }

  10% {
    opacity: 1
  }

  90% {
    opacity: 1
  }

  100% {
    left: calc(100% - 6px);
    opacity: 0
  }
}

/* ══════════════════════════════════════
   TABS
   ══════════════════════════════════════ */
.tab-bar {
  display: flex;
  gap: 2px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 4px 4px 0;
  overflow-x: auto
}

.tab-btn {
  padding: 9px 16px;
  font-size: .76rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: all .2s;
  white-space: nowrap;
  font-family: inherit
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--white)
}

.tab-btn.active {
  background: var(--white);
  color: var(--navy);
  box-shadow: var(--shadow-xs)
}

.tab-content {
  display: none;
  animation: tabIn .3s ease-out
}

.tab-content.active {
  display: block
}

@keyframes tabIn {
  from {
    opacity: 0;
    transform: translateY(6px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

/* ══════════════════════════════════════
   ALERTS
   ══════════════════════════════════════ */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: .84rem;
  margin: 12px 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-left: 4px solid;
  line-height: 1.7
}

.alert i {
  margin-top: 3px;
  flex-shrink: 0
}

.alert.info {
  background: rgba(59, 130, 246, .05);
  border-left-color: var(--accent);
  color: #1e40af
}

.alert.warning {
  background: rgba(245, 158, 11, .05);
  border-left-color: var(--amber);
  color: #92400e
}

.alert.success {
  background: rgba(34, 197, 94, .05);
  border-left-color: var(--green);
  color: #166534
}

.alert.danger {
  background: rgba(239, 68, 68, .05);
  border-left-color: var(--red);
  color: #991b1b
}

/* ── SEPARATORS ── */
.rule-separator {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 28px 0 0
}

.section-label {
  display: flex;
  align-items: center;
  gap: 8px
}

.section-label i {
  opacity: .7
}

/* ══════════════════════════════════════
   BACK TO TOP
   ══════════════════════════════════════ */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--white);
  color: var(--teal);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: .88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(10px);
  transition: all .3s;
  z-index: 99;
  box-shadow: var(--shadow-sm)
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0)
}

.back-to-top:hover {
  background: var(--teal);
  color: var(--white);
  border-color: var(--teal);
  box-shadow: var(--shadow-md)
}

/* ══════════════════════════════════════
   FOOTER
   ══════════════════════════════════════ */
.site-footer {
  background: var(--white);
  color: var(--text-muted);
  text-align: center;
  padding: 28px 24px;
  border-top: 1px solid var(--border)
}

.site-footer img {
  width: 70px;
  margin-bottom: 10px;
  opacity: .7
}

.site-footer p {
  font-size: .82rem;
  color: var(--text-secondary);
  margin-bottom: 3px
}

.site-footer .sub {
  font-size: .72rem;
  color: var(--text-muted)
}

/* ══════════════════════════════════════
   INTERACTIVE CODE SECTIONS
   ══════════════════════════════════════ */
.code-section {
  position: relative;
  transition: background .2s;
  border-radius: 4px;
  cursor: pointer
}

.code-section:hover {
  background: rgba(13, 148, 136, .08)
}

.code-section.active {
  background: rgba(13, 148, 136, .12)
}

.code-section::before {
  content: attr(data-label);
  position: absolute;
  left: -2px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--teal);
  border-radius: 3px;
  opacity: 0;
  transition: opacity .2s
}

.code-section:hover::before,
.code-section.active::before {
  opacity: 1
}

.section-popup {
  position: fixed;
  z-index: 150;
  width: 340px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s, transform .2s;
  border-left: 4px solid var(--teal)
}

.section-popup.visible {
  opacity: 1;
  transform: translateY(0)
}

.section-popup h4 {
  font-family: 'Poppins', sans-serif;
  font-size: .88rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px
}

.section-popup h4 .popup-num {
  font-size: .62rem;
  font-weight: 700;
  background: var(--teal);
  color: var(--white);
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0
}

.section-popup .popup-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px
}

.section-popup .popup-tag {
  font-size: .66rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--bg-page);
  color: var(--text-muted);
  border: 1px solid var(--border)
}

.section-popup p {
  font-size: .82rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 4px
}

.section-popup .popup-maint {
  font-size: .76rem;
  color: var(--text-muted);
  font-style: italic
}

.section-popup.popup-code-mode {
  width: auto;
  max-width: 420px;
  min-width: 280px
}

.section-popup .popup-code-snippet {
  font-family: 'Fira Code', monospace;
  font-size: .72rem;
  line-height: 1.5;
  background: var(--code-bg);
  color: #e6edf3;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--code-border)
}

.breakdown-code-reveal {
  display: none;
  margin-top: 8px;
  margin-bottom: 16px;
  padding: 14px 18px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 4px solid var(--teal);
  box-shadow: var(--shadow-sm);
  overflow: hidden
}

.breakdown-code-reveal.visible {
  display: block;
  animation: revealIn .25s ease-out
}

.breakdown-code-reveal pre {
  font-family: 'Fira Code', monospace;
  font-size: .72rem;
  line-height: 1.5;
  color: #e6edf3;
  margin: 0;
  padding: 12px;
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--code-border);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto
}

@keyframes revealIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

.breakdown-card {
  transition: all .3s cubic-bezier(.22, 1, .36, 1);
  cursor: pointer
}

.breakdown-card.highlight {
  box-shadow: 0 0 0 2px var(--teal), var(--shadow-md);
  transform: translateY(-2px)
}

/* ── DOC SECTIONS ── */
.doc-section {
  margin-top: 8px
}

.doc-section .doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 8px;
  font-size: .8rem;
  color: var(--text-muted)
}

.doc-section .doc-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-page);
  border: 1px solid var(--border)
}

.doc-toggle {
  margin-top: 8px;
  font-size: .74rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--teal);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0
}

.doc-toggle i {
  font-size: .7rem;
  transition: transform .2s
}

.doc-toggle[aria-expanded="true"] i {
  transform: rotate(90deg)
}

.doc-body {
  margin-top: 8px
}

.doc-body.collapsed {
  display: none
}

/* ── DEPENDENCY CHIPS ── */
.dependency-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px
}

.dependency-chip {
  font-size: .7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-page);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border)
}

.dependency-chip i {
  font-size: .66rem;
  opacity: .6
}

.dependency-chip a {
  text-decoration: none;
  color: inherit
}

.dependency-chip a:hover {
  color: var(--teal)
}

/* ══════════════════════════════════════
   MOBILE
   ══════════════════════════════════════ */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--navy);
  border: 1px solid var(--border);
  font-size: .88rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm)
}

@media(max-width:900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .3s;
    box-shadow: var(--shadow-lg)
  }

  .sidebar.open {
    transform: translateX(0)
  }

  .main {
    margin-left: 0
  }

  .mobile-toggle {
    display: flex
  }

  .hero,
  .page-header {
    padding: 40px 20px 28px
  }

  .hero h1,
  .page-header h1 {
    font-size: 1.45rem
  }

  .content-wrap {
    padding: 0 16px 40px
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr
  }

  .pipeline {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px
  }

  .pipeline-arrow {
    display: none
  }

  .tab-bar {
    overflow-x: auto
  }

  .detail-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px
  }

  .hero-card-inner {
    flex-direction: column;
  }

  .hero-graphic {
    width: 180px;
    margin: 0 auto;
  }

  .hero-wrapper {
    padding: 20px 16px 8px;
  }

  .hero-card {
    padding: 28px 24px 20px;
  }
}

@media print {

  .sidebar,
  .mobile-toggle,
  .back-to-top,
  #progress {
    display: none !important
  }

  .main {
    margin-left: 0
  }

  .hero,
  .page-header {
    padding: 24px
  }

  .code-block pre {
    white-space: pre-wrap;
    word-break: break-all
  }
}

/*  COLLAPSIBLE SOURCE CODE  */
.source-collapse {
  margin-top: 20px;
}

.source-collapse summary {
  cursor: pointer;
  list-style: none;
  font-family: 'Poppins', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--navy);
  padding-bottom: 8px;
  border-bottom: 3px solid var(--teal);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: color 0.2s;
  user-select: none;
}

.source-collapse summary:hover {
  color: var(--teal);
}

.source-collapse summary::-webkit-details-marker {
  display: none;
}

.source-collapse summary::before {
  content: '\f0da';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 1rem;
  color: var(--teal);
  transition: transform 0.2s;
}

.source-collapse[open] summary::before {
  transform: rotate(90deg);
}

.source-collapse[open] summary {
  border-bottom: 3px solid transparent;
}

.source-collapse .collapse-content {
  margin-top: 16px;
  animation: heroIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* 
   EDITOR MODE PROTOTYPE
    */
.editor-login-btn,
.editor-logout-btn {
  display: flex !important;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 600;
  padding: 10px 0;
  transition: color .2s;
  margin-top: auto;
  border-top: 1px solid var(--border-strong);
  padding-top: 16px;
}

.editor-logout-btn {
  margin-top: 10px;
  border-top: none;
  padding-top: 0;
}

.editor-login-btn:hover,
.editor-logout-btn:hover {
  color: var(--teal);
}

.editor-toggle-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-strong);
  font-size: .85rem;
  font-weight: 600;
  color: var(--navy);
}

.editor-toggle-container span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  margin: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}

input:checked+.slider {
  background-color: var(--teal);
}

input:checked+.slider:before {
  transform: translateX(20px);
}

.slider.round {
  border-radius: 24px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Editable elements */
.editor-mode-active .editable-node {
  outline: 2px dashed rgba(13, 148, 136, 0.4);
  outline-offset: 4px;
  border-radius: 4px;
  transition: outline-color .2s;
}

.editor-mode-active .editable-node:hover {
  outline-color: var(--teal);
  background: rgba(13, 148, 136, 0.03);
  cursor: text;
}

.editor-mode-active .editable-node:focus {
  outline: 2px solid var(--teal);
  background: var(--white);
  cursor: text;
}

/* Modal */
.editor-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.editor-modal.active {
  display: flex;
  animation: heroIn .3s;
}

.editor-modal-content {
  background: var(--white);
  padding: 32px;
  border-radius: var(--radius);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  font-family: 'Inter', sans-serif;
}

.editor-modal-content h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.4rem;
  color: var(--navy);
  margin-bottom: 8px;
}

.editor-modal-content p {
  font-size: .85rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.editor-modal-content input {
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  box-sizing: border-box;
}

.editor-modal-content input:focus {
  outline: 2px solid var(--teal);
  border-color: transparent;
}

.editor-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

.btn-cancel {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
}

.btn-cancel:hover {
  background: var(--border);
}

.btn-submit {
  background: var(--teal);
  color: white;
  border: none;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 20px;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
}

.btn-submit:hover {
  background: #0f766e;
}

.editor-modal-error {
  color: var(--red);
  font-size: .8rem;
  font-weight: 500;
  min-height: 20px;
}

/* Toast */
.editor-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e293b;
  color: white;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: .85rem;
  font-weight: 600;
  opacity: 0;
  transition: all .3s;
  z-index: 1000;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  font-family: 'Inter', sans-serif;
}

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

/* WYSIWYG Toolbar */
.editor-toolbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: 54px;
  background: #0f172a;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: heroIn 0.3s forwards;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-sep {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.15);
}

.editor-toolbar button {
  background: transparent;
  color: #cbd5e1;
  border: 1px solid transparent;
  padding: 6px 10px;
  border-radius: 4px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.editor-toolbar button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.editor-toolbar .btn-save {
  background: var(--teal);
  color: white;
  padding: 6px 14px;
  font-weight: 600;
}

.editor-toolbar .btn-save:hover {
  background: #0f766e;
}

.editor-toolbar .btn-danger {
  color: #f87171;
}

.editor-toolbar .btn-danger:hover {
  background: rgba(248, 113, 113, 0.15);
  color: #fca5a5;
}

/* Shift main down when toolbar active */
.editor-mode-active .main {
  padding-top: 54px;
}

/* Focus styles for active editing */
.editor-mode-active .editable-node.focused {
  outline: 2px solid var(--teal) !important;
  background: var(--white);
  cursor: text;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.1);
}

.new-node-flash {
  animation: flashGreen 1s forwards;
}

@keyframes flashGreen {
  0% {
    background: rgba(13, 148, 136, 0.2);
  }

  100% {
    background: transparent;
  }
}

/* Contextual Toolbar Button Adjustments */
.editor-toolbar button span {
  margin-left: 4px;
}

.editor-toolbar button i {
  font-size: 0.9rem;
}

.editor-toolbar #btnContextAddHeader {
  display: flex;
}

/* Toggleable by JS */


/*  VISUAL BUILDER (CMS ACTION BAR)  */
[data-cms-html] {
  position: relative;
}

.editor-mode-active [data-cms-html] {
  outline: 2px dashed rgba(13, 148, 136, 0.2);
  outline-offset: 4px;
  border-radius: 8px;
  transition: outline 0.2s;
}

.editor-mode-active [data-cms-html]:hover {
  outline: 2px solid var(--teal);
}

.cms-action-bar {
  position: absolute;
  top: -16px;
  right: -16px;
  background: var(--navy);
  color: white;
  border-radius: 8px;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  white-space: nowrap;
}

.editor-mode-active [data-cms-html]:hover>.cms-action-bar,
.cms-action-bar:hover {
  display: flex !important;
}

.cms-action-bar button {
  background: transparent;
  color: #cbd5e1;
  border: none;
  border-radius: 4px;
  padding: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.cms-action-bar button:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--white);
}

.cms-action-bar button.btn-danger:hover {
  background: var(--red);
  color: white;
}

/* Link Editing Indication */
.editor-mode-active a[data-cms-href] {
  outline: 2px dashed rgba(75, 122, 140, 0.4);
  outline-offset: 2px;
  cursor: pointer !important;
  position: relative;
}

.editor-mode-active a[data-cms-href]:hover::after {
  content: "✏️ Edit Link";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
}

/*  SEARCH DROPDOWN  */
.search-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  max-height: 400px;
  overflow-y: auto;
  z-index: 9999;
  border: 1px solid var(--border-light);
}

.search-result-item {
  display: block;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-light);
  text-decoration: none;
  color: var(--text-main);
  transition: background 0.2s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: #f8fafc;
}

.search-result-title {
  font-weight: 600;
  color: var(--brand-navy);
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.search-result-title i {
  color: var(--teal);
  margin-right: 6px;
}

.search-result-snippet {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.search-result-snippet mark {
  background: var(--teal-glow);
  color: var(--teal);
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 600;
}

.search-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

/* --- LIGHTBOX (IMAGE ZOOM) --- */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  backdrop-filter: blur(8px);
  cursor: zoom-out;
}

.lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lightbox-overlay.active img {
  transform: scale(1);
}

/* Add zoom cursor to all article images to indicate interactivity */
.content-wrap img {
  cursor: zoom-in;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.content-wrap img:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* --- Editor Mode Visuals --- */
.editor-mode-active .content-wrap img {
  cursor: pointer;
  border: 2px dashed transparent;
  transition: all 0.2s ease;
}

.editor-mode-active .content-wrap img:hover {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.1);
  opacity: 0.85;
}