:root {
  color-scheme: light;
  --bg: #F6F7F9;
  --surface: #ffffff;
  --surface-soft: #F8FAFC;
  --text: #1F2937;
  --muted: #64748B;
  --line: #DDE3EA;
  --blue-deep: #1D4ED8;
  --blue-tech: #2563EB;
  --cyan-health: #2563EB;
  --accent: #2563EB;
  --accent-dark: #1D4ED8;
  --success: #10B981;
  --warning: #F59E0B;
  --error: #EF4444;
  --sidebar: #1E293B;
  --sidebar-hover: #334155;
  --sidebar-active: #2563EB;
  --sidebar-text: #CBD5E1;
  --sidebar-active-text: #FFFFFF;
  --layer-navigation: 4000;
  --layer-navigation-flyout: 4100;
  --layer-modal: 5000;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: var(--bg);
}

.login-shell {
  width: min(480px, calc(100vw - 34px));
  margin: 0;
  padding: 24px;
}

.login-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 28px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.login-card img {
  display: block;
  width: 100%;
  margin-bottom: 24px;
}

.login-card h1 {
  margin-bottom: 22px;
  font-size: 26px;
}

.login-note,
.list-count {
  color: var(--muted);
  font-size: 13px;
}

.login-note {
  margin: 16px 0 0;
}

.login-check-row {
  margin: 0;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: var(--layer-navigation);
  width: 240px;
  max-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 0;
  background: var(--sidebar);
  color: var(--sidebar-text);
  scrollbar-color: rgba(203, 213, 225, 0.42) transparent;
  scrollbar-width: thin;
}

.sidebar::-webkit-scrollbar {
  width: 7px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(203, 213, 225, 0.30);
  border-radius: 999px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(203, 213, 225, 0.55);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 16px 12px;
  border-bottom: 1px solid rgba(203, 213, 225, 0.14);
  color: #ffffff;
  text-decoration: none;
}

.brand img {
  display: block;
  width: 30px;
  height: auto;
  object-fit: contain;
}

.brand span {
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
}

.admin-menu,
nav {
  display: grid;
  gap: 2px;
  padding: 12px 8px 18px;
}

nav a,
.menu-item,
.menu-trigger,
.submenu a,
.submenu-disabled {
  display: flex;
  align-items: center;
  min-height: 38px;
  border-radius: 4px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

nav a:hover,
nav a.active,
.menu-item:hover,
.menu-item.active,
.menu-trigger:hover,
.menu-group:hover .menu-trigger,
.menu-group:focus-within .menu-trigger,
.menu-group.flyout-open .menu-trigger,
.menu-group.active-parent .menu-trigger,
.submenu a:hover,
.submenu a.active {
  background: var(--sidebar-hover);
  color: #ffffff;
}

.menu-item,
.menu-trigger {
  gap: 10px;
  padding: 0 10px;
}

.menu-item.active,
.menu-group.active-parent .menu-trigger,
.submenu a.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
}

.menu-item.disabled,
.submenu-disabled {
  cursor: default;
  opacity: 0.58;
}

.menu-item.disabled {
  pointer-events: none;
}

.menu-item.disabled:hover {
  background: transparent;
  color: var(--sidebar-text);
}

.menu-icon {
  display: inline-grid;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid rgba(203, 213, 225, 0.24);
  border-radius: 4px;
  color: #E2E8F0;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.menu-group {
  border-top: 1px solid rgba(203, 213, 225, 0.10);
  margin-top: 6px;
  padding-top: 6px;
}

.menu-trigger {
  width: 100%;
  border: 0;
  background: transparent;
  cursor: default;
  font: inherit;
  text-align: left;
}

.menu-trigger::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.75;
}

.submenu {
  position: fixed;
  left: 240px;
  top: var(--flyout-top, 64px);
  z-index: var(--layer-navigation-flyout);
  display: grid;
  width: 282px;
  max-height: calc(100vh - 76px);
  overflow-y: auto;
  gap: 2px;
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(203, 213, 225, 0.18);
  border-left: 0;
  border-radius: 0 6px 6px 0;
  background: #243244;
  box-shadow: 10px 16px 28px rgba(15, 23, 42, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-6px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.menu-group:hover .submenu,
.menu-group:focus-within .submenu,
.menu-group.flyout-open .submenu {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.submenu a,
.submenu-disabled {
  min-height: 34px;
  padding: 0 11px;
  color: #CBD5E1;
  font-size: 13px;
  font-weight: 600;
}

.logout {
  margin-top: 8px;
  border-top: 1px solid rgba(203, 213, 225, 0.10);
}

.main {
  margin-left: 0;
  padding: 24px;
}

.admin-shell {
  min-height: 100vh;
  margin-left: 240px;
}

.admin-topbar,
.topbar {
  min-height: 52px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 24px;
  color: var(--muted);
  font-size: 13px;
}

.topbar-brand {
  color: var(--text);
  font-weight: 800;
}

.topbar-status,
.topbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.topbar-status span {
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.topbar-actions a {
  color: var(--blue-tech);
  font-weight: 700;
  text-decoration: none;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #F8FAFC;
  padding: 0 8px;
  color: var(--text);
  font-weight: 700;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.header-logo {
  width: min(260px, 34vw);
  max-height: 60px;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--text);
  font-size: 26px;
  font-weight: 650;
}

h2 {
  margin-bottom: 18px;
  color: var(--text);
  font-size: 16px;
  font-weight: 650;
}

.button,
.quick-actions a,
.admin-form button,
.form-stack button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #ffffff;
  text-decoration: none;
  font-weight: 650;
}

.button:hover,
.quick-actions a:hover,
.admin-form button:hover,
.form-stack button:hover,
.link-button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

button:disabled,
.link-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button.secondary {
  border-color: #CBD5E1;
  background: #ffffff;
  color: #334155;
}

button.secondary {
  border-color: #CBD5E1;
  background: #ffffff;
  color: #334155;
}

.form-stack,
.admin-form {
  display: grid;
  gap: 15px;
}

.admin-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-stack label,
.admin-form label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 800;
}

.form-stack span,
.admin-form span {
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #CBD5E1;
  border-radius: 4px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  padding: 0 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue-tech);
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.16);
  outline: 0;
}

textarea {
  min-height: 92px;
  padding: 10px 12px;
  resize: vertical;
}

.admin-form button {
  width: fit-content;
}

.admin-form .full-span {
  grid-column: 1 / -1;
}

.validation-tolerance-form {
  display: grid;
  gap: 18px;
}

.validation-tolerance-form .section-header {
  align-items: start;
}

.validation-tolerance-form .section-header p {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--muted);
}

.validation-settings-scroll {
  max-height: min(62vh, 720px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  scrollbar-gutter: stable;
}

.validation-settings-table {
  width: 100%;
  border-collapse: collapse;
}

.validation-settings-table td {
  border-bottom: 1px solid var(--line);
  padding: 0;
}

.validation-settings-table tr:last-child td {
  border-bottom: 0;
}

.validation-setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 320px);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 6px 18px;
  min-height: 74px;
  padding: 11px 14px;
}

.validation-setting-title {
  display: flex;
  align-items: baseline;
  min-width: 0;
  gap: 9px;
}

.validation-setting-title small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.validation-setting-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.validation-setting-row output {
  justify-self: end;
  padding: 5px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.validation-setting-row output[data-level="0"] {
  background: #e0f2fe;
  color: #075985;
}

.validation-setting-row output[data-level="1"] {
  background: #fef3c7;
  color: #92400e;
}

.validation-setting-row output[data-level="2"] {
  background: #fee2e2;
  color: #991b1b;
}

.validation-setting-row p {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.validation-setting-row select {
  width: 100%;
  min-width: 0;
}

.status-threshold-control {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.status-threshold-zones {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.status-threshold-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 12px;
}

.status-threshold-zone output {
  font-weight: 900;
}

.status-threshold-zone-urgent {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.status-threshold-zone-verify {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.status-threshold-zone-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.status-threshold-slider {
  position: relative;
  height: 32px;
}

.status-threshold-track {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 12px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #dc2626 0 var(--urgent-position),
    #f59e0b var(--urgent-position) var(--ok-position),
    #16a34a var(--ok-position) 100%
  );
  transform: translateY(-50%);
}

.status-threshold-handle {
  position: absolute;
  top: 50%;
  left: 0;
  z-index: 2;
  width: 100%;
  height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  pointer-events: none;
  transform: translateY(-50%);
}

.status-threshold-handle-ok {
  z-index: 3;
}

.status-threshold-handle:focus {
  z-index: 4;
  outline: none;
}

.status-threshold-handle::-webkit-slider-runnable-track {
  height: 12px;
  border: 0;
  background: transparent;
}

.status-threshold-handle::-moz-range-track {
  height: 12px;
  border: 0;
  background: transparent;
}

.status-threshold-handle::-webkit-slider-thumb {
  width: 18px;
  height: 24px;
  margin-top: -6px;
  border: 3px solid #ffffff;
  border-radius: 5px;
  background: #334155;
  box-shadow: 0 0 0 1px #475569, 0 2px 5px rgb(15 23 42 / 30%);
  appearance: none;
  -webkit-appearance: none;
  cursor: grab;
  pointer-events: auto;
}

.status-threshold-handle::-moz-range-thumb {
  width: 12px;
  height: 18px;
  border: 3px solid #ffffff;
  border-radius: 5px;
  background: #334155;
  box-shadow: 0 0 0 1px #475569, 0 2px 5px rgb(15 23 42 / 30%);
  cursor: grab;
  pointer-events: auto;
}

.status-threshold-handle-urgent::-webkit-slider-thumb {
  background: #dc2626;
}

.status-threshold-handle-urgent::-moz-range-thumb {
  background: #dc2626;
}

.status-threshold-handle-ok::-webkit-slider-thumb {
  background: #16a34a;
}

.status-threshold-handle-ok::-moz-range-thumb {
  background: #16a34a;
}

.status-threshold-handle:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px #dbeafe, 0 0 0 5px #2563eb;
}

.status-threshold-handle:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px #dbeafe, 0 0 0 5px #2563eb;
}

.status-threshold-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .status-threshold-zones {
    grid-template-columns: 1fr;
  }

  .validation-setting-row {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 44%);
  }

  .status-threshold-zone {
    padding: 8px 10px;
  }
}

