/* VDM AI Assistant: mirrors the EngDMS assistant interaction model without altering legacy VDM layouts. */

.vdm-ai-launcher,
.vdm-ai-panel,
.vdm-ai-modal,
.vdm-ai-toast,
.vdm-ai-document-actions,
.vdm-ai-similar-decisions {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.vdm-ai-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 11010;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #0ea5e9 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(18, 77, 137, .36), 0 0 0 4px rgba(255, 255, 255, .9);
  transition: transform .18s ease, box-shadow .18s ease;
}

.vdm-ai-launcher:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 14px 30px rgba(18, 77, 137, .48), 0 0 0 4px rgba(255, 255, 255, .95);
}

.vdm-ai-launcher:focus-visible,
.vdm-ai-panel button:focus-visible,
.vdm-ai-document-actions button:focus-visible,
.vdm-ai-similar-decisions button:focus-visible {
  outline: 3px solid #f3b447;
  outline-offset: 3px;
}

.vdm-ai-launcher__icon {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  fill: currentColor;
}

.vdm-ai-launcher__pulse {
  position: absolute;
  inset: -5px;
  border: 2px solid rgba(38, 126, 204, .35);
  border-radius: inherit;
  animation: vdm-ai-pulse 2.5s ease-out infinite;
}

@keyframes vdm-ai-pulse {
  0%, 55% { transform: scale(.88); opacity: .82; }
  100% { transform: scale(1.18); opacity: 0; }
}

.vdm-ai-backdrop {
  display: none;
}

.vdm-ai-panel {
  --vdm-ai-blue: #155790;
  --vdm-ai-blue-dark: #0f3d6c;
  --vdm-ai-accent: #2b83cf;
  --vdm-ai-text: #18344f;
  --vdm-ai-muted: #60758a;
  --vdm-ai-border: #d6e3ef;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 11010;
  display: flex;
  flex-direction: column;
  width: min(440px, 100vw);
  min-height: 0;
  overflow: hidden;
  border: 1px solid #c7d9ea;
  border-radius: 16px 0 0 16px;
  background: #fff;
  color: var(--vdm-ai-text);
  box-shadow: 0 18px 48px rgba(12, 52, 89, .27);
  opacity: 0;
  transform: translateX(calc(100% + 36px));
  transition: transform .23s ease, opacity .2s ease;
}

.vdm-ai-panel[hidden] {
  display: none !important;
}

.vdm-ai-panel.is-open {
  opacity: 1;
  transform: translateX(0);
}

.vdm-ai-panel__header {
  flex: 0 0 auto;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5 0%, #6d28d9 50%, #0369a1 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset;
}

.vdm-ai-panel__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 13px 16px 10px;
}

.vdm-ai-panel__brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.vdm-ai-panel__brand-icon {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  fill: #fff;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .18));
}

.vdm-ai-panel__title-group {
  min-width: 0;
}

.vdm-ai-panel__title {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}

.vdm-ai-panel__subtitle {
  overflow: hidden;
  margin: 3px 0 0;
  color: rgba(255, 255, 255, .84);
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vdm-ai-panel__close {
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0 0 3px;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
  font-size: 24px;
  line-height: 26px;
  transition: background .15s ease;
}

.vdm-ai-panel__close:hover {
  background: rgba(255, 255, 255, .22);
}

.vdm-ai-tabs {
  display: flex;
  align-items: flex-end;
  padding: 0 14px;
  gap: 4px;
}

.vdm-ai-tab {
  min-height: 36px;
  margin: 0;
  padding: 8px 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 7px 7px 0 0;
  background: transparent;
  color: rgba(255, 255, 255, .78);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1px;
}

.vdm-ai-tab:hover,
.vdm-ai-tab.is-active {
  color: #fff;
}

.vdm-ai-tab.is-active {
  border-bottom-color: #f6c862;
  background: rgba(255, 255, 255, .1);
}

.vdm-ai-panel__body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  background: #f7faff;
}

.vdm-ai-view {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.vdm-ai-view[hidden] {
  display: none;
}

.vdm-ai-support-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--vdm-ai-border);
  background: #fff;
  gap: 8px;
}

