:root {
  --ink: #162235;
  --muted: #65758d;
  --line: #d8e0ea;
  --line-soft: #e8edf4;
  --panel: #ffffff;
  --surface: #f2f5f9;
  --field: #fbfcfe;
  --primary: #0f5ea8;
  --primary-dark: #0a477f;
  --teal: #0f766e;
  --success: #16704e;
  --warning: #996300;
  --danger: #b42318;
}

body {
  background: var(--surface);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.container-fluid {
  padding: 0;
}

.app-shell {
  max-width: 1660px;
  margin: 0 auto;
  padding: 20px 28px 42px;
}

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

.brand-block h1 {
  margin: 0;
  font-size: 31px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-block p,
.panel-heading p,
.context-heading p {
  margin: 4px 0 0;
  color: var(--muted);
}

.identity {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 230px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.identity span {
  color: var(--muted);
}

.state-fields {
  display: none;
}

.base-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(22, 34, 53, 0.05);
}

.base-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.base-summary-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.base-summary-title strong {
  font-size: 15px;
}

.base-summary-title span {
  color: var(--muted);
  font-size: 13px;
}

.base-actions {
  flex-shrink: 0;
}

.context-panel,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(22, 34, 53, 0.06);
}

.context-panel {
  padding: 16px;
  margin-bottom: 16px;
}

.panel {
  padding: 16px;
  margin-bottom: 16px;
}

.panel-heading,
.item-heading,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.panel-heading {
  margin-bottom: 14px;
}

.panel-heading h3,
.context-heading h3,
.section-heading h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 750;
}

.context-grid {
  display: grid;
  grid-template-columns:
    minmax(210px, 1.1fr)
    minmax(100px, 0.45fr)
    minmax(220px, 1fr)
    minmax(140px, 0.55fr)
    minmax(140px, 0.55fr);
  gap: 12px;
  align-items: end;
}

.control-field .form-group,
.add-fields .form-group {
  margin-bottom: 0;
}

.form-control,
.selectize-input {
  min-height: 40px;
  background: var(--field);
  border-color: #cdd7e4;
  border-radius: 8px;
  box-shadow: none;
}

.form-control:focus,
.selectize-input.focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 94, 168, 0.12);
}

.control-label {
  margin-bottom: 6px;
  color: #33445e;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.checkbox-field {
  min-height: 62px;
  display: flex;
  align-items: flex-end;
  padding-bottom: 8px;
}

.checkbox-field .checkbox {
  margin: 0;
}

.charge-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.charge-summary span,
.status-badge,
.eyebrow,
.item-meta span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}

.charge-summary span {
  background: #eaf3ff;
  color: #214b7c;
  padding: 6px 10px;
}

.workbench {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.catalog-panel,
.detail-panel {
  min-height: 410px;
}

.catalog-page {
  width: 100%;
}

.catalog-page .catalog-frame {
  min-height: 360px;
}

.catalog-page table.dataTable tbody td {
  padding-top: 10px;
  padding-bottom: 10px;
}

.catalog-panel .tabbable {
  margin-top: 4px;
}

.catalog-panel .nav-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px;
  background: #f4f7fb;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.catalog-panel .tab-content {
  padding-top: 2px;
}

.catalog-panel .nav-tabs > li > a {
  margin-right: 0;
  padding: 8px 11px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 750;
}

.catalog-panel .nav-tabs > li.active > a,
.catalog-panel .nav-tabs > li.active > a:hover,
.catalog-panel .nav-tabs > li.active > a:focus {
  color: var(--primary);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 2px 6px rgba(22, 34, 53, 0.06);
}

