/* companies.css — the Companies list (companies.js), to the owner's design.
 * Its own tokens; dark mode swaps blue accents for lime like the rest. */

.crm-co {
  --co-ink: #101828;
  --co-muted: #475467;
  --co-soft: #667085;
  --co-line: #e7eaf0;
  --co-card: #ffffff;
  --co-bg: #f8fafc;
  --co-lime: #d4fb08;
  --co-lime-ink: #111;
  --co-peach: #fde3c4;
  --co-peach-ink: #b4530f;
  --co-img: #e3f4ee;

  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  background: var(--co-bg);
  color: var(--co-ink);
  font-size: 14px;
  text-align: start;
}
.dark .crm-co {
  --co-ink: #e8eaed;
  --co-muted: #b8c0cc;
  --co-soft: #98a1ad;
  --co-line: #2c3138;
  --co-card: #1b1e23;
  --co-bg: #15181c;
  --co-peach: rgba(251, 176, 96, .16);
  --co-peach-ink: #fdba74;
  --co-img: rgba(110, 231, 183, .12);
}
.crm-co * { box-sizing: border-box; }

/* The platform page's own column is gone (captain-routes.js); hide anything
   it might still leave in <main> while ours is up. */
body[data-crm-co-open] main > section.bg-n-surface-1 { display: none !important; }

.crm-co-inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 44px 40px 0;
}

/* ---------------------------------------------------------------- header */
.crm-co-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 30px; flex-wrap: wrap; }
.crm-co-titles h1 { margin: 0; font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; color: var(--co-ink); }
.crm-co-titles p { margin: 6px 0 0; font-size: 15px; color: var(--co-muted); }

.crm-co-tools { display: flex; align-items: center; gap: 16px; }

