@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=Source+Sans+3:wght@400;500;600&display=swap");

:root {
  color-scheme: light;
  --bg: #ededed;
  --panel: #f6f6f6;
  --text: #2b2b2b;
  --muted: #7a7a7a;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --accent: #2b2b2b;
  --accent-weak: rgba(0, 0, 0, 0.06);
  --error: #a23b31;
  --radius: 12px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
}

/* Mobile adaptations */
@media (max-width: 767px) {
  .app {
    grid-template-columns: 1fr;
  }

  .panel-left {
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 0 20px 20px;
  }

  .panel-divider {
    display: none;
  }

  .panel-right {
    padding: 0 20px 20px;
  }

  .left-hero {
    margin: 0 -20px 12px;
    padding: 16px 20px 16px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .brand-title {
    font-size: 22px;
  }

  .search-row {
    gap: 12px;
  }

  .pdf-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .pdf-actions {
    width: 100%;
    justify-content: space-between;
  }

  .pdf-highlight-bar {
    flex-direction: column;
    gap: 12px;
  }

  .highlight-query-form {
    width: 100%;
  }

  .highlight-query-form input {
    width: 100%;
    max-width: none;
  }

  /* Mobile touch targets */
  .btn-primary,
  .btn-text,
  .btn-icon,
  .toggle-btn,
  .doc-link {
    min-height: 44px;
    min-width: 44px;
  }

  /* Mobile navigation */
  .view-toggle {
    width: 100%;
  }

  .toggle-btn {
    flex: 1;
    min-width: 0;
  }

  /* Mobile PDF viewer */
  .pdf-body {
    padding: 0;
  }

  .pdf-pages {
    padding: 12px;
  }

  /* Mobile map */
  .map-shell {
    min-height: 300px;
  }

  /* Mobile bug report button */
  .bug-report-trigger {
    right: 12px;
    bottom: 12px;
    padding: 8px 12px;
    font-size: 10px;
  }

  /* Mobile consent banner */
  .consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 0;
  }

  /* Mobile search guide */
  .search-guide-steps {
    gap: 8px;
  }

  /* Mobile card layout */
  .card-title {
    font-size: 18px;
  }

  .rag-chat-msg-content {
    max-width: 96%;
  }

  .rag-chat-access-form {
    grid-template-columns: 1fr;
  }

  .rag-chat-access-submit {
    width: 100%;
  }

  /* Mobile input fields */
  input[type="text"],
  textarea,
  select {
    font-size: 14px;
    padding: 10px 8px;
  }

  /* Mobile error banner */
  .error-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  /* Mobile progress indicator */
  .progress {
    left: 20px;
    right: 20px;
  }

  /* Mobile panel transitions */
  .panel-left.is-collapsed {
    padding: 12px 20px;
  }

  /* Mobile history view */
  .history-dock {
    margin: 0 20px;
  }

  /* Mobile map legal */
  .map-legal {
    padding: 8px 20px 16px;
  }

  /* Touch-specific improvements for mobile */
  @media (hover: none) and (pointer: coarse) {
    /* Larger touch targets for mobile */
    .btn-primary,
    .btn-text,
    .btn-icon,
    .toggle-btn,
    .scenario-menu-option,
    .doc-link {
      min-height: 48px;
      min-width: 48px;
    }

    /* Better spacing for touch */

    /* Larger form inputs for touch */
    input[type="text"],
    textarea,
    select {
      min-height: 48px;
    }

    /* Prevent double-tap zoom on form elements */
    input,
    textarea,
    select,
    button {
      touch-action: manipulation;
    }

    /* Better scroll behavior */
    .panel-left,
    .pdf-body,
    .history-list {
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
    }

    /* Prevent accidental taps during scrolling */
    .panel-divider {
      touch-action: none;
    }
  }

  /* Mobile-specific hover states */
  @media (hover: hover) {
    /* Keep hover effects for desktop */
    .btn-primary:hover,
    .btn-text:hover,
    .doc-link:hover {
      background: rgba(0, 0, 0, 0.04);
    }
  }

  /* Mobile landscape orientation adjustments */
  @media (max-width: 767px) and (orientation: landscape) {
    .app {
      max-height: 100vh;
    }

    .panel-left {
      padding: 0 16px 16px;
    }

    .panel-right {
      padding: 0 16px 16px;
    }

    .left-hero {
      margin: 0 -16px 12px;
      padding: 12px 16px;
    }

    /* More compact layout in landscape */
    .brand-title {
      font-size: 20px;
    }

    .search-row {
      gap: 8px;
    }

    .btn-primary {
      font-size: 11px;
      padding: 10px 16px;
    }

    /* Adjust PDF viewer for landscape */
    .pdf-pages {
      padding: 8px;
    }

    .map-shell {
      min-height: 240px;
    }
  }

  /* Mobile iOS specific fixes */
  @supports (-webkit-touch-callout: none) {
    /* Fix for iOS position:fixed issues */
    .consent-banner {
      -webkit-backdrop-filter: blur(10px);
      backdrop-filter: blur(10px);
    }

    /* Prevent text size adjustment */
    html {
      -webkit-text-size-adjust: 100%;
    }

    /* Smooth scrolling */
    html {
      scroll-behavior: smooth;
    }
  }

  /* Mobile Android specific fixes */
  @media (max-width: 767px) and (-webkit-min-device-pixel-ratio: 0) {
    /* Prevent overscroll glow */
    body {
      overscroll-behavior-y: none;
    }

    /* Better font rendering */
    body {
      -webkit-font-smoothing: antialiased;
      text-rendering: optimizeLegibility;
    }
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

body {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.035'/></svg>");
  opacity: 0.35;
  mix-blend-mode: multiply;
}

.app {
  position: relative;
  display: grid;
  grid-template-columns: var(--left-width, 2fr) 10px 1fr;
  height: 100vh;
  width: 100%;
  margin: 0;
  border-radius: 0;
  border: none;
  background: var(--panel);
}

.panel {
  padding: 34px 44px;
  background: transparent;
}

.panel-left {
  position: relative;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  overscroll-behavior: contain;
  overflow-y: auto;
  background-color: var(--panel);
  padding: 0 44px 34px;
}


.panel-left::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='64' height='64'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='1' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/><feComponentTransfer><feFuncR type='discrete' tableValues='0.85 1'/><feFuncG type='discrete' tableValues='0.85 1'/><feFuncB type='discrete' tableValues='0.85 1'/></feComponentTransfer></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='1'/></svg>");
  background-size: 0.8px 0.8px;
  image-rendering: pixelated;
  opacity: 0.25;
  mix-blend-mode: normal;
}

.panel-divider {
  cursor: col-resize;
  background: transparent;
  position: relative;
}

.panel-divider::before {
  content: "";
  position: absolute;
  inset: 0 4px;
  background: var(--line);
}

.panel-divider.active::before {
  background: var(--line-strong);
}

.panel-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overscroll-behavior: contain;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.right-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 14px 28px 0;
}

.history-dock {
  border: 1px solid var(--line);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  margin: 0 28px;
}

.history-view {
  gap: 16px;
}

.history-view .history-dock {
  flex: 1;
  max-height: none;
  margin: 0;
}

.history-title {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-item button {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 8px 6px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.history-item button:hover {
  background: var(--accent-weak);
}

.history-address {
  font-size: 13px;
  color: var(--text);
}

.history-egrid {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 12px 2px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.history-empty[hidden] {
  display: none;
}

.history-empty .empty-icon {
  opacity: 0.35;
  margin-bottom: 2px;
}

.history-empty .empty-hint {
  font-size: 11px;
  opacity: 0.6;
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.toggle-btn {
  border: none;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 4px 10px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s ease;
}

.toggle-btn:last-child {
  border-right: none;
  padding-right: 0;
}

.toggle-btn:first-child {
  padding-left: 0;
}

.toggle-btn:not(.active):hover,
.toggle-btn:not(.active):focus-visible {
  color: var(--text);
}

.toggle-btn.active {
  color: var(--text);
  font-weight: 600;
}

.right-view {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.right-view[hidden] {
  display: none !important;
}


.map-status {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  padding: 0 28px 12px;
}


.bauzone-line {
  display: flex;
  gap: 6px;
  align-items: baseline;
}

.bauzone-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.map-shell {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--line);
  background: #fff;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
  position: relative;
}

/* Highlighted parcel polygon — uses --error from the design tokens; the
   colour and opacity are set inline by applyParcelHighlight in app.js. */
#map .parcel-highlight {
  pointer-events: none;
}

/* Map double-click search popup */
.map-search-popup {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 0;
  min-width: 160px;
}

.map-search-popup-coords {
  font-size: 11px;
  color: var(--muted, #888);
  font-variant-numeric: tabular-nums;
}

.map-search-popup-btn {
  background: var(--accent, #2563eb);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: background 0.15s;
}

.map-search-popup-btn:hover {
  background: var(--accent-hover, #1d4ed8);
}

.map-search-popup-hint {
  font-size: 10px;
  color: var(--muted, #aaa);
  line-height: 1.3;
}

/* Map pin jump control */
.leaflet-map-pin-jump {
  margin-top: 42px;
}

.map-pin-jump-btn {
  width: 34px;
  height: 34px;
  border: 1px solid #cfcfcf;
  background: #fff;
  color: #2d2d2d;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  padding: 0;
}

.map-pin-jump-btn:hover:not(:disabled) {
  background: #f5f5f5;
}

.map-pin-jump-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

#mapView {
  position: relative;
}

.map-legal {
  font-size: 11px;
  color: var(--muted);
  display: grid;
  gap: 4px;
  padding: 12px 28px 24px;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(246, 246, 246, 0) 0%, rgba(246, 246, 246, 0.92) 60%);
}

.map-disclaimer {
  font-size: 11px;
  color: var(--text);
}

.dwg-view {
  padding: 14px 18px 20px;
  gap: 0;
}

.dwg-summary {
  font-size: 12px;
  line-height: 1.45;
  color: rgba(201, 212, 235, 0.74);
}

.dwg-shell {
  flex: 1;
  min-height: 0;
  display: flex;
}

.dwg-preview-panel {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  background:
    radial-gradient(circle at top left, rgba(69, 120, 226, 0.16), transparent 28%),
    linear-gradient(180deg, #151c29 0%, #101722 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 18px 44px rgba(8, 12, 19, 0.28);
  color: #eef3ff;
  overflow: hidden;
}

.dwg-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dwg-preview-header .pdf-title {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: #f5f7ff;
  font-size: 17px;
  line-height: 1.2;
  flex-wrap: wrap;
}

.dwg-heading {
  display: flex;
  align-items: center;
  min-width: 0;
}

.dwg-title-primary {
  font-weight: 700;
  color: #f7f9ff;
}

.dwg-title-secondary {
  font-weight: 500;
  color: rgba(211, 220, 236, 0.78);
}

.dwg-preview-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.dwg-preview-modes {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(8, 12, 19, 0.36);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.dwg-preview-mode {
  min-height: 30px;
  padding: 0 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: rgba(201, 212, 235, 0.76);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.dwg-preview-mode:hover,
.dwg-preview-mode:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  color: #f4f7ff;
  outline: none;
}

.dwg-preview-mode.is-active {
  background: #eef3ff;
  color: #101826;
  box-shadow: 0 8px 18px rgba(10, 14, 20, 0.22);
}

.dwg-preview-toolbar #dwg-download {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #eef3ff;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.dwg-preview-toolbar #dwg-download:hover,
.dwg-preview-toolbar #dwg-download:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  outline: none;
}

.dwg-preview-body {
  position: relative;
  min-height: 0;
  height: 100%;
}

.dwg-preview-layout {
  position: relative;
  min-height: 100%;
  height: 100%;
}

.dwg-preview-canvas {
  position: relative;
  min-width: 0;
  height: 100%;
  min-height: 580px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.05), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, #101722 0%, #0d131d 100%);
}

.dwg-preview-canvas::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.16;
  pointer-events: none;
  z-index: 0;
}

.dwg-map-canvas {
  position: absolute;
  inset: 0;
  z-index: 10;
}

.dwg-map-canvas[hidden] {
  display: none !important;
}

.dwg-map-canvas.leaflet-container {
  background: transparent;
  font-family: inherit;
}

.dwg-legend-panel {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 42;
  min-height: 0;
  overflow: visible;
  border: none;
  background: transparent;
  pointer-events: none;
}

.dwg-legend-card {
  display: grid;
  gap: 8px;
  padding: 0;
  justify-items: start;
}

.dwg-legend-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(163, 176, 203, 0.62);
}

.dwg-legend-status {
  font-size: 12px;
  font-weight: 600;
  color: rgba(233, 239, 248, 0.84);
  text-shadow: 0 2px 10px rgba(7, 10, 16, 0.36);
}

.dwg-legend-body {
  display: block;
  pointer-events: auto;
}

.dwg-legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 0 0 1px rgba(10, 14, 20, 0.2);
}

.dwg-legend-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  pointer-events: auto;
}

.dwg-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(237, 242, 250, 0.9);
  white-space: nowrap;
}

