
/* T2 Falcon Admin — Contracts & Cost Management */

/* Contracts page tree visibility — Falcon view shows the Template Management
   clients tree, Client view drops it and the main column takes the full width. */
.templates-page.cm-page.with-tree { grid-template-columns: var(--clients-w) minmax(0, 1fr); }
.templates-page.cm-page.no-tree   { grid-template-columns: minmax(0, 1fr); }

/* The contracts list reuses Hierarchy's .content-panel + .content-body +
   .node-header chrome as-is — no custom modifier classes needed. */

/* Use Hierarchy's .users-table inside the contracts list table.
   Row hover is explicitly suppressed per design request. */
.cm-users-table { width: 100%; }
.cm-users-table tbody tr { cursor: default; }
.cm-users-table tbody tr:hover { background: transparent !important; }
.cm-users-table tbody tr.selected { background: transparent !important; }

/* Details page — matches Hierarchy's structure exactly:
   `.tabs-bar` sits directly inside `.content-panel`, then `.content-body` holds
   the node-header row + tab content. Spacing inside the body uses the same
   gap rhythm as Hierarchy (between node-header and table-panel / info-panel). */
/* Details page — reuses Hierarchy's .tabs-bar / .content-body / .node-header
   chrome as-is. No custom body/header modifier classes. */
.cm-tabs-bar { gap: 28px; }
.cm-tab-body { padding: 0; }


/* === Contract Details / Rate Card / Addons tabs — reuse .apps-panel chrome === */

/* Control row above the Contract Details matrix (Currency / Application / CommChannel) */
.cm-details-control-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(220px, 2fr) minmax(180px, 1fr);
  gap: 28px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border-2);
  background: white;
}
.cm-details-control { display: flex; flex-direction: column; gap: 6px; }
.cm-details-control .lbl { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.cm-details-control .val { font-size: 13.5px; color: var(--text); }
.cm-details-control .val.strong { font-weight: 700; }
/* Currency radio in edit mode uses Hierarchy Settings' .ac-radio-card +
   .ac-radio-mark — `.is-disabled` dims the mark per the settings tab pattern. */
.cm-details-control .ac-radio-card.is-disabled { cursor: not-allowed; }
.cm-details-control .ac-radio-card.is-disabled .ac-radio-mark { opacity: 0.7; }
.cm-details-control .ac-radio-card.is-disabled .ac-radio-text strong { color: var(--text-muted); }

/* Editable cells / inputs inside the apps-table */
.cm-edit-input, .cm-edit-select, .cm-cell-input {
  font: inherit;
  color: var(--text);
  background: white;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: 6px 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.cm-edit-input:focus, .cm-edit-select:focus, .cm-cell-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(45, 212, 217, 0.15);
}
.cm-cell-input { width: 86px; padding: 5px 8px; text-align: start; font-size: 12.5px; }
/* Matrix table — country columns: header label + value both LEFT-aligned
   (start in RTL) so they share the same x-position inside each column. The
   input's leading padding is also zeroed below so the value text doesn't
   shift right of the header. The first column (Priority/Type row label)
   keeps its own left alignment. */
.cm-matrix th,
.cm-matrix td { text-align: start; }
/* Contract Details matrix (edit + view): fill the panel and distribute the
   country columns evenly (table-layout: fixed) so ALL columns are always
   visible — no horizontal overflow/cut on narrow screens — and the value
   inputs fill their cells so there are no awkward gaps between them. */
.apps-table.cm-matrix { width: 100%; table-layout: fixed; }
.apps-table.cm-matrix thead th,
.apps-table.cm-matrix tbody td { padding: 10px 9px; overflow: hidden; }
.apps-table.cm-matrix thead th:first-child,
.apps-table.cm-matrix tbody td:first-child { width: 116px; padding-inline-start: 16px; }
.apps-table.cm-matrix .cm-cell-input { width: 100%; box-sizing: border-box; }
/* Keep each country header label aligned with the (now indented) value below it. */
.apps-table.cm-matrix thead th:not(:first-child) { padding-inline-start: 19px; }
.cm-edit-select { padding: 6px 8px; min-width: 200px; }

/* View-mode "input" — keeps the exact same dimensions/padding as the editable
   field so values don't shift when toggling between View and Edit. */
.cm-edit-input.is-view,
.cm-cell-input.is-view {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  cursor: default;
  pointer-events: none;
}
.cm-edit-readonly { display: inline-block; padding: 6px 0; font-size: 13px; }

/* Info-field with a leading icon (e.g., Riyal mark) inside the input box */
.cm-info-prefix-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  height: 40px;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.cm-info-prefix-wrap:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 63, 68, 0.08);
}
.cm-info-prefix-wrap .cm-info-prefix-icon {
  display: inline-flex; align-items: center; color: var(--text-2);
}
.cm-info-prefix-wrap .cm-info-prefix-input,
.ac-field .cm-info-prefix-wrap input.ac-input {
  flex: 1; min-width: 0;
  border: 0; padding: 0;
  background: transparent;
  outline: none; box-shadow: none;
  height: 100%;
}
.cm-info-prefix-view {
  display: inline-flex; align-items: center; gap: 6px;
}
.cm-info-prefix-view .cm-info-prefix-icon { color: var(--text-2); }