.crm-co-find {
  display: flex; align-items: center; gap: 10px;
  width: 280px; height: 48px; padding: 0 16px;
  border: 1px solid var(--co-line); border-radius: 8px;
  background: var(--co-card); color: var(--co-soft); cursor: text;
}
.crm-co-find:focus-within { border-color: #98a2b3; }
.dark .crm-co-find:focus-within { border-color: var(--co-lime); }
.crm-co-find .fi { font-size: 17px; line-height: 1; display: inline-flex; }
.crm-co .crm-co-find input {
  flex: 1; min-width: 0; height: 100% !important; margin: 0 !important; padding: 0 !important;
  border: 0 !important; border-radius: 0 !important; background: none !important; box-shadow: none !important;
  outline: 0 !important; outline-offset: 0 !important;
  color: var(--co-ink); font: inherit; font-size: 15px;
}
.crm-co-find input::placeholder { color: var(--co-soft); }
.crm-co-find input::-webkit-search-cancel-button { cursor: pointer; }

.crm-co .crm-co-add {
  display: inline-flex; align-items: center; gap: 10px;
  height: 48px; padding: 0 22px;
  border: 0; border-radius: 8px;
  background: var(--co-lime); color: var(--co-lime-ink);
  font: inherit; font-size: 16px; font-weight: 700; white-space: nowrap; cursor: pointer;
}
.crm-co .crm-co-add:hover { background: #c4ea00; }
.crm-co-add .fi { font-size: 16px; line-height: 1; display: inline-flex; }

.crm-co .crm-co-sort {
  width: 48px; height: 48px; display: grid; place-items: center;
  border: 1px solid var(--co-line); border-radius: 8px;
  background: var(--co-card); color: var(--co-ink); cursor: pointer; font-size: 17px;
}
.crm-co .crm-co-sort:hover { border-color: #98a2b3; }
.crm-co-sort .fi { line-height: 1; display: inline-flex; }

/* ------------------------------------------------------------------ list */
.crm-co-list { display: flex; flex-direction: column; gap: 20px; flex: 1; transition: opacity .15s; }
.crm-co-list.is-dim { opacity: .55; }

.crm-co .crm-co-card {
  display: flex; align-items: center; gap: 30px;
  width: 100%; min-height: 136px; padding: 26px 32px;
  border: 1px solid var(--co-line); border-radius: 8px;
  background: var(--co-card); color: var(--co-ink);
  box-shadow: none;
  font: inherit; text-align: start; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.crm-co .crm-co-card:hover { border-color: #d0d5dd; box-shadow: 0 4px 14px rgba(16, 24, 40, .07); }
.dark .crm-co .crm-co-card:hover { border-color: #3a414b; box-shadow: none; }
.crm-co .crm-co-card:focus-visible { outline: 2px solid var(--co-lime); outline-offset: 2px; }
.crm-co-card.is-ghost { cursor: default; background: linear-gradient(90deg, var(--co-card), var(--co-bg), var(--co-card)); background-size: 200% 100%; animation: crm-co-shimmer 1.2s linear infinite; }
@keyframes crm-co-shimmer { to { background-position: -200% 0; } }

.crm-co-av {
  flex: none; width: 80px; height: 80px; border-radius: 50%;
  display: grid; place-items: center; overflow: hidden;
  background: var(--co-peach); color: var(--co-peach-ink);
  font-size: 30px; font-weight: 600; line-height: 1;
}
.crm-co-av.has-img { background: var(--co-img); }
.crm-co-av img { width: 100%; height: 100%; object-fit: cover; display: block; }

.crm-co-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.crm-co-name { font-size: 20px; font-weight: 700; color: var(--co-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-co-meta { display: flex; align-items: center; gap: 30px; min-width: 0; color: var(--co-muted); font-size: 16px; }
.crm-co-bit { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.crm-co-bit .fi { font-size: 18px; line-height: 1; display: inline-flex; color: var(--co-muted); }
.crm-co-domain { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-co-sep { width: 1px; height: 20px; background: var(--co-line); flex: none; }
.crm-co-go { flex: none; font-size: 22px; line-height: 1; display: inline-flex; color: var(--co-muted); }

.crm-co-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 64px 20px; border: 1px dashed var(--co-line); border-radius: 8px;
  background: var(--co-card); color: var(--co-muted); text-align: center;
}
.crm-co-empty strong { color: var(--co-ink); font-size: 16px; }
.crm-co-empty-ic { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--co-lime) 25%, var(--co-card)); color: var(--co-ink); font-size: 22px; margin-bottom: 6px; }
.crm-co-empty-ic .fi { line-height: 1; display: inline-flex; }

/* ---------------------------------------------------------------- footer */
.crm-co-foot {
  position: sticky; bottom: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 40px; padding: 26px 0 30px;
  /* clear of the platform's round chat button, fixed bottom-right */
  padding-inline-end: 64px;
  border-top: 1px solid var(--co-line);
  background: var(--co-bg);
}
.crm-co-showing { font-size: 15px; color: var(--co-muted); }
.crm-co-pages { display: flex; align-items: center; gap: 14px; }
.crm-co .crm-co-pbtn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: none; color: var(--co-muted);
  font-size: 18px; cursor: pointer;
}
.crm-co .crm-co-pbtn .fi { line-height: 1; display: inline-flex; }
.crm-co .crm-co-pbtn:hover:not(:disabled) { background: var(--co-line); color: var(--co-ink); }
.crm-co .crm-co-pbtn:disabled { color: #c5cad3; cursor: default; }
.dark .crm-co .crm-co-pbtn:disabled { color: #4a515b; }
.crm-co-pnow {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%;
  background: var(--co-lime); color: var(--co-lime-ink); font-weight: 700; font-size: 15px;
}
.crm-co-pof { font-size: 15px; color: var(--co-muted); margin-inline-end: 4px; }

/* ---------------------------------------------------------------- narrow */
@media (max-width: 900px) {
  .crm-co-inner { padding: 24px 16px 0; }
  .crm-co-tools { width: 100%; }
  .crm-co-find { flex: 1; width: auto; }
  .crm-co .crm-co-card { gap: 16px; padding: 18px; min-height: 0; }
  .crm-co-av { width: 56px; height: 56px; font-size: 22px; }
  .crm-co-meta { gap: 14px; flex-wrap: wrap; font-size: 14px; }
  .crm-co-sep { display: none; }
  .crm-co-titles h1 { font-size: 26px; }
}
@media (max-width: 560px) {
  .crm-co .crm-co-add span { display: none; }
  .crm-co .crm-co-add { width: 48px; padding: 0; justify-content: center; }
}

/* ---------------------------------------------- second design (2026-09-19)
 * A header card with the building mark, then ONE card holding the search,
 * the list and the pager. Full width, like Invoices. */
.crm-co-inner { max-width: none; padding: 24px 24px 24px; }
.crm-co-head {
  align-items: center; justify-content: flex-start; gap: 24px; margin-bottom: 22px; flex-wrap: nowrap;
  padding: 18px 18px; border: 1px solid var(--co-line); border-radius: 8px; background: var(--co-card);
}
.crm-co-heroic {
  flex: none; width: 82px; height: 82px; border-radius: 8px; display: grid; place-items: center;
  background: var(--crm-tint); color: var(--crm-ink); font-size: 36px;
}
.crm-co-heroic .fi { line-height: 1; display: inline-flex; }
.dark .crm-co-heroic { background: rgba(212, 251, 8, .1); color: #d4fb08; }
.crm-co-titles h1 { font-size: 30px; }

.crm-co-panel {
  display: flex; flex-direction: column; flex: 1;
  padding: 18px 24px 0; border: 1px solid var(--co-line); border-radius: 8px; background: var(--co-card);
}
.crm-co-panel > .crm-co-tools { justify-content: flex-end; margin-bottom: 16px; }
.crm-co-panel .crm-co-find { width: 322px; }
.crm-co-panel .crm-co-add { padding: 0 26px; font-size: 17px; }
.crm-co-panel .crm-co-list { gap: 16px; }
.crm-co-panel .crm-co-card { min-height: 122px; padding: 20px 26px; }
.crm-co-panel .crm-co-foot { margin-top: 24px; padding: 20px 0 22px; padding-inline-end: 56px; background: var(--co-card); }
.crm-co-panel .crm-co-empty { background: var(--co-bg); }

@media (max-width: 900px) {
  .crm-co-inner { padding: 16px; }
  .crm-co-head { gap: 14px; }
  .crm-co-heroic { width: 56px; height: 56px; font-size: 24px; }
  .crm-co-panel { padding: 14px 14px 0; }
  .crm-co-panel .crm-co-find { width: auto; }
}

/* ================================================== one company (.crm-cd)
 * Crumb, then two columns: the header, the form and the danger zone on the
 * left; History / Notes / Contacts in one card on the right. */
.crm-cd { padding: 18px 20px 28px; }
.crm-cd-crumb { display: flex; align-items: center; gap: 10px; margin: 2px 0 16px; font-size: 15px; color: var(--co-muted); }
.crm-cd-crumb button { border: 0; background: none; padding: 0; color: var(--co-muted); font: inherit; cursor: pointer; }
.crm-cd-crumb button:hover { color: var(--co-ink); text-decoration: underline; }
.crm-cd-crumb .fi { font-size: 16px; line-height: 1; display: inline-flex; }
.crm-cd-crumb-now { color: var(--co-ink); font-weight: 600; }

.crm-cd-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 480px); gap: 14px; align-items: start; }
.crm-cd-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.crm-cd-card { padding: 22px 24px; border: 1px solid var(--co-line); border-radius: 8px; background: var(--co-card); }

.crm-cd-hero { display: flex; align-items: center; gap: 24px; min-height: 118px; }
.crm-co .crm-cd-av { width: 74px; height: 74px; border-radius: 8px; font-size: 30px; }
.crm-cd-herotext h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.01em; color: var(--co-ink); }
.crm-cd-herotext p { margin: 6px 0 0; font-size: 16px; color: var(--co-soft); }

.crm-cd-cardhead { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.crm-cd-cardhead h2 { margin: 0; font-size: 19px; font-weight: 700; color: var(--co-ink); }
.crm-cd-cardhead p { margin: 6px 0 0; font-size: 15px; color: var(--co-muted); line-height: 1.5; }
.crm-cd-mark { flex: none; width: 56px; height: 56px; border-radius: 8px; display: grid; place-items: center; font-size: 24px; }
.crm-cd-mark .fi { line-height: 1; display: inline-flex; }
.crm-cd-mark.is-blue { background: var(--crm-tint); color: var(--crm-ink); }
.crm-cd-mark.is-red { background: #fde2e1; color: #d92d20; }
.crm-cd-mark.is-grey { background: #f2f4f7; color: #667085; }
.dark .crm-cd-mark.is-blue { background: rgba(212, 251, 8, .1); color: #d4fb08; }
.dark .crm-cd-mark.is-red { background: rgba(252, 165, 165, .12); color: #fca5a5; }
.dark .crm-cd-mark.is-grey { background: #23272d; color: #98a1ad; }

.crm-cd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 22px; margin-bottom: 22px; }
.crm-cd-field { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.crm-cd-field.is-wide { grid-column: 1 / -1; }
.crm-cd-field > span { font-size: 15px; font-weight: 500; color: var(--co-ink); }
.crm-co .crm-cd-input {
  width: 100% !important; height: 42px; margin: 0 !important; padding: 0 14px !important;
  border: 1px solid var(--co-line) !important; border-radius: 8px; box-shadow: none !important; outline: 0;
  background: var(--co-bg) !important; color: var(--co-ink); font: inherit; font-size: 15px;
}
.crm-co .crm-cd-input:focus { border-color: #98a2b3 !important; background: var(--co-card) !important; }
.dark .crm-co .crm-cd-input:focus { border-color: #d4fb08 !important; }
.crm-cd-areawrap { position: relative; }
.crm-co .crm-cd-area { height: 118px; padding: 12px 14px 28px !important; resize: vertical; line-height: 1.5; }
.crm-cd-count { position: absolute; bottom: 10px; inset-inline-end: 14px; font-size: 12.5px; color: var(--co-soft); pointer-events: none; }

.crm-co .crm-cd-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px;
  border: 0; border-radius: 8px; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
.crm-co .crm-cd-btn.is-lime { background: #d4fb08; color: #111; }
.crm-co .crm-cd-btn.is-lime:hover:not(:disabled) { background: #c4ea00; }
.crm-co .crm-cd-btn.is-red { background: #e5484d; color: #fff; font-weight: 600; }
.crm-co .crm-cd-btn.is-red:hover { background: #d13438; }
.crm-co .crm-cd-btn:disabled { opacity: .5; cursor: default; }
.crm-cd-card.is-danger .crm-cd-cardhead { align-items: flex-start; }

/* ---- side panel */
.crm-cd-side { padding: 18px 20px; min-height: calc(100vh - 90px); position: sticky; top: 0; }
.crm-cd-tabs { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border-radius: 8px; background: var(--co-bg); border: 1px solid var(--co-line); margin-bottom: 14px; }
.crm-co .crm-cd-tab { height: 38px; border: 0; border-radius: 8px; background: none; color: var(--co-ink); font: inherit; font-size: 15px; cursor: pointer; white-space: nowrap; }
.crm-co .crm-cd-tab.is-on { background: #d4fb08; color: #111; font-weight: 700; }
.crm-cd-list { display: flex; flex-direction: column; }

.crm-co .crm-cd-item {
  display: flex; align-items: flex-start; gap: 16px; width: 100%; padding: 14px 12px;
  border: 0; border-inline-start: 2px solid var(--co-line); border-radius: 0; background: none;
  color: var(--co-ink); font: inherit; text-align: start;
}
.crm-co button.crm-cd-item { cursor: pointer; }
.crm-co button.crm-cd-item:hover { background: var(--co-bg); }
.crm-cd-lav { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: 600; font-family: Georgia, serif; }
.crm-cd-lav.is-pink { background: #fce7f3; color: #be185d; }
.crm-cd-lav.is-peach { background: var(--co-peach); color: var(--co-peach-ink); }
.crm-cd-lav.is-blue { background: var(--crm-tint); color: var(--crm-ink); font-family: inherit; }
.dark .crm-cd-lav.is-pink { background: rgba(244, 114, 182, .15); color: #f9a8d4; }
.dark .crm-cd-lav.is-blue { background: rgba(212, 251, 8, .1); color: #d4fb08; }
.crm-cd-itembody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.crm-co button.crm-cd-itembody { border: 0; background: none; padding: 0; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.crm-cd-itemtop { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.crm-cd-itembody strong { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-cd-when { flex: none; display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--co-soft); }
.crm-cd-ch { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; background: #eef0f4; color: #475467; font-size: 12px; }
.dark .crm-cd-ch { background: #23272d; color: #b8c0cc; }
.crm-cd-ch .fi { line-height: 1; display: inline-flex; }
.crm-cd-last { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14.5px; color: var(--co-muted); }
.crm-cd-last > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-cd-out { flex: none; font-size: 13px; line-height: 1; display: inline-flex; }
.crm-cd-notetext { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--co-ink); }
.crm-cd-by { font-size: 12.5px; color: var(--co-soft); }

.crm-co .crm-cd-item.is-person { align-items: center; border-inline-start: 0; border-bottom: 1px solid var(--co-line); padding: 12px 4px; }
.crm-co .crm-cd-mini { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--co-line); border-radius: 8px; background: var(--co-card); color: var(--co-muted); cursor: pointer; font-size: 15px; }
.crm-co .crm-cd-mini:hover { color: #d92d20; border-color: #f7c1bd; }
.crm-co .crm-cd-mini.is-add:hover { color: #111; background: #d4fb08; border-color: #d4fb08; }
.crm-cd-mini .fi { line-height: 1; display: inline-flex; }

.crm-cd-addwrap { margin-bottom: 8px; }
.crm-cd-find { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px; border: 1px solid var(--co-line); border-radius: 8px; background: var(--co-bg); color: var(--co-soft); }
.crm-cd-find:focus-within { border-color: #98a2b3; }
.crm-cd-find .fi { line-height: 1; display: inline-flex; font-size: 16px; }
.crm-co .crm-cd-find input { flex: 1; min-width: 0; height: 100% !important; margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; outline: 0 !important; box-shadow: none !important; background: none !important; color: var(--co-ink); font: inherit; font-size: 14.5px; }
.crm-cd-found { display: flex; flex-direction: column; }
.crm-cd-found:not(:empty) { margin-top: 6px; padding: 4px 10px; border: 1px dashed var(--co-line); border-radius: 8px; }
.crm-cd-found .crm-cd-item.is-person:last-child { border-bottom: 0; }

.crm-cd-more { display: flex; align-items: center; justify-content: center; gap: 12px; padding-top: 12px; color: var(--co-muted); font-size: 14px; }
.crm-cd-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 16px; text-align: center; color: var(--co-muted); font-size: 14.5px; }
.crm-cd-empty p { margin: 0; max-width: 300px; line-height: 1.5; }
.crm-cd-muted { margin: 8px 0; color: var(--co-muted); font-size: 14.5px; }
.crm-cd-ghost { height: 74px; flex: 1; border-radius: 8px; background: linear-gradient(90deg, var(--co-card), var(--co-bg), var(--co-card)); background-size: 200% 100%; animation: crm-co-shimmer 1.2s linear infinite; }
.crm-cd-ghost.is-row { height: 64px; }

@media (max-width: 1100px) {
  .crm-cd-cols { grid-template-columns: 1fr; }
  .crm-cd-side { position: static; }
}
@media (max-width: 640px) {
  .crm-cd { padding: 12px 16px 24px; }
  .crm-cd-grid { grid-template-columns: 1fr; }
  .crm-cd-card { padding: 16px; }
}
