/* =======================================================
   Orchestrator — CRM pages
   Accounts · Contacts · Custom Objects · Relationships · Tasks · Logs
   ======================================================= */

/* ---------- two-pane master/detail (Accounts, Contacts) ---------- */
.crm-split { display: grid; grid-template-columns: 340px 1fr; gap: 16px; height: 100%; min-height: 0; align-items: stretch; }
.crm-list { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.crm-list-head { padding: 12px 14px; border-bottom: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 10px; }
.crm-search { height: 32px; border-radius: var(--r-sm); background: var(--sunken); border: 1px solid var(--hairline); display: flex; align-items: center; gap: 8px; padding: 0 11px; color: var(--muted); font-size: 12px; }
.crm-search input { border: none; outline: none; background: transparent; font-family: inherit; font-size: 12px; color: var(--fg); width: 100%; }
.crm-search input::placeholder { color: var(--muted); }
.crm-list-body { flex: 1; overflow-y: auto; padding: 6px; }
.crm-li { padding: 10px 11px; border-radius: var(--r-md); cursor: pointer; display: grid; grid-template-columns: 34px 1fr auto; gap: 11px; align-items: center; margin-bottom: 2px; }
.crm-li:hover { background: var(--sunken); }
.crm-li.is-active { background: var(--brand-soft); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--brand) 25%, transparent); }
.crm-li .nm { font-size: 12.5px; font-weight: 600; color: var(--fg-strong); }
.crm-li .meta { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-li .right { text-align: right; min-width: 56px; }
.crm-li .right .val { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--fg-strong); }

.crm-detail { min-height: 0; overflow-y: auto; }
.crm-dt-head { padding: 20px 22px 16px; border-bottom: 1px solid var(--hairline); display: flex; align-items: flex-start; gap: 14px; }
.crm-dt-head .big-av { width: 52px; height: 52px; font-size: 16px; }
.crm-dt-head > div:first-child { flex: 1; min-width: 0; }
.crm-dt-head h2 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.015em; color: var(--fg-strong); text-wrap: balance; }
.crm-dt-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crm-dt-head .acts { margin-left: auto; display: flex; gap: 7px; }
.crm-dt-body { padding: 18px 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.crm-dt-body .full { grid-column: 1 / -1; }
.crm-block .sect-h { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 11px; display: flex; align-items: center; justify-content: space-between; }
.crm-block .sect-h .act { color: var(--brand); font-weight: 600; }
.crm-block .sect-h .tot { color: var(--fg-strong); font-weight: 700; font-family: var(--mono); }
.crm-dt-head .sub .lk { color: var(--brand); font-weight: 600; }
.kv2 .v.with-av { display: inline-flex; align-items: center; gap: 6px; }
.crm-block .lead-link { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border: var(--card-border); border-radius: var(--r-md); cursor: pointer; }
.crm-block .lead-link .nm { font-size: 12.5px; font-weight: 600; color: var(--fg-strong); }
.crm-block .lead-link .st { font-size: 11px; color: var(--muted); }
.crm-tab-body { padding: 16px 20px; }

/* tabs in contact detail */
.crm-tabs { display: flex; gap: 2px; padding: 0 22px; border-bottom: 1px solid var(--hairline); }
.crm-tab { padding: 12px 12px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; position: relative; }
.crm-tab.is-active { color: var(--fg-strong); font-weight: 700; }
.crm-tab.is-active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand); }
.crm-tab .badge { font-family: var(--mono); font-size: 10px; font-weight: 700; margin-left: 4px; padding: 0 5px; border-radius: 999px; background: var(--sunken); color: var(--muted); }
.crm-tab.is-active .badge { background: var(--brand-soft); color: var(--brand-strong); }

/* open-deals mini rows */
.deal-mini { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--hairline); }
.deal-mini:last-child { border-bottom: none; }
.deal-mini .nm { font-size: 12.5px; font-weight: 600; color: var(--fg-strong); }
.deal-mini .st { font-size: 11px; color: var(--muted); }
.deal-mini .val { margin-left: auto; font-family: var(--mono); font-weight: 700; font-size: 12.5px; color: var(--fg-strong); }

