/* Simplio CRM · app styles. Sits on top of theme-v2.css, follows DESIGN.md:
   hairline borders, near-black numbers, flat accent, sentence case. */

.crm-loading .wrap { opacity: 0 }
.wrap { padding: 26px 34px 70px; max-width: 1500px; transition: opacity .15s }
.h1 { font-size: 25px; font-weight: 800; letter-spacing: -.02em; color: var(--text); margin: 0 }
.hrow { display: flex; align-items: center; gap: 14px; margin-bottom: 20px }
.hrow .spacer { flex: 1 }

.kpirow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 22px }
.kpi { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-card); padding: 15px 17px }
.kpi .lbl { font-size: 12.5px; color: var(--text-muted); font-weight: 600; margin-bottom: 5px }
.kpi .val { font-size: 26px; font-weight: 800; color: var(--text); letter-spacing: -.02em; line-height: 1.15 }
.kpi .sub { font-size: 12px; color: var(--text-muted); margin-top: 3px }

.section-title { font-size: 15px; font-weight: 800; color: var(--text); margin: 24px 0 11px; letter-spacing: -.01em }
.card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-card); overflow: hidden }

/* toolbar */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap }
.search { display: flex; align-items: center; gap: 8px; background: var(--bg-panel);
  border: 1px solid var(--border); border-radius: var(--r-ctrl); padding: 0 12px; height: 38px; min-width: 260px }
.search input { border: 0; background: transparent; font: inherit; font-size: 14px; color: var(--text);
  outline: none; width: 100% }
.search i { color: var(--text-muted); font-size: 17px }
.btn { height: 38px; padding: 0 15px; border-radius: var(--r-ctrl); font: inherit; font-size: 14px;
  font-weight: 700; cursor: pointer; border: 1px solid var(--border); background: var(--bg-panel);
  color: var(--text); display: inline-flex; align-items: center; gap: 7px }
.btn:hover { border-color: var(--text-muted) }
.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent) }
.btn--primary:hover { background: var(--accent-dim); border-color: var(--accent-dim) }
.btn--ghost { background: transparent }

/* filter bar */
.fb { display: flex; flex-direction: column; gap: 9px; margin-bottom: 14px }
.fb-g { display: flex; align-items: center; gap: 10px; flex-wrap: wrap }
.fb-l { font-size: 12px; font-weight: 700; color: var(--text-muted); width: 74px; flex: none }
.chip-group { display: flex; gap: 6px; flex-wrap: wrap }
.chip { border: 1px solid var(--border); background: var(--bg-panel); color: var(--text-dim);
  border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer }
.chip b { font-weight: 700; color: var(--text-muted); margin-left: 3px }
.chip:hover { border-color: var(--text-muted) }
.chip.active { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent) }
.chip.active b { color: var(--accent) }

/* data table */
.dt { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-card); overflow: hidden }
.dt-head { display: flex; align-items: center; border-bottom: 1px solid var(--border);
  background: var(--bg-elev); position: sticky; top: 0; z-index: 2 }
.dt-head .dt-c { font-size: 12px; font-weight: 700; color: var(--text-muted); cursor: pointer;
  user-select: none; display: flex; align-items: center; gap: 5px; padding: 10px 14px }
.dt-head .dt-c i { font-size: 13px; opacity: .35 }
.dt-head .dt-c.sorted { color: var(--text) }
.dt-head .dt-c.sorted i { opacity: 1; color: var(--accent) }
.dt-head .dt-c.r, .dt-r .dt-c.r { justify-content: flex-end; text-align: right }
.dt-r { display: flex; align-items: center; border-bottom: 1px solid var(--border); cursor: pointer }
.dt-r:last-child { border-bottom: 0 }
.dt-r:hover { background: var(--bg-elev) }
.dt-c { flex: 1; min-width: 0; padding: 11px 14px; font-size: 13.5px; color: var(--text-dim);
  display: flex; align-items: center; gap: 8px; overflow: hidden }
/* A column with no fixed width (empty style="") absorbs leftover row space, so give it a floor
   or a narrow window shrinks it past the point where its text can lay out on one line. Matched
   by the empty style attribute rather than :first-child, because on accounts.html the flexible
   Company column sits second, after a fixed-width checkbox column, and :first-child force-widened
   the checkbox instead and squeezed Company further, clipping its header to a sliver. */
.dt-head .dt-c[style=""], .dt-r .dt-c[style=""] { min-width: 190px }

/* Outreach: pin the Company column so the row stays identifiable while scrolling right to reach
   the status and "Mark as sent" columns. Company sits at a different position in each table
   (rank # comes first in Wave 1), so this is scoped per table by id rather than :first-child. */
