:root {
  --bg: #e9e8e3;
  --panel: #f7f6f2;
  --card: #f9f8f5;
  --stroke: #d7d7d0;
  --stroke-strong: #c5c8c7;
  --text: #232628;
  --muted: #6d7474;
  --blue: #3b61dd;
  --blue-soft: #e8eeff;
  --green: #2e8f58;
  --red: #c34c42;
  --shadow: 0 10px 26px rgba(28, 30, 33, 0.08), 0 1px 4px rgba(28, 30, 33, 0.05);
  --radius-xl: 16px;
  --radius-lg: 12px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 20px;
  --space-5: 24px;
}

/* ---------------- Final UI Consolidation ---------------- */

.ghost-btn,
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 16px;
  line-height: 1.1;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: background-color 120ms ease, border-color 120ms ease, filter 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.ghost-btn:hover,
.primary-btn:hover {
  transform: translateY(-1px);
}

.inline-actions {
  flex-wrap: wrap;
}

.control-brand-main {
  display: grid;
  gap: 14px;
}

.control-brand-lockup {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.control-brand-logo {
  width: 156px;
  max-width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 22px rgba(21, 87, 214, 0.10));
}

.control-brand-copy {
  min-width: 0;
}

.control-brand-subtitle {
  max-width: 760px;
}

.control-brand-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.control-brand-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(78, 86, 90, 0.12);
  background: rgba(255, 255, 255, 0.72);
  color: #2e3739;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.modal-header h1 {
  font-size: 28px;
}

.tab-compact-nav {
  display: none;
}

.tab-group-nav {
  display: flex !important;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 24px 0;
}

.tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 24px 0;
}