/* timeline (reused for activity / enrollment) */
.tl { display: flex; flex-direction: column; }
.tl-i { display: grid; grid-template-columns: 26px 1fr auto; gap: 11px; padding: 9px 0; position: relative; align-items: start; }
.tl-i::before { content: ""; position: absolute; left: 12px; top: 28px; bottom: -2px; width: 1.5px; background: var(--faint); }
.tl-i:last-child::before { display: none; }
.tl-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--faint); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); z-index: 1; }
.tl-dot.email { border-color: color-mix(in oklch, var(--info) 45%, white); color: var(--info); }
.tl-dot.call { border-color: var(--ok); color: var(--ok); }
.tl-dot.meeting { border-color: oklch(0.78 0.07 200); color: oklch(0.42 0.10 200); }
.tl-dot.ai { border-color: var(--ai); color: var(--ai); background: var(--ai-bg); }
.tl-l1 { font-size: 12px; color: var(--fg); }
.tl-l1 b { font-weight: 600; color: var(--fg-strong); }
.tl-l2 { font-size: 11px; color: var(--muted); margin-top: 1px; }
.tl-t { font-family: var(--mono); font-size: 11px; color: var(--dim); white-space: nowrap; }

/* notes / files reuse fz-note style locally */
.cnote { padding: 12px 14px; border-radius: var(--r-md); background: var(--sunken); border: 1px solid var(--hairline); margin-bottom: 10px; }
.cnote .top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.cnote .who { font-size: 11.5px; font-weight: 600; color: var(--fg-strong); }
.cnote .when { font-size: 10.5px; color: var(--muted); font-family: var(--mono); margin-left: auto; }
.cnote .body { font-size: 12px; color: var(--fg); line-height: 1.5; }

/* ---------- generic data table (Objects, Logs) ---------- */
.crm-table { width: 100%; border-collapse: collapse; }
.crm-table thead th { position: sticky; top: 0; background: var(--surface); text-align: left; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 2; }
.crm-table td { padding: 10px 14px; font-size: 12.5px; border-bottom: 1px solid var(--hairline); color: var(--fg); }
.crm-table td.strong { font-weight: 600; color: var(--fg-strong); }
.crm-table td.primary { font-weight: 600; color: var(--fg-strong); }
.crm-table td.dim { color: var(--muted); }
.crm-table td.ts { font-family: var(--mono); color: var(--muted); white-space: nowrap; font-size: 11px; }
.crm-table tr:hover td { background: var(--sunken); }
.crm-table .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.crm-table td.num, .crm-table th.num { text-align: right; }
.crm-table .tl-dot { width: 22px; height: 22px; }
.enroll-act { font-size: 12.5px; font-weight: 600; color: var(--fg-strong); }
.enroll-act.ai { color: var(--ai); }
.enroll-contact { font-weight: 600; color: var(--fg-strong); }