.dwg-legend-chip.is-active {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
}

.dwg-legend-chip-label {
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.dwg-legend-chip-count {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(221, 228, 239, 0.86);
  font-size: 11px;
  line-height: 1;
}

#dwg-preview-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: none;
  display: none;
  background: #0f1623;
  z-index: 20;
}

.dwg-preview-body .empty-state {
  position: absolute;
  inset: 0;
  min-height: 0;
  z-index: 30;
  background:
    linear-gradient(180deg, rgba(12, 17, 25, 0.46), rgba(12, 17, 25, 0.82)),
    linear-gradient(180deg, #121a27 0%, #0f1622 100%);
  color: #eef3ff;
}

.dwg-preview-body .empty-text {
  max-width: 360px;
  color: rgba(229, 236, 249, 0.84);
}

.dwg-preview-body .pdf-loading {
  position: absolute;
  inset: 0;
  z-index: 35;
  background: rgba(10, 14, 20, 0.48);
  backdrop-filter: blur(5px);
}

.dwg-preview-body .pdf-loading .loading-text {
  color: #eef3ff;
}

.dwg-map-canvas .leaflet-control-zoom {
  margin: 18px 0 0 18px;
}

.dwg-map-canvas .leaflet-bar {
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 14px 30px rgba(7, 10, 16, 0.24);
}

.dwg-map-canvas .leaflet-control-zoom a {
  width: 34px;
  height: 34px;
  line-height: 34px;
  background: rgba(13, 17, 26, 0.9);
  color: #f3f6ff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dwg-map-canvas .leaflet-control-zoom a:hover,
.dwg-map-canvas .leaflet-control-zoom a:focus-visible {
  background: rgba(36, 48, 70, 0.94);
  color: #ffffff;
}

.dwg-map-canvas .leaflet-pane svg path,
.dwg-map-canvas .leaflet-pane canvas {
  transition: opacity 0.12s ease, fill-opacity 0.12s ease, stroke-width 0.12s ease;
}

.dwg-map-tooltip {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(8, 12, 19, 0.92);
  color: #eef3ff;
  box-shadow: 0 12px 26px rgba(6, 10, 16, 0.26);
}

.dwg-map-tooltip::before {
  border-top-color: rgba(8, 12, 19, 0.92);
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
}

.left-hero {
  background-color: #e1e1e1;
  margin: 0 -44px 12px;
  padding: 20px 44px 20px;
  border-radius: 0;
  position: sticky;
  top: 0;
  z-index: 2;
  transform: translateY(var(--hero-slide, 0px));
  transition: padding 0.2s ease, box-shadow 0.2s ease, transform 0.1s linear;
}

.panel-left.is-collapsed .left-hero {
  padding: 12px 44px;
  top: 0;
  transform: translateY(0);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.panel-left.is-collapsed .header {
  display: none;
}

.panel-left.is-collapsed .search {
  margin-top: 0;
}

.panel-left.is-collapsed .search-row {
  align-items: center;
}


.brand-title {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.brand-subtitle {
  color: #3a3a3a;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

select,
input {
  font-family: inherit;
  font-size: 15px;
  border: none;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 10px 4px;
  background: transparent;
  color: var(--text);
}

#lang-select {
  font-size: 12px;
  padding: 6px 4px;
  width: 64px;
}

select:focus,
input:focus {
  outline: none;
  border-bottom-width: 2px;
}

input {
  flex: 1;
}

.search-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}


.search-split {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
}

.search-split .btn-primary {
  border: none;
  border-radius: 0;
  background: transparent;
  font-size: 10px;
}


.search-split .btn-primary:hover,
.search-split .btn-primary:focus-visible {
  background: rgba(31, 29, 26, 0.06);
}

.search-split .btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.scenario-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(246, 246, 246, 0.98);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  z-index: 10;
}

.scenario-menu[hidden] {
  display: none;
}

.scenario-menu-option {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.scenario-menu-option:hover,
.scenario-menu-option:focus-visible {
  background: rgba(0, 0, 0, 0.04);
}

.scenario-menu-option.active {
  border-color: var(--line-strong);
  background: rgba(0, 0, 0, 0.05);
}

.btn-primary {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  padding: 10px 22px;
  border-radius: 999px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
}

.btn-primary:hover {
  background: rgba(31, 29, 26, 0.06);
  border-color: rgba(31, 29, 26, 0.3);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-text {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}

.btn-text:hover,
.btn-text:focus-visible {
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.02);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-icon:hover,
.btn-icon:focus-visible {
  background: rgba(0, 0, 0, 0.06);
  border-color: var(--line-strong);
}

.btn-icon[aria-pressed="true"] {
  background: var(--accent-weak);
  border-color: rgba(0, 0, 0, 0.2);
  color: var(--text);
}

.btn-icon.btn-subtle {
  border-color: transparent;
  background: rgba(0, 0, 0, 0.03);
  opacity: 0.75;
}

.btn-icon.btn-subtle:hover,
.btn-icon.btn-subtle:focus-visible {
  opacity: 1;
  border-color: var(--line);
}

.btn-icon.btn-subtle:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.progress {
  position: absolute;
  left: 44px;
  right: 44px;
  top: 50%;
  transform: translateY(-50%);
  transition: opacity 0.3s ease, height 0.3s ease;
  opacity: 0;
  height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 10px;
  row-gap: 4px;
  align-items: center;
}

.progress-quote {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
  letter-spacing: 0.02em;
  grid-column: 1 / -1;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(31, 29, 26, 0.1);
  border-radius: 999px;
  overflow: hidden;
  grid-column: 1 / 2;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.28s ease-out;
}

.progress-meta {
  margin-top: 0;
  display: flex;
  justify-content: flex-end;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  grid-column: 2 / 3;
  min-width: 40px;
}

.progress-milestones {
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  grid-column: 1 / -1;
}

.progress-milestone {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  opacity: 0.6;
}

.progress-milestone-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.22);
  background: transparent;
}

.progress-milestone-label {
  font-size: 10px;
  color: var(--muted);
}

.progress-milestone.is-active {
  opacity: 1;
}

.progress-milestone.is-active .progress-milestone-dot {
  border-color: rgba(27, 95, 255, 0.7);
  background: rgba(27, 95, 255, 0.8);
}

.progress-milestone.is-active .progress-milestone-label {
  color: #184fbf;
}

.progress-milestone.is-complete {
  opacity: 0.92;
}

.progress-milestone.is-complete .progress-milestone-dot {
  border-color: rgba(33, 133, 84, 0.42);
  background: rgba(33, 133, 84, 0.7);
}

.progress-milestone.is-complete .progress-milestone-label {
  color: rgba(33, 133, 84, 0.92);
}

.error-banner {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(162, 59, 49, 0.3);
  border-radius: 12px;
  background: rgba(162, 59, 49, 0.08);
  color: var(--error);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.error-banner[hidden] {
  display: none;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
  position: relative;
  flex: 1;
}


.search-guide {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.52);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-guide-intro {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.search-guide-steps {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
}

.search-guide-step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.search-guide-step-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 1px;
}

.search-guide-step-body {
  min-width: 0;
}

.search-guide-step-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text);
}

.search-guide-step-detail {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  margin-top: 1px;
}

.egrid-badge {
  align-self: flex-end;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  padding: 6px 10px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.egrid-label {
  color: var(--muted);
}

.egrid-value {
  color: var(--text);
  font-weight: 600;
}

.card {
  border-top: 1px solid var(--line);
  border-bottom: none;
  border-radius: 0;
  background: transparent;
  padding: 20px 0;
  box-shadow: none;
}

.card.card--framed {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-bg, #fff);
  padding: 0;
  margin: 16px 0;
}

.card-inline-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.docs-download-all-btn {
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 5px 7px;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.docs-download-all-btn:hover,
.docs-download-all-btn:focus-visible {
  color: var(--text);
  border-color: var(--text);
}

.docs-download-all-btn--loading {
  opacity: 0.5;
  pointer-events: none;
}

.card-body {
  padding: 16px 16px 12px;
}

.card:last-child {
  border-bottom: 1px solid var(--line);
}

.card:has(+ .rag-chat-card) {
  border-bottom: none;
}

.restrictions-summary-card {
  border-top: none;
}


.restrictions-card {
  border-left: none;
  border-right: none;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
}

.card--framed.restrictions-card {
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0;
}

.restrictions-card.restrictions-summary-card {
  border-top: none;
}

.restrictions-card--no-bottom {
  border-bottom: none;
}


.card-title {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 12px;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.card-header-row .card-title {
  margin-bottom: 0;
}

.card-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}


.card-title-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  gap: 10px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.card-title-toggle:hover,
.card-title-toggle:focus-visible {
  background: rgba(0, 0, 0, 0.03);
}

.card-title-toggle:focus {
  outline: 1px solid var(--line-strong);
  outline-offset: 4px;
}

.card-title-indicator {
  font-size: 14px;
  transition: transform 0.2s ease;
}

.card-collapsible.open .card-title-indicator {
  transform: rotate(180deg);
}

.card-subtitle {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: -6px;
  margin-bottom: 12px;
}

.rag-chat-card {
  position: relative;
  border-top: none;
  padding-top: 14px;
  padding-bottom: 14px;
}

.rag-chat-content {
  position: relative;
}

.rag-chat-content--locked {
  min-height: 0;
}

.rag-chat-surface--locked {
  filter: blur(2px);
  opacity: 0.22;
  pointer-events: none;
  user-select: none;
}

.rag-chat-access-gate {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
}

.rag-chat-access-gate[hidden] {
  display: none !important;
}

.rag-chat-access-panel {
  width: min(320px, 100%);
  display: grid;
  gap: 10px;
}


.rag-chat-access-error {
  margin: 0;
  color: var(--error);
  font-size: 12px;
  line-height: 1.35;
}

.rag-chat-access-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.rag-chat-access-label {
  font-size: 12px;
  color: var(--muted);
}

.rag-chat-access-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-top: 0;
}

.rag-chat-access-input {
  min-width: 0;
  padding-right: 12px;
}

.rag-chat-access-submit {
  min-width: 96px;
}

.rag-chat-card .card-title {
  font-size: 18px;
  margin-bottom: 8px;
}

.rag-chat-header-row {
  margin-bottom: 8px;
}

.rag-chat-header-row .card-title {
  margin-bottom: 0;
}

.rag-chat-header-actions {
  gap: 6px;
}

.rag-chat-header-btn {
  width: 28px;
  height: 28px;
}

.rag-chat-length-trigger {
  position: relative;
  width: 28px;
  height: 28px;
}

.rag-chat-length-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}

.rag-chat-length-btn:focus-visible {
  outline: 2px solid rgba(27, 95, 255, 0.35);
  outline-offset: 1px;
}

.rag-chat-length-btn:hover,
.rag-chat-length-btn:focus-visible {
  border-color: var(--line-strong);
}

.rag-chat-length-btn:disabled {
  cursor: default;
  opacity: 0.65;
}

.rag-chat-length-icon {
  color: var(--muted);
}

.rag-chat-length-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rag-chat-length-btn:hover .rag-chat-length-icon,
.rag-chat-length-btn:focus-visible .rag-chat-length-icon {
  color: var(--text);
}

.rag-chat-length-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 230px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rag-chat-length-menu[hidden] {
  display: none;
}

.rag-chat-length-menu-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.rag-chat-length-menu-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.rag-chat-length-menu-option {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  font-size: 11px;
  line-height: 1.2;
  padding: 5px 6px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.rag-chat-length-menu-option:hover,
.rag-chat-length-menu-option:focus-visible {
  border-color: var(--line-strong);
  background: #ffffff;
}

.rag-chat-length-menu-option.active {
  border-color: var(--primary);
  background: #dde8ff;
  color: var(--primary);
  font-weight: 600;
}

.rag-chat-length-menu-hint {
  padding: 0 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.rag-chat-length-menu-divider {
  height: 1px;
  background: var(--line);
  margin: 2px 0;
}

.rag-chat-hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.rag-chat-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: none;
  overflow: visible;
}

.rag-chat-msg {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-width: 92%;
}

.rag-chat-msg--assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.rag-chat-msg--user {
  align-self: flex-end;
  align-items: flex-end;
  position: relative;
  padding-bottom: 6px;
}

.rag-chat-msg-role {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 2px;
}

.rag-chat-msg-content {
  font-size: 13px;
  line-height: 1.45;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.82);
  white-space: normal;
  overflow-wrap: anywhere;
}

.rag-chat-msg-content--copyable {
  position: relative;
  padding-right: 44px;
}

.rag-chat-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  cursor: pointer;
}