.vdm-ai-scope {
  display: flex;
  min-width: 0;
  gap: 6px;
}

.vdm-ai-scope__chip {
  display: inline-flex;
  align-items: center;
  max-width: 260px;
  overflow: hidden;
  padding: 5px 10px 5px 8px;
  border: 1px solid #bad6ee;
  border-radius: 999px;
  background: #eef7ff;
  color: #14507f;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  gap: 5px;
}

.vdm-ai-scope__icon {
  width: 14px;
  height: 14px;
  fill: #287fc8;
}

.vdm-ai-page-chip {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid #cbd9e7;
  border-radius: 999px;
  background: #fff;
  color: #486276;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.vdm-ai-page-chip:hover {
  border-color: #6b9fcc;
  color: #155790;
}

.vdm-ai-page-chip.is-off {
  border-color: #e2c3c3;
  color: #8d5353;
}

.vdm-ai-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px;
  background: linear-gradient(180deg, #f8fbff 0%, #f4f8fc 100%);
  scrollbar-color: #b7cade transparent;
  scrollbar-width: thin;
}

.vdm-ai-messages::-webkit-scrollbar {
  width: 9px;
}

.vdm-ai-messages::-webkit-scrollbar-thumb {
  border: 2px solid #f6f9fd;
  border-radius: 9px;
  background: #b7cade;
}

.vdm-ai-empty {
  max-width: 360px;
  margin: auto;
  padding: 26px 18px 20px;
  border: 1px solid #d9e7f2;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 6px 16px rgba(23, 83, 130, .07);
  color: #4f6578;
  text-align: center;
}

.vdm-ai-empty__icon {
  width: 31px;
  height: 31px;
  margin-bottom: 7px;
  fill: #287fc8;
}

.vdm-ai-empty__title {
  margin: 0 0 6px;
  color: #183d61;
  font-size: 16px;
  font-weight: 700;
}

.vdm-ai-empty p:not(.vdm-ai-empty__title) {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
}

.vdm-ai-starters {
  display: grid;
  margin-top: 16px;
  gap: 7px;
}

.vdm-ai-starter,
.vdm-ai-suggestion {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #c8dbec;
  border-radius: 8px;
  background: #f8fcff;
  color: #1e5d91;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.35;
  text-align: left;
  transition: border-color .14s ease, background .14s ease, transform .14s ease;
}

.vdm-ai-starter:hover,
.vdm-ai-suggestion:hover {
  border-color: #6faddb;
  background: #edf7ff;
  transform: translateY(-1px);
}

.vdm-ai-composer {
  flex: 0 0 auto;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--vdm-ai-border);
  background: #fff;
}

.vdm-ai-composer__row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.vdm-ai-composer__input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 42px;
  max-height: 110px;
  padding: 10px 11px;
  border: 1px solid #b7cadc;
  border-radius: 9px;
  background: #fff;
  color: #18344f;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.35;
  resize: vertical;
}

.vdm-ai-composer__input:focus {
  border-color: #287fc8;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(40, 127, 200, .16);
}

.vdm-ai-composer__input:disabled {
  background: #f3f6f9;
  cursor: wait;
}