/* object type chips row */
.obj-types { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.obj-type { height: 32px; padding: 0 12px; border-radius: var(--r-md); border: 1px solid transparent; background: var(--surface); cursor: pointer; display: flex; align-items: center; gap: 9px; }
.obj-type:hover { background: var(--sunken); }
.obj-type.is-active { border-color: var(--border); background: var(--surface); box-shadow: var(--card-shadow); color: var(--fg-strong); }
.obj-type .ic { width: 28px; height: 28px; border-radius: var(--r-md); background: var(--sunken); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.obj-type.is-active .ic { background: var(--surface); color: var(--brand); }
.obj-type .nm { font-size: 12.5px; font-weight: 600; color: var(--fg-strong); }
.obj-type .cnt { font-size: 10.5px; font-weight: 700; font-family: var(--mono); padding: 0 5px; border-radius: 999px; background: var(--sunken); color: var(--muted); }

/* custom-fields surface */
.obj-fields-act { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--brand); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; text-transform: none; letter-spacing: 0; }
.obj-fields-act svg { width: 12px; height: 12px; }
.obj-field-x { border: none; background: transparent; color: var(--dim); cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 6px; border-radius: var(--r-xs); }
.obj-field-x:hover { color: var(--alert); background: var(--alert-bg); }
.obj-field-add td { background: var(--sunken); vertical-align: middle; }
.obj-field-add .cs-inp { height: 30px; }

/* ---------- Relationships org/committee map ---------- */
.rel-wrap { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.rel-canvas { padding: 20px; position: relative; }
.rel-account { display: flex; align-items: center; gap: 11px; padding: 12px 16px; border-radius: var(--r-lg); background: var(--brand); border: 1px solid var(--brand-border, transparent); color: var(--brand-fg); width: fit-content; margin: 0 auto 4px; }
.rel-account .av { background: color-mix(in oklch, var(--brand-fg) 22%, transparent); color: var(--brand-fg); }
.rel-account .nm { font-size: 13px; font-weight: 700; }
.rel-account .sub { font-size: 9.5px; color: color-mix(in oklch, var(--brand-fg) 78%, transparent); }
.rel-tier { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin-top: 20px; position: relative; }
.rel-tier::before { content: ""; position: absolute; top: -12px; left: 50%; width: 1.5px; height: 12px; background: var(--faint); }
.rel-node { width: 188px; border-radius: var(--r-md); border: var(--card-border); background: var(--surface); box-shadow: var(--card-shadow); padding: 12px; position: relative; }
.rel-node::before { content: ""; position: absolute; top: -12px; left: 50%; width: 1.5px; height: 12px; background: var(--faint); }
.rel-node .top { display: flex; align-items: center; gap: 9px; }
.rel-node .nm { font-size: 12.5px; font-weight: 700; color: var(--fg-strong); }
.rel-node .tt { font-size: 11px; color: var(--muted); }
.rel-node .row { display: flex; align-items: center; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.rel-node.champion { border-color: color-mix(in oklch, var(--warn) 55%, var(--border)); box-shadow: 0 0 0 1px color-mix(in oklch, var(--warn) 35%, transparent), var(--card-shadow); }
.rel-node.is-link { cursor: pointer; }
.rel-node.is-link:hover { border-color: color-mix(in oklch, var(--brand) 40%, var(--border)); }
.rel-node.is-suggested { border-style: dashed; background: var(--sunken); opacity: 0.92; }
.rel-node .rel-why { font-size: 10.5px; color: var(--muted); margin-top: 8px; line-height: 1.4; }
.rel-node .rel-disabled { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--surface); border: 1px solid var(--hairline); padding: 1px 6px; border-radius: 999px; }

/* account-detail Relationships tab */
.crm-dt-tabs { padding: 10px 16px 0; }
.acct-rel { padding: 0 2px; }
.acct-rel-bar { display: flex; }

/* ---------- Tasks board ---------- */
.task-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: start; padding-top: 2px; }
.task-col-h { display: flex; align-items: center; gap: 8px; padding: 2px 2px 10px; }
.task-col-h .nm { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.task-col-h .cnt { font-size: 11px; font-weight: 700; font-family: var(--mono); color: var(--muted); background: var(--sunken); padding: 0 7px; border-radius: 999px; }
.task-col-h.overdue .nm { color: var(--alert); }
.task-card { background: var(--surface); border-radius: var(--r-md); border: var(--card-border); box-shadow: var(--card-shadow); padding: 10px 11px; margin-bottom: 8px; }
.task-cols .confirm-card { margin-bottom: 8px; }
.task-card .tt { font-size: 12.5px; font-weight: 600; color: var(--fg-strong); line-height: 1.35; }
.task-card .meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.task-card .meta .due { font-weight: 600; }
.task-card .meta .due.over { color: var(--alert); }