#wave1-dt, #all-dt { overflow-x: auto }
#wave1-dt .dt-head .dt-c:nth-child(2), #wave1-dt .dt-r .dt-c:nth-child(2),
#all-dt .dt-head .dt-c:nth-child(1), #all-dt .dt-r .dt-c:nth-child(1) {
  position: sticky; left: 0; z-index: 1;
  background: var(--bg-panel); border-right: 1px solid var(--border);
}
#wave1-dt .dt-head .dt-c:nth-child(2), #all-dt .dt-head .dt-c:nth-child(1) {
  background: var(--bg-elev); z-index: 3;
}
#wave1-dt .dt-r:hover .dt-c:nth-child(2), #all-dt .dt-r:hover .dt-c:nth-child(1) {
  background: var(--bg-elev);
}
.dt-c .strong { font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.dt-c .muted { color: var(--text-muted); font-size: 12.5px }
.dt-more { padding: 12px; text-align: center }
.dt-morebtn { border: 1px solid var(--border); background: var(--bg-panel); color: var(--text-dim);
  border-radius: var(--r-ctrl); padding: 8px 18px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer }
.dt-count { font-size: 12.5px; color: var(--text-muted) }

/* pills */
.cr-pill { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 11.5px;
  font-weight: 700; background: var(--bg-elev); color: var(--text-dim); border: 1px solid var(--border); white-space: nowrap }
.cr-pill.pos { background: rgba(22,163,74,.10); color: var(--pos); border-color: transparent }
.cr-pill.neg { background: rgba(226,75,74,.10); color: var(--neg); border-color: transparent }
.cr-pill.warn { background: rgba(186,117,23,.12); color: var(--warn); border-color: transparent }
.cr-pill.acc { background: var(--accent-soft); color: var(--accent); border-color: transparent }
.avatar { width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none }

/* kanban */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start }
.col { width: 268px; flex: none; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r-card); display: flex; flex-direction: column; max-height: calc(100vh - 260px) }
.col.over { border-color: var(--accent); background: var(--accent-soft) }
.col-h { padding: 12px 14px 10px; border-bottom: 1px solid var(--border) }
.col-h .nm { font-size: 13.5px; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 7px }
.col-h .dot { width: 8px; height: 8px; border-radius: 3px; flex: none }
.col-h .sm { font-size: 12px; color: var(--text-muted); margin-top: 3px }
.col-b { padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; flex: 1 }
.dcard { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 11px;
  padding: 11px 12px; cursor: grab; font-size: 13px }
.dcard:hover { border-color: var(--text-muted) }
.dcard.rot { border-left: 3px solid var(--warn) }
.dcard .t { font-weight: 700; color: var(--text); font-size: 13.5px; margin-bottom: 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.dcard .m { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--text-muted); font-size: 11.5px }
.dcard .v { font-weight: 800; color: var(--text) }

/* drawer */
.cr-scrim { position: fixed; inset: 0; background: rgba(15,31,61,.28); opacity: 0; pointer-events: none;
  transition: opacity .18s; z-index: 60 }
.cr-scrim.on { opacity: 1; pointer-events: auto }
.cr-drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 620px; max-width: 94vw;
  background: var(--bg-panel); border-left: 1px solid var(--border); transform: translateX(100%);
  transition: transform .2s ease; z-index: 61; overflow-y: auto; box-shadow: -8px 0 30px rgba(16,24,40,.06) }
.cr-drawer.on { transform: translateX(0) }
.dr-h { padding: 22px 26px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: var(--bg-panel); z-index: 2 }
.dr-h .nm { font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -.02em }
.dr-h .sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap }
.dr-x { position: absolute; top: 20px; right: 22px; border: 0; background: transparent; cursor: pointer;
  color: var(--text-muted); font-size: 21px }
.dr-s { padding: 18px 26px }
.dr-s + .dr-s { border-top: 1px solid var(--border) }
.dr-t { font-size: 12px; font-weight: 800; color: var(--text-muted); margin-bottom: 11px }
.kv { display: grid; grid-template-columns: 138px 1fr; gap: 7px 14px; font-size: 13.5px }
.kv .k { color: var(--text-muted); font-weight: 600 }
.kv .v { color: var(--text); font-weight: 600; word-break: break-word }
.tl { display: flex; flex-direction: column; gap: 0 }
.tl-i { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--border) }
.tl-i:last-child { border-bottom: 0 }
.tl-ic { width: 26px; height: 26px; border-radius: 8px; background: var(--bg-elev); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; font-size: 14px; flex: none }
.tl-b { flex: 1; min-width: 0 }
.tl-b .tx { font-size: 13.5px; color: var(--text); line-height: 1.5; white-space: pre-wrap; word-break: break-word }
.tl-b .mt { font-size: 11.5px; color: var(--text-muted); margin-top: 4px }
.plist { display: flex; flex-direction: column; gap: 9px }
.pitem { display: flex; align-items: center; gap: 10px; font-size: 13.5px }
.pitem .pn { font-weight: 700; color: var(--text) }
.pitem .pr { color: var(--text-muted); font-size: 12.5px }
textarea.note { width: 100%; border: 1px solid var(--border); border-radius: var(--r-ctrl); padding: 10px 12px;
  font: inherit; font-size: 13.5px; color: var(--text); background: var(--bg-panel); resize: vertical; min-height: 74px }