.query-builder-form textarea {
  min-height: 180px;
}

.query-builder-details {
  margin-top: 14px;
}

.query-builder-details pre {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8fafc;
  color: var(--text);
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.45;
  padding: 12px;
  white-space: pre-wrap;
}

.form-submit-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

.link-button {
  min-height: 35px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
}

.danger-link {
  color: var(--error);
}

.danger-link:hover {
  background: #fff1f0;
}

.check-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.form-error {
  margin-bottom: 16px;
  border: 1px solid #fda29b;
  border-radius: 8px;
  background: #fff1f0;
  color: var(--error);
  font-weight: 800;
  padding: 12px;
}

.flash {
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-weight: 700;
}

.flash.success {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.flash.error {
  border-color: #fda29b;
  background: #fff1f0;
  color: var(--error);
}

.flash code {
  display: inline-block;
  margin: 6px 0;
  padding: 6px 10px;
  border-radius: 6px;
  background: #ffffff;
  color: var(--blue-deep);
  font-weight: 900;
}

.form-card {
  display: grid;
  gap: 12px;
  max-width: 520px;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
}

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

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: none;
}

.metric {
  min-height: 94px;
  padding: 16px;
  border-top: 3px solid var(--blue-tech);
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
  color: var(--text);
}

.metric.warning {
  border-top-color: var(--warning);
}

.metric.error {
  border-top-color: var(--error);
}

.metric.offline {
  border-top-color: #6b7280;
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.settings-grid,
.prompt-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.form-field-hint {
  align-self: end;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 14px;
}

.metric-card span,
.prompt-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  color: var(--text);
  font-size: 22px;
}

.metric-card small {
  color: var(--muted);
  line-height: 1.45;
}

.prompt-preview {
  display: grid;
  gap: 8px;
}

.prompt-preview textarea {
  min-height: 260px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
}

.interview-document-thumb-link,
.interview-document-thumb-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  overflow: hidden;
}

.interview-document-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.interview-document-thumb-placeholder {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-decoration: none;
}

.prompt-editor-form {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.prompt-editor-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  padding: 12px 0 0;
}

.prompt-rendered-preview {
  margin-top: 16px;
}

.prompt-rendered-preview textarea {
  margin-top: 10px;
  min-height: 320px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
}

.paddleocr-settings-form {
  align-items: start;
}

.paddleocr-toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 12px;
}

.rich-editor-source {
  display: none;
}

.rich-editor {
  overflow: hidden;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  background: #ffffff;
}

.rich-editor:focus-within {
  border-color: var(--blue-tech);
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.16);
}

.rich-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  background: #F8FAFC;
  padding: 8px;
}

.rich-editor-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  max-width: 220px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: #334155;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.rich-editor-button:hover {
  border-color: var(--blue-tech);
  color: var(--blue-tech);
}