.catalog-tab-tools {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.catalog-expand-panel {
  padding: 12px;
  background: #f9fbfd;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.catalog-expand-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.catalog-expand-head span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.catalog-components-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.catalog-components-table th,
.catalog-components-table td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

.catalog-components-table th {
  color: #34465f;
  background: #f6f8fb;
  font-size: 11px;
  font-weight: 850;
}

.catalog-expand-empty {
  padding: 10px;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.dt-actions {
  white-space: nowrap !important;
  text-align: right;
}

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-left: 4px;
  color: var(--primary);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.icon-action:hover {
  background: #eaf3ff;
  border-color: #bdd4f0;
}

.icon-action.danger {
  color: var(--danger);
}

.icon-action.danger:hover {
  background: #fff1f0;
  border-color: #f3c5c1;
}

.detail-panel {
  display: flex;
  flex-direction: column;
}

.button-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  border-radius: 8px;
  font-weight: 700;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-soft {
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn-soft:hover,
.btn-default:hover {
  background: #eef4fb;
  border-color: #c8d4e4;
}

.table-frame {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
}

.catalog-frame,
.components-frame,
.search-results {
  width: 100%;
}

.dataTables_wrapper {
  padding: 0;
}

table.dataTable {
  width: 100% !important;
  margin: 0 !important;
  border-collapse: collapse !important;
}

table.dataTable thead th {
  background: #f7f9fc;
  color: #253752;
  border-bottom: 1px solid var(--line) !important;
  font-size: 12px;
  font-weight: 800;
}

table.dataTable tbody td {
  vertical-align: middle;
  color: #27364c;
  border-top: 1px solid var(--line-soft);
  white-space: normal;
}

table.dataTable tbody tr:hover {
  background: #f4f8fd;
}

.dt-nowrap {
  white-space: nowrap !important;
}

.dataTables_info,
.dataTables_paginate {
  padding: 10px 12px !important;
  color: var(--muted) !important;
}

.dataTables_paginate .paginate_button {
  border-radius: 6px !important;
}

.item-heading {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.item-title {
  min-width: 0;
}

.item-title h2 {
  margin: 5px 0 8px;
  font-size: 23px;
  line-height: 1.2;
  font-weight: 780;
}

.eyebrow {
  color: var(--primary);
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.item-meta span {
  background: #f1f5f9;
  color: #43546d;
  padding: 5px 9px;
}

.status-badge {
  padding: 7px 11px;
  background: #eef2f7;
  color: #40506a;
}

.status-badge.validado {
  background: #e4f6ed;
  color: var(--success);
}

.status-badge.rascunho {
  background: #fff4d8;
  color: var(--warning);
}

.status-badge.arquivado {
  background: #edf0f4;
  color: var(--muted);
}

.detail-actions {
  padding: 12px 0;
}

.section-heading {
  margin: 16px 0 10px;
  align-items: center;
}

.section-heading .button-row .btn {
  padding: 6px 10px;
}

.result-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-radius: 8px;
  padding: 13px 14px;
  margin: 0 0 12px;
}

.result-banner.complete {
  background: #e8f7ef;
  color: #105c43;
}

.result-banner.pending {
  background: #fff3d7;
  color: #7b4e00;
}

.result-banner div {
  display: flex;
  flex-direction: column;
}

.result-banner strong {
  font-size: 24px;
  line-height: 1.15;
}

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.mini-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mini-card span,
.mini-card small {
  color: var(--muted);
  font-size: 11px;
}

.issues,
.warning-box {
  border-radius: 8px;
  background: #fff3d7;
  color: #754600;
  padding: 11px 13px;
  margin: 0 0 12px;
}

.source-card,
.ai-valid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}

.ai-assistant-shell {
  display: grid;
  gap: 14px;
}

.ai-intro {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: #16345c;
  background: #eef6ff;
  border: 1px solid #cfe2f7;
  border-radius: 8px;
}

.ai-intro .fa,
.ai-intro .fas {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0f63ce;
  background: #fff;
  border-radius: 8px;
}

.ai-tabs .nav-tabs {
  border-bottom-color: var(--line);
}

.ai-tabs .nav-tabs > li > a {
  color: var(--muted);
  border-radius: 8px 8px 0 0;
  font-weight: 750;
}

.ai-tabs .nav-tabs > li.active > a,
.ai-tabs .nav-tabs > li.active > a:focus,
.ai-tabs .nav-tabs > li.active > a:hover {
  color: var(--primary);
  border-color: var(--line) var(--line) #fff;
}

.ai-step-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(260px, 1fr);
  gap: 12px;
  padding-top: 12px;
}

.ai-card {
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ai-card.wide,
.ai-attachments {
  grid-column: 1 / -1;
}

.ai-card-title {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 820;
}

.ai-context-summary {
  margin-top: 10px;
  padding: 10px 12px;
  color: #34465f;
  background: #f6f8fb;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.compact-warning {
  margin: 10px 0 0;
  padding: 9px 10px;
  font-size: 12px;
}

.ai-send-preview {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  padding: 10px 12px;
  color: #16345c;
  background: #eef6ff;
  border: 1px solid #cfe2f7;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 750;
}

.ai-send-preview-error {
  color: #754600;
  background: #fff3d7;
  border-color: #f3d59b;
}

.ai-token-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 8px;
  padding: 9px 10px;
  color: #52637a;
  background: #f9fbfd;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  font-size: 12px;
}

.ai-token-note .fa,
.ai-token-note .fas {
  margin-top: 2px;
  color: #0f63ce;
}

.ai-inline-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}

.ai-inline-actions .form-group {
  margin-bottom: 0;
}

.ai-base-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr) 120px auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.ai-base-grid .form-group,
.ai-base-grid .checkbox {
  margin-bottom: 0;
}

.modal-footer .ai-footer-actions {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-footer-left,
.ai-footer-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-footer-right {
  justify-content: flex-end;
  margin-left: auto;
}

.ai-footer-actions [data-display-if],
.ai-footer-actions .shiny-bound-output {
  display: inline-flex;
}

.ai-footer-actions .btn {
  margin: 0;
}

.ai-counter {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.ai-counter-valid {
  color: #0b7a4b;
  font-weight: 800;
}

.ai-counter-error {
  color: #b42318;
  font-weight: 800;
}

.ai-contract {
  padding: 12px 14px;
  color: #334155;
  background: #f9fbfd;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ai-contract-format {
  margin-left: 8px;
  padding: 3px 7px;
  color: #105c43;
  background: #dff7ed;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 850;
}

.ai-response-help {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.ai-run-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  padding: 10px 12px;
  color: #34465f;
  background: #f6f8fb;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.ai-run-status-ok {
  color: #105c43;
  background: #e9f8f2;
  border-color: #c7eadb;
}

.ai-run-status-error {
  color: #754600;
  background: #fff3d7;
  border-color: #f3d59b;
}

.loading-dot {
  display: inline-flex;
  gap: 4px;
}

.loading-dot .dot {
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 999px;
  animation: ai-pulse 1s infinite ease-in-out;
}

.loading-dot .dot:nth-child(2) {
  animation-delay: 0.15s;
}

.loading-dot .dot:nth-child(3) {
  animation-delay: 0.3s;
}

.ai-request-preview {
  margin-top: 10px;
}

.ai-request-preview pre,
.ai-contract pre {
  max-height: 240px;
  overflow: auto;
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

@keyframes ai-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@media (max-width: 760px) {
  .ai-base-grid,
  .ai-inline-actions {
    grid-template-columns: 1fr;
  }

  .modal-footer .ai-footer-actions,
  .ai-footer-left,
  .ai-footer-right {
    width: 100%;
    justify-content: flex-end;
  }

  .edit-item-grid {
    grid-template-columns: 1fr;
  }
}

.wizard {
  min-height: 340px;
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  color: var(--muted);
  background: #f6f8fb;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.wizard-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: #52637a;
  background: #e9eef5;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.wizard-step.active {
  color: var(--primary);
  background: #eaf3ff;
  border-color: #c8ddf5;
}

.wizard-step.active span {
  color: #fff;
  background: var(--primary);
}

.wizard-card {
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
}

.wizard-card h4 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 780;
}

.review-list {
  display: grid;
  gap: 8px;
}

.review-list div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}

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

.review-list span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.ai-valid {
  background: #e9f8f2;
  color: #105c43;
  margin-top: 12px;
}

.empty-state {
  display: flex;
  min-height: 200px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
}

.empty-state h3 {
  margin: 0;
  color: var(--ink);
  font-size: 21px;
}

.empty-state p {
  margin: 0;
}

.empty-state.compact {
  min-height: 96px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #eaf3ff;
  color: var(--primary);
  font-size: 20px;
}

.search-panel {
  margin-top: 4px;
}

.component-modal {
  display: grid;
  gap: 14px;
}

.component-add-section {
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.component-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.component-table-shell {
  display: grid;
  gap: 12px;
  overflow-x: auto;
  max-width: 100%;
}

.component-table {
  width: 100%;
  min-width: 1080px;
  table-layout: fixed;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.component-table th,
.component-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  text-align: left;
  line-height: 1.35;
  word-break: normal;
  overflow-wrap: normal;
}

.component-table th {
  color: #34465f;
  background: #f6f8fb;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.component-table tbody tr {
  cursor: pointer;
}

.component-table tbody tr:hover,
.component-table tbody tr.selected {
  background: #eef6ff;
}

.component-col-code {
  width: 150px;
}

.component-col-description {
  width: 34%;
}

.component-col-data {
  width: 170px;
}

.component-col-price {
  width: 180px;
}

.component-col-base {
  width: 170px;
}

.component-col-actions {
  width: 124px;
}

.component-code-cell {
  white-space: nowrap;
}

.component-description-cell strong {
  display: -webkit-box;
  max-height: 42px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.component-table th:nth-child(5),
.component-table td:nth-child(5) {
  color: #52637a;
  font-size: 12px;
}

.component-table-unit {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.component-table-data {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  color: #26364d;
  font-size: 12px;
}

.metric-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  color: #26364d;
  background: #f6f8fb;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 780;
}

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

.component-price-stack {
  display: grid;
  gap: 3px;
  font-size: 12px;
}

.component-price-stack div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.component-price-stack span {
  color: var(--muted);
}

.component-memo-row td {
  padding: 0 10px 10px;
  background: #eef6ff;
}

.component-memo-inline {
  padding: 10px 12px;
  color: #34465f;
  background: #fff;
  border: 1px solid #cfe2f7;
  border-radius: 8px;
}

.component-memo-inline strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.component-memo-inline p {
  margin: 0;
  white-space: pre-wrap;
}

.edit-item-shell {
  display: grid;
  gap: 14px;
}

.edit-item-summary {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  background: #f6f8fb;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.edit-item-summary strong {
  color: var(--ink);
  font-size: 15px;
}

.edit-item-summary span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.edit-item-grid {
  display: grid;
  grid-template-columns: 160px minmax(260px, 1fr) 220px;
  gap: 12px;
  align-items: end;
}

.edit-item-grid .wide {
  grid-column: 1 / -1;
}

.edit-item-grid .form-group {
  margin-bottom: 0;
}

.edit-item-grid .shiny-input-container {
  width: 100% !important;
  max-width: none !important;
}

.component-card {
  cursor: pointer;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.component-card:hover {
  border-color: #b8cce4;
  box-shadow: 0 6px 18px rgba(22, 34, 53, 0.08);
}

.component-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.component-card-head > div:first-child {
  min-width: 0;
}

.component-card-head h4 {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 780;
}

.component-card-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 6px;
  margin: 12px 0;
}

.component-card-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.component-card-metrics div {
  padding: 8px;
  background: #f8fafc;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
}

.component-card-metrics strong,
.component-card-metrics span {
  display: block;
}

.component-card-metrics strong {
  font-size: 13px;
}

.component-card-metrics span {
  color: var(--muted);
  font-size: 11px;
}

.component-card-base {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.component-base-grid {
  display: grid;
  grid-template-columns:
    minmax(210px, 1.1fr)
    minmax(90px, 0.45fr)
    minmax(190px, 0.9fr)
    minmax(120px, 0.55fr)
    minmax(120px, 0.55fr);
  gap: 12px;
  align-items: end;
  padding: 12px;
  margin-bottom: 12px;
  background: #f8fafc;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.modal-lg {
  width: min(1280px, calc(100vw - 42px));
}

.search-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) minmax(250px, 0.95fr) minmax(220px, 0.95fr) minmax(190px, 0.55fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.type-tabs .nav-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin: 0;
  background: #f4f7fb;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.type-tabs .nav-tabs > li {
  flex: 1 1 0;
}

.type-tabs .nav-tabs > li > a {
  margin: 0;
  padding: 8px 9px;
  color: var(--muted);
  text-align: center;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 750;
}

.type-tabs .nav-tabs > li.active > a,
.type-tabs .nav-tabs > li.active > a:hover,
.type-tabs .nav-tabs > li.active > a:focus {
  color: var(--primary);
  background: #fff;
  border: 1px solid var(--line);
}

.type-tabs .tab-content {
  display: none;
}

.add-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  margin-top: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f8fafc;
}

.add-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 180px));
  gap: 12px;
}

pre {
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  background: #f6f8fb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.selectize-dropdown {
  z-index: 10000;
}

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

  .catalog-panel,
  .detail-panel {
    min-height: 0;
  }

  .context-grid,
  .search-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .base-bar,
  .panel-heading,
  .item-heading,
  .section-heading,
  .add-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .identity {
    align-items: flex-start;
    min-width: 0;
  }

  .base-actions,
  .base-actions .btn {
    width: 100%;
  }

  .context-grid,
  .add-fields,
  .config-grid,
  .component-base-grid {
    grid-template-columns: 1fr;
  }

  .checkbox-field {
    min-height: 0;
    padding-bottom: 0;
  }

  .button-row .btn,
  .catalog-tab-tools .btn,
  .add-bar .btn {
    width: 100%;
  }

  .wizard-steps,
  .review-list div {
    grid-template-columns: 1fr;
  }

  .component-card-head {
    flex-direction: column;
  }

  .component-card-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .component-card-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .item-title h2 {
    font-size: 20px;
  }

  .result-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

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