textarea.note:focus { outline: none; border-color: var(--accent) }
select.sel, input.inp { height: 36px; border: 1px solid var(--border); border-radius: var(--r-ctrl);
  padding: 0 10px; font: inherit; font-size: 13.5px; color: var(--text); background: var(--bg-panel) }
select.sel:focus, input.inp:focus { outline: none; border-color: var(--accent) }

/* toast */
.cr-toast { position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 14px); opacity: 0;
  background: var(--text); color: #fff; padding: 11px 20px; border-radius: 11px; font-size: 13.5px;
  font-weight: 700; z-index: 90; transition: all .22s }
.cr-toast.on { opacity: 1; transform: translate(-50%, 0) }
.cr-toast.bad { background: var(--neg) }

.empty { padding: 26px 18px; font-size: 13.5px; color: var(--text-muted) }
@media (max-width: 900px) {
  .wrap { padding: 18px 14px 70px }
  .kpirow { grid-template-columns: repeat(2, 1fr) }
  .fb-l { width: auto }
}

/* report meters: single hue on a recessive track, near-black values */
.rep { display: grid; grid-template-columns: 1fr 1fr; gap: 14px }
.rep .card { padding: 18px 20px }
.rep h3 { font-size: 14px; font-weight: 800; color: var(--text); margin: 0 0 14px; letter-spacing: -.01em }
.meter { display: grid; grid-template-columns: 1fr; gap: 9px }
.mrow { display: grid; grid-template-columns: 150px 1fr 82px; gap: 12px; align-items: center }
.mrow .ml { font-size: 12.5px; color: var(--text-dim); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.mrow .mt { height: 9px; border-radius: 4px; background: var(--bg-elev); overflow: hidden }
.mrow .mf { height: 100%; border-radius: 4px; background: var(--accent); min-width: 2px }
.mrow .mv { font-size: 13px; font-weight: 800; color: var(--text); text-align: right }
.mrow:hover .mf { background: var(--accent-dim) }
.repnote { font-size: 12px; color: var(--text-muted); margin-top: 12px }
@media (max-width: 1050px) { .rep { grid-template-columns: 1fr } }

/* inline editing */
.ed { cursor: text; border-radius: 6px; padding: 1px 4px; margin: -1px -4px;
  border-bottom: 1px dashed transparent; display: inline-block; max-width: 100% }
.ed:hover { background: var(--bg-elev); border-bottom-color: var(--border) }
.ed .ph { color: var(--text-muted); font-weight: 500 }
.ed .inline { height: 30px; font-size: inherit; font-weight: inherit; min-width: 160px }
.ed textarea.note { min-height: 90px; font-weight: 500 }
.dr-h .nm .ed { font-size: inherit }
.mini { border: 1px solid var(--border); background: var(--bg-panel); color: var(--text-dim);
  border-radius: 7px; padding: 2px 8px; font: inherit; font-size: 11.5px; font-weight: 700;
  cursor: pointer; margin-left: 8px; display: inline-flex; align-items: center; gap: 4px }
.mini:hover { border-color: var(--accent); color: var(--accent) }
.dr-t { display: flex; align-items: center }

/* deal rows */
.dlist { display: flex; flex-direction: column; gap: 8px }
.drow { border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; cursor: pointer }
.drow:hover { border-color: var(--accent) }
.drow .dn { font-size: 13.5px; font-weight: 700; color: var(--text); margin-bottom: 5px }
.drow .dm { display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-muted) }
.drow .dv { font-weight: 800; color: var(--text) }
.drow .ph { color: var(--text-muted); font-weight: 500 }

.pitem .ic { border: 0; background: transparent; color: var(--text-muted); cursor: pointer;
  font-size: 16px; padding: 3px; text-decoration: none; display: inline-flex }
.pitem .ic:hover { color: var(--accent) }
.pitem .ic.del:hover { color: var(--neg) }
.tickbox { width: 17px; height: 17px; border: 1.5px solid var(--border); border-radius: 5px;
  cursor: pointer; flex: none }