.rag-chat-copy-btn svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rag-chat-copy-btn:hover,
.rag-chat-copy-btn:focus-visible {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 1);
  outline: none;
}

.rag-chat-copy-btn.is-copied {
  border-color: rgba(27, 95, 255, 0.35);
  color: #1b5fff;
}

.rag-chat-paragraph {
  margin: 0;
}

.rag-chat-paragraph + .rag-chat-paragraph {
  margin-top: 10px;
}

.rag-chat-msg--assistant .rag-chat-msg-content {
  background: #fff;
  border-color: var(--line);
}

.rag-chat-msg--assistant .rag-chat-msg-content > :first-child {
  margin-top: 0;
}

.rag-chat-msg--assistant .rag-chat-msg-content > :last-child {
  margin-bottom: 0;
}

.rag-chat-msg--assistant .rag-chat-msg-content p,
.rag-chat-msg--assistant .rag-chat-msg-content ul,
.rag-chat-msg--assistant .rag-chat-msg-content ol,
.rag-chat-msg--assistant .rag-chat-msg-content pre,
.rag-chat-msg--assistant .rag-chat-msg-content blockquote {
  margin: 0;
}

.rag-chat-msg--assistant .rag-chat-msg-content p + p,
.rag-chat-msg--assistant .rag-chat-msg-content p + ul,
.rag-chat-msg--assistant .rag-chat-msg-content p + ol,
.rag-chat-msg--assistant .rag-chat-msg-content ul + p,
.rag-chat-msg--assistant .rag-chat-msg-content ol + p,
.rag-chat-msg--assistant .rag-chat-msg-content pre + p,
.rag-chat-msg--assistant .rag-chat-msg-content p + pre,
.rag-chat-msg--assistant .rag-chat-msg-content blockquote + p,
.rag-chat-msg--assistant .rag-chat-msg-content p + blockquote {
  margin-top: 10px;
}

.rag-chat-msg--assistant .rag-chat-msg-content ul,
.rag-chat-msg--assistant .rag-chat-msg-content ol {
  padding-left: 18px;
}

.rag-chat-msg--assistant .rag-chat-msg-content li + li {
  margin-top: 3px;
}

.rag-chat-msg--assistant .rag-chat-msg-content pre {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.04);
  white-space: pre;
}

.rag-chat-msg--assistant .rag-chat-msg-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 5px;
  padding: 1px 4px;
}

.rag-chat-msg--assistant .rag-chat-msg-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

.rag-chat-msg--assistant .rag-chat-msg-content blockquote {
  border-left: 3px solid var(--line-strong);
  padding-left: 9px;
  color: var(--muted);
}

.rag-chat-msg--assistant .rag-chat-msg-content a {
  color: #1b5fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.rag-chat-msg--assistant .rag-chat-msg-content h1,
.rag-chat-msg--assistant .rag-chat-msg-content h2,
.rag-chat-msg--assistant .rag-chat-msg-content h3,
.rag-chat-msg--assistant .rag-chat-msg-content h4,
.rag-chat-msg--assistant .rag-chat-msg-content h5,
.rag-chat-msg--assistant .rag-chat-msg-content h6 {
  margin: 0;
  line-height: 1.25;
  color: #142543;
  font-weight: 650;
}

.rag-chat-msg--assistant .rag-chat-msg-content h1 {
  font-size: 17px;
}

.rag-chat-msg--assistant .rag-chat-msg-content h2 {
  font-size: 15px;
}

.rag-chat-msg--assistant .rag-chat-msg-content h3,
.rag-chat-msg--assistant .rag-chat-msg-content h4,
.rag-chat-msg--assistant .rag-chat-msg-content h5,
.rag-chat-msg--assistant .rag-chat-msg-content h6 {
  font-size: 13px;
}

.rag-chat-msg--assistant .rag-chat-msg-content p + h1,
.rag-chat-msg--assistant .rag-chat-msg-content p + h2,
.rag-chat-msg--assistant .rag-chat-msg-content p + h3,
.rag-chat-msg--assistant .rag-chat-msg-content ul + h1,
.rag-chat-msg--assistant .rag-chat-msg-content ul + h2,
.rag-chat-msg--assistant .rag-chat-msg-content ul + h3,
.rag-chat-msg--assistant .rag-chat-msg-content ol + h1,
.rag-chat-msg--assistant .rag-chat-msg-content ol + h2,
.rag-chat-msg--assistant .rag-chat-msg-content ol + h3 {
  margin-top: 14px;
}

.rag-chat-msg--assistant .rag-chat-msg-content h1 + p,
.rag-chat-msg--assistant .rag-chat-msg-content h2 + p,
.rag-chat-msg--assistant .rag-chat-msg-content h3 + p,
.rag-chat-msg--assistant .rag-chat-msg-content h1 + ul,
.rag-chat-msg--assistant .rag-chat-msg-content h2 + ul,
.rag-chat-msg--assistant .rag-chat-msg-content h3 + ul {
  margin-top: 8px;
}

.rag-chat-answer-table-wrap {
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  background: #fff;
}

.rag-chat-answer-table {
  width: 100%;
  min-width: 520px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  line-height: 1.35;
  color: #223251;
}

.rag-chat-answer-table th,
.rag-chat-answer-table td {
  text-align: left;
  vertical-align: top;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.rag-chat-answer-table th {
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
  background: var(--accent-weak);
}

.rag-chat-answer-table td:first-child {
  font-weight: 600;
  color: var(--text);
}

.rag-chat-answer-table tbody tr:nth-child(2n) td {
  background: rgba(0, 0, 0, 0.015);
}

.rag-chat-answer-table tbody tr:last-child td {
  border-bottom: none;
}

.rag-chat-msg--user .rag-chat-msg-content {
  background: rgba(27, 95, 255, 0.08);
  border-color: rgba(27, 95, 255, 0.2);
  white-space: pre-wrap;
}

.rag-chat-msg-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 0 2px;
  line-height: 1.3;
}

.rag-chat-msg-meta {
  font-size: 11px;
  color: var(--muted);
  padding: 0 2px;
}

.rag-chat-msg--user .rag-chat-msg-meta {
  text-align: right;
}

.rag-chat-tech-host,
.rag-chat-status-technical {
  width: 100%;
}

.rag-chat-tech-timeline {
  margin-top: 6px;
}

.rag-chat-tech-timeline .rag-chat-thinking-step {
  padding-bottom: 8px;
}

.rag-chat-tech-timeline .rag-chat-thinking-step:last-child {
  padding-bottom: 2px;
}

.rag-chat-tech-step .rag-chat-thinking-step-dot {
  background: #22c55e;
}

.rag-chat-tech-step--context .rag-chat-thinking-step-dot {
  background: #1f4b88;
}

.rag-chat-tech-step--level-warning .rag-chat-thinking-step-dot {
  background: #f59e0b;
}

.rag-chat-tech-step--level-error .rag-chat-thinking-step-dot {
  background: #ef4444;
}

.rag-chat-tech-step-stage {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(27, 95, 255, 0.08);
  color: #1f4b88;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.2;
}

.rag-chat-tech-step-data {
  margin-top: 8px;
}

.rag-chat-tech-event-data {
  margin-left: 0;
}

.rag-chat-tech-panel {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  overflow: hidden;
}


.rag-chat-tech-event-data {
  margin: 4px 0 6px 15px;
  padding: 8px 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  line-height: 1.5;
  color: #c9d8f0;
  background: #1c2b3f;
  border-radius: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.rag-chat-status-technical {
  grid-row: 5;
  grid-column: 1 / -1;
  margin-top: 8px;
}

.rag-chat-question-favorite-overlay {
  position: absolute;
  right: 10px;
  bottom: 0;
  transform: translateY(42%);
  z-index: 1;
}

.rag-chat-question-favorite-btn {
  width: 18px;
  height: 18px;
}

/* Voting buttons for chat messages */
.rag-chat-vote {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  z-index: 1;
}

.rag-chat-vote-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.rag-chat-vote-btn:hover {
  background: var(--bg-hover);
  border-color: var(--line-strong);
}

.rag-chat-vote-btn svg {
  width: 14px;
  height: 14px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 2;
}

.rag-chat-vote-btn.active {
  background: var(--primary);
  border-color: var(--primary);
}

.rag-chat-vote-btn.active svg {
  stroke: white;
  fill: white;
}

.rag-chat-vote-btn.thumbs-up.active {
  background: #4CAF50;
  border-color: #4CAF50;
}

.rag-chat-vote-btn.thumbs-down.active {
  background: #F44336;
  border-color: #F44336;
}

.rag-chat-vote-btn.rag-chat-question-favorite-btn svg {
  width: 10px;
  height: 10px;
  fill: var(--muted);
  stroke: var(--muted);
}

.rag-chat-vote-btn.rag-chat-question-favorite-btn.active {
  background: #f1b52c;
  border-color: #f1b52c;
}

.rag-chat-vote-btn.rag-chat-question-favorite-btn.active svg {
  fill: #ffffff;
  stroke: #ffffff;
  opacity: 1;
}

/* Ensure assistant messages have relative positioning for absolute vote buttons */
.rag-chat-msg--assistant {
  position: relative;
}

/* Streaming cursor shown while the LLM is typing */
.rag-chat-msg-content--streaming .rag-chat-streaming-body::after {
  content: "▋";
  display: inline-block;
  animation: rag-blink 0.9s step-end infinite;
  margin-left: 1px;
  opacity: 0.7;
}

@keyframes rag-blink {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0; }
}

.rag-chat-entry-state {
  margin-top: 2px;
  padding-top: 10px;
}

.rag-chat-entry-state[data-mode="input"] .rag-chat-status {
  display: none !important;
}

.rag-chat-entry-state[data-mode="progress"] .rag-chat-form {
  display: none !important;
}

.rag-chat-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  margin-top: 0;
  padding-top: 0;
}

