/* Clients. Scoped under #clientsView, which redeclares its own tokens the way
   #onboardingView does, so nothing here depends on the legacy page CSS in
   index.html and nothing here leaks back out to it. */

#clientsView {
  --iv: #F5F2E9; --iv2: #EDE9DC; --iv3: #E2DDD1; --iv4: #D6D0C0;
  --fr: #0B1F10; --fr2: #122618; --frl: #2B5038;
  --co: #FF4B3B; --co-l: #FF7A6E; --co-fill: #D93A2B; --co-on: #FFFFFF;
  --co-d: #C83528; --co-line: #F24738; --co-rgb: 255,75,59;
  --ink: #0F0F0D; --ink2: #4A4843; --ink3: #706D68; --ink4: #8B877E;
  --hot: #BC2F23; --ok: #0A6B5F; --warn: #8F6110;
  --spring: cubic-bezier(.32,.72,0,1);
  --ease: cubic-bezier(.4,0,.2,1);
  --open: 680ms;

  position: fixed; inset: 0; z-index: 100;
  overflow-y: auto; overflow-x: hidden;
  background: var(--iv);
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--ink);
  max-width: none; margin: 0; padding: 0; animation: none;
  -webkit-font-smoothing: antialiased;
}
#clientsView * { box-sizing: border-box; }
#clientsView button { font-family: inherit; cursor: pointer; }
#clientsView input { font-family: inherit; }
#clientsView .cl-serif { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; }

/* ---------- top bar ---------- */
#clientsView .cl-top {
  position: sticky; top: 0; z-index: 60; height: 60px;
  display: flex; align-items: center; padding: 0 22px;
  border-bottom: 1px solid var(--iv3); background: var(--iv);
}
#clientsView .cl-back {
  display: flex; align-items: center; gap: 8px; background: none; border: 0;
  font-size: 13.5px; font-weight: 600; color: var(--ink2); padding: 8px 2px;
}
#clientsView .cl-back:hover { color: var(--co-d); }
#clientsView .cl-back svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }
#clientsView .cl-brand {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 15px;
}
#clientsView .cl-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--fr); color: var(--co);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 11px;
}

/* ---------- masthead ---------- */
#clientsView .cl-mast {
  max-width: 720px; margin: 0 auto; padding: 40px 20px 22px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
}
#clientsView .cl-mast h1 {
  font-size: 3.2rem; line-height: .95; letter-spacing: -.02em; margin: 0;
  transform-origin: left bottom;
}
#clientsView .cl-mast h1 em { font-style: italic; color: var(--co-d); }
#clientsView .cl-mast p { font-size: 12.5px; color: var(--ink3); margin-top: 9px; }
#clientsView .cl-new {
  background: var(--fr); color: var(--co); border: 0; border-radius: 100px;
  padding: 10px 18px; font-size: 12.5px; font-weight: 700; flex-shrink: 0;
  transition: transform .14s var(--ease), background .18s;
}
#clientsView .cl-new:hover { background: var(--fr2); transform: translateY(-2px); }

/* ---------- sticky utility bar ----------
   sticky + z-index makes this a stacking context, so the sort menu's z-index is
   scoped inside it. It must therefore outrank every .cl-pass (40 when open). */
#clientsView .cl-util {
  position: sticky; top: 60px; z-index: 50;
  background: rgba(245,242,233,.9); backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent; transition: border-color .3s var(--ease);
}
#clientsView .cl-util.cl-stuck { border-bottom-color: var(--iv3); }
#clientsView .cl-utilin {
  max-width: 720px; margin: 0 auto; padding: 11px 20px;
  display: flex; align-items: center; gap: 12px;
}
#clientsView .cl-mini {
  font-size: 1.15rem; line-height: 1; opacity: 0; transform: translateY(6px);
  transition: opacity .3s, transform .35s var(--spring);
  pointer-events: none; white-space: nowrap; flex-shrink: 0; width: 0; overflow: hidden;
}
#clientsView .cl-util.cl-stuck .cl-mini { opacity: 1; transform: none; width: auto; margin-right: 2px; }

#clientsView .cl-search {
  display: flex; align-items: center; gap: 8px; background: #fff;
  border: 1px solid var(--iv3); border-radius: 100px; padding: 7px 14px; width: 190px;
  transition: width .42s var(--spring), border-color .2s, box-shadow .2s;
}
#clientsView .cl-search:focus-within { width: 290px; border-color: var(--co-line); box-shadow: 0 0 0 3px rgba(var(--co-rgb),.1); }
#clientsView .cl-search svg { width: 14px; height: 14px; stroke: var(--ink3); fill: none; stroke-width: 2; flex-shrink: 0; transition: stroke .2s; }
#clientsView .cl-search:focus-within svg { stroke: var(--co-line); }
#clientsView .cl-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 13px; color: var(--ink); }
#clientsView .cl-search input::placeholder { color: #BDB8AE; }
#clientsView .cl-clr { border: 0; background: none; color: var(--ink3); font-size: 15px; line-height: 1; padding: 0 2px; display: none; }
#clientsView .cl-search.cl-filled .cl-clr { display: block; }