/* Money cell — Riyal mark + number tight inline pair */
.cm-money {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cm-money svg { color: var(--text-2); }

/* Price cell: Riyal mark sits INSIDE the input box as a prefix */
.cm-price-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  height: 38px;                 /* match the Price Unit dropdown height */
  box-sizing: border-box;
  padding: 0 12px;
  max-width: 200px;
  transition: border-color .15s, box-shadow .15s;
}
.cm-price-cell:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(45, 212, 217, 0.15);
}
.cm-price-cell .cm-price-input {
  border: 0;
  background: transparent;
  padding: 0;
  width: auto;
  min-width: 0;
  max-width: 140px;
  outline: none;
  font: inherit;
  color: var(--text);
}
.cm-price-cell .cm-price-input.is-view {
  width: auto;
  cursor: default;
  pointer-events: none;
}

/* Cell hover suppressed (same as the list table) */
.apps-table tbody tr:hover { background: transparent !important; }

/* ============ Addons stack ============ */
.cm-addons-stack { display: flex; flex-direction: column; gap: 18px; }
.cm-addon-panel-body { padding: 20px 24px 22px; }
.cm-addon-panel-body .cm-addon-section-field + .cm-addon-section-field { margin-top: 14px; }

/* Addon value as plain info (view mode) — bold value with riyal glyph,
   matches the Hierarchy .info-field-value typography. */
.cm-addon-section-value {
  display: inline-flex; align-items: center; gap: 6px;
}
.cm-addon-section-value .cm-addon-section-currency {
  width: auto; height: auto; margin: 0;
  color: var(--text-2);
}
.cm-addon-section-value .num {
  font-size: 13.5px; font-weight: 700; color: var(--text);
}
.cm-addon-section {
  background: white;
  border: 1px solid var(--border-2);
  border-radius: 14px;
  padding: 20px 24px 22px;
}
.cm-addon-section-title {
  font-size: 16px; font-weight: 700; color: var(--text);
  letter-spacing: -0.01em;
}
.cm-addon-section-divider {
  height: 1px; background: var(--border-2);
  margin: 12px 0 16px;
}
.cm-addon-section-field { display: flex; flex-direction: column; gap: 8px; max-width: 480px; }
.cm-addon-section-field + .cm-addon-section-field { margin-top: 14px; }
.cm-addon-section-input {
  position: relative;
  background: white;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.cm-addon-section-currency {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-inline-start: 8px;
  color: var(--text-2);
  flex-shrink: 0;
}
.cm-addon-section-input input {
  flex: 1;
  border: 0; outline: none; background: transparent;
  font: inherit; color: var(--text);
  padding: 0 14px;
}
.cm-addon-section-input:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(45, 212, 217, 0.15);
}
.cm-addon-section-input input { min-width: 0; }
/* "/N" original-value suffix shown inside the field after the current number */
.cm-addon-section-original {
  margin-inline-end: 14px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}