.vdm-ai-composer__send {
  flex: 0 0 auto;
  min-width: 59px;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid #155790;
  border-radius: 9px;
  background: linear-gradient(180deg, #287fc8, #155790);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  transition: filter .14s ease, transform .14s ease;
}

.vdm-ai-composer__send:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.vdm-ai-composer__send:disabled {
  cursor: wait;
  opacity: .65;
}

.vdm-ai-composer__hint {
  margin-top: 6px;
  color: #718394;
  font-size: 10px;
}

.vdm-ai-turn {
  max-width: 88%;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #dce7f0;
  border-radius: 11px 11px 11px 3px;
  background: #fff;
  box-shadow: 0 3px 8px rgba(22, 74, 116, .045);
}

.vdm-ai-turn--user {
  margin-left: auto;
  border-color: #b9dbf3;
  border-radius: 11px 11px 3px 11px;
  background: #e9f6ff;
}

.vdm-ai-turn--assistant {
  margin-right: auto;
}

.vdm-ai-turn--error {
  border-color: #efc3c3;
  background: #fff7f7;
}

.vdm-ai-turn__label {
  display: block;
  margin-bottom: 4px;
  color: #507087;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .15px;
  text-transform: uppercase;
}

.vdm-ai-turn--user .vdm-ai-turn__label {
  color: #23699f;
}

.vdm-ai-turn__body {
  color: #253f55;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.vdm-ai-turn--assistant .vdm-ai-turn__body {
  white-space: normal;
}

.vdm-ai-markdown p,
.vdm-ai-markdown__paragraph {
  margin: 0 0 10px;
}

.vdm-ai-markdown p:last-child,
.vdm-ai-markdown__paragraph:last-child {
  margin-bottom: 0;
}

.vdm-ai-markdown h1,
.vdm-ai-markdown h2,
.vdm-ai-markdown h3,
.vdm-ai-markdown h4,
.vdm-ai-markdown h5,
.vdm-ai-markdown h6,
.vdm-ai-markdown__heading {
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #164f7d !important; /* Legacy site.css marks every h3 color important. */
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.vdm-ai-markdown h1:not(:first-child),
.vdm-ai-markdown h2:not(:first-child),
.vdm-ai-markdown h3:not(:first-child),
.vdm-ai-markdown h4:not(:first-child),
.vdm-ai-markdown h5:not(:first-child),
.vdm-ai-markdown h6:not(:first-child),
.vdm-ai-markdown__heading + .vdm-ai-markdown__heading {
  margin-top: 13px;
}

.vdm-ai-markdown ul,
.vdm-ai-markdown ol,
.vdm-ai-markdown__list {
  margin: 0 0 11px;
  padding-left: 21px;
}

.vdm-ai-markdown__item + .vdm-ai-markdown__item {
  margin-top: 5px;
}

.vdm-ai-markdown code,
.vdm-ai-markdown__code {
  padding: 1px 4px;
  border-radius: 3px;
  background: #edf3f8;
  color: #21577f;
  font-family: Consolas, Monaco, monospace;
  font-size: 11px;
}

.vdm-ai-markdown pre {
  margin: 0 0 10px;
  padding: 9px;
  overflow-x: auto;
  border-radius: 5px;
  background: #edf3f8;
}

.vdm-ai-markdown pre code {
  padding: 0;
  background: transparent;
}

.vdm-ai-markdown table {
  width: 100%;
  margin: 0 0 10px;
  border-collapse: collapse;
  font-size: 11px;
}

.vdm-ai-markdown th,
.vdm-ai-markdown td {
  padding: 4px 6px;
  border: 1px solid #d2dfe9;
  text-align: left;
  vertical-align: top;
}

.vdm-ai-markdown blockquote {
  margin: 0 0 10px;
  padding: 2px 10px;
  border-left: 3px solid #9cc9e8;
  color: #597287;
}

.vdm-ai-markdown a,
.vdm-ai-markdown__link {
  color: #176fb0;
  text-decoration: underline;
}

.vdm-ai-working {
  display: flex;
  align-items: center;
  width: fit-content;
  margin: 0 0 12px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #e8f3fc;
  color: #39739f;
  font-size: 11px;
  font-style: italic;
  gap: 6px;
}

.vdm-ai-working__dots {
  display: inline-block;
  color: #287fc8;
  font-size: 15px;
  letter-spacing: 1px;
  line-height: 8px;
  animation: vdm-ai-dots 1.2s ease-in-out infinite;
}

@keyframes vdm-ai-dots {
  50% { opacity: .25; transform: translateY(1px); }
}

.vdm-ai-citations {
  display: flex;
  flex-wrap: wrap;
  margin-top: 8px;
  gap: 5px;
}

.vdm-ai-citation {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px 7px;
  border: 1px solid #c5dbea;
  border-radius: 999px;
  background: #f2f9ff;
  color: #3b6483;
  font-size: 10px;
  line-height: 1.25;
}

.vdm-ai-citation__number {
  color: #176396;
  font-weight: 700;
}

.vdm-ai-citation__separator {
  color: #83a0b4;
}

.vdm-ai-citation__unverified {
  padding: 1px 4px;
  border-radius: 999px;
  background: #fff2d9;
  color: #9b6208;
  font-weight: 700;
}

.vdm-ai-document-header {
  flex: 0 0 auto;
  padding: 12px 14px 9px;
  border-bottom: 1px solid #d9e6f1;
  background: #fff;
}

.vdm-ai-document-identity {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.vdm-ai-document-identity__icon {
  flex: 0 0 auto;
  width: 21px;
  height: 21px;
  fill: #287fc8;
}

.vdm-ai-document-identity__number {
  display: block;
  overflow: hidden;
  color: #174973;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vdm-ai-document-identity__meta,
.vdm-ai-document-title {
  display: block;
  margin-top: 2px;
  color: #647d90;
  font-size: 10px;
  line-height: 1.35;
}

.vdm-ai-document-title {
  margin: 7px 0 0;
  color: #435f77;
  font-size: 11px;
}

.vdm-ai-document-loading {
  margin: 0;
  color: #5e7a91;
  font-size: 12px;
}

.vdm-ai-document-tools {
  display: flex;
  flex: 0 0 auto;
  overflow-x: auto;
  padding: 9px 14px;
  border-bottom: 1px solid #d9e6f1;
  background: #fff;
  gap: 7px;
}

.vdm-ai-document-tools[hidden] {
  display: none;
}

.vdm-ai-document-tool {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid #bdd7eb;
  border-radius: 8px;
  background: #f8fcff;
  color: #185988;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  gap: 5px;
}

.vdm-ai-document-tool:hover:not(:disabled) {
  border-color: #6aa5d0;
  background: #edf7ff;
}

.vdm-ai-document-tool:disabled {
  cursor: wait;
  opacity: .6;
}

.vdm-ai-document-tool__icon {
  order: -1;
  width: 15px;
  height: 15px;
  fill: #287fc8;
}

.vdm-ai-result-state,
.vdm-ai-summary-overview,
.vdm-ai-result-list,
.vdm-ai-comparison-section,
.vdm-ai-suggestions {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid #d8e5f0;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 3px 8px rgba(22, 74, 116, .04);
}

.vdm-ai-result-state {
  display: flex;
  align-items: flex-start;
  color: #4d6a81;
  font-size: 12px;
  line-height: 1.5;
  gap: 9px;
}

.vdm-ai-result-state p {
  margin: 0;
}

.vdm-ai-result-state--error {
  flex-direction: column;
  border-color: #edc5c5;
  background: #fff8f8;
  color: #8a4343;
  gap: 6px;
}

.vdm-ai-result-state__icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  fill: #287fc8;
}

.vdm-ai-result-heading {
  display: flex;
  align-items: center;
  margin: 0 0 11px;
  color: #174e79;
  font-size: 15px;
  font-weight: 700;
  gap: 8px;
}

.vdm-ai-result-heading__icon {
  width: 23px;
  height: 23px;
  fill: #287fc8;
}

.vdm-ai-summary-overview h3,
.vdm-ai-result-list h3,
.vdm-ai-comparison-section h3,
.vdm-ai-suggestions h3 {
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #20577f !important;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.vdm-ai-summary-overview p {
  margin: 0;
  color: #344f65;
  font-size: 12px;
  line-height: 1.55;
}

.vdm-ai-result-list ul {
  margin: 0;
  padding-left: 18px;
  color: #344f65;
  font-size: 12px;
  line-height: 1.55;
}

.vdm-ai-result-list li + li {
  margin-top: 4px;
}

.vdm-ai-suggestions {
  display: grid;
  gap: 7px;
}

.vdm-ai-suggestions h3 {
  margin-bottom: 1px;
}

.vdm-ai-summary-actions {
  display: flex;
  justify-content: flex-end;
  margin: 14px 0 4px;
}

.vdm-ai-summary-actions .vdm-ai-document-tool {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 11px;
}

.vdm-ai-comparison-section {
  padding-bottom: 5px;
}

.vdm-ai-comparison-item {
  margin: 0 0 8px;
  padding: 10px;
  border: 1px solid #e1eaf2;
  border-left: 3px solid #4d9bd6;
  border-radius: 7px;
  background: #fbfdff;
}

.vdm-ai-comparison-item__title {
  display: block;
  margin-bottom: 7px;
  color: #244f72;
  font-size: 12px;
}

.vdm-ai-comparison-item__values {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #4c6476;
  font-size: 11px;
  line-height: 1.45;
  row-gap: 3px;
}

.vdm-ai-comparison-item__values dt,
.vdm-ai-comparison-item__values dd {
  float: none;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.45;
  text-align: left;
  overflow-wrap: anywhere;
}

.vdm-ai-comparison-item__values dt {
  color: #698095 !important; /* Override the host's global dt rule only inside comparison cards. */
  font-weight: 700;
}

.vdm-ai-comparison-item__values dd {
  min-width: 0;
  margin: 0;
  word-break: break-word;
}

.vdm-ai-comparison-item__pages,
.vdm-ai-result-note {
  margin: 8px 0 0;
  color: #718394;
  font-size: 10px;
  line-height: 1.45;
}

.vdm-ai-result-note {
  margin-bottom: 12px;
}

.vdm-ai-comparison-item__pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 12px;
}

.vdm-ai-comparison-item__source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

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

.vdm-ai-modal {
  position: fixed;
  inset: 0;
  z-index: 11030;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(8, 37, 65, .48);
}

.vdm-ai-modal__card {
  width: min(510px, 100%);
  padding: 22px;
  border: 1px solid #bfd5e8;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 20px 52px rgba(4, 30, 53, .34);
  color: #29465e;
}

.vdm-ai-modal__heading {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.vdm-ai-modal__icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  fill: #287fc8;
}

.vdm-ai-modal__title {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #184d78;
  font-size: 17px;
}

.vdm-ai-modal__subtitle {
  margin: 4px 0 0;
  color: #6b8193;
  font-size: 12px;
  line-height: 1.4;
}

.vdm-ai-attestation-document {
  display: flex;
  flex-direction: column;
  margin-top: 16px;
  padding: 10px 12px;
  border-left: 3px solid #4a9bd7;
  border-radius: 4px;
  background: #f3f9fe;
  color: #47667f;
  font-size: 12px;
  line-height: 1.45;
}

.vdm-ai-attestation-document strong {
  color: #1d547e;
}

.vdm-ai-attestation-statement {
  margin: 15px 0;
  color: #36536a;
  font-size: 12px;
  line-height: 1.55;
}

.vdm-ai-attestation-check {
  display: flex;
  align-items: flex-start;
  color: #284b66;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  gap: 6px;
}

.vdm-ai-attestation-check input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
}

.vdm-ai-modal__footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
  gap: 9px;
}