#clientsView .cl-seg {
  position: relative; display: flex; background: var(--iv2);
  border: 1px solid var(--iv3); border-radius: 100px; padding: 3px; flex-shrink: 0;
}
#clientsView .cl-pill {
  position: absolute; top: 3px; bottom: 3px; border-radius: 100px; background: #fff;
  box-shadow: 0 2px 6px rgba(15,15,13,.1);
  transition: transform .42s var(--spring), width .42s var(--spring);
}
#clientsView .cl-seg button {
  position: relative; z-index: 1; border: 0; background: none; padding: 6px 15px;
  border-radius: 100px; font-size: 12.5px; font-weight: 600; color: var(--ink3);
  transition: color .25s; white-space: nowrap;
}
#clientsView .cl-seg button.cl-on { color: var(--ink); }
#clientsView .cl-seg button b { font-weight: 700; opacity: .5; margin-left: 4px; }
#clientsView .cl-tally { font-size: 11.5px; font-weight: 600; color: var(--ink3); flex-shrink: 0; }

/* ---------- sort ---------- */
#clientsView .cl-sortwrap { position: relative; margin-left: auto; flex-shrink: 0; }
#clientsView .cl-sortbtn {
  display: flex; align-items: center; gap: 7px; background: none;
  border: 1px solid transparent; border-radius: 100px; padding: 7px 11px;
  font-size: 12.5px; font-weight: 600; color: var(--ink2);
  transition: all .2s var(--ease); white-space: nowrap;
}
#clientsView .cl-sortbtn:hover, #clientsView .cl-sortbtn.cl-open { border-color: var(--iv3); background: #fff; }
#clientsView .cl-sortbtn .cl-ic { width: 14px; height: 14px; stroke: var(--ink3); fill: none; stroke-width: 1.9; flex-shrink: 0; }
#clientsView .cl-sortbtn .cl-cv { width: 11px; height: 11px; stroke: var(--ink3); fill: none; stroke-width: 2.4; transition: transform .35s var(--spring); }
#clientsView .cl-sortbtn.cl-open .cl-cv { transform: rotate(180deg); }
#clientsView .cl-sortmenu {
  position: absolute; top: calc(100% + 8px); right: 0; width: 212px; background: #fff;
  border: 1px solid var(--iv3); border-radius: 14px; padding: 6px;
  box-shadow: 0 22px 50px rgba(15,15,13,.18); z-index: 70;
  opacity: 0; transform: translateY(-8px) scale(.97); transform-origin: top right;
  pointer-events: none; transition: opacity .2s var(--ease), transform .28s var(--spring);
}
#clientsView .cl-sortmenu.cl-show { opacity: 1; transform: none; pointer-events: auto; }
#clientsView .cl-sortmenu button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: 0; padding: 9px 10px; border-radius: 9px;
  font-size: 13px; color: var(--ink); font-weight: 500;
}
#clientsView .cl-sortmenu button:hover { background: var(--iv); }
#clientsView .cl-sortmenu button.cl-on { font-weight: 700; }
#clientsView .cl-sortmenu .cl-tick { width: 14px; height: 14px; stroke: var(--co-line); fill: none; stroke-width: 2.6; flex-shrink: 0; opacity: 0; }
#clientsView .cl-sortmenu button.cl-on .cl-tick { opacity: 1; }
#clientsView .cl-sortmenu hr { border: 0; border-top: 1px solid var(--iv3); margin: 5px 8px; }

