*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --ink: #172033;
  --muted: #64748b;
  --line: #dbe3ef;
  --surface: #f7f9fc;
  --panel: #ffffff;
  --primary: #2563eb;
  --primary-soft: #eef4ff;
  --green: #13845f;
  --green-soft: #ecfdf5;
  --amber: #b7791f;
  --amber-soft: #fff7ed;
  --red: #b42318;
  --red-soft: #fff1f1;
  --shadow: 0 18px 42px rgba(27, 39, 66, .08);
  --sidebar-w: 260px;
  --topbar-h: 76px;
}

html,
body {
  min-height: 100vh;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.topbar__left,
.topbar__right,
.page-header,
.panel__header,
.actions-cell,
.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__right {
  justify-content: flex-end;
}

.global-search {
  width: min(330px, 26vw);
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.global-search > i {
  color: var(--muted);
}

.global-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.global-search__results {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 60;
  width: min(380px, 90vw);
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.global-search__results a {
  display: grid;
  gap: 3px;
  padding: 10px;
  border-radius: 6px;
}

.global-search__results a:hover {
  background: var(--primary-soft);
}

.global-search__results small,
.global-search__empty {
  color: var(--muted);
  font-size: 12px;
}

.global-search__empty {
  display: block;
  padding: 10px;
}

.brand {
  font-size: 22px;
  font-weight: 850;
}

.brand strong,
.sidebar__brand strong {
  color: var(--primary);
}

.company-switcher {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.company-switcher select {
  min-width: 190px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
}

.topbar-alert,
.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.topbar-alert span {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  display: grid;
  place-items: center;
}

.topbar-user {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.topbar__menu {
  display: none;
}

.layout {
  width: min(1560px, 100%);
  margin: 0 auto;
  padding: 24px;
  flex: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 24px;
}

.sidebar {
  align-self: start;
  position: sticky;
  top: calc(var(--topbar-h) + 24px);
  min-height: calc(100vh - var(--topbar-h) - 70px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.sidebar__brand {
  display: grid;
  gap: 2px;
  padding: 8px 10px 18px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
  font-weight: 850;
}

.nav-list {
  display: grid;
  gap: 5px;
}

.nav-item {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #526070;
  font-size: 14px;
  font-weight: 700;
}

.nav-item i {
  color: var(--primary);
}

.nav-item:hover,
.nav-item.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.main {
  min-width: 0;
  display: grid;
  gap: 20px;
  align-content: start;
}

.page-header {
  justify-content: space-between;
}

.page-header h1,
.panel h2,
.modal h2 {
  margin: 0;
}

.page-header h1 {
  font-size: clamp(28px, 3.4vw, 42px);
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.panel,
.metric,
.kanban-column {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.kanban-column.is-drop-target {
  outline: 2px dashed var(--primary);
  outline-offset: -5px;
  background: var(--primary-soft);
}

.panel {
  padding: 20px;
  min-width: 0;
}

.panel__header {
  justify-content: space-between;
  margin-bottom: 14px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

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

.profile-card {
  min-height: 104px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

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

.profile-card strong {
  display: block;
  margin-top: 8px;
  font-size: 23px;
}

.profile-card .profile-card__date {
  font-size: 16px;
}

.metric {
  min-height: 108px;
  padding: 18px;
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.btn {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  white-space: nowrap;
}

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

.btn--danger {
  color: var(--red);
  border-color: #f4c4c0;
  background: var(--red-soft);
}

.btn--sm {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.field {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.field--color {
  padding: 5px;
}

.color-swatch {
  width: 10px;
  height: 10px;
  display: inline-block;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--swatch);
}

.code-field {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.flow-steps {
  display: grid;
  gap: 0;
  padding: 0;
  margin: 0;
  list-style: none;
}

.flow-steps li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.flow-steps li > div:nth-child(2) {
  display: grid;
  gap: 3px;
}

.flow-steps small {
  color: var(--muted);
}

.flow-steps__order {
  min-width: 34px;
  min-height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 850;
}

.field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}

textarea.field {
  resize: vertical;
}

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

.form-divider {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.form-grid label,
.login-form label {
  display: grid;
  gap: 7px;
}

.form-grid label span,
.login-form label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

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

.check-row {
  min-height: 42px;
  display: flex !important;
  align-items: center;
  gap: 10px;
}

.table-wrap {
  overflow-x: auto;
}

.table-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
}

.table-filter .field {
  width: min(360px, 100%);
  min-height: 34px;
}

.table-link {
  color: var(--primary);
  font-weight: 800;
}

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

.data-table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
}

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

.data-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.data-table small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.actions-cell {
  justify-content: flex-end;
  flex-wrap: wrap;
}

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

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

.notice--success {
  color: var(--green);
  background: var(--green-soft);
}

.notice--error {
  color: var(--red);
  background: var(--red-soft);
}

.badge {
  min-height: 27px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 850;
}

.badge--green {
  color: var(--green);
  background: var(--green-soft);
}

.badge--amber {
  color: var(--amber);
  background: var(--amber-soft);
}

.badge--red {
  color: var(--red);
  background: var(--red-soft);
}

.score-pill {
  min-width: 38px;
  min-height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 900;
}

.score-pill--high {
  color: var(--green);
  background: var(--green-soft);
}

.score-pill--mid {
  color: var(--amber);
  background: var(--amber-soft);
}

.score-pill--low {
  color: var(--red);
  background: var(--red-soft);
}

.batch-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}

.batch-bar .field {
  width: auto;
  min-width: 210px;
}

.segmented-control {
  display: flex;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segmented-control a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.segmented-control a:last-child {
  border-right: 0;
}

.segmented-control a.is-active {
  color: var(--primary);
  background: var(--primary-soft);
}

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

.recommendation-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.recommendation-card__header,
.recommendation-meta,
.recommendation-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.recommendation-card__header {
  justify-content: space-between;
}

.recommendation-card h2 {
  margin: 3px 0 0;
  font-size: 19px;
}

.recommendation-card > p,
.recommendation-meta {
  color: var(--muted);
  font-size: 13px;
}

.recommendation-meta {
  flex-wrap: wrap;
}

.recommendation-actions {
  margin-top: 14px;
}

.recommendation-actions .field {
  flex: 1;
}

.message-preview {
  margin-top: 14px;
  padding: 12px;
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
}

.message-preview p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.token-reveal {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid #86efac;
  border-radius: 8px;
  background: var(--green-soft);
}

.token-reveal code,
.data-table code {
  overflow-wrap: anywhere;
  white-space: normal;
}

.compact-list {
  display: grid;
  gap: 0;
  margin-top: 18px;
}

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

.compact-list span,
.compact-list small {
  display: grid;
  gap: 2px;
}

.compact-list small {
  color: var(--muted);
}

.operational-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.operational-strip > div {
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 12px;
  background: #fff;
}

.operational-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.operational-strip strong {
  font-size: 21px;
}

.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.kanban-column {
  min-height: 340px;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.kanban-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  display: grid;
  gap: 7px;
}

.kanban-card[draggable="true"] {
  cursor: grab;
}

.kanban-card.is-dragging {
  opacity: .45;
}

.kanban-card strong {
  font-size: 15px;
}

.kanban-card span {
  color: var(--muted);
  font-size: 13px;
}

.login-body {
  background: linear-gradient(135deg, #eef4ff, #ffffff);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-logo {
  margin: 0 0 22px;
  font-size: 30px;
  font-weight: 900;
}

.login-logo strong {
  color: var(--primary);
}

.login-form {
  display: grid;
  gap: 14px;
}

.footer {
  width: min(1560px, 100%);
  margin: 0 auto;
  padding: 18px 24px 28px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

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

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

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

.info-list div {
  min-width: 0;
}

.info-list .span-all {
  grid-column: span 2;
}

.info-list dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.info-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.timeline {
  display: grid;
  gap: 0;
}

.timeline__item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.timeline__item:last-child {
  border-bottom: 0;
}

.timeline__dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--primary);
}

.timeline__item div {
  display: grid;
  gap: 3px;
}

.timeline__item small,
.timeline__item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.audit-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.audit-list span {
  color: var(--muted);
  font-size: 13px;
}

.priority-list,
.source-list {
  display: grid;
  gap: 8px;
}

.priority-list__item,
.source-list > div {
  display: grid;
  align-items: center;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.priority-list__item {
  grid-template-columns: auto minmax(0, 1fr);
}

.priority-list__item small {
  grid-column: 2;
  color: var(--muted);
}

.priority-list__date {
  grid-row: span 2;
  color: var(--primary);
  font-size: 12px;
  font-weight: 850;
}

.priority-list__date.is-late {
  color: var(--red);
}

.source-list > div {
  grid-template-columns: minmax(0, 1fr) auto;
}

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

.commercial-flow-header p {
  margin: 6px 0 0;
  color: var(--muted);
  max-width: 760px;
}

.commercial-flow-form {
  display: grid;
  gap: 16px;
}

.commercial-flow-meta {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.commercial-flow-meta__main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, .7fr) minmax(240px, 1.4fr);
  gap: 12px;
}

.commercial-flow-meta label,
.commercial-flow-inspector label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.commercial-flow-meta .field,
.commercial-flow-inspector .field {
  width: 100%;
}

.commercial-flow-active {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.commercial-flow-active input {
  position: absolute;
  opacity: 0;
}

.commercial-flow-active span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

.commercial-flow-active input:checked + span {
  color: var(--green);
}

.commercial-flow-designer {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.commercial-flow-designer.is-fullscreen {
  position: fixed;
  inset: 12px;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.commercial-flow-fullscreen-open {
  overflow: hidden;
}

.commercial-flow-designer__topbar,
.commercial-flow-designer__footer {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  background: #fff;
}

.commercial-flow-designer__topbar {
  border-bottom: 1px solid var(--line);
}

.commercial-flow-designer__footer {
  border-top: 1px solid var(--line);
}

.commercial-flow-designer__title {
  display: grid;
  gap: 3px;
}

.commercial-flow-designer__title strong {
  font-size: 15px;
}

.commercial-flow-designer__title span,
.commercial-flow-inspector__empty span,
.commercial-flow-inspector__hint,
.commercial-flow-inspector__edge p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.commercial-flow-tools,
.commercial-flow-save-actions,
.commercial-flow-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.commercial-flow-tools .btn,
.commercial-flow-tools .icon-button {
  min-height: 34px;
}

.commercial-flow-tools .icon-button {
  width: 34px;
  height: 34px;
}

.commercial-flow-tools__divider {
  width: 1px;
  align-self: stretch;
  background: var(--line);
}

.commercial-flow-designer__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 304px;
  min-height: 570px;
}

.commercial-flow-designer.is-fullscreen .commercial-flow-designer__body {
  flex: 1;
  min-height: 0;
}

.commercial-flow-viewport {
  min-width: 0;
  overflow: auto;
  background-color: #f8fbff;
  background-image: linear-gradient(#dde7f3 1px, transparent 1px), linear-gradient(90deg, #dde7f3 1px, transparent 1px);
  background-size: 24px 24px;
}

.commercial-flow-stage-shell {
  position: relative;
  min-width: 100%;
  min-height: 100%;
}

.commercial-flow-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 3200px;
  height: 1800px;
  transform-origin: top left;
}

.commercial-flow-edges,
.commercial-flow-edge-labels,
.commercial-flow-cards {
  position: absolute;
  inset: 0;
  width: 3200px;
  height: 1800px;
}

.commercial-flow-edges {
  overflow: visible;
  z-index: 1;
}

.commercial-flow-edge {
  fill: none;
  stroke: #91a4b8;
  stroke-width: 3;
  cursor: pointer;
  pointer-events: stroke;
}

.commercial-flow-edge:hover,
.commercial-flow-edge.is-selected {
  stroke: var(--primary);
  stroke-width: 4;
}

.commercial-flow-edges marker path {
  fill: #91a4b8;
}

.commercial-flow-edge-labels {
  z-index: 2;
  pointer-events: none;
}

.commercial-flow-edge-label {
  position: absolute;
  transform: translate(-50%, -50%);
  max-width: 170px;
  overflow: hidden;
  border: 1px solid #b8c8d9;
  border-radius: 6px;
  padding: 4px 7px;
  background: #fff;
  color: #40536a;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: auto;
}

.commercial-flow-edge-label.is-selected {
  border-color: var(--primary);
  color: var(--primary);
}

.commercial-flow-cards {
  z-index: 3;
}

.commercial-flow-card {
  position: absolute;
  width: 236px;
  min-height: 118px;
  display: grid;
  align-content: start;
  gap: 6px;
  overflow: hidden;
  border: 1px solid #b9c8d9;
  border-radius: 8px;
  padding: 13px 14px 12px 42px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(37, 54, 81, .1);
  color: var(--ink);
  text-align: left;
  touch-action: none;
  user-select: none;
}

.commercial-flow-card:hover,
.commercial-flow-card.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15), 0 11px 22px rgba(37, 54, 81, .13);
}

.commercial-flow-card.is-connection-source {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(183, 121, 31, .16);
}

.commercial-flow-card--start {
  border-color: #4eaf86;
  background: #f4fffa;
}

.commercial-flow-card--decision {
  border-color: #dba45d;
  background: #fffaf2;
}

.commercial-flow-card--end {
  border-color: #d9928d;
  background: #fff7f6;
}

.commercial-flow-card__number {
  position: absolute;
  top: 13px;
  left: 13px;
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 850;
}

.commercial-flow-card--start .commercial-flow-card__number { background: var(--green); }
.commercial-flow-card--decision .commercial-flow-card__number { background: var(--amber); }
.commercial-flow-card--end .commercial-flow-card__number { background: var(--red); }

.commercial-flow-card__type {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.commercial-flow-card strong {
  overflow: hidden;
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commercial-flow-card small {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.commercial-flow-inspector {
  display: grid;
  align-content: start;
  gap: 14px;
  overflow-y: auto;
  padding: 16px;
  border-left: 1px solid var(--line);
  background: #fff;
}

.commercial-flow-inspector__empty {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 12px 2px;
}

.commercial-flow-inspector__empty i {
  color: var(--primary);
  font-size: 24px;
}

.commercial-flow-inspector__node,
.commercial-flow-inspector__edge {
  display: grid;
  gap: 12px;
}

.commercial-flow-inspector__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.commercial-flow-inspector__head div {
  display: grid;
  gap: 2px;
}

.commercial-flow-inspector__head span {
  color: var(--primary);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.commercial-flow-inspector__head strong {
  font-size: 14px;
}

.icon-button--danger {
  border-color: #f3c7c4;
  color: var(--red);
}

.commercial-flow-inspector__hint {
  margin: 0;
}

.commercial-flow-legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.commercial-flow-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.commercial-flow-legend__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.commercial-flow-legend__dot.is-start { background: var(--green); }
.commercial-flow-legend__dot.is-decision { background: var(--amber); }
.commercial-flow-legend__dot.is-end { background: var(--red); }

#commercialFlowStatus {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

#commercialFlowStatus.is-error {
  color: var(--red);
}

.commercial-flow-library-header p,
.commercial-flow-library__heading span,
.commercial-flow-create .panel__header span {
  margin: 6px 0 0;
  color: var(--muted);
}

.commercial-flow-library-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.commercial-flow-create .panel__header > div {
  display: grid;
  gap: 2px;
}

.commercial-flow-library {
  display: grid;
  gap: 14px;
}

.commercial-flow-library__heading {
  padding-bottom: 4px;
}

.commercial-flow-library__heading > div {
  display: grid;
  gap: 2px;
}

.commercial-flow-library__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.commercial-flow-library__item {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 15px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(27, 39, 66, .05);
}

.commercial-flow-library__item:hover {
  border-color: #b4c9e7;
  box-shadow: 0 14px 28px rgba(27, 39, 66, .09);
}

.commercial-flow-library__item-head,
.commercial-flow-library__metrics,
.commercial-flow-library__trigger {
  display: flex;
  align-items: center;
  gap: 8px;
}

.commercial-flow-library__item-head {
  justify-content: space-between;
}

.commercial-flow-library__state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 850;
}

.commercial-flow-library__state.is-active { color: var(--green); }
.commercial-flow-library__state.is-inactive { color: var(--amber); }

.commercial-flow-library__updated {
  color: var(--muted);
  font-size: 11px;
}

.commercial-flow-library__item-copy {
  min-height: 88px;
}

.commercial-flow-library__item-copy h3,
.commercial-flow-library__item-copy p {
  margin: 0;
}

.commercial-flow-library__item-copy h3 {
  overflow: hidden;
  font-size: 17px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commercial-flow-library__item-copy p {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.commercial-flow-library__trigger {
  min-height: 30px;
  overflow: hidden;
  color: #4d6077;
  font-size: 12px;
  font-weight: 800;
}

.commercial-flow-library__trigger i {
  color: var(--amber);
}

.commercial-flow-library__metrics {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.commercial-flow-library__metrics span {
  min-width: 0;
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
}

.commercial-flow-library__metrics strong {
  color: var(--ink);
  font-size: 16px;
}

.commercial-flow-library__item .btn {
  justify-content: center;
}

.commercial-flow-library__empty {
  min-height: 150px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  border: 1px dashed #b9c9da;
  border-radius: 8px;
  color: var(--muted);
}

.commercial-flow-library__empty i {
  color: var(--primary);
  font-size: 28px;
}

.commercial-flow-library__empty span {
  font-size: 13px;
}

@media (max-width: 1050px) {
  .topbar__menu {
    display: inline-flex;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .sidebar {
    position: fixed;
    inset: var(--topbar-h) auto 0 0;
    width: min(88vw, var(--sidebar-w));
    border-radius: 0;
    z-index: 50;
    transform: translateX(-105%);
    transition: transform .2s ease;
    overflow-y: auto;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .metric-grid,
  .form-grid,
  .profile-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .commercial-flow-meta__main {
    grid-template-columns: 1fr 1fr;
  }

  .commercial-flow-meta__objective {
    grid-column: span 2;
  }

  .commercial-flow-designer__body {
    grid-template-columns: minmax(0, 1fr);
  }

  .commercial-flow-inspector {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .commercial-flow-inspector__empty,
  .commercial-flow-inspector__node,
  .commercial-flow-inspector__edge {
    grid-column: span 2;
  }
}

@media (max-width: 700px) {
  .topbar {
    align-items: stretch;
    height: auto;
    flex-direction: column;
  }

  .topbar__right,
  .page-header,
  .panel__header,
  .actions-cell,
  .form-actions,
  .footer {
    align-items: stretch;
    flex-direction: column;
  }

  .table-filter {
    width: 100%;
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .table-filter .field {
    width: 100%;
  }

  .info-list {
    grid-template-columns: 1fr;
  }

  .info-list .span-all {
    grid-column: auto;
  }

  .recommendation-card__header,
  .recommendation-actions,
  .batch-bar {
    align-items: stretch;
    flex-direction: column;
  }

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

  .batch-bar .field {
    width: 100%;
  }

  .company-switcher select {
    min-width: 0;
  }

  .global-search {
    width: 100%;
  }

  .commercial-flow-meta,
  .commercial-flow-designer__topbar,
  .commercial-flow-designer__footer {
    align-items: stretch;
    flex-direction: column;
  }

  .commercial-flow-meta__main {
    grid-template-columns: 1fr;
  }

  .commercial-flow-meta__objective {
    grid-column: auto;
  }

  .commercial-flow-tools {
    width: 100%;
  }

  .commercial-flow-tools .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .commercial-flow-designer__body {
    min-height: 500px;
  }

  .commercial-flow-inspector {
    grid-template-columns: 1fr;
  }

  .commercial-flow-inspector__empty,
  .commercial-flow-inspector__node,
  .commercial-flow-inspector__edge {
    grid-column: auto;
  }

  .commercial-flow-library-stats {
    grid-template-columns: 1fr 1fr;
  }

  .btn,
  .actions-cell .btn,
  .actions-cell form,
  .actions-cell button {
    width: 100%;
  }
}