.rag-chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rag-chat-input-shell {
  position: relative;
  flex: 1;
  min-width: 0;
}

.rag-chat-input {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 98px 10px 12px;
  font-size: 13px;
  min-height: 40px;
}

.rag-chat-input:focus {
  outline: 1px solid var(--line-strong);
  outline-offset: 1px;
}

.rag-chat-select-triggers {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.rag-chat-preset-trigger,
.rag-chat-history-trigger,
.rag-chat-favorite-trigger {
  position: relative;
  width: 24px;
  height: 24px;
  border-left: 1px solid var(--line);
}

.rag-chat-preset,
.rag-chat-history-select,
.rag-chat-favorite-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.rag-chat-preset-icon,
.rag-chat-history-icon,
.rag-chat-favorite-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  pointer-events: none;
}

.rag-chat-preset-icon svg,
.rag-chat-history-icon svg,
.rag-chat-favorite-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rag-chat-preset:focus + .rag-chat-preset-icon,
.rag-chat-history-select:focus + .rag-chat-history-icon,
.rag-chat-favorite-select:focus + .rag-chat-favorite-icon {
  color: var(--text);
  outline: none;
}

.rag-chat-send {
  min-width: 84px;
  min-height: 40px;
  padding: 8px 14px;
}

.rag-chat-status {
  margin-top: 0;
  font-size: 12px;
  color: var(--muted);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  row-gap: 6px;
  align-items: center;
  padding: 6px 2px 0;
}

.rag-chat-status-header {
  grid-row: 2;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.rag-chat-status-cancel {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  min-width: 60px;
}

.rag-chat-status-cancel svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-right: 6px;
}

.rag-chat-status-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  grid-row: 4;
  grid-column: 2 / 3;
  margin-top: 0;
}

.rag-chat-status-cancel:hover,
.rag-chat-status-cancel:focus-visible {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.92);
  outline: none;
}

.rag-chat-status-cancel:disabled {
  opacity: 0.55;
  cursor: default;
}

.rag-chat-status-text {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.rag-chat-status-track {
  grid-row: 3;
  grid-column: 1 / -1;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.rag-chat-status-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(27, 95, 255, 0.38), rgba(27, 95, 255, 0.75));
  transition: width 0.22s ease;
}

.rag-chat-status-milestones {
  grid-row: 3;
  grid-column: 1 / 2;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.rag-chat-status-milestone {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  opacity: 0.6;
}

.rag-chat-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.22);
  background: transparent;
}

.rag-chat-status-label {
  font-size: 10px;
  color: var(--muted);
}

.rag-chat-status-milestone.is-active {
  opacity: 1;
}

.rag-chat-status-milestone.is-active .rag-chat-status-dot {
  border-color: rgba(27, 95, 255, 0.7);
  background: rgba(27, 95, 255, 0.8);
}

.rag-chat-status-milestone.is-active .rag-chat-status-label {
  color: #184fbf;
}

.rag-chat-status-milestone.is-complete {
  opacity: 0.9;
}

.rag-chat-status-milestone.is-complete .rag-chat-status-dot {
  border-color: rgba(33, 133, 84, 0.4);
  background: rgba(33, 133, 84, 0.65);
}

.rag-chat-status-milestone.is-complete .rag-chat-status-label {
  color: rgba(33, 133, 84, 0.92);
}

.rag-chat-status-technical {
  grid-row: 1;
  grid-column: 1 / -1;
  margin-top: 0;
}

/* Research Plan Section */
.rag-chat-research-plan {
  grid-row: 5;
  grid-column: 1 / -1;
  margin-top: 16px;
  padding: 12px;
  background: var(--background-alt);
  border-radius: 8px;
  border: 1px solid var(--line);
}

.rag-chat-research-plan-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rag-chat-research-plan-milestones {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rag-chat-research-plan-milestone {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.rag-chat-research-plan-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.22);
  background: transparent;
}

.rag-chat-research-plan-label {
  font-size: 12px;
  color: var(--muted);
}

.rag-chat-research-plan-milestone.is-active {
  opacity: 1;
  background: rgba(27, 95, 255, 0.1);
}

.rag-chat-research-plan-milestone.is-active .rag-chat-research-plan-dot {
  border-color: rgba(27, 95, 255, 0.7);
  background: rgba(27, 95, 255, 0.8);
}

.rag-chat-research-plan-milestone.is-active .rag-chat-research-plan-label {
  color: #184fbf;
  font-weight: 500;
}

.rag-chat-research-plan-milestone.is-complete {
  opacity: 1;
  background: rgba(33, 133, 84, 0.1);
}

.rag-chat-research-plan-milestone.is-complete .rag-chat-research-plan-dot {
  border-color: rgba(33, 133, 84, 0.4);
  background: rgba(33, 133, 84, 0.7);
}

.rag-chat-research-plan-milestone.is-complete .rag-chat-research-plan-label {
  color: rgba(33, 133, 84, 0.92);
  font-weight: 500;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

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

.row-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex: 0 0 180px;
}

.row-value {
  flex: 1;
  font-size: 14px;
}

.row-value a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

.row-value a:hover,
.row-value a:focus-visible {
  color: var(--text);
}

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

.list-item {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

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

/* ── Flat deduplicated docs list ────────────────────────────────── */
.docs-flat-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 0 8px;
}

.docs-flat-list .list-item {
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
}

.docs-flat-list .list-item:last-child {
  border-bottom: none;
}

/* Pinned ÖREB extract — always first row, visually distinct */
.docs-flat-pinned {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-strong) !important;
  margin-bottom: 0;
}

.docs-flat-pinned .doc-link {
  font-weight: 500;
}

/* Section header — groups documents by canonical type */
.docs-flat-section-header {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 18px 12px 5px;
  margin-bottom: 0;
}

.docs-flat-section-header:first-child,
.docs-flat-pinned + .docs-flat-section-header {
  padding-top: 10px;
}

/* Collapsible "Weitere Dokumente" section */
.docs-flat-section-toggle {
  cursor: pointer;
  user-select: none;
}

.docs-flat-section-toggle::before {
  content: "›";
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.15s ease;
  font-size: 11px;
}

.docs-flat-section-toggle[aria-expanded="true"]::before {
  transform: rotate(90deg);
}

.docs-flat-section-collapsible {
  display: none;
}

.docs-flat-section-collapsible[data-open="true"] {
  display: block;
}

/* Plan family bundle — uses same row grammar as documents */
.docs-flat-bundle-toggle {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
}

.docs-flat-bundle-toggle:hover {
  background: rgba(0, 0, 0, 0.025);
}

.docs-flat-bundle-primary {
  display: flex;
  align-items: center;
  gap: 0;
}

.docs-flat-bundle-chevron {
  display: none;
  font-size: 10px;
  color: rgba(0, 0, 0, 0.30);
  transition: transform 0.15s ease;
  flex-shrink: 0;
  width: 16px;
  line-height: 1;
}

.docs-flat-bundle-toggle[aria-expanded="true"] .docs-flat-bundle-chevron {
  transform: rotate(90deg);
}

.docs-flat-bundle-label {
  font-size: inherit;
  color: var(--muted);
  font-weight: 400;
  padding: 2px 6px;
}

.docs-flat-bundle-secondary {
  font-size: 12px;
  color: var(--muted);
  padding: 1px 6px 0;
}

.docs-flat-bundle-items {
  display: none;
}

.docs-flat-bundle-items[data-open="true"] {
  display: contents;
}

.docs-flat-bundle-items .list-item {
  padding-left: 12px !important;
}

.list-item--doc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.list-item--doc .doc-link {
  flex: 1;
  min-width: 0;
}

.policy-group-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.policy-group-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text);
  background: transparent;
  white-space: nowrap;
}

.policy-level-tag {
  text-transform: none;
}


.policy-group-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}

.policy-group-relevance {
  font-weight: 600;
}

.policy-group-relevance--high {
  border-color: rgba(21, 118, 61, 0.4);
  color: #1f6f3f;
  background: rgba(46, 160, 67, 0.1);
}

.policy-group-relevance--medium {
  border-color: rgba(191, 128, 0, 0.4);
  color: #8e5f00;
  background: rgba(245, 158, 11, 0.12);
}

.policy-group-relevance--low {
  border-color: rgba(188, 49, 49, 0.35);
  color: #9d2d2d;
  background: rgba(239, 68, 68, 0.1);
}

.policy-group-tag--high {
  border-width: 3px;
}

.policy-group-tag--medium {
  border-width: 2px;
}

.policy-group-tag--low {
  border-width: 1px;
}

.doc-link {
  background: none;
  border: none;
  padding: 2px 6px;
  color: var(--accent);
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.doc-link--authority {
  color: #1b5fff;
}

.doc-link--authority:hover,
.doc-link--authority:focus-visible {
  color: #0b47d0;
}

.authority-contact {
  margin-top: 4px;
  margin-left: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.authority-contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
}


.authority-contact-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.2);
}

.authority-contact-link:hover,
.authority-contact-link:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.doc-link--inline {
  padding: 2px 4px;
}