.tab-group-btn,
.tab-btn {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.tab-btn {
  min-height: 42px;
  padding: 10px 15px;
  border-color: rgba(70, 76, 88, 0.12);
  background: rgba(255, 255, 255, 0.72);
  color: #566062;
  transition: 140ms ease;
}

.tab-btn:hover {
  border-color: rgba(21, 87, 214, 0.20);
  color: #304247;
  transform: translateY(-1px);
}

.tab-btn.is-active {
  box-shadow: 0 8px 16px rgba(52, 87, 195, 0.10);
}

.decision-box {
  border-radius: 16px;
}

.switch-panel,
.form-grid .switch-setting-card,
.checkbox-inline,
.switch-inline,
.sabi-inline-toolbar {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.info-banner.is-warning {
  background: #fff5df;
  border-color: #f0d79a;
  color: #8c6500;
}

.info-banner.is-error {
  background: #fff0ee;
  border-color: #efc2bc;
  color: #a53f34;
}

.info-banner.is-success {
  background: #eaf8ef;
  border-color: #cbe8d5;
  color: #237b46;
}

.total-card {
  border-radius: 14px;
  padding: 12px 13px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.table-wrap {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.panel-status {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(83, 92, 96, 0.12);
  background: rgba(255, 255, 255, 0.75);
  color: #5e696a;
  font-weight: 700;
}

.ghost-btn.mini {
  min-height: 34px;
  padding: 7px 10px;
}

@media (max-width: 1100px) {
  .control-brand-lockup {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 12px;
  }

  .control-brand-logo {
    width: 132px;
  }

  .tab-compact-nav {
    display: grid;
  }

  .tab-group-nav,
  .tab-nav {
    display: none !important;
  }
}

@media (max-width: 760px) {
  .control-brand-badges {
    gap: 6px;
  }

  .control-brand-badge {
    min-height: 30px;
    padding: 0 10px;
    font-size: 11px;
  }
}

[hidden] {
  display: none !important;
}

/* ---------------- Auth (Clerk) ---------------- */

.auth-bar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: var(--card);
}

.auth-bar-status {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.clerk-user-button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

.auth-gate {
  margin: 14px 0 18px;
  display: flex;
  justify-content: center;
}

.auth-gate-card {
  width: min(560px, 100%);
  border: 1px solid var(--stroke);
  background: var(--panel);
  border-radius: 18px;
  padding: 18px;
  display: grid;
  gap: 14px;
}

.auth-gate-copy h2 {
  margin: 0;
  font-size: 22px;
}

.auth-gate-copy p {
  margin: 6px 0 0;
  color: var(--muted);
}

.clerk-signin-mount {
  min-height: 120px;
}

.auth-gate-fallback {
  border: 1px dashed var(--stroke);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Satoshi", "Avenir Next", "SF Pro Display", "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #efeee9 0%, #e9e8e3 100%);
}

button,
input,
select {
  font: inherit;
}

.stage-shell {
  min-height: 100vh;
  padding: 12px 16px 22px;
}

.page-head {
  width: min(1220px, 100%);
  margin: 0 auto 10px;
  background: #f7f6f2;
  border: 1px solid #ddddd6;
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-head-copy {
  display: grid;
  gap: 2px;
}

.page-head-copy span {
  color: #7a8180;
  font-size: 12px;
}

.page-head-copy strong {
  color: #1f2426;
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.page-head-copy small {
  color: #65706f;
  font-size: 13px;
}

.page-head-actions {
  display: flex;
  align-items: center;
}

.ghost-btn,
.primary-btn {
  border-radius: 10px;
  padding: 10px 14px;
  min-height: 40px;
  border: 1px solid var(--stroke);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, filter 120ms ease;
  font-weight: 600;
}

.ghost-btn:hover {
  border-color: #babebd;
}

.ghost-btn.is-active {
  border-color: #9ab0f5;
  background: #edf2ff;
  color: #2c4fbe;
}

.primary-btn {
  background: linear-gradient(180deg, #4f77f3 0%, #355dd6 100%);
  border-color: #3156c8;
  color: #fff;
  box-shadow: 0 8px 20px rgba(59, 97, 221, 0.25);
}

.primary-btn:hover {
  filter: brightness(1.02);
}

.primary-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.viewport {
  margin-top: 4px;
  display: grid;
  place-items: center;
}

.modal-card {
  width: min(1220px, 100%);
  background: #f9f8f5;
  border: 1px solid rgba(30, 35, 40, 0.08);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e3e3dc;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.modal-header-main {
  min-width: 260px;
  flex: 1 1 420px;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 1 auto;
}

.modal-header h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.modal-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.tab-compact-nav {
  display: grid;
  grid-template-columns: 220px minmax(280px, 1fr);
  gap: 10px 12px;
  padding: 10px 20px 12px;
  border-bottom: 1px solid #e7e6e0;
  background: #fcfbf8;
}

.compact-nav-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.compact-nav-field > span {
  font-size: 11px;
  font-weight: 700;
  color: #6d7474;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.compact-nav-field select {
  width: 100%;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid #d8d8d1;
  background: #f7f6f2;
  padding: 0 12px;
  color: #273032;
  font-weight: 600;
}

.tab-group-nav {
  display: none;
}

.tab-group-btn {
  border: 1px solid #deded8;
  background: #f8f7f3;
  color: #657071;
  border-radius: 999px;
  padding: 7px 12px;
  min-height: 34px;
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.tab-group-btn.is-active {
  background: #eef1fb;
  border-color: #d2daf4;
  color: #3752a8;
}

.tab-nav {
  display: none;
}

.tab-btn {
  border: 1px solid #d8d8d1;
  background: #f3f2ee;
  color: #5e6769;
  border-radius: 999px;
  padding: 9px 13px;
  min-height: 38px;
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  flex: 0 0 auto;
}

.tab-btn.is-active {
  background: #eaf0ff;
  border-color: #cad7ff;
  color: #3457c3;
}

.tab-btn.is-group-hidden {
  display: none;
}

.tab-panel {
  display: none;
}

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

.decision-box {
  margin: 20px;
  padding: 14px 16px;
  border: 1px solid #d8d8d2;
  border-radius: 12px;
  background: #fbfaf7;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.switch-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid #deded8;
  background: #f6f5f1;
}

.switch-meta {
  display: grid;
  gap: 2px;
  min-width: 84px;
}

.switch-label {
  font-size: 12px;
  color: #7a8180;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.switch-meta strong {
  font-size: 14px;
  color: #7c8383;
}

.switch {
  position: relative;
  display: inline-block;
  width: 54px;
  height: 32px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: #d4d7db;
  border: 1px solid #cbd0d6;
  border-radius: 999px;
  transition: 160ms ease;
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  left: 3px;
  top: 3px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: 160ms ease;
}

.switch input:checked + .switch-slider {
  background: rgba(59, 97, 221, 0.85);
  border-color: rgba(59, 97, 221, 0.95);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(22px);
}

.decision-copy h2 {
  margin: 0;
  font-size: 18px;
}

.decision-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.segmented {
  display: inline-flex;
  border: 1px solid #d7d8df;
  border-radius: 10px;
  padding: 3px;
  background: #f4f4f7;
}

.segmented button {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 8px;
  color: #555d63;
  font-weight: 600;
  cursor: pointer;
}

.segmented button.is-active {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 97, 221, 0.25);
}

.info-banner {
  margin: 0 20px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--blue-soft);
  color: #4560b9;
  border: 1px solid #dbe3ff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.crm-cycle-inline-note {
  margin: 10px 20px 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e1e3de;
  background: #fbfaf7;
}

.crm-cycle-inline-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-size: 12px;
  color: #4f585c;
  line-height: 1.35;
}

.crm-cycle-inline-main .label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6a7174;
  font-size: 11px;
}

.crm-cycle-inline-main strong {
  color: #263032;
  font-weight: 700;
}

.crm-cycle-inline-main .dot {
  color: #a6abad;
}

.crm-cycle-inline-sub {
  margin-top: 4px;
  color: #6f7679;
  font-size: 12px;
  line-height: 1.35;
}

.form-section,
.data-block {
  margin: 18px 20px 0;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.section-title-row h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #2a2f31;
  text-transform: none;
}

.section-title-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.title-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.financial-query-title-row {
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px;
}

.financial-query-title-row .primary-btn {
  margin-left: auto;
  align-self: flex-start;
  white-space: nowrap;
}

.summary-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid #cfe0d8;
  background: #edf7f2;
  color: #2c7650;
  font-size: 13px;
  font-weight: 700;
}

.summary-pill.is-off {
  border-color: #dbddd8;
  background: #f2f2ef;
  color: #67706e;
}

.section-title-row.compact {
  align-items: end;
}

.cycle-title-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.cycle-title-row p {
  width: 100%;
}

.section-title-row.with-search {
  align-items: center;
}

.preset-chips {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-chips button {
  border: 1px solid #d3d5d6;
  background: #fff;
  color: #596266;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.preset-chips button.is-active {
  background: #eaf0ff;
  color: #3253bd;
  border-color: #c9d6ff;
}

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

.form-grid label {
  display: grid;
  gap: 6px;
}

.checkbox-label {
  align-content: start;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid #d9d8d3;
  background: #fbfaf7;
  border-radius: 10px;
  padding: 9px 11px;
}

.checkbox-inline input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.checkbox-inline span {
  font-size: 13px;
  color: #566061;
  font-weight: 500;
}

.form-grid label.wide {
  grid-column: span 2;
}

.form-grid .switch-setting-card {
  grid-column: span 2;
  border: 1px solid #d9d8d3;
  border-radius: 10px;
  background: #fbfaf7;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-grid .switch-setting-card .switch-meta {
  gap: 4px;
}

.form-grid .switch-setting-card .switch-label {
  font-size: 13px;
  color: #697171;
  font-weight: 600;
}

.form-grid span {
  font-size: 13px;
  color: #697171;
  font-weight: 600;
}

.form-grid input,
.form-grid select,
.search-wrap input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #d9d8d3;
  background: #fbfaf7;
  padding: 11px 12px;
  color: var(--text);
  outline: none;
}

.form-grid input[readonly] {
  color: #616967;
  background: #f4f3ef;
}

.form-grid input:focus,
.form-grid select:focus,
.search-wrap input:focus {
  border-color: #8ea7ff;
  box-shadow: 0 0 0 3px rgba(59, 97, 221, 0.12);
}

.form-grid small {
  font-size: 12px;
  color: #8a8f8e;
}

.inline-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.inline-actions.compact-actions {
  margin-top: 0;
}

.inline-actions.wrap-actions {
  flex-wrap: wrap;
}

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

.totals-strip {
  margin: 18px 20px 0;
  padding: 8px;
  border: 1px solid #ddddda;
  border-radius: 12px;
  background: #f4f3ef;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.total-card {
  background: #f9f8f5;
  border: 1px solid #e3e2dc;
  border-radius: 10px;
  padding: 10px 11px;
  display: grid;
  gap: 4px;
}

.total-card span {
  font-size: 12px;
  color: #7a8180;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.total-card strong {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.total-card .sub {
  font-size: 12px;
  color: #7b8281;
}

.total-card.wide {
  grid-column: span 2;
}

.total-card.positive strong {
  color: var(--green);
}

.total-card.warning strong {
  color: #94670b;
}

.total-card.negative strong {
  color: #ad3c34;
}

.total-card.neutral strong {
  color: #4f5a5a;
}

.table-wrap {
  margin-top: 10px;
  border: 1px solid #deded8;
  border-radius: 12px;
  overflow-x: auto;
  overflow-y: visible;
  background: #faf9f7;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.table-wrap.slim {
  max-height: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
}

th,
td {
  padding: 12px 12px;
  border-bottom: 1px solid #ecebe6;
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 12px;
  color: #7d8483;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0.01em;
  background: #f2f1ed;
  position: static;
}

.table-wrap.sticky-head th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.table-runs table {
  min-width: 760px;
}

.table-companies table {
  min-width: 1180px;
}

.table-sabi-catalog table {
  min-width: 900px;
}

.table-sabi-runs table {
  min-width: 760px;
}

.table-mapping table {
  min-width: 1120px;
}

.table-preview-rows table {
  min-width: 1220px;
}

.table-dryrun-jobs table {
  min-width: 760px;
}

.table-scoring-config table {
  min-width: 760px;
}

.table-scoring-results table {
  min-width: 1120px;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(59, 97, 221, 0.03);
}

.empty-cell {
  text-align: center;
  color: #878d8d;
  padding: 22px 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge.ok {
  background: #eaf8ef;
  color: #237b46;
  border: 1px solid #c8ead4;
}

.badge.error {
  background: #fff0ee;
  color: #ad3c34;
  border: 1px solid #f4d1cc;
}

.badge.warning {
  background: #fff7e8;
  color: #94670b;
  border: 1px solid #f2e0bd;
}

.badge.neutral {
  background: #f2f3f2;
  color: #667272;
  border: 1px solid #d7dbdb;
}

.badge.running {
  background: #eef3ff;
  color: #3a57b8;
  border: 1px solid #d1ddff;
}

.search-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 280px;
  flex-wrap: nowrap;
}

.pagination-row {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: #727978;
  font-size: 13px;
}

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

.table-wrap a {
  color: #355dd6;
  text-decoration: none;
  font-weight: 600;
}

.table-wrap a:hover {
  text-decoration: underline;
}

.ghost-btn.is-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.ghost-btn.is-link.disabled {
  pointer-events: none;
  opacity: 0.55;
}

.panel-card {
  border: 1px solid #dddcd7;
  border-radius: 12px;
  background: #faf9f6;
  padding: 14px;
}

.clay-layout-block {
  margin-top: 18px;
}

.clay-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.clay-main-col,
.clay-side-col {
  min-width: 0;
}

.clay-title-row {
  align-items: center;
}

.clay-title-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.clay-table-wrap table {
  min-width: 980px;
}

.financial-layout-block {
  margin-top: 18px;
}

.financial-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.financial-main-col,
.financial-side-col {
  min-width: 0;
}

.financial-side-col {
  display: grid;
  gap: 14px;
}

.financial-toolbar {
  margin: 8px 0 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.financial-toolbar label {
  display: grid;
  gap: 6px;
  color: #616969;
  font-size: 12px;
  font-weight: 600;
}

.financial-toolbar select {
  min-width: 190px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid #dadad4;
  background: #fff;
  color: #2c3333;
  padding: 0 12px;
}

.financial-toolbar-meta {
  color: #707776;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.financial-toolbar-meta .dot {
  opacity: 0.6;
}

.table-financial-catalog table {
  min-width: 940px;
}

.financial-kpi-grid {
  margin-top: 14px;
  grid-template-columns: 1fr;
}

.financial-json-output {
  margin: 0;
  padding: 12px;
  border: 1px solid #e1e1db;
  border-radius: 10px;
  background: #f7f6f2;
  color: #283131;
  min-height: 220px;
  max-height: 520px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
}

#tabPanelFinancial .form-grid.settings-grid {
  grid-template-columns: 1fr;
}

#tabPanelFinancial .form-grid.settings-grid label {
  min-width: 0;
}

.clay-col-index {
  width: 56px;
}

.clay-col-active {
  width: 84px;
}

.clay-col-name {
  width: 220px;
}

.clay-col-action {
  width: 110px;
}

#clayTablesTableBody td {
  vertical-align: middle;
}

.clay-row-index {
  color: #60686b;
}

.clay-row-active-cell {
  text-align: center;
}

.clay-row-checkbox {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #3b61dd;
  cursor: pointer;
}

.clay-row-input {
  width: 100%;
  min-width: 0;
  border-radius: 10px;
  border: 1px solid #d9d8d3;
  background: #fbfaf7;
  padding: 10px 11px;
  color: var(--text);
  outline: none;
}

.clay-row-input:focus {
  border-color: #8ea7ff;
  box-shadow: 0 0 0 3px rgba(59, 97, 221, 0.12);
}

.clay-row-action-cell {
  white-space: nowrap;
}

.clay-test-response {
  margin: 0;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #354042;
  font-size: 12px;
  line-height: 1.35;
  background: transparent;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

.clay-push-grid .label-checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #3b4345;
}

.clay-push-grid .label-checkbox-inline input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #3b61dd;
}

.clay-push-response {
  margin: 0;
  padding: 12px;
  border: 1px solid #e1e1db;
  border-radius: 10px;
  background: #f7f6f2;
  color: #283131;
  min-height: 180px;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.sabi-layout-block {
  margin-top: 18px;
}

.sabi-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.sabi-main-col,
.sabi-side-col {
  min-width: 0;
}

.sabi-side-col {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 14px;
  order: -1;
  align-items: start;
}

.sabi-filters-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.sabi-filters-grid label {
  display: grid;
  gap: 6px;
}

.sabi-filters-grid span {
  font-size: 12px;
  color: #6f7878;
  font-weight: 700;
}

.sabi-filters-grid select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #d9d8d3;
  background: #fbfaf7;
  padding: 10px 11px;
  color: var(--text);
  outline: none;
}

.sabi-filters-grid select:focus {
  border-color: #8ea7ff;
  box-shadow: 0 0 0 3px rgba(59, 97, 221, 0.12);
}

.sabi-inline-toolbar {
  margin-top: 12px;
  border: 1px solid #e0e2dc;
  border-radius: 10px;
  background: #f7f6f2;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.sabi-inline-toolbar-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.sabi-inline-toolbar-copy strong {
  font-size: 13px;
  color: #24282a;
}

.sabi-inline-toolbar-copy span {
  font-size: 12px;
  color: #737a7a;
}

.sabi-inline-toolbar-copy span.is-warning {
  color: #a36f12;
  font-weight: 600;
}

.sabi-table-wrap {
  margin-top: 12px;
  max-height: none;
}

.sabi-list-title {
  display: grid;
  gap: 4px;
}

.sabi-list-title strong {
  font-size: 14px;
  color: #232628;
}

.sabi-list-title p {
  margin: 0;
  font-size: 12px;
  color: #7b8383;
  line-height: 1.35;
}

.check-cell {
  width: 42px;
  text-align: center;
}

.check-cell input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #3b61dd;
  cursor: pointer;
}

