:root {
  --paper: #f4f0e6;
  --paper-deep: #e9e3d5;
  --paper-light: #fbf8f0;
  --ink: #171b22;
  --ink-soft: #50545b;
  --ink-faint: #77786f;
  --rule: #c8c0b0;
  --rule-dark: #8f8a7f;
  --cobalt: #173f91;
  --cobalt-bright: #2252b2;
  --cobalt-pale: #dce5f7;
  --red: #c9362a;
  --red-deep: #97261e;
  --green: #26705b;
  --yellow: #e3b341;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "DM Sans", "Avenir Next", "Segoe UI", sans-serif;
  --shadow-hard: 5px 5px 0 rgba(23, 27, 34, 0.11);
  --radius-sm: 4px;
  --radius-md: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
}

button,
summary,
select {
  cursor: pointer;
}

button {
  border: 0;
}

a {
  color: inherit;
}

::selection {
  color: var(--paper-light);
  background: var(--cobalt);
}

.paper-noise {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(23, 63, 145, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 63, 145, 0.026) 1px, transparent 1px),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.11'/%3E%3C/svg%3E");
  background-size: 24px 24px, 24px 24px, 180px 180px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  transform: translateY(-150%);
  border: 2px solid var(--ink);
  background: var(--paper-light);
  font-weight: 700;
}

.skip-link:focus {
  transform: none;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.site-header {
  display: flex;
  width: min(100% - 48px, 1510px);
  min-height: 92px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-bottom: 1px solid var(--ink);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--cobalt);
  box-shadow: 3px 3px 0 var(--red);
  color: var(--paper-light);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.08em;
  transform: rotate(-3deg);
}

.brand-mark span {
  color: #ffb5a9;
}

.brand-copy {
  display: grid;
  line-height: 1.1;
}

.brand-copy strong {
  font-family: var(--font-display);
  font-size: 25px;
  letter-spacing: -0.025em;
}