.rag-citation-link {
  color: #1b5fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.rag-citation-link:hover,
.rag-citation-link:focus-visible {
  color: #0b47d0;
}

/* Inline document-name citation links (pdf_id occurrences in answer text) */
.rag-docname-link {
  font-size: 0.82em;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  word-break: break-all;
  vertical-align: baseline;
}

.rag-citation-legend {
  margin-top: 10px;
  padding: 6px 0 2px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rag-citation-legend-heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.rag-citation-legend-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 4px 2px;
  cursor: pointer;
  text-align: left;
  font-size: 0.8em;
  color: var(--muted);
  line-height: 1.4;
  border-radius: 0;
  min-width: 0;
}

.rag-citation-legend-item:last-child {
  border-bottom: none;
}

.rag-citation-legend-item:hover {
  color: var(--text);
  background: transparent;
}

.rag-citation-legend-item--doc {
  font-weight: 600;
}


.rag-citation-legend-num {
  color: var(--text);
  font-weight: 600;
  flex-shrink: 0;
}

.rag-citation-legend-title {
  color: inherit;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}


.doc-link:hover,
.doc-link:focus-visible {
  background: rgba(0, 0, 0, 0.04);
}

.doc-link.is-selected {
  background: var(--accent-weak);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.doc-link[aria-busy="true"] {
  opacity: 0.6;
  cursor: wait;
}

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

.accordion-item {
  border: 1px solid var(--line);
  border-radius: 0;
  overflow: hidden;
  background: transparent;
}

.accordion-header {
  padding: 12px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.accordion-header:hover,
.accordion-header:focus-visible {
  background: rgba(0, 0, 0, 0.03);
}

.accordion-title {
  font-weight: 500;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
}

.accordion-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 8px 10px;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}

.accordion-legend-list {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 4px;
  align-content: flex-start;
  align-items: flex-end;
  justify-content: flex-end;
  justify-self: end;
  max-width: min(24rem, 34vw);
  min-width: 0;
}

@media (max-width: 960px) {
  .accordion-title-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .accordion-legend-list {
    justify-content: flex-start;
    justify-self: start;
    align-items: flex-start;
    max-width: 100%;
  }
}

.accordion-legend-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.02);
  max-width: 100%;
  text-align: right;
}

.accordion-indicator {
  flex: 0 0 auto;
  min-width: 18px;
  text-align: center;
  line-height: 1;
  margin-top: 1px;
}

.accordion-panel {
  padding: 0 0 16px;
  border-top: 1px solid var(--line);
  display: none;
}

.restrictions-card .accordion-item {
  border-left: none;
  border-right: none;
  border-top: none;
  border-bottom: 1px solid var(--line);
}

.restrictions-card .accordion-panel {
  border-top: 1px solid var(--line);
}

.restrictions-card .list {
  gap: 10px;
}

.restrictions-card .list-item {
  border-bottom: none;
  padding: 6px 0;
}


.accordion-item.open .accordion-panel {
  display: block;
}

.section-title {
  margin: 12px 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.panel-left .section-title {
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

.empty-state {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 24px 0;
  background: transparent;
}

.empty-icon {
  color: var(--muted);
  opacity: 0.45;
  margin-bottom: 10px;
}

.empty-title {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
}

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

.empty-hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  opacity: 0.7;
}

.pdf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 2px 28px 6px;
}

.pdf-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* Action icons in title row — visually quiet, title dominates */
.pdf-actions .btn-icon {
  width: 28px;
  height: 28px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  opacity: 0.65;
}

.pdf-actions .btn-icon svg {
  width: 16px;
  height: 16px;
}

.pdf-actions .btn-icon:hover,
.pdf-actions .btn-icon:focus-visible {
  opacity: 1;
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
  border-color: transparent;
}

.pdf-actions .btn-icon[aria-pressed="true"] {
  opacity: 1;
  color: var(--text);
  background: var(--accent-weak);
}

.pdf-title {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 500;
  font-size: 15px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-highlight-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  max-height: 120px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.25s ease, border-color 0.25s ease;
}

.pdf-highlight-bar.is-collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-color: transparent;
}

.pdf-highlight-bar[hidden] {
  display: none;
}

.pdf-highlight-layers {
  display: contents;
}

.pdf-highlight-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 4px 2px 6px;
  transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.pdf-highlight-chip:hover,
.pdf-highlight-chip:focus-visible {
  background: #fff;
}

.pdf-highlight-chip.is-off {
  opacity: 0.5;
  background: rgba(255, 255, 255, 0.5);
}

.pdf-highlight-chip.is-loading {
  cursor: wait;
}

.pdf-highlight-main {
  border: none;
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 2px;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.pdf-highlight-main:focus-visible {
  outline: 1px solid var(--line-strong);
  outline-offset: 1px;
  border-radius: 999px;
}

.pdf-highlight-chip.is-similar {
  border-style: dashed;
}

.pdf-highlight-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--layer-color, #d0a91f);
  flex-shrink: 0;
}

.pdf-highlight-chip.is-loading .pdf-highlight-dot {
  animation: pulse-dot 1s ease-in-out infinite;
}

.pdf-highlight-label {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-highlight-remove,
.pdf-highlight-mode {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
  padding: 3px 6px;
  cursor: pointer;
}

.pdf-highlight-mode.is-similar {
  border-style: dashed;
}

.pdf-highlight-remove {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 12px;
}

.pdf-highlight-remove:hover,
.pdf-highlight-mode:hover,
.pdf-highlight-remove:focus-visible,
.pdf-highlight-mode:focus-visible {
  background: #fff;
}

.pdf-highlight-controls {
  display: contents;
}

.highlight-query-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 2px 4px 2px 8px;
  background: rgba(255, 255, 255, 0.9);
}

.highlight-match-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.highlight-match-btn {
  border: none;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 7px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.highlight-match-btn:last-child {
  border-right: none;
  padding-right: 2px;
}

.highlight-query-form input {
  width: 150px;
  border: none;
  border-radius: 0;
  padding: 5px 0;
  background: transparent;
  font-size: 12px;
}

.highlight-query-form input:focus {
  border: none;
  outline: none;
}

.highlight-match-btn:hover,
.highlight-match-btn:focus-visible {
  color: var(--text);
}

.pdf-body {
  flex: 1;
  position: relative;
  min-height: 0;
}

#pdf-viewer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background: #f8f6f2;
  display: none;
}

.pdf-scroll-markers {
  position: absolute;
  top: 0;
  right: 6px;
  width: 8px;
  height: 100%;
  z-index: 6;
  pointer-events: none;
}

.pdf-scroll-marker {
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 183, 0, 0.7);
  box-shadow: 0 0 0 1px rgba(140, 90, 0, 0.45);
  transform: translateY(-50%);
  border: none;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
}

.pdf-scroll-marker:hover {
  background: rgba(255, 183, 0, 0.95);
}

.pdf-inline {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #f8f6f2;
}

.pdf-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 24px;
  min-height: 100%;
}

.pdf-page {
  position: relative;
  box-shadow: 0 12px 30px rgba(18, 17, 15, 0.12);
  background: #fff;
}

.pdf-page canvas {
  display: block;
  position: relative;
  z-index: 1;
}

.textLayer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  line-height: 1;
  text-size-adjust: none;
  -webkit-text-size-adjust: none;
  cursor: text;
  z-index: 2;
}

.textLayer span {
  position: absolute;
  white-space: pre;
  transform-origin: 0 0;
  color: transparent;
}

.textLayer ::selection {
  background: rgba(65, 113, 255, 0.35);
}

.annotationLayer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.page-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.highlight-rect {
  position: absolute;
  background: rgba(255, 221, 0, 0.28);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(120, 90, 10, 0.18);
}

.highlight-rect[data-word-highlight="true"] {
  background: rgba(255, 180, 0, 0.45);
  box-shadow: inset 0 0 0 1px rgba(140, 100, 20, 0.35);
  border-radius: 1px;
}

@keyframes pulse-dot {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.25);
  }
}

.pdf-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100%;
  border: none;
  border-radius: 0;
  position: absolute;
  inset: 0;
  background: var(--panel);
  pointer-events: none;
}

.pdf-loading[hidden],
.pdf-body .empty-state[hidden] {
  display: none !important;
}

.pdf-progress {
  width: min(280px, 70%);
  height: 6px;
  border-radius: 999px;
  background: rgba(31, 29, 26, 0.12);
  overflow: hidden;
}

.pdf-progress-bar {
  height: 100%;
  width: 40%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: pdf-progress 1.2s ease-in-out infinite;
}

.pdf-body .empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.pdf-load-error {
  margin-top: 10px;
  padding: 0 20px;
  max-width: min(92%, 820px);
}

