/* ===========================================================================
   crm.css — interactive "Max" Secure Outbound & CRM dashboard (Solution 03)
   Faithful HTML/CSS recreation (no image) of the dark, red-accented calling
   floor. Tokens scoped to .crm. The signature feature — masked numbers — is
   demonstrated live: agents see a name only, never the number.
   =========================================================================== */

.crm-stage { margin: clamp(40px, 6vw, 72px) auto 0; max-width: 1180px; }

.crm {
  --c-bg: #0b0b0d;
  --c-panel: #141416;
  --c-panel2: #18181b;
  --c-soft: #1c1c20;
  --c-line: #27272c;
  --c-text: #f1f1f3;
  --c-text2: #98989f;
  --c-text3: #636369;
  --c-red: #2f72bd;               /* harmonized to Trio blue (token name kept) */
  --c-red2: #205a99;
  --c-red-soft: rgba(47,114,189,.16);
  --c-green: #46b06f;
  --c-green-soft: rgba(70,176,111,.16);
  --c-blue: #5b8cff;
  --c-amber: #d9a23a;

  position: relative;
  border: 1px solid var(--c-line);
  border-radius: 16px;
  background: var(--c-bg);
  color: var(--c-text);
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,.3), 0 36px 80px -34px rgba(0,0,0,.75);
  font-size: 14px;
}