.tickbox.on { background: var(--pos); border-color: var(--pos) }
.tickbox:hover { border-color: var(--accent) }

/* modal form */
.cr-modal { position: fixed; inset: 0; background: rgba(15,31,61,.32); display: flex;
  align-items: center; justify-content: center; z-index: 80; opacity: 0; transition: opacity .16s }
.cr-modal.on { opacity: 1 }
.cr-mbox { width: 420px; max-width: 94vw; background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 22px 24px; box-shadow: 0 20px 60px rgba(16,24,40,.18) }
.cr-mt { font-size: 17px; font-weight: 800; color: var(--text); margin-bottom: 16px; letter-spacing: -.01em }
.cr-f { display: block; margin-bottom: 12px }
.cr-f span { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 5px }
.cr-f .inp, .cr-f .sel, .cr-f .note { width: 100% }
.cr-mb { display: flex; gap: 8px; margin-top: 18px; align-items: center }

/* command palette */
.cp { position: fixed; inset: 0; background: rgba(15,31,61,.30); z-index: 95; opacity: 0;
  transition: opacity .14s; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh }
.cp.on { opacity: 1 }
.cp-box { width: 620px; max-width: 94vw; background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: 0 24px 70px rgba(16,24,40,.22); overflow: hidden }
.cp-in { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border) }
.cp-in i { color: var(--text-muted); font-size: 19px }
.cp-in input { flex: 1; border: 0; background: transparent; font: inherit; font-size: 15.5px;
  color: var(--text); outline: none }
.cp-l { max-height: 52vh; overflow-y: auto }
.cp-i { display: flex; align-items: center; gap: 11px; padding: 10px 18px; cursor: pointer }
.cp-i i { color: var(--text-muted); font-size: 17px }
.cp-i.on { background: var(--accent-soft) }
.cp-i.on i, .cp-i.on .cp-t { color: var(--accent) }
.cp-t { font-size: 14px; font-weight: 700; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.cp-s { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.cp-k { font-size: 10.5px; font-weight: 700; color: var(--text-muted); text-transform: none }
.cp-e { padding: 26px 18px; font-size: 13.5px; color: var(--text-muted) }

/* bulk selection */
.dt-r.picked { background: var(--accent-soft) }
.pickbox { width: 16px; height: 16px; border: 1.5px solid var(--border); border-radius: 4px;
  flex: none; cursor: pointer }
.pickbox.on { background: var(--accent); border-color: var(--accent) }
.bulkbar { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px);
  background: var(--text); color: #fff; border-radius: 13px; padding: 10px 14px; display: none;
  align-items: center; gap: 10px; z-index: 70; box-shadow: 0 14px 40px rgba(16,24,40,.24) }
.bulkbar.on { display: flex; transform: translate(-50%, 0) }
.bulkbar .n { font-size: 13.5px; font-weight: 800; padding-right: 4px }
.bulkbar button { background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 9px;
  padding: 7px 13px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer }
.bulkbar button:hover { background: rgba(255,255,255,.26) }

/* sidebar search button */
.v2-search { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0 0 14px;
  padding: 9px 13px; border: 1px solid var(--border); background: var(--bg-panel);
  border-radius: var(--r-ctrl); font: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--text-muted); cursor: pointer }
.v2-search:hover { border-color: var(--accent); color: var(--accent) }
.v2-search i { font-size: 17px }
.v2-search .kbd { margin-left: auto; font-size: 11px; font-weight: 700; border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 6px; color: var(--text-muted) }
.v2-search:hover .kbd { border-color: var(--accent) }

/* merge candidates */
.mg { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-card);
  margin-bottom: 12px; overflow: hidden }
.mg-h { padding: 10px 18px; border-bottom: 1px solid var(--border); background: var(--bg-elev) }
.mg-b { display: grid; grid-template-columns: 1fr 1fr }
.mg-s { padding: 15px 18px; cursor: pointer }
.mg-s:first-child { border-right: 1px solid var(--border) }
.mg-s:hover { background: var(--bg-elev) }
.mg-n { font-size: 15px; font-weight: 800; color: var(--text); margin-bottom: 7px }
.mg-m { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12.5px; color: var(--text-muted) }
.mg-f { display: flex; gap: 9px; padding: 12px 18px; border-top: 1px solid var(--border); flex-wrap: wrap }
@media (max-width: 900px) { .mg-b { grid-template-columns: 1fr }
  .mg-s:first-child { border-right: 0; border-bottom: 1px solid var(--border) } }
.dr-h .nm .src { font-size: 11.5px; font-weight: 600; color: var(--text-muted);
  vertical-align: middle; margin-left: 6px }
