@font-face {
  font-family: "Cuaniex";
  src: url("/fonts/Cuaniex.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f1f7f3;
  --panel: #ffffff;
  --panel-soft: #f7fbf8;
  --ink: #10251a;
  --muted: #607268;
  --line: #d6e5db;
  --nav: #062b1c;
  --nav-2: #0a4930;
  --brand: #087b4e;
  --blue: #0a8f5a;
  --cyan: #1aa879;
  --green: #079455;
  --amber: #d97706;
  --red: #dc2626;
  --purple: #4a8065;
  --shadow: 0 14px 34px rgb(7 74 46 / 9%);
  font-family: "Cuaniex", Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

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

button {
  min-height: 38px;
  border: 1px solid var(--brand);
  border-radius: 7px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: #05633e;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  padding: 8px 10px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgb(8 123 78 / 15%);
}

textarea {
  resize: vertical;
}

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

h1 {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 28px;
  line-height: 1.12;
}

h2 {
  margin: 0 0 4px;
  color: #16213a;
  font-size: 16px;
  line-height: 1.2;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% 0%, rgb(32 180 112 / 22%), transparent 32%),
    linear-gradient(180deg, var(--nav), #031c12);
  color: #dce9f7;
  padding: 18px 14px;
}

.brand {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 3px 2px 18px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 50px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.brand-mark img {
  width: 54px;
  height: 48px;
  object-fit: contain;
  display: block;
}

.brand strong,
.brand span,
.factory-status span {
  display: block;
}

.brand strong {
  font-size: 14px;
  line-height: 1.18;
  letter-spacing: 0;
}

.brand span {
  margin-top: 3px;
  color: #9fb7ce;
  font-size: 12px;
}

.module-nav {
  display: grid;
  gap: 4px;
}

.module-link {
  justify-content: flex-start;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #dce9f7;
  padding: 0 12px;
  text-align: left;
  font-weight: 750;
}

.module-link:hover,
.module-link.active {
  background: #0b6542;
  color: #ffffff;
}

.factory-status {
  margin-top: 24px;
  border-top: 1px solid rgb(255 255 255 / 14%);
  padding: 16px 8px 0;
}

.factory-status p {
  margin-bottom: 10px;
  color: #9fb7ce;
  font-size: 12px;
  font-weight: 800;
}

.factory-status span {
  margin: 8px 0;
  font-size: 13px;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: -1px;
}

.dot.green {
  background: var(--green);
}

.dot.cyan {
  background: var(--cyan);
}

.dot.amber {
  background: #fbbf24;
}

.main-panel {
  min-width: 0;
  width: 100%;
  overflow-x: hidden;
  padding: 18px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.user-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: end;
  gap: 12px;
}

.quote {
  color: #475569;
  font-size: 13px;
  font-style: italic;
}

.user-pill {
  min-width: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 10px;
}

.user-pill span,
.user-pill small {
  display: block;
}

.user-pill span {
  font-weight: 900;
}

.user-pill small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.ghost {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.ghost:hover {
  border-color: #c4d2e4;
  background: #f8fbff;
}

.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.login-panel {
  display: grid;
  width: min(720px, 100%);
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 24px;
  box-shadow: var(--shadow);
}

.login-form {
  display: grid;
  grid-template-columns: 1fr 1fr 132px;
  gap: 10px;
}

.filter-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
  align-items: end;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgb(255 255 255 / 94%);
  padding: 10px;
  backdrop-filter: blur(10px);
}

.filter-bar label,
.outcome-form label {
  display: grid;
  gap: 5px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

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

.kpi-card {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  padding: 12px;
  box-shadow: 0 8px 22px rgb(15 23 42 / 5%);
}

.kpi-card span,
.kpi-card small {
  display: block;
}

.kpi-card span {
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
}

.kpi-card strong {
  display: block;
  margin: 8px 0 6px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  white-space: nowrap;
}

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

.kpi-card.blue {
  background: linear-gradient(180deg, #eef6ff, #ffffff);
}

.kpi-card.green {
  background: linear-gradient(180deg, #ecfdf3, #ffffff);
}

.kpi-card.amber {
  background: linear-gradient(180deg, #fff7ed, #ffffff);
}

.kpi-card.red {
  background: linear-gradient(180deg, #fff1f2, #ffffff);
}

.kpi-card.purple {
  background: linear-gradient(180deg, #f5f3ff, #ffffff);
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

.sync-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.health-card {
  min-height: 92px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--cyan);
  border-radius: 8px;
  background: #ffffff;
  padding: 11px 12px;
  box-shadow: 0 8px 22px rgb(15 23 42 / 5%);
}

.health-card.ok {
  border-left-color: var(--green);
}

.health-card.warn {
  border-left-color: var(--amber);
}

.health-card.bad {
  border-left-color: var(--red);
}

.health-card span,
.health-card strong,
.health-card small {
  display: block;
}

.health-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.health-card strong {
  margin: 6px 0 5px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.1;
}

.health-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-meter,
.kpi-meter {
  display: block;
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 3px;
  background: rgb(255 255 255 / 10%);
}

.health-meter {
  margin: 8px 0 7px;
}

.health-meter b,
.kpi-meter b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #4fc738;
}

.health-card.warn .health-meter b { background: #f0b33c; }
.health-card.bad .health-meter b { background: #ef5b55; }

.kpi-meter {
  margin-top: auto;
}

.kpi-card .kpi-meter b { background: #55c63d; }
.kpi-card.amber .kpi-meter b { background: #f0b33c; }
.kpi-card.red .kpi-meter b { background: #ef5b55; }
.kpi-card.purple .kpi-meter b { background: #6ea8ee; }

.sync-alert-card {
  grid-column: 1 / -1;
  min-height: auto;
}

.sync-alert-chart {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 10px;
}

.sync-alert-chart > div {
  display: grid;
  grid-template-columns: auto minmax(70px, 1fr) auto;
  gap: 9px;
  align-items: center;
}

.sync-alert-chart span,
.sync-alert-chart strong {
  margin: 0;
  color: #ffffff;
  font-size: 12px;
}

.sync-alert-chart i {
  display: block;
  height: 9px;
  overflow: hidden;
  border-radius: 4px;
  background: rgb(255 255 255 / 10%);
}

.sync-alert-chart b { display: block; height: 100%; }
.sync-alert-chart b.bad { background: #ef5b55; }
.sync-alert-chart b.warn { background: #f0b33c; }
.sync-alert-chart b.ok { background: #55c63d; }

.sync-alert-card ul {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.sync-alert-card li {
  position: relative;
  padding-left: 16px;
  color: #334155;
  font-size: 12px;
  line-height: 1.45;
}

.sync-alert-card li::before {
  position: absolute;
  top: 7px;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--cyan);
  content: "";
}

.sync-alert-card li.ok::before {
  background: var(--green);
}

.sync-alert-card li.warn::before {
  background: var(--amber);
}

.sync-alert-card li.bad::before {
  background: var(--red);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.8fr 0.85fr;
  gap: 12px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel.wide {
  grid-column: span 2;
}

.action-board {
  grid-column: span 3;
}

.insight-card {
  grid-column: span 2;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
}

.panel-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.chip,
.alert-pill,
.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 9px;
  background: #e8f3ff;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.alert-pill {
  background: #fee2e2;
  color: var(--red);
}

.line-chart {
  min-height: 294px;
  padding: 4px 14px 14px;
}

.line-chart svg {
  width: 100%;
  height: 240px;
}

.grid-lines line {
  stroke: #d8e5f2;
  stroke-dasharray: 3 4;
}

.spend-line,
.revenue-line {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spend-line {
  stroke: #2563eb;
}

.revenue-line {
  stroke: #16a34a;
}

.axis-labels text {
  fill: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.line-swatch {
  display: inline-block;
  width: 22px;
  height: 4px;
  margin-right: 6px;
  border-radius: 999px;
  vertical-align: 2px;
}

.line-swatch.spend {
  background: #2563eb;
}

.line-swatch.revenue {
  background: #16a34a;
}

.funnel {
  display: grid;
  gap: 10px;
  padding: 2px 14px 16px;
}

.funnel-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 52px;
  gap: 8px;
  align-items: center;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.funnel-bar {
  min-width: 36px;
  border-radius: 5px;
  background: linear-gradient(90deg, #93c5fd, #2563eb);
  padding: 7px 9px;
  color: #ffffff;
  text-align: right;
}

.funnel-row:nth-child(2) .funnel-bar {
  background: linear-gradient(90deg, #86efac, #16a34a);
}

.funnel-row:nth-child(3) .funnel-bar {
  background: linear-gradient(90deg, #fde68a, #f59e0b);
}

.funnel-row:nth-child(4) .funnel-bar {
  background: linear-gradient(90deg, #fca5a5, #ef4444);
}

.funnel-row:nth-child(5) .funnel-bar {
  background: linear-gradient(90deg, #c4b5fd, #7c3aed);
}

.funnel-row em {
  color: var(--muted);
  font-style: normal;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 146px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 8px 14px 16px;
}

.donut {
  position: relative;
  display: grid;
  place-items: center;
  width: 146px;
  height: 146px;
  border-radius: 50%;
  background: conic-gradient(#e2e8f0 0deg 360deg);
}

.donut::after {
  position: absolute;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: #ffffff;
  content: "";
}

.donut span {
  position: relative;
  z-index: 1;
  display: grid;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  font-weight: 800;
}

.donut strong {
  color: var(--ink);
  font-size: 22px;
}

.legend {
  display: grid;
  gap: 8px;
}

.legend-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  color: #334155;
  font-size: 12px;
}

.legend-row i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.rank-chart {
  display: grid;
  gap: 13px;
  min-height: 250px;
  padding: 8px 16px 20px;
}

.rank-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(160px, 1.35fr) minmax(175px, 0.9fr);
  gap: 14px;
  align-items: center;
}

.rank-label,
.rank-value {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.rank-label strong,
.rank-value strong {
  overflow: hidden;
  color: #ffffff;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-label span,
.rank-value span {
  overflow: hidden;
  color: #c5cec8;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-value {
  text-align: right;
}

.rank-track {
  height: 30px;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 5px;
  background: #263229;
}

.rank-track i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: #58c63b;
}

.rank-track .tone-warn { background: #f59e0b; }
.rank-track .tone-bad { background: #ef5b55; }
.rank-track .tone-neutral { background: #399ee5; }
.rank-track .tone-sale { background: #63c84a; }

@media (max-width: 760px) {
  .rank-chart {
    min-height: 0;
    padding-inline: 0;
  }

  .rank-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 10px;
  }

  .rank-track {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 24px;
  }

  .rank-value {
    min-width: 116px;
  }

  .rank-value span {
    white-space: normal;
  }
}

.table-wrap {
  overflow: auto;
}

.table-wrap.compact {
  max-height: 360px;
}

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

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f9ff;
  color: #475569;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

td {
  color: #1e293b;
  font-size: 12px;
}

.number-cell {
  text-align: right;
  white-space: nowrap;
}

.name,
.source-page {
  font-weight: 900;
}

.customer-copy {
  min-width: 0;
}

.customer-copy .name,
.customer-id {
  overflow-wrap: anywhere;
}

.customer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  align-items: center;
}

.customer-tag {
  display: inline-flex;
  align-items: center;
  max-width: 180px;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.customer-tag.intake {
  gap: 5px;
  color: #4b5563;
  background: #f1f5f9;
}

.customer-tag.intake::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca3af;
  flex: 0 0 auto;
}

.customer-tag.source {
  color: #315b78;
  background: #e8f3ff;
}

.customer-tag.missing {
  color: #9a3412;
  background: #fff7ed;
}

.customer-tag.more {
  color: #334155;
  background: #ffffff;
  border: 1px solid var(--line);
}

.meta,
.customer-id {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.customer-block {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-width: 200px;
}

.customer-avatar {
  width: 38px;
  height: 38px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #e8f3ff;
}

.customer-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.customer-avatar.placeholder {
  display: grid;
  place-items: center;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e8f3ff;
  color: #134e4a;
  font-size: 11px;
  font-weight: 900;
}

.badge.warn,
.status-chip.warn {
  background: #fff7ed;
  color: #c2410c;
}

.badge.ok,
.status-chip.ok {
  background: #ecfdf3;
  color: var(--green);
}

.badge.bad,
.status-chip.bad {
  background: #fef2f2;
  color: var(--red);
}

.row-action {
  min-height: 32px;
  padding: 0 11px;
  white-space: nowrap;
}

.alert-list,
.ai-insight,
.target-list,
.quality-grid,
.module-summary,
.action-summary,
.data-completeness,
.priority-list {
  display: grid;
  gap: 10px;
  padding: 0 14px 16px;
}

.alert-item,
.quality-card,
.module-card,
.action-item,
.priority-item,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  padding: 11px 12px;
}

.action-board-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr 1.2fr;
  gap: 12px;
}

.action-item {
  border-left: 4px solid var(--cyan);
}

.action-item.ok {
  border-left-color: var(--green);
}

.action-item.warn {
  border-left-color: var(--amber);
}

.action-item.bad {
  border-left-color: var(--red);
}

.action-item strong,
.action-item span,
.priority-item strong,
.priority-item span,
.priority-item small,
.completeness-row strong,
.completeness-row span {
  display: block;
}

.action-item span,
.priority-item span,
.priority-item small,
.completeness-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.completeness-row {
  display: grid;
  gap: 8px;
}

.priority-item {
  background: #ffffff;
}

.alert-item {
  border-left-width: 4px;
}

.alert-item strong,
.alert-item span,
.empty-state strong,
.empty-state span,
.quality-card strong,
.quality-card span,
.quality-card small {
  display: block;
}

.alert-item span,
.empty-state span,
.quality-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.alert-item.low {
  border-left-color: var(--cyan);
}

.alert-item.medium {
  border-left-color: var(--amber);
}

.alert-item.high,
.alert-item.critical {
  border-left-color: var(--red);
}

.ai-insight p {
  margin: 0;
  color: #334155;
  font-size: 13px;
  line-height: 1.45;
}

.target-row {
  display: grid;
  gap: 7px;
}

.target-row div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #334155;
  font-size: 12px;
}

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

.target-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.target-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #16a34a, #2563eb);
}

.quick-entry-panel {
  padding-bottom: 14px;
}

.quick-head {
  align-items: center;
}

.quick-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0 14px 12px;
}

.quick-metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fbff, #ffffff);
  padding: 11px 12px;
}

.quick-metric strong,
.quick-metric span {
  display: block;
}

.quick-metric strong {
  color: var(--brand);
  font-size: 22px;
  line-height: 1;
}

.quick-metric span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.quick-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 14px;
}

.quick-filter {
  min-height: 34px;
  border-color: var(--line);
  background: #ffffff;
  color: #334155;
  padding: 0 12px;
  font-size: 12px;
}

.quick-filter:hover,
.quick-filter.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.quick-lead-list {
  display: grid;
  gap: 12px;
  padding: 0 14px 2px;
}

.quick-lead-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  box-shadow: 0 8px 22px rgb(15 23 42 / 5%);
}

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

.quick-card-head .customer-block {
  min-width: 0;
}

.quick-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.quick-meta-grid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdff;
  padding: 8px 9px;
}

.quick-meta-grid strong,
.quick-meta-grid span {
  display: block;
}

.quick-meta-grid strong {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.quick-meta-grid span {
  overflow: hidden;
  margin-top: 3px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-next-action {
  border-left: 4px solid var(--amber);
  border-radius: 7px;
  background: #fff7ed;
  color: #7c2d12;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
}

.quick-suggested-reply {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: start;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--blue);
  border-radius: 7px;
  background: #eff6ff;
  padding: 9px 10px;
}

.quick-suggested-reply strong {
  color: var(--brand);
  font-size: 12px;
  line-height: 1.25;
}

.quick-suggested-reply p {
  grid-column: 1 / -1;
  margin: 0;
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}

.quick-suggested-reply button {
  min-height: 30px;
}

.quick-update-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.quick-update-form label {
  display: grid;
  gap: 5px;
  color: #334155;
  font-size: 12px;
  font-weight: 850;
}

.quick-update-form label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-update-form .quick-wide {
  grid-column: span 3;
}

.quick-card-actions {
  display: flex;
  grid-column: span 3;
  align-items: center;
  justify-content: end;
  gap: 9px;
}

.quick-save-message {
  margin-right: auto;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.quick-save-message.error {
  color: var(--red);
}

.rbac-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.4fr);
  gap: 12px;
}

.rbac-form-panel,
.rbac-table-panel {
  min-width: 0;
}

.user-form {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px;
}

.user-form label,
.page-picker {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 850;
}

.user-active-toggle {
  grid-template-columns: 18px 1fr;
  align-items: center;
}

.user-active-toggle input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

.page-picker strong {
  color: #334155;
}

.page-picker small {
  color: var(--muted);
  font-weight: 750;
  line-height: 1.35;
}

.page-options {
  display: grid;
  gap: 7px;
}

.page-options label {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdff;
  padding: 8px 9px;
}

.page-options input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

.user-form-actions,
.user-row-actions {
  display: flex;
  gap: 8px;
}

.user-form-actions {
  justify-content: end;
}

.user-row-actions {
  justify-content: end;
}

.user-row-actions .row-action {
  min-width: 64px;
}

.ghost-row {
  border-color: var(--line);
  background: #ffffff;
  color: #334155;
}

.ghost-row:hover {
  border-color: var(--brand);
  background: #eff6ff;
  color: var(--brand);
}

.inbox-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr) 330px;
  gap: 12px;
}

.conversation-list,
.chat-panel,
.profile-panel {
  min-height: 600px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.conversation-items {
  display: grid;
  gap: 8px;
  padding: 0 12px 14px;
}

.conversation-item {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 78px;
  border-color: var(--line);
  background: #ffffff;
  color: #334155;
  padding: 10px;
  text-align: left;
  font-weight: 700;
}

.conversation-item:hover,
.conversation-item.active {
  border-color: #93c5fd;
  background: #eff6ff;
}

.conversation-name {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.conversation-item strong {
  color: var(--brand);
  font-size: 12px;
}

.chat-panel {
  display: grid;
  place-items: center;
  padding: 18px;
}

.profile-panel {
  padding: 14px;
}

.profile-name {
  margin: 12px 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.profile-preview dl,
.lead-detail {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}

.profile-preview dl div,
.lead-detail div {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdff;
  padding: 9px 10px;
}

.profile-preview dt,
.lead-detail dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-preview dd,
.lead-detail dd {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 13px;
}

.full-width {
  width: 100%;
}

.pipeline-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding: 4px 14px 16px;
}

.pipeline-column {
  min-height: 460px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--cyan);
  border-radius: 8px;
  background: #f7fbf8;
}

.pipeline-column.qualified { border-top-color: #0ea5e9; }
.pipeline-column.quoted { border-top-color: var(--amber); }
.pipeline-column.won { border-top-color: var(--green); }
.pipeline-column.lost { border-top-color: var(--red); }

.pipeline-column > header,
.decision-group > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px;
}

.pipeline-column > header span,
.decision-group > header > span {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e6f4ec;
  color: var(--brand);
  font-weight: 900;
}

.pipeline-list {
  display: grid;
  gap: 7px;
  padding: 0 8px 10px;
}

.pipeline-lead {
  display: grid;
  gap: 4px;
  width: 100%;
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.pipeline-lead:hover { border-color: var(--brand); background: #f0faf5; }
.pipeline-lead span,
.pipeline-lead small { color: var(--muted); font-size: 11px; }

.operation-summary,
.finance-summary,
.report-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 4px 14px 14px;
}

#saleEngagementSummary {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  padding: 0 0 14px;
}

#saleEngagementSummary .operation-stat {
  min-width: 0;
}

#saleEngagementSummary .operation-stat strong,
#saleEngagementSummary .operation-stat small {
  overflow-wrap: anywhere;
}

@media (max-width: 1280px) {
  #saleEngagementSummary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  #saleEngagementSummary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.operation-stat,
.finance-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 7px;
  background: #ffffff;
  padding: 11px 12px;
}

.operation-stat.warn { border-left-color: var(--amber); }
.operation-stat.bad { border-left-color: var(--red); }
.operation-stat span,
.finance-card span,
.finance-card small { display: block; color: var(--muted); font-size: 11px; font-weight: 800; }
.operation-stat strong,
.finance-card strong { display: block; margin: 5px 0; color: var(--ink); font-size: 22px; }

.analysis-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, .7fr);
  gap: 12px;
}

.decision-matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 4px 14px 16px;
}

.decision-group {
  border: 1px solid var(--line);
  border-top: 4px solid var(--cyan);
  border-radius: 8px;
  overflow: hidden;
}

.decision-group.ok { border-top-color: var(--green); }
.decision-group.warn { border-top-color: var(--amber); }
.decision-group.bad { border-top-color: var(--red); }
.decision-group header small { display: block; margin-top: 3px; color: var(--muted); }

.decision-ad {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--line);
  padding: 9px 11px;
}

.decision-ad span,
.decision-ad small { color: var(--muted); font-size: 11px; line-height: 1.4; }

.action-distribution,
.bar-chart,
.report-snapshot {
  display: grid;
  gap: 14px;
  padding: 8px 14px 18px;
}

.distribution-row > div:first-child {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12px;
}

.distribution-track,
.bar-track { height: 12px; overflow: hidden; border-radius: 4px; background: #e8efeb; }
.distribution-track i,
.bar-track i { display: block; height: 100%; background: var(--cyan); }
.distribution-row.ok i { background: var(--green); }
.distribution-row.warn i { background: var(--amber); }
.distribution-row.bad i { background: var(--red); }

.finance-summary { grid-template-columns: repeat(6, minmax(0, 1fr)); padding: 0 0 12px; }
.bar-chart { padding: 12px 18px 22px; }
.bar-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 120px; gap: 12px; align-items: center; font-size: 12px; }
.bar-row strong { text-align: right; }
.bar-track { height: 24px; }
.bar-track i.spend { background: #2563eb; }
.bar-track i.deposit { background: var(--amber); }
.bar-track i.profit { background: #0f9f6e; }
.bar-track i.revenue { background: var(--green); }

.report-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0 0 12px; }
.report-card { display: grid; gap: 9px; padding: 14px; }
.report-card > span { min-height: 36px; color: var(--muted); font-size: 12px; }
.report-snapshot { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.report-snapshot > div { border: 1px solid var(--line); border-radius: 7px; padding: 10px; }
.report-snapshot span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.report-decision { grid-column: span 3; }

.hidden {
  display: none !important;
}

.error-text,
.save-message.error {
  color: var(--red);
  font-weight: 800;
}

dialog {
  width: min(760px, calc(100vw - 24px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 22px 70px rgb(15 23 42 / 28%);
}

dialog::backdrop {
  background: rgb(15 23 42 / 42%);
}

.outcome-form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.icon-btn,
.dialog-actions button:first-child {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.icon-btn {
  width: 40px;
  padding: 0;
  font-size: 24px;
}

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

.save-message {
  min-height: 20px;
  margin: 0;
  color: var(--green);
  font-weight: 800;
}

.dialog-actions {
  justify-content: end;
}

.dialog-actions button {
  min-width: 120px;
}

.empty-table {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1380px) {
  .kpi-grid {
    grid-template-columns: repeat(6, minmax(130px, 1fr));
  }

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

  .panel.wide,
  .action-board,
  .insight-card {
    grid-column: span 2;
  }

  .filter-bar {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
  }
}

@media (max-width: 1020px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .topbar,
  .dashboard-grid,
  .action-board-grid,
  .rbac-layout,
  .quick-meta-grid,
  .quick-update-form,
  .inbox-layout,
  .filter-bar,
  .lead-detail,
  .form-grid,
    .login-form {
    grid-template-columns: 1fr;
  }

  .analysis-layout,
  .decision-matrix,
  .operation-summary,
  .finance-summary,
  .report-grid,
  .report-snapshot {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-decision { grid-column: span 2; }

  .panel.wide,
  .action-board,
  .insight-card,
  .quick-update-form .quick-wide,
  .quick-card-actions {
    grid-column: span 1;
  }

  .user-actions {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .quote {
    display: none;
  }
}

@media (max-width: 720px) {
  .main-panel {
    padding: 12px;
  }

  .operation-summary,
  .finance-summary,
  .report-grid,
  .report-snapshot,
  .decision-matrix,
  .analysis-layout {
    grid-template-columns: 1fr;
  }

  .report-decision { grid-column: span 1; }
  .bar-row { grid-template-columns: 86px minmax(0, 1fr); }
  .bar-row strong { grid-column: 2; text-align: left; }

  .sidebar {
    padding: 10px 12px;
  }

  .brand {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 9px;
    padding-bottom: 10px;
  }

  .brand-mark {
    width: 40px;
    height: 36px;
  }

  .brand-mark img {
    width: 38px;
    height: 34px;
  }

  .brand strong {
    font-size: 12px;
  }

  .brand span {
    font-size: 11px;
  }

  .module-nav {
    display: flex;
    overflow-x: auto;
    gap: 7px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .module-nav::-webkit-scrollbar {
    display: none;
  }

  .module-link {
    flex: 0 0 auto;
    width: auto;
    min-height: 34px;
    padding: 0 11px;
    white-space: nowrap;
  }

  .factory-status {
    display: none;
  }

  .topbar {
    gap: 8px;
    margin-bottom: 8px;
  }

  h1 {
    font-size: 22px;
  }

  .subcopy {
    font-size: 13px;
    line-height: 1.35;
  }

  .user-actions {
    gap: 8px;
  }

  .user-pill {
    min-width: 0;
  }

  body[data-role="sale"] h1 {
    font-size: 20px;
  }

  body[data-role="sale"] .topbar > div:first-child {
    display: none;
  }

  body[data-role="sale"] .topbar {
    display: block;
  }

  body[data-role="sale"] .subcopy,
  body[data-role="sale"] .kpi-grid {
    display: none;
  }

  body[data-role="sale"] .filter-period,
  body[data-role="sale"] .filter-page,
  body[data-role="sale"] .filter-product,
  body[data-role="sale"] .filter-status {
    display: none;
  }

  body[data-role="sale"] .filter-bar {
    grid-template-columns: 1fr;
    position: static;
    gap: 7px;
    margin-bottom: 10px;
    padding: 8px;
  }

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

  .quick-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-inline: 12px;
  }

  body[data-role="sale"] .quick-head {
    padding: 12px 12px 8px;
  }

  body[data-role="sale"] .quick-head p {
    display: none;
  }

  body[data-role="sale"] .quick-metrics {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 10px;
    scrollbar-width: none;
  }

  body[data-role="sale"] .quick-metrics::-webkit-scrollbar,
  body[data-role="sale"] .quick-toolbar::-webkit-scrollbar {
    display: none;
  }

  body[data-role="sale"] .quick-metric {
    flex: 0 0 120px;
    padding: 8px 9px;
  }

  body[data-role="sale"] .quick-metric strong {
    font-size: 20px;
  }

  body[data-role="sale"] .quick-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: none;
  }

  body[data-role="sale"] .quick-filter {
    flex: 0 0 auto;
  }

  .quick-toolbar,
  .quick-lead-list {
    padding-inline: 12px;
  }

  .sync-health-grid {
    grid-template-columns: 1fr;
  }

  .quick-card-head,
  .quick-card-actions {
    display: grid;
    justify-content: stretch;
  }

  .quick-card-actions button {
    width: 100%;
  }

  .quick-save-message {
    min-height: 18px;
    margin-right: 0;
  }

  .module-nav {
    grid-template-columns: 1fr;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

/* XLINK visual system. Business selectors and interaction states remain unchanged. */
:root {
  color-scheme: dark;
  --bg: #050a07;
  --panel: rgb(255 255 255 / 7%);
  --panel-soft: rgb(255 255 255 / 4%);
  --ink: #f1f4f2;
  --muted: #98a29c;
  --line: rgb(255 255 255 / 14%);
  --nav: #07100a;
  --nav-2: #0c1d12;
  --brand: #57bf39;
  --blue: #76d758;
  --cyan: #83e56a;
  --green: #57bf39;
  --amber: #f3ce54;
  --red: #ff7262;
  --purple: #a6d686;
  --shadow: inset 0 1px 0 rgb(255 255 255 / 18%), 0 0 0 1px rgb(255 255 255 / 4%), 0 30px 80px rgb(0 0 0 / 55%);
  font-family: Inter, Arial, Helvetica, sans-serif;
}

html { background: var(--bg); }

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 18%, rgb(71 181 43 / 18%), transparent 30%),
    radial-gradient(circle at 83% 42%, rgb(45 125 41 / 12%), transparent 32%),
    radial-gradient(circle at 48% 90%, rgb(87 191 57 / 10%), transparent 38%),
    #050a07;
  color: var(--ink);
}

body::before,
body::after {
  position: fixed;
  z-index: -1;
  width: 44vw;
  height: 44vw;
  border-radius: 50%;
  background: rgb(64 170 40 / 12%);
  filter: blur(110px);
  content: "";
  pointer-events: none;
  animation: xlink-drift 16s ease-in-out infinite alternate;
}

body::before { top: -20vw; left: 4vw; }
body::after { right: -20vw; bottom: -18vw; animation-delay: -8s; }

@keyframes xlink-drift {
  from { transform: translate3d(-3%, -2%, 0) scale(0.94); }
  to { transform: translate3d(7%, 8%, 0) scale(1.08); }
}

.app-shell { display: block; min-height: 100vh; padding: 72px 16px 132px; }

.sidebar {
  position: fixed;
  z-index: 40;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  width: 100%;
  height: 68px;
  overflow: visible;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgb(255 255 255 / 7%);
  background: rgb(5 10 7 / 78%);
  padding: 0 20px;
  backdrop-filter: none;
}

.brand { display: flex; min-width: max-content; grid-template-columns: none; gap: 10px; padding: 0; }
.brand-mark { width: 38px; height: 38px; border: 1px solid rgb(255 255 255 / 20%); border-radius: 12px; background: #fff; box-shadow: 0 10px 30px rgb(0 0 0 / 35%); }
.brand-mark img { width: 36px; height: 36px; }
.brand strong { color: #fff; font-family: "Cuaniex", Inter, sans-serif; font-size: 13px; }
.brand span { color: #7cc768; font-size: 10px; letter-spacing: 0; }

.factory-status { display: flex; margin: 0; gap: 14px; border: 0; padding: 0; }
.factory-status p { display: none; }
.factory-status span { margin: 0; color: #aeb8b1; font-size: 11px; }

.module-nav {
  position: fixed;
  z-index: 60;
  right: 50%;
  bottom: 16px;
  display: flex;
  width: min(960px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  overflow-x: auto;
  gap: 4px;
  border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 9999px;
  background: rgb(20 27 22 / 86%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 16%), 0 24px 80px rgb(0 0 0 / 62%);
  padding: 7px;
  scrollbar-width: none;
  transform: translateX(50%);
  backdrop-filter: blur(24px) saturate(140%);
}

.module-nav::-webkit-scrollbar { display: none; }

.module-link {
  flex: 0 0 auto;
  width: auto;
  min-height: 42px;
  justify-content: center;
  border: 0;
  border-radius: 9999px;
  color: #a6afa9;
  padding: 0 17px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}

.module-link:hover { background: rgb(255 255 255 / 8%); color: #fff; transform: translateY(-1px); }
.module-link.active { background: #57bf39; color: #071006; box-shadow: 0 8px 28px rgb(87 191 57 / 30%); }

.main-panel { width: 100%; max-width: 1242px; margin: 0 auto; padding: 0; }

.topbar { min-height: 0; align-items: end; gap: 24px; border: 0; background: transparent; padding: 18px 2px 16px; }

.eyebrow,
.panel-head p,
.subcopy,
.quote,
label,
th { letter-spacing: 0; }

.eyebrow { color: #71cf55; font-size: 11px; text-transform: uppercase; }

h1,
h2,
.kpi-card strong,
.metric-block strong,
.health-card strong,
.quick-metric strong { font-family: "Cuaniex", Inter, sans-serif; }

h1 { color: #fff; font-size: clamp(28px, 3.2vw, 46px); line-height: 1.04; letter-spacing: 0; }
h2 { color: #f4f7f5; font-size: 18px; letter-spacing: 0; }
.subcopy,
.panel-head p { color: #8f9a93; }
.user-actions { gap: 8px; }
.quote { display: none; }

.user-pill,
.chip,
.alert-pill,
.status-chip,
.action-chip { border: 1px solid rgb(255 255 255 / 12%); border-radius: 9999px; background: rgb(255 255 255 / 6%); color: #edf3ef; box-shadow: inset 0 1px 0 rgb(255 255 255 / 8%); }
.user-pill small { color: #7bc966; }

button { border: 0; border-radius: 9999px; background: #57bf39; color: #061005; letter-spacing: 0; transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease; }
button:hover { background: #71d34f; box-shadow: 0 10px 30px rgb(87 191 57 / 24%); transform: translateY(-1px); }
button.ghost,
.quick-filter { border: 1px solid rgb(255 255 255 / 13%); background: rgb(255 255 255 / 6%); color: #e4eae6; }
button.ghost:hover,
.quick-filter:hover,
.quick-filter.active { border-color: rgb(108 210 78 / 55%); background: rgb(87 191 57 / 18%); color: #91e775; }

.login-panel,
.filter-bar,
.panel,
.kpi-card,
.health-card,
.quick-lead-card,
.profile-preview,
.user-form,
.user-table-card,
.module-summary,
dialog { border: 1px solid rgb(255 255 255 / 14%); border-radius: 28px; background: rgb(255 255 255 / 7%); color: var(--ink); box-shadow: var(--shadow); backdrop-filter: blur(20px) saturate(125%); }

.login-panel { width: min(720px, 100%); min-height: 290px; margin: 10vh auto 0; align-content: center; padding: 36px; }
.login-panel h2 { margin-bottom: 8px; font-size: 30px; }
.login-panel p { color: #9ca69f; }

.filter-bar { position: sticky; z-index: 30; top: 78px; border-radius: 22px; background: rgb(13 20 15 / 84%); padding: 14px; backdrop-filter: blur(22px) saturate(140%); }

input,
select,
textarea { border: 1px solid rgb(255 255 255 / 13%); border-radius: 13px; background: rgb(5 10 7 / 72%); color: #f2f5f3; }
input:focus,
select:focus,
textarea:focus { border-color: #57bf39; box-shadow: 0 0 0 3px rgb(87 191 57 / 16%); }
input::placeholder,
textarea::placeholder { color: #657069; }

.sync-health-grid,
.kpi-grid { gap: 12px; }
.sync-health-grid { margin-top: 14px; }
.kpi-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.kpi-card,
.health-card { min-height: 138px; border-radius: 24px; background: radial-gradient(circle at 100% 0%, rgb(87 191 57 / 13%), transparent 44%), rgb(255 255 255 / 6%); }
.kpi-card { display: flex; min-height: 116px; flex-direction: column; }
.health-card { min-height: 118px; }
.kpi-card small { display: none; }
.kpi-card::before,
.kpi-card.blue::before,
.kpi-card.purple::before,
.kpi-card.green::before { background: #57bf39; }
.kpi-card strong { color: #f8fbf9; font-size: clamp(23px, 2vw, 34px); }
.kpi-card.green strong,
.kpi-card.blue strong { color: #7cda60; }
.kpi-card span,
.kpi-card small,
.health-card p,
.health-card small { color: #98a29c; }

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

.panel { grid-column: span 4; border-radius: 28px; background: radial-gradient(circle at 80% 15%, rgb(87 191 57 / 8%), transparent 45%), rgb(255 255 255 / 7%); padding: 22px; }
.panel.wide { grid-column: span 6; }
.panel.full { grid-column: 1 / -1; }
.action-board { grid-column: span 6; }
.panel:hover,
.kpi-card:hover,
.health-card:hover { border-color: rgb(132 221 105 / 25%); box-shadow: inset 0 1px 0 rgb(255 255 255 / 21%), 0 35px 90px rgb(0 0 0 / 58%); }

table { color: #e8edea; }
th { color: #7f8b84; font-size: 10px; text-transform: uppercase; }
td { border-color: rgb(255 255 255 / 8%); }
tbody tr:hover { background: rgb(87 191 57 / 7%); }

.line-chart,
.module-summary,
.quick-lead-card,
.conversation-item,
.profile-preview,
.quality-card,
.target-row,
.alert-item,
.priority-item,
.action-summary article { border-color: rgb(255 255 255 / 10%); background: rgb(0 0 0 / 18%); color: #e5ebe7; }
.chart-grid { stroke: rgb(255 255 255 / 10%); }
.chart-spend { stroke: #71d34f; }
.chart-revenue { stroke: #d1ee75; }
.funnel-step,
.progress-track { background: rgb(255 255 255 / 8%); }
.funnel-step:nth-child(1),
.funnel-step:nth-child(2),
.funnel-step:nth-child(3),
.funnel-step:nth-child(4),
.funnel-step:nth-child(5) { background: linear-gradient(90deg, #2d7628, #69c84c); }

dialog::backdrop { background: rgb(2 6 3 / 76%); backdrop-filter: blur(10px); }
.hidden { display: none !important; }

@media (max-width: 1100px) {
  .factory-status { display: none; }
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .panel,
  .panel.wide,
  .action-board { grid-column: span 6; }
}

@media (max-width: 760px) {
  .app-shell { padding: 62px 10px 112px; }
  .sidebar { height: 58px; padding: 0 12px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-mark img { width: 32px; height: 32px; }
  .brand strong { font-size: 11px; }
  .brand span { font-size: 9px; }
  .topbar { display: block; padding: 14px 2px; }
  .topbar h1 { max-width: 11ch; font-size: 30px; }
  .subcopy { max-width: 42ch; font-size: 12px; }
  .user-actions { margin-top: 12px; justify-content: space-between; }
  .filter-bar { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); border-radius: 20px; }
  .filter-search,
  #refreshBtn { grid-column: 1 / -1; }
  .sync-health-grid,
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-card,
  .health-card { min-height: 128px; }
  .dashboard-grid { display: block; }
  .panel { margin-bottom: 12px; padding: 18px; }
  .login-panel { min-height: 0; margin-top: 5vh; border-radius: 24px; padding: 24px; }
  .login-panel h2 { font-size: 24px; }
  .login-form { grid-template-columns: 1fr; }
  .module-nav { bottom: 10px; width: calc(100vw - 20px); max-width: calc(100vw - 20px); border-radius: 24px; padding: 6px; }
  .module-link { min-height: 40px; padding: 0 13px; font-size: 10px; }
}

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

/* High-contrast data tables: white copy and framed rows on the dark canvas. */
.table-wrap table {
  border-collapse: separate;
  border-spacing: 0 8px;
}

.table-wrap th {
  border-bottom: 0;
  background: #f4f7f5;
  color: #506057;
}

.table-wrap th:first-child { border-radius: 10px 0 0 10px; }
.table-wrap th:last-child { border-radius: 0 10px 10px 0; }

.table-wrap tbody td {
  border-top: 1px solid rgb(255 255 255 / 13%);
  border-bottom: 1px solid rgb(255 255 255 / 13%);
  background: rgb(255 255 255 / 6%);
  color: #f6f8f7;
  line-height: 1.45;
}

.table-wrap tbody td:first-child {
  border-left: 1px solid rgb(255 255 255 / 13%);
  border-radius: 14px 0 0 14px;
}

.table-wrap tbody td:last-child {
  border-right: 1px solid rgb(255 255 255 / 13%);
  border-radius: 0 14px 14px 0;
}

.table-wrap tbody tr:hover td {
  border-color: rgb(125 218 96 / 34%);
  background: rgb(87 191 57 / 11%);
}

.table-wrap .name,
.table-wrap .source-page,
.table-wrap .number-cell,
.table-wrap td:nth-child(3),
.table-wrap td:nth-child(7) {
  color: #ffffff;
}

.table-wrap .meta,
.table-wrap .customer-id {
  color: #b7c1ba;
}

#leadRows td:nth-child(2) > div {
  min-width: 150px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 10px;
  background: rgb(0 0 0 / 20%);
  padding: 8px 10px;
}

#leadRows td:nth-child(3) {
  font-weight: 700;
}

#leadRows td:nth-child(7) {
  min-width: 220px;
}

/* Crisp reading pass: stronger surfaces, brighter copy and decisive transitions. */
html,
body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
  font-synthesis: none;
}

body {
  background:
    radial-gradient(circle at 16% 18%, rgb(55 151 35 / 14%), transparent 25%),
    radial-gradient(circle at 83% 42%, rgb(34 105 31 / 10%), transparent 28%),
    #040806;
}

body::before,
body::after {
  opacity: 0.55;
  filter: blur(72px);
}

.topbar h1,
.login-panel h2,
.panel h2,
.kpi-card strong,
.health-card strong {
  color: #ffffff;
  text-shadow: 0 1px 0 rgb(0 0 0 / 75%);
}

.subcopy,
.panel-head p,
.login-panel p,
.health-card p,
.health-card small,
.kpi-card small {
  color: #c2cbc5;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.55;
}

.eyebrow,
label,
.kpi-card span,
.health-card span {
  font-weight: 800;
}

.module-link {
  color: #d4dbd6;
  font-size: 12px;
  font-weight: 800;
}

.sidebar,
.module-nav,
.filter-bar {
  background: rgb(8 14 10 / 96%);
}

.login-panel,
.panel,
.kpi-card,
.health-card,
.quick-lead-card,
.profile-preview,
.user-form,
.user-table-card,
.module-summary,
dialog {
  border-color: rgb(255 255 255 / 21%);
  background: rgb(20 29 23 / 94%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 22%), 0 24px 60px rgb(0 0 0 / 68%);
  backdrop-filter: none;
}

.filter-bar {
  border-color: rgb(255 255 255 / 19%);
  box-shadow: 0 18px 50px rgb(0 0 0 / 48%);
  backdrop-filter: none;
}

input,
select,
textarea {
  border-color: rgb(255 255 255 / 22%);
  background: #07100a;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
}

input::placeholder,
textarea::placeholder {
  color: #aeb8b1;
  opacity: 1;
}

.user-pill,
.chip,
.alert-pill,
.status-chip,
.action-chip {
  border-color: rgb(255 255 255 / 20%);
  background: #111b14;
  color: #ffffff;
}

.table-wrap tbody td {
  background: #131e16;
  color: #ffffff;
  font-size: 13px;
  font-weight: 550;
}

.table-wrap .meta,
.table-wrap .customer-id {
  color: #c8d0cb;
  font-size: 12px;
}

.view-panel.active {
  transform-origin: 50% 24px;
  animation: view-impact 440ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.view-panel.active .panel,
.view-panel.active .quick-lead-card {
  animation: surface-rise 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.view-panel.active .panel:nth-child(2) { animation-delay: 55ms; }
.view-panel.active .panel:nth-child(3) { animation-delay: 95ms; }
.view-panel.active .panel:nth-child(4) { animation-delay: 135ms; }

@keyframes view-impact {
  0% { opacity: 0; transform: translateY(22px) scale(0.975); }
  65% { opacity: 1; transform: translateY(-3px) scale(1.004); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes surface-rise {
  0% { opacity: 0; transform: translateY(18px); border-color: rgb(87 191 57 / 65%); }
  100% { opacity: 1; transform: translateY(0); border-color: rgb(255 255 255 / 21%); }
}

.module-link.active {
  box-shadow: 0 0 0 1px rgb(166 244 139 / 50%), 0 10px 36px rgb(87 191 57 / 48%);
}

.row-action,
button.primary,
#refreshBtn,
#loginForm button {
  box-shadow: 0 8px 24px rgb(87 191 57 / 30%);
}

#refreshBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 156px;
  white-space: nowrap;
}

#refreshBtn.is-loading {
  background: #2d7628;
  border-color: #78d759;
  box-shadow: 0 0 0 1px rgb(166 244 139 / 35%), 0 8px 28px rgb(87 191 57 / 42%);
}

.refresh-spinner {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  border: 2px solid rgb(255 255 255 / 38%);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: refresh-spin 720ms linear infinite;
}

.refresh-spinner[hidden] {
  display: none;
}

.refresh-toast {
  position: fixed;
  z-index: 1200;
  top: 22px;
  left: 50%;
  display: flex;
  align-items: center;
  min-height: 46px;
  max-width: min(520px, calc(100vw - 32px));
  border: 1px solid rgb(137 227 104 / 65%);
  border-radius: 10px;
  background: #15321d;
  color: #ffffff;
  padding: 11px 18px 11px 44px;
  box-shadow: 0 18px 50px rgb(0 0 0 / 55%);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -18px);
  transition: opacity 180ms ease, transform 220ms ease;
}

.refresh-toast::before {
  position: absolute;
  left: 17px;
  content: "✓";
  color: #8be06d;
  font-size: 20px;
  font-weight: 900;
}

.refresh-toast[data-tone="error"] {
  border-color: rgb(255 108 108 / 72%);
  background: #3a1717;
}

.refresh-toast[data-tone="error"]::before {
  content: "!";
  color: #ff8f8f;
}

.refresh-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

.pipeline-column,
.operation-stat,
.finance-card,
.decision-group,
.report-snapshot > div {
  border-color: rgb(255 255 255 / 20%);
  background: #111b14;
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 9%);
}

.kpi-card.blue,
.kpi-card.amber,
.kpi-card.green,
.kpi-card.red,
.kpi-card.purple {
  border-color: rgb(255 255 255 / 21%);
  background: radial-gradient(circle at 100% 0%, rgb(87 191 57 / 15%), transparent 44%), #141d17;
}

.kpi-card.blue strong,
.kpi-card.amber strong,
.kpi-card.green strong,
.kpi-card.red strong,
.kpi-card.purple strong {
  color: #ffffff;
  text-shadow: 0 1px 0 #000000;
}

.kpi-card.blue span,
.kpi-card.blue small,
.kpi-card.amber span,
.kpi-card.amber small,
.kpi-card.green span,
.kpi-card.green small,
.kpi-card.red span,
.kpi-card.red small,
.kpi-card.purple span,
.kpi-card.purple small {
  color: #c5cec8;
}

.pipeline-lead,
.decision-ad,
.report-card {
  border-color: rgb(255 255 255 / 16%);
  background: #17231a;
  color: #ffffff;
}

.pipeline-lead:hover {
  border-color: #70d153;
  background: #1d3020;
}

.pipeline-lead span,
.pipeline-lead small,
.decision-ad span,
.decision-ad small,
.decision-group header small,
.finance-card span,
.finance-card small,
.report-card > span,
.report-snapshot span {
  color: #c5cec8;
}

.operation-stat strong,
.finance-card strong,
.decision-ad strong,
.report-snapshot strong,
.bar-row,
.distribution-row {
  color: #ffffff;
}

.distribution-track,
.bar-track {
  background: #253129;
}

/* Final contrast audit: every legacy light surface gets an explicit text pair. */
.quick-metric,
.quick-meta-grid > div,
.priority-item,
.page-options label,
.conversation-list,
.chat-panel,
.profile-panel,
.conversation-item,
.profile-preview dl > div,
.lead-detail > div,
.module-card,
.quality-card,
.alert-item,
.action-item,
.empty-state,
.target-row {
  border-color: rgb(255 255 255 / 18%);
  background: #17231a;
  color: #ffffff;
}

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

.meta-toolbar {
  justify-content: space-between;
  gap: 16px;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 16px;
  background: #101a13;
  padding: 14px 16px;
}

.meta-toolbar strong,
.meta-page-head strong {
  display: block;
  color: #ffffff;
}

.meta-toolbar small,
.meta-page-head small {
  display: block;
  margin-top: 4px;
  color: #aeb9b1;
}

.meta-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

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

.meta-page-card {
  border: 1px solid rgb(255 255 255 / 15%);
  border-left: 4px solid #6f7b73;
  border-radius: 14px;
  background: #152019;
  padding: 14px;
}

.meta-page-card.ok { border-left-color: #57bf39; }
.meta-page-card.warn { border-left-color: #e9bd35; }
.meta-page-card.bad { border-left-color: #e05c5c; }

.meta-page-head {
  justify-content: space-between;
  gap: 10px;
}

.meta-health-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
}

.meta-health-list > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  border-top: 1px solid rgb(255 255 255 / 8%);
  padding-top: 8px;
}

.meta-health-list dt { color: #96a199; }
.meta-health-list dd { margin: 0; color: #ffffff; overflow-wrap: anywhere; }
.meta-error { margin: 12px 0 0; color: #ff9d9d; }
.meta-message { margin: 0; border-left: 4px solid #57bf39; border-radius: 8px; background: #122719; color: #dff8d7; padding: 10px 12px; }
.audience-sync-summary { margin-top: 16px; }

@media (max-width: 980px) {
  .meta-page-grid { grid-template-columns: 1fr; }
  .meta-toolbar { align-items: flex-start; flex-direction: column; }
  .meta-actions { justify-content: flex-start; }
}

.quick-metric strong {
  color: #7ce05c;
  text-shadow: 0 1px 0 #000000;
}

.quick-metric span,
.quick-meta-grid strong,
.quick-update-form label,
.user-form label,
.page-picker,
.profile-preview dt,
.lead-detail dt {
  color: #c5cec8;
}

.quick-meta-grid span,
.profile-preview dd,
.lead-detail dd,
.profile-name,
.conversation-name,
.action-item strong,
.priority-item strong,
.empty-state strong,
.quality-card strong,
.module-card,
.target-row strong {
  color: #ffffff;
}

.quick-next-action {
  border-color: #e9bd35;
  background: #2b2512;
  color: #ffe69a;
}

.quick-suggested-reply {
  border-color: #4d8fe8;
  border-left-color: #68db4c;
  background: #eef5ff;
}

.quick-suggested-reply strong {
  color: #187a2b;
}

.quick-suggested-reply p {
  color: #173a78;
}

.quick-suggested-reply button.ghost {
  border-color: #2f6aba;
  background: #ffffff;
  color: #173a78;
  box-shadow: none;
}

.quick-suggested-reply button.ghost:hover {
  background: #dbeafe;
  color: #102e60;
}

.customer-tag.intake {
  background: #dfe7e2;
  color: #293a30;
}

.customer-tag.source {
  background: #d9ecff;
  color: #174b73;
}

.customer-tag.missing {
  background: #ffead8;
  color: #8b2e0b;
}

.customer-tag.more {
  border-color: #68776e;
  background: #253129;
  color: #ffffff;
}

.badge,
.status-chip {
  border: 1px solid rgb(255 255 255 / 18%);
}

.badge.ok,
.status-chip.ok {
  background: #e5f8e7;
  color: #187a2b;
}

.badge.warn,
.status-chip.warn {
  background: #fff0d8;
  color: #8d350d;
}

.badge.bad,
.status-chip.bad {
  background: #ffe4e1;
  color: #a4261d;
}

.ai-insight p,
.target-row > div:first-child,
.funnel-row,
.legend-row,
.completeness-row strong,
.page-picker strong {
  color: #ffffff;
}

.action-item span,
.priority-item span,
.priority-item small,
.completeness-row span,
.empty-state span,
.quality-card small,
.target-row span,
.conversation-item > span:not(.conversation-name) {
  color: #c5cec8;
}

.target-track {
  background: #2a372e;
}

.donut::after {
  background: #17231a;
}

.donut span,
.donut strong {
  color: #ffffff;
}

.ghost-row,
.icon-btn,
.dialog-actions button:first-child {
  border-color: rgb(255 255 255 / 22%);
  background: #17231a;
  color: #ffffff;
}

.ghost-row:hover,
.icon-btn:hover,
.dialog-actions button:first-child:hover {
  border-color: #70d153;
  background: #213326;
  color: #a4ee8d;
}

select option {
  background: #07100a;
  color: #ffffff;
}

/* Readability pass for labels and notices inherited from the light theme. */
.filter-bar label,
.outcome-form label,
.sync-alert-card li {
  color: #e5ebe7;
}

.filter-bar label,
.outcome-form label {
  text-shadow: 0 1px 0 rgb(0 0 0 / 55%);
}

@media (max-width: 760px) {
  .module-link { font-size: 11px; }
  .subcopy,
  .panel-head p,
  .login-panel p { font-size: 13px; }
}

/* Balanced responsive dashboard: fill the available canvas without orphan gaps. */
.main-panel {
  max-width: 1480px;
}

.sync-health-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: stretch;
}

.sync-health-grid > .health-card:not(.sync-alert-card),
.kpi-grid > .kpi-card {
  height: 100%;
}

.kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  align-items: stretch;
}

.dashboard-grid > .panel,
.dashboard-grid > .panel.wide,
.dashboard-grid > .action-board,
.dashboard-grid > .insight-card,
.dashboard-grid > .targets {
  grid-column: span 6;
  height: 100%;
}

@media (max-width: 1100px) {
  .sync-health-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  .main-panel {
    max-width: none;
  }

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

  .sync-alert-card {
    grid-column: 1 / -1;
  }

  .sync-alert-chart {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-grid > .panel,
  .dashboard-grid > .panel.wide,
  .dashboard-grid > .action-board,
  .dashboard-grid > .insight-card,
  .dashboard-grid > .targets {
    grid-column: 1;
  }
}

/* Closed-loop Ads -> Messenger -> Sale reporting. */
.closed-loop-panel {
  grid-column: 1 / -1;
  overflow: hidden;
}

.closed-loop-head {
  align-items: flex-end;
  gap: 18px;
}

.closed-loop-head .eyebrow {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.closed-loop-headline {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 8px;
  min-width: min(100%, 420px);
}

.closed-loop-headline > div,
.closed-funnel-step,
.closed-quality-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.closed-loop-headline > div {
  padding: 10px 12px;
}

.closed-loop-headline span,
.closed-funnel-step span,
.closed-quality-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.closed-loop-headline strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 16px;
}

.closed-loop-funnel {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 0 18px 14px;
}

.closed-funnel-step {
  min-width: 0;
  padding: 11px 12px;
  border-top: 3px solid var(--cyan);
}

.closed-funnel-step strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 20px;
}

.closed-funnel-step small,
.closed-quality-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.closed-loop-quality {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 0 18px 18px;
}

.closed-quality-card {
  padding: 11px 12px;
}

.closed-quality-card > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.closed-quality-card strong {
  color: var(--amber);
  font-size: 14px;
}

.closed-quality-card.ok strong {
  color: var(--green);
}

.closed-quality-card .target-track {
  margin-top: 9px;
}

.closed-quality-card.warn .target-track i {
  background: var(--amber);
}

.closed-loop-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.closed-loop-table-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.closed-loop-table-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.closed-loop-table td {
  vertical-align: top;
}

.closed-loop-table td:first-child {
  min-width: 230px;
}

.closed-loop-table td:last-child {
  min-width: 260px;
}

.closed-action > div,
.closed-action > small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.chip.ok {
  border-color: var(--green);
  color: var(--green);
}

.chip.warn {
  border-color: var(--amber);
  color: var(--amber);
}

@media (max-width: 1100px) {
  .closed-loop-head {
    align-items: stretch;
  }

  .closed-loop-headline,
  .closed-loop-quality {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .closed-loop-funnel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .closed-loop-head {
    flex-direction: column;
    align-items: stretch;
  }

  .closed-loop-head > div,
  .closed-loop-headline {
    width: 100%;
    min-width: 0;
  }

  .closed-loop-headline {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .closed-loop-funnel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-inline: 14px;
  }

  .closed-loop-quality {
    grid-template-columns: 1fr;
    padding-inline: 14px;
  }

  .closed-loop-table-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