.row-clickable {
  cursor: pointer;
}

.row-clickable.is-selected-row {
  background: rgba(59, 97, 221, 0.05);
}

.info-cell {
  width: 60px;
  text-align: center;
}

.inline-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  border: 1px solid #d7dbdb;
  background: #f2f3f2;
  color: #607070;
  font-size: 12px;
  font-weight: 700;
}

.inline-badge.yes {
  border-color: #c8e7d2;
  background: #eaf8ef;
  color: #237b46;
}

.inline-badge.no {
  border-color: #dddeda;
  background: #f2f2ef;
  color: #697170;
}

.inline-badge.type {
  font-weight: 600;
}

.inline-badge.ok {
  border-color: #c8e7d2;
  background: #eaf8ef;
  color: #237b46;
}

.inline-badge.warning {
  border-color: #f2e0bd;
  background: #fff7e8;
  color: #94670b;
}

.inline-badge.error {
  border-color: #f4d1cc;
  background: #fff0ee;
  color: #ad3c34;
}

.inline-badge.neutral {
  border-color: #d7dbdb;
  background: #f2f3f2;
  color: #667272;
}

.sabi-detail-card,
.sabi-active-card {
  height: 100%;
}

.sabi-detail-card .section-title-row,
.sabi-active-card .section-title-row {
  align-items: start;
}