.brand-copy small {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.source-signal {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.signal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(38, 112, 91, 0.13);
}

.signal-rule {
  width: 24px;
  height: 1px;
  background: var(--rule-dark);
}

.app-layout {
  display: grid;
  width: min(100% - 48px, 1510px);
  margin: 0 auto;
  grid-template-columns: minmax(520px, 0.95fr) minmax(490px, 1.05fr);
  align-items: start;
}

.chat-column,
.registry-panel {
  min-width: 0;
}

.chat-column {
  padding: 56px clamp(32px, 4.8vw, 76px) 90px 8px;
}

.registry-panel {
  position: sticky;
  top: 0;
  min-height: calc(100vh - 92px);
  padding: 38px clamp(28px, 3.7vw, 60px) 28px;
  border-right: 1px solid var(--rule-dark);
  border-left: 1px solid var(--ink);
  background:
    linear-gradient(90deg, rgba(23, 63, 145, 0.055), transparent 12%),
    var(--paper-light);
}

.registry-panel::before {
  position: absolute;
  top: 0;
  right: 0;
  width: 63px;
  height: 7px;
  background: var(--red);
  content: "";
}

.registry-panel::after {
  position: absolute;
  top: 0;
  right: 63px;
  width: 86px;
  height: 7px;
  background: var(--cobalt);
  content: "";
}

.eyebrow {
  display: flex;
  margin: 0 0 13px;
  align-items: center;
  gap: 10px;
  color: var(--cobalt);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow span {
  display: inline-grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 9px;
}

.chat-intro h1 {
  max-width: 680px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(44px, 5.1vw, 72px);
  font-weight: 600;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.chat-intro > p:last-child {
  max-width: 610px;
  margin: 22px 0 0;
  color: var(--ink-soft);
  font-size: 16px;
}

.conversation {
  display: flex;
  min-height: 158px;
  max-height: 440px;
  margin-top: 38px;
  padding: 5px 9px 5px 0;
  overflow-y: auto;
  flex-direction: column;
  gap: 18px;
  overscroll-behavior: contain;
  scrollbar-color: var(--rule-dark) transparent;
  scrollbar-width: thin;
}

.message {
  display: flex;
  max-width: 94%;
  align-items: flex-start;
  gap: 12px;
  animation: message-in 420ms var(--ease) both;
}

.message-avatar {
  display: grid;
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--cobalt);
  color: white;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
}

.message-body {
  padding: 15px 18px;
  border: 1px solid var(--rule-dark);
  border-radius: 2px 13px 13px 13px;
  background: rgba(251, 248, 240, 0.74);
  box-shadow: 3px 3px 0 rgba(23, 27, 34, 0.05);
}

.message-body p {
  margin: 0;
}

.message-body p + p {
  margin-top: 9px;
}

.message-note {
  color: var(--ink-soft);
  font-size: 12px;
}

.message-user {
  margin-left: auto;
  justify-content: flex-end;
}

.message-user .message-body {
  border-color: var(--cobalt);
  border-radius: 13px 2px 13px 13px;
  background: var(--cobalt);
  color: white;
  box-shadow: 3px 3px 0 rgba(23, 63, 145, 0.19);
}

.message-error .message-body {
  border-color: var(--red);
  background: #fff0eb;
}

.message-loading .message-body {
  display: flex;
  min-width: 110px;
  align-items: center;
  gap: 8px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cobalt);
  animation: typing 1s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: 130ms;
}

.typing-dot:nth-child(3) {
  animation-delay: 260ms;
}

.result-list {
  display: grid;
  width: min(100%, 620px);
  margin: -4px 0 2px 45px;
  gap: 9px;
  animation: message-in 440ms var(--ease) both;
}

.result-card {
  position: relative;
  display: grid;
  width: 100%;
  padding: 14px 42px 14px 16px;
  overflow: hidden;
  border: 1px solid var(--rule-dark);
  border-left: 3px solid var(--cobalt);
  border-radius: var(--radius-sm);
  background: rgba(251, 248, 240, 0.88);
  text-align: left;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.result-card::after {
  position: absolute;
  top: 50%;
  right: 16px;
  color: var(--cobalt);
  content: "→";
  font-size: 19px;
  transform: translateY(-50%);
  transition: transform 160ms ease;
}

.result-card:hover {
  border-color: var(--cobalt);
  box-shadow: var(--shadow-hard);
  transform: translate(-2px, -2px);
}

.result-card:hover::after {
  transform: translate(3px, -50%);
}

.result-card-title {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-card-meta {
  display: flex;
  margin-top: 5px;
  flex-wrap: wrap;
  gap: 5px 12px;
  color: var(--ink-soft);
  font-size: 11px;
}

.result-card-meta span + span::before {
  margin-right: 12px;
  color: var(--red);
  content: "/";
  font-weight: 700;
}

.quick-examples {
  display: flex;
  margin-top: 20px;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.quick-examples > span {
  margin-right: 3px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.example-chip {
  padding: 7px 10px;
  border: 1px solid var(--rule);
  border-radius: 30px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 11px;
  transition: 150ms ease;
}

.example-chip:hover {
  border-color: var(--cobalt);
  background: var(--cobalt-pale);
  color: var(--cobalt);
}

.composer {
  position: relative;
  display: grid;
  margin-top: 15px;
  padding: 7px 7px 7px 18px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  grid-template-columns: 1fr auto;
  align-items: end;
  background: var(--paper-light);
  box-shadow: 5px 5px 0 var(--cobalt);
  transition:
    border-color 170ms ease,
    box-shadow 170ms ease;
}

.composer:focus-within {
  border-color: var(--cobalt);
  box-shadow: 5px 5px 0 var(--red);
}

.composer textarea {
  min-height: 48px;
  max-height: 130px;
  padding: 12px 12px 12px 0;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: none;
  background: transparent;
  line-height: 1.35;
}

.composer textarea::placeholder {
  color: #898a83;
}

.send-button {
  display: flex;
  height: 48px;
  padding: 0 17px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 3px;
  background: var(--red);
  color: white;
  font-size: 13px;
  font-weight: 700;
  transition:
    background 150ms ease,
    transform 150ms ease;
}

.send-button:hover {
  background: var(--red-deep);
  transform: translateY(-1px);
}

.send-button:disabled,
.filter-submit:disabled {
  cursor: wait;
  opacity: 0.6;
}

.send-button svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.composer-help {
  position: absolute;
  right: 0;
  bottom: -22px;
  margin: 0;
  color: var(--ink-faint);
  font-size: 10px;
}

.advanced-search {
  margin-top: 49px;
  border-top: 1px solid var(--rule-dark);
  border-bottom: 1px solid var(--rule-dark);
}

.advanced-search > summary {
  display: flex;
  min-height: 70px;
  padding: 12px 4px;
  align-items: center;
  gap: 13px;
  list-style: none;
}

.advanced-search > summary::-webkit-details-marker {
  display: none;
}

.advanced-search > summary > span:last-child {
  display: grid;
  line-height: 1.25;
}

.advanced-search > summary strong {
  font-family: var(--font-display);
  font-size: 18px;
}

.advanced-search > summary small {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 11px;
}

.summary-plus {
  position: relative;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border: 1px solid var(--ink);
  border-radius: 50%;
}

.summary-plus::before,
.summary-plus::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 1px;
  background: var(--ink);
  content: "";
  transform: translate(-50%, -50%);
  transition: transform 200ms ease;
}

.summary-plus::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.advanced-search[open] .summary-plus::after {
  transform: translate(-50%, -50%) rotate(0);
}

.filter-form {
  padding: 8px 4px 24px;
  animation: reveal 300ms var(--ease) both;
}

.filter-grid {
  display: grid;
  gap: 11px;
}

.filter-grid-location {
  grid-template-columns: 1fr 1fr 0.9fr;
}

.filter-grid-pair {
  grid-template-columns: repeat(2, 1fr);
}

.filter-grid-turnover {
  grid-template-columns: 1fr 1fr 0.7fr 0.85fr;
}

.filter-form fieldset {
  margin: 17px 0 0;
  padding: 0;
  border: 0;
}

.filter-form legend {
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.filter-form label {
  display: grid;
  align-content: start;
}

.filter-form label > span {
  min-height: 18px;
  margin-bottom: 4px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.filter-form label em {
  color: var(--ink-faint);
  font-size: 8px;
  font-style: normal;
  font-weight: 500;
}

.filter-form input,
.filter-form select {
  width: 100%;
  min-width: 0;
  height: 39px;
  padding: 0 9px;
  border: 1px solid var(--rule-dark);
  border-radius: 2px;
  outline: none;
  background: rgba(251, 248, 240, 0.8);
  font-size: 12px;
}

.filter-form input:focus,
.filter-form select:focus {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 2px rgba(23, 63, 145, 0.14);
}

.filter-form label > small {
  margin-top: 4px;
  color: var(--ink-faint);
  font-size: 9px;
}

.filter-actions {
  display: flex;
  margin-top: 20px;
  align-items: end;
  justify-content: space-between;
  gap: 15px;
}

.sort-control {
  width: min(230px, 48%);
}

.filter-submit {
  display: inline-flex;
  min-height: 42px;
  padding: 0 16px;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper-light);
  font-size: 12px;
  font-weight: 700;
  transition: 150ms ease;
}

.filter-submit:hover {
  background: var(--cobalt);
  box-shadow: 3px 3px 0 var(--red);
  transform: translate(-1px, -1px);
}

.form-error {
  margin: 13px 0 0;
  padding: 8px 10px;
  border-left: 3px solid var(--red);
  background: #fff0eb;
  color: var(--red-deep);
  font-size: 11px;
}

.panel-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.record-state {
  padding: 5px 8px;
  border: 1px solid var(--rule-dark);
  border-radius: 2px;
  color: var(--ink-faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.record-state.is-ready {
  border-color: var(--green);
  color: var(--green);
}

.record-state.is-loading {
  border-color: var(--cobalt);
  color: var(--cobalt);
}

.record-state.is-error {
  border-color: var(--red);
  color: var(--red);
}

.empty-index {
  display: grid;
  max-width: 620px;
  margin: 0;
  border-top: 1px solid var(--rule);
  grid-template-columns: repeat(3, 1fr);
}

.empty-index div {
  padding: 13px 10px 10px 0;
  border-bottom: 1px solid var(--rule);
}

.empty-index div + div {
  padding-left: 13px;
  border-left: 1px solid var(--rule);
}

.empty-index dt {
  color: var(--cobalt);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.empty-index dd {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 10px;
}

.profile-loading {
  padding: 50px 0 30px;
}

.skeleton {
  overflow: hidden;
  background: var(--paper-deep);
}

.skeleton::after {
  display: block;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent);
  content: "";
  animation: shimmer 1.25s infinite ease-in-out;
}

.skeleton-label {
  width: 110px;
  height: 10px;
  margin-bottom: 18px;
}

.skeleton-title {
  width: 82%;
  height: 33px;
  margin-top: 8px;
}

.skeleton-title.short {
  width: 52%;
}

.skeleton-grid {
  display: grid;
  margin: 37px 0 30px;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.skeleton-card {
  height: 84px;
}

.skeleton-block {
  height: 95px;
  margin-top: 11px;
}

.profile-content {
  padding-top: 28px;
  animation: profile-in 560ms var(--ease) both;
}

.profile-idline {
  display: flex;
  margin-bottom: 11px;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--cobalt);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.profile-idline span + span::before {
  margin-right: 8px;
  color: var(--red);
  content: "•";
}

.profile-title {
  max-width: 820px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(34px, 3.4vw, 55px);
  font-weight: 600;
  letter-spacing: -0.047em;
  line-height: 0.99;
}

.profile-meta {
  display: flex;
  margin-top: 16px;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.status-pill,
.neutral-pill {
  display: inline-flex;
  min-height: 24px;
  padding: 4px 8px;
  align-items: center;
  border: 1px solid var(--green);
  border-radius: 20px;
  color: var(--green);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-pill.is-inactive {
  border-color: var(--red);
  color: var(--red);
}

.neutral-pill {
  border-color: var(--rule-dark);
  color: var(--ink-soft);
}

.identity-grid {
  display: grid;
  margin: 30px 0 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  grid-template-columns: repeat(3, 1fr);
}

.identity-cell {
  min-width: 0;
  padding: 15px 12px 15px 0;
}

.identity-cell + .identity-cell {
  padding-left: 14px;
  border-left: 1px solid var(--rule);
}

.identity-cell dt,
.metric-card dt {
  color: var(--ink-faint);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.identity-cell dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 600;
}

.profile-section {
  margin-top: 29px;
}

.section-heading {
  display: flex;
  margin-bottom: 11px;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}

.section-heading h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.section-heading span {
  color: var(--ink-faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.address-block {
  margin: 0;
  padding: 15px 17px;
  border-left: 3px solid var(--cobalt);
  background: var(--paper-deep);
  font-size: 13px;
}

.address-block a {
  display: inline-block;
  margin-top: 8px;
  color: var(--cobalt);
  font-size: 11px;
  font-weight: 700;
  text-underline-offset: 3px;
}

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

.metric-card {
  min-width: 0;
  margin: 0;
  padding: 14px 12px;
  border: 1px solid var(--rule);
  background: rgba(244, 240, 230, 0.5);
}

.metric-card.is-primary {
  border-color: var(--cobalt);
  background: var(--cobalt);
  color: white;
}

.metric-card.is-primary dt {
  color: #cbd9fa;
}

.metric-card dd {
  margin: 6px 0 0;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: clamp(17px, 1.7vw, 26px);
  font-weight: 600;
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card small {
  margin-left: 3px;
  font-family: var(--font-body);
  font-size: 8px;
  letter-spacing: 0.06em;
}

.data-table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--rule-dark);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  white-space: nowrap;
}

.data-table th,
.data-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--rule);
  text-align: right;
}

.data-table th:first-child,
.data-table td:first-child {
  padding-left: 0;
  text-align: left;
}

.data-table th {
  color: var(--ink-faint);
  font-size: 8px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.financial-year-cell {
  vertical-align: middle;
}

.publication-badge {
  display: inline-flex;
  padding: 2px 5px;
  border: 1px solid rgba(23, 63, 145, 0.25);
  border-radius: 999px;
  color: var(--cobalt);
  background: var(--cobalt-pale);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
  margin-left: 6px;
  vertical-align: middle;
}

.entity-list {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 6px;
  list-style: none;
}

.entity-list li {
  display: grid;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 15px;
  font-size: 11px;
}

.entity-list strong {
  font-size: 12px;
}

.entity-list span {
  color: var(--ink-soft);
  font-size: 9px;
  text-align: right;
  text-transform: uppercase;
}

.caen-list {
  display: flex;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
  gap: 7px;
  list-style: none;
}

.caen-list li {
  display: inline-flex;
  padding: 7px 9px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: rgba(244, 240, 230, 0.52);
  font-size: 9px;
}

.caen-list strong {
  color: var(--cobalt);
  font-size: 11px;
}

.caen-list .is-primary {
  border-color: var(--cobalt);
}

.empty-data {
  margin: 0;
  padding: 12px 14px;
  border: 1px dashed var(--rule-dark);
  color: var(--ink-soft);
  font-size: 11px;
}

.source-box {
  display: grid;
  padding: 14px 16px;
  border: 1px solid var(--cobalt);
  background: var(--cobalt-pale);
  grid-template-columns: auto 1fr;
  gap: 12px;
}

.source-box-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--cobalt);
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
}

.source-box strong {
  display: block;
  color: var(--cobalt);
  font-size: 11px;
}

.source-box p {
  margin: 3px 0 0;
  color: #32466f;
  font-size: 9px;
}

.coverage-list {
  display: flex;
  margin-top: 8px;
  flex-wrap: wrap;
  gap: 5px;
}

.coverage-list span {
  padding: 3px 6px;
  border: 1px solid rgba(23, 63, 145, 0.27);
  border-radius: 10px;
  color: #32466f;
  font-size: 8px;
}

.profile-error {
  margin: 55px 0;
  padding: 23px;
  border: 1px solid var(--red);
  background: #fff0eb;
}

.profile-error h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 28px;
}

.profile-error p {
  margin: 0;
  color: var(--red-deep);
  font-size: 12px;
}

.panel-footer {
  display: flex;
  margin-top: 34px;
  padding-top: 14px;
  align-items: flex-start;
  gap: 9px;
  border-top: 1px solid var(--rule);
  color: var(--ink-faint);
}

.panel-footer > span {
  color: var(--red);
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
}

.panel-footer p {
  max-width: 550px;
  margin: 0;
  font-size: 9px;
}

.toast-region {
  position: fixed;
  z-index: 50;
  right: 20px;
  bottom: 20px;
  display: grid;
  width: min(360px, calc(100vw - 40px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 14px;
  border: 1px solid var(--ink);
  border-left: 4px solid var(--red);
  background: var(--paper-light);
  box-shadow: var(--shadow-hard);
  font-size: 11px;
  animation: toast-in 260ms var(--ease) both;
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
}

@keyframes profile-in {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
}

@keyframes typing {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@keyframes shimmer {
  from {
    transform: translateX(-120%);
  }
  to {
    transform: translateX(300%);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@media (max-width: 1120px) {
  .app-layout {
    grid-template-columns: minmax(430px, 0.9fr) minmax(440px, 1.1fr);
  }

  .chat-column {
    padding-right: 36px;
  }

  .filter-grid-location {
    grid-template-columns: 1fr 1fr;
  }

  .filter-grid-location label:last-child {
    grid-column: 1 / -1;
  }

  .filter-grid-turnover {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  .site-header {
    width: min(100% - 34px, 760px);
  }

  .source-signal .signal-rule,
  .source-signal #global-source-date {
    display: none;
  }

  .app-layout {
    display: block;
    width: min(100% - 34px, 760px);
  }

  .chat-column {
    padding: 45px 0 70px;
  }

  .registry-panel {
    position: relative;
    min-height: 700px;
    margin: 0 -17px;
    padding: 40px max(24px, 5vw) 28px;
    border-top: 1px solid var(--ink);
    border-right: 0;
  }

  .chat-intro h1 {
    font-size: clamp(47px, 10vw, 70px);
  }

  .conversation {
    max-height: 520px;
  }
}

@media (max-width: 580px) {
  .site-header {
    width: calc(100% - 28px);
    min-height: 78px;
  }

  .brand-mark {
    width: 43px;
    height: 43px;
    font-size: 20px;
  }

  .brand-copy strong {
    font-size: 21px;
  }

  .brand-copy small {
    display: none;
  }

  .source-signal {
    font-size: 9px;
  }

  .app-layout {
    width: calc(100% - 28px);
  }

  .chat-column {
    padding-top: 36px;
  }

  .chat-intro h1 {
    font-size: clamp(42px, 13.5vw, 60px);
  }

  .chat-intro > p:last-child {
    margin-top: 17px;
    font-size: 14px;
  }

  .conversation {
    max-height: 480px;
    margin-top: 29px;
  }

  .message {
    max-width: 98%;
    gap: 8px;
  }

  .message-avatar {
    width: 28px;
    height: 28px;
    font-size: 10px;
  }

  .message-body {
    padding: 12px 13px;
    font-size: 13px;
  }

  .result-list {
    width: calc(100% - 36px);
    margin-left: 36px;
  }

  .result-card-title {
    white-space: normal;
  }

  .quick-examples {
    align-items: flex-start;
  }

  .quick-examples > span {
    width: 100%;
  }

  .composer {
    padding-left: 13px;
  }

  .send-button {
    width: 48px;
    padding: 0;
  }

  .send-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .composer-help {
    display: none;
  }

  .advanced-search {
    margin-top: 35px;
  }

  .filter-grid-location,
  .filter-grid-pair,
  .filter-grid-turnover {
    grid-template-columns: 1fr 1fr;
  }

  .filter-grid-location label:last-child {
    grid-column: 1 / -1;
  }

  .filter-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .sort-control {
    width: 100%;
  }

  .filter-submit {
    justify-content: space-between;
  }

  .registry-panel {
    margin: 0 -14px;
    padding-right: 20px;
    padding-left: 20px;
  }

  .empty-index,
  .identity-grid,
  .financial-highlight {
    grid-template-columns: 1fr;
  }

  .empty-index div + div,
  .identity-cell + .identity-cell {
    padding-left: 0;
    border-left: 0;
  }

  .identity-cell + .identity-cell {
    border-top: 1px solid var(--rule);
  }

  .identity-cell {
    padding: 11px 0;
  }

  .financial-highlight {
    gap: 6px;
  }

  .metric-card dd {
    font-size: 23px;
  }

  .entity-list li {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .entity-list span {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --rule: #77736b;
    --ink-soft: #34373d;
    --ink-faint: #4e514e;
  }

  .paper-noise {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Relații — registrul ca hartă editorială, nu ca diagramă generică
   -------------------------------------------------------------------------- */

.sidebar-view-tabs {
  display: grid;
  padding-top: 7px;
  border-top: 1px solid var(--rule);
  gap: 2px;
}

.sidebar-view-tab {
  text-decoration: none;
}

.sidebar-view-tab.is-active {
  color: var(--cobalt);
  background: var(--cobalt-pale);
  font-weight: 700;
}

.sidebar-view-tab.is-active::after {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--cobalt);
  content: "";
}

.app-shell.is-relations-view .history-section {
  display: none;
}

.app-shell:not(.sidebar-collapsed) .relations-sidebar-open-button {
  display: none;
}

.relations-main {
  position: relative;
  min-width: 0;
  height: 100dvh;
  flex: 1;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper-light);
}

.relations-main[hidden] {
  display: none;
}

.chat-main[hidden] {
  display: none;
}

.relations-view {
  height: calc(100dvh - var(--topbar-height));
  padding: clamp(18px, 2.4vw, 34px) clamp(20px, 3.7vw, 58px) 44px;
  overflow: auto;
  scrollbar-color: var(--rule-dark) transparent;
}

.relations-intro {
  width: min(100%, 1480px);
  margin: 0 auto;
}

.relations-search-form {
  width: min(100%, 820px);
  margin: 0 auto;
  min-width: 0;
}

.relations-search-box {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 10px;
  padding: 7px 7px 7px 17px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  box-shadow: 4px 4px 0 var(--paper-deep);
}

.relations-search-box:focus-within {
  border-color: var(--cobalt);
  box-shadow: 4px 4px 0 var(--cobalt-pale);
}

.relations-search-box > svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--cobalt);
  stroke-linecap: round;
  stroke-width: 1.7;
}

.relations-search-box input {
  min-width: 0;
  height: 42px;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
}

.relations-search-box input::placeholder {
  color: var(--ink-faint);
}

.relations-search-box button {
  min-width: 86px;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 5px;
  color: #fff;
  background: var(--cobalt);
  font-size: 10px;
  font-weight: 700;
}

.relations-search-box button:hover:not(:disabled) {
  background: var(--cobalt-bright);
}

.relations-search-box button:disabled {
  opacity: 0.62;
  cursor: wait;
}

.relations-search-kind {
  display: flex;
  margin: 10px 0 0;
  padding: 0;
  border: 0;
  gap: 5px;
}

.relations-search-kind label {
  cursor: pointer;
}

.relations-search-kind input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.relations-search-kind span {
  display: grid;
  min-height: 32px;
  padding: 6px 11px;
  place-items: center;
  border: 1px solid var(--rule-dark);
  border-radius: 999px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 9px;
  font-weight: 700;
}

.relations-search-kind input:checked + span {
  border-color: var(--ink);
  color: #fff;
  background: var(--ink);
}

.relations-search-kind input:focus-visible + span {
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
}

#relations-search-help {
  margin: 8px 2px 0;
  color: var(--ink-faint);
  font-size: 9px;
}

.relations-search-history {
  min-width: 0;
  margin: 12px 2px 0;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}

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

.relations-search-history-heading {
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.relations-search-history-heading > div {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 7px;
}

.relations-search-history-heading h2 {
  margin: 0;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.relations-search-history-heading span {
  color: var(--ink-faint);
  font-size: 8px;
}

.relations-search-history-clear {
  min-height: 28px;
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 6px;
  color: var(--ink-faint);
  background: transparent;
  font-size: 8px;
  font-weight: 650;
}

.relations-search-history-clear:hover {
  color: var(--red-deep);
  background: rgba(182, 56, 49, 0.08);
}

.relations-search-history-list {
  display: flex;
  min-width: 0;
  margin: 5px -2px 0;
  padding: 2px 2px 7px;
  gap: 6px;
  overflow-x: auto;
  list-style: none;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--rule-dark) transparent;
  scrollbar-width: thin;
}

.relations-search-history-item {
  display: inline-flex;
  max-width: min(290px, 72vw);
  min-height: 34px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--rule-dark);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
}

.relations-search-history-item:hover,
.relations-search-history-item:focus-within {
  border-color: var(--cobalt);
  background: var(--cobalt-pale);
}

.relations-search-history-replay {
  display: inline-flex;
  min-width: 0;
  min-height: 32px;
  padding: 6px 6px 6px 11px;
  align-items: center;
  gap: 7px;
  border-radius: 999px 0 0 999px;
  background: transparent;
  text-align: left;
}

.relations-search-history-kind {
  flex: 0 0 auto;
  color: var(--cobalt);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.relations-search-history-query {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relations-search-history-remove {
  display: grid;
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  place-items: center;
  border-left: 1px solid var(--rule);
  border-radius: 0 999px 999px 0;
  color: var(--ink-faint);
  background: transparent;
  font-size: 14px;
  line-height: 1;
}

.relations-search-history-remove:hover {
  color: var(--red-deep);
  background: rgba(182, 56, 49, 0.1);
}

.relations-search-history-replay:focus-visible,
.relations-search-history-remove:focus-visible,
.relations-search-history-clear:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--cobalt);
  outline-offset: -2px;
}

.relations-workbench {
  display: grid;
  width: min(100%, 1480px);
  min-height: 660px;
  margin: 18px auto 0;
  border: 1px solid var(--ink);
  background: #fff;
  grid-template-columns: minmax(205px, 250px) minmax(520px, 1fr) minmax(205px, 250px);
  box-shadow: 6px 6px 0 var(--paper-deep);
}

.relations-results-panel,
.relations-detail-panel,
.relations-graph-panel {
  min-width: 0;
}

.relations-results-panel,
.relations-detail-panel {
  background: var(--paper-light);
}

.relations-results-panel {
  border-right: 1px solid var(--rule-dark);
}

.relations-detail-panel {
  border-left: 1px solid var(--rule-dark);
}

.relations-panel-heading {
  display: flex;
  min-height: 54px;
  padding: 13px 14px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule);
}

.relations-panel-heading > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.relations-panel-heading span,
.relations-graph-header .relations-graph-kicker {
  color: var(--cobalt);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.relations-panel-heading h2,
.relations-graph-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
}

.relations-panel-heading small {
  color: var(--ink-faint);
  font-size: 8px;
  font-weight: 600;
}

.relations-results {
  display: grid;
  max-height: 604px;
  padding: 8px;
  overflow: auto;
  align-content: start;
  gap: 5px;
  scrollbar-width: thin;
}

.relations-results-empty,
.relations-results-message {
  padding: 42px 14px;
  color: var(--ink-faint);
  text-align: center;
}

.relations-results-empty span {
  display: block;
  color: var(--cobalt);
  font-family: var(--font-display);
  font-size: 25px;
}

.relations-results-empty p,
.relations-results-message p {
  margin: 8px 0 0;
  font-size: 10px;
}

.relations-results-message strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}

.relations-results-message.is-error strong,
.relations-results-message.is-error p {
  color: var(--red);
}

.relations-results-message.is-partial {
  padding: 10px;
  border: 1px solid rgba(145, 94, 19, 0.32);
  border-radius: 5px;
  color: #6d4812;
  background: #fff8e9;
  text-align: left;
}

.relations-results-message.is-partial strong {
  color: #6d4812;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
}

.relations-results-message.is-partial p {
  margin-top: 4px;
}

.relations-result-card {
  display: grid;
  width: 100%;
  min-height: 66px;
  padding: 9px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  grid-template-columns: 31px minmax(0, 1fr) 18px;
  gap: 9px;
  text-align: left;
  animation: relations-result-in 280ms var(--ease) both;
  animation-delay: calc(var(--result-index) * 36ms);
}

.relations-result-card:hover,
.relations-result-card.is-selected {
  border-color: var(--rule-dark);
  background: var(--paper-deep);
}

.relations-result-card.is-selected {
  border-left: 3px solid var(--cobalt);
}

.relations-result-kind {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--cobalt);
  border-radius: 4px;
  color: var(--cobalt);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
}

.relations-result-kind.is-administrator {
  border-radius: 50%;
  border-color: var(--green);
  color: var(--green);
}

.relations-result-copy {
  display: grid;
  min-width: 0;
}

.relations-result-copy strong {
  overflow: hidden;
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
}

.relations-result-copy small {
  overflow: hidden;
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 8px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relations-result-arrow {
  color: var(--cobalt);
  font-size: 16px;
}

.relations-results-loading {
  display: grid;
  padding: 8px 0;
  gap: 7px;
}

.relations-results-loading i {
  height: 64px;
  overflow: hidden;
  border-radius: 5px;
  background: var(--paper-deep);
}

.relations-results-loading i::after {
  display: block;
  width: 38%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.78), transparent);
  content: "";
  animation: shimmer 1.15s infinite ease-in-out;
}

.relations-graph-panel {
  display: flex;
  min-height: 660px;
  flex-direction: column;
  background: #fbfaf7;
}

.relations-graph-header {
  display: flex;
  min-height: 74px;
  padding: 13px 17px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-light);
}

.relations-graph-header h2 {
  max-width: 430px;
  margin-top: 2px;
  overflow: hidden;
  font-size: 21px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relations-graph-header p {
  max-width: 240px;
  margin: 0;
  color: var(--ink-faint);
  font-size: 8px;
  text-align: right;
}

.relations-graph-stage {
  position: relative;
  isolation: isolate;
  min-height: 530px;
  flex: 1;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.76), rgba(241, 246, 247, 0.68)), #f7faf9;
}

.relations-graph {
  width: 100%;
  height: 100%;
  min-height: 530px;
  outline: none;
}

.relations-graph:focus-visible {
  box-shadow: inset 0 0 0 3px var(--cobalt);
}

/* React Flow relationship explorer */
.relations-flow-explorer,
.relations-flow-explorer .react-flow {
  width: 100%;
  height: 100%;
  min-height: 530px;
}

.relations-flow-explorer {
  position: relative;
  color: var(--ink);
  font-family: var(--font-body);
}

.relations-flow-explorer .react-flow__pane {
  cursor: grab;
}

.relations-flow-explorer .react-flow__pane.dragging,
.relations-flow-explorer .react-flow__node.dragging {
  cursor: grabbing;
}

.relations-flow-explorer .react-flow__node.dragging .relations-flow-node {
  cursor: grabbing;
}

.relations-flow-explorer .react-flow__node:not(.draggable) .relations-flow-node {
  cursor: pointer;
}

.relations-flow-explorer .react-flow__node {
  border: 0;
  outline: 0;
}

.relations-flow-explorer .react-flow__node.selected {
  z-index: 10 !important;
}

.relations-flow-explorer .react-flow__node:focus-visible .relations-flow-node {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}

.relations-flow-node {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  padding: 11px 12px 10px;
  overflow: visible;
  flex-direction: column;
  gap: 4px;
  border: 1.5px solid var(--cobalt);
  border-radius: 13px;
  color: var(--ink);
  background: linear-gradient(155deg, #fff, #eef5f9);
  box-shadow: 0 12px 28px rgba(38, 57, 70, 0.13), 3px 3px 0 rgba(24, 90, 141, 0.11);
  cursor: grab;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.relations-flow-node.is-administrator {
  border-color: var(--green);
  border-radius: 22px;
  background: linear-gradient(155deg, #fff, #eaf6f0);
  box-shadow: 0 12px 28px rgba(33, 82, 68, 0.12), 3px 3px 0 rgba(36, 112, 93, 0.11);
}

.relations-flow-node:hover {
  box-shadow: 0 17px 34px rgba(38, 57, 70, 0.17), 3px 3px 0 rgba(24, 90, 141, 0.15);
}

.relations-flow-node.is-root {
  border-width: 2.5px;
  box-shadow: 0 0 0 4px rgba(24, 90, 141, 0.11), 0 18px 38px rgba(24, 90, 141, 0.2);
}

.relations-flow-node.is-root.is-administrator {
  box-shadow: 0 0 0 4px rgba(36, 112, 93, 0.12), 0 18px 38px rgba(36, 112, 93, 0.19);
}

.relations-flow-node.is-selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--cobalt), 0 18px 38px rgba(24, 90, 141, 0.2);
}

.relations-flow-node.is-selected.is-administrator {
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--green), 0 18px 38px rgba(36, 112, 93, 0.2);
}

.relations-flow-node.is-new {
  border-color: #8c6413;
  animation: relations-node-arrive 620ms var(--ease) both;
  box-shadow: 0 0 0 5px rgba(230, 184, 79, 0.24), 0 16px 34px rgba(93, 72, 25, 0.16);
}

.relations-flow-node.is-expanded {
  border-bottom-color: var(--green);
}

.relations-flow-node.is-expanding {
  cursor: progress;
  box-shadow: 0 0 0 4px rgba(230, 184, 79, 0.25), 0 18px 38px rgba(93, 72, 25, 0.16);
}

.relations-flow-node.is-new.is-selected,
.relations-flow-node.is-expanding.is-selected {
  box-shadow:
    0 0 0 3px #fff,
    0 0 0 6px var(--cobalt),
    0 0 0 10px rgba(230, 184, 79, 0.3),
    0 18px 38px rgba(24, 90, 141, 0.2);
}

.relations-flow-node.is-administrator.is-new.is-selected,
.relations-flow-node.is-administrator.is-expanding.is-selected {
  box-shadow:
    0 0 0 3px #fff,
    0 0 0 6px var(--green),
    0 0 0 10px rgba(230, 184, 79, 0.3),
    0 18px 38px rgba(36, 112, 93, 0.2);
}

.relations-flow-node header {
  display: flex;
  min-height: 15px;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.relations-flow-node header span,
.relations-flow-node header small {
  overflow: hidden;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.relations-flow-node header span {
  color: var(--cobalt);
}

.relations-flow-node.is-administrator header span {
  color: var(--green);
}

.relations-flow-node header small {
  color: #74500d;
}

.relations-flow-node > strong {
  display: -webkit-box;
  min-height: 30px;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 750;
  letter-spacing: -0.015em;
  line-height: 1.24;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.relations-flow-node > p,
.relations-flow-node > em {
  margin: 0;
  overflow: hidden;
  font-size: 8px;
  font-weight: 650;
  line-height: 1.22;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relations-flow-node > p {
  color: var(--ink-soft);
}

.relations-flow-node > em {
  color: var(--green);
  font-size: 7px;
  font-style: normal;
}

.relations-flow-node-toolbar {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  z-index: 8;
  display: flex;
  width: max-content;
  padding: 6px;
  align-items: stretch;
  gap: 5px;
  border: 1px solid var(--ink);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 10px 28px rgba(30, 31, 29, 0.18), 3px 3px 0 rgba(30, 31, 29, 0.1);
  backdrop-filter: blur(8px);
  transform: translateX(-50%);
}

.relations-flow-node-toolbar button {
  min-width: 44px;
  min-height: 44px;
  padding: 7px 10px;
  border: 1px solid var(--rule-dark);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
}

.relations-flow-node-toolbar button:first-child {
  border-color: var(--cobalt);
  color: var(--cobalt);
}

.relations-flow-node-toolbar button:hover:not(:disabled) {
  border-color: var(--ink);
  color: #fff;
  background: var(--ink);
}

.relations-flow-node-toolbar button:focus-visible,
.relations-flow-local-error button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.relations-flow-node-toolbar button:disabled {
  border-color: #c8cbc8;
  color: #777c79;
  background: #eeefed;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.72;
}

.relations-flow-node-toolbar button.is-checking:disabled {
  cursor: progress;
  opacity: 0.9;
}

.relations-flow-node-toolbar .relations-flow-remove {
  border-color: rgba(182, 56, 49, 0.5);
  color: var(--red-deep);
  background: #fff7f5;
}

.relations-flow-node-toolbar .relations-flow-remove:hover {
  border-color: var(--red-deep);
  color: #fff;
  background: var(--red-deep);
}

.relations-flow-handle {
  width: 8px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
}

.relations-flow-node-spinner {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(140, 100, 19, 0.22);
  border-top-color: #8c6413;
  border-radius: 50%;
  animation: relation-spin 680ms linear infinite;
}

.relations-flow-explorer .react-flow__edge-path {
  stroke: #71878b;
  stroke-width: 1.8;
  vector-effect: non-scaling-stroke;
}

.relations-flow-explorer .react-flow__arrowhead polyline {
  fill: #71878b;
  stroke: #71878b;
}

.relations-flow-explorer .react-flow__edge.selected .react-flow__edge-path,
.relations-flow-explorer .react-flow__edge:focus-visible .react-flow__edge-path {
  stroke: var(--cobalt);
  stroke-width: 3.2;
  filter: drop-shadow(0 0 3px rgba(24, 90, 141, 0.28));
}

.relations-flow-explorer .react-flow__edge-text {
  fill: var(--ink-soft);
  font-size: 9px;
  font-weight: 700;
}

.relations-flow-explorer .react-flow__edge-textbg {
  fill: rgba(255, 255, 255, 0.94);
  stroke: var(--rule);
  stroke-width: 1px;
}

.relations-flow-controls.react-flow__controls {
  overflow: hidden;
  gap: 0;
  border: 1px solid var(--ink);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 4px 4px 0 rgba(30, 31, 29, 0.12);
}

.relations-flow-controls .react-flow__controls-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  background: transparent;
  font-size: 18px;
  font-weight: 700;
}

.relations-flow-controls .react-flow__controls-button:last-child {
  border-bottom: 0;
}

.relations-flow-controls .react-flow__controls-button svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.relations-flow-controls .react-flow__controls-button:hover:not(:disabled),
.relations-flow-controls .react-flow__controls-button[aria-pressed="true"] {
  color: #fff;
  background: var(--cobalt);
}

.relations-flow-controls .react-flow__controls-button:focus-visible {
  position: relative;
  z-index: 2;
  outline: 3px solid var(--ink);
  outline-offset: -4px;
}

.relations-flow-controls .react-flow__controls-button:disabled {
  color: var(--ink-faint);
  background: var(--paper-deep);
  cursor: default;
}

.relations-flow-minimap.react-flow__minimap {
  width: 178px;
  height: 118px;
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 10px;
  background: rgba(252, 253, 251, 0.96);
  box-shadow: 4px 4px 0 rgba(30, 31, 29, 0.1);
}

.relations-flow-minimap .react-flow__minimap-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.relations-flow-minimap .react-flow__minimap-mask {
  fill: rgba(24, 90, 141, 0.12);
  stroke: var(--cobalt);
  stroke-width: 1.5px;
}

.relations-flow-local-error {
  position: absolute;
  z-index: 9;
  top: 13px;
  left: 50%;
  display: flex;
  width: min(520px, calc(100% - 190px));
  min-height: 44px;
  padding: 7px 8px 7px 13px;
  transform: translateX(-50%);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--red);
  border-radius: 9px;
  color: var(--red-deep);
  background: rgba(255, 247, 245, 0.98);
  box-shadow: 0 10px 28px rgba(90, 35, 31, 0.16);
  font-size: 9px;
  font-weight: 650;
}

.relations-flow-local-error button {
  min-width: max-content;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--red);
  border-radius: 6px;
  color: #fff;
  background: var(--red);
  font-size: 8px;
  font-weight: 800;
}

.relations-flow-explorer .react-flow__attribution {
  right: 8px;
  bottom: 4px;
  color: var(--ink-faint);
  background: rgba(255, 255, 255, 0.72);
  font-size: 7px;
}

@keyframes relations-node-arrive {
  from {
    opacity: 0;
    filter: saturate(0.65) brightness(1.08);
  }
  to {
    opacity: 1;
    filter: none;
  }
}

.relations-empty-constellation {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.relations-empty-constellation i {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(24, 90, 141, 0.48);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 7px rgba(24, 90, 141, 0.045);
}

.relations-empty-constellation i::before {
  position: absolute;
  top: 5px;
  right: 12px;
  width: clamp(60px, 10vw, 150px);
  height: 1px;
  transform: rotate(var(--constellation-angle, 0deg));
  transform-origin: right center;
  background: repeating-linear-gradient(90deg, var(--rule-dark) 0 5px, transparent 5px 10px);
  content: "";
  opacity: 0.45;
}

.relations-empty-constellation i:nth-child(1) { top: 27%; left: 28%; --constellation-angle: -20deg; }
.relations-empty-constellation i:nth-child(2) { top: 52%; left: 39%; --constellation-angle: 34deg; }
.relations-empty-constellation i:nth-child(3) { top: 35%; left: 51%; --constellation-angle: -42deg; }
.relations-empty-constellation i:nth-child(4) { top: 61%; left: 61%; --constellation-angle: 18deg; }
.relations-empty-constellation i:nth-child(5) { top: 25%; left: 72%; --constellation-angle: -12deg; }
.relations-empty-constellation i:nth-child(6) { top: 70%; left: 79%; }

.relations-graph-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--cobalt);
  background: rgba(251, 250, 247, 0.86);
  backdrop-filter: blur(2px);
  font-family: var(--font-display);
  font-size: 18px;
  z-index: 20;
}

.relations-graph-loading[hidden] {
  display: none;
}

.relations-graph-loading i {
  width: 31px;
  height: 31px;
  border: 2px solid var(--cobalt-pale);
  border-top-color: var(--cobalt);
  border-radius: 50%;
  animation: relation-spin 680ms linear infinite;
}

.relations-graph-error {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(340px, calc(100% - 36px));
  padding: 18px;
  transform: translate(-50%, -50%);
  border: 1px solid var(--red);
  border-radius: 6px;
  color: var(--red);
  background: #fff7f5;
  text-align: center;
  font-size: 10px;
  z-index: 19;
}

html.has-relations-fullscreen,
html.has-relations-fullscreen body {
  overflow: hidden;
}

.relations-graph-panel:fullscreen,
.relations-graph-panel.is-relations-fullscreen-fallback {
  width: 100dvw;
  height: 100dvh;
  min-height: 100dvh;
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--paper-light);
  box-shadow: none;
}

.relations-graph-panel.is-relations-fullscreen-fallback {
  position: fixed;
  z-index: 1000;
  inset: 0;
}

.relations-graph-panel:fullscreen::backdrop {
  background: var(--paper-light);
}

.relations-graph-panel:fullscreen .relations-graph-header,
.relations-graph-panel.is-relations-fullscreen-fallback .relations-graph-header {
  flex: 0 0 auto;
  min-height: 70px;
  padding-right: max(18px, env(safe-area-inset-right));
  padding-left: max(18px, env(safe-area-inset-left));
}

.relations-graph-panel:fullscreen .relations-graph-stage,
.relations-graph-panel.is-relations-fullscreen-fallback .relations-graph-stage {
  height: auto;
  min-height: 0;
  flex: 1;
}

.relations-graph-panel:fullscreen .relations-graph,
.relations-graph-panel.is-relations-fullscreen-fallback .relations-graph,
.relations-graph-panel:fullscreen .relations-flow-explorer,
.relations-graph-panel.is-relations-fullscreen-fallback .relations-flow-explorer,
.relations-graph-panel:fullscreen .relations-flow-explorer .react-flow,
.relations-graph-panel.is-relations-fullscreen-fallback .relations-flow-explorer .react-flow {
  height: 100%;
  min-height: 0;
}

.relations-detail {
  padding: 18px 15px;
}

.relations-detail > p:first-child {
  margin: 0;
  color: var(--ink-faint);
  font-size: 10px;
}

.relations-detail-kind {
  display: inline-flex;
  padding: 3px 6px;
  border: 1px solid var(--cobalt);
  border-radius: 3px;
  color: var(--cobalt);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.relations-detail-kind.is-administrator {
  border-color: var(--green);
  color: var(--green);
}

.relations-detail h3 {
  margin: 12px 0 0;
  overflow-wrap: anywhere;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.02;
}

.relations-detail-list {
  display: grid;
  margin: 19px 0 0;
  border-top: 1px solid var(--rule-dark);
}

.relations-detail-list > div {
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
}

.relations-detail-list dt {
  color: var(--ink-faint);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.relations-detail-list dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-size: 9px;
  font-weight: 600;
}

.relations-identity-note,
.relations-truncation-note {
  margin: 13px 0 0;
  padding: 9px 10px;
  border-left: 2px solid var(--red);
  color: var(--ink-soft);
  background: #f8efec;
  font-size: 8px;
  line-height: 1.55;
}

.relations-truncation-note {
  margin: 0 0 14px;
  border-left-color: var(--yellow);
  background: #fbf6e8;
}

.relations-detail-actions {
  display: grid;
  margin-top: 16px;
  gap: 6px;
}

.relations-detail-actions button {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--cobalt);
  border-radius: 5px;
  font-size: 9px;
  font-weight: 700;
}

.relations-profile-button {
  color: #fff;
  background: var(--cobalt);
}

.relations-profile-button:hover {
  background: var(--cobalt-bright);
}

@keyframes relations-result-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}

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

@media (max-width: 1280px) {
  .relations-view {
    padding-right: 24px;
    padding-left: 24px;
  }

  .relations-workbench {
    grid-template-columns: 230px minmax(480px, 1fr);
  }

  .relations-detail-panel {
    display: grid;
    border-top: 1px solid var(--rule-dark);
    border-left: 0;
    grid-column: 1 / -1;
    grid-template-columns: 230px 1fr;
  }

  .relations-detail-panel .relations-panel-heading {
    align-items: flex-start;
    border-right: 1px solid var(--rule-dark);
    border-bottom: 0;
  }

  .relations-detail {
    display: grid;
    align-items: start;
    grid-template-columns: minmax(200px, 0.7fr) minmax(260px, 1fr) minmax(160px, 0.55fr);
    gap: 15px;
  }

  .relations-detail h3,
  .relations-detail-kind {
    grid-column: 1;
  }

  .relations-detail-list {
    margin-top: 0;
    grid-column: 2;
    grid-row: 1 / span 3;
  }

  .relations-detail-actions,
  .relations-identity-note,
  .relations-truncation-note {
    margin-top: 0;
    grid-column: 3;
  }
}

@media (max-width: 900px) {
  .relations-workbench {
    grid-template-columns: 1fr;
  }

  .relations-results-panel {
    border-right: 0;
    border-bottom: 1px solid var(--rule-dark);
  }

  .relations-results {
    display: flex;
    max-height: none;
    padding: 8px;
    overflow: auto hidden;
  }

  .relations-result-card {
    width: 230px;
    min-width: 230px;
  }

  .relations-graph-panel {
    min-height: 610px;
  }

  .relations-detail-panel {
    display: block;
    grid-column: auto;
  }

  .relations-detail-panel .relations-panel-heading {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .relations-detail {
    display: block;
  }

  .relations-detail-list,
  .relations-detail-actions,
  .relations-identity-note,
  .relations-truncation-note {
    margin-top: 14px;
  }

}

@media (max-width: 700px) {
  .relations-view {
    padding: 30px 14px 34px;
  }

  .relations-search-box {
    min-height: 54px;
    padding-left: 13px;
  }

  .relations-search-box button {
    min-width: 70px;
  }

  .relations-search-kind {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .relations-search-kind span {
    min-height: 44px;
    padding-right: 7px;
    padding-left: 7px;
  }

  .relations-search-history-heading {
    min-height: 44px;
  }

  .relations-search-history-clear {
    min-height: 44px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .relations-search-history-list {
    margin-right: -4px;
    margin-left: -4px;
    padding-right: 4px;
    padding-left: 4px;
  }

  .relations-search-history-item,
  .relations-search-history-replay,
  .relations-search-history-remove {
    min-height: 44px;
  }

  .relations-search-history-remove {
    width: 44px;
    min-width: 44px;
  }

  .relations-search-history-query {
    font-size: 10px;
  }

  .relations-workbench {
    box-shadow: 3px 3px 0 var(--paper-deep);
  }

  .relations-graph-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .relations-graph-header p {
    max-width: none;
    text-align: left;
  }

  .relations-graph-stage,
  .relations-graph,
  .relations-flow-explorer,
  .relations-flow-explorer .react-flow {
    min-height: 430px;
  }

  .relations-result-card,
  .relations-flow-controls .react-flow__controls-button,
  .relations-detail-actions button,
  .relations-search-box button {
    min-height: 44px;
  }

  .relations-flow-local-error {
    top: 8px;
    width: calc(100% - 72px);
    min-height: 48px;
    align-items: stretch;
    flex-direction: column;
    gap: 7px;
  }

  .relations-flow-local-error button {
    min-height: 44px;
  }

  .relations-flow-controls.react-flow__controls {
    max-width: calc(100% - 18px);
    overflow-x: auto;
    flex-direction: row;
    bottom: max(9px, env(safe-area-inset-bottom));
    left: max(9px, env(safe-area-inset-left));
  }

  .relations-flow-controls .react-flow__controls-button {
    flex: 0 0 44px;
    border-right: 1px solid var(--rule);
    border-bottom: 0;
  }

  .relations-flow-controls .react-flow__controls-button:last-child {
    border-right: 0;
  }

  .relations-graph-panel:fullscreen .relations-graph-stage,
  .relations-graph-panel.is-relations-fullscreen-fallback .relations-graph-stage,
  .relations-graph-panel:fullscreen .relations-graph,
  .relations-graph-panel.is-relations-fullscreen-fallback .relations-graph,
  .relations-graph-panel:fullscreen .relations-flow-explorer,
  .relations-graph-panel.is-relations-fullscreen-fallback .relations-flow-explorer,
  .relations-graph-panel:fullscreen .relations-flow-explorer .react-flow,
  .relations-graph-panel.is-relations-fullscreen-fallback .relations-flow-explorer .react-flow {
    min-height: 0;
  }

}

@media (max-width: 420px) {
  .relations-view {
    padding-right: 10px;
    padding-left: 10px;
  }

  .relations-workbench {
    width: 100%;
    min-width: 0;
  }

  .relations-search-box {
    gap: 7px;
    padding-left: 10px;
  }

  .relations-search-box button {
    min-width: 64px;
    padding-right: 9px;
    padding-left: 9px;
  }

  .relations-graph-header {
    padding-right: 12px;
    padding-left: 12px;
  }

  .relations-graph-header h2 {
    max-width: calc(100vw - 54px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .relations-result-card,
  .relations-graph-loading i,
  .relations-flow-node-spinner,
  .relations-flow-node.is-new {
    animation: none;
  }

  .relations-flow-node,
  .relations-flow-node-toolbar button,
  .relations-flow-explorer .react-flow__viewport {
    transition: none;
  }

  .relations-flow-node:hover {
    transform: none;
  }
}

@media (prefers-contrast: more) {
  .relations-workbench,
  .relations-search-box,
  .relations-search-history-item,
  .relations-result-card,
  .relations-flow-node,
  .relations-flow-node-toolbar,
  .relations-flow-controls.react-flow__controls,
  .relations-flow-minimap.react-flow__minimap,
  .relations-detail-actions button {
    border-width: 2px;
  }

  .relations-flow-node-toolbar button {
    border-width: 2px;
  }

  .relations-flow-explorer .react-flow__edge-path {
    stroke: var(--ink-soft);
    stroke-width: 2.5;
  }
}

@media (forced-colors: active) {
  .relations-flow-node,
  .relations-search-history-item,
  .relations-flow-node-toolbar,
  .relations-flow-controls.react-flow__controls,
  .relations-flow-minimap.react-flow__minimap,
  .relations-flow-local-error {
    border: 2px solid CanvasText;
    box-shadow: none;
    forced-color-adjust: auto;
  }

  .relations-flow-node.is-selected,
  .relations-flow-explorer .react-flow__node:focus-visible .relations-flow-node {
    outline: 3px solid Highlight;
  }

  .relations-flow-explorer .react-flow__edge-path {
    stroke: CanvasText;
  }
}

/* Account menu and settings ------------------------------------------------ */

.sidebar-footer {
  position: relative;
}

.account-menu {
  position: absolute;
  z-index: 90;
  right: 10px;
  bottom: calc(100% + 10px);
  left: 10px;
  padding: 8px;
  border: 1px solid var(--rule-dark);
  border-radius: 18px;
  color: var(--ink);
  background: color-mix(in srgb, var(--paper-light) 96%, transparent);
  box-shadow: var(--shadow-float);
  backdrop-filter: blur(18px);
  transform-origin: 50% 100%;
  animation: account-menu-enter 150ms ease-out both;
}

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

@keyframes account-menu-enter {
  from { opacity: 0; transform: translateY(7px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.account-menu-identity {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 9px 10px;
}

.account-menu-identity .account-avatar {
  width: 38px;
  height: 38px;
}

.account-menu-identity > span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.account-menu-identity strong,
.account-menu-identity small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-identity strong {
  font-size: 14px;
  font-weight: 700;
}

.account-menu-identity small {
  color: var(--ink-faint);
  font-size: 11px;
}

.account-menu-rule {
  height: 1px;
  margin: 0 4px 6px;
  background: var(--rule);
}

.account-menu-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 11px;
  color: var(--ink);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.account-menu-item:hover,
.account-menu-item:focus-visible {
  outline: none;
  background: var(--cobalt-pale);
}

.account-menu-item svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-menu-item > span:not(.account-menu-shortcut) {
  padding-left: 9px;
  font-size: 14px;
  font-weight: 650;
}

.account-menu-shortcut {
  color: var(--ink-faint);
  font-size: 11px;
}

.account-button.is-active {
  background: var(--cobalt-pale);
}

.settings-dialog {
  width: min(900px, calc(100vw - 32px));
  max-width: none;
  max-height: min(780px, calc(100dvh - 32px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--rule-dark);
  border-radius: 24px;
  color: var(--ink);
  background: var(--paper-light);
  box-shadow: 0 30px 90px rgba(26, 31, 34, .24);
}

.settings-dialog::backdrop {
  background: rgba(25, 29, 31, .46);
  backdrop-filter: blur(4px);
}

.settings-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: min(680px, calc(100dvh - 34px));
  max-height: min(780px, calc(100dvh - 34px));
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 94px;
  padding: 20px 24px 18px 28px;
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper-light) 92%, var(--cobalt-pale));
}

.settings-header p,
.settings-panel-heading > span {
  margin: 0 0 3px;
  color: var(--cobalt);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.settings-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(29px, 4vw, 38px);
  font-weight: 600;
  line-height: .95;
}

.settings-close {
  flex: 0 0 auto;
  border: 1px solid transparent;
}

.settings-layout {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.settings-tabs {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 18px 12px;
  border-right: 1px solid var(--rule);
  background: var(--paper);
}

.settings-tab {
  display: grid;
  grid-template-columns: 21px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--ink-soft);
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.settings-tab svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-tab:hover {
  color: var(--ink);
  background: var(--paper-deep);
}

.settings-tab.is-active {
  border-color: color-mix(in srgb, var(--cobalt) 25%, var(--rule));
  color: var(--cobalt-bright);
  background: var(--cobalt-pale);
}

.settings-tab:focus-visible,
.preference-option:has(input:focus-visible) {
  outline: 3px solid color-mix(in srgb, var(--cobalt) 36%, transparent);
  outline-offset: 2px;
}

.settings-panels {
  min-width: 0;
  overflow: auto;
  background: var(--paper-light);
}

.settings-panel {
  min-height: 100%;
  padding: 34px clamp(26px, 5vw, 54px) 48px;
}

.settings-panel[hidden] {
  display: none;
}

.settings-panel-heading {
  max-width: 610px;
  padding-bottom: 27px;
}

.settings-panel-heading h3,
.settings-placeholder h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(27px, 3.4vw, 39px);
  font-weight: 560;
  line-height: 1.05;
}

.settings-panel-heading p,
.settings-placeholder p {
  max-width: 560px;
  margin: 0;
  color: var(--ink-faint);
  font-size: 13px;
  line-height: 1.6;
}

.preference-group {
  margin: 0;
  padding: 25px 0 29px;
  border: 0;
  border-top: 1px solid var(--rule);
}

.preference-group legend {
  float: left;
  width: 100%;
  margin: 0 0 3px;
  padding: 0;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
}

.preference-group > p {
  clear: both;
  margin: 0 0 17px;
  color: var(--ink-faint);
  font-size: 12px;
  line-height: 1.55;
}

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

.preference-option {
  position: relative;
  display: grid;
  grid-template-columns: minmax(68px, .72fr) minmax(0, 1fr) 22px;
  align-items: center;
  gap: 13px;
  min-height: 104px;
  padding: 13px;
  overflow: hidden;
  border: 1px solid var(--rule-dark);
  border-radius: 16px;
  background: var(--paper-light);
  cursor: pointer;
}

.preference-option:hover {
  border-color: color-mix(in srgb, var(--cobalt) 46%, var(--rule-dark));
  box-shadow: 0 7px 22px rgba(38, 52, 60, .08);
}

.preference-option:has(input:checked) {
  border-color: var(--cobalt);
  background: color-mix(in srgb, var(--cobalt-pale) 68%, var(--paper-light));
  box-shadow: inset 0 0 0 1px var(--cobalt);
}

.preference-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.preference-preview {
  display: grid;
  grid-template-columns: 19px 1fr;
  grid-template-rows: repeat(2, 1fr);
  gap: 4px;
  width: 100%;
  height: 68px;
  padding: 6px;
  border: 1px solid #cbd0d0;
  border-radius: 9px;
  background: #f7f6f2;
}

.preference-preview i {
  display: block;
  border-radius: 3px;
  background: #e3e7e8;
}

.preference-preview i:first-child {
  grid-row: 1 / 3;
  background: #dce9f1;
}

.preference-preview i:last-child {
  background: #bdd4e2;
}

.preference-preview.is-dark {
  border-color: #4d565a;
  background: #171c1e;
}

.preference-preview.is-dark i {
  background: #30383b;
}

.preference-preview.is-dark i:first-child {
  background: #223745;
}

.preference-preview.is-dark i:last-child {
  background: #316f91;
}

.preference-option-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.preference-option-copy strong {
  color: var(--ink);
  font-size: 13px;
}

.preference-option-copy small {
  color: var(--ink-faint);
  font-size: 10px;
  line-height: 1.35;
}

.preference-check {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border: 1px solid var(--rule-dark);
  border-radius: 50%;
  color: transparent;
  font-size: 12px;
  font-weight: 800;
}

.preference-option:has(input:checked) .preference-check {
  border-color: var(--cobalt);
  color: white;
  background: var(--cobalt);
}

.preference-option.is-compact {
  grid-template-columns: 54px minmax(0, 1fr) 22px;
  min-height: 78px;
}

.currency-mark {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 1px solid var(--rule-dark);
  border-radius: 14px;
  color: var(--cobalt-bright);
  background: var(--paper);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
}

.preference-status {
  min-height: 19px;
  margin: 12px 0 0 !important;
  color: var(--green) !important;
}

.settings-placeholder {
  position: relative;
  display: grid;
  align-content: center;
  min-height: 100%;
  overflow: hidden;
}

.settings-placeholder-number {
  position: absolute;
  right: 28px;
  bottom: -50px;
  color: color-mix(in srgb, var(--cobalt) 8%, transparent);
  font-family: var(--font-display);
  font-size: 260px;
  line-height: 1;
  pointer-events: none;
}

.settings-placeholder > *:not(.settings-placeholder-number) {
  position: relative;
  z-index: 1;
}

.settings-placeholder em {
  justify-self: start;
  margin-top: 20px;
  padding: 6px 10px;
  border: 1px solid var(--rule-dark);
  border-radius: 999px;
  color: var(--ink-faint);
  font-size: 10px;
  font-style: normal;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.settings-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 25px;
  border-top: 1px solid var(--rule);
  color: var(--ink-faint);
  background: var(--paper);
}

.settings-footer p {
  margin: 0;
  font-size: 10px;
}

.settings-saved-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 13%, transparent);
}

@media (max-width: 720px) {
  .settings-dialog {
    width: calc(100vw - 14px);
    max-height: calc(100dvh - 14px);
    border-radius: 18px;
  }

  .settings-shell {
    min-height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .settings-header {
    min-height: 78px;
    padding: 15px 16px 13px 20px;
  }

  .settings-layout {
    display: flex;
    flex-direction: column;
  }

  .settings-tabs {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 4px;
    padding: 8px 10px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    scrollbar-width: none;
  }

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

  .settings-tab {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0 10px;
  }

  .settings-tab svg { width: 17px; }

  .settings-panels { flex: 1 1 auto; }

  .settings-panel {
    padding: 25px 18px 36px;
  }

  .settings-panel-heading { padding-bottom: 21px; }

  .preference-options {
    grid-template-columns: 1fr;
  }

  .preference-option {
    min-height: 84px;
  }

  .preference-preview {
    height: 56px;
  }
}

/* Explicit dark theme ------------------------------------------------------ */

html[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #101315;
  --surface: #181d20;
  --surface-raised: #1e2427;
  --surface-muted: #252b2e;
  --surface-input: #14181a;
  --surface-overlay: rgba(24, 29, 32, .96);
  --scrim: rgba(0, 0, 0, .66);
  --paper: #181c1e;
  --paper-deep: #252b2e;
  --paper-light: #181d20;
  --ink: #f2f4ef;
  --ink-soft: #c1c7c0;
  --ink-faint: #99a29a;
  --rule: #333a3d;
  --rule-dark: #536065;
  --cobalt: #69b7e8;
  --cobalt-bright: #8bcdf4;
  --cobalt-pale: #17384a;
  --green: #72c9aa;
  --red: #ff8e87;
  --red-deep: #ffaaa4;
  --yellow: #e5c36d;
  --action-bg: #225f8b;
  --action-hover: #2b76a8;
  --danger-bg: #9b3e39;
  --positive-pale: #17392f;
  --negative-pale: #411f20;
  --warning-pale: #40351d;
  --shadow-float: 0 2px 8px rgba(0, 0, 0, .32), 0 18px 46px rgba(0, 0, 0, .3);
}

html[data-theme="dark"] body,
html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .chat-main,
html[data-theme="dark"] .chat-view,
html[data-theme="dark"] .chat-scroll {
  color: var(--ink);
  background: var(--canvas);
}

html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .dossier-header,
html[data-theme="dark"] .dialog-header {
  color: var(--ink);
  background: var(--surface-overlay);
}

html[data-theme="dark"] .sidebar-action,
html[data-theme="dark"] .history-link,
html[data-theme="dark"] .history-menu-button,
html[data-theme="dark"] .account-button,
html[data-theme="dark"] .conversation-title-button,
html[data-theme="dark"] .icon-button {
  color: var(--ink);
}

html[data-theme="dark"] .skip-link,
html[data-theme="dark"] .history-popover,
html[data-theme="dark"] .history-rename-input,
html[data-theme="dark"] .composer,
html[data-theme="dark"] .starter-card,
html[data-theme="dark"] .result-card,
html[data-theme="dark"] .financial-chart,
html[data-theme="dark"] .financial-chart-tooltip,
html[data-theme="dark"] .identity-grid,
html[data-theme="dark"] .address-block,
html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .entity-list li,
html[data-theme="dark"] .source-box,
html[data-theme="dark"] .data-table-wrap,
html[data-theme="dark"] .caen-entry,
html[data-theme="dark"] .caen-list li,
html[data-theme="dark"] .caen-group,
html[data-theme="dark"] .filters-dialog,
html[data-theme="dark"] .delete-conversations-dialog,
html[data-theme="dark"] .filter-form,
html[data-theme="dark"] .filter-form input,
html[data-theme="dark"] .filter-form select,
html[data-theme="dark"] .toast,
html[data-theme="dark"] .account-menu,
html[data-theme="dark"] .settings-dialog,
html[data-theme="dark"] .settings-tabs,
html[data-theme="dark"] .settings-panels,
html[data-theme="dark"] .settings-panel,
html[data-theme="dark"] .preference-option {
  color: var(--ink);
  border-color: var(--rule);
  background: var(--surface);
}

html[data-theme="dark"] .settings-header,
html[data-theme="dark"] .settings-footer,
html[data-theme="dark"] .currency-mark,
html[data-theme="dark"] .account-menu-item:hover,
html[data-theme="dark"] .account-menu-item:focus-visible {
  color: var(--ink);
  border-color: var(--rule);
  background: var(--surface-raised);
}

html[data-theme="dark"] .preference-option:has(input:checked),
html[data-theme="dark"] .settings-tab.is-active,
html[data-theme="dark"] .account-button.is-active {
  color: var(--cobalt-bright);
  border-color: var(--cobalt);
  background: var(--cobalt-pale);
}

html[data-theme="dark"] .registry-panel.dossier-panel {
  color: var(--ink);
  background: var(--surface);
  box-shadow: -18px 0 48px rgba(0, 0, 0, .38);
}

html[data-theme="dark"] .composer-zone {
  background: linear-gradient(to bottom, transparent, var(--canvas) 28%, var(--canvas));
}

html[data-theme="dark"] .message-user .message-body,
html[data-theme="dark"] .financial-chart-empty,
html[data-theme="dark"] .panel-footer,
html[data-theme="dark"] .record-state {
  background: var(--paper-deep);
}

html[data-theme="dark"] .sidebar-action.is-primary,
html[data-theme="dark"] .send-button,
html[data-theme="dark"] .filter-submit,
html[data-theme="dark"] .metric-card.is-primary {
  color: #fff;
  background: var(--action-bg);
}

html[data-theme="dark"] .sidebar-action.is-primary:hover,
html[data-theme="dark"] .send-button:hover:not(:disabled),
html[data-theme="dark"] .filter-submit:hover {
  background: var(--action-hover);
}

html[data-theme="dark"] .metric-card.is-primary dt { color: rgba(255, 255, 255, .76); }
html[data-theme="dark"] .record-state.is-ready { background: var(--positive-pale); }
html[data-theme="dark"] .record-state.is-loading { color: var(--yellow); background: var(--warning-pale); }

html[data-theme="dark"] .record-state.is-error,
html[data-theme="dark"] .profile-error,
html[data-theme="dark"] .form-error,
html[data-theme="dark"] .message-error .message-body {
  color: var(--red);
  border-color: var(--red);
  background: var(--negative-pale);
}

html[data-theme="dark"] dialog::backdrop { background: var(--scrim); }
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select { color: var(--ink); background: var(--surface-input); caret-color: var(--cobalt); }

html[data-theme="dark"] .skeleton::after,
html[data-theme="dark"] .relations-results-loading i::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent);
}

html[data-theme="dark"] .relations-main { background: var(--canvas); }

html[data-theme="dark"] .relations-graph-panel,
html[data-theme="dark"] .relations-graph-stage {
  background: radial-gradient(circle at 50% 45%, #182126, #111719 60%, #0d1113);
}

html[data-theme="dark"] .relations-intro,
html[data-theme="dark"] .relations-results-panel,
html[data-theme="dark"] .relations-detail-panel,
html[data-theme="dark"] .relations-graph-header,
html[data-theme="dark"] .relations-detail-toggle {
  color: var(--ink);
  border-color: var(--rule);
  background: var(--surface-overlay);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .34);
}

html[data-theme="dark"] .relations-search-box,
html[data-theme="dark"] .relations-search-history-item,
html[data-theme="dark"] .relations-flow-node-toolbar,
html[data-theme="dark"] .relations-flow-node-toolbar button,
html[data-theme="dark"] .relations-flow-controls.react-flow__controls,
html[data-theme="dark"] .relations-flow-minimap.react-flow__minimap {
  color: var(--ink);
  background: var(--surface-raised);
}

html[data-theme="dark"] .relations-result-card:hover,
html[data-theme="dark"] .relations-result-card.is-selected { background: var(--cobalt-pale); }
html[data-theme="dark"] .relations-flow-node { background: linear-gradient(155deg, var(--surface-raised), var(--cobalt-pale)); }
html[data-theme="dark"] .relations-flow-node.is-administrator { background: linear-gradient(155deg, var(--surface-raised), var(--positive-pale)); }

html[data-theme="dark"] .relations-flow-explorer .react-flow__edge-path,
html[data-theme="dark"] .relations-flow-explorer .react-flow__arrowhead polyline {
  stroke: #78909a;
  fill: #78909a;
}

html[data-theme="dark"] .relations-flow-explorer .react-flow__edge-textbg {
  fill: var(--surface-raised);
  stroke: var(--rule-dark);
}

html[data-theme="dark"] .relations-flow-explorer .react-flow__attribution { background: rgba(24, 29, 32, .76); }
html[data-theme="dark"] .relations-graph-loading { background: rgba(16, 19, 21, .88); }

html[data-theme="dark"] .compare-main {
  background: linear-gradient(180deg, rgba(23, 56, 74, .38), transparent 280px), var(--canvas);
}

html[data-theme="dark"] .compare-topbar { background: linear-gradient(110deg, var(--surface), #162126); }
html[data-theme="dark"] .compare-form { background: linear-gradient(180deg, var(--canvas) 0%, var(--canvas) 82%, transparent 100%); }

html[data-theme="dark"] .compare-selector,
html[data-theme="dark"] .compare-search-control,
html[data-theme="dark"] .compare-search-results,
html[data-theme="dark"] .compare-swap-button,
html[data-theme="dark"] .compare-report-stage,
html[data-theme="dark"] .compare-report-section {
  color: var(--ink);
  border-color: var(--rule);
  background: var(--surface-raised);
}

html[data-theme="dark"] .compare-report-heading { background: linear-gradient(115deg, var(--surface-muted), var(--cobalt-pale)); }
html[data-theme="dark"] .compare-company-header { background: linear-gradient(145deg, var(--cobalt-pale), var(--surface-raised) 72%); }
html[data-theme="dark"] .compare-status-pill { background: rgba(24, 29, 32, .82); }
html[data-theme="dark"] .compare-status-pill.is-positive { background: var(--positive-pale); }

html[data-theme="dark"] .compare-status-pill.is-negative,
html[data-theme="dark"] .compare-search-message.is-error { background: var(--negative-pale); }

html[data-theme="dark"] .compare-report-section-heading,
html[data-theme="dark"] .compare-metric-label,
html[data-theme="dark"] .compare-report-note { background: var(--paper); }

@media (prefers-reduced-motion: reduce) {
  .account-menu { animation: none; }
}

@media (prefers-contrast: more) {
  html[data-theme="dark"] {
    --ink-faint: #b8beb7;
    --rule: #697378;
    --rule-dark: #899398;
  }

  .account-menu,
  .settings-dialog,
  .settings-tab,
  .preference-option {
    border-width: 2px;
  }
}

@media (forced-colors: active) {
  .account-menu,
  .settings-dialog,
  .settings-header,
  .settings-tabs,
  .settings-panels,
  .settings-footer,
  .preference-option,
  .currency-mark {
    color: CanvasText;
    border-color: CanvasText;
    background: Canvas;
    box-shadow: none;
    forced-color-adjust: auto;
  }

  .settings-tab.is-active,
  .preference-option:has(input:checked),
  .account-menu-item:focus-visible {
    color: HighlightText;
    background: Highlight;
  }
}

/* --------------------------------------------------------------------------
   FirmeAI conversation shell — familiar chat ergonomics, distinct identity
   -------------------------------------------------------------------------- */

:root {
  --paper: #f7f7f5;
  --paper-deep: #efefec;
  --paper-light: #ffffff;
  --ink: #1e1f1d;
  --ink-soft: #565853;
  --ink-faint: #83857f;
  --rule: #e5e5e1;
  --rule-dark: #cacbc5;
  --cobalt: #185a8d;
  --cobalt-bright: #0e6ba8;
  --cobalt-pale: #e6f1f7;
  --red: #b63831;
  --red-deep: #8e2823;
  --green: #24705d;
  --yellow: #e6b84f;
  --font-display: "Newsreader", Georgia, serif;
  --font-body: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  --shadow-hard: 0 18px 55px rgba(24, 34, 40, 0.14);
  --shadow-float: 0 2px 8px rgba(24, 34, 40, 0.06), 0 14px 38px rgba(24, 34, 40, 0.08);
  --sidebar-width: 268px;
  --topbar-height: 58px;
  --content-width: 780px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  min-height: 100dvh;
  color: var(--ink);
  background: var(--paper-light);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(24, 90, 141, 0.28);
  outline-offset: 2px;
}

svg {
  display: block;
}

.skip-link {
  z-index: 300;
  border: 1px solid var(--ink);
  border-radius: 9px;
  background: #fff;
  box-shadow: var(--shadow-float);
  font-size: 13px;
}

.app-shell {
  position: relative;
  display: flex;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #fff;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  color: var(--ink-soft);
  background: transparent;
  transition: color 150ms ease, background 150ms ease, transform 150ms ease;
}

.icon-button:hover {
  color: var(--ink);
  background: rgba(30, 31, 29, 0.07);
}

.icon-button:active {
  transform: scale(0.96);
}

.icon-button svg,
.sidebar-action svg,
.account-button > svg,
.starter-card > svg,
.filter-submit svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Sidebar */

.sidebar {
  position: relative;
  z-index: 70;
  display: flex;
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  flex-direction: column;
  overflow: hidden;
  color: #292a27;
  background: var(--paper);
  transition:
    width 240ms var(--ease),
    min-width 240ms var(--ease),
    transform 240ms var(--ease),
    border-color 180ms ease;
}

.sidebar-header {
  display: flex;
  min-width: var(--sidebar-width);
  height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px 7px 14px;
}

.sidebar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-glyph {
  position: relative;
  display: flex;
  width: 31px;
  height: 31px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 9px 4px 9px 9px;
  color: #fff;
  background: var(--cobalt);
  box-shadow: inset 0 -8px 18px rgba(4, 48, 79, 0.16);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  line-height: 1;
}

.brand-glyph::after {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 14px;
  height: 14px;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  content: "";
}

.brand-letter {
  display: block;
  color: #fff;
  line-height: 1;
  transform: translateY(2px);
}

.sidebar-actions {
  min-width: var(--sidebar-width);
  padding: 8px 10px 10px;
}

.sidebar-action {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 10px;
  color: #343532;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  transition: background 140ms ease, color 140ms ease;
}

.sidebar-action + .sidebar-action {
  margin-top: 2px;
}

.sidebar-action:hover {
  background: #ececea;
}

.sidebar-action.is-primary {
  margin-bottom: 8px;
  color: #fff;
  background: var(--cobalt);
  box-shadow: 0 6px 16px rgba(24, 90, 141, 0.13);
}

.sidebar-action.is-primary:hover {
  background: #124f7d;
}

.sidebar-action svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.sidebar-action span {
  min-width: 0;
  flex: 1;
}

.sidebar-action kbd {
  color: rgba(255, 255, 255, 0.62);
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 500;
}

.history-section {
  min-width: var(--sidebar-width);
  min-height: 0;
  flex: 1;
  padding: 8px 10px 12px;
  overflow: hidden auto;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.history-section:hover {
  scrollbar-color: #ccccc7 transparent;
}

.history-heading-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 9px 7px;
}

.history-heading-row h2,
.history-group h3 {
  margin: 0;
  color: #777973;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history-heading-row > span {
  color: #989a94;
  font-size: 8px;
}

.history-empty {
  margin: 4px 9px;
  color: #8b8d87;
  font-size: 11px;
  line-height: 1.55;
}

.history-group + .history-group {
  margin-top: 15px;
}

.history-group h3 {
  padding: 5px 9px;
  font-size: 9px;
}

.history-item {
  position: relative;
  display: flex;
  min-height: 38px;
  align-items: center;
  border-radius: 9px;
}

.history-item:hover,
.history-item.is-active {
  background: #e9e9e6;
}

.history-link {
  min-width: 0;
  flex: 1;
  padding: 9px 34px 9px 9px;
  overflow: hidden;
  color: #343532;
  background: transparent;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.history-menu-button {
  position: absolute;
  right: 4px;
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 7px;
  opacity: 0;
  color: #5d5f59;
  background: transparent;
  font-size: 18px;
  line-height: 1;
}

.history-item:hover .history-menu-button,
.history-item:focus-within .history-menu-button,
.history-menu-button[aria-expanded="true"] {
  opacity: 1;
}

.history-menu-button:hover {
  background: #dedeDA;
}

.history-popover {
  position: fixed;
  z-index: 210;
  width: 154px;
  padding: 5px;
  border: 1px solid var(--rule);
  border-radius: 11px;
  background: #fff;
  box-shadow: var(--shadow-float);
}

.history-popover button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 7px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-size: 11px;
}

.history-popover button:hover {
  background: var(--paper);
}

.history-popover button.is-danger {
  color: var(--red);
}

.history-rename-input {
  width: calc(100% - 10px);
  margin: 5px;
  padding: 7px 8px;
  border: 1px solid var(--cobalt);
  border-radius: 7px;
  background: #fff;
  font-size: 11px;
}

.sidebar-footer {
  min-width: var(--sidebar-width);
  padding: 8px 10px 10px;
  border-top: 1px solid rgba(30, 31, 29, 0.06);
  background: var(--paper);
}

.account-button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 7px;
  border-radius: 10px;
  background: transparent;
  text-align: left;
}

.account-button:hover {
  background: #ebebe8;
}

.account-avatar {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #263a45;
  font-size: 10px;
  font-weight: 700;
}

.account-copy {
  display: grid;
  min-width: 0;
  flex: 1;
}

.account-copy strong {
  font-size: 11px;
  font-weight: 600;
}

.account-copy small {
  color: #858781;
  font-size: 9px;
}

.account-button > svg {
  width: 17px;
  height: 17px;
}

.sidebar-backdrop {
  position: fixed;
  z-index: 60;
  inset: 0;
  background: rgba(20, 24, 27, 0.34);
  backdrop-filter: blur(1px);
}

.app-shell.sidebar-collapsed .sidebar {
  width: 0;
  min-width: 0;
}

.app-shell.sidebar-collapsed:not(.sidebar-mobile-open) .sidebar {
  border-right-color: transparent;
  pointer-events: none;
}

.app-shell:not(.sidebar-collapsed) .sidebar-open-button {
  display: none;
}

/* Main conversation area */

.chat-main {
  position: relative;
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  background: #fff;
  transition: margin-right 260ms var(--ease);
}

.topbar {
  position: relative;
  z-index: 40;
  display: flex;
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px 7px 12px;
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(16px);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 5px;
}

.conversation-title-button {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: 9px;
  background: transparent;
  text-align: left;
}

.conversation-title-button:hover {
  background: var(--paper);
}

.conversation-title-button > span {
  max-width: min(34vw, 340px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.conversation-title-button small {
  color: var(--ink-faint);
  font-size: 9px;
  font-weight: 500;
}

.conversation-title-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.top-new-chat-button {
  display: none;
}

.profile-panel-button.is-active {
  color: var(--cobalt);
  background: var(--cobalt-pale);
}

.profile-panel-button:disabled {
  cursor: not-allowed;
  opacity: 0.34;
}

.profile-panel-button:disabled:hover {
  color: var(--ink-soft);
  background: transparent;
}

.chat-view {
  position: relative;
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.chat-scroll {
  min-height: 0;
  flex: 1;
  overflow: hidden auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #d4d5d0 transparent;
}

.welcome-state {
  display: flex;
  width: min(var(--content-width), calc(100% - 40px));
  min-height: calc(100dvh - var(--topbar-height) - 160px);
  margin: 0 auto;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: 58px 0 184px;
  text-align: center;
  animation: welcome-in 520ms var(--ease) both;
}

.welcome-mark {
  position: relative;
  display: grid;
  width: 53px;
  height: 53px;
  margin-bottom: 21px;
  place-items: center;
  border: 1px solid rgba(24, 90, 141, 0.16);
  border-radius: 16px 7px 16px 16px;
  color: var(--cobalt);
  background: linear-gradient(145deg, #f5fbfe, #e8f2f8);
  box-shadow: 0 12px 30px rgba(24, 90, 141, 0.12);
  font-family: var(--font-display);
  font-size: 29px;
  font-weight: 600;
}

.welcome-mark i {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 15px;
  height: 15px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #e5b84f;
}

.welcome-kicker {
  margin: 0 0 7px;
  color: var(--cobalt);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.welcome-state h1 {
  margin: 0;
  color: #252622;
  font-family: var(--font-display);
  font-size: clamp(35px, 4.2vw, 49px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.welcome-copy {
  max-width: 520px;
  margin: 14px auto 0;
  color: #70726c;
  font-size: 12px;
  line-height: 1.65;
}

.starter-grid {
  display: grid;
  width: 100%;
  margin-top: 34px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  text-align: left;
}

.starter-card {
  display: flex;
  min-width: 0;
  min-height: 68px;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 15px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 0 rgba(20, 28, 33, 0.02);
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 180ms var(--ease), box-shadow 180ms ease;
}

.starter-card:hover {
  border-color: #d3d8d9;
  background: #fcfdfd;
  box-shadow: 0 10px 24px rgba(24, 43, 53, 0.06);
  transform: translateY(-2px);
}

.starter-card > span:nth-child(2) {
  display: grid;
  min-width: 0;
  flex: 1;
}

.starter-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 650;
}

.starter-card small {
  margin-top: 1px;
  overflow: hidden;
  color: var(--ink-faint);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
}

.starter-card > svg {
  width: 16px;
  height: 16px;
  opacity: 0;
  color: var(--cobalt);
  transform: translateX(-5px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.starter-card:hover > svg {
  opacity: 1;
  transform: translateX(0);
}

.starter-icon {
  display: grid;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 700;
}

.starter-icon.is-cui {
  color: #1d5e8a;
  background: #e6f1f7;
}

.starter-icon.is-company {
  color: #34705f;
  background: #e8f2ed;
  font-family: var(--font-display);
  font-size: 15px;
}

.starter-icon.is-name {
  color: #845d20;
  background: #f7efdc;
  font-family: var(--font-display);
  font-size: 12px;
}

.starter-icon.is-filter {
  color: #69528c;
  background: #eee9f6;
  font-size: 15px;
}

/* Transcript */

.conversation {
  width: min(var(--content-width), calc(100% - 40px));
  max-height: none;
  margin: 0 auto;
  padding: 34px 0 190px;
  overflow: visible;
}

.conversation[hidden] {
  display: none;
}

.message {
  display: flex;
  width: 100%;
  max-width: none;
  align-items: flex-start;
  gap: 13px;
  margin: 0;
  padding: 18px 0;
  animation: message-in 280ms var(--ease) both;
}

.message + .message {
  margin-top: 3px;
}

.message-avatar {
  display: grid;
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  place-items: center;
  border: 0;
  border-radius: 9px 4px 9px 9px;
  color: #fff;
  background: var(--cobalt);
  box-shadow: none;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
}

.message-body {
  max-width: min(680px, calc(100% - 42px));
  padding: 3px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #2b2c29;
  font-size: 13px;
  line-height: 1.72;
}

.message-body p {
  margin: 0;
}

.message-body p + p {
  margin-top: 7px;
}

.message-note {
  color: #80827c;
  font-size: 10px;
}

.message-user {
  justify-content: flex-end;
  padding: 13px 0;
}

.message-user .message-body {
  width: auto;
  max-width: min(78%, 610px);
  margin: 0;
  padding: 10px 14px;
  border: 0;
  border-radius: 17px 17px 4px 17px;
  color: #292a27;
  background: #f0f0ed;
  font-size: 12px;
}

.message-error .message-avatar {
  color: #fff;
  background: var(--red);
}

.message-error .message-body {
  padding: 10px 12px;
  border: 1px solid #efd5d2;
  border-radius: 12px;
  color: #7e2b26;
  background: #fff7f6;
}

.message-loading .message-body {
  display: flex;
  min-height: 29px;
  align-items: center;
  gap: 4px;
  padding: 0 2px;
  border: 0;
  background: transparent;
}

.typing-dot {
  width: 5px;
  height: 5px;
  background: #7c8b92;
}

.result-list {
  display: grid;
  width: calc(100% - 42px);
  margin: 3px 0 22px 42px;
  gap: 7px;
}

.result-card {
  position: relative;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 43px 11px 13px;
  border: 1px solid var(--rule);
  border-radius: 13px;
  color: var(--ink);
  background: #fff;
  box-shadow: none;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.result-card::after {
  right: 14px;
  width: 25px;
  height: 25px;
  border: 0;
  border-radius: 50%;
  color: var(--cobalt);
  background: var(--cobalt-pale);
  font-size: 14px;
  line-height: 25px;
  text-align: center;
  transform: none;
}

.result-card:hover {
  border-color: #c8d8df;
  background: #fbfdfe;
  box-shadow: 0 8px 24px rgba(24, 56, 73, 0.06);
  transform: translateY(-1px);
}

.result-card:hover::after {
  transform: none;
}

.result-card-title {
  max-width: 52%;
  color: #2a2b28;
  font-size: 11px;
  font-weight: 700;
}

.result-card-meta {
  justify-content: flex-end;
  color: #777a74;
  font-size: 9px;
}

/* Composer */

.composer-zone {
  position: absolute;
  z-index: 35;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 30px 20px 12px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 27%, #fff 100%);
  pointer-events: none;
}

.composer {
  display: flex;
  width: min(var(--content-width), 100%);
  min-height: 92px;
  margin: 0 auto;
  padding: 12px 12px 9px 15px;
  flex-direction: column;
  border: 1px solid #dedfdb;
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow-float);
  pointer-events: auto;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.composer:focus-within {
  border-color: #c4ccd0;
  box-shadow: 0 2px 9px rgba(24, 34, 40, 0.07), 0 18px 42px rgba(24, 34, 40, 0.1);
}

.composer textarea {
  width: 100%;
  min-height: 31px;
  max-height: 148px;
  padding: 3px 2px 5px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: #92948f;
}

.composer-toolbar {
  display: flex;
  min-height: 37px;
  align-items: flex-end;
  justify-content: space-between;
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.composer-tool-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #e1e2de;
  border-radius: 50%;
  color: #454744;
  background: #fff;
  transition: background 140ms ease, border-color 140ms ease;
}

.composer-tool-button:hover {
  border-color: #d4d5d0;
  background: var(--paper);
}

.composer-tool-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.send-button {
  display: grid;
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: #242522;
  transition: background 140ms ease, transform 140ms ease, opacity 140ms ease;
}

.send-button:hover:not(:disabled) {
  background: var(--cobalt);
  transform: translateY(-1px);
}

.send-button:disabled {
  cursor: default;
  opacity: 0.22;
}

.send-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer-help {
  width: min(var(--content-width), 100%);
  margin: 7px auto 0;
  color: #8a8c86;
  font-size: 8.5px;
  line-height: 1.4;
  text-align: center;
  pointer-events: auto;
}

/* Company dossier */

.registry-panel.dossier-panel {
  position: fixed;
  z-index: 90;
  top: 0;
  right: 0;
  display: flex;
  width: min(520px, 43vw);
  min-width: 430px;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  padding: 0;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  border-left: 1px solid var(--rule);
  color: var(--ink);
  background: #fbfbfa;
  box-shadow: -20px 0 55px rgba(25, 34, 39, 0.1);
  opacity: 0;
  transform: translateX(102%);
  transition: width 260ms var(--ease), transform 260ms var(--ease), opacity 180ms ease;
  pointer-events: none;
}

.registry-panel.dossier-panel::before,
.registry-panel.dossier-panel::after {
  display: none;
}

.registry-panel.dossier-panel.is-open {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.registry-panel.dossier-panel.is-fullscreen {
  width: 100vw;
  max-width: none;
  min-width: 0;
  border-left: 0;
  box-shadow: none;
}

.dossier-header {
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 8px 17px;
  border-bottom: 1px solid var(--rule);
  background: rgba(251, 251, 250, 0.94);
  backdrop-filter: blur(14px);
}

.dossier-header > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.dossier-header .dossier-header-actions {
  gap: 2px;
}

.fullscreen-profile-button[aria-pressed="true"] {
  color: var(--cobalt);
  background: var(--cobalt-pale);
}

.dossier-header p {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
}

.record-state {
  padding: 4px 7px;
  border: 0;
  border-radius: 999px;
  color: #74766f;
  background: #ededeb;
  font-size: 8px;
  letter-spacing: 0;
}

.record-state.is-ready {
  color: #25644f;
  background: #e5f2ec;
}

.record-state.is-loading {
  color: #6e5a22;
  background: #f5efdc;
}

.record-state.is-error {
  color: #8a302b;
  background: #f9e8e6;
}

.dossier-scroll {
  min-height: 0;
  flex: 1;
  overflow: hidden auto;
  overscroll-behavior: contain;
}

.profile-loading,
.profile-content {
  padding: 28px 25px 40px;
}

.registry-panel.dossier-panel.is-fullscreen .profile-loading,
.registry-panel.dossier-panel.is-fullscreen .profile-content {
  width: min(100%, 1180px);
  margin-inline: auto;
  padding: 36px clamp(25px, 4vw, 58px) 56px;
}

.profile-content {
  animation: profile-in 260ms var(--ease) both;
}

.profile-idline {
  color: var(--cobalt);
  font-size: 9px;
}

.profile-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 39px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.025em;
}

.profile-meta {
  margin-top: 13px;
}

.status-pill,
.neutral-pill {
  border-radius: 999px;
  box-shadow: none;
  font-size: 8px;
}

.identity-grid {
  border-color: var(--rule);
  background: #fff;
  box-shadow: none;
}

.identity-cell dt,
.metric-card dt {
  color: #7b7d77;
  font-size: 8px;
}

.identity-cell dd {
  font-size: 11px;
}

.profile-section {
  margin-top: 29px;
}

.section-heading {
  padding-bottom: 8px;
  border-color: var(--rule);
}

.section-heading h3 {
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.section-heading span {
  font-size: 8px;
}

.address-block,
.metric-card,
.entity-list li,
.source-box,
.profile-error {
  border-color: var(--rule);
  background: #fff;
  box-shadow: none;
}

.metric-card.is-primary {
  color: #fff;
  background: var(--cobalt);
}

.metric-card dd {
  font-size: 21px;
}

.data-table-wrap {
  border-color: var(--rule);
  border-radius: 11px;
  background: #fff;
}

.data-table th,
.data-table td {
  border-color: var(--rule);
  font-size: 9px;
}

.caen-list li {
  border-color: var(--rule);
  border-radius: 9px;
  background: #fff;
}

.panel-footer {
  margin: 0;
  padding: 10px 17px;
  border-top: 1px solid var(--rule);
  background: #f5f5f3;
}

.panel-footer > span {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid #b9bbb5;
  border-radius: 50%;
  font-size: 9px;
}

.panel-footer p {
  font-size: 8px;
}

@media (min-width: 1260px) {
  .app-shell.has-dossier .chat-main {
    margin-right: min(520px, 43vw);
  }

  .app-shell.has-dossier.dossier-fullscreen .chat-main {
    margin-right: 0;
  }
}

/* Advanced filters dialog */

.filters-dialog {
  width: min(760px, calc(100vw - 30px));
  max-width: none;
  max-height: min(820px, calc(100dvh - 30px));
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 22px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 28px 90px rgba(15, 26, 32, 0.22);
}

.filters-dialog::backdrop {
  background: rgba(21, 27, 30, 0.43);
  backdrop-filter: blur(3px);
}

.dialog-shell {
  max-height: min(820px, calc(100dvh - 30px));
  overflow: hidden auto;
}

.dialog-header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 18px 15px 22px;
  border-bottom: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.dialog-header p,
.dialog-header h2 {
  margin: 0;
}

.dialog-header p {
  color: var(--cobalt);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dialog-header h2 {
  margin-top: 1px;
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 500;
  line-height: 1;
}

.dialog-close-form {
  margin: 0;
}

.filter-form {
  display: block;
  padding: 4px 22px 22px;
  border: 0;
  background: #fff;
}

.filter-section {
  padding: 20px 0 18px;
  border-bottom: 1px solid var(--rule);
}

.filter-section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.filter-section-heading > span {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 8px;
  color: var(--cobalt);
  background: var(--cobalt-pale);
  font-size: 8px;
  font-weight: 700;
}

.filter-section-heading > div {
  display: grid;
}

.filter-section-heading strong {
  font-size: 11px;
}

.filter-section-heading small {
  color: var(--ink-faint);
  font-size: 8px;
}

.filter-grid {
  gap: 10px;
}

.filter-grid-location {
  grid-template-columns: 1fr 1fr 1fr;
}

.filter-grid-pair {
  grid-template-columns: 1fr 1fr;
}

.filter-grid-turnover {
  grid-template-columns: 1fr 1fr 0.65fr 0.8fr;
}

.filter-form fieldset {
  margin-top: 14px;
  padding: 0;
  border: 0;
}

.filter-form legend {
  margin-bottom: 7px;
  color: #6e706b;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.filter-form label > span {
  margin-bottom: 5px;
  color: #5e605b;
  font-size: 8px;
}

.filter-form input,
.filter-form select {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #dedfdb;
  border-radius: 9px;
  background: #fbfbfa;
  font-size: 10px;
}

.filter-form input:focus,
.filter-form select:focus {
  border-color: #84a8bd;
  outline: 3px solid rgba(24, 90, 141, 0.09);
  background: #fff;
}

.filter-form label > small {
  margin-top: 4px;
  font-size: 7px;
}

.filter-actions {
  margin-top: 18px;
}

.sort-control {
  width: min(230px, 45%);
}

.filter-submit {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 16px;
  padding: 0 15px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--cobalt);
  box-shadow: none;
  font-size: 10px;
}

.filter-submit:hover {
  color: #fff;
  background: #124f7d;
  transform: none;
}

.filter-submit svg {
  width: 15px;
  height: 15px;
}

.form-error {
  border: 1px solid #efd5d2;
  border-radius: 9px;
  color: #87312c;
  background: #fff7f6;
  font-size: 9px;
}

/* Toasts */

.toast-region {
  z-index: 260;
  right: 16px;
  bottom: 16px;
  width: min(340px, calc(100vw - 32px));
}

.toast {
  padding: 11px 13px;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--cobalt);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-float);
  font-size: 10px;
}

@keyframes welcome-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* Responsive shell */

@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(var(--sidebar-width), calc(100vw - 48px));
    min-width: min(var(--sidebar-width), calc(100vw - 48px));
    box-shadow: 18px 0 48px rgba(19, 27, 31, 0.12);
    transform: translateX(-105%);
  }

  .app-shell.sidebar-mobile-open .sidebar {
    transform: translateX(0);
  }

  .app-shell.sidebar-collapsed .sidebar {
    width: min(var(--sidebar-width), calc(100vw - 48px));
    min-width: min(var(--sidebar-width), calc(100vw - 48px));
  }

  .app-shell:not(.sidebar-collapsed) .sidebar-open-button,
  .sidebar-open-button {
    display: inline-grid;
  }

  .sidebar-collapse-button svg path:last-child {
    display: none;
  }

  .top-new-chat-button {
    display: inline-grid;
  }

  .registry-panel.dossier-panel {
    width: min(560px, 94vw);
    min-width: 0;
  }
}

@media (max-width: 700px) {
  :root {
    --topbar-height: 54px;
  }

  .dossier-header-actions .icon-button {
    width: 44px;
    height: 44px;
  }

  .topbar {
    padding-right: 8px;
    padding-left: 7px;
  }

  .conversation-title-button small,
  .conversation-title-button svg {
    display: none;
  }

  .conversation-title-button > span {
    max-width: 48vw;
    font-size: 13px;
  }

  .welcome-state {
    width: calc(100% - 28px);
    min-height: calc(100dvh - var(--topbar-height) - 135px);
    padding: 35px 0 160px;
  }

  .welcome-mark {
    width: 46px;
    height: 46px;
    margin-bottom: 16px;
    font-size: 25px;
  }

  .welcome-state h1 {
    font-size: clamp(31px, 10vw, 40px);
  }

  .welcome-copy {
    max-width: 350px;
    font-size: 11px;
  }

  .starter-grid {
    display: flex;
    margin-top: 25px;
    padding-bottom: 5px;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .starter-grid::-webkit-scrollbar {
    display: none;
  }

  .starter-card {
    width: min(280px, 78vw);
    min-width: min(280px, 78vw);
    scroll-snap-align: start;
  }

  .conversation {
    width: calc(100% - 28px);
    padding-top: 20px;
    padding-bottom: 176px;
  }

  .message {
    gap: 9px;
    padding: 13px 0;
  }

  .message-avatar {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
    font-size: 10px;
  }

  .message-body {
    max-width: calc(100% - 35px);
    font-size: 12px;
  }

  .message-user .message-body {
    max-width: 88%;
  }

  .result-list {
    width: calc(100% - 35px);
    margin-left: 35px;
  }

  .result-card {
    display: block;
    padding-right: 42px;
  }

  .result-card-title {
    display: block;
    max-width: 100%;
    white-space: normal;
  }

  .result-card-meta {
    justify-content: flex-start;
    margin-top: 5px;
  }

  .composer-zone {
    padding: 23px 10px 8px;
  }

  .composer {
    min-height: 87px;
    border-radius: 19px;
  }

  .composer-help {
    max-width: 92%;
    font-size: 7.5px;
  }

  .registry-panel.dossier-panel {
    width: 100vw;
  }

  .profile-loading,
  .profile-content {
    padding-right: 17px;
    padding-left: 17px;
  }

  .financial-highlight,
  .identity-grid {
    grid-template-columns: 1fr;
  }

  .metric-card,
  .identity-cell {
    min-width: 0;
  }

  .filters-dialog {
    width: 100vw;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }

  .dialog-shell {
    max-height: 100dvh;
  }

  .filter-form {
    padding-right: 15px;
    padding-left: 15px;
  }

  .filter-grid-location,
  .filter-grid-pair,
  .filter-grid-turnover {
    grid-template-columns: 1fr 1fr;
  }

  .filter-grid-location label:last-child {
    grid-column: 1 / -1;
  }

  .filter-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .sort-control {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .filter-grid-location,
  .filter-grid-pair,
  .filter-grid-turnover {
    grid-template-columns: 1fr;
  }

  .filter-grid-location label:last-child {
    grid-column: auto;
  }
}

@media (prefers-contrast: more) {
  .composer,
  .starter-card,
  .result-card,
  .filter-form input,
  .filter-form select {
    border-color: #8b8d87;
  }
}

/* --------------------------------------------------------------------------
   Unified registry editorial theme — final cascade
   -------------------------------------------------------------------------- */

:root {
  --paper: #f5f3ee;
  --paper-deep: #eceae4;
  --paper-light: #fdfcf9;
  --ink: #1e201d;
  --ink-soft: #565a54;
  --ink-faint: #656961;
  --rule: #dedfd8;
  --rule-dark: #c5c8c0;
  --cobalt: #1d6295;
  --cobalt-bright: #174f78;
  --cobalt-pale: #e8f2f8;
  --green: #2c715e;
  --red: #aa3d37;
  --radius-sm: 6px;
  --radius-md: 10px;
  --content-width: 860px;
  --shadow-float: 0 2px 6px rgba(24, 34, 40, 0.04), 0 14px 34px rgba(24, 34, 40, 0.07);
}

body,
.app-shell,
.chat-main,
.chat-view,
.chat-scroll {
  background: var(--paper-light);
}

#react-root {
  width: 100%;
  height: 100%;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
}

.icon-button,
.conversation-title-button {
  border-radius: 6px;
}

.icon-button:hover,
.conversation-title-button:hover {
  background: var(--paper-deep);
}

/* Shell and navigation */

.sidebar,
.sidebar-footer {
  background: var(--paper);
}

.sidebar {
  border-right: 1px solid var(--rule);
  box-shadow: none;
}

.sidebar-brand {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
}

.brand-glyph {
  width: 32px;
  height: 32px;
  border: 1px solid var(--cobalt);
  border-radius: 5px;
  color: var(--cobalt);
  background: transparent;
  box-shadow: none;
  font-size: 20px;
}

.brand-glyph::after {
  display: none;
}

.brand-letter {
  color: var(--cobalt);
  transform: translateY(1px);
}

.sidebar-action,
.account-button,
.history-item {
  border-radius: 6px;
}

.sidebar-action:hover,
.account-button:hover,
.history-item:hover,
.history-item.is-active {
  background: var(--paper-deep);
}

.sidebar-action.is-primary {
  border: 1px solid var(--cobalt);
  border-radius: 6px;
  background: var(--cobalt);
  box-shadow: none;
}

.sidebar-action.is-primary:hover {
  background: var(--cobalt-bright);
}

.history-heading-row h2,
.history-group h3,
.history-heading-row > span,
.history-empty,
.account-copy small {
  color: var(--ink-faint);
}

.history-management {
  position: sticky;
  z-index: 5;
  top: -8px;
  padding-top: 8px;
  background: var(--paper);
}

.history-heading-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.history-heading-actions > span {
  color: var(--ink-faint);
  font-size: 8px;
}

.history-select-button {
  min-height: 28px;
  padding: 4px 7px;
  border-radius: 5px;
  color: var(--cobalt);
  background: transparent;
  font-size: 9px;
  font-weight: 700;
}

.history-select-button:hover {
  background: var(--cobalt-pale);
}

.history-select-button:disabled {
  visibility: hidden;
}

.history-selection-toolbar {
  display: grid;
  padding: 3px 8px 9px;
  align-items: center;
  border-bottom: 1px solid var(--rule);
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 8px;
}

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

.history-select-all-control {
  display: inline-flex;
  min-width: 0;
  min-height: 32px;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
}

.history-select-all-control input,
.history-selection-checkbox {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--cobalt);
}

.history-selection-count {
  color: var(--ink-faint);
  font-size: 8px;
  font-weight: 600;
  white-space: nowrap;
}

.history-delete-selected {
  min-height: 32px;
  grid-column: 1 / -1;
  border: 1px solid rgba(170, 61, 55, 0.4);
  border-radius: 5px;
  color: var(--red);
  background: transparent;
  font-size: 9px;
  font-weight: 700;
}

.history-delete-selected:hover:not(:disabled) {
  color: var(--paper-light);
  background: var(--red);
}

.history-delete-selected:disabled {
  border-color: var(--rule);
  color: var(--ink-faint);
  opacity: 0.55;
  cursor: default;
}

.history-item.is-selection-item {
  min-height: 42px;
}

.history-item.is-selection-item.is-selected,
.history-item.is-selection-item.is-selected:hover {
  background: var(--cobalt-pale);
}

.history-selection-row {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 7px 9px;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.history-selection-title {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer {
  flex: 0 0 auto;
  margin-top: auto;
  border-top-color: var(--rule);
}

.account-avatar {
  border-radius: 5px;
  background: var(--cobalt);
}

.topbar {
  border-bottom: 1px solid var(--rule);
  background: rgba(253, 252, 249, 0.96);
  backdrop-filter: none;
}

.conversation-title-button > span {
  color: var(--ink);
}

.conversation-title-button small {
  color: var(--ink-faint);
}

/* Welcome */

.welcome-state {
  width: min(920px, calc(100% - 64px));
  min-height: calc(100dvh - var(--topbar-height) - 155px);
  align-items: flex-start;
  padding: 72px 0 188px;
  text-align: left;
}

.welcome-mark {
  width: 46px;
  height: 46px;
  margin-bottom: 25px;
  border: 1px solid var(--cobalt);
  border-radius: 5px;
  color: var(--cobalt);
  background: transparent;
  box-shadow: none;
  font-size: 27px;
}

.welcome-mark i {
  display: none;
}

.welcome-kicker {
  margin-bottom: 9px;
  color: var(--cobalt);
  font-size: 10px;
}

.welcome-state h1 {
  max-width: 700px;
  color: var(--ink);
  font-size: clamp(42px, 5vw, 58px);
  line-height: 0.98;
}

.welcome-copy {
  max-width: 610px;
  margin: 16px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.starter-grid {
  margin-top: 36px;
  gap: 10px;
}

.starter-card {
  min-height: 76px;
  padding: 12px 14px;
  border-color: var(--rule);
  border-radius: 6px;
  background: var(--paper-light);
  box-shadow: none;
}

.starter-card:hover {
  border-color: var(--cobalt);
  background: var(--cobalt-pale);
  box-shadow: none;
  transform: none;
}

.starter-card > svg {
  opacity: 0.52;
  transform: none;
}

.starter-card:hover > svg {
  opacity: 1;
}

.starter-icon,
.starter-icon.is-cui,
.starter-icon.is-company,
.starter-icon.is-name,
.starter-icon.is-filter {
  border-radius: 4px;
  color: var(--cobalt);
  background: var(--cobalt-pale);
}

.starter-card strong {
  font-size: 12px;
}

.starter-card small {
  color: var(--ink-faint);
  font-size: 10px;
}

/* Conversation and result cards */

.conversation {
  width: min(var(--content-width), calc(100% - 64px));
}

.message-avatar {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  border-radius: 5px;
  background: var(--cobalt);
  line-height: 1;
}

.message-body {
  color: var(--ink);
  font-size: 14px;
}

.message-note {
  color: var(--ink-faint);
  font-size: 11px;
}

.message-user .message-body {
  border: 1px solid var(--rule);
  border-radius: 7px 7px 2px 7px;
  color: var(--ink);
  background: var(--paper);
}

.result-card {
  min-height: 70px;
  border-color: var(--rule);
  border-left: 3px solid var(--cobalt);
  border-radius: 7px;
  background: var(--paper-light);
  box-shadow: none;
}

.result-card:hover {
  border-color: var(--cobalt);
  background: var(--cobalt-pale);
  box-shadow: none;
  transform: none;
}

.result-card::after {
  top: 50%;
  border-radius: 5px;
  color: var(--cobalt);
  background: transparent;
  transform: translateY(-50%);
}

.result-card:hover::after {
  transform: translate(2px, -50%);
}

.result-card-title {
  color: var(--ink);
  font-size: 12px;
}

.result-card-meta {
  color: var(--ink-faint);
  font-size: 10px;
}

/* Composer */

.composer-zone {
  background: linear-gradient(
    to bottom,
    rgba(253, 252, 249, 0),
    var(--paper-light) 28%,
    var(--paper-light)
  );
}

.composer {
  min-height: 88px;
  border-color: var(--rule-dark);
  border-radius: 10px;
  background: var(--paper-light);
  box-shadow: var(--shadow-float);
}

.composer:focus-within {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px rgba(29, 98, 149, 0.1);
}

.composer textarea:focus,
.composer textarea:focus-visible {
  outline: 0;
  box-shadow: none;
}

.composer-tool-button {
  border-color: var(--rule);
  border-radius: 6px;
  color: var(--cobalt);
  background: var(--paper-light);
}

.composer-tool-button:hover {
  border-color: var(--cobalt);
  background: var(--cobalt-pale);
}

.send-button {
  border-radius: 6px;
  background: var(--cobalt);
}

.send-button:hover:not(:disabled) {
  background: var(--cobalt-bright);
}

.composer-help {
  color: var(--ink-faint);
  font-size: 10px;
}

/* Dossier */

.registry-panel.dossier-panel {
  border-left-color: var(--rule);
  background: var(--paper-light);
  box-shadow: -18px 0 48px rgba(25, 34, 39, 0.08);
}

.registry-panel.dossier-panel.is-fullscreen {
  box-shadow: none;
}

.dossier-header {
  border-bottom-color: var(--rule);
  background: rgba(253, 252, 249, 0.96);
  backdrop-filter: none;
}

.dossier-header p,
.section-heading h3 {
  font-size: 12px;
}

.profile-idline {
  color: var(--cobalt);
  font-size: 10px;
}

.profile-title {
  color: var(--ink);
}

.registry-panel.dossier-panel.is-fullscreen .profile-title {
  font-size: clamp(38px, 3.2vw, 50px);
}

.identity-grid,
.address-block,
.metric-card,
.entity-list li,
.data-table-wrap {
  border-color: var(--rule);
  background: var(--paper-light);
  box-shadow: none;
}

.identity-cell dt,
.metric-card dt,
.data-table th,
.section-heading span {
  color: var(--ink-soft);
  font-size: 9px;
}

.metric-card {
  border-radius: 0;
}

.metric-card.is-primary {
  border-color: var(--cobalt);
  background: var(--cobalt);
}

.section-heading {
  border-bottom-color: var(--rule);
}

.panel-footer {
  border-top-color: var(--rule);
  background: var(--paper);
}

.panel-footer p {
  color: var(--ink-faint);
  font-size: 10px;
}

/* Financial charts */

.financial-charts {
  display: grid;
  margin: 14px 0 16px;
  grid-template-columns: 1fr;
  gap: 12px;
}

.financial-chart-react-root {
  min-width: 0;
}

.registry-panel.dossier-panel.is-fullscreen .financial-charts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.financial-chart {
  min-width: 0;
  margin: 0;
  padding: 14px 14px 8px;
  border: 1px solid var(--rule);
  background: var(--paper-light);
}

.financial-chart-caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
}

.financial-chart-caption strong {
  font-size: 11px;
  font-weight: 600;
}

.financial-chart-caption span {
  color: var(--ink-faint);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.financial-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: hidden;
}

.financial-chart-canvas {
  position: relative;
  min-width: 0;
  margin-top: 5px;
}

.financial-chart-gridline,
.financial-chart-zero-line {
  fill: none;
  stroke: var(--rule);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.financial-chart-zero-line {
  stroke: var(--rule-dark);
}

.financial-chart-axis-label,
.financial-chart-year,
.financial-chart-missing {
  fill: var(--ink-faint);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 500;
}

.financial-chart-line {
  fill: none;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.financial-chart-line.is-turnover {
  stroke: var(--cobalt);
}

.financial-chart-line.is-profit {
  stroke: var(--green);
}

.financial-chart-line.is-loss {
  stroke: var(--red);
}

.financial-chart-line.is-zero {
  stroke: var(--ink-faint);
}

.financial-chart-point {
  stroke: var(--paper-light);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.financial-chart-point.is-turnover {
  fill: var(--cobalt);
}

.financial-chart-point.is-profit {
  fill: var(--green);
}

.financial-chart-point.is-loss {
  fill: var(--red);
}

.financial-chart-point.is-zero {
  fill: var(--ink-faint);
}

.financial-chart-point-hit {
  position: absolute;
  z-index: 2;
  width: 44px;
  height: 44px;
  padding: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: transparent;
  touch-action: manipulation;
}

.financial-chart-point-hit:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: -9px;
}

.financial-chart-tooltip {
  position: absolute;
  z-index: 4;
  display: grid;
  width: max-content;
  max-width: min(230px, calc(100% - 16px));
  padding: 10px 12px;
  border: 1px solid var(--rule-dark);
  border-radius: 7px;
  color: var(--ink);
  background: var(--paper-light);
  box-shadow: var(--shadow-float);
  gap: 1px;
  pointer-events: auto;
}

.financial-chart-tooltip::after {
  position: absolute;
  bottom: -5px;
  left: var(--financial-tooltip-arrow-x);
  width: 8px;
  height: 8px;
  transform: translateX(-50%) rotate(45deg);
  border-right: 1px solid var(--rule-dark);
  border-bottom: 1px solid var(--rule-dark);
  background: var(--paper-light);
  content: "";
}

.financial-chart-tooltip.is-below::after {
  top: -5px;
  bottom: auto;
  border: 0;
  border-top: 1px solid var(--rule-dark);
  border-left: 1px solid var(--rule-dark);
}

.financial-chart-tooltip > span,
.financial-chart-tooltip > small {
  color: var(--ink-faint);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.financial-chart-tooltip > strong {
  font-size: 10px;
  font-weight: 600;
}

.financial-chart-tooltip > b {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.15;
}

.financial-chart-empty {
  min-height: 140px;
  margin: 8px 0 0;
  padding: 30px 12px;
  color: var(--ink-faint);
  background: var(--paper);
  font-size: 11px;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .financial-chart-point-hit,
  .financial-chart-tooltip {
    transition: none;
  }
}

/* Grouped CAEN */

.caen-section-toggle {
  display: inline-flex;
  min-height: 30px;
  padding: 5px 3px 5px 9px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 7px;
  color: var(--ink-faint);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  transition: color 160ms ease, background-color 160ms ease;
}

.caen-section-toggle::after {
  width: 8px;
  height: 8px;
  margin: 0 4px 3px 0;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  content: "";
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.caen-section-toggle[aria-expanded="true"]::after {
  margin: 3px 4px 0 0;
  transform: rotate(225deg);
}

.caen-section-toggle:hover {
  color: var(--cobalt);
  background: var(--cobalt-pale);
}

.caen-section-toggle:focus-visible {
  outline-offset: 2px;
}

.caen-section-content[hidden] {
  display: none;
}

.caen-meaning-note {
  margin: 10px 0 0;
  padding: 9px 11px;
  border-left: 2px solid var(--cobalt);
  color: var(--ink-soft);
  background: var(--cobalt-pale);
  font-size: 9px;
  line-height: 1.55;
}

.caen-meaning-note strong {
  color: var(--ink);
  font-weight: 700;
}

.caen-primary-block {
  margin-bottom: 9px;
  padding: 10px 12px 11px;
  border: 1px solid var(--cobalt);
  border-radius: 7px;
  background: var(--cobalt-pale);
}

.caen-primary-title {
  margin: 0 0 7px;
  color: var(--cobalt);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.caen-list,
.caen-group-list {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 6px;
  list-style: none;
}

.caen-entry,
.caen-list li {
  display: grid;
  min-height: 44px;
  padding: 8px 10px;
  align-items: center;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--paper-light);
  grid-template-columns: minmax(48px, auto) minmax(0, 1fr) auto;
  gap: 9px;
  font-size: 10px;
}

.caen-primary-block .caen-entry {
  min-height: 36px;
  padding: 7px 0 0;
  border: 0;
  border-top: 1px solid rgba(29, 98, 149, 0.22);
  border-radius: 0;
  background: transparent;
}

.caen-code {
  color: var(--cobalt);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.caen-entry-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.caen-label {
  min-width: 0;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.caen-explanation {
  margin: 0;
  max-width: 78ch;
  color: var(--ink-faint);
  font-size: 9px;
  line-height: 1.5;
}

.caen-primary-badge {
  padding: 3px 6px;
  border: 1px solid rgba(29, 98, 149, 0.3);
  border-radius: 999px;
  color: var(--cobalt);
  background: var(--paper-light);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.caen-groups {
  display: grid;
  gap: 7px;
}

.caen-group {
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--paper-light);
}

.caen-group-summary {
  display: flex;
  min-height: 46px;
  padding: 0 12px;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}

.caen-group-summary::-webkit-details-marker {
  display: none;
}

.caen-group-summary::after {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-right: 1.5px solid var(--ink-faint);
  border-bottom: 1.5px solid var(--ink-faint);
  content: "";
  transform: rotate(45deg) translate(-1px, 1px);
  transition: transform 160ms ease;
}

.caen-group[open] > .caen-group-summary::after {
  transform: rotate(225deg) translate(-1px, 1px);
}

.caen-group-name {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 8px;
}

.caen-group-division {
  color: var(--ink-faint);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.caen-group-description {
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
}

.caen-group-count {
  color: var(--ink-faint);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.caen-group-list {
  padding: 8px;
  border-top: 1px solid var(--rule);
}

.caen-group-summary:focus-visible {
  outline-offset: -2px;
}

/* Dialog and transient UI */

.filters-dialog {
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--paper-light);
  box-shadow: 0 24px 70px rgba(15, 26, 32, 0.18);
}

.delete-conversations-dialog {
  width: min(430px, calc(100vw - 28px));
  max-width: none;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--rule-dark);
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper-light);
  box-shadow: 0 24px 70px rgba(15, 26, 32, 0.2);
}

.delete-conversations-dialog::backdrop {
  background: rgba(19, 27, 31, 0.42);
  backdrop-filter: blur(2px);
}

.delete-conversations-shell {
  padding: 25px;
}

.delete-conversations-eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.delete-conversations-shell h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.05;
}

.delete-conversations-shell > p:not(.delete-conversations-eyebrow) {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.65;
}

.delete-conversations-actions {
  display: flex;
  margin-top: 24px;
  justify-content: flex-end;
  gap: 8px;
}

.delete-conversations-cancel,
.delete-conversations-confirm {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--rule-dark);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
}

.delete-conversations-cancel {
  color: var(--ink);
  background: var(--paper-light);
}

.delete-conversations-cancel:hover {
  background: var(--paper-deep);
}

.delete-conversations-confirm {
  border-color: var(--red);
  color: var(--paper-light);
  background: var(--red);
}

.delete-conversations-confirm:hover {
  background: #8f302b;
}

.dialog-header {
  border-bottom-color: var(--rule);
  background: rgba(253, 252, 249, 0.96);
}

.filter-form {
  background: var(--paper-light);
}

.filter-section {
  border-bottom-color: var(--rule);
}

.filter-section-heading > span,
.filter-form input,
.filter-form select,
.filter-submit,
.form-error,
.toast {
  border-radius: 6px;
}

.filter-form input,
.filter-form select {
  min-height: 44px;
  border-color: var(--rule-dark);
  background: #fff;
  font-size: 11px;
}

.filter-form label > span,
.filter-form legend,
.filter-section-heading small,
.filter-form label > small {
  color: var(--ink-faint);
  font-size: 10px;
}

.filter-submit {
  background: var(--cobalt);
}

.filter-submit:hover {
  background: var(--cobalt-bright);
}

@media (max-width: 1024px) {
  .sidebar {
    box-shadow: 16px 0 44px rgba(25, 34, 39, 0.12);
  }
}

@media (pointer: coarse) {
  .icon-button,
  .composer-tool-button,
  .send-button,
  .history-select-button,
  .history-delete-selected,
  .delete-conversations-cancel,
  .delete-conversations-confirm {
    min-width: 44px;
    min-height: 44px;
  }

  .history-select-all-control,
  .history-selection-row {
    min-height: 44px;
  }
}

@media (max-width: 700px) {
  .welcome-state {
    width: calc(100% - 28px);
    min-height: auto;
    padding: 44px 0 178px;
  }

  .welcome-state h1 {
    font-size: clamp(36px, 12vw, 46px);
  }

  .welcome-copy {
    font-size: 12px;
  }

  .starter-grid {
    display: grid;
    width: 100%;
    margin-top: 28px;
    padding: 0;
    overflow: visible;
    grid-template-columns: 1fr;
  }

  .starter-card {
    width: 100%;
    min-width: 0;
  }

  .conversation {
    width: calc(100% - 28px);
  }

  .message-body {
    font-size: 13px;
  }

  .composer-help {
    font-size: 10px;
  }

  .profile-title,
  .registry-panel.dossier-panel.is-fullscreen .profile-title {
    font-size: 32px;
  }

  .registry-panel.dossier-panel.is-fullscreen .financial-charts {
    grid-template-columns: 1fr;
  }

  .financial-chart {
    padding-right: 8px;
    padding-left: 8px;
  }

  .caen-entry,
  .caen-list li {
    grid-template-columns: minmax(45px, auto) minmax(0, 1fr);
  }

  .caen-primary-badge {
    width: max-content;
    grid-column: 2;
  }

  .filters-dialog {
    border: 0;
    border-radius: 0;
  }

  .delete-conversations-shell {
    padding: 22px 18px 18px;
  }

  .delete-conversations-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .delete-conversations-cancel,
  .delete-conversations-confirm {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .caen-section-toggle,
  .caen-section-toggle::after,
  .caen-group-summary::after {
    transition: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --ink-soft: #343731;
    --ink-faint: #454942;
    --rule: #777b73;
    --rule-dark: #555951;
  }
}

/* Relații — hartă pe tot ecranul, cu instrumentele integrate ca overlay-uri */
.relations-main {
  height: 100dvh;
  background: #f3f7f7;
}

.relations-view {
  position: relative;
  height: 100dvh;
  padding: 0;
  overflow: hidden;
}

.relations-workbench {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.relations-graph-panel {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.96), rgba(239, 246, 246, 0.84) 58%, rgba(228, 238, 238, 0.9)),
    #f2f7f7;
}

.relations-graph-stage {
  position: absolute;
  z-index: 1;
  min-height: 0;
  inset: 0;
  background:
    radial-gradient(circle, rgba(33, 93, 126, 0.12) 1px, transparent 1.3px) 0 0 / 24px 24px,
    linear-gradient(145deg, rgba(255, 255, 255, 0.74), rgba(235, 243, 243, 0.66));
}

.relations-graph,
.relations-flow-explorer,
.relations-flow-explorer .react-flow {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.relations-left-overlay {
  position: absolute;
  z-index: 40;
  top: 18px;
  left: 18px;
  display: flex;
  width: min(420px, calc(100% - 36px));
  max-height: calc(100% - 36px);
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.relations-intro,
.relations-results-panel,
.relations-detail-panel,
.relations-graph-header {
  border: 1px solid rgba(80, 93, 91, 0.24);
  border-radius: 18px;
  background: rgba(255, 255, 253, 0.96);
  box-shadow:
    0 18px 46px rgba(33, 49, 52, 0.14),
    0 2px 8px rgba(33, 49, 52, 0.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.relations-intro,
.relations-results-panel,
.relations-detail-panel {
  pointer-events: auto;
}

.relations-intro {
  width: 100%;
  padding: 9px;
}

.relations-search-form {
  width: 100%;
  margin: 0;
}

.relations-search-box {
  min-height: 56px;
  gap: 9px;
  padding: 5px;
  border: 0;
  border-radius: 13px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(63, 74, 72, 0.2);
}

.relations-search-box:focus-within {
  border-color: transparent;
  box-shadow:
    inset 0 0 0 2px var(--cobalt),
    0 0 0 4px rgba(24, 90, 141, 0.09);
}

.relations-search-box > svg {
  width: 21px;
  height: 21px;
  margin-left: 6px;
}

.relations-search-box input {
  height: 46px;
  font-size: 15px;
}

.relations-search-box #relations-search-submit {
  min-width: 82px;
  min-height: 46px;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 11px;
}

.relations-search-box .relations-sidebar-open-button {
  display: grid;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: 0 -1px 0 0;
  padding: 0;
  place-items: center;
  border-radius: 10px;
  color: var(--ink-soft);
  background: transparent;
}

.relations-search-box .relations-sidebar-open-button:hover {
  color: var(--cobalt);
  background: var(--cobalt-pale);
}

.relations-search-box .relations-sidebar-open-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.relations-search-dropdown {
  max-height: min(42dvh, 360px);
  padding: 1px 1px 2px;
  overflow: auto;
  animation: relations-search-dropdown-enter 170ms var(--ease) both;
  scrollbar-width: thin;
}

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

.relations-search-options {
  display: flex;
  min-width: 0;
  margin: 9px 4px 1px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.relations-search-kind {
  margin: 0;
  gap: 4px;
}

.relations-search-kind span {
  min-height: 34px;
  padding: 7px 12px;
  border-color: rgba(80, 93, 91, 0.24);
  background: rgba(246, 248, 246, 0.9);
  font-size: 10px;
}

#relations-search-help {
  max-width: 145px;
  margin: 0;
  font-size: 9px;
  line-height: 1.35;
  text-align: right;
}

.relations-search-history {
  margin: 9px 3px 0;
  padding-top: 9px;
}

.relations-search-history-list {
  padding-bottom: 2px;
}

.relations-search-history-item {
  background: #fff;
}

.relations-results-panel[hidden],
.relations-detail-panel[hidden] {
  display: none;
}

.relations-results-panel {
  display: flex;
  width: 100%;
  min-height: 0;
  max-height: min(48dvh, 520px);
  overflow: hidden;
  flex-direction: column;
  border-right: 1px solid rgba(80, 93, 91, 0.24);
  animation: relations-overlay-enter 180ms var(--ease) both;
}

.relations-panel-heading {
  min-height: 52px;
  padding: 10px 12px 10px 16px;
  border-bottom-color: rgba(80, 93, 91, 0.14);
}

.relations-panel-heading > div {
  gap: 0;
}

.relations-panel-heading h2 {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.relations-panel-heading-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.relations-panel-heading small {
  font-size: 10px;
}

.relations-overlay-close {
  display: grid;
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  place-items: center;
  border-radius: 9px;
  color: var(--ink-faint);
  background: transparent;
}

.relations-overlay-close:hover {
  color: var(--ink);
  background: var(--paper-deep);
}

.relations-overlay-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.relations-results {
  min-height: 0;
  max-height: none;
  padding: 7px;
  flex: 1;
}

.relations-result-card {
  min-height: 70px;
  padding: 10px;
  border-radius: 12px;
  grid-template-columns: 34px minmax(0, 1fr) 20px;
}

.relations-result-card:hover,
.relations-result-card.is-selected {
  border-color: rgba(24, 90, 141, 0.26);
  background: #edf5f9;
}

.relations-result-card.is-selected {
  border-left-width: 1px;
  box-shadow: inset 3px 0 0 var(--cobalt);
}

.relations-result-copy strong {
  font-size: 12px;
}

.relations-result-copy small {
  font-size: 10px;
}

.relations-graph-header {
  position: absolute;
  z-index: 41;
  top: 18px;
  right: 18px;
  left: auto;
  display: grid;
  width: min(360px, calc(100% - 36px));
  min-width: 270px;
  min-height: 68px;
  padding: 11px 15px 11px 17px;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  font: inherit;
  text-align: left;
  pointer-events: auto;
  cursor: pointer;
}

.relations-graph-header[hidden] {
  display: none;
}

.relations-graph-summary-copy {
  display: block;
  min-width: 0;
}

.relations-graph-kicker {
  display: block;
  color: var(--cobalt);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.09em;
  line-height: 1.25;
  text-transform: uppercase;
}

.relations-graph-header strong {
  display: block;
  overflow: hidden;
  max-width: 100%;
  margin-top: 3px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.25;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relations-graph-header:hover,
.relations-graph-header[aria-expanded="true"] {
  border-color: var(--cobalt);
  color: var(--cobalt);
}

.relations-graph-header:focus-visible {
  outline: 3px solid var(--cobalt);
  outline-offset: 3px;
}

.relations-graph-header svg {
  width: 17px;
  height: 17px;
  transition: transform 160ms var(--ease);
}

.relations-graph-header[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.relations-detail-panel {
  position: absolute;
  z-index: 40;
  top: 96px;
  right: 18px;
  display: flex;
  width: min(350px, calc(100% - 36px));
  max-height: calc(100% - 114px);
  overflow: hidden;
  flex-direction: column;
  border-left: 1px solid rgba(80, 93, 91, 0.24);
  animation: relations-overlay-enter 180ms var(--ease) both;
  pointer-events: auto;
}

.relations-detail {
  min-height: 0;
  padding: 17px;
  overflow: auto;
  scrollbar-width: thin;
}

.relations-detail h3 {
  font-size: 25px;
}

.relations-detail-list dt {
  font-size: 9px;
}

.relations-detail-list dd {
  font-size: 11px;
}

.relations-detail-actions button {
  min-height: 44px;
  border-radius: 10px;
  font-size: 10px;
}

.relations-flow-controls.react-flow__controls {
  z-index: 15;
  right: auto;
  bottom: 18px;
  left: 18px;
  border-color: rgba(46, 58, 57, 0.44);
  box-shadow: 0 12px 30px rgba(33, 49, 52, 0.14);
}

.relations-flow-minimap.react-flow__minimap {
  z-index: 14;
  right: 18px;
  bottom: 18px;
  border-color: rgba(46, 58, 57, 0.42);
  box-shadow: 0 12px 30px rgba(33, 49, 52, 0.12);
}

.relations-graph-panel:fullscreen,
.relations-graph-panel.is-relations-fullscreen-fallback {
  display: block;
}

.relations-graph-panel:fullscreen .relations-graph-header,
.relations-graph-panel.is-relations-fullscreen-fallback .relations-graph-header {
  min-height: 68px;
  padding: 11px 15px 11px 17px;
}

.relations-graph-panel:fullscreen .relations-graph-stage,
.relations-graph-panel.is-relations-fullscreen-fallback .relations-graph-stage {
  position: absolute;
  height: auto;
  inset: 0;
}

@keyframes relations-overlay-enter {
  from {
    opacity: 0;
    transform: translateY(-7px);
  }
}

@keyframes relations-search-dropdown-enter {
  from {
    opacity: 0;
    transform: translateY(-7px);
  }
}

@keyframes relations-overlay-enter-right {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
}

@keyframes relations-overlay-enter-bottom {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (max-width: 1180px) {
  .relations-graph-header {
    width: min(330px, calc(100% - 36px));
  }

  .relations-detail-panel {
    top: 96px;
    right: 18px;
    bottom: auto;
    left: auto;
    width: min(350px, calc(100% - 36px));
    max-height: min(calc(100% - 114px), 540px);
    border: 1px solid rgba(80, 93, 91, 0.24);
    border-radius: 18px;
    animation-name: relations-overlay-enter;
  }

  .relations-detail-panel .relations-panel-heading {
    border-right: 0;
    border-bottom: 1px solid rgba(80, 93, 91, 0.14);
  }

  .relations-detail {
    display: block;
  }

  .relations-flow-controls.react-flow__controls {
    top: auto;
    right: auto;
    bottom: 18px;
    left: 18px;
  }

  .relations-flow-minimap.react-flow__minimap {
    display: none;
  }
}

@media (max-width: 900px) {
  .relations-left-overlay {
    top: max(10px, env(safe-area-inset-top));
    right: 10px;
    left: 10px;
    width: auto;
    max-height: min(58dvh, 610px);
  }

  .relations-intro {
    padding: 7px;
    border-radius: 16px;
  }

  .relations-search-box {
    min-height: 54px;
  }

  .relations-search-box input {
    height: 44px;
    font-size: 16px;
  }

  .relations-search-box #relations-search-submit {
    min-width: 68px;
    min-height: 44px;
    padding-right: 11px;
    padding-left: 11px;
  }

  .relations-search-options {
    margin-top: 7px;
  }

  .relations-search-dropdown {
    max-height: min(46dvh, 390px);
  }

  #relations-search-help {
    display: none;
  }

  .relations-search-kind span {
    min-height: 44px;
    padding-right: 11px;
    padding-left: 11px;
  }

  .relations-search-history {
    margin-top: 7px;
    padding-top: 7px;
  }

  .relations-search-history-heading {
    min-height: 24px;
  }

  .relations-search-history-list {
    margin-top: 3px;
  }

  .relations-results-panel {
    max-height: min(31dvh, 310px);
    border-right: 1px solid rgba(80, 93, 91, 0.24);
    border-bottom: 1px solid rgba(80, 93, 91, 0.24);
  }

  .relations-results {
    display: grid;
    max-height: none;
    padding: 6px;
    overflow: auto;
  }

  .relations-result-card {
    width: 100%;
    min-width: 0;
  }

  .relations-detail-panel {
    top: auto;
    right: 10px;
    bottom: max(88px, calc(env(safe-area-inset-bottom) + 78px));
    left: 10px;
    width: auto;
    max-height: min(41dvh, 400px);
    border: 1px solid rgba(80, 93, 91, 0.24);
    border-radius: 18px;
    animation-name: relations-overlay-enter-bottom;
  }

  .relations-graph-header {
    top: auto;
    right: 10px;
    left: auto;
    width: min(330px, calc(100% - 20px));
    min-width: 0;
    bottom: max(10px, env(safe-area-inset-bottom));
  }

  .relations-detail-panel .relations-panel-heading {
    border-right: 0;
    border-bottom: 1px solid rgba(80, 93, 91, 0.14);
  }

  .relations-detail {
    display: block;
    padding: 15px;
  }

  .relations-detail-list,
  .relations-detail-actions,
  .relations-identity-note,
  .relations-truncation-note {
    margin-top: 14px;
  }

  .relations-flow-controls.react-flow__controls {
    top: auto;
    right: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 10px;
    max-width: calc(100% - 20px);
  }

  .relations-flow-minimap.react-flow__minimap {
    display: none;
  }

  .relations-graph-panel:fullscreen .relations-left-overlay,
  .relations-graph-panel.is-relations-fullscreen-fallback .relations-left-overlay {
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
    left: max(10px, env(safe-area-inset-left));
  }

}

@media (max-width: 540px) {
  .relations-main,
  .relations-view,
  .relations-workbench,
  .relations-graph-panel {
    width: 100vw;
    max-width: 100vw;
    min-width: 0;
  }

  .relations-left-overlay {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
  }

  .relations-search-box {
    width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .relations-search-box > svg {
    display: none;
  }

  .relations-search-box input {
    width: 0;
    flex: 1 1 0;
  }

  .relations-search-box .relations-sidebar-open-button {
    width: 42px;
    min-width: 42px;
  }

  .relations-search-box #relations-search-submit {
    width: 44px;
    min-width: 44px;
    padding: 0;
    font-size: 0;
  }

  .relations-search-box #relations-search-submit::before {
    content: "→";
    font-size: 20px;
    line-height: 1;
  }

  .relations-search-kind span {
    padding-right: 9px;
    padding-left: 9px;
    font-size: 9px;
  }

  .relations-search-history-heading span {
    display: none;
  }

  .relations-flow-controls.react-flow__controls {
    overflow-x: auto;
    flex-direction: row;
  }

  .relations-graph-header {
    bottom: max(70px, calc(env(safe-area-inset-bottom) + 60px));
  }

  .relations-detail-panel {
    bottom: max(148px, calc(env(safe-area-inset-bottom) + 138px));
  }

  .relations-flow-controls .react-flow__controls-button {
    flex: 0 0 44px;
    border-right: 1px solid var(--rule);
    border-bottom: 0;
  }

  .relations-flow-controls .react-flow__controls-button:last-child {
    border-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .relations-results-panel,
  .relations-detail-panel {
    animation: none;
  }
}

@media (pointer: coarse) {
  .relations-overlay-close {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .relations-search-kind span {
    min-height: 44px;
  }
}

/* --------------------------------------------------------------------------
   Compară — raport editorial cu două coloane perfect aliniate
   -------------------------------------------------------------------------- */

.app-shell.is-compare-view .history-section {
  display: none;
}

@media (min-width: 1025px) {
  .app-shell:not(.sidebar-collapsed) .compare-sidebar-open-button {
    display: none;
  }
}

.compare-main {
  position: relative;
  display: flex;
  min-width: 0;
  height: 100dvh;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(232, 242, 248, 0.36), transparent 280px),
    var(--paper-light);
}

.compare-main[hidden] {
  display: none;
}

.compare-topbar {
  position: relative;
  z-index: 20;
  display: flex;
  min-height: 164px;
  align-items: flex-start;
  gap: 14px;
  padding: clamp(25px, 3.2vw, 42px) clamp(22px, 4vw, 58px) 25px;
  border-bottom: 1px solid var(--rule);
  background:
    linear-gradient(110deg, rgba(253, 252, 249, 0.98), rgba(240, 247, 249, 0.94)),
    var(--paper-light);
}

.compare-topbar::after {
  position: absolute;
  right: clamp(24px, 5vw, 72px);
  bottom: -1px;
  width: min(28vw, 330px);
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--cobalt));
  content: "";
  opacity: 0.68;
}

.compare-topbar > div {
  width: min(100%, 1180px);
  min-width: 0;
}

.compare-sidebar-open-button {
  margin-top: -5px;
}

.compare-kicker {
  margin: 0 0 7px;
  color: var(--cobalt);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.compare-topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(31px, 3.6vw, 46px);
  font-weight: 500;
  line-height: 1.03;
  letter-spacing: -0.035em;
}

#compare-intro {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.65;
}

.compare-view {
  min-height: 0;
  flex: 1;
  padding: 0 clamp(22px, 4vw, 58px) 58px;
  overflow: hidden auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--rule-dark) transparent;
  scrollbar-gutter: stable;
}

.compare-form,
.compare-report-stage {
  width: min(100%, 1180px);
  margin-inline: auto;
}

.compare-form {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  padding: 18px 0 19px;
  align-items: start;
  grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr);
  gap: 12px;
  background:
    linear-gradient(180deg, var(--paper-light) 0%, var(--paper-light) 82%, rgba(253, 252, 249, 0) 100%);
}

.compare-selector {
  --compare-accent: var(--cobalt);
  --compare-accent-pale: var(--cobalt-pale);
  position: relative;
  min-width: 0;
  padding: 14px 15px 13px;
  border: 1px solid var(--rule-dark);
  border-top: 3px solid var(--compare-accent);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 8px 24px rgba(30, 42, 46, 0.055);
  transition: border-color 160ms ease, box-shadow 180ms ease, transform 180ms var(--ease);
}

.compare-selector[data-compare-slot="b"] {
  --compare-accent: var(--green);
  --compare-accent-pale: #e7f2ed;
}

.compare-selector.has-error {
  --compare-accent: var(--red);
  --compare-accent-pale: #fff1ef;
}

.compare-selector:focus-within {
  z-index: 45;
  border-color: var(--compare-accent);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--compare-accent) 10%, transparent),
    0 14px 34px rgba(30, 42, 46, 0.09);
}

.compare-selector-heading {
  display: flex;
  min-height: 27px;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}

.compare-selector-index,
.compare-selection-mark,
.compare-result-mark,
.compare-company-letter {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--compare-accent, var(--cobalt));
  color: var(--compare-accent, var(--cobalt));
  background: var(--compare-accent-pale, var(--cobalt-pale));
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1;
}

.compare-selector-index {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  font-size: 13px;
}

.compare-selector-heading label {
  color: var(--ink);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.compare-search-control {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 48px;
  align-items: center;
  gap: 8px;
  padding: 0 7px 0 12px;
  border: 1px solid var(--rule-dark);
  border-radius: 8px;
  background: #fff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.compare-search-control:focus-within {
  border-color: var(--compare-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--compare-accent) 11%, transparent);
}

.compare-search-control > svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--compare-accent);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.compare-search-control input {
  width: 0;
  min-width: 0;
  height: 46px;
  flex: 1 1 0;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
}

.compare-search-control input::placeholder {
  color: var(--ink-faint);
}

.compare-clear-button {
  display: grid;
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border-radius: 7px;
  color: var(--ink-faint);
  background: transparent;
}

.compare-clear-button[hidden] {
  display: none;
}

.compare-clear-button:hover {
  color: var(--red);
  background: #f9ecea;
}

.compare-clear-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.compare-selector-help {
  min-height: 17px;
  margin: 6px 1px 0;
  color: var(--ink-faint);
  font-size: 9px;
  line-height: 1.5;
}

.compare-selector-help.is-error {
  color: var(--red);
}

.compare-search-results {
  position: absolute;
  z-index: 60;
  top: 126px;
  right: 10px;
  left: 10px;
  max-height: min(340px, 45dvh);
  margin: 0;
  padding: 5px;
  overflow: hidden auto;
  border: 1px solid var(--rule-dark);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 20px 48px rgba(24, 36, 42, 0.17), 0 3px 8px rgba(24, 36, 42, 0.07);
  list-style: none;
  animation: compare-dropdown-in 170ms var(--ease) both;
  scrollbar-width: thin;
}

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

.compare-search-result + .compare-search-result {
  margin-top: 2px;
}

.compare-search-result {
  border-radius: 7px;
}

.compare-search-result.is-active {
  background: var(--compare-accent-pale);
}

.compare-search-result.is-disabled {
  opacity: 0.5;
}

.compare-search-result-button {
  display: grid;
  width: 100%;
  min-height: 60px;
  padding: 8px 9px;
  align-items: center;
  border-radius: 7px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  grid-template-columns: 31px minmax(0, 1fr) 20px;
  gap: 9px;
}

.compare-search-result-button:hover:not(:disabled),
.compare-search-result-button.is-active,
.compare-search-result.is-active .compare-search-result-button {
  background: var(--compare-accent-pale);
}

.compare-search-result-button:disabled {
  cursor: not-allowed;
}

.compare-result-mark {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 12px;
}

.compare-result-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.compare-result-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10.5px;
  font-weight: 750;
}

.compare-result-copy small {
  overflow: hidden;
  color: var(--ink-faint);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 8.5px;
}

.compare-result-arrow {
  color: var(--compare-accent);
  font-size: 15px;
  text-align: center;
}

.compare-search-message {
  display: grid;
  min-height: 64px;
  padding: 12px;
  place-items: center start;
  border-radius: 7px;
  color: var(--ink-soft);
  background: var(--paper-light);
}

.compare-search-message p {
  margin: 0;
  font-size: 10px;
  line-height: 1.55;
}

.compare-search-message.is-error {
  color: var(--red);
  background: #fff7f6;
}

.compare-selection {
  display: grid;
  min-width: 0;
  min-height: 66px;
  margin-top: 11px;
  padding: 10px 11px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--compare-accent) 28%, var(--rule));
  border-radius: 9px;
  background: color-mix(in srgb, var(--compare-accent-pale) 66%, #fff);
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  animation: compare-selection-in 220ms var(--ease) both;
}

.compare-selection[hidden] {
  display: none;
}

.compare-selection-mark {
  width: 35px;
  height: 35px;
  border-radius: 7px;
  font-size: 16px;
}

.compare-selection > div {
  min-width: 0;
}

.compare-selection h2,
.compare-selection p {
  margin: 0;
}

.compare-selection h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.compare-selection p {
  margin-top: 2px;
  overflow: hidden;
  color: var(--ink-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 8.5px;
}

.compare-selector.is-loading .compare-selection-mark {
  animation: compare-selection-pulse 920ms ease-in-out infinite alternate;
}

.compare-swap-button {
  display: grid;
  width: 44px;
  height: 44px;
  margin: 58px auto 0;
  padding: 0;
  place-items: center;
  border: 1px solid var(--rule-dark);
  border-radius: 50%;
  color: var(--cobalt);
  background: #fff;
  box-shadow: 0 5px 15px rgba(24, 42, 49, 0.07);
  transition: border-color 160ms ease, color 160ms ease, transform 180ms var(--ease), box-shadow 180ms ease;
}

.compare-swap-button:hover:not(:disabled) {
  border-color: var(--cobalt);
  box-shadow: 0 9px 22px rgba(24, 60, 78, 0.12);
  transform: rotate(180deg);
}

.compare-swap-button:disabled {
  cursor: not-allowed;
  opacity: 0.3;
  box-shadow: none;
}

.compare-swap-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.compare-report-stage {
  overflow: hidden;
  border: 1px solid var(--rule-dark);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(27, 42, 48, 0.075);
}

.compare-report-heading {
  display: flex;
  min-height: 94px;
  padding: 20px 24px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-bottom: 1px solid var(--rule);
  background:
    linear-gradient(115deg, rgba(245, 243, 238, 0.8), rgba(232, 242, 248, 0.42)),
    #fff;
}

.compare-report-heading > div {
  min-width: 0;
}

.compare-report-heading span {
  color: var(--cobalt);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.compare-report-heading h2 {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-family: var(--font-display);
  font-size: clamp(24px, 2.4vw, 31px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.compare-report-heading p {
  max-width: 390px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 9.5px;
  line-height: 1.55;
  text-align: right;
}

.compare-empty-state {
  display: flex;
  min-height: 350px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: 52px 20px 64px;
  text-align: center;
}

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

.compare-empty-diagram {
  display: grid;
  width: min(330px, 74vw);
  margin-bottom: 24px;
  align-items: center;
  grid-template-columns: 48px minmax(80px, 1fr) 48px;
  gap: 13px;
}

.compare-empty-diagram span {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--cobalt);
  border-radius: 10px;
  color: var(--cobalt);
  background: var(--cobalt-pale);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  box-shadow: 4px 4px 0 rgba(29, 98, 149, 0.08);
}

.compare-empty-diagram span:last-child {
  border-color: var(--green);
  color: var(--green);
  background: #e7f2ed;
  box-shadow: 4px 4px 0 rgba(44, 113, 94, 0.08);
}

.compare-empty-diagram i {
  position: relative;
  display: block;
  height: 1px;
  background: var(--rule-dark);
}

.compare-empty-diagram i::before,
.compare-empty-diagram i::after {
  position: absolute;
  top: -3px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--rule-dark);
  border-radius: 50%;
  background: #fff;
  content: "";
}

.compare-empty-diagram i::before {
  left: 0;
}

.compare-empty-diagram i::after {
  right: 0;
}

.compare-empty-state > strong {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 500;
}

.compare-empty-state > p {
  max-width: 530px;
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 10.5px;
  line-height: 1.65;
}

.compare-report {
  padding: 22px 22px 26px;
  animation: compare-report-in 300ms var(--ease) both;
}

.compare-report[hidden] {
  display: none;
}

.compare-report[aria-busy="true"] {
  cursor: progress;
}

.compare-company-pair,
.compare-metric-row {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(150px, 0.64fr) repeat(2, minmax(0, 1fr));
}

.compare-company-pair {
  margin-bottom: 20px;
  gap: 10px;
}

.compare-company-corner {
  display: flex;
  align-items: flex-end;
  padding: 0 15px 10px;
  color: var(--ink-faint);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.compare-company-header {
  --compare-accent: var(--cobalt);
  --compare-accent-pale: var(--cobalt-pale);
  position: relative;
  min-width: 0;
  min-height: 142px;
  padding: 15px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--compare-accent) 27%, var(--rule));
  border-radius: 11px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--compare-accent-pale) 64%, #fff), #fff 72%);
}

.compare-company-header.is-a {
  grid-column: 2;
}

.compare-company-header.is-b {
  --compare-accent: var(--green);
  --compare-accent-pale: #e7f2ed;
  grid-column: 3;
}

.compare-company-header::after {
  position: absolute;
  right: -23px;
  bottom: -29px;
  width: 92px;
  height: 92px;
  border: 1px solid color-mix(in srgb, var(--compare-accent) 15%, transparent);
  border-radius: 50%;
  content: "";
}

.compare-company-header-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.compare-company-letter {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  font-size: 13px;
}

.compare-status-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.8);
  font-size: 8px;
  font-weight: 750;
}

.compare-status-pill.is-positive {
  border-color: rgba(44, 113, 94, 0.28);
  color: var(--green);
  background: #eff8f4;
}

.compare-status-pill.is-negative {
  border-color: rgba(170, 61, 55, 0.25);
  color: var(--red);
  background: #fff2f0;
}

.compare-company-header h3,
.compare-company-header p {
  position: relative;
  z-index: 1;
  margin: 0;
}

.compare-company-header h3 {
  margin-top: 18px;
  overflow-wrap: anywhere;
  font-family: var(--font-display);
  font-size: clamp(18px, 1.7vw, 24px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.compare-company-header p {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 8.5px;
  line-height: 1.55;
}

.compare-report-section {
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: #fff;
}

.compare-report-section + .compare-report-section {
  margin-top: 14px;
}

.compare-report-section-heading {
  min-height: 54px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.compare-report-section-title {
  display: flex;
  min-height: 31px;
  align-items: center;
  gap: 10px;
}

.compare-report-section-heading span {
  display: grid;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(29, 98, 149, 0.2);
  border-radius: 6px;
  color: var(--cobalt);
  background: var(--cobalt-pale);
  font-size: 8px;
  font-weight: 750;
}

.compare-report-section-heading h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.compare-metric-row + .compare-metric-row {
  border-top: 1px solid var(--rule);
}

.compare-metric-label,
.compare-metric-value {
  min-width: 0;
  padding: 14px 15px;
}

.compare-metric-label {
  display: flex;
  justify-content: center;
  flex-direction: column;
  background: color-mix(in srgb, var(--paper) 58%, #fff);
}

.compare-metric-label strong {
  font-size: 9px;
  font-weight: 750;
}

.compare-metric-label small {
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 7.5px;
  line-height: 1.4;
}

.compare-metric-value {
  position: relative;
  display: flex;
  min-height: 68px;
  justify-content: center;
  flex-direction: column;
  border-left: 1px solid var(--rule);
}

.compare-metric-value.is-a {
  box-shadow: inset 2px 0 0 rgba(29, 98, 149, 0.1);
}

.compare-metric-value.is-b {
  box-shadow: inset 2px 0 0 rgba(44, 113, 94, 0.1);
}

.compare-metric-value strong {
  overflow-wrap: anywhere;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.45;
}

.compare-metric-value small {
  margin-top: 4px;
  color: var(--ink-faint);
  font-size: 7.5px;
  line-height: 1.45;
}

.compare-metric-value.is-positive strong {
  color: var(--green);
}

.compare-metric-value.is-negative strong {
  color: var(--red);
}

.compare-metric-value.is-missing strong {
  color: var(--ink-faint);
  font-weight: 500;
  font-style: italic;
}

.compare-report[aria-busy="true"] .compare-metric-value strong {
  animation: compare-data-pulse 900ms ease-in-out infinite alternate;
}

.compare-report-note {
  margin: 18px 1px 0;
  padding: 13px 15px;
  border-left: 3px solid var(--cobalt);
  color: var(--ink-soft);
  background: var(--paper);
  font-size: 9px;
  line-height: 1.6;
}

.compare-report-note strong {
  color: var(--ink);
}

@keyframes compare-dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@keyframes compare-selection-in {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
}

@keyframes compare-report-in {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
}

@keyframes compare-selection-pulse {
  to {
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--compare-accent) 12%, transparent);
  }
}

@keyframes compare-data-pulse {
  to {
    opacity: 0.48;
  }
}

@media (max-width: 900px) {
  .compare-topbar {
    min-height: 150px;
    padding: 25px 20px 22px;
  }

  .compare-topbar h1 {
    font-size: clamp(31px, 6vw, 40px);
  }

  .compare-view {
    padding-right: 20px;
    padding-left: 20px;
  }

  .compare-form {
    position: relative;
    top: auto;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .compare-selector {
    padding-right: 14px;
    padding-left: 14px;
  }

  .compare-swap-button {
    margin: 0 auto;
    transform: rotate(90deg);
  }

  .compare-swap-button:hover:not(:disabled) {
    transform: rotate(270deg);
  }

  .compare-company-pair {
    position: relative;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compare-company-corner {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .compare-company-header.is-a {
    grid-column: 1;
  }

  .compare-company-header.is-b {
    grid-column: 2;
  }

  .compare-metric-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compare-metric-label {
    min-height: 45px;
    padding: 10px 13px;
    border-bottom: 1px solid var(--rule);
    grid-column: 1 / -1;
  }

  .compare-metric-label small {
    max-width: 600px;
  }

  .compare-metric-value.is-a {
    border-left: 0;
  }
}

@media (max-width: 700px) {
  .compare-topbar {
    min-height: 0;
    gap: 8px;
    padding: 20px 13px 18px;
  }

  .compare-topbar::after {
    right: 14px;
    width: 34vw;
  }

  .compare-sidebar-open-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    margin-top: -4px;
  }

  .compare-kicker {
    font-size: 8px;
  }

  .compare-topbar h1 {
    font-size: clamp(28px, 9vw, 36px);
  }

  #compare-intro {
    font-size: 10px;
  }

  .compare-view {
    padding-right: 11px;
    padding-bottom: 34px;
    padding-left: 11px;
    scrollbar-gutter: auto;
  }

  .compare-form {
    padding-top: 11px;
    padding-bottom: 13px;
  }

  .compare-selector {
    padding: 12px;
    border-radius: 10px;
  }

  .compare-search-control input {
    font-size: 16px;
  }

  .compare-search-results {
    top: 124px;
    right: 7px;
    left: 7px;
    max-height: min(300px, 42dvh);
  }

  .compare-result-copy strong,
  .compare-result-copy small {
    white-space: normal;
  }

  .compare-selection h2,
  .compare-selection p {
    white-space: normal;
  }

  .compare-report-stage {
    border-radius: 11px;
  }

  .compare-report-heading {
    min-height: 0;
    padding: 16px;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .compare-report-heading h2 {
    font-size: 24px;
  }

  .compare-report-heading p {
    max-width: none;
    text-align: left;
  }

  .compare-empty-state {
    min-height: 300px;
    padding: 42px 15px 50px;
  }

  .compare-empty-state > strong {
    font-size: 21px;
  }

  .compare-report {
    padding: 12px 9px 18px;
  }

  .compare-company-pair {
    margin-bottom: 12px;
    gap: 6px;
  }

  .compare-company-header {
    min-height: 136px;
    padding: 11px;
    border-radius: 8px;
  }

  .compare-company-header h3 {
    margin-top: 13px;
    font-size: clamp(16px, 5.2vw, 20px);
  }

  .compare-company-header p {
    font-size: 8px;
  }

  .compare-status-pill {
    max-width: calc(100% - 36px);
    min-height: 22px;
    padding-right: 6px;
    padding-left: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .compare-report-section + .compare-report-section {
    margin-top: 9px;
  }

  .compare-report-section-heading {
    min-height: 50px;
    padding: 10px 11px;
  }

  .compare-metric-label,
  .compare-metric-value {
    padding: 11px;
  }

  .compare-metric-value {
    min-height: 70px;
  }

  .compare-metric-value strong {
    font-size: 10.5px;
  }

  .compare-report-note {
    margin-top: 12px;
    padding: 11px;
  }
}

@media (max-width: 420px) {
  .compare-topbar {
    padding-right: 10px;
    padding-left: 8px;
  }

  .compare-topbar h1 {
    font-size: clamp(26px, 8.4vw, 32px);
  }

  #compare-intro {
    margin-top: 7px;
    line-height: 1.5;
  }

  .compare-view {
    padding-right: 8px;
    padding-left: 8px;
  }

  .compare-selector {
    padding-right: 10px;
    padding-left: 10px;
  }

  .compare-search-control {
    padding-left: 9px;
  }

  .compare-selection {
    padding-right: 9px;
    padding-left: 9px;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 8px;
  }

  .compare-selection-mark {
    width: 31px;
    height: 31px;
  }

  .compare-empty-diagram {
    width: min(260px, 76vw);
    grid-template-columns: 42px minmax(54px, 1fr) 42px;
  }

  .compare-empty-diagram span {
    width: 42px;
    height: 42px;
  }

  .compare-company-header {
    min-height: 130px;
    padding: 9px;
  }

  .compare-company-letter {
    width: 25px;
    height: 25px;
  }

  .compare-company-header h3 {
    font-size: 15px;
  }

  .compare-metric-label,
  .compare-metric-value {
    padding-right: 9px;
    padding-left: 9px;
  }

  .compare-metric-value strong {
    font-size: 10px;
  }

  .compare-metric-value small {
    font-size: 7px;
  }
}

@media (pointer: coarse) {
  .compare-clear-button,
  .compare-swap-button,
  .compare-search-result-button {
    min-width: 44px;
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .compare-selector,
  .compare-search-control,
  .compare-swap-button,
  .compare-selection,
  .compare-report,
  .compare-search-results,
  .compare-report[aria-busy="true"] .compare-metric-value strong,
  .compare-selector.is-loading .compare-selection-mark {
    animation: none;
    transition: none;
  }
}

@media (prefers-contrast: more) {
  .compare-selector,
  .compare-search-control,
  .compare-search-results,
  .compare-selection,
  .compare-report-stage,
  .compare-company-header,
  .compare-report-section,
  .compare-status-pill {
    border-width: 2px;
  }

  .compare-metric-row + .compare-metric-row,
  .compare-metric-value {
    border-color: var(--ink-soft);
  }
}

@media (forced-colors: active) {
  .compare-selector,
  .compare-search-control,
  .compare-search-results,
  .compare-selection,
  .compare-report-stage,
  .compare-company-header,
  .compare-report-section,
  .compare-swap-button {
    border: 2px solid CanvasText;
    background: Canvas;
    box-shadow: none;
    forced-color-adjust: auto;
  }

  .compare-search-result.is-active,
  .compare-search-result-button.is-active,
  .compare-search-result-button:hover:not(:disabled),
  .compare-metric-label {
    color: HighlightText;
    background: Highlight;
  }
}