/* ---------- stack ---------- */
#clientsView .cl-stackwrap { max-width: 720px; margin: 0 auto; padding: 18px 20px 110px; }
#clientsView .cl-stack { position: relative; transition: height var(--open) var(--spring); }
#clientsView .cl-pass {
  position: absolute; left: 0; right: 0; top: 0; background: #fff;
  border-radius: 20px; overflow: hidden;
  box-shadow: 0 -1px 0 rgba(15,15,13,.04), 0 12px 30px rgba(15,15,13,.09);
  transition: transform var(--open) var(--spring), height var(--open) var(--spring),
              box-shadow .45s var(--ease), opacity .34s var(--ease);
}
#clientsView .cl-pass:hover:not(.cl-open) { box-shadow: 0 -1px 0 rgba(15,15,13,.04), 0 18px 40px rgba(15,15,13,.14); }
#clientsView .cl-pass.cl-open { box-shadow: 0 34px 74px rgba(15,15,13,.2); }
#clientsView .cl-pass.cl-leaving { opacity: 0; transform: translateY(var(--ty)) scale(.94) !important; }
#clientsView .cl-edge { height: 5px; transition: height .4s var(--spring); }
#clientsView .cl-pass.cl-open .cl-edge { height: 8px; }
#clientsView .cl-band { display: flex; align-items: center; gap: 13px; padding: 19px 22px; height: 78px; cursor: pointer; }
#clientsView .cl-bname { font-size: 1.4rem; line-height: 1.1; flex-shrink: 0; }
#clientsView .cl-bsub { font-size: 12.5px; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#clientsView .cl-bslot { font-size: 12.5px; color: var(--co-d); font-weight: 600; white-space: nowrap; }
#clientsView .cl-bright { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
#clientsView .cl-caret { width: 21px; height: 21px; stroke: var(--ink3); fill: none; stroke-width: 2.2; transition: transform .5s var(--spring); }
#clientsView .cl-pass.cl-open .cl-caret { transform: rotate(180deg); }
#clientsView .cl-flag {
  font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--co-d); border: 1px solid rgba(var(--co-rgb),.35); border-radius: 100px;
  padding: 2px 8px; flex-shrink: 0;
}
#clientsView .cl-archtag {
  font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink3); border: 1px solid var(--iv3); border-radius: 100px; padding: 2px 8px; flex-shrink: 0;
}
#clientsView .cl-pass.cl-archived { background: #FCFAF4; }
#clientsView .cl-pass.cl-archived .cl-bname { color: var(--ink3); }

/* journey pip on the name bar */
#clientsView .cl-pip { display: flex; align-items: center; gap: 2.5px; flex-shrink: 0; }
#clientsView .cl-pip i { width: 9px; height: 4px; border-radius: 2px; background: var(--iv3); }
#clientsView .cl-pip i.cl-done { background: var(--frl); }
#clientsView .cl-pip i.cl-now { width: 15px; }
#clientsView .cl-pipwrap { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
#clientsView .cl-pipn { font-size: 9.5px; font-weight: 700; color: var(--ink3); background: var(--iv2); border-radius: 100px; padding: 1px 6px; }
#clientsView .cl-pipnone { font-size: 10px; font-weight: 600; color: #C4BFB5; letter-spacing: .04em; }

/* ---------- expanded body ---------- */
#clientsView .cl-body { padding: 6px 22px 24px; }
#clientsView .cl-rvl { opacity: 0; transform: translateY(14px); }
#clientsView .cl-pass.cl-open .cl-rvl {
  opacity: 1; transform: none;
  transition: opacity .46s var(--ease), transform .58s var(--spring);
  transition-delay: calc(var(--i) * 62ms + 150ms);
}
#clientsView .cl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 26px; }
#clientsView .cl-f label {
  display: block; font-size: 10px; font-weight: 700; letter-spacing: .11em;
  text-transform: uppercase; color: var(--ink3); margin-bottom: 7px;
}
#clientsView .cl-f input, #clientsView .cl-f select {
  width: 100%; border: 0; border-bottom: 1.5px solid var(--iv3); background: none;
  font-size: 15.5px; color: var(--ink); padding: 3px 0 9px; outline: none;
  border-radius: 0; transition: border-color .18s;
}
#clientsView .cl-f input:focus, #clientsView .cl-f select:focus { border-bottom-color: var(--co-line); box-shadow: none; }
#clientsView .cl-f input.cl-empty { border-bottom-style: dotted; border-bottom-color: #D3CEC3; }
#clientsView .cl-f input::placeholder { color: #C4BFB5; }
#clientsView .cl-sech {
  font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink3); margin: 26px 0 14px;
}