.sabi-empty-state {
  border: 1px dashed #d8dad7;
  border-radius: 10px;
  background: #f6f6f2;
  color: #717878;
  padding: 14px;
  font-size: 13px;
}

.hidden {
  display: none !important;
}

body.sabi-detail-open {
  overflow: hidden;
}

.sabi-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto;
}

.sabi-detail-backdrop {
  border: 0;
  margin: 0;
  padding: 0;
  background: rgba(25, 28, 31, 0.24);
  cursor: pointer;
}

.sabi-detail-drawer {
  width: min(540px, 100vw);
  height: 100%;
  background: #f6f5f1;
  border-left: 1px solid #deded8;
  box-shadow: -18px 0 38px rgba(18, 21, 25, 0.12);
  padding: 14px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  display: grid;
  align-content: start;
  gap: 12px;
}

.sabi-detail-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.sabi-detail-drawer-header h3 {
  margin: 2px 0 0;
  font-size: 18px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: #202426;
}

.drawer-card {
  box-shadow: none;
}

.sabi-detail-title-row {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
}

.sabi-detail-title-row h4 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

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

.sabi-detail-grid > div {
  border: 1px solid #e2e2dc;
  border-radius: 10px;
  padding: 10px;
  background: #f7f6f3;
}

.detail-label {
  display: block;
  font-size: 11px;
  color: #7a8180;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.big-code {
  font-size: 14px;
  word-break: break-word;
}

.sabi-detail-description {
  margin-top: 12px;
  border: 1px solid #e2e2dc;
  border-radius: 10px;
  padding: 10px;
  background: #f7f6f3;
}

.sabi-detail-description p {
  margin: 0;
  color: #33383a;
  line-height: 1.45;
  font-size: 13px;
}

.ghost-btn.icon-only {
  width: 34px;
  min-width: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.sabi-chip-list {
  margin-top: 10px;
  max-height: 280px;
  overflow: auto;
  display: grid;
  gap: 8px;
  scrollbar-gutter: stable;
}

.sabi-chip-item {
  border: 1px solid #dedfd9;
  border-radius: 10px;
  background: #f8f7f4;
  padding: 10px;
  display: grid;
  gap: 6px;
}

.sabi-chip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sabi-chip-row strong {
  font-size: 13px;
  line-height: 1.25;
}

.chip-meta {
  color: #6f7678;
  font-size: 12px;
}

.chip-remove-btn {
  border: 1px solid #dbdcd6;
  background: #fff;
  color: #7b8283;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
}

.chip-remove-btn:hover {
  border-color: #c9cccb;
}

.panel-status {
  margin: 12px 0 0;
  font-size: 13px;
  color: #6f7676;
}

.sabi-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sabi-cycle-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#sabiEnrichmentTotalsStrip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#sabiProjectionCard strong {
  font-size: 18px;
}

#sabiProjectionCard .sub + .sub {
  margin-top: 2px;
}

.contacts-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.scoring-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mapping-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.preview-layout-block {
  margin-top: 18px;
}

.preview-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.preview-main-col,
.preview-side-col {
  min-width: 0;
}

.preview-side-col {
  display: grid;
  gap: 14px;
  order: 0;
}

.preview-main-col {
  order: 1;
}

.preview-cif-wrap {
  min-width: 360px;
}

.preview-table-wrap {
  margin-top: 12px;
}

#previewRunMetaBanner {
  color: #5b6674;
  font-size: 13px;
  font-weight: 600;
}