.pdf-load-error-title {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.pdf-load-error-link {
  max-width: 100%;
  justify-content: center;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: center;
}

.spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(31, 29, 26, 0.12);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

.loading-text {
  font-size: 13px;
  color: var(--muted);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pdf-progress {
  0% {
    transform: translateX(-120%);
    opacity: 0.2;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateX(220%);
    opacity: 0.2;
  }
}

@keyframes embed-indeterminate {
  0% { transform: translateX(-100%) scaleX(0.4); }
  40% { transform: translateX(0%) scaleX(0.4); }
  60% { transform: translateX(60%) scaleX(0.6); }
  100% { transform: translateX(200%) scaleX(0.4); }
}

@keyframes book-left-cover {
  0%,
  10% {
    transform: perspective(80px) rotateY(0deg);
  }
  30% {
    transform: perspective(80px) rotateY(42deg);
  }
  70% {
    transform: perspective(80px) rotateY(42deg);
  }
  90%,
  100% {
    transform: perspective(80px) rotateY(0deg);
  }
}

@keyframes book-right-cover {
  0%,
  10% {
    transform: perspective(80px) rotateY(0deg);
  }
  30% {
    transform: perspective(80px) rotateY(-42deg);
  }
  70% {
    transform: perspective(80px) rotateY(-42deg);
  }
  90%,
  100% {
    transform: perspective(80px) rotateY(0deg);
  }
}

@keyframes page-flip {
  0%,
  20% {
    transform: perspective(80px) rotateY(0deg);
    opacity: 0;
  }
  28% {
    transform: perspective(80px) rotateY(0deg);
    opacity: 0.8;
  }
  50% {
    transform: perspective(80px) rotateY(-90deg);
    opacity: 0.6;
  }
  72% {
    transform: perspective(80px) rotateY(-170deg);
    opacity: 0.3;
  }
  78%,
  100% {
    transform: perspective(80px) rotateY(-180deg);
    opacity: 0;
  }
}

.rag-embed-progress-bar {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 2px;
  font-size: 11px;
  color: color-mix(in srgb, var(--muted, #7a7a7a) 88%, transparent);
  letter-spacing: 0.01em;
}

.rag-embed-bar-icon {
  position: relative;
  width: 24px;
  height: 18px;
  flex: 0 0 auto;
}

.rag-embed-bar-book {
  position: absolute;
  left: 2px;
  top: 3px;
  width: 20px;
  height: 12px;
  transform-style: preserve-3d;
}

.rag-embed-bar-book::before,
.rag-embed-bar-book::after {
  content: "";
  position: absolute;
  top: 0;
  width: 10px;
  height: 12px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, currentColor 20%, white 80%) 0,
    color-mix(in srgb, currentColor 10%, white 90%) 100%
  );
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, currentColor 12%, transparent),
    inset 0 -1px 0 color-mix(in srgb, currentColor 16%, transparent),
    0 1px 2px color-mix(in srgb, currentColor 12%, transparent);
}

.rag-embed-bar-book::before {
  left: 0;
  border-radius: 6px 2px 2px 6px;
  transform-origin: right center;
  animation: book-left-cover 2.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.rag-embed-bar-book::after {
  right: 0;
  border-radius: 2px 6px 6px 2px;
  transform-origin: left center;
  animation: book-right-cover 2.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.rag-embed-bar-page {
  position: absolute;
  left: 10px;
  top: 4px;
  width: 9px;
  height: 10px;
  border-radius: 1px 3px 3px 1px;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, white 94%, currentColor 6%) 0,
      color-mix(in srgb, white 86%, currentColor 14%) 100%
    );
  transform-origin: left center;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, currentColor 8%, transparent),
    0 1px 1px color-mix(in srgb, currentColor 10%, transparent);
  animation: page-flip 2.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.rag-embed-bar-label {
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity 0.25s ease;
}

.rag-embed-bar-dots {
  display: inline-block;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  color: inherit;
  opacity: 0.72;
  animation: embed-dots 1.7s steps(4, end) infinite;
}

.rag-embed-bar-retry {
  margin-left: 10px;
  padding: 2px 10px;
  border: 1px solid currentColor;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.85em;
  cursor: pointer;
  opacity: 0.85;
  white-space: nowrap;
  flex-shrink: 0;
}
.rag-embed-bar-retry:hover {
  opacity: 1;
}

@keyframes embed-dots {
  0%,
  20% {
    width: 0;
  }
  45% {
    width: 1ch;
  }
  65% {
    width: 2ch;
  }
  82% {
    width: 3ch;
  }
  100% {
    width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rag-embed-bar-book::before,
  .rag-embed-bar-book::after,
  .rag-embed-bar-page,
  .rag-embed-bar-dots {
    animation: none;
  }

  .rag-embed-bar-book::before {
    transform: perspective(80px) rotateY(38deg);
  }

  .rag-embed-bar-book::after {
    transform: perspective(80px) rotateY(-38deg);
  }

  .rag-embed-bar-page {
    opacity: 0.35;
    transform: perspective(60px) rotateY(-24deg);
  }
}


.floating-buttons {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 42;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.bug-report-trigger {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(246, 246, 246, 0.95);
  color: var(--text);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 14px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(8px);
}

.bug-report-trigger:hover,
.bug-report-trigger:focus-visible {
  background: #fff;
}

.donate-trigger {
  background: #006fba;
  color: #fff;
  border-color: #006fba;
}

.donate-trigger:hover,
.donate-trigger:focus-visible {
  background: #005a96;
  border-color: #005a96;
}

.bug-report-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.bug-report-modal[hidden] {
  display: none !important;
}

.bug-report-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 18, 18, 0.42);
}

.bug-report-sheet {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  border-radius: 14px;
  padding: 18px;
}

.bug-report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.bug-report-title {
  margin: 0;
  font-size: 19px;
  font-weight: 500;
}

.bug-report-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.bug-report-close {
  flex-shrink: 0;
}

.bug-report-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bug-report-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bug-report-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.bug-report-field select,
.bug-report-field input,
.bug-report-field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}

.bug-report-field textarea {
  resize: vertical;
  min-height: 88px;
}

.bug-report-field input:focus,
.bug-report-field select:focus,
.bug-report-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.bug-report-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
}

.bug-report-check input {
  width: auto;
  padding: 0;
  border: none;
}

.bug-report-status {
  font-size: 12px;
  color: var(--muted);
}

.bug-report-status[data-status="error"] {
  color: var(--error);
}

.bug-report-status[data-status="success"] {
  color: #20592b;
}

.bug-report-privacy {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.bug-report-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.bug-report-confirm-sheet {
  width: min(460px, 100%);
  max-height: none;
}

.bug-report-confirm-message {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.bug-report-confirm-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

body.bug-report-open {
  overflow: hidden;
}

.donate-sheet {
  width: min(480px, 100%);
}

.donate-description {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.partner-values {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.partner-values li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 14px;
  border-left: 2px solid var(--line-strong);
}

.partner-value-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.partner-value-detail {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.donate-contact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

.donate-contact-btn:hover,
.donate-contact-btn:focus-visible {
  background: var(--accent);
  color: #fff;
}

.donate-actions {
  margin-top: 4px;
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .app {
    grid-template-columns: 1fr;
    width: 100%;
    margin: 0;
    height: auto;
    border-radius: 0;
  }

  .panel-left {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .panel-divider {
    display: none;
  }

  .panel-right {
    padding-top: 0;
    height: auto;
    overflow: visible;
  }

  .right-view {
    overflow: visible;
  }

  .right-header {
    padding: 12px 18px 0;
  }

  .history-dock {
    margin: 0 18px;
  }

  .history-view .history-dock {
    margin: 0;
  }

  .map-status {
    padding: 0 18px 12px;
  }

  .map-legal {
    padding: 12px 18px 20px;
  }

  .dwg-view {
    padding: 10px 12px 16px;
  }

  .dwg-preview-panel {
    border-radius: 16px;
  }

  .dwg-preview-header {
    padding: 12px 14px;
  }

  .dwg-preview-canvas {
    min-height: 360px;
  }

  .pdf-header {
    padding-left: 18px;
    padding-right: 18px;
  }

  .pdf-highlight-bar {
    padding-left: 18px;
    padding-right: 18px;
    align-items: flex-start;
    flex-direction: column;
  }

  .pdf-highlight-controls {
    width: 100%;
    justify-content: flex-end;
  }

  .highlight-query-form {
    width: 100%;
    flex-wrap: wrap;
  }

  .highlight-query-form input {
    width: 100%;
    min-width: 0;
  }

  #pdf-panel.collapsed {
    display: none;
  }

  .pdf-header {
    position: sticky;
    top: 0;
    background: var(--panel);
    z-index: 2;
  }

  #pdf-close {
    display: inline-flex;
  }

  .right-header {
    flex-wrap: wrap;
  }

  .bug-report-modal {
    padding: 10px;
    align-items: flex-end;
  }

  .bug-report-sheet {
    width: 100%;
    max-height: calc(100vh - 20px);
  }

  .bug-report-confirm-sheet {
    max-height: calc(100vh - 20px);
  }

  .bug-report-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 901px) {
  #pdf-close {
    display: none;
  }
}

/* --- About modal --- */

.about-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.about-btn:hover,
.about-btn:focus-visible {
  color: var(--text);
  border-color: var(--text);
}

.about-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.about-modal[hidden] {
  display: none !important;
}

.about-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 18, 18, 0.42);
}

.about-sheet {
  position: relative;
  width: min(580px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  border-radius: 14px;
  padding: 24px;
}

.about-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.about-title {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

.about-header .btn-text {
  font-size: 22px;
  line-height: 1;
  padding: 0 4px;
}

.about-body h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 18px 0 6px;
}

.about-body p {
  font-size: 13px;
  line-height: 1.55;
  margin: 0 0 6px;
  color: var(--text);
}

.about-body a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.about-body a:hover {
  color: var(--muted);
}

.about-list {
  list-style: none;
  padding: 0;
  margin: 0 0 6px;
}

.about-list li {
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 8px;
  color: var(--text);
}

.about-disclaimer {
  color: var(--muted) !important;
  font-size: 12px !important;
}

.consent-banner {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 980px;
  margin: 0 auto;
  background: rgba(246, 246, 246, 0.92);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(10px);
}

.consent-banner[hidden] {
  display: none !important;
}

.consent-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px 14px;
}

.consent-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.consent-title {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.consent-text {
  font-size: 13px;
  line-height: 1.35;
  color: var(--text);
  max-width: 62ch;
}

.consent-details-toggle {
  align-self: flex-start;
  padding-left: 0;
}

.consent-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.consent-details {
  border-top: 1px solid var(--line);
  padding: 12px 18px 16px;
}

.consent-details-text {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

@media (max-width: 600px) {
  .search-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }


  .rag-chat-input-row {
    flex-direction: column;
    align-items: stretch;
  }

  .rag-chat-send {
    width: 100%;
  }

  .consent-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .consent-actions {
    justify-content: flex-start;
  }

  .contact-item {
    border-radius: 6px;
    padding: 12px;
  }

  .contact-field-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .section-title--contacts {
    padding: 0 12px;
  }
}

.section-title--contacts {
  margin: 24px 0 12px 0;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.contacts-engine-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-body.contacts-engine-body {
  padding: 16px;
}

.contact-item {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}

.contact-item-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.contact-fields {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.contact-field-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  column-gap: 10px;
  align-items: flex-start;
}

.contact-field-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.contact-field-values {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.contact-field-value {
  display: flex;
  align-items: flex-start;
  position: relative;
  min-width: 0;
}

.contact-value-trigger {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(15, 23, 42, 0.24);
  text-underline-offset: 2px;
  cursor: pointer;
}

.contact-value-trigger:hover,
.contact-value-trigger:focus-visible {
  color: var(--accent);
  text-decoration-color: currentColor;
  outline: none;
}

.row-value {
  position: relative;
}

.row-value .contact-value-trigger {
  font-size: inherit;
}

.contact-action-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  min-width: 156px;
  max-width: min(240px, calc(100vw - 64px));
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-action-menu-option {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 7px 8px;
  border-radius: 6px;
  text-align: left;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}

.contact-action-menu-option:hover,
.contact-action-menu-option:focus-visible {
  background: rgba(15, 23, 42, 0.08);
  outline: none;
}

.contact-empty-state {
  font-size: 13px;
  color: var(--muted);
}

/* ── Design refresh ─────────────────────────────────────────────── */

/* 1. Policy level tag — colour by hierarchy level */
.policy-level-tag[data-level="municipal"] {
  color: #1a5c4a;
  background: rgba(26, 92, 74, 0.08);
  border-color: rgba(26, 92, 74, 0.28);
}
.policy-level-tag[data-level="cantonal"] {
  color: #2c4a7a;
  background: rgba(44, 74, 122, 0.07);
  border-color: rgba(44, 74, 122, 0.22);
}
.policy-level-tag[data-level="federal"] {
  color: #4e4e62;
  background: rgba(78, 78, 98, 0.07);
  border-color: rgba(78, 78, 98, 0.2);
}

/* 2. Doc rows — coloured left border keyed to level via :has() */
.list-item--doc:has(.policy-level-tag[data-level="municipal"]) {
  border-left: 2px solid rgba(26, 92, 74, 0.45);
  padding-left: 8px;
}
.list-item--doc:has(.policy-level-tag[data-level="cantonal"]) {
  border-left: 2px solid rgba(44, 74, 122, 0.35);
  padding-left: 8px;
}
.list-item--doc:has(.policy-level-tag[data-level="federal"]) {
  border-left: 2px solid rgba(78, 78, 98, 0.28);
  padding-left: 8px;
}

/* 3. Accordion section title — stronger weight */
.accordion-title {
  font-weight: 600;
}

/* 4. RECHTSVORSCHRIFTEN / GESETZLICHE GRUNDLAGEN label — chip style */
.card-subtitle {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  background: var(--accent-weak);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
  margin-bottom: 10px;
}

/* 5. Doc-link hover — slightly more visible */
.doc-link:hover,
.doc-link:focus-visible {
  background: rgba(0, 0, 0, 0.06);
}

/* 6. Accordion header hover — match doc-link feel */
.accordion-header:hover,
.accordion-header:focus-visible {
  background: rgba(0, 0, 0, 0.04);
}

/* 7. Active progress milestone dot — pulse animation */
@keyframes brb-pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(27, 95, 255, 0.35); }
  50%       { box-shadow: 0 0 0 4px rgba(27, 95, 255, 0); }
}
.progress-milestone.is-active .progress-milestone-dot {
  animation: brb-pulse-dot 1.6s ease-in-out infinite;
}

/* ── end design refresh ─────────────────────────────────────────── */

/* ── utility polish / workbench alignment ───────────────────────── */
:root {
  --primary: #1b5fff;
  --fg: var(--text);
  --bg-hover: rgba(0, 0, 0, 0.06);
  --ui-gutter: 20px;
}

body::before,
.panel-left::before {
  display: none;
}

.app {
  grid-template-columns: minmax(380px, var(--left-width, 56%)) 8px minmax(360px, 1fr);
  background: #f2f2f2;
}

.panel-divider::before {
  inset: 0 3px;
}

.panel-left {
  padding: 0 var(--ui-gutter) 22px;
  background-color: #f5f5f5;
}

.left-hero {
  background-color: #ececec;
  margin: 0 calc(var(--ui-gutter) * -1) 10px;
  padding: 12px var(--ui-gutter);
  border-bottom: 1px solid var(--line);
}

.panel-left.is-collapsed .left-hero {
  padding: 10px var(--ui-gutter);
  box-shadow: none;
}

.header {
  align-items: center;
  margin-bottom: 10px;
}

.brand-title {
  font-size: 22px;
  letter-spacing: 0.1px;
}

.brand-subtitle {
  font-size: 10px;
  letter-spacing: 0.06em;
}

.controls {
  gap: 10px;
}

.control {
  gap: 4px;
  letter-spacing: 0.06em;
}

#lang-select {
  width: auto;
  min-width: 62px;
  padding: 6px 8px;
}