/* ------------------------------ title bar ------------------------------- */
.crm-bar { display: flex; align-items: center; gap: 14px; height: 46px; padding: 0 14px; background: var(--c-panel); border-bottom: 1px solid var(--c-line); }
.crm-dots { display: inline-flex; gap: 7px; }
.crm-dots i { width: 11px; height: 11px; border-radius: 50%; background: #2c2c32; }
.crm-bar-title { font-size: 12.5px; font-weight: 500; color: var(--c-text2); }

/* -------------------------------- body ---------------------------------- */
.crm-body { display: grid; grid-template-columns: 64px 1fr; }

/* icon rail */
.crm-rail {
  border-right: 1px solid var(--c-line);
  background: var(--c-panel);
  padding: 14px 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  min-height: 760px;
}
.crm-logo { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(150deg, #3a86d0, #1f5fa0); color: #fff; margin-bottom: 8px; }
.crm-logo svg { width: 22px; height: 22px; }
.crm-railbtn {
  position: relative; display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 12px;
  color: var(--c-text2); cursor: pointer; transition: background .18s, color .18s;
}
.crm-railbtn svg { width: 21px; height: 21px; }
.crm-railbtn:hover { background: var(--c-soft); color: var(--c-text); }
.crm-railbtn.is-active { background: var(--c-red); color: #fff; }
.crm-railbtn .crm-rb-badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 18px; height: 18px; padding: 0 4px;
  display: grid; place-items: center; font-size: 10px; font-weight: 700;
  border-radius: 9px; background: var(--c-red); color: #fff; border: 2px solid var(--c-panel);
}
.crm-railbtn.is-active .crm-rb-badge { background: #fff; color: var(--c-red); }
.crm-rail-sep { width: 24px; height: 1px; background: var(--c-line); margin: 4px 0; }
.crm-rail-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.crm-ava { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(150deg, #3a86d0, #1f5fa0); color: #fff; font-size: 13px; font-weight: 600; }

/* main */
.crm-main { padding: clamp(16px, 1.8vw, 24px); background: var(--c-bg); min-width: 0; }

.crm-top { display: flex; align-items: center; gap: 16px; }
.crm-search {
  flex: 1; max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 14px;
  background: var(--c-panel); border: 1px solid var(--c-line); border-radius: 12px;
  color: var(--c-text3); font-size: 13.5px;
}
.crm-search svg { width: 16px; height: 16px; }
.crm-search kbd { margin-left: auto; font: inherit; font-size: 11px; padding: 2px 6px; border-radius: 5px; background: var(--c-soft); color: var(--c-text3); }
.crm-top-actions { display: flex; align-items: center; gap: 6px; color: var(--c-text2); }
.crm-topbtn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; cursor: pointer; color: inherit; }
.crm-topbtn:hover { background: var(--c-soft); color: var(--c-text); }
.crm-topbtn svg { width: 18px; height: 18px; }
.crm-lang { font-size: 12px; font-weight: 600; }

/* two columns */
.crm-cols { display: grid; grid-template-columns: 1.25fr 1fr; gap: 20px; margin-top: 22px; align-items: start; }

.crm-h { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 14px; }
.crm-h svg { width: 17px; height: 17px; color: var(--c-red); }

/* callback rows */
.crm-cb { display: flex; align-items: center; gap: 13px; padding: 13px 2px; border-bottom: 1px solid var(--c-line); }
.crm-cb.removing { opacity: 0; transform: translateX(-10px); transition: opacity .3s var(--ease), transform .3s var(--ease); }
.crm-cb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-red); flex: none; }
.crm-cb-txt { font-size: 14px; }
.crm-cb-txt b { font-weight: 700; }
.crm-cb-txt span { color: var(--c-text2); }
.crm-cb-actions { margin-left: auto; display: flex; gap: 8px; }
.crm-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 13px; border: none; border-radius: 999px;
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: filter .2s, transform .2s;
}
.crm-pill:hover { filter: brightness(1.08); transform: translateY(-1px); }
.crm-pill svg { width: 13px; height: 13px; }
.crm-pill--green { background: var(--c-green); color: #062414; }
.crm-pill--red { background: var(--c-red); color: #fff; }

/* big action buttons */
.crm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.crm-bigbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 52px; border-radius: 12px; font: inherit; font-size: 14.5px; font-weight: 600;
  cursor: pointer; transition: filter .2s, transform .2s; color: var(--c-text);
}
.crm-bigbtn svg { width: 17px; height: 17px; }
.crm-bigbtn--red { background: var(--c-red); color: #fff; border: none; box-shadow: 0 12px 28px -12px var(--c-red); }
.crm-bigbtn--ghost { background: var(--c-panel); border: 1px solid var(--c-line); }
.crm-bigbtn:hover { transform: translateY(-1px); filter: brightness(1.05); }

/* last call card */
.crm-lastcall {
  border: 1px solid var(--c-red-soft); border-left: 2px solid var(--c-red);
  border-radius: 14px; padding: 20px; background: linear-gradient(180deg, rgba(47,114,189,.05), var(--c-panel));
}
.crm-lc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.crm-lc-label { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--c-red); }
.crm-lc-label .ld { width: 7px; height: 7px; border-radius: 50%; background: var(--c-red); }
.crm-lc-date { font-size: 12.5px; color: var(--c-text2); }
.crm-lc-date b { color: var(--c-text); }
.crm-lc-contact { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.crm-lc-ava { width: 56px; height: 56px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(150deg,#3a3a40,#222226); color: var(--c-text2); font-size: 16px; font-weight: 700; }
.crm-lc-name { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.crm-lc-org { font-size: 13px; color: var(--c-text2); margin-top: 3px; display: flex; align-items: center; gap: 8px; }
.crm-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.crm-badge .bd { width: 6px; height: 6px; border-radius: 50%; }
.crm-badge--green { background: var(--c-green-soft); color: var(--c-green); }
.crm-badge--green .bd { background: var(--c-green); }
.crm-lc-since { text-align: right; font-size: 11px; letter-spacing: .1em; color: var(--c-text3); margin-top: 12px; }
.crm-lc-since b { color: var(--c-red); }

/* masked number row */
.crm-mask { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 13px; color: var(--c-text2); }
.crm-mask-num { font-variant-numeric: tabular-nums; letter-spacing: .12em; color: var(--c-text); }
.crm-mask-lock { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: #c9a86a; background: rgba(201,168,106,.16); border: none; padding: 4px 9px; border-radius: 999px; cursor: pointer; }
.crm-mask-lock svg { width: 12px; height: 12px; }
.crm-mask-msg { font-size: 12px; color: var(--c-text3); margin-top: 6px; display: none; }
.crm-mask-msg.show { display: block; }

.crm-callnow {
  width: 100%; height: 54px; margin-top: 16px; border: none; border-radius: 12px;
  background: var(--c-red); color: #fff; font: inherit; font-size: 16px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer;
  box-shadow: 0 14px 30px -14px var(--c-red); transition: filter .2s, transform .2s;
}
.crm-callnow svg { width: 18px; height: 18px; }
.crm-callnow:hover { transform: translateY(-1px); filter: brightness(1.05); }
.crm-callnow.is-active { background: #2a2a2e; box-shadow: none; color: var(--c-text); }
.crm-callnow.is-active .crm-cn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-red); animation: crmPulse 1.6s infinite; }

.crm-lc-div { border-top: 1px solid var(--c-line); margin: 18px 0 0; padding-top: 16px; }
.crm-note-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.crm-note-head b { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--c-text2); }
.crm-addnote { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--c-red); background: none; border: 1px solid var(--c-red-soft); padding: 5px 10px; border-radius: 8px; cursor: pointer; }
.crm-addnote svg { width: 13px; height: 13px; }

.crm-note { margin-top: 12px; background: var(--c-panel2); border: 1px solid var(--c-line); border-radius: 10px; padding: 14px; }
.crm-note-q { font-size: 18px; color: var(--c-text3); line-height: 0; }
.crm-note-meta { font-size: 10.5px; letter-spacing: .04em; color: var(--c-red); margin-top: 4px; }
.crm-note-meta span { color: var(--c-text3); }
.crm-note-body { font-size: 13px; color: var(--c-text); margin-top: 6px; }

.crm-notecompose { display: none; margin-top: 10px; gap: 8px; }
.crm-notecompose.show { display: flex; }
.crm-notecompose input { flex: 1; height: 38px; padding: 0 12px; background: var(--c-soft); border: 1px solid var(--c-line); border-radius: 9px; color: var(--c-text); font: inherit; font-size: 13px; }
.crm-notecompose input:focus { outline: none; border-color: var(--c-red); }
.crm-notecompose button { height: 38px; padding: 0 14px; border: none; border-radius: 9px; background: var(--c-red); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }

.crm-shownotes { width: 100%; margin-top: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; background: var(--c-panel2); border: 1px solid var(--c-line); border-radius: 10px; color: var(--c-text2); font: inherit; font-size: 13px; cursor: pointer; }
.crm-shownotes svg { width: 14px; height: 14px; transition: transform .25s var(--ease); }
.crm-shownotes[aria-expanded="true"] svg { transform: rotate(180deg); }
.crm-prevnotes { display: none; flex-direction: column; gap: 10px; margin-top: 10px; }
.crm-prevnotes.show { display: flex; }
.crm-prevnote { background: var(--c-panel2); border: 1px solid var(--c-line); border-radius: 9px; padding: 11px 13px; }
.crm-prevnote .m { font-size: 10.5px; letter-spacing: .04em; color: var(--c-text3); }
.crm-prevnote p { font-size: 13px; color: var(--c-text2); margin-top: 4px; }

/* stat cards */
.crm-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 22px; }
.crm-stat { border: 1px solid var(--c-line); border-radius: 14px; padding: 20px; background: var(--c-panel); }
.crm-stat-lbl { font-size: 11px; font-weight: 700; letter-spacing: .07em; color: var(--c-text3); text-transform: uppercase; }
.crm-stat-num { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1; margin: 16px 0 12px; font-variant-numeric: tabular-nums; }
.crm-stat-num small { font-size: 15px; font-weight: 500; color: var(--c-text3); letter-spacing: 0; }
.crm-stat-sub { font-size: 12px; color: var(--c-text3); }
.crm-stat-sub .ov { color: var(--c-red); margin-left: 8px; }

/* recent contacts */
.crm-recent { margin-top: 30px; }
.crm-recent-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.crm-recent-head h5 { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.crm-goal { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: #fff; background: var(--c-red); border: none; padding: 8px 13px; border-radius: 9px; cursor: pointer; }
.crm-goal svg { width: 14px; height: 14px; }
.crm-goal.is-set { background: var(--c-green); color: #062414; }
.crm-viewall { font-size: 13px; font-weight: 500; color: var(--c-text2); cursor: pointer; }

.crm-table { width: 100%; border-collapse: collapse; }
.crm-table th { text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--c-text3); padding: 12px 10px; border-bottom: 1px solid var(--c-line); }
.crm-table th:last-child, .crm-table td:last-child { text-align: right; }
.crm-table td { padding: 13px 10px; border-bottom: 1px solid var(--c-line); font-size: 13.5px; }
.crm-td-name { display: flex; align-items: center; gap: 10px; }
.crm-td-name .crm-ava { width: 28px; height: 28px; font-size: 11px; border-radius: 8px; background: linear-gradient(150deg,#3a3a40,#222226); color: var(--c-text2); }
.crm-td-name b { font-weight: 600; }
.crm-stage { font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.crm-stage--new { background: rgba(91,140,255,.14); color: var(--c-blue); }
.crm-stage--contacted { background: var(--c-green-soft); color: var(--c-green); }
.crm-stage--interested { background: rgba(217,162,58,.14); color: var(--c-amber); }
.crm-stage--callback { background: var(--c-red-soft); color: var(--c-red); }
.crm-stage--noanswer { background: var(--c-soft); color: var(--c-text3); }
.crm-td-call { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px; background: var(--c-red); color: #fff; border: none; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.crm-td-call svg { width: 12px; height: 12px; }

/* ready status */
.crm-foot { display: flex; justify-content: flex-end; margin-top: 18px; }
.crm-ready { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--c-green); background: var(--c-green-soft); padding: 7px 13px; border-radius: 999px; }
.crm-ready .rd { width: 8px; height: 8px; border-radius: 50%; background: var(--c-green); }
.crm-ready.oncall { color: var(--c-red); background: var(--c-red-soft); }
.crm-ready.oncall .rd { background: var(--c-red); animation: crmPulse 1.6s infinite; }

.crm-cap { margin-top: 16px; text-align: center; font-size: 13px; color: var(--text-2); }
.crm-rowin { animation: crmRowIn .4s var(--ease) both; }

@keyframes crmPulse { 0% { box-shadow: 0 0 0 0 rgba(47,114,189,.5);} 70% { box-shadow: 0 0 0 6px rgba(47,114,189,0);} 100% { box-shadow: 0 0 0 0 rgba(47,114,189,0);} }
@keyframes crmRowIn { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: none; } }

/* ------------------------------ responsive ------------------------------ */
@media (max-width: 1000px) { .crm-cols { grid-template-columns: 1fr; } .crm-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) {
  .crm-rail { display: none; }
  .crm-body { grid-template-columns: 1fr; }
  .crm-search kbd { display: none; }
}
@media (max-width: 560px) {
  .crm-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .crm-actions { grid-template-columns: 1fr; }
  .crm-table th:nth-child(2), .crm-table td:nth-child(2),
  .crm-table th:nth-child(4), .crm-table td:nth-child(4) { display: none; }
}
