/* CRM-SPLIT-01 (assets/crmsplit01.js): the estimate in grey, the Link row on the lead card and the Lead Pipeline panel, the owner's and heads'
   toolbar lists, the project page's Link lead bar, the manual-create phone note and the link / list sheets. Colours come from the app's own
   tokens, so both themes follow; nothing here is wider than a 390 px phone. */

/* ---------- the estimate: shown apart, never counted in the pipeline value ---------- */
.crmsplit01-est {
  color: var(--lv4-muted2, var(--text-secondary, var(--ui-muted)));
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ---------- the Link row: lead card (Ownership facts) and Lead Pipeline panel ---------- */
[data-crmsplit01-card-row] dd {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.crmsplit01-hint {
  color: var(--text-secondary, var(--ui-muted));
  font-size: 13px;
}

.crmsplit01-lv4 {
  align-items: center;
}

.crmsplit01-lv4 .crmsplit01-hint {
  color: var(--lv4-muted, var(--text-secondary));
}

/* ---------- the owner's and heads' lists (Leads toolbar) ---------- */
.crmsplit01-tools {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
}

.crmsplit01-tools[hidden] {
  display: none;
}

.crmsplit01-tools .ghost-button {
  white-space: normal;
}

.crmsplit01-tools strong {
  margin-left: 4px;
}

/* ---------- the project page: Link lead ---------- */
.crmsplit01-project-bar {
  align-items: center;
  background: var(--panel-soft, var(--ui-surface-soft));
  border: 1px solid var(--panel-line, var(--ui-border));
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  justify-content: space-between;
  margin: 10px 0;
  padding: 8px 12px;
}

/* ---------- manual create: an open lead has this phone ---------- */
.crmsplit01-manual:empty {
  display: none;
}

.crmsplit01-note {
  border: 1px solid var(--orange, var(--panel-line));
  border-radius: 10px;
  font-size: 13px;
  margin: 0;
  overflow-wrap: anywhere;
  padding: 8px 12px;
}

.crmsplit01-note p {
  margin: 0;
}

.crmsplit01-note ul {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.crmsplit01-note li,
.crmsplit01-note.is-using {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

/* ---------- the sheets ---------- */
/* Above the Leads CRM lead card (.crm03a-card-modal 3300), its move sheet (3400) and the Lead Pipeline sheet (1200); below the toasts (10000). */
.crmsplit01-modal {
  z-index: 3500;
}

.crmsplit01-card {
  width: min(720px, 100%);
}

.crmsplit01-body p {
  margin: 0;
}

.crmsplit01-muted {
  color: var(--text-secondary, var(--ui-muted));
  font-size: 13px;
}

.crmsplit01-error {
  color: var(--red);
  font-weight: 700;
}

.crmsplit01-done {
  color: var(--ui-teal-dark, var(--cyan));
  font-weight: 700;
}

.crmsplit01-cands {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.crmsplit01-cand {
  align-items: center;
  background: var(--panel-soft, var(--ui-surface-soft));
  border: 1px solid var(--panel-line, var(--ui-border));
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  justify-content: space-between;
  padding: 8px 10px;
}

.crmsplit01-cand.is-blocked {
  border-style: dashed;
}

/* The sheet body styles its labels as small upper-case field names; a project row reads as normal text. */
.text-action-modal-body .crmsplit01-cand label {
  align-items: flex-start;
  cursor: pointer;
  display: flex;
  flex: 1 1 240px;
  gap: 10px;
}

.text-action-modal-body .crmsplit01-cand label > span {
  color: inherit;
  display: grid;
  font-size: 14px;
  font-weight: 400;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
  text-transform: none;
}

/* The app's input rule (100% wide, 40 px tall, padded) is meant for text fields; only checkboxes are reset there, so a project or lead
   choice resets its radio here (without this it stretches into a wide oval). */
.crmsplit01-cand input[type="radio"] {
  accent-color: var(--ui-teal, var(--cyan));
  flex: 0 0 auto;
  height: 18px;
  margin: 2px 0 0;
  min-height: 18px;
  padding: 0;
  width: 18px;
}

.crmsplit01-cand input[disabled] + span {
  opacity: 0.75;
}

.crmsplit01-cand small {
  color: var(--text-secondary, var(--ui-muted));
  font-size: 12px;
}

.crmsplit01-cand .crmsplit01-why {
  color: var(--orange, var(--text-secondary));
}

.crmsplit01-search {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.crmsplit01-search .crmsplit01-field {
  flex: 1 1 200px;
}

.crmsplit01-field input,
.crmsplit01-field select,
.crmsplit01-field textarea {
  box-sizing: border-box;
  max-width: 100%;
  width: 100%;
}

/* The dark theme colours a field by its container (.app-shell …). A sheet sits outside it, so its fields would show near-white text on a
   white field; they take the dark field look of the app's own panels instead. */
[data-theme="dark"] .crmsplit01-modal .crmsplit01-field :is(input, select, textarea) {
  background: #091827;
  border-color: var(--ui-border-strong, var(--panel-line));
  color: var(--ui-text, var(--text));
}

[data-theme="dark"] .crmsplit01-modal .crmsplit01-field :is(input, textarea)::placeholder {
  color: #748da3;
}

/* A Link that cannot be pressed yet (no project chosen) looks it. */
.crmsplit01-actions .primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.crmsplit01-tablewrap {
  max-width: 100%;
  overflow-x: auto;
}

/* The app's table rules are for its wide registers: every table at least 1560 px, white, with sticky headers and cells that never wrap.
   A list in a sheet resets them, so it fits the sheet and takes the sheet's colours. */
.crmsplit01-table {
  background: transparent;
  border-collapse: collapse;
  color: inherit;
  font-size: 13px;
  min-width: 0;
  width: 100%;
}

.crmsplit01-table th,
.crmsplit01-table td {
  background: transparent;
  border-bottom: 1px solid var(--panel-line, var(--ui-border));
  color: inherit;
  overflow-wrap: anywhere;
  padding: 6px 8px;
  position: static;
  text-align: left;
  vertical-align: top;
  white-space: normal;
}

.crmsplit01-table th {
  color: var(--text-secondary, var(--ui-muted));
  font-size: 12px;
}

.crmsplit01-table tbody tr:hover td {
  background: color-mix(in srgb, var(--ui-teal, var(--cyan)) 8%, transparent);
}

.crmsplit01-table td .ghost-button {
  white-space: nowrap;
}

.crmsplit01-table small {
  color: var(--text-secondary, var(--ui-muted));
  display: block;
  font-size: 12px;
}

.crmsplit01-linkbtn {
  background: none;
  border: 0;
  color: var(--ui-teal-dark, var(--cyan));
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0;
  text-decoration: underline;
}

/* A phone: each list row becomes a small card of labelled facts, two to a line, with its button below; nothing scrolls sideways. */
@media (max-width: 600px) {
  .crmsplit01-table,
  .crmsplit01-table tbody,
  .crmsplit01-table td {
    display: block;
  }

  .crmsplit01-table thead {
    display: none;
  }

  .crmsplit01-table tr {
    border-bottom: 1px solid var(--panel-line, var(--ui-border));
    display: grid;
    gap: 6px 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 8px 2px;
  }

  .crmsplit01-table td {
    border: 0;
    padding: 0;
  }

  .crmsplit01-table td[data-label]::before {
    color: var(--text-secondary, var(--ui-muted));
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .crmsplit01-table td:last-child {
    grid-column: 1 / -1;
  }

  .crmsplit01-table tbody tr:hover td {
    background: transparent;
  }
}