.search-row {
  gap: 10px;
  align-items: center;
}


.search input {
  min-height: 40px;
  padding: 10px 12px;
}

.search input:focus {
  outline: none;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.search-input-wrap:focus-within {
  border-color: var(--line-strong);
  outline: 1px solid rgba(27, 95, 255, 0.2);
  outline-offset: 0;
}

.search-input-wrap input {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  border: none;
  background: transparent;
  outline: none;
}

.search-inline-btn {
  background: none;
  border: none;
  padding: 0 14px 0 4px;
  margin: 0;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
}

.search-inline-btn:hover,
.search-inline-btn:focus-visible {
  color: var(--text);
}

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 4px 0 0;
  padding: 4px 0;
  list-style: none;
  background: rgba(246, 246, 246, 0.98);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  z-index: 20;
  max-height: 320px;
  overflow-y: auto;
}

.search-suggestions[hidden] {
  display: none;
}

.search-suggestion {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s ease;
}

.search-suggestion:hover,
.search-suggestion[aria-selected="true"] {
  background: rgba(0, 0, 0, 0.06);
}

.search-suggestion-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-suggestion-type {
  flex-shrink: 0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.search-split {
  border: 1px solid #d4d4d4;
  border-radius: 8px;
  background: #efefef;
  overflow: visible;
}


.search-split .btn-primary {
  border: none;
  border-radius: 0;
  min-height: 36px;
  background: transparent;
  color: #262626;
}

.search-split .btn-primary:hover,
.search-split .btn-primary:focus-visible {
  background: #dcdcdc;
}

.scenario-menu {
  top: calc(100% + 6px);
  min-width: 280px;
  border-radius: 10px;
  border-color: #d4d4d4;
  background: #f3f3f3;
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.12);
  padding: 8px;
}

.scenario-menu-option {
  padding: 9px 10px;
  font-size: 12px;
}

.scenario-menu-option.active {
  border-color: #c8c8c8;
  background: #e9e9e9;
}

.btn-primary {
  border-radius: 8px;
  letter-spacing: 0.06em;
  font-size: 10px;
  padding: 9px 14px;
}

.btn-text {
  letter-spacing: 0.04em;
}

.results {
  margin-top: 12px;
  gap: 12px;
}

.search-guide {
  border-radius: 8px;
  background: #fff;
  padding: 14px 16px;
}

.card,
.restrictions-card,
.history-dock,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.card,
.restrictions-card {
  padding: 14px;
}

.card-title {
  font-size: 18px;
  margin-bottom: 10px;
}

.accordion-item {
  border: none;
}

.accordion-header {
  padding: 10px 0;
}

.panel-right {
  border-left: 1px solid var(--line);
  background: #f6f6f6;
}

.right-header {
  background-color: #ececec;
  padding: 12px 16px 16px;
  border-bottom: 1px solid var(--line);
}

.toggle-btn {
  font-size: 11px;
}


.history-dock {
  margin: 5px 16px 16px;
  padding: 10px 12px;
}

.pdf-header {
  padding: 13px 16px 8px;
}

.pdf-highlight-bar {
  padding: 8px 16px;
}

.pdf-body {
  background: #f3f3f3;
}

#pdf-viewer,
.pdf-inline {
  background: #f3f3f3;
}

.pdf-pages {
  padding: 14px;
  gap: 14px;
}

.rag-chat-card {
  padding: 12px;
}

.restrictions-card + .rag-chat-card {
  margin-top: 4px;
}

.rag-chat-thread {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.rag-chat-entry-state {
  margin-top: 10px;
  padding-top: 10px;
  border-top: none;
}

.rag-chat-form {
  gap: 8px;
}

.rag-chat-input {
  border: 1px solid var(--line);
  background: #fff;
  min-height: 38px;
}

.rag-chat-send {
  min-height: 38px;
  min-width: 76px;
}

.rag-chat-msg {
  max-width: 95%;
}

.rag-chat-msg-content {
  border-radius: 10px;
}

.map-shell {
  border: none;
}

.floating-buttons {
  right: 12px;
  bottom: 12px;
}

.bug-report-trigger {
  border-radius: 8px;
  box-shadow: none;
}

@media (hover: hover) and (pointer: fine) {
  .floating-buttons--hover-collapse {
    --floating-stack-step: 44px;
    --floating-stack-shift: calc(var(--floating-stack-step) * 2);
    transform: translate3d(0, var(--floating-stack-shift), 0);
    transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
  }

  .floating-buttons--hover-collapse.is-expanded,
  .floating-buttons--hover-collapse:focus-within {
    transform: translate3d(0, 0, 0);
  }

  .floating-buttons--hover-collapse .bug-report-trigger {
    transition:
      opacity 160ms ease,
      transform 180ms cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0s linear 160ms;
    will-change: opacity, transform;
  }

  .floating-buttons--hover-collapse:not(.is-expanded):not(:focus-within) .bug-report-trigger:not(.feedback-trigger) {
    opacity: 0;
    transform: translate3d(0, 6px, 0);
    visibility: hidden;
    pointer-events: none;
  }

  .floating-buttons--hover-collapse.is-expanded .bug-report-trigger,
  .floating-buttons--hover-collapse:focus-within .bug-report-trigger {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }
}

@media (max-width: 900px) {
  .right-header {
    padding: 10px 12px 6px;
  }


  .history-dock {
    margin: 10px 12px 14px;
  }

  .pdf-header,
  .pdf-highlight-bar {
    padding-left: 12px;
    padding-right: 12px;
  }

}

@media (max-width: 1120px) {
  .dwg-legend-panel {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-height: none;
  }
}
/* ── end utility polish ─────────────────────────────────────────── */

/* ── restrictions list refinement ───────────────────────────────── */
.list-item--doc:has(.policy-level-tag[data-level="municipal"]),
.list-item--doc:has(.policy-level-tag[data-level="cantonal"]),
.list-item--doc:has(.policy-level-tag[data-level="federal"]) {
  border-left: none;
  padding-left: 0;
}

.restrictions-card .accordion-item {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.restrictions-card .accordion-item:last-child {
  border-bottom: none;
}

.restrictions-card .accordion-panel {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-top: 2px;
}

.restrictions-card .accordion-title {
  font-size: 1rem;
  line-height: 1.35;
}

.restrictions-card .section-title {
  border-bottom: none;
  padding-bottom: 0;
  margin: 12px 0 6px;
  color: #6f6f6f;
}

.restrictions-card .list {
  gap: 6px;
}

.restrictions-card .list-item--doc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px 10px;
  padding: 4px 0;
}

.restrictions-card .list-item--doc > .doc-link {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
  border-radius: 8px;
  padding: 6px 8px;
}

.restrictions-card .list-item--doc > .doc-link:hover,
.restrictions-card .list-item--doc > .doc-link:focus-visible {
  background: rgba(0, 0, 0, 0.035);
}

.restrictions-card .list-item--doc > .doc-link.is-selected {
  background: rgba(0, 0, 0, 0.03);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  color: var(--text);
  font-weight: 500;
}

.restrictions-card .policy-group-meta {
  justify-self: end;
  align-self: center;
  flex-wrap: wrap;
  gap: 6px;
}

@media (max-width: 760px) {
  .restrictions-card .list-item--doc {
    grid-template-columns: 1fr;
  }

  .restrictions-card .policy-group-meta {
    justify-self: start;
  }
}
/* ── end restrictions list refinement ───────────────────────────── */

/* ── Flat docs list row overrides (must come after .restrictions-card grid) ── */
.docs-flat-list .list-item.list-item--doc {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 6px 12px;
}

.docs-flat-list .doc-row-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.docs-flat-list .doc-row-header > .doc-link {
  flex: 1;
  min-width: 0;
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
  text-align: left;
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 13px;
  color: var(--text);
  transition: background 0.12s ease;
}

.docs-flat-list .doc-row-header > .doc-link:hover,
.docs-flat-list .doc-row-header > .doc-link:focus-visible {
  background: rgba(0, 0, 0, 0.04);
}

/* Level badge — secondary, quiet, right-aligned */
.doc-classify-tag {
  flex-shrink: 0;
  font-size: 10px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--muted);
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--accent-weak);
}

.doc-classify-tag[data-level="municipal"] {
  color: #1a5c4a;
  background: rgba(26, 92, 74, 0.07);
}

.doc-classify-tag[data-level="cantonal"] {
  color: #2c4a7a;
  background: rgba(44, 74, 122, 0.07);
}

.doc-classify-tag[data-level="federal"] {
  color: #4e4e62;
  background: rgba(78, 78, 98, 0.07);
}

/* Agentic RAG Thinking Visualization */
.rag-chat-thinking-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  margin: 6px 0 10px;
  animation: fadeIn 0.18s ease-out;
}