.preview-summary-grid {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.preview-summary-item {
  border: 1px solid #e2e2dc;
  border-radius: 10px;
  background: #f7f6f3;
  padding: 10px;
}

.preview-summary-item .detail-label {
  margin-bottom: 4px;
}

.preview-changes-wrap {
  max-height: none;
}

.preview-value {
  word-break: break-word;
}

.mapping-pending-banner {
  margin: 18px 20px 0;
  padding: 14px 16px;
  border: 1px solid #b8dff1;
  border-radius: 12px;
  background: #dff2fb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mapping-pending-banner-copy {
  min-width: 0;
}

.mapping-pending-banner-copy strong {
  display: block;
  color: #165c7a;
  font-size: 15px;
  margin-bottom: 4px;
}

.mapping-pending-banner-copy p {
  margin: 0;
  color: #2f6177;
  font-size: 13px;
}

.mapping-pending-banner .ghost-btn {
  background: rgba(255, 255, 255, 0.65);
}

.dry-run-kpi-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.dry-run-controls {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dry-run-size-field {
  display: grid;
  gap: 6px;
  min-width: 170px;
}

.dry-run-size-field span {
  font-size: 12px;
  color: #6f7878;
  font-weight: 700;
}

.dry-run-size-field input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #d9d8d3;
  background: #fbfaf7;
  padding: 10px 11px;
  color: var(--text);
  outline: none;
}

.dry-run-size-field input:focus {
  border-color: #8ea7ff;
  box-shadow: 0 0 0 3px rgba(59, 97, 221, 0.12);
}

.dry-run-layout-block {
  margin-top: 18px;
}

.dry-run-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(380px, 1fr);
  gap: 14px;
  align-items: start;
}

.dry-run-main-col,
.dry-run-side-col {
  min-width: 0;
}

.dry-run-side-col {
  display: grid;
  gap: 14px;
}

.dry-run-progress {
  margin-top: 10px;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #ecebe6;
  border: 1px solid #ddddda;
  overflow: hidden;
}

.dry-run-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #91a6ff 0%, #4f77f3 100%);
  transition: width 180ms ease;
}

.dry-run-progress-fill.ok {
  background: linear-gradient(90deg, #64c48a 0%, #2f9d5e 100%);
}

.dry-run-progress-fill.error {
  background: linear-gradient(90deg, #f1948b 0%, #cb5146 100%);
}

.mapping-layout-block {
  margin-top: 18px;
}

.mapping-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.mapping-main-col,
.mapping-side-col {
  min-width: 0;
}

.mapping-toolbar {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.mapping-count-text {
  font-size: 12px;
  color: #6f7676;
  font-weight: 700;
}

.mapping-table-wrap {
  margin-top: 12px;
}

.mapping-submeta {
  color: #8a9092;
  font-size: 12px;
  line-height: 1.35;
}

.mapping-select {
  width: 100%;
  min-width: 180px;
  border-radius: 10px;
  border: 1px solid #d9d8d3;
  background: #fbfaf7;
  padding: 9px 10px;
  color: var(--text);
  outline: none;
}

.mapping-select:focus {
  border-color: #8ea7ff;
  box-shadow: 0 0 0 3px rgba(59, 97, 221, 0.12);
}

.mapping-select:disabled {
  background: #f0efeb;
  color: #8c9191;
  cursor: not-allowed;
}

.mapping-actions-cell {
  white-space: nowrap;
}

.ghost-btn.mini {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  margin-right: 6px;
}

.ghost-btn.mini.icon-only {
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  margin-right: 0;
  font-weight: 700;
}

.ghost-btn.mini:last-child {
  margin-right: 0;
}

.mapping-side-list {
  margin-top: 10px;
  max-height: none;
  overflow: visible;
  display: grid;
  gap: 8px;
}

.mapping-side-item {
  border: 1px solid #dfdfda;
  border-radius: 10px;
  background: #faf9f6;
  padding: 10px;
  display: grid;
  gap: 4px;
}

.mapping-side-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.mapping-side-item-top strong {
  font-size: 13px;
  line-height: 1.25;
}

.mapping-side-item-meta {
  color: #6f7676;
  font-size: 12px;
}

.mapping-side-item-sample {
  color: #8a9090;
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
}

.scoring-layout-block {
  margin-top: 18px;
}

.scoring-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr);
  gap: 14px;
  align-items: start;
}

.scoring-main-col,
.scoring-side-col {
  min-width: 0;
}

.scoring-global-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.scoring-global-grid label {
  display: grid;
  gap: 6px;
}

.scoring-global-grid span {
  font-size: 12px;
  color: #6f7878;
  font-weight: 700;
}

.scoring-global-grid input[type="number"] {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #d9d8d3;
  background: #fbfaf7;
  padding: 10px 11px;
  color: var(--text);
  outline: none;
}

.scoring-global-grid input[type="number"]:focus {
  border-color: #8ea7ff;
  box-shadow: 0 0 0 3px rgba(59, 97, 221, 0.12);
}

.switch-inline {
  border: 1px solid #dddeda;
  border-radius: 10px;
  background: #f7f6f3;
  padding: 10px 12px;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.switch-inline input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #3b61dd;
}

.scoring-config-table-wrap {
  margin-top: 12px;
}

.scoring-cif-wrap {
  min-width: 360px;
}

.scoring-run-meta {
  margin-top: 12px;
  border: 1px solid #dde2ff;
  background: #f1f4ff;
  color: #4b60af;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
}

.scoring-results-table-wrap {
  margin-top: 12px;
}

.scoring-mini-series {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 32px;
  min-width: 90px;
}

.scoring-mini-series .bar {
  width: 10px;
  border-radius: 3px 3px 0 0;
  background: #cfd6eb;
}

.scoring-mini-series .bar.latest {
  background: #5879e8;
}

.delta-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #d8dbda;
  background: #f2f2ef;
  color: #65706f;
}

.delta-pill.pos {
  border-color: #c8e7d2;
  background: #eaf8ef;
  color: #237b46;
}

.delta-pill.neg {
  border-color: #f0d4cf;
  background: #fff1ee;
  color: #b24339;
}

.scoring-clickable {
  cursor: pointer;
}

.scoring-clickable.active {
  background: rgba(59, 97, 221, 0.05);
}

.mini-series-table table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
}

.mini-series-table th,
.mini-series-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #ecebe6;
  font-size: 12px;
  text-align: left;
}

.mini-series-table th {
  position: static;
  background: transparent;
  color: #727979;
  padding-top: 0;
}