.rich-editor-select {
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: #334155;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.rich-editor-select:hover,
.rich-editor-select:focus {
  border-color: var(--blue-tech);
  outline: 0;
}

.rich-editor-color {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.rich-editor-color input {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.rich-editor-variable-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.rich-editor-variable-group .rich-editor-button {
  color: #0F766E;
}

.rich-editor-surface {
  min-height: var(--rich-editor-min-height, 260px);
  max-height: min(68vh, 760px);
  overflow: auto;
  padding: 12px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  outline: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.rich-editor-footer {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  background: #F8FAFC;
  padding: 6px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.panel {
  padding: 16px;
}

.code-preview {
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.prompt-history-item {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.prompt-history-item summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
}

.prompt-history-item details[open] summary {
  margin-bottom: 8px;
}

.prompt-history-item .status-badge {
  padding: 5px 9px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
}

.prompt-history-item .status-badge.error {
  background: #fee2e2;
  color: #991b1b;
}

.prompt-history-item .status-badge.skipped {
  background: #fef3c7;
  color: #92400e;
}

.conseil-comptoir-tabs {
  margin-top: 18px;
}

.conseil-tab-count {
  min-width: 22px;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  text-align: center;
  font-size: 11px;
}

.conseil-tab-panel {
  display: none;
}

.conseil-tab-panel.active {
  display: block;
}

.conseil-log-table-wrap {
  overflow-x: auto;
  margin-top: 14px;
}

.conseil-log-table {
  min-width: 980px;
}

.conseil-log-row {
  cursor: pointer;
}

.conseil-log-row:hover,
.conseil-log-row:focus {
  background: #f8fafc;
  outline: none;
}

.conseil-log-row code {
  font-size: 11px;
  overflow-wrap: anywhere;
}

.conseil-prompt-modal {
  width: calc(100vw - 24px);
  height: calc(100vh - 24px);
  max-height: none;
}

.conseil-prompt-modal-panel {
  width: 100%;
  height: 100%;
  max-height: none;
}

.conseil-prompt-modal-body {
  overflow: auto;
  padding: 18px;
}

.conseil-log-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.conseil-log-summary > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.conseil-log-summary span {
  color: var(--muted);
  font-size: 12px;
}

.conseil-log-summary strong {
  overflow-wrap: anywhere;
}

.conseil-log-timeline {
  display: grid;
  gap: 0;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.conseil-log-timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 16px;
}

.conseil-log-timeline-item::before {
  position: absolute;
  top: 32px;
  bottom: 0;
  left: 15px;
  width: 2px;
  background: var(--line);
  content: "";
}

.conseil-log-timeline-item:last-child::before {
  display: none;
}

.conseil-log-timeline-index {
  position: relative;
  z-index: 1;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.conseil-log-timeline-item > div {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.conseil-log-timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.conseil-log-timeline-head > span:last-child {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.conseil-log-timeline-item p {
  margin: 8px 0;
}

.conseil-log-timeline-item details summary,
.conseil-audit-details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}

.conseil-log-timeline-item details .code-preview,
.conseil-audit-details .code-preview {
  margin-top: 10px;
  max-height: 52vh;
}

.conseil-prompt-stage + .conseil-prompt-stage {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid var(--line);
}

.conseil-prompt-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.conseil-prompt-detail.full-span {
  grid-column: 1 / -1;
}

.conseil-prompt-detail h4 {
  margin: 0 0 7px;
}

.conseil-prompt-detail .code-preview {
  max-height: 42vh;
}

@media (max-width: 900px) {
  .conseil-log-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .conseil-prompt-detail-grid {
    grid-template-columns: 1fr;
  }

  .conseil-prompt-detail.full-span {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .conseil-log-summary {
    grid-template-columns: 1fr;
  }
}

.spaced-panel {
  margin-top: 12px;
}

.summary-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.summary-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

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

.section-header h2 {
  margin-bottom: 0;
}

.section-header span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.summary-list div:last-child {
  border-bottom: 0;
}

dt {
  color: var(--muted);
  font-weight: 700;
}

dd {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  background: #ffffff;
}

.system-table-wrap {
  max-height: 620px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.system-table th,
.system-table td {
  padding: 11px 14px;
  vertical-align: top;
}

.system-table td:first-child {
  width: 260px;
  color: var(--blue-deep);
  font-weight: 800;
}

.system-table td:last-child {
  overflow-wrap: anywhere;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  background: #F8FAFC;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  text-transform: none;
}

tbody tr:hover {
  background: #F1F5F9;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty {
  margin-bottom: 0;
  color: var(--muted);
}

.table-link {
  color: var(--blue-tech);
  font-weight: 650;
  text-decoration: none;
}

.table-link:hover {
  text-decoration: underline;
}

.table-actions {
  white-space: nowrap;
}

.table-actions .inline-form {
  margin-left: 10px;
}

.connector-updates-shell,
.connector-update-panel,
.connector-update-tabs,
.connector-update-pagination {
  max-width: 100%;
  min-width: 0;
}

.connector-update-tabs {
  margin-top: 14px;
  margin-bottom: 0;
}

.connector-update-tabs .tab-button {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  text-align: left;
}

.connector-updates-table {
  table-layout: fixed;
}

.connector-updates-table th,
.connector-updates-table td {
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.connector-updates-table code {
  white-space: normal;
  overflow-wrap: anywhere;
}

.connector-updates-table .table-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  white-space: normal;
}

.connector-updates-table .table-actions .inline-form {
  max-width: 100%;
  margin-left: 0;
}

.connector-updates-table .table-actions .link-button {
  max-width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 0 10px;
  white-space: normal;
}

.connector-updates-table .table-actions .table-link {
  max-width: 100%;
  min-width: 0;
  white-space: normal;
}

.connector-versions-table th,
.connector-versions-table td {
  padding: 7px 8px;
  font-size: 13px;
  line-height: 1.25;
}

.connector-version-actions-heading {
  width: 120px;
}

.connector-version-actions {
  gap: 4px;
  justify-content: flex-start;
}

.icon-action {
  display: inline-flex;
  width: 26px;
  min-width: 26px;
  height: 26px;
  min-height: 26px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #475569;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.icon-action:hover {
  border-color: #CBD5E1;
  background: #F8FAFC;
  color: #0F172A;
  text-decoration: none;
}

.icon-action:focus-visible {
  outline: 2px solid var(--blue-tech);
  outline-offset: 2px;
}

.icon-action.primary {
  color: #2563EB;
}

.icon-action.success {
  color: #047857;
}

.icon-action.warning {
  color: #B45309;
}

.icon-action.danger {
  color: #B91C1C;
}

.icon-action-svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.connector-update-pagination .pagination-pages,
.connector-update-pagination .pagination-size {
  min-width: 0;
}

.connector-update-pagination .pagination-pages a,
.connector-update-pagination .pagination-pages span {
  white-space: normal;
  text-align: center;
}

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 16px;
}

.pagination-footer {
  margin: 16px 0 0;
}

.pagination-info {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pagination-size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pagination-size select {
  width: auto;
  min-height: 34px;
  padding: 0 28px 0 10px;
}

.pagination-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pagination-pages a,
.pagination-pages span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.pagination-pages a {
  color: var(--blue-tech);
}

.pagination-pages .active {
  border-color: var(--blue-tech);
  background: #EAF2FF;
  color: #1D4ED8;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #EAF2FF;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status.actif,
.status.online,
.status.active,
.status.success {
  background: #ECFDF5;
  color: #047857;
}

.brand-showcase {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.brand-asset {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 18px;
  box-shadow: none;
}

.brand-asset.wide {
  grid-column: 1 / -1;
}

.transparent-stage {
  display: grid;
  min-height: 260px;
  place-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, #eef1f4 25%, transparent 25%),
    linear-gradient(-45deg, #eef1f4 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef1f4 75%),
    linear-gradient(-45deg, transparent 75%, #eef1f4 75%);
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
}

.transparent-stage img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
}

.api-docs-frame {
  display: block;
  width: 100%;
  min-height: 720px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
}

.api-docs-summary {
  margin: 0 0 14px;
}

.mcp-docs-panel {
  display: grid;
  gap: 16px;
}

.mcp-docs-summary {
  margin-bottom: 0;
}

.mcp-docs-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.mcp-doc-box {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 14px;
}

.mcp-code-block {
  max-height: 320px;
  margin-top: 0;
  white-space: pre-wrap;
}

.mcp-guardrails {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-weight: 700;
}

.mcp-tools-table {
  min-width: 860px;
}

.mcp-tools-table td {
  white-space: normal;
}

.mcp-tools-table td:nth-child(2) {
  white-space: nowrap;
}

.status.warning,
.status.test,
.status.running {
  background: #FFFBEB;
  color: #B45309;
}

.status.error,
.status.resilie {
  background: #FEF2F2;
  color: #B91C1C;
}

.status.offline,
.status.suspendu,
.status.inactive,
.status.disabled {
  background: #F1F5F9;
  color: #475569;
}

.status.stock_et_usage {
  background: #D1FAE5;
  color: #047857;
}

.status.stock_dormant {
  background: #FEF3C7;
  color: #92400E;
}

.status.usage_sans_stock {
  background: #DBEAFE;
  color: #1D4ED8;
}

.worker-inline-form {
  min-width: 420px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
}

.detail-grid div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.detail-grid dd {
  margin-top: 4px;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.detail-grid dd small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.connector-detail-panel,
.connector-update-panel,
.connector-system-summary {
  max-width: 100%;
  min-width: 0;
}

.connector-detail-panel .section-header {
  flex-wrap: wrap;
}

.connector-detail-panel .section-header h2 {
  min-width: 0;
  overflow-wrap: anywhere;
}

.connector-detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
}

.connector-detail-grid div {
  min-width: 0;
  padding: 8px 10px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
}

.connector-detail-grid dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.connector-detail-grid dd {
  min-width: 0;
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.connector-detail-grid .status {
  min-height: 22px;
  padding: 2px 7px;
  font-size: 11px;
}

.connector-update-form {
  grid-template-columns: minmax(170px, 0.9fr) minmax(220px, 1.35fr) minmax(150px, 0.7fr) auto;
  gap: 10px;
  align-items: end;
}

.connector-update-form label,
.connector-update-form textarea,
.connector-update-form select {
  min-width: 0;
}

.connector-update-form textarea {
  min-height: 42px;
  resize: vertical;
}

.connector-update-form .check-row {
  grid-template-columns: auto minmax(0, 1fr);
  align-self: center;
  gap: 8px;
}

.connector-update-form .form-submit-row {
  flex-wrap: wrap;
  gap: 6px;
}

.connector-update-form .form-submit-row button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.connector-delete-card {
  max-width: 100%;
  margin-top: 10px;
}

.connector-detail-table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
}

.connector-detail-table th,
.connector-detail-table td {
  padding: 7px 8px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.pharmaml-test-panel {
  margin-top: 12px;
}

.pharmaml-command-test-layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.85fr) minmax(420px, 1.15fr);
  gap: 14px;
  align-items: start;
}

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

.pharmaml-test-form label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--text);
  font-weight: 800;
}

.pharmaml-test-form label > span {
  color: #334155;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.pharmaml-test-form textarea {
  min-height: 108px;
  resize: vertical;
  font-family: var(--font-mono, "Consolas", monospace);
  line-height: 1.35;
}

.pharmaml-test-form label small {
  color: #64748B;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.pharmaml-test-form .pharmaml-test-check,
.pharmaml-test-form .pharmaml-test-lines,
.pharmaml-test-actions,
.pharmaml-test-warning,
.pharmaml-test-status {
  grid-column: 1 / -1;
}

.pharmaml-test-form .pharmaml-test-check {
  display: flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid #DBEAFE;
  border-radius: 6px;
  background: #F8FAFC;
  padding: 10px 12px;
}

.pharmaml-test-form .pharmaml-test-check span {
  color: #334155;
  font-size: 13px;
  font-weight: 800;
  text-transform: none;
}

.pharmaml-test-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pharmaml-test-side {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.pharmaml-test-next-window {
  display: grid;
  gap: 8px;
  min-width: 0;
  border: 1px solid #BFDBFE;
  border-radius: 6px;
  background: #EFF6FF;
  padding: 14px;
}

.pharmaml-test-next-window span {
  color: #1D4ED8;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.pharmaml-test-next-window h3 {
  margin: 0;
  color: #1E293B;
  font-size: 16px;
  line-height: 1.25;
}

.pharmaml-test-next-window p {
  margin: 0;
  color: #334155;
  font-size: 13px;
  line-height: 1.45;
}

.pharmaml-test-next-window ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.pharmaml-next-sql {
  max-height: 180px;
  margin: 0;
  overflow: auto;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  background: #0F172A;
  color: #E2E8F0;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.45;
}

.pharmaml-test-warning,
.pharmaml-test-status {
  margin: 0;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.pharmaml-test-warning {
  border: 1px solid rgba(245, 158, 11, 0.42);
  background: #FFFBEB;
  color: #92400E;
}

.pharmaml-test-status {
  border: 1px solid var(--line);
  background: #F8FAFC;
  color: #475569;
}

.pharmaml-test-status.ok {
  border-color: rgba(16, 185, 129, 0.35);
  background: #ECFDF5;
  color: #047857;
}

.pharmaml-test-status.warning {
  border-color: rgba(245, 158, 11, 0.35);
  background: #FFFBEB;
  color: #92400E;
}

.pharmaml-test-status.error {
  border-color: rgba(239, 68, 68, 0.35);
  background: #FEF2F2;
  color: #B91C1C;
}

.pharmaml-test-debug {
  display: grid;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  overflow: hidden;
}

.pharmaml-test-tabs {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  background: #F8FAFC;
}

.pharmaml-test-tabs button {
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: #475569;
  padding: 0 12px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 850;
}

.pharmaml-test-tabs button.active {
  background: #ffffff;
  color: var(--blue-deep);
}

.pharmaml-test-output {
  display: none;
  min-height: 318px;
  max-height: 520px;
  margin: 0;
  overflow: auto;
  background: #0F172A;
  color: #DDEBFF;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.pharmaml-test-output.active {
  display: block;
}

.pharmaml-pipe-panel {
  margin-top: 12px;
}

.pharmaml-pipe-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.pipe-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.pipe-status.done {
  border-color: rgba(16, 185, 129, 0.35);
  background: #ECFDF5;
  color: #047857;
}

.pipe-status.error {
  border-color: rgba(239, 68, 68, 0.35);
  background: #FEF2F2;
  color: #B91C1C;
}

.pipe-status.warning {
  border-color: rgba(245, 158, 11, 0.35);
  background: #FFFBEB;
  color: #92400E;
}

.pipe-status.pending,
.pipe-status.skipped,
.pipe-status.planned {
  border-color: #CBD5E1;
  background: #F8FAFC;
  color: #475569;
}

.pharmaml-pipe-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.pharmaml-pipe-summary div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 11px 12px;
}

.pharmaml-pipe-summary dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.pharmaml-pipe-summary dd {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.pharmaml-pipe-summary small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.pharmaml-pipe {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.pharmaml-pipe-step {
  min-height: 138px;
  border: 1px solid var(--line);
  border-top: 3px solid #CBD5E1;
  border-radius: 6px;
  background: #ffffff;
  padding: 12px;
}

.pharmaml-pipe-step.done {
  border-top-color: var(--success);
}

.pharmaml-pipe-step.error {
  border-top-color: var(--error);
}

.pharmaml-pipe-step.warning {
  border-top-color: var(--warning);
}

.pharmaml-pipe-step.skipped,
.pharmaml-pipe-step.pending,
.pharmaml-pipe-step.planned {
  background: #F8FAFC;
}

.pharmaml-pipe-step-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.pharmaml-pipe-step-head strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
}

.pharmaml-pipe-step-head span {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #E2E8F0;
  color: #334155;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.pharmaml-pipe-step.done .pharmaml-pipe-step-head span {
  background: #D1FAE5;
  color: #047857;
}

.pharmaml-pipe-step.error .pharmaml-pipe-step-head span {
  background: #FEE2E2;
  color: #B91C1C;
}

.pharmaml-pipe-step.warning .pharmaml-pipe-step-head span {
  background: #FEF3C7;
  color: #92400E;
}

.pharmaml-pipe-step.planned .pharmaml-pipe-step-head span {
  background: #DBEAFE;
  color: #1D4ED8;
}

.pharmaml-pipe-step p {
  margin: 10px 0 0;
  color: #334155;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.pharmaml-pipe-step small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.error-text {
  color: var(--error) !important;
}

.subnav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.subnav a {
  flex: 0 1 auto;
  min-width: 0;
  margin-bottom: -1px;
  padding: 9px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: #334155;
  text-decoration: none;
  font-weight: 650;
  white-space: normal;
}

.subnav a.active {
  border-color: var(--blue-tech);
  background: transparent;
  color: var(--blue-tech);
}

.subnav .connector-disable-form {
  margin-left: auto;
}

.subnav-action {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.tab-button {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: #ffffff;
  color: #334155;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
}

.tab-button.active {
  border-color: var(--blue-tech);
  background: #ffffff;
  color: var(--blue-tech);
}

.connector-tab-panel {
  display: none;
}

.connector-tab-panel.active {
  display: block;
}

.context-tab-panel {
  display: none;
}

.context-tab-panel.active {
  display: block;
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.toolbar-row label,
.sql-editor-label {
  display: grid;
  gap: 7px;
  min-width: min(360px, 100%);
  color: var(--text);
  font-weight: 800;
}

.toolbar-row label span,
.sql-editor-label span {
  font-size: 13px;
}

.connector-workspace {
  gap: 16px;
}

.table-scroll {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
}

.context-table-scroll {
  max-height: min(68vh, 720px);
}

.context-table-scroll .compact-table {
  min-width: 1100px;
}

.compact-table th,
.compact-table td {
  padding: 9px 11px;
  vertical-align: top;
  white-space: nowrap;
}

.compact-table td:last-child {
  white-space: normal;
}

.compact-table input,
.compact-table select,
.compact-table textarea {
  min-width: 130px;
}

.compact-table textarea {
  min-width: 260px;
  min-height: 62px;
}

.compact-table input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  min-height: 18px;
}

.compact-table .json-output {
  max-height: 220px;
  margin: 0;
  border-radius: 6px;
  white-space: pre-wrap;
}

.menu-manager {
  display: grid;
  gap: 12px;
}

.menu-manager-toolbar {
  justify-content: flex-start;
}

.menu-manager-table {
  min-width: 1180px;
}

.menu-manager-table th,
.menu-manager-table td {
  vertical-align: middle;
}

.menu-manager-group-row {
  background: #f8fafc;
}

.menu-manager-child-label {
  padding-left: 24px;
}

.menu-manager-order,
.menu-manager-actions,
.menu-active-inputs {
  display: grid;
  gap: 6px;
}

.menu-manager-order,
.menu-manager-actions {
  grid-template-columns: repeat(2, minmax(0, auto));
}

.menu-manager-actions {
  min-width: 180px;
}

.menu-active-inputs input {
  min-width: 230px;
}

.menu-reset-form {
  margin-top: 12px;
}

.ordonnance-steps-table {
  min-width: 980px;
}

.ordonnance-steps-table td,
.ordonnance-ai-table td {
  white-space: normal;
}

.ordonnance-ai-table {
  min-width: 1120px;
}

.ordonnance-ai-table input {
  display: block;
  margin-top: 8px;
}

.ordonnance-ai-table input:first-child {
  margin-top: 0;
}

.status-message {
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.status-message.success {
  color: #166534;
}

.status-message.error {
  color: var(--error);
}

.upload-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.upload-progress progress {
  width: min(420px, 100%);
  height: 14px;
}

.sql-editor {
  min-height: 160px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.query-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.query-metrics span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fbfcfc;
  padding: 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pharmaml-supplier-layout,
.pharmaml-test-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.pharmaml-test-layout {
  grid-template-columns: 1fr;
}

.pharmaml-test-layout > div {
  display: flex;
  justify-content: flex-start;
}

.pharmaml-supplier-table {
  min-width: 420px;
}

.pharmaml-supplier-table .selected-row {
  background: #eef6ff;
}

.pharmaml-supplier-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pharmaml-exchange-label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 800;
}

.pharmaml-exchange-label span {
  font-size: 13px;
}

.pharmaml-exchange-log {
  width: 100%;
  box-sizing: border-box;
  min-height: 350px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  white-space: pre;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: rgba(88, 55, 140, 0.08);
}

.clickable-row:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.pharmaml-detail-output {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0F172A;
  color: #e8edf1;
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre;
}

.json-output {
  max-height: 420px;
  overflow: auto;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0F172A;
  color: #e8edf1;
  padding: 14px;
  font-size: 13px;
}

.ai-context-preview {
  max-height: 68vh;
}

.ai-sync-form {
  margin-bottom: 16px;
}

.cron-detail {
  margin-bottom: 16px;
}

.ai-model-table-wrap {
  max-height: 720px;
}

.ai-model-table {
  min-width: 1280px;
}

.ai-description {
  min-width: 280px;
  white-space: normal !important;
}

.raw-details {
  margin-top: 10px;
}

.raw-details summary {
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 800;
}

.raw-details .json-output {
  width: min(720px, 72vw);
  max-height: 300px;
  white-space: pre-wrap;
}

.muted-inline {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.worker-log-list {
  display: grid;
  gap: 14px;
}

.worker-log-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  overflow: hidden;
}

.order-automation-run-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
}

.order-automation-run-form label {
  width: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.order-automation-run-form select {
  min-width: 280px;
}

.order-automation-pipe {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.order-automation-table,
.order-automation-history-table {
  min-width: 1080px;
}

.order-automation-table td small,
.order-automation-history-table td small {
  display: block;
  max-width: 420px;
  margin-top: 4px;
  color: var(--muted);
  white-space: normal;
}

.order-automation-table .selected-row {
  background: #eef7ff;
}

.generic-algorithm-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 22px;
  align-items: center;
  border-left: 5px solid #5b3f91;
  background: linear-gradient(135deg, #ffffff 0%, #f5f3ff 100%);
}

.generic-algorithm-hero h2,
.generic-algorithm-hero p {
  margin: 0;
}

.generic-algorithm-hero h2 {
  margin-top: 5px;
  color: #3f2868;
}

.generic-algorithm-hero p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.55;
}

.generic-algorithm-kicker {
  color: #6d4ba4;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.generic-algorithm-formula {
  display: grid;
  gap: 8px;
  border: 1px solid #d8cee8;
  border-radius: 7px;
  background: #ffffff;
  padding: 15px;
}

.generic-algorithm-formula > span {
  color: #6d4ba4;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.generic-algorithm-formula code {
  display: block;
  border-radius: 5px;
  background: #f3f0f8;
  color: #3f2868;
  padding: 9px 10px;
  white-space: normal;
}

.generic-algorithm-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.generic-algorithm-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  margin: 0;
  border-top: 4px solid #5b3f91;
}

.generic-algorithm-step.golden {
  border-top-color: #d4a017;
}

.generic-algorithm-step.replacement {
  border-top-color: #15803d;
}

.generic-algorithm-step.choice {
  border-top-color: #2563eb;
}

.generic-algorithm-step.validation {
  border-top-color: #dc2626;
}

.generic-algorithm-step-number {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #5b3f91;
  color: #ffffff;
  font-weight: 900;
}

.generic-algorithm-step.golden .generic-algorithm-step-number {
  background: #d4a017;
}

.generic-algorithm-step.replacement .generic-algorithm-step-number {
  background: #15803d;
}

.generic-algorithm-step.choice .generic-algorithm-step-number {
  background: #2563eb;
}

.generic-algorithm-step.validation .generic-algorithm-step-number {
  background: #dc2626;
}

.generic-algorithm-step h3,
.generic-algorithm-step p {
  margin: 0;
}

.generic-algorithm-step p {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.5;
}

.generic-algorithm-step ul,
.generic-algorithm-step ol {
  margin: 12px 0 0;
  padding-left: 19px;
  color: #475569;
  font-size: 13px;
  line-height: 1.5;
}

.generic-algorithm-settings-form {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

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

.generic-algorithm-settings-grid > label {
  display: grid;
  gap: 7px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  padding: 14px;
}

.generic-algorithm-settings-grid > label > span:first-child {
  font-weight: 800;
}

.generic-algorithm-settings-grid input[type="number"] {
  width: 100%;
}

.generic-algorithm-settings-grid small,
.generic-algorithm-settings-actions p {
  color: var(--muted);
  line-height: 1.4;
}

.generic-algorithm-settings-grid .generic-algorithm-checkbox {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
}

.generic-algorithm-checkbox input {
  margin-top: 4px;
}

.generic-algorithm-checkbox span,
.generic-algorithm-checkbox small {
  display: block;
}

.generic-algorithm-settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.generic-algorithm-settings-actions p {
  margin: 0;
}

.cno-config-header {
  align-items: flex-end;
}

.cno-pharmacy-form select {
  min-width: 320px;
}

.cno-config-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.cno-lppr-add-form,
.cno-config-summary {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  padding: 18px;
}

.cno-lppr-add-form {
  display: grid;
  gap: 12px;
}

.cno-lppr-add-form > label {
  font-size: 13px;
  font-weight: 800;
}

.cno-autocomplete {
  position: relative;
}

.cno-autocomplete-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  max-height: 340px;
  overflow: auto;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
}

.cno-autocomplete-option {
  display: grid;
  width: 100%;
  gap: 4px;
  border: 0;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 0;
  background: #ffffff;
  color: var(--text);
  padding: 11px 13px;
  text-align: left;
}

.cno-autocomplete-option:last-child {
  border-bottom: 0;
}

.cno-autocomplete-option:hover,
.cno-autocomplete-option.active {
  background: #f3efff;
  color: var(--text);
}

.cno-autocomplete-option strong {
  font-size: 13px;
}

.cno-autocomplete-option small {
  color: var(--muted);
  font-size: 11px;
}

.cno-autocomplete-option span {
  font-size: 12px;
  font-weight: 800;
}

.cno-autocomplete-option .has-lppr {
  color: #166534;
}

.cno-autocomplete-option .no-lppr {
  color: #b45309;
}

.cno-autocomplete-empty,
.cno-search-status {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.cno-autocomplete-empty {
  padding: 13px;
}

.cno-lppr-preview {
  display: grid;
  gap: 6px;
  border: 1px solid #ddd6fe;
  border-radius: 6px;
  background: #ffffff;
  padding: 13px;
}

.cno-lppr-preview > span,
.cno-config-summary > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.cno-lppr-preview dl {
  display: grid;
  grid-template-columns: minmax(130px, 0.4fr) minmax(0, 1.6fr);
  gap: 8px;
  margin: 5px 0 0;
}

.cno-lppr-preview dl div {
  min-width: 0;
}

.cno-lppr-preview dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.cno-lppr-preview dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 800;
}

.cno-laboratory-lppr-list {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  background: #f8fafc;
}

.cno-laboratory-lppr-list > .empty {
  margin: 0;
  padding: 13px;
}

.cno-laboratory-lppr-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.3fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
  border-bottom: 1px solid #e2e8f0;
}

.cno-laboratory-lppr-row:last-child {
  border-bottom: 0;
}

.cno-laboratory-lppr-row span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 700;
}

.cno-laboratory-lppr-row small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.cno-lppr-add-form > button {
  width: fit-content;
}

.cno-config-summary {
  display: flex;
  min-height: 190px;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  background: #f5f3ff;
}

.cno-config-summary strong {
  color: #4c1d95;
  font-size: 19px;
}

.cno-config-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.cno-config-summary a {
  margin-top: auto;
  color: var(--blue-tech);
  font-weight: 800;
}

.cno-lppr-table {
  min-width: 860px;
}

.cno-lppr-controls {
  display: grid;
  grid-template-columns: minmax(280px, 1.5fr) minmax(220px, 1fr) minmax(170px, 0.7fr) auto;
  gap: 12px;
  align-items: end;
  margin: 18px 0 10px;
}

.cno-lppr-controls label {
  display: grid;
  gap: 6px;
  margin: 0;
}

.cno-lppr-controls label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cno-lppr-controls input,
.cno-lppr-controls select {
  width: 100%;
  min-height: 40px;
}

.cno-lppr-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-weight: 650;
  white-space: nowrap;
}

.cno-lppr-list-summary {
  min-height: 19px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.cno-lppr-sort {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  text-align: left;
}

.cno-lppr-sort:hover,
.cno-lppr-sort:focus-visible {
  background: transparent;
  color: var(--blue-tech);
}

.cno-lppr-sort span {
  color: var(--blue-tech);
  font-size: 10px;
}

.cno-lppr-pagination .pagination-pages button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.cno-lppr-pagination .pagination-pages button:hover:not(:disabled),
.cno-lppr-pagination .pagination-pages button.active {
  border-color: var(--blue-tech);
  background: var(--blue-tech);
  color: #ffffff;
}

.cno-lppr-pagination .pagination-pages button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.cno-lppr-table [hidden],
.cno-lppr-pagination[hidden] {
  display: none !important;
}

.cno-lppr-table td small {
  display: block;
  max-width: 620px;
  margin-top: 4px;
  color: var(--muted);
  white-space: normal;
}

.cno-delete-button {
  border-color: #fecaca;
  background: #ffffff;
  color: #b91c1c;
}

.cno-delete-button:hover {
  border-color: #ef4444;
  background: #fef2f2;
  color: #991b1b;
}

@media (max-width: 1050px) {
  .cno-lppr-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cno-lppr-reset {
    width: fit-content;
  }
}

@media (max-width: 640px) {
  .cno-lppr-controls {
    grid-template-columns: 1fr;
  }
}

.alert.success,
.alert.error {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid;
  border-radius: 6px;
  font-weight: 700;
}

.alert.success {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.alert.error {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

@media (max-width: 900px) {
  .order-automation-pipe {
    grid-template-columns: 1fr;
  }

  .generic-algorithm-hero,
  .generic-algorithm-steps,
  .generic-algorithm-settings-grid {
    grid-template-columns: 1fr;
  }

  .generic-algorithm-settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .order-automation-run-form,
  .order-automation-run-form label {
    justify-content: stretch;
    text-align: left;
  }

  .order-automation-run-form select,
  .order-automation-run-form button {
    width: 100%;
  }

  .cno-config-grid,
  .cno-lppr-preview dl {
    grid-template-columns: 1fr;
  }

  .cno-laboratory-lppr-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .cno-laboratory-lppr-row small {
    white-space: normal;
  }

  .cno-pharmacy-form select {
    min-width: 0;
  }
}

.worker-log-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #F8FAFC;
}

.worker-log-card-header h3 {
  margin: 0 0 3px;
  font-size: 15px;
}

.worker-log-card-header span:not(.status) {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.worker-log-table {
  border: 0;
}

.worker-log-table th,
.worker-log-table td {
  vertical-align: top;
}

.worker-log-details summary {
  color: var(--blue-tech);
  cursor: pointer;
  font-weight: 800;
}

.worker-log-details.error summary {
  color: var(--error);
}

.worker-log-details pre {
  max-height: 220px;
  overflow: auto;
  margin: 8px 0 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0F172A;
  color: #e8edf1;
  padding: 10px;
  white-space: pre-wrap;
}

.worker-access-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.worker-access-table td,
.worker-summary-table td {
  vertical-align: top;
  white-space: normal;
}

.worker-summary-table {
  min-width: 1040px;
}

.worker-row strong {
  display: block;
  margin-bottom: 3px;
}

.admin-modal {
  width: min(1120px, calc(100vw - 36px));
  max-width: none;
  max-height: 90vh;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.admin-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.admin-modal-panel {
  display: grid;
  max-height: 90vh;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 62px rgba(15, 23, 42, 0.26);
}

.admin-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #F8FAFC;
}

.admin-modal-head h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.admin-modal-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.worker-modal-form,
.worker-log-modal-body {
  max-height: calc(90vh - 68px);
  overflow: auto;
  padding: 16px;
}

.worker-modal-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.worker-modal-form .full-span {
  grid-column: 1 / -1;
}

.worker-modal-form textarea {
  min-height: 220px;
}

.worker-modal-meta dd {
  font-size: 14px;
}

.worker-log-modal-panel {
  width: 100%;
}

.worker-log-empty {
  padding: 18px;
}

.worker-log-modal .worker-log-table {
  min-width: 960px;
}

.worker-log-modal .worker-log-details pre {
  max-height: 300px;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

@media (max-width: 860px) {
  .sidebar {
    position: static;
    width: auto;
    max-height: none;
    overflow: visible;
  }

  .submenu {
    position: static;
    width: auto;
    max-height: none;
    overflow: visible;
    margin: 4px 0 2px 32px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .admin-shell {
    margin-left: 0;
  }

  .admin-topbar,
  .topbar {
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 12px 18px;
  }

  .topbar-status,
  .topbar-actions {
    gap: 8px;
  }

  .topbar-status span {
    padding-left: 0;
    border-left: 0;
  }

  .main {
    margin-left: 0;
    padding: 22px;
  }

  .topbar,
  .panel-grid,
  .settings-grid,
  .prompt-preview-grid,
  .brand-showcase {
    display: block;
  }

  .button,
  .header-logo {
    margin-top: 16px;
  }

  .header-logo {
    width: 100%;
    max-height: 100px;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .worker-access-metrics,
  .worker-modal-form {
    grid-template-columns: 1fr;
  }

  .panel {
    margin-top: 16px;
  }

.brand-asset {
    margin-top: 16px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .admin-form {
    grid-template-columns: 1fr;
  }

  .connector-detail-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  }

  .connector-update-form {
    grid-template-columns: 1fr;
  }

  .subnav .connector-disable-form {
    margin-left: 0;
  }

  .connector-update-pagination {
    align-items: stretch;
  }

  .connector-update-pagination .pagination-pages,
  .connector-update-pagination .pagination-size {
    width: 100%;
  }

  .connector-update-pagination .pagination-pages a,
  .connector-update-pagination .pagination-pages span {
    flex: 1 1 120px;
    justify-content: center;
  }

  .responsive-table {
    display: block;
    border: 0;
    background: transparent;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table tbody {
    display: grid;
    gap: 10px;
  }

  .responsive-table tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #ffffff;
  }

  .responsive-table td {
    display: grid;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    width: 100%;
    border-bottom: 1px solid var(--line);
  }

  .responsive-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .responsive-table .table-actions {
    display: block;
  }

  .responsive-table .table-actions::before {
    display: block;
    margin-bottom: 8px;
  }

  .responsive-table .table-actions > a,
  .responsive-table .table-actions > form {
    display: inline-flex;
    min-width: 0;
    margin: 0 8px 8px 0;
    vertical-align: top;
  }

  .pharmaml-supplier-layout,
  .pharmaml-command-test-layout,
  .pharmaml-test-layout,
  .pharmaml-supplier-form {
    grid-template-columns: 1fr;
  }

  .pharmaml-test-form {
    grid-template-columns: 1fr;
  }
}

.connector-sql-form {
  display: block;
}

.connector-sql-toolbar {
  align-items: end;
  margin-bottom: 18px;
}

.permission-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 2px 4px 2px 0;
  padding: 4px 8px;
  border: 1px solid var(--border-color, #d9e2ec);
  border-radius: 6px;
  background: #f6f8fb;
  white-space: nowrap;
}

.permission-pill button {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #dfe7ef;
  color: #344054;
  cursor: pointer;
}

.empty-inline {
  color: #7a8699;
}

.stock-page {
  display: grid;
  gap: 16px;
}

.stock-titlebar,
.stock-result-head,
.stock-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.stock-titlebar h2 {
  margin: 4px 0 6px;
}

.stock-actions,
.stock-scope-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.stock-actions form,
.stock-inventory-footer form {
  margin: 0;
}

.general-advice-winpharma .stock-filters,
.general-advice-winpharma .stock-actions,
.general-advice-winpharma > .muted,
.general-advice-winpharma > .status-message {
  margin-right: 10px;
  margin-left: 10px;
}

.general-advice-winpharma .stock-actions {
  padding: 6px 0;
}

.general-advice-winpharma-table th {
  border-color: #c8c1d9;
  background: #e8e4f2;
  color: #3e286d;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.general-advice-winpharma-table td {
  overflow: hidden;
  border-color: #e2deeb;
  padding: 4px 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.general-advice-winpharma-table tbody tr:nth-child(even) {
  background: #faf9fc;
}

.general-advice-winpharma-table .stock-col-name {
  width: 24%;
}

.general-advice-winpharma-table .stock-col-ean {
  width: 11%;
}

.general-advice-col-supplier {
  width: 15%;
}

.general-advice-col-indication {
  width: 25%;
}

.general-advice-col-posology {
  width: 17%;
}

.general-advice-col-status {
  width: 8%;
}

.general-advice-product-row {
  cursor: pointer;
  transition: background 140ms ease, box-shadow 140ms ease;
}

.general-advice-product-row:hover,
.general-advice-product-row:focus {
  outline: none;
  background: #eeeafd;
  box-shadow: inset 3px 0 0 #5b3f91;
}

.general-advice-toolbar-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 10px;
  margin: 10px 0;
}

.general-advice-toolbar-card {
  min-width: 0;
  margin: 8px 0;
  padding: 10px;
  border: 1px solid #b8accd;
  background: #f8f6fb;
}

.general-advice-toolbar-card h3 {
  margin: 0 0 8px;
  color: #4b3379;
  font-size: 13px;
  text-transform: uppercase;
}

.general-advice-toolbar-card .stock-actions {
  margin: 0;
}

.general-advice-ai-prompt-settings {
  margin-top: 10px;
}

.general-advice-ai-prompt-settings summary {
  color: #4b3379;
  cursor: pointer;
  font-weight: 700;
}

.general-advice-ai-prompt-settings label,
.general-advice-ai-prompt-settings textarea {
  display: block;
  width: 100%;
}

.general-advice-ai-prompt-settings label {
  margin-top: 8px;
}

.general-advice-ai-prompt-settings textarea {
  box-sizing: border-box;
  margin-top: 4px;
  min-height: 280px;
  resize: vertical;
}

@media (max-width: 1050px) {
  .general-advice-toolbar-grid {
    grid-template-columns: 1fr;
  }
}

.general-advice-modal {
  position: fixed;
  inset: 0;
  z-index: var(--layer-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(16, 24, 40, 0.58);
  backdrop-filter: blur(3px);
}

.general-advice-modal.open {
  display: flex;
}

.general-advice-modal-window {
  width: min(1480px, calc(100vw - 48px));
  max-height: 92vh;
  overflow: hidden;
  border: 1px solid #b7a9d6;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(16, 24, 40, 0.32);
}

.general-advice-modal-window > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px;
  border-bottom: 1px solid #4b3379;
  background: #5b3f91;
}

.general-advice-modal-window header h2,
.general-advice-modal-window header p {
  margin: 4px 0 0;
  color: #fff;
}

.general-advice-modal-window > header small {
  color: #e8e2f5;
}

.general-advice-modal-body {
  max-height: calc(92vh - 105px);
  overflow: auto;
  padding: 24px;
}

.general-advice-product-image {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 180px;
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid #d8d2e8;
  border-radius: 3px;
  background: #faf9fc;
  color: var(--muted);
}

.general-advice-product-image img {
  display: block;
  width: auto;
  max-width: min(460px, 100%);
  max-height: 340px;
  object-fit: contain;
}

.general-advice-product-image figcaption {
  color: var(--muted);
  font-size: 12px;
}

.general-advice-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.general-advice-detail-field {
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid #d8d2e8;
  border-radius: 2px;
  background: #faf9fc;
}

.general-advice-detail-field dt {
  margin-bottom: 5px;
  color: #5b3f91;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.general-advice-detail-field dd {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.general-advice-modal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  padding: 30px;
  color: var(--muted);
  font-weight: 800;
}

.general-advice-modal-loading.error {
  color: var(--error);
}

.winpharma-product-editor {
  position: relative;
  width: min(1500px, calc(100vw - 20px));
  height: min(760px, calc(100vh - 20px));
  max-height: calc(100vh - 20px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border-color: #79649f;
  font-size: 12px;
}

.winpharma-product-editor > header {
  align-items: center;
  padding: 9px 12px;
  gap: 12px;
}

.winpharma-product-editor > header h2 {
  margin-top: 1px;
  font-size: 17px;
  line-height: 1.1;
}

.winpharma-product-editor > header p {
  margin-top: 2px;
  font-size: 11px;
}

.winpharma-product-editor > header > div:last-child {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

.winpharma-product-editor > header .button {
  padding: 7px 10px;
  white-space: nowrap;
  font-size: 11px;
}

.winpharma-product-editor > .status-message {
  margin: 4px 8px 0;
  padding: 5px 8px;
  font-size: 11px;
}

.winpharma-product-editor .general-advice-modal-body {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  padding: 8px;
}

.general-advice-image-actions {
  display: grid;
  gap: 5px;
}

.general-advice-image-actions .button {
  width: 100%;
  padding: 6px 5px;
  font-size: 10px;
}

.general-advice-image-picker {
  position: absolute;
  inset: 52px 10px 10px;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(22, 17, 34, 0.72);
}

.general-advice-image-picker[hidden] {
  display: none;
}

.general-advice-image-picker > section {
  width: min(980px, calc(100% - 20px));
  padding: 10px;
  border: 1px solid #7b68a2;
  background: #f7f5fa;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.35);
}

.general-advice-image-picker > section > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  color: #4b3379;
}

.general-advice-image-picker-loading {
  padding: 45px;
  text-align: center;
  font-weight: 800;
}

.general-advice-image-carousel {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  gap: 7px;
  align-items: stretch;
}

.general-advice-image-carousel-track {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  scroll-snap-type: x mandatory;
}

.general-advice-image-choice {
  flex: 0 0 210px;
  display: grid;
  grid-template-rows: 180px 34px;
  gap: 4px;
  padding: 6px;
  border: 2px solid #c4b9d8;
  background: #fff;
  color: #302344;
  cursor: pointer;
  scroll-snap-align: start;
}

.general-advice-image-choice:hover,
.general-advice-image-choice:focus {
  border-color: #5b3f91;
}

.general-advice-image-choice img {
  width: 100%;
  height: 180px;
  object-fit: contain;
}

.general-advice-image-choice span {
  overflow: hidden;
  font-size: 10px;
  line-height: 1.2;
}

.general-advice-carousel-nav {
  border: 1px solid #79649f;
  background: #5b3f91;
  color: #fff;
  font-size: 25px;
  cursor: pointer;
}

.general-advice-editor-image {
  display: grid;
  grid-template-rows: minmax(150px, 1fr) auto;
  gap: 7px;
  min-height: 0;
}

.winpharma-product-editor .general-advice-product-image {
  min-height: 0;
  height: 100%;
  margin: 0;
  padding: 7px;
}

.winpharma-product-editor .general-advice-product-image img {
  max-width: 170px;
  max-height: 310px;
}

.general-advice-readonly-grid {
  display: grid;
  gap: 4px;
}

.general-advice-readonly-grid span {
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid #c8bfd8;
  background: #f4f1f8;
  overflow-wrap: anywhere;
}

.general-advice-readonly-grid b {
  display: block;
  color: #5b3f91;
  font-size: 9px;
  text-transform: uppercase;
}

.general-advice-editor-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 6px;
  min-width: 0;
  min-height: 0;
}

.general-advice-editor-main fieldset {
  min-width: 0;
  margin: 0;
  padding: 5px 7px 7px;
  border: 1px solid #b9aecb;
  background: #f9f8fb;
}

.general-advice-editor-main legend {
  padding: 0 5px;
  color: #4b3379;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.general-advice-edit-grid {
  display: grid;
  gap: 5px 7px;
  align-items: end;
}

.general-advice-edit-grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.general-advice-edit-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.general-advice-edit-grid.cols-4 {
  grid-template-columns: 2fr 0.7fr 0.8fr 1.4fr;
}

.general-advice-edit-field {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: #49396a;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.general-advice-edit-field input,
.general-advice-edit-field textarea,
.general-advice-case-row input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid #9e90b8;
  border-radius: 1px;
  background: #fff;
  color: #1d1630;
  font: 11px/1.2 Arial, sans-serif;
}

.general-advice-edit-field input,
.general-advice-case-row input {
  height: 25px;
  padding: 3px 5px;
}

.general-advice-edit-field textarea {
  height: 48px;
  padding: 4px 5px;
  resize: none;
  overflow: hidden;
}

.general-advice-case-row {
  display: grid;
  grid-template-columns: 80px minmax(150px, 0.7fr) minmax(250px, 1.3fr);
  gap: 6px;
  align-items: center;
  margin-top: 3px;
}

.general-advice-case-row b {
  color: #5b3f91;
  font-size: 9px;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .general-advice-detail-grid {
    grid-template-columns: 1fr;
  }

  .winpharma-product-editor .general-advice-modal-body {
    grid-template-columns: 120px minmax(0, 1fr);
  }

  .general-advice-edit-grid.cols-3,
  .general-advice-edit-grid.cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.stock-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stock-stats div {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 12px;
}

.stock-stats span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.stock-stats strong {
  color: var(--text);
  font-size: 22px;
}

.stock-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) repeat(4, minmax(135px, 1fr)) 88px auto;
  align-items: end;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 8px 10px;
}

.stock-filters label {
  display: grid;
  gap: 3px;
  color: var(--text);
  font-weight: 800;
}

.stock-filters label span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.stock-inventory-page .button,
.stock-filters .button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.stock-filters input,
.stock-filters select {
  min-height: 30px;
  padding: 0 7px;
  font-size: 12px;
}

.stock-ai-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(260px, auto);
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 12px;
}

.stock-ai-panel label {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.stock-ai-panel label span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.stock-ai-panel textarea {
  min-height: 90px;
  resize: vertical;
}

.stock-ai-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.stock-ai-status {
  grid-column: 1 / -1;
  margin: -2px 0 0;
  font-size: 12px;
}

.stock-ai-error {
  color: #B91C1C;
  font-weight: 750;
}

.stock-ai-modal {
  position: fixed;
  inset: 0;
  z-index: var(--layer-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
}

.stock-ai-modal[hidden] {
  display: none;
}

.stock-ai-modal-panel {
  display: grid;
  width: min(1180px, 96vw);
  max-height: 88vh;
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.32);
}

.stock-ai-modal-head,
.stock-ai-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.stock-ai-modal-head h3 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 16px;
}

.stock-ai-modal-head p {
  margin: 0;
}

.stock-ai-modal-table {
  max-height: 62vh;
}

.stock-ai-modal-table table {
  min-width: 920px;
}

.stock-ai-modal-table input {
  min-width: 180px;
}

.stock-ai-modal-actions {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.stock-supplier-filter {
  position: relative;
}

.stock-supplier-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
}

.stock-supplier-results button {
  display: grid;
  width: 100%;
  gap: 3px;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid #E2E8F0;
  background: #ffffff;
  color: var(--text);
  text-align: left;
  line-height: 1.25;
}

.stock-supplier-results button:last-child {
  border-bottom: 0;
}

.stock-supplier-results button:hover,
.stock-supplier-results button:focus {
  background: #EFF6FF;
  outline: none;
}

.stock-supplier-results strong {
  font-size: 13px;
  font-weight: 750;
}

.stock-supplier-results small,
.stock-supplier-result-empty {
  color: var(--muted);
  font-size: 12px;
}

.stock-supplier-result-empty {
  padding: 10px;
}

.stock-scope {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  padding: 5px 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 11px;
  font-weight: 800;
}

.stock-scope.active,
.stock-scope:hover {
  border-color: var(--accent);
  background: #EFF6FF;
  color: var(--accent-dark);
}

.stock-spinner {
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 999px;
  animation: stock-spin 0.75s linear infinite;
}

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

.stock-table-scroll {
  max-height: none;
  overflow-x: hidden;
  overflow-y: visible;
}

.stock-table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.stock-table th a {
  color: inherit;
  text-decoration: none;
}

.stock-product {
  min-width: 0;
  white-space: nowrap;
}

.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stock-pager {
  justify-content: flex-end;
}

.stock-result-head,
.stock-pager {
  padding: 0 10px;
  font-size: 12px;
}

.stock-sql-details {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 12px;
}

.stock-sql-details summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-weight: 800;
}

.stock-sql-details pre {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0F172A;
  padding: 12px;
  color: #E2E8F0;
}

.stock-inventory-page {
  gap: 6px;
  padding: 0;
  overflow: hidden;
  border-color: #B7A9D6;
}

.stock-inventory-windowbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  background: #5B3F91;
  padding: 4px 10px;
  color: #ffffff;
}

.stock-inventory-windowbar h2 {
  margin: 0;
  color: #ffffff;
  font-size: 16px;
  font-weight: 500;
}

.stock-inventory-windowbar span {
  font-size: 11px;
  opacity: 0.88;
}

.stock-inventory-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px 2px;
}

.stock-inventory-note p {
  margin: 3px 0 0;
  font-size: 13px;
}

.stock-inventory-note p span,
.stock-inventory-totals span,
.stock-inventory-tabs {
  color: #5B3F91;
}

.stock-inventory-tabs {
  display: grid;
  grid-template-columns: 180px 110px 1fr;
  align-items: center;
  min-height: 28px;
  border-top: 1px solid #D8D2E8;
  border-bottom: 1px solid #C8C1D9;
  font-size: 11px;
}

.stock-inventory-tabs span,
.stock-inventory-tabs strong {
  display: flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  font-weight: 500;
}

.stock-inventory-tabs .active {
  justify-content: center;
  background: #DAD4F5;
  font-style: italic;
}

.stock-general-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: #f4f7fa;
  border: 1px solid #d8e1ea;
  border-top: 0;
  overflow-x: auto;
}

.stock-general-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid #cbd7e3;
  border-radius: 7px;
  background: #fff;
  color: #30465a;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.stock-general-tabs a:hover,
.stock-general-tabs a:focus {
  border-color: #008f83;
  color: #00776e;
}

.stock-general-tabs a.active {
  border-color: #008f83;
  background: #008f83;
  color: #fff;
}

.stock-inventory-table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 0;
  font-size: 10px;
  table-layout: fixed;
}

.stock-col-ean {
  width: 8%;
}

.stock-col-name {
  width: 40%;
}

.stock-col-maker,
.stock-col-range,
.stock-col-space,
.stock-col-family {
  width: 6%;
}

.stock-col-supplier {
  width: 8%;
}

.stock-col-vat,
.stock-col-coeff {
  width: 3%;
}

.stock-col-stock {
  width: 5%;
}

.stock-col-price,
.stock-col-buy,
.stock-col-margin {
  width: 5%;
}

.stock-inventory-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  border-right: 1px solid #D7D7D7;
  background: #ffffff;
  color: #000000;
  font-size: 9px;
  font-weight: 800;
  text-transform: none;
  white-space: normal;
  overflow-wrap: anywhere;
}

.stock-inventory-table th,
.stock-inventory-table td {
  padding: 4px 3px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: clip;
}

.stock-inventory-table td {
  border-right: 1px solid #D7D7D7;
  border-bottom: 0;
  color: #000000;
}

.stock-inventory-table .stock-product,
.stock-inventory-table td:nth-child(3),
.stock-inventory-table td:nth-child(4),
.stock-inventory-table td:nth-child(5),
.stock-inventory-table td:nth-child(6) {
  min-width: 0;
  white-space: nowrap;
}

.stock-inventory-table td:first-child,
.stock-inventory-table .numeric {
  white-space: nowrap;
}

.stock-inventory-table .stock-product strong {
  display: inline-block;
  min-width: 0;
  max-width: none;
  white-space: nowrap;
  transform-origin: left center;
}

.stock-inventory-table tbody tr:nth-child(odd) {
  background: #E9E9E9;
}

.stock-inventory-table tbody tr:nth-child(even) {
  background: #F7F7F7;
}

.stock-inventory-table tbody tr.stock-row-warning {
  background: #FFFEB5;
}

.stock-product-alert strong {
  color: #D60000;
}

.stock-checkbox-cell {
  text-align: center;
}

.stock-checkbox {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #C6C6C6;
  background: #ffffff;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.18);
}

.stock-checkbox.checked::after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  margin: 3px;
  background: #5B3F91;
}

.stock-promis {
  color: #F00000;
  font-weight: 800;
}

.stock-inventory-table tfoot td {
  border-top: 1px solid #D7D7D7;
  background: #F8F8F8;
  color: #5B3F91;
  font-weight: 800;
}

.stock-inventory-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 6px 10px;
  border-top: 1px solid #D8D2E8;
  font-size: 12px;
}

.stock-inventory-totals strong {
  margin-left: 5px;
  color: #000000;
  font-weight: 500;
}

.stock-inventory-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid #D8D2E8;
  background: #F7F7F7;
}

.stock-inventory-footer > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stock-template-preview {
  display: grid;
  min-height: 140px;
  place-items: center;
  border: 1px dashed #CBD5E1;
  border-radius: 6px;
  background: linear-gradient(135deg, #F8FAFC, #EEF2FF);
  color: var(--text);
  text-align: center;
}

.stock-template-preview img {
  display: block;
  max-width: 100%;
  max-height: 260px;
  border-radius: 4px;
  object-fit: contain;
}

.stock-template-preview span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.stock-template-preview strong {
  font-size: 18px;
}

.generic-list-toolbar {
  align-items: flex-start;
}

.generic-list-toolbar .stock-actions {
  justify-content: flex-end;
}

.generic-list-toolbar form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.generic-list-ai-engine-form {
  align-items: flex-end;
}

.generic-list-ai-engine-form label {
  display: grid;
  gap: 4px;
  margin: 0;
  color: #5B3F91;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.generic-list-toolbar select {
  width: auto;
  min-width: 280px;
  min-height: 30px;
  padding: 0 7px;
  font-size: 12px;
}

.button.secondary.generic-list-danger {
  border-color: #FCA5A5;
  color: #991B1B;
}

.button.secondary.generic-list-danger:hover {
  border-color: #EF4444;
  background: #FEF2F2;
  color: #7F1D1D;
}

.generic-list-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 6px 10px;
}

.generic-list-stats div {
  border: 1px solid #D8D2E8;
  background: #ffffff;
  padding: 8px 10px;
}

.generic-list-stats span {
  display: block;
  margin-bottom: 3px;
  color: #5B3F91;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.generic-list-stats strong {
  color: #000000;
  font-size: 15px;
  font-weight: 600;
}

.generic-list-tabs {
  display: flex;
  gap: 6px;
  margin: 6px 10px;
  border-bottom: 1px solid #D8D2E8;
}

.generic-list-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid #D8D2E8;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: #F8FAFC;
  color: #5B3F91;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.generic-list-tabs a.active {
  background: #ffffff;
  color: #111827;
}

.generic-list-filters {
  grid-template-columns: minmax(260px, 1fr) 180px auto;
  margin: 4px 10px;
}

.generic-list-files-panel {
  margin: 6px 10px 12px;
  border: 1px solid #D8D2E8;
  background: #ffffff;
}

.generic-list-files-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid #D8D2E8;
}

.generic-list-files-head h3,
.generic-list-files-head p {
  margin: 0;
}

.generic-list-files-head h3 {
  color: #111827;
  font-size: 15px;
}

.generic-list-files-head p {
  margin-top: 3px;
  color: #475569;
  font-size: 12px;
}

.generic-list-files-head span {
  color: #5B3F91;
  font-size: 12px;
  font-weight: 800;
}

.generic-list-files-scroll {
  max-height: min(62vh, 720px);
}

.generic-list-files-table {
  min-width: 980px;
}

.generic-list-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.generic-list-file-actions .generic-list-refresh-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.generic-list-sql {
  margin: 6px 10px;
}

.generic-list-pdf-pipeline {
  margin: 6px 10px;
}

.generic-list-pdf-pipeline ol {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.generic-list-pdf-pipeline li {
  border: 1px solid #D8D2E8;
  border-radius: 6px;
  background: #F8FAFC;
  padding: 10px;
}

.generic-list-pdf-pipeline strong {
  display: block;
  margin-bottom: 6px;
  color: #5B3F91;
  font-size: 12px;
}

.generic-list-pdf-pipeline p {
  margin: 0;
  color: #334155;
  font-size: 12px;
  line-height: 1.4;
}

.generic-list-ai-prompt {
  margin: 6px 10px;
}

.generic-list-ai-prompt textarea {
  display: block;
  width: 100%;
  min-height: 280px;
  max-height: 44vh;
  margin-top: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0F172A;
  padding: 12px;
  color: #E2E8F0;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
}

.generic-list-result-head {
  padding: 2px 10px 4px;
}

.generic-list-scroll {
  margin: 0 10px;
  max-height: min(62vh, 720px);
}

.generic-list-table {
  min-width: 1080px;
}

.generic-list-cip {
  width: 11%;
}

.generic-list-name {
  width: 27%;
}

.generic-list-supplier {
  width: 16%;
}

.generic-list-label {
  width: 22%;
}

.generic-list-dosage {
  width: 9%;
}

.generic-list-api {
  width: 11%;
}

.generic-list-action {
  width: 8%;
}

.generic-list-click-row {
  cursor: pointer;
}

.generic-list-click-row:hover {
  background: #F8F5FF;
}

.generic-list-table td:nth-child(3),
.generic-list-table td:nth-child(4),
.generic-list-table td:nth-child(5),
.generic-list-table td:nth-child(6) {
  white-space: normal;
}

.generic-list-table td:nth-child(7) {
  white-space: nowrap;
}

.generic-list-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
}

.generic-list-sort:hover,
.generic-list-sort.active {
  color: #5B3F91;
  text-decoration: underline;
}

.generic-list-sort span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.generic-list-action-cell form {
  margin: 0;
}

.generic-list-refresh-button {
  min-height: 24px;
  border: 1px solid #D8D2E8;
  border-radius: 4px;
  background: #ffffff;
  color: #5B3F91;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
  padding: 0 7px;
}

.generic-list-refresh-button:hover,
.generic-list-refresh-button:focus-visible {
  outline: 0;
  border-color: #8D6BC1;
  background: #F4F0FF;
}

.generic-list-table small {
  display: block;
  margin-top: 3px;
  color: var(--error);
  white-space: normal;
}

.generic-list-page .stock-inventory-footer span {
  color: #5B3F91;
  font-size: 12px;
}

.generic-list-progress {
  display: grid;
  gap: 6px;
  margin: 6px 10px;
  border: 1px solid #D8D2E8;
  background: #ffffff;
  padding: 8px 10px;
}

.generic-list-progress[hidden] {
  display: none;
}

.generic-list-progress > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #5B3F91;
  font-size: 12px;
  font-weight: 800;
}

.generic-list-progress progress {
  width: 100%;
  height: 14px;
  accent-color: #5B3F91;
}

.generic-list-progress p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.generic-list-modal {
  position: fixed;
  z-index: var(--layer-modal);
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(17, 24, 39, 0.42);
  padding: 20px;
}

.generic-list-modal[hidden] {
  display: none;
}

.generic-list-modal-window {
  width: min(920px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid #D8D2E8;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(17, 24, 39, 0.28);
  overflow: hidden;
}

.generic-list-modal-window > header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #E9E4F5;
  background: #F8F5FF;
  padding: 12px 14px;
}

.generic-list-modal-window h3,
.generic-list-modal-window p {
  margin: 0;
}

.generic-list-modal-window h3 {
  color: #4C1D95;
  font-size: 18px;
}

.generic-list-modal-window p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.generic-list-modal-close {
  width: 32px;
  min-height: 30px;
  border: 1px solid #D8D2E8;
  border-radius: 5px;
  background: #ffffff;
  color: #4C1D95;
  cursor: pointer;
  font-weight: 900;
}

.generic-list-modal-body {
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.generic-list-modal-groups {
  display: grid;
  gap: 12px;
}

.generic-list-dose-group {
  border: 1px solid #E4DDF2;
  border-radius: 6px;
  background: #ffffff;
  overflow: hidden;
}

.generic-list-dose-group > header {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #E9E4F5;
  background: #F8F5FF;
  padding: 8px 10px;
}

.generic-list-dose-group h4 {
  margin: 0;
  color: #4C1D95;
  font-size: 14px;
  font-weight: 900;
}

.generic-list-dose-group > header span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.generic-list-unit-group {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.generic-list-unit-group + .generic-list-unit-group {
  border-top: 1px solid #EEE8F8;
}

.generic-list-unit-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #4C1D95;
  font-size: 12px;
  font-weight: 900;
}

.generic-list-unit-title small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.generic-list-modal-table {
  width: 100%;
}

.generic-list-modal-table tr.reference {
  background: #F3EFFF;
  font-weight: 800;
}

.generic-list-empty-modal {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .stock-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stock-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .generic-list-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .generic-list-pdf-pipeline ol {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stock-ai-panel {
    grid-template-columns: 1fr;
  }

  .stock-titlebar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .stock-stats,
  .stock-filters,
  .generic-list-stats {
    grid-template-columns: 1fr;
  }

  .generic-list-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .generic-list-toolbar .stock-actions,
  .generic-list-toolbar form {
    align-items: stretch;
    flex-direction: column;
  }

  .generic-list-toolbar select {
    width: 100%;
    min-width: 0;
  }

  .generic-list-pdf-pipeline ol {
    grid-template-columns: 1fr;
  }
}