.cm-addon-section-value .cm-addon-section-original {
  margin-inline-start: 4px;
  margin-inline-end: 0;
}
/* Edit mode for an entitlement (consumed/offered): TWO side-by-side fields —
   the consumed value (before the "/") is FIXED + DISABLED, and the OFFERED value
   (after the "/") is the editable input. */
.cm-addon-section-pair {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cm-addon-section-pair .cm-addon-section-input {
  flex: 1;
  min-width: 0;
}
.cm-addon-section-pair .cm-addon-section-slash {
  color: var(--text-muted);
  flex-shrink: 0;
  font-weight: 500;
}
/* Fixed/disabled consumed field */
.cm-addon-section-input.is-disabled {
  background: #F4F6F7;
  border-color: var(--border-2);
}
.cm-addon-section-input.is-disabled input {
  color: var(--text-muted);
  cursor: not-allowed;
  -webkit-text-fill-color: var(--text-muted);
  opacity: 1;
}

/* Removed in this redesign — kept selectors as no-ops so old refs don't break */
.cm-meta-input, .cm-stat-input, .cm-cell-input { background: white; }

/* Editable inputs that match the visual weight of the read-only values */
.cm-meta-input, .cm-stat-input, .cm-cell-input, .cm-addon-input {
  font: inherit;
  color: var(--text);
  background: white;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: 6px 8px;
  width: 100%;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.cm-meta-input:focus,
.cm-stat-input:focus,
.cm-cell-input:focus,
.cm-addon-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(45, 212, 217, 0.15);
}
/* Matrix cell input — left-align text and remove the leading inline padding
   so the value lines up with the column header (text-align: start on the
   parent th/td). Trailing inline padding kept so the number doesn't kiss the
   input's right border. Border-width offset (~1px) is visually negligible. */
.cm-cell-input {
  padding-block: 4px;
  padding-inline-start: 10px;   /* breathing room so the value isn't on the border (same in view + edit) */
  padding-inline-end: 6px;
  width: 70px;
  text-align: start;
}
.cm-addon-input { max-width: 160px; }
.cm-addon-unit-input { max-width: 80px; margin-inline-start: 6px; }

/* Add Contract wizard — extends ac-page chrome with a wider body */
.ac-page.cw-page .ac-card.cw-card { max-width: none; }
.cw-body { padding: 20px 28px 28px; min-height: 540px; }
.cw-step { display: flex; flex-direction: column; gap: 16px; }

/* Larger client icon in the wizard top bar (mirrors the attached image) */
.cw-topbar-brand { gap: 14px; }
.cw-brand-mark {
  width: 40px !important;
  height: 40px !important;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.cw-brand-mark .row-logo {
  width: 40px !important;
  height: 40px !important;
  border-radius: 8px !important;
  font-size: 16px !important;
}
.cw-brand-name {
  font-size: 18px !important;
  font-weight: 700;
  color: var(--text) !important;
  letter-spacing: -0.01em;
}

.cw-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.cw-field { display: flex; flex-direction: column; gap: 6px; }
.cw-field label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.cw-field input[type="text"],
.cw-field select {
  font-size: 13px; color: var(--text);
  background: white; border: 1px solid var(--border-2);
  border-radius: 8px; padding: 10px 12px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.cw-field input[type="text"]:focus,
.cw-field select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(45, 212, 217, 0.15); }

/* ---- Required marker + inline validation errors (Add Contract wizard) ---- */
.cw-req { color: #dc2626; font-weight: 700; }
.cw-field-error { font-size: 12px; color: #dc2626; line-height: 1.35; }
.cw-field.has-error input[type="text"],
.cw-field.has-error input[type="date"],
.cw-field.has-error select,
.cw-field.has-error .cw-value-input { border-color: #dc2626; }
.cw-field.has-error input[type="text"]:focus,
.cw-field.has-error input[type="date"]:focus,
.cw-field.has-error .cw-value-input:focus-within {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}
/* Unit suffix (e.g. SAR) inside the value field */
.cw-value-suffix { font-size: 12px; color: var(--text-muted); font-weight: 500; flex-shrink: 0; }
.cw-date-input { position: relative; }
.cw-date-input .cw-cal-ic {
  position: absolute; inset-inline-start: 10px; top: 50%;
  transform: translateY(-50%); color: var(--text-muted);
  background: #eef2f3; padding: 6px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
}
.cw-date-input input { padding-inline-start: 42px; width: 100%; }

/* Step 2: Rate Card editor */
.cw-rate-table {
  background: white; border: 1px solid var(--border-2);
  border-radius: 10px; overflow: hidden;
}
.cw-rate-head, .cw-rate-row {
  display: grid; grid-template-columns: 160px 1fr 1fr; gap: 12px;
  padding: 14px 18px;
}
.cw-rate-head {
  background: #fafbfb; border-bottom: 1px solid var(--border-2);
  font-size: 12.5px; color: var(--text-muted); font-weight: 500;
}
.cw-rate-row { border-bottom: 1px solid var(--border-2); align-items: center; }
.cw-rate-row:last-child { border-bottom: 0; }
.cw-rate-name { font-weight: 600; color: var(--text); font-size: 13px; }
.cw-rate-cell select, .cw-rate-cell input {
  width: 100%; padding: 9px 12px; font-size: 13px;
  border: 1px solid var(--border-2); border-radius: 8px;
  background: white; outline: none;
}
.cw-rate-cell select:focus, .cw-rate-cell input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(45, 212, 217, 0.15); }

/* Step 3: Contract Details */
.cw-details-head {
  display: grid; grid-template-columns: minmax(140px, 1fr) minmax(220px, 2fr) minmax(180px, 1fr);
  gap: 18px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border-2); margin-bottom: 10px;
}
.cw-radio-row { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.cw-radio {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--text-muted); display: inline-flex;
  align-items: center; justify-content: center;
}
.cw-radio.checked { border-color: var(--teal); }
.cw-radio.checked::after {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--teal);
}
.cw-matrix-scroll { overflow-x: auto; }
.cw-matrix {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.cw-matrix th, .cw-matrix td { padding: 10px 8px; text-align: center; }
.cw-matrix thead th { background: #f5f5f5; color: var(--text-muted); font-weight: 500; font-size: 12px; }
.cw-matrix thead th:first-child, .cw-matrix tbody td:first-child { text-align: start; padding-inline-start: 16px; }
.cw-matrix tbody td input {
  width: 80px; text-align: center;
  padding: 7px 8px; border-radius: 6px;
  border: 1px solid var(--border-2); background: white; font-size: 12.5px;
  outline: none;
}
.cw-matrix tbody td input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(45, 212, 217, 0.15); }

/* Step 4: Addons */
.cw-addons { gap: 18px; }
.cw-addon-block {
  background: white; border: 1px solid var(--border-2);
  border-radius: 12px; padding: 16px 20px;
}
.cw-addon-block-title { font-size: 14px; font-weight: 600; color: var(--text); }
/* Extra breathing room between addon fields (per request) */
.cw-addon-block .cw-field + .cw-field { margin-top: 10px; }
.cw-addon-divider { height: 1px; background: var(--border-2); margin: 10px 0 14px; }
.cw-addon-sub { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.cw-addon-input {
  display: grid; grid-template-columns: 1fr 60px; align-items: stretch;
  border: 1px solid var(--border-2); border-radius: 8px; overflow: hidden;
  max-width: 360px;
}
.cw-addon-input input {
  border: 0; padding: 10px 12px; font-size: 13px; outline: none;
  background: white;
}
.cw-addon-input .cw-addon-unit {
  background: #fafbfb;
  border-inline-start: 1px solid var(--border-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--text-muted); padding: 0 12px;
}

/* --- New: wizard improvements --- */
/* Step 1: Value field with Riyal icon inside */
.cw-value-input {
  display: inline-flex; align-items: center; gap: 6px;
  width: 100%;
  background: white;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 0 12px;
  height: 40px;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.cw-value-input:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(45, 212, 217, 0.15);
}
.cw-value-input .cw-value-icon { color: var(--text-2); display: inline-flex; align-items: center; }
/* Beat the generic `.cw-field input[type="text"]` rule above — the inner
   input must be borderless/padless so only the wrapper draws the box. */
.cw-field .cw-value-input input,
.cw-field .cw-value-input input[type="text"] {
  flex: 1; border: 0; outline: none; background: transparent;
  font: inherit; color: var(--text); padding: 0; box-shadow: none;
}
.cw-field .cw-value-input input:focus,
.cw-field .cw-value-input input[type="text"]:focus {
  border: 0; box-shadow: none;
}
/* Step 1: native date picker styled like other inputs */
.cw-date-native {
  width: 100%; height: 40px;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 0 12px;
  font: inherit; color: var(--text);
  background: white;
  font-family: inherit;
}
.cw-date-native:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(45, 212, 217, 0.15); }

/* ---- Reusable date field: shows DD-MMM-YYYY, opens the native calendar ---- */
.cm-datefield {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px;
  border: 1px solid var(--border-2); border-radius: 8px;
  background: white; cursor: pointer; box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.cm-datefield-wrap { position: relative; }
.cm-datefield.is-open { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(45, 212, 217, 0.15); }
.cm-dp-pop { min-width: 248px; }
.cm-datefield:hover { border-color: #cfd6dc; }
.cm-datefield:focus,
.cm-datefield:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(45, 212, 217, 0.15); outline: none; }
.cm-datefield-cal { color: var(--text-muted); display: inline-flex; flex-shrink: 0; }
.cm-datefield-text { flex: 1; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-datefield-text.is-placeholder { color: var(--text-muted); font-weight: 400; }
/* native picker input stays in the DOM (calendar + value) but is visually hidden */
.cm-datefield-native { position: absolute; inset-inline-end: 10px; bottom: 4px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.cm-datefield.is-disabled { background: #f4f6f7; cursor: not-allowed; }
.cm-datefield.is-disabled .cm-datefield-text { color: var(--text-muted); }
/* error state when used inside a wizard field */
.cw-field.has-error .cm-datefield { border-color: #dc2626; }
.cw-field.has-error .cm-datefield:focus,
.cw-field.has-error .cm-datefield:focus-within { box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14); }
.cw-date-native::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.6; }

/* Step 2: rate-card wrapper sized like ac-svc-table */
.ac-svc-table.cw-rate-svc .ac-svc-head,
.ac-svc-table.cw-rate-svc .ac-svc-row {
  grid-template-columns: 1fr 1fr 1fr;
  min-height: 64px;
}
/* Match the head row height to the body rows exactly */
.ac-svc-table.cw-rate-svc .ac-svc-head { padding: 14px 20px; }
.ac-svc-table.cw-rate-svc .ac-svc-row { padding: 14px 20px; }
/* Name cell no longer bold (matches user request) */
.ac-svc-table.cw-rate-svc .ac-svc-row .ac-svc-cell:first-child { font-weight: 400; }

/* Step 3: matrix wrapped in a panel matching ac-svc-table chrome */
.cw-matrix-panel {
  background: white;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  overflow: hidden;
}
.cw-matrix-panel .cw-matrix-scroll { overflow-x: auto; }
/* Fill the panel, distribute the country columns evenly, so all columns are
   always visible (no overflow/cut) and the inputs fill their cells. */
.cw-matrix-styled { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.cw-matrix-styled tbody td input { width: 100%; box-sizing: border-box; padding: 6px 4px; padding-inline-start: 10px; }
.cw-matrix-styled thead th:first-child,
.cw-matrix-styled tbody td:first-child { width: 110px; }
/* Keep each country header label aligned with the (now indented) value below it. */
.cw-matrix-styled thead th:not(:first-child) { padding-inline-start: 19px; }
.cw-matrix-styled thead th {
  background: #f5f5f5;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  padding: 14px 9px;
  border-bottom: 1px solid var(--border-2);
  height: 64px;
  box-sizing: border-box;
  text-align: start;
}
.cw-matrix-styled tbody td {
  padding: 12px 9px;
  border-bottom: 1px solid var(--border-2);
  text-align: start;
  font-size: 13px;
  height: 64px;
  box-sizing: border-box;
}
.cw-matrix-styled tbody td input { text-align: start; }
.cw-matrix-styled tbody tr { height: 64px; }
.cw-matrix-styled tbody tr:last-child td { border-bottom: 0; }
.cw-matrix-styled tbody td:first-child {
  text-align: start; padding-inline-start: 16px; font-weight: 400;
}

/* Step 4: addons input with leading Riyal mark + trailing /original suffix */
.cw-addon-input {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: white;
  padding: 0 12px;
  height: 44px;
  max-width: 360px;
}
.cw-addon-input:focus-within {
  border-color: var(--teal); box-shadow: 0 0 0 3px rgba(45, 212, 217, 0.15);
}
.cw-addon-input .cw-addon-currency {
  display: inline-flex; align-items: center; color: var(--text-2); margin-inline-end: 8px; flex-shrink: 0;
}
/* Higher specificity to beat .cw-field input[type="text"] from above */
.cw-field .cw-addon-input input,
.cw-field .cw-addon-input input[type="text"] {
  flex: 1; min-width: 0; border: 0; padding: 0; outline: none; background: transparent;
  box-shadow: none;
}
.cw-field .cw-addon-input input:focus,
.cw-field .cw-addon-input input[type="text"]:focus {
  border: 0; box-shadow: none;
}

/* Section title above the contracts table */
.cm-section-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin: 4px 4px 10px;
  letter-spacing: 0.01em;
}

/* List table tweaks */
.cm-list-table tbody tr:hover { background: #fafbfc; }

/* Row-level status text colors (no pill) — matches column treatment in screenshot */
.cm-row-status { font-weight: 500; }
.cm-row-status.active  { color: #15803d; }
.cm-row-status.pending { color: #6b7280; }
.cm-row-status.expired { color: #B91C1C; }

/* ============ DETAILS PAGE (4 tabs) ============ */
.cm-details-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
}

.cm-details-scope {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

/* Tab strip — underline accent like Templates */
.cm-tabs {
  display: flex;
  gap: 28px;
  border-bottom: 1px solid var(--border-2);
  padding: 0 4px;
}
.cm-tab {
  appearance: none;
  background: none;
  border: 0;
  padding: 12px 0;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: color 0.15s;
  white-space: nowrap;
}
.cm-tab:hover { color: var(--text); }
.cm-tab.active {
  color: var(--text);
  font-weight: 700;
}
.cm-tab.active::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  bottom: -1px;
  height: 3px;
  background: var(--teal);
  border-radius: 2px;
}

/* legacy: .cm-tab-body padding consolidated above */

/* ============ TAB 1: Contract Information ============ */
.cm-info-wrap {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Top metadata row in a soft outlined card */
.cm-info-meta {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
  padding: 22px 28px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
}
.cm-meta-cell .lbl {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.cm-meta-cell .val {
  font-size: 14px;
  color: var(--text);
}
.cm-meta-cell .val.strong { font-weight: 600; }

/* Three-up stat card — value / remaining / status, tone-tinted by status */
.cm-stat-card {
  display: grid;
  grid-template-columns: 1fr 1px 1fr 1px auto;
  align-items: center;
  gap: 0;
  padding: 22px 32px;
  border-radius: 14px;
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s;
}
.cm-stat-divider {
  width: 1px;
  height: 38px;
  background: rgba(0,0,0,0.06);
  margin: 0 28px;
}
.cm-stat-cell .lbl {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.cm-stat-cell .amt {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.cm-stat-cell.status {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
}
.cm-stat-cell.status .lbl { margin: 0; }

/* Tones */
.cm-tone-active  { background: #EAF4EE; border-color: #C9E2D2; }
.cm-tone-pending { background: #F2F3F5; border-color: #E1E3E7; }
.cm-tone-expired { background: #FCEAEA; border-color: #F2C8C8; }

.cm-tone-active  .cm-stat-divider { background: rgba(13, 63, 68, 0.10); }
.cm-tone-pending .cm-stat-divider { background: rgba(0, 0, 0, 0.08); }
.cm-tone-expired .cm-stat-divider { background: rgba(185, 28, 28, 0.18); }

/* Status pills inside the stat card */
.cm-pill {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.cm-pill.active  { background: white; color: #0d3f44; border-color: #C9E2D2; }
.cm-pill.pending { background: #E5E7EB; color: #4B5563; border-color: #D1D5DB; }
.cm-pill.expired { background: white; color: #B91C1C; border-color: #F2C8C8; }

/* ============ Generic card + table used by tabs 2/3/4 ============ */
.cm-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.cm-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  color: var(--text);
}
.cm-table thead th {
  text-align: start;
  padding: 14px 22px;
  background: #F4F6F7;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  border-bottom: 1px solid var(--border-2);
  white-space: nowrap;
}
.cm-table tbody td {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-2);
}
.cm-table tbody tr:last-child td { border-bottom: 0; }
.cm-table .strong { font-weight: 600; }

.cm-row-head td { background: #F4F6F7; }

.cm-table-scroll {
  overflow-x: auto;
  max-width: 100%;
}
.cm-table.cm-matrix {
  min-width: 900px;
}
.cm-table.cm-matrix thead th,
.cm-table.cm-matrix tbody td {
  white-space: nowrap;
  padding-inline: 14px;
}
.cm-table.cm-matrix tbody td:first-child,
.cm-table.cm-matrix thead th:first-child {
  padding-inline-start: 22px;
}

/* Header row of Contract Details (currency / app / channel) */
.cm-details-head {
  display: grid;
  grid-template-columns: 1fr 2fr minmax(220px, 1fr);
  gap: 24px;
  padding: 22px 28px;
  background: white;
  border-bottom: 1px solid var(--border-2);
  align-items: end;
}
.cm-channel-select { display: flex; flex-direction: column; gap: 6px; }
.cm-channel-select .lbl {
  font-size: 12px; color: var(--text-muted); font-weight: 500;
}
.cm-channel-select select {
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.cm-channel-select select:focus { outline: 2px solid var(--teal); outline-offset: -2px; }

/* Custom radio dot used by Currency display */
.cm-radio-line { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; }
.cm-radio {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid var(--text-muted);
  display: inline-block;
  position: relative;
}
.cm-radio.checked { border-color: var(--teal); }
.cm-radio.checked::after {
  content: '';
  position: absolute;
  inset: 2.5px;
  border-radius: 50%;
  background: var(--teal);
}

/* ============ TAB 4: Addons ============ */
.cm-addons-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.cm-addon-block {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px 22px;
}
.cm-addon-block-head {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-2);
}
.cm-addon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.cm-addon-card {
  background: #F4F8F7;
  border: 1px solid #DCE7E5;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.cm-addon-card:hover {
  border-color: var(--teal);
  background: #ECF4F2;
}
.cm-addon-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--teal);
  letter-spacing: 0.01em;
}
.cm-addon-amt {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.cm-addon-amt .num {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.cm-addon-amt .unit {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Responsive: stack 5-up meta row on narrow screens */
@media (max-width: 1199px) {
  .cm-info-meta { grid-template-columns: repeat(3, 1fr); }
  .cm-details-head { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 899px) {
  .cm-info-meta { grid-template-columns: repeat(2, 1fr); }
  .cm-stat-card {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .cm-stat-divider { display: none; }
}