.modal-footer {
  margin-top: 18px;
  padding: 16px 20px;
  border-top: 1px solid #e4e4de;
  background: rgba(250, 249, 246, 0.95);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.modal-footer p {
  margin: 0;
  color: #707776;
  font-size: 13px;
}

.footer-actions {
  display: flex;
  gap: 10px;
}

td .muted {
  color: #8a9192;
  font-size: 12px;
}

.codeish {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

/* ---------------- Global Revamp Overrides ---------------- */

:root {
  --bg: #ebe6dc;
  --panel: #f7f2e8;
  --card: #fdfaf3;
  --stroke: #d8d0c0;
  --stroke-strong: #c8beac;
  --text: #1f2628;
  --muted: #667073;
  --blue: #1557d6;
  --blue-soft: #e8f0ff;
  --green: #1f8b57;
  --red: #c04336;
  --shadow: 0 20px 40px rgba(24, 20, 12, 0.08), 0 6px 18px rgba(24, 20, 12, 0.06);
}

body {
  position: relative;
  isolation: isolate;
  color: var(--text);
  background:
    radial-gradient(1200px 420px at 10% -10%, rgba(21, 87, 214, 0.10), transparent 60%),
    radial-gradient(900px 360px at 90% 0%, rgba(31, 139, 87, 0.08), transparent 60%),
    linear-gradient(180deg, #f2ede2 0%, #e9e3d8 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.35;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(20, 24, 28, 0.08) 1px, transparent 0);
  background-size: 22px 22px;
}

.stage-shell {
  padding: 18px 20px 28px;
}

.viewport {
  margin-top: 8px;
}

.control-brand-banner {
  width: min(1320px, 100%);
  margin: 0 auto 12px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(89, 84, 70, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(247, 241, 230, 0.85));
  box-shadow: 0 14px 28px rgba(20, 16, 10, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.control-brand-main {
  min-width: 0;
}

.control-brand-kicker {
  font-size: 11px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #6f787a;
  font-weight: 800;
  margin-bottom: 8px;
}

.control-brand-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: #1f2628;
}

.control-brand-subtitle {
  margin: 6px 0 0;
  color: #616b6d;
  font-size: 13px;
  line-height: 1.35;
}

.control-brand-side {
  min-width: 0;
  display: grid;
  gap: 8px;
  justify-items: end;
}

.control-brand-side-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6f787a;
  font-weight: 700;
}

.mono-logo-strip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mono-logo-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(41, 45, 49, 0.18);
  background: rgba(255, 255, 255, 0.66);
  color: #161a1c;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.mono-logo-chip-ef {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.06em;
}

.modal-card {
  width: min(1320px, 100%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(253, 250, 243, 0.92));
  border: 1px solid rgba(74, 66, 48, 0.12);
  border-radius: 22px;
  box-shadow: 0 26px 60px rgba(22, 18, 12, 0.10), 0 8px 18px rgba(22, 18, 12, 0.05);
  backdrop-filter: blur(8px);
}

.modal-header {
  padding: 20px 24px 18px;
  border-bottom: 1px solid rgba(90, 84, 70, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.18));
}

.modal-header h1 {
  font-size: 30px;
  letter-spacing: -0.03em;
}

.modal-header p {
  margin-top: 8px;
  font-size: 14px;
  color: #5d686b;
}

.auth-bar {
  border-radius: 14px;
  padding: 8px 12px;
  border-color: rgba(90, 84, 70, 0.14);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.auth-bar-top {
  width: 100%;
  justify-content: flex-end;
  gap: 10px;
  padding: 8px 10px;
}

.auth-bar-top .auth-bar-status {
  font-size: 12px;
  color: #606a6d;
}

.ghost-btn-auth {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 13px;
}

.tab-compact-nav {
  display: grid;
  grid-template-columns: 240px minmax(320px, 1fr);
  gap: 12px;
  margin: 14px 24px 0;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(89, 84, 70, 0.10);
  background: rgba(255, 255, 255, 0.60);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.compact-nav-field {
  gap: 6px;
}

.compact-nav-field > span {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #6b7577;
}

.compact-nav-field select {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(89, 84, 70, 0.12);
  background: rgba(255, 255, 255, 0.85);
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.tab-group-nav {
  display: none !important;
}

.tab-group-btn {
  min-height: 36px;
  border-radius: 999px;
  border-color: rgba(70, 76, 88, 0.12);
  background: rgba(255, 255, 255, 0.65);
  color: #586264;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transition: 140ms ease;
}

.tab-group-btn:hover {
  border-color: rgba(21, 87, 214, 0.22);
  color: #354045;
}

.tab-group-btn.is-active {
  background: linear-gradient(180deg, #eef4ff 0%, #dfeaff 100%);
  border-color: rgba(21, 87, 214, 0.24);
  color: #234fb5;
  box-shadow: 0 4px 10px rgba(21, 87, 214, 0.08);
}

.tab-nav {
  display: none !important;
}

.tab-btn {
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 999px;
  border-color: rgba(78, 84, 94, 0.10);
  background: rgba(255, 255, 255, 0.66);
  color: #566063;
  font-size: 13px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.tab-btn:hover {
  border-color: rgba(21, 87, 214, 0.20);
  transform: translateY(-1px);
}

.tab-btn.is-active {
  background: linear-gradient(180deg, #f0f5ff 0%, #dfeaff 100%);
  border-color: rgba(21, 87, 214, 0.28);
  color: #1f4cb4;
  box-shadow: 0 6px 14px rgba(21, 87, 214, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.decision-box {
  margin: 22px 24px 0;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(90, 84, 70, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(253, 249, 241, 0.95));
  box-shadow: 0 10px 24px rgba(21, 17, 11, 0.04);
}

.decision-box-switch {
  align-items: center;
}

.decision-box-switch .switch-panel {
  align-self: center;
  min-height: 54px;
}

.decision-box > .inline-actions.compact-actions {
  align-self: center;
}

.decision-copy h2 {
  font-size: 21px;
  letter-spacing: -0.02em;
}

.decision-copy p {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.45;
  color: #617072;
}

.switch-panel {
  border-radius: 14px;
  border-color: rgba(90, 84, 70, 0.12);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.info-banner {
  margin: 12px 24px 0;
  padding: 13px 16px 13px 18px;
  border-radius: 14px;
  border: 1px solid rgba(21, 87, 214, 0.13);
  border-left: 4px solid rgba(21, 87, 214, 0.42);
  background:
    linear-gradient(180deg, rgba(238, 244, 255, 0.95), rgba(248, 250, 255, 0.95));
  color: #2f4f9f;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.01em;
  box-shadow: 0 6px 14px rgba(21, 87, 214, 0.035), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  text-wrap: pretty;
}

.crm-cycle-inline-note {
  margin: 12px 24px 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(90, 84, 70, 0.10);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.form-section,
.data-block {
  margin: 20px 24px 0;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(90, 84, 70, 0.10);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 8px 16px rgba(20, 16, 10, 0.03);
}

.section-title-row h3 {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.section-title-row p {
  color: #667173;
}

.summary-pill {
  border-color: rgba(31, 139, 87, 0.20);
  background: linear-gradient(180deg, #f0fbf5 0%, #e5f7ee 100%);
  color: #1f7d4d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.summary-pill.is-off {
  border-color: rgba(90, 84, 70, 0.12);
  background: rgba(255, 255, 255, 0.68);
  color: #657070;
}

.ghost-btn,
.primary-btn,
.tab-btn,
.tab-group-btn,
.preset-chips button,
.segmented button,
.chip-remove-btn {
  position: relative;
  appearance: none;
  border-width: 1px;
  border-style: solid;
  border-radius: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    box-shadow 140ms ease,
    color 140ms ease,
    transform 140ms ease,
    filter 140ms ease;
}

.ghost-btn:focus-visible,
.primary-btn:focus-visible,
.tab-btn:focus-visible,
.tab-group-btn:focus-visible,
.preset-chips button:focus-visible,
.segmented button:focus-visible,
.chip-remove-btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px rgba(21, 87, 214, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  border-color: rgba(21, 87, 214, 0.30);
}

.ghost-btn:active,
.primary-btn:active,
.tab-btn:active,
.tab-group-btn:active,
.preset-chips button:active,
.segmented button:active,
.chip-remove-btn:active {
  transform: translateY(1px);
}

.ghost-btn,
.primary-btn {
  min-height: 42px;
  border-radius: 12px;
  padding: 10px 14px;
}

.ghost-btn {
  border-color: rgba(89, 84, 70, 0.13);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.ghost-btn:hover {
  border-color: rgba(21, 87, 214, 0.18);
  background: rgba(255, 255, 255, 0.92);
}

.primary-btn {
  background: linear-gradient(180deg, #2d72f2 0%, #1557d6 100%);
  border-color: rgba(15, 73, 181, 0.65);
  box-shadow: 0 12px 20px rgba(21, 87, 214, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.primary-btn:hover {
  filter: brightness(1.03);
  box-shadow: 0 14px 24px rgba(21, 87, 214, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.primary-btn:active {
  filter: brightness(0.99);
}

.tab-group-btn,
.tab-btn {
  border-radius: 999px;
}

.preset-chips button,
.segmented button,
.chip-remove-btn {
  border-color: rgba(89, 84, 70, 0.12);
  background: rgba(255, 255, 255, 0.74);
  color: #566164;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.preset-chips button:hover,
.segmented button:hover,
.chip-remove-btn:hover {
  border-color: rgba(21, 87, 214, 0.18);
  background: rgba(255, 255, 255, 0.92);
  color: #314043;
}

.preset-chips button.is-active {
  background: linear-gradient(180deg, #eef4ff 0%, #dfeaff 100%);
  border-color: rgba(21, 87, 214, 0.24);
  color: #224fb5;
  box-shadow: 0 6px 12px rgba(21, 87, 214, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.segmented {
  border-color: rgba(89, 84, 70, 0.10);
  background: rgba(255, 255, 255, 0.56);
  border-radius: 12px;
  padding: 4px;
}

.segmented button {
  border-radius: 10px;
  padding: 8px 13px;
}

.segmented button.is-active {
  background: linear-gradient(180deg, #2d72f2 0%, #1557d6 100%);
  color: #fff;
  box-shadow: 0 8px 14px rgba(21, 87, 214, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.chip-remove-btn {
  min-height: 32px;
  border-radius: 10px;
  padding: 6px 10px;
}

.ghost-btn.mini {
  border-radius: 10px;
  min-height: 34px;
  padding: 7px 10px;
}

.ghost-btn.icon-only,
.ghost-btn.mini.icon-only {
  border-radius: 10px;
}

.ghost-btn:disabled,
.primary-btn:disabled,
.tab-btn:disabled,
.tab-group-btn:disabled,
.preset-chips button:disabled,
.segmented button:disabled,
.chip-remove-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.form-grid {
  gap: 14px;
}

.form-grid span {
  font-size: 12px;
  color: #626d70;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.form-grid input,
.form-grid select,
.search-wrap input {
  min-height: 44px;
  border-radius: 12px;
  border-color: rgba(89, 84, 70, 0.13);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.form-grid input[readonly] {
  background: rgba(244, 242, 236, 0.92);
  color: #5e686a;
}

.form-grid input:focus,
.form-grid select:focus,
.search-wrap input:focus {
  border-color: rgba(21, 87, 214, 0.34);
  box-shadow: 0 0 0 4px rgba(21, 87, 214, 0.11);
}

.checkbox-inline {
  min-height: 44px;
  border-radius: 12px;
  border-color: rgba(89, 84, 70, 0.13);
  background: rgba(255, 255, 255, 0.74);
}

.totals-strip {
  margin: 20px 24px 0;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(90, 84, 70, 0.10);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(244, 240, 232, 0.7));
  gap: 10px;
}

.total-card {
  border-radius: 12px;
  border-color: rgba(89, 84, 70, 0.10);
  background: rgba(255, 255, 255, 0.70);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  padding: 12px;
  gap: 5px;
}

.total-card span {
  font-size: 11px;
  letter-spacing: 0.07em;
}

.total-card strong {
  font-size: 22px;
  line-height: 1.05;
}

.total-card .sub {
  font-size: 12px;
  color: #6f797b;
}

.table-wrap {
  margin-top: 12px;
  border-radius: 14px;
  border: 1px solid rgba(89, 84, 70, 0.12);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 16px rgba(20, 16, 10, 0.03);
}

th,
td {
  padding: 12px 13px;
}

th {
  background: linear-gradient(180deg, #f6f2ea 0%, #efe9dd 100%);
  color: #647073;
  border-bottom-color: rgba(89, 84, 70, 0.10);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

td {
  border-bottom-color: rgba(89, 84, 70, 0.07);
}

tbody tr:nth-child(even) {
  background: rgba(247, 244, 238, 0.35);
}

tbody tr:hover {
  background: rgba(21, 87, 214, 0.05);
}

.table-wrap.sticky-head th {
  box-shadow: inset 0 -1px 0 rgba(89, 84, 70, 0.08);
}

.panel-card {
  border-radius: 14px;
  border: 1px solid rgba(89, 84, 70, 0.10);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
  padding: 16px;
}

.sabi-inline-toolbar,
.mapping-pending-banner {
  border-radius: 12px;
  border-color: rgba(89, 84, 70, 0.10);
  background: rgba(255, 255, 255, 0.58);
}

.inline-badge {
  border-color: rgba(89, 84, 70, 0.12);
  background: rgba(242, 243, 242, 0.92);
  color: #5f6e70;
}

.inline-badge.type {
  background: rgba(233, 239, 251, 0.95);
  border-color: rgba(21, 87, 214, 0.15);
  color: #3157b8;
}

.sabi-detail-drawer {
  background: linear-gradient(180deg, #f8f4eb 0%, #f4efe4 100%);
  border-left-color: rgba(89, 84, 70, 0.12);
}

.panel-status {
  margin-top: 14px;
  color: #677174;
}

.empty-cell {
  color: #788082;
  padding: 26px 14px;
}

.decision-actions-financial {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, max-content));
  gap: 8px;
  justify-content: end;
  align-items: center;
}

.decision-actions-financial #financialRunBtn {
  grid-column: 1 / -1;
  justify-self: stretch;
}

.decision-actions-financial .ghost-btn,
.decision-actions-financial .primary-btn {
  width: 100%;
}

.decision-actions-dryrun {
  display: grid;
  grid-template-columns: minmax(170px, 220px) max-content max-content;
  gap: 10px;
  align-items: end;
  justify-content: end;
}

.decision-actions-dryrun .ghost-btn,
.decision-actions-dryrun .primary-btn {
  align-self: end;
  white-space: nowrap;
}

.dry-run-size-field {
  align-self: end;
}

.dry-run-size-field span {
  min-height: 14px;
}

@media (max-width: 1100px) {
  .control-brand-banner {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 10px;
    padding: 12px 14px;
  }

  .control-brand-side {
    justify-items: start;
  }

  .mono-logo-strip {
    justify-content: flex-start;
  }

  .tab-compact-nav {
    display: grid;
  }

  .tab-group-nav,
  .tab-nav {
    display: none;
  }

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

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

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

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

  #sabiEnrichmentTotalsStrip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .total-card.wide {
    grid-column: span 2;
  }

  .search-wrap {
    min-width: 0;
    width: 100%;
  }

  .section-title-row.with-search {
    align-items: stretch;
    flex-direction: column;
  }

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

  .sabi-side-col {
    grid-template-columns: 1fr;
    order: 0;
  }

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

  .mapping-pending-banner {
    align-items: stretch;
    flex-direction: column;
  }

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

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

  .clay-push-grid {
    grid-template-columns: 1fr;
  }

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

  .decision-actions-financial {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .decision-actions-financial #financialRunBtn {
    grid-column: auto;
  }

  .decision-actions-dryrun {
    grid-template-columns: 1fr;
    width: 100%;
    justify-content: stretch;
  }

  .dry-run-layout {
    grid-template-columns: 1fr;
  }

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

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

  .scoring-global-grid {
    grid-template-columns: 1fr 1fr;
  }

  .mapping-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .financial-toolbar {
    align-items: stretch;
  }

  .financial-toolbar label,
  .financial-toolbar select {
    width: 100%;
  }

  .scoring-cif-wrap {
    min-width: 0;
    width: 100%;
  }

  .preview-cif-wrap {
    min-width: 0;
    width: 100%;
  }

  .mapping-pending-banner .inline-actions {
    width: 100%;
  }

  .mapping-pending-banner .ghost-btn {
    flex: 1;
  }

  .sabi-inline-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .sabi-inline-toolbar .inline-actions {
    width: 100%;
  }

  .sabi-inline-toolbar .ghost-btn {
    flex: 1;
  }

  .dry-run-controls {
    width: 100%;
    justify-content: stretch;
  }

  .dry-run-controls .ghost-btn,
  .dry-run-controls .primary-btn {
    width: 100%;
  }

  .form-section,
  .data-block {
    padding: 14px;
  }

  .dry-run-size-field {
    width: 100%;
  }

  .clay-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .clay-title-actions {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 760px) {
  .stage-shell {
    padding: 12px 10px 18px;
  }

  .control-brand-banner {
    margin-bottom: 10px;
    border-radius: 16px;
    padding: 12px;
  }

  .control-brand-title {
    font-size: 20px;
  }

  .control-brand-subtitle {
    font-size: 12px;
  }

  .tab-compact-nav {
    grid-template-columns: 1fr;
    padding: 10px 14px 12px;
  }

  .modal-header {
    padding: 16px 14px;
  }

  .modal-header-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .modal-header h1 {
    font-size: 22px;
  }

  .decision-box {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-section,
  .data-block {
    margin: 16px 14px 0;
    padding: 12px;
    border-radius: 14px;
  }

  .decision-box,
  .info-banner,
  .totals-strip {
    margin-left: 14px;
    margin-right: 14px;
  }

  .decision-box > .inline-actions.compact-actions {
    width: 100%;
    align-self: stretch;
  }

  .switch-panel {
    width: 100%;
    justify-content: space-between;
  }

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

  .form-grid label.wide {
    grid-column: auto;
  }

  .totals-strip {
    grid-template-columns: 1fr;
  }

  .sabi-kpi-grid {
    grid-template-columns: 1fr;
  }

  .sabi-cycle-grid {
    grid-template-columns: 1fr;
  }

  #sabiEnrichmentTotalsStrip {
    grid-template-columns: 1fr;
  }

  .contacts-kpi-grid {
    grid-template-columns: 1fr;
  }

  .financial-kpi-grid {
    grid-template-columns: 1fr;
  }

  .scoring-kpi-grid {
    grid-template-columns: 1fr;
  }

  .dry-run-kpi-grid {
    grid-template-columns: 1fr;
  }

  .total-card.wide {
    grid-column: auto;
  }

  .sabi-filters-grid {
    grid-template-columns: 1fr;
  }

  .scoring-global-grid {
    grid-template-columns: 1fr;
  }

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

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

  .sabi-detail-backdrop {
    display: none;
  }

  .sabi-detail-drawer {
    width: 100vw;
    border-left: 0;
    box-shadow: none;
    padding: 12px 10px 16px;
  }

  .modal-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .footer-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

}