.vdm-ai-button {
  min-height: 34px;
  padding: 7px 13px;
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
}

.vdm-ai-button--secondary {
  border: 1px solid #b9cbd9;
  background: #fff;
  color: #46637a;
}

.vdm-ai-button--primary {
  border: 1px solid #155790;
  background: #155790;
  color: #fff;
}

.vdm-ai-button--primary:disabled {
  cursor: not-allowed;
  opacity: .5;
}

.vdm-ai-toast {
  position: fixed;
  right: 24px;
  bottom: 94px;
  z-index: 11040;
  max-width: min(360px, calc(100vw - 48px));
  padding: 10px 13px;
  border: 1px solid #b9d4e8;
  border-radius: 9px;
  background: #fff;
  color: #294d69;
  box-shadow: 0 8px 22px rgba(16, 64, 105, .22);
  font-size: 12px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(7px);
  transition: opacity .16s ease, transform .16s ease;
}

.vdm-ai-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.vdm-ai-toast--error {
  border-color: #ebc3c3;
  color: #8d4141;
}

/* Document-list action icon. It is initially hidden in the markup until the VDM AI status check succeeds. */
.vdm-ai-document-actions[hidden] {
  display: none !important;
}

.vdm-ai-document-actions {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.vdm-ai-document-actions--table {
  margin-left: 5px;
}

.vdm-ai-revision-actions {
  margin-left: 4px;
}

.vdm-ai-revision-compare {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

.vdm-ai-revision-compare svg {
  width: 14px;
  height: 14px;
}

.vdm-ai-document-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  padding: 0;
  border: 1px solid #6ba6d1;
  border-radius: 50%;
  background: #f4fbff;
  color: #1a6caa;
  cursor: pointer;
  vertical-align: middle;
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}

.vdm-ai-document-icon:hover:not(.is-disabled) {
  transform: translateY(-1px) scale(1.07);
  background: #e8f6ff;
  box-shadow: 0 0 0 3px rgba(54, 141, 208, .16);
}

.vdm-ai-document-icon svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.vdm-ai-document-icon__status {
  position: absolute;
  right: -6px;
  bottom: -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 13px;
  height: 13px;
  padding: 0 2px;
  border: 1px solid #fff;
  border-radius: 8px;
  background: #e5edf4;
  color: #607a90;
  font-size: 7px;
  font-weight: 700;
  line-height: 1;
}

.vdm-ai-document-actions[data-vdm-ai-status="ingested"] .vdm-ai-document-icon {
  border-color: #4aa975;
  background: #effaf3;
  color: #278250;
}

.vdm-ai-document-actions[data-vdm-ai-status="ingested"] .vdm-ai-document-icon__status {
  width: 9px;
  min-width: 9px;
  height: 9px;
  padding: 0;
  background: #39a565;
  font-size: 0;
}

.vdm-ai-document-icon.is-busy {
  border-color: #d89e36;
  color: #a76a07;
  cursor: wait;
}

.vdm-ai-document-icon.is-busy svg {
  animation: vdm-ai-spin 1.3s linear infinite;
}

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

.vdm-ai-document-icon.is-disabled {
  border-color: #d6dde3;
  background: #f2f4f6;
  color: #8a98a3;
  cursor: not-allowed;
}

.vdm-ai-document-actions--detail {
  margin-left: 8px;
}

.vdm-ai-document-actions--detail .vdm-ai-document-tool {
  padding: 4px 8px;
  vertical-align: middle;
}

.vdm-ai-document-actions--detail .vdm-ai-document-tool svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.vdm-ai-document-actions--detail .vdm-ai-document-tool.is-disabled {
  cursor: not-allowed;
  opacity: .55;
}

/* Historical concession/deviation decisions: visible even if the external AI gateway is disabled. */
.vdm-ai-similar-decisions {
  max-width: 780px;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid #cddfeb;
  border-radius: 11px;
  background: linear-gradient(135deg, #fbfdff 0%, #f2f9ff 100%);
  box-shadow: 0 4px 13px rgba(23, 82, 126, .06);
}

.vdm-ai-similar-decisions h3 {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #195782 !important;
  font-size: 16px;
  line-height: 1.35;
}

.vdm-ai-similar-status {
  margin: 6px 0 0;
  color: #60798e;
  font-size: 12px;
  line-height: 1.45;
}

.vdm-ai-similar-status--error {
  color: #9a4545;
}

.vdm-ai-decision {
  position: relative;
  margin-top: 12px;
  padding: 12px 13px;
  border: 1px solid #d9e5ee;
  border-left: 4px solid #4b9bd5;
  border-radius: 8px;
  background: #fff;
}

.vdm-ai-decision__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  color: #224e70;
  font-size: 12px;
  gap: 10px;
}

.vdm-ai-decision__outcome,
.vdm-ai-decision__match {
  display: inline-block;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.vdm-ai-decision__outcome {
  padding: 3px 8px;
  background: #eef3f7;
  color: #506d83;
}

.vdm-ai-decision__outcome--accepted {
  background: #e8f7ee;
  color: #26804d;
}

.vdm-ai-decision__outcome--rejected {
  background: #fff0f0;
  color: #a44646;
}

.vdm-ai-decision__match {
  margin-top: 6px;
  padding: 2px 7px;
  background: #eaf5fe;
  color: #3475a4;
}

.vdm-ai-decision__text {
  margin: 8px 0 0;
  color: #405b70;
  font-size: 12px;
  line-height: 1.45;
}

.vdm-ai-decision__meta,
.vdm-ai-similar-note {
  margin: 8px 0 0;
  color: #6a8193;
  font-size: 10px;
  line-height: 1.45;
}

.vdm-ai-similar-note {
  padding-top: 9px;
  border-top: 1px solid #dce8f1;
  font-style: italic;
}

@media (max-width: 740px) {
  .vdm-ai-launcher {
    right: 17px;
    bottom: 17px;
    width: 54px;
    height: 54px;
  }

  .vdm-ai-backdrop[hidden] {
    display: none;
  }

  .vdm-ai-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 11000;
    display: block;
    background: rgba(8, 37, 65, .32);
  }

  .vdm-ai-panel {
    top: auto;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
    min-height: 0;
    height: min(730px, calc(100vh - 16px));
    border-radius: 14px;
    transform: translateY(calc(100% + 18px));
  }

  .vdm-ai-panel.is-open {
    transform: translateY(0);
  }

  .vdm-ai-toast {
    right: 16px;
    bottom: 80px;
    max-width: calc(100vw - 32px);
  }

  .vdm-ai-comparison-item__values {
    grid-template-columns: 62px minmax(0, 1fr);
  }
}

@media (max-width: 430px) {
  .vdm-ai-panel__titlebar {
    min-height: 65px;
    padding: 11px 12px 8px;
  }

  .vdm-ai-tabs {
    padding: 0 9px;
  }

  .vdm-ai-tab {
    padding-right: 10px;
    padding-left: 10px;
  }

  .vdm-ai-support-controls,
  .vdm-ai-composer {
    padding-right: 10px;
    padding-left: 10px;
  }

  .vdm-ai-messages {
    padding: 11px;
  }

  .vdm-ai-document-tools {
    padding-right: 10px;
    padding-left: 10px;
  }
}

@media print {
  .vdm-ai-launcher,
  .vdm-ai-panel,
  .vdm-ai-backdrop,
  .vdm-ai-modal,
  .vdm-ai-toast,
  .vdm-ai-document-actions {
    display: none !important;
  }
}

/* Keep host display rules from overriding the hidden attribute. */
.vdm-ai-launcher[hidden],
.vdm-ai-composer[hidden],
.vdm-ai-tab[hidden] {
  display: none !important;
}

.vdm-ai-column {
  width: 42px;
  text-align: center;
  white-space: nowrap;
}

.vdm-ai-column .vdm-ai-document-actions--table {
  margin-left: 0;
}

@media (prefers-reduced-motion: reduce) {
  .vdm-ai-launcher__pulse { animation: none; }
  .vdm-ai-panel { transition: none; }
}

.vdm-ai-composer__send[hidden] { display: none !important; }
.vdm-ai-panel__action {
  margin-left: auto;
  padding: 5px 8px;
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 6px;
  color: #fff;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}
.vdm-ai-source-page {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid #d6d3ff;
  border-radius: 8px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 11px;
}

/* EngDMS listing icon treatment: gradient glyph, with badges only for a real status. */
.vdm-ai-document-icon {
  width: 28px;
  height: 28px;
  border: 0;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #0ea5e9 100%);
  color: #fff;
}
.vdm-ai-document-icon:hover:not(.is-disabled),
.vdm-ai-document-actions[data-vdm-ai-status="ingested"] .vdm-ai-document-icon {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #0ea5e9 100%);
  color: #fff;
}
.vdm-ai-document-actions:not([data-vdm-ai-status="ingested"]) .vdm-ai-document-icon__status:empty {
  display: none;
}
.vdm-ai-document-actions[data-vdm-ai-status="failed"] .vdm-ai-document-icon__status {
  background: #b91c1c;
  color: #fff;
}
.vdm-ai-document-icon.vdm-ai-revision-compare { width: 24px; height: 24px; }
.vdm-ai-document-icon.is-disabled { background: #e5e7eb; color: #6b7280; }

/* A current-revision status cannot certify that the previous file is available. */
.vdm-ai-revision-actions .vdm-ai-document-icon__status { display: none; }