/* journey rail, one per listing */
#clientsView .cl-rail { margin-bottom: 26px; }
#clientsView .cl-railtop { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
#clientsView .cl-railtop b { font-size: 14px; font-weight: 600; flex: 1; }
#clientsView .cl-railtop small { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
#clientsView .cl-track { position: relative; height: 11px; margin: 0 5px 9px; }
#clientsView .cl-track .cl-base { position: absolute; left: 0; right: 0; top: 4.5px; height: 2px; background: var(--iv3); border-radius: 2px; }
#clientsView .cl-track .cl-fill { position: absolute; left: 0; top: 4.5px; height: 2px; border-radius: 2px; width: 0; }
#clientsView .cl-pass.cl-open .cl-track .cl-fill {
  width: var(--w); transition: width .8s var(--spring);
  transition-delay: calc(var(--i) * 62ms + 330ms);
}
#clientsView .cl-stop {
  position: absolute; top: 0; width: 11px; height: 11px; border-radius: 50%;
  background: #fff; border: 2px solid var(--iv3); margin-left: -5.5px;
}
#clientsView .cl-stop.cl-done { border-color: var(--frl); background: var(--frl); }
#clientsView .cl-stop.cl-nowstop { border-color: var(--c); background: #fff; }
#clientsView .cl-stoplabels {
  display: flex; justify-content: space-between; font-size: 9.5px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: #BDB8AE;
}
#clientsView .cl-stoplabels span { flex: 1; text-align: center; }
#clientsView .cl-stoplabels span:first-child { text-align: left; }
#clientsView .cl-stoplabels span:last-child { text-align: right; }
#clientsView .cl-stoplabels span.cl-on { color: var(--ink2); }
#clientsView .cl-nojourney {
  font-size: 13px; color: var(--ink3); line-height: 1.6; background: var(--iv);
  border: 1px dashed var(--iv3); border-radius: 12px; padding: 15px 17px;
}
#clientsView .cl-nojourney b { display: block; color: var(--ink2); font-size: 13.5px; margin-bottom: 3px; }

/* deliverables */
#clientsView .cl-deliv { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--iv3); font-size: 13.5px; }
#clientsView .cl-deliv a { color: var(--ink); font-weight: 600; text-decoration: none; flex: 1; }
#clientsView .cl-deliv a:hover { color: var(--co-d); text-decoration: underline; }
#clientsView .cl-deliv span.cl-dtype { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink3); }
#clientsView .cl-deliv small { font-size: 11px; color: var(--ink3); }
#clientsView .cl-delivnone { font-size: 12.5px; color: #BDB8AE; padding: 4px 0 6px; }

/* actions */
#clientsView .cl-acts { display: flex; align-items: center; gap: 12px; margin-top: 26px; }
#clientsView .cl-save {
  flex: 1; background: var(--fr); color: var(--co); border: 0; border-radius: 100px;
  padding: 13px; font-weight: 700; font-size: 13.5px;
  transition: background .18s, transform .12s var(--ease);
}
#clientsView .cl-save:hover { background: var(--fr2); }
#clientsView .cl-save:active { transform: scale(.985); }
#clientsView .cl-save[disabled] { opacity: .55; cursor: default; }
#clientsView .cl-arch {
  display: flex; align-items: center; gap: 7px; background: none; border: 1px solid var(--iv3);
  border-radius: 100px; padding: 12px 18px; font-size: 12.5px; font-weight: 600;
  color: var(--ink2); transition: all .2s var(--ease); flex-shrink: 0;
}
#clientsView .cl-arch:hover { border-color: var(--co-line); color: var(--co-d); background: rgba(var(--co-rgb),.04); }
#clientsView .cl-arch svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; }
#clientsView .cl-ghost {
  background: none; border: 1px solid var(--iv3); border-radius: 100px; padding: 12px 18px;
  font-size: 12.5px; font-weight: 600; color: var(--ink2); flex-shrink: 0;
}
#clientsView .cl-ghost:hover { border-color: var(--ink3); }

/* states */
#clientsView .cl-none { text-align: center; padding: 56px 20px; }
#clientsView .cl-none p { font-size: 14px; color: var(--ink3); }
#clientsView .cl-none button {
  margin-top: 18px; background: var(--fr); color: var(--co); border: 0;
  border-radius: 100px; padding: 12px 22px; font-size: 13px; font-weight: 700;
}
#clientsView .cl-skel { height: 78px; border-radius: 20px; background: #fff; margin-bottom: 12px; opacity: .55; }

/* undo toast */
#clientsView .cl-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 90px); z-index: 120;
  background: var(--fr); color: var(--iv); border-radius: 100px;
  padding: 13px 16px 13px 22px; display: flex; align-items: center; gap: 18px;
  font-size: 13px; box-shadow: 0 20px 44px rgba(11,31,16,.34);
  opacity: 0; transition: transform .5s var(--spring), opacity .3s; pointer-events: none;
}
#clientsView .cl-toast.cl-show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
#clientsView .cl-toast button { background: none; border: 0; color: var(--co); font-size: 13px; font-weight: 700; }
#clientsView .cl-toast button:hover { text-decoration: underline; }

@media (max-width: 620px) {
  #clientsView .cl-mast h1 { font-size: 2.4rem; }
  #clientsView .cl-grid { grid-template-columns: 1fr; }
  #clientsView .cl-utilin { flex-wrap: wrap; }
  #clientsView .cl-search, #clientsView .cl-search:focus-within { width: 100%; }
  #clientsView .cl-sortwrap { margin-left: 0; }
  #clientsView .cl-bsub { display: none; }
}