.rag-chat-thinking-steps {
  display: flex;
  flex-direction: column;
  overflow: visible;
  max-height: 200000px;
  opacity: 1;
  transition: max-height 0.35s ease, opacity 0.25s ease;
}

.rag-chat-thinking-container:not(.rag-chat-thinking-container--expanded) .rag-chat-thinking-steps {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
}

.rag-chat-thinking-container.rag-chat-thinking-container--expanded .rag-chat-thinking-steps {
  max-height: 200000px;
  opacity: 1;
  overflow: visible;
}

.rag-chat-thinking-step {
  position: relative;
  display: flex;
  align-items: flex-start;
  min-width: 0;
  padding: 1px 0 10px 24px;
  animation: fadeIn 0.15s ease-out;
}

.rag-chat-thinking-step:last-child {
  padding-bottom: 2px;
}

.rag-chat-thinking-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 10px;
  bottom: -2px;
  width: 1px;
  background: rgba(0, 0, 0, 0.08);
}

.rag-chat-thinking-step-dot {
  position: absolute;
  left: 4px;
  top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7a7a7a;
  box-shadow: 0 0 0 2px var(--panel);
  flex-shrink: 0;
}

.rag-chat-thinking-step--thinking .rag-chat-thinking-step-dot {
  background: #505050;
}

.rag-chat-thinking-step--clarification .rag-chat-thinking-step-dot {
  background: #5b89c9;
}

.rag-chat-thinking-step-content {
  width: 100%;
  min-width: 0;
}

.rag-chat-thinking-step-text {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  line-height: 1.45;
}

.rag-chat-thinking-step-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #2b2b2b);
}

.rag-chat-thinking-step-msg {
  color: rgba(27, 27, 27, 0.92);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.rag-chat-thinking-step-msg--block {
  display: block;
  margin-top: 4px;
}

.rag-chat-thinking-step-markdown {
  white-space: normal;
}

.rag-chat-thinking-step-markdown p {
  margin: 0 0 6px;
}

.rag-chat-thinking-step-markdown p:last-child {
  margin-bottom: 0;
}

.rag-chat-thinking-step-markdown ul,
.rag-chat-thinking-step-markdown ol {
  margin: 4px 0 8px 18px;
  padding: 0;
}

.rag-chat-thinking-step-markdown li {
  margin: 2px 0;
}

.rag-chat-thinking-step-markdown blockquote {
  margin: 6px 0;
  padding-left: 8px;
  border-left: 2px solid rgba(0, 0, 0, 0.12);
  color: rgba(50, 50, 50, 0.86);
}

.rag-chat-thinking-step-markdown pre,
.rag-chat-thinking-step-markdown code {
  white-space: pre-wrap;
  word-break: break-word;
}

.rag-chat-thinking-step-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted, #7a7a7a);
  line-height: 1.35;
}

.rag-chat-thinking-step--thinking .rag-chat-thinking-step-title {
  color: #5f5f5f;
  font-style: normal;
  font-weight: 600;
}

.rag-chat-thinking-step-params {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  overflow: hidden;
}

.rag-chat-thinking-step-param {
  display: grid;
  grid-template-columns: minmax(110px, 30%) 1fr;
  gap: 10px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.4;
}

.rag-chat-thinking-step-param + .rag-chat-thinking-step-param {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.rag-chat-thinking-step-param-key {
  color: rgba(90, 90, 90, 0.95);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.rag-chat-thinking-step-param-value {
  color: var(--text, #2b2b2b);
  white-space: pre-wrap;
  word-break: break-word;
}

.rag-chat-thinking-citation-card {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  padding: 7px 10px;
}

.rag-chat-thinking-citation-meta {
  color: var(--muted, #7a7a7a);
  font-size: 11px;
  line-height: 1.35;
}


.rag-chat-thinking-citation-content {
  margin-top: 6px;
  color: var(--text, #2b2b2b);
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

.rag-chat-thinking-citation-chunk {
  margin-top: 6px;
  border: 1px solid rgba(0, 0, 0, 0.11);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.58);
}

.rag-chat-thinking-citation-chunk:first-child {
  margin-top: 0;
}

.rag-chat-thinking-citation-chunk-header {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.03);
  color: rgba(70, 70, 70, 0.85);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.rag-chat-thinking-citation-relevance {
  font-weight: 700;
  color: rgba(24, 90, 178, 0.96);
}

.rag-chat-thinking-citation-chunk-header.is-clickable {
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.rag-chat-thinking-citation-chunk-header.is-clickable:hover,
.rag-chat-thinking-citation-chunk-header.is-clickable:focus-visible {
  background: rgba(0, 0, 0, 0.06);
  border-bottom-color: rgba(0, 0, 0, 0.2);
  color: rgba(48, 48, 48, 0.96);
  outline: none;
}

.rag-chat-thinking-citation-chunk-header.is-legal {
  border-bottom-color: rgba(46, 101, 210, 0.22);
  background: rgba(53, 112, 230, 0.09);
  color: rgba(28, 78, 168, 0.95);
}

.rag-chat-thinking-citation-chunk-header.is-legal.is-clickable:hover,
.rag-chat-thinking-citation-chunk-header.is-legal.is-clickable:focus-visible {
  background: rgba(53, 112, 230, 0.15);
  border-bottom-color: rgba(46, 101, 210, 0.35);
  color: rgba(20, 64, 145, 0.98);
}

.rag-chat-thinking-citation-chunk-body {
  padding: 7px 8px;
  font-style: italic;
}

.rag-chat-thinking-citation-quote-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.rag-chat-thinking-citation-quote-text + .rag-chat-thinking-citation-quote-text {
  margin-top: 6px;
}

.rag-chat-thinking-citation-quote-table-wrap {
  margin-top: 6px;
  overflow-x: auto;
}

.rag-chat-thinking-citation-content > :first-child {
  margin-top: 0;
}

.rag-chat-thinking-citation-chunk-body > :first-child {
  margin-top: 0;
}

.rag-chat-thinking-citation-quote-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 11px;
  line-height: 1.35;
}

.rag-chat-thinking-citation-quote-table th,
.rag-chat-thinking-citation-quote-table td {
  border: 1px solid rgba(0, 0, 0, 0.14);
  padding: 4px 6px;
  vertical-align: top;
  text-align: left;
}

.rag-chat-thinking-citation-quote-table th {
  background: rgba(0, 0, 0, 0.05);
  font-weight: 600;
  font-style: normal;
}

.rag-chat-thinking-citation-assessment {
  margin-top: 6px;
  color: rgba(27, 27, 27, 0.95);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.rag-chat-thinking-step--clarification {
  background-color: rgba(47, 125, 246, 0.03);
  border-radius: 6px;
  padding-right: 8px;
}

.rag-chat-thinking-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.rag-chat-thinking-container--expandable .rag-chat-thinking-footer {
  cursor: pointer;
  user-select: none;
}

.rag-chat-thinking-container--expandable .rag-chat-thinking-footer:hover .rag-chat-thinking-label,
.rag-chat-thinking-container--expandable .rag-chat-thinking-footer:hover .rag-chat-thinking-toggle {
  color: rgba(70, 70, 70, 0.86);
}

.rag-chat-thinking-container--expandable .rag-chat-thinking-footer::after {
  content: "▸";
  font-size: 9px;
  color: rgba(120, 120, 120, 0.72);
  margin-left: 1px;
  transition: transform 0.25s ease;
  display: inline-block;
}

.rag-chat-thinking-container--expandable.rag-chat-thinking-container--expanded .rag-chat-thinking-footer::after {
  transform: rotate(90deg);
}

.rag-chat-thinking-icon {
  width: 12px;
  height: 12px;
  color: rgba(112, 112, 112, 0.82);
  flex-shrink: 0;
  overflow: visible;
}

.rag-chat-thinking-container--active .rag-chat-thinking-icon {
  animation: iconPulse 2.8s ease-in-out infinite;
}

.rag-chat-thinking-beam {
  transform-box: fill-box;
  transform-origin: 50% 0%;
}

.rag-chat-thinking-container--active .rag-chat-thinking-beam {
  animation: beamWiggle 2.6s ease-in-out infinite;
}

.rag-chat-thinking-container--active.is-calm .rag-chat-thinking-beam {
  animation: beamWiggleCalm 4s ease-in-out infinite;
}

.rag-chat-thinking-beam.milestone-spin {
  animation: beamSpinOnce 0.7s ease-in-out forwards !important;
}

@keyframes beamWiggle {
  0% { transform: rotate(-7deg); }
  50% { transform: rotate(7deg); }
  100% { transform: rotate(-7deg); }
}

@keyframes beamWiggleCalm {
  0% { transform: rotate(-2.5deg); }
  50% { transform: rotate(2.5deg); }
  100% { transform: rotate(-2.5deg); }
}

@keyframes beamSpinOnce {
  from { transform: rotate(-7deg); }
  to { transform: rotate(353deg); }
}

@keyframes iconPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

.rag-chat-thinking-label {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(120, 120, 120, 0.74);
}

.rag-chat-thinking-toggle {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: rgba(108, 108, 108, 0.75);
  text-transform: none;
}

.rag-chat-thinking-container--active .rag-chat-thinking-label::after {
  content: "▋";
  margin-left: 1px;
  animation: cursorBlink 0.7s step-end infinite;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.rag-chat-clarification-response {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.rag-chat-clarification-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border-light, #e0e0e0);
  border-radius: 4px;
  font-size: 13px;
  min-height: 32px;
}

.rag-chat-clarification-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.rag-chat-clarification-button {
  padding: 6px 12px;
  background-color: #3b82f6;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.rag-chat-clarification-button:hover {
  background-color: #2563eb;
}

.rag-chat-clarification-button:disabled {
  background-color: #93c5fd;
  cursor: not-allowed;
}

.rag-chat-thinking-container + .rag-chat-msg--assistant {
  margin-top: 10px;
}

@media (max-width: 760px) {
  .rag-chat-thinking-step {
    padding-left: 21px;
    padding-bottom: 9px;
  }

  .rag-chat-thinking-step:not(:last-child)::before {
    left: 7px;
  }

  .rag-chat-thinking-step-dot {
    left: 3px;
    width: 8px;
    height: 8px;
    top: 5px;
  }

  .rag-chat-thinking-step-title,
  .rag-chat-thinking-step-msg {
    font-size: 12px;
  }

  .rag-chat-thinking-step-param {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .rag-chat-clarification-response {
    flex-direction: column;
    align-items: stretch;
  }
}

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


.bewilligung-empty-state {
  font-size: 0.875rem;
  color: var(--muted);
  text-align: center;
  padding: 16px;
  font-style: italic;
}

/* Baubewilligungsprozess link styling */
.bewilligung-source-link {
  font-size: 0.875rem !important; /* Reduced font size */
  gap: 4px;
  align-items: center;
  display: inline-flex;
}

.bewilligung-popup-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
}

.bewilligung-popup-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--muted);
}

.bewilligung-source-link:hover .bewilligung-popup-icon svg,
.bewilligung-source-link:focus-visible .bewilligung-popup-icon svg {
  color: var(--text);
}
