/* =========================================================================
   views/content.css — Client Content tab + Content Sharing (list / create / finder / share cards)
   Split from the old monolithic styles/views.css. LOAD ORDER MATTERS:
   the <link> order in Magnet CRM.html / Client App.html reproduces the
   original file order, so the cascade is unchanged — add new rules to the
   matching feature file, not the end of the list.
   ========================================================================= */
/* ===== Content (client-detail Content tab) ============================ */
/* the Sharing|Scheduling segmented + New share/Compose live in the shared
   toolbar row (contentToolbar → clientDetailToolbar), not in a second bar */
.content-hub { display: flex; flex-direction: column; height: 100%; min-height: 0; }

/* ===== Content Schedule route (top-level) ============================= */
/* the route hosts the SAME .content-hub surface; only the landing client
   picker is new (centred card + search, no client selected yet) */
.content-schedule { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.content-schedule > .content-hub { flex: 1 1 auto; min-height: 0; }
.cs-clientchip { display: inline-flex; align-items: center; gap: 8px; }
.cs-clientchip svg:last-child { width: 14px; height: 14px; opacity: .6; }

.cs-picker { position: relative; flex: 1 1 auto; display: flex; align-items: flex-start; justify-content: center; padding: clamp(24px, 8vh, 72px) var(--space-4) var(--space-6); overflow: hidden; }
/* ambient brand-card spread behind the picker (decorative; .cs-bg is built in
   contentSchedulePage from the clients already in memory). The gradient wash
   sits on top of the tiles so the middle stays clean enough to read. */
.cs-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
/* the wash: a cool blue haze bottom-left, a mint one bottom-right and a soft
   white bloom behind the picker — the reference's "frosted studio" feel */
.cs-bg::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(42% 42% at 50% 36%, color-mix(in srgb, var(--surface) 82%, transparent) 40%, color-mix(in srgb, var(--surface) 30%, transparent) 74%, transparent 100%),
    radial-gradient(72% 58% at 14% 86%, color-mix(in srgb, var(--primary-500) 30%, transparent), transparent 62%),
    radial-gradient(64% 54% at 88% 92%, color-mix(in srgb, var(--primary-400, var(--primary-500)) 24%, transparent), transparent 62%),
    radial-gradient(62% 48% at 94% 8%, color-mix(in srgb, var(--primary-300, var(--primary-500)) 20%, transparent), transparent 60%),
    /* the flat veil that frosts the whole spread — the reference's pastel look
       comes from this, not from fading each card */
    linear-gradient(color-mix(in srgb, var(--surface) 44%, transparent), color-mix(in srgb, var(--surface) 44%, transparent));
}
/* the fan: cards dealt in a rainbow arc across the centre — clean white
   border, layered shadow, and a touch of 3D so the outer cards turn inward.
   The row is wider than the viewport on purpose: the end cards clip off both
   edges (.cs-picker's overflow:hidden does the cutting). */
.cs-fan {
  position: absolute; left: 50%; top: 42%;
  transform: translate(-50%, -50%);
  /* wider than the route so the end cards always run off both edges */
  width: 116%;
  display: flex; align-items: center; justify-content: center;
  perspective: 900px; perspective-origin: 50% 42%; transform-style: flat;
}
.cs-fan-card {
  flex: 1 1 0; min-width: 0; max-width: 260px; aspect-ratio: 9 / 16;
  margin-inline: -14px;
  transform: translateY(var(--dy)) rotate(var(--r)) rotateY(var(--ry)) rotateX(var(--rx)) skewY(var(--sk));
  border-radius: 22px;
  background-color: var(--gray-100);
  background-size: cover; background-position: center;
  background-clip: padding-box;
  /* thin dark hairline INSIDE the edge instead of a white frame */
  box-shadow: inset 0 0 0 2px rgba(15, 23, 42, .26), 0 34px 66px rgba(15, 23, 42, .28), 0 6px 16px rgba(15, 23, 42, .16);
}
/* reel chrome overlaid on each fan card */
.cs-fan-card { position: relative; overflow: hidden; }
.cs-fan-card::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 42%;
  background: linear-gradient(transparent, rgba(0, 0, 0, .48));
  pointer-events: none;
}
.cs-fan-rail { position: absolute; right: 9px; bottom: 16px; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 13px; color: #fff; }
.cs-fan-rail svg { width: 17px; height: 17px; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .55)); }
.cs-fan-id { position: absolute; left: 11px; right: 40px; bottom: 14px; z-index: 1; display: flex; align-items: center; gap: 6px; min-width: 0; }
.cs-fan-av { width: 21px; height: 21px; flex: none; border-radius: 50%; background-size: cover; background-position: center; box-shadow: 0 0 0 1px rgba(255, 255, 255, .75); }
.cs-fan-av--mono { display: inline-flex; align-items: center; justify-content: center; background: var(--lc); color: #fff; font-size: 9px; font-weight: var(--fw-bold); }
.cs-fan-name { color: #fff; font-size: 11px; font-weight: var(--fw-semibold); text-shadow: 0 1px 2px rgba(0, 0, 0, .55); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-fan-follow { flex: none; padding: 1.5px 8px; border: 1px solid rgba(255, 255, 255, .85); border-radius: 7px; color: #fff; font-size: 9.5px; font-weight: var(--fw-semibold); text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
@media (max-width: 1200px) { .cs-fan-card { margin-inline: -12px; } }
@media (max-width: 900px) { .cs-fan-card { margin-inline: -10px; } }
.cs-picker-card {
  position: relative; width: 100%; max-width: 460px;
  background: var(--surface, #fff); border: 1px solid var(--border);
  border-radius: var(--radius-lg, 14px); padding: var(--space-5, 20px);
  box-shadow: 0 18px 44px rgba(15, 23, 42, .14), 0 4px 12px rgba(15, 23, 42, .08);
}
.cs-picker-title { margin: 0; font-size: var(--fs-xl, 20px); font-weight: var(--fw-semibold, 600); }
.cs-picker-sub { margin: 4px 0 16px; color: var(--gray-500); font-size: var(--fs-sm, 13px); }
.cs-search { position: relative; display: flex; align-items: center; }
.cs-search svg { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--gray-400); pointer-events: none; }
.cs-search .input { width: 100%; padding-left: 34px; }
.cs-list { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; max-height: min(52vh, 420px); overflow: auto; }
.cs-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; background: none; border: 0; border-radius: var(--radius-md, 10px); cursor: pointer; text-align: left; font: inherit; color: inherit; }
/* display:flex outranks the [hidden] attribute — the search filter sets
   row.hidden, so it needs this to actually take rows off the list */
.cs-row[hidden] { display: none; }
.cs-row:hover, .cs-row:focus-visible { background: var(--gray-100); }
.cs-row-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--fw-medium, 500); }
.cs-row > svg:last-child { width: 16px; height: 16px; color: var(--gray-400); flex-shrink: 0; }
.cs-empty { margin: 14px 4px; color: var(--gray-500); font-size: var(--fs-sm, 13px); }
.ch-tabs button { display: inline-flex; align-items: center; gap: 6px; }
.ch-tabs button svg { width: 15px; height: 15px; }
.ch-body { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }

/* ===== Content Sharing (Content tab › sharing) ======================== */
.cs { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }

/* the create/edit surface slides in from the right like a pushed screen;
   the back button slides it out and the list eases back in from the left */
@keyframes csPushIn { from { transform: translateX(36px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes csPushOut { from { transform: none; opacity: 1; } to { transform: translateX(36px); opacity: 0; } }
@keyframes csBackIn { from { transform: translateX(-22px); opacity: 0; } to { transform: none; opacity: 1; } }
/* match the lead detail side sheet: same duration (--dur-slow) + easing (--ease) */
.cs-create { animation: csPushIn var(--dur-slow) var(--ease); }
.cs-create.is-leaving { animation: csPushOut var(--dur-slow) var(--ease) forwards; }
.cs-list-wrap.cs-enter-back { animation: csBackIn var(--dur-slow) var(--ease); }
@media (prefers-reduced-motion: reduce) {
  .cs-create, .cs-create.is-leaving, .cs-list-wrap.cs-enter-back { animation: none; }
}

/* shared video poster tile (placeholder gradient + play glyph) */
.cs-thumb {
  position: relative; display: block; aspect-ratio: 16 / 9;
  border-radius: var(--radius-md); overflow: hidden; flex: none; background: var(--gray-200);
}
.cs-thumb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* liquid-glass play button (every admin thumbnail) */
.cs-thumb-play {
  position: absolute; inset: 0; margin: auto; z-index: 1;
  width: 46px; height: 46px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full); color: #fff; overflow: hidden;
  background: linear-gradient(145deg, rgba(255, 255, 255, .34), rgba(255, 255, 255, .08));
  border: 1px solid rgba(255, 255, 255, .45);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  backdrop-filter: blur(12px) saturate(180%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .28), inset 0 1px 1.5px rgba(255, 255, 255, .8), inset 0 -8px 16px rgba(255, 255, 255, .05);
}
.cs-thumb-play::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(125% 85% at 50% 0%, rgba(255, 255, 255, .6), rgba(255, 255, 255, 0) 60%);
}
.cs-thumb-play svg { position: relative; z-index: 1; width: 18px; height: 18px; margin-left: 2px; fill: currentColor; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .28)); }
.cs-thumb-dur {
  position: absolute; right: 6px; bottom: 6px; padding: 1px 6px;
  border-radius: var(--radius-xs); background: rgba(0, 0, 0, .55); color: #fff;
  font-size: var(--text-2xs); font-weight: var(--fw-semibold);
}

/* ---- list surface ---- */
.cs-list-wrap { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; padding: var(--space-6); }
.cs-list-wrap--empty { padding: 0; }
.cs-loading { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; min-height: 40vh; color: var(--text-soft); }
.cs-spin { display: inline-flex; animation: spin 0.9s linear infinite; }
.cs-spin svg { width: 26px; height: 26px; }
.cs-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-5); }
.cs-head-l { display: flex; flex-direction: column; gap: 2px; }
.cs-title { font-size: var(--text-xl); font-weight: var(--fw-bold); color: var(--text-strong); letter-spacing: -0.01em; }
.cs-sub { font-size: var(--text-sm); color: var(--text-soft); }
.cs-list { display: flex; flex-direction: column; gap: var(--space-3); overflow-y: auto; flex: 1 1 auto; min-height: 0; padding-bottom: var(--space-4); }

.cs-card {
  display: flex; align-items: stretch; gap: var(--space-4);
  padding: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .cs-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
}
/* the cover's soft right shadow bleeds under the content; the card's overflow
   clips the top/left/bottom so only the rightward shadow shows */
.cs-card-thumbs { position: relative; width: 150px; flex: none; align-self: stretch; box-shadow: 10px 0 22px -6px rgba(0, 0, 0, .22); }
.cs-thumb--card { width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; }
.cs-thumb--card .cs-thumb-play { display: none; }   /* no play overlay on the list card */
.cs-thumb-count {
  position: absolute; right: 6px; top: 6px; display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: var(--radius-xs); background: rgba(0, 0, 0, .55); color: #fff;
  font-size: var(--text-2xs); font-weight: var(--fw-semibold);
}
.cs-thumb-count svg { width: 12px; height: 12px; }

.cs-card-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: var(--space-3) 0; }
.cs-card-top { display: flex; align-items: center; gap: var(--space-2); }
.cs-card-name { font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-badge { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: var(--radius-full); font-size: var(--text-2xs); font-weight: var(--fw-semibold); flex: none; }
.cs-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.cs-badge--live { color: var(--success-600); background: var(--success-bg); }
.cs-badge--off { color: var(--text-soft); background: var(--surface-sunk); }
.cs-card-meta { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-soft); }
.cs-card-meta .cs-dot { color: var(--border-strong); }
.cs-views { display: inline-flex; align-items: center; gap: 4px; }
.cs-views svg { width: 14px; height: 14px; }
.cs-linkrow { display: flex; align-items: center; gap: var(--space-2); margin-top: 2px; min-width: 0; }
.cs-link { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; height: 30px; padding: 0 10px; border-radius: var(--radius-sm); background: var(--surface-sunk); color: var(--text-muted); font-size: var(--text-sm); cursor: pointer; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
@media (hover: hover) and (pointer: fine) {
  .cs-link:hover { background: var(--surface-hover-strong); color: var(--text); }
  .cs-link:hover .cs-link-copy { color: var(--primary-600); }
}
.cs-link svg { width: 14px; height: 14px; color: var(--text-soft); flex: none; }
.cs-link-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cs-link-copy { display: inline-flex; flex: none; color: var(--text-soft); transition: color var(--dur) var(--ease); }
.cs-link.is-copied { color: var(--success-600); background: var(--success-bg); }
.cs-link.is-copied svg, .cs-link.is-copied .cs-link-copy { color: var(--success-600); }
.cs-card-actions { display: flex; align-items: center; gap: var(--space-2); flex: none; align-self: flex-start; padding: var(--space-3) var(--space-4) 0 0; }
.cs-open svg { width: 15px; height: 15px; }

/* ---- create surface ---- */
.cs-create { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.cs-create-head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--border); }
.cs-back svg { width: 18px; height: 18px; }
.cs-create-titles { display: flex; flex-direction: column; gap: 1px; }
.cs-create-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: var(--space-6); }
.cs-create-inner { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-5); }
.cs-field { display: flex; flex-direction: column; gap: var(--space-2); }
.cs-field-label { font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text); }

.cs-drop {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
  padding: var(--space-8) var(--space-5); text-align: center; cursor: pointer;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-sunk);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .cs-drop:hover { border-color: var(--primary-400); background: color-mix(in srgb, var(--primary-500) 4%, var(--surface)); }
}
.cs-drop--over { border-color: var(--primary-500); border-style: solid; background: color-mix(in srgb, var(--primary-500) 8%, var(--surface)); }
.cs-drop-ico { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md); background: var(--surface); color: var(--primary-600); box-shadow: var(--shadow-xs); }
.cs-drop-ico svg { width: 22px; height: 22px; }
.cs-drop-title { font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--text-strong); }
.cs-drop-sub { font-size: var(--text-sm); color: var(--text-soft); }
.cs-link-btn { color: var(--primary-600); font-weight: var(--fw-semibold); }
@media (hover: hover) and (pointer: fine) { .cs-link-btn:hover { text-decoration: underline; } }

.cs-or { display: flex; align-items: center; gap: var(--space-3); color: var(--text-soft); font-size: var(--text-sm); }
.cs-or::before, .cs-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.cs-sources { display: flex; flex-direction: column; gap: var(--space-3); }
.cs-source { display: flex; align-items: flex-start; gap: var(--space-3); width: 100%; padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); text-align: left; }
.cs-source-ico { width: 40px; height: 40px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md); background: var(--surface-sunk); }
.cs-source-ico svg { width: 22px; height: 22px; }
.cs-source-ico--folder { background: color-mix(in srgb, var(--primary-500) 12%, var(--surface)); color: var(--primary-600); }
.cs-source-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cs-source-title { font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text-strong); }
.cs-source-row { display: flex; gap: var(--space-2); }
.cs-drive-input { flex: 1 1 auto; min-width: 0; }
.cs-drive-fetch { flex: none; }
.cs-drive-fetch svg { width: 15px; height: 15px; }
.cs-source-hint { font-size: var(--text-xs); color: var(--text-soft); }
.cs-source--folder { cursor: pointer; align-items: center; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
@media (hover: hover) and (pointer: fine) { .cs-source--folder:hover { background: var(--surface-hover); border-color: var(--border-strong); } }
.cs-source-chev { color: var(--text-soft); align-self: center; }
.cs-source-chev svg { width: 18px; height: 18px; }

.cs-staged-empty { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-4); border-radius: var(--radius-lg); background: var(--surface-sunk); color: var(--text-soft); font-size: var(--text-sm); }
.cs-staged-empty svg { width: 18px; height: 18px; flex: none; }
.cs-staged-head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text); }
.cs-staged-n { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-full); background: var(--primary-600); color: var(--on-primary); font-size: var(--text-2xs); }
/* staged videos: square grid cards (cover + glass play + kebab) */
.cs-staged-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-3); }
.cs-staged-card { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.cs-staged-thumb { position: relative; aspect-ratio: 1 / 1; width: 100%; border-radius: var(--radius-lg); overflow: hidden; cursor: pointer; background: var(--gray-200); box-shadow: var(--shadow-xs); }
.cs-staged-cover, .cs-staged-grad { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
@media (hover: hover) and (pointer: fine) {
  .cs-staged-thumb:hover .cs-thumb-play { transform: scale(1.06); }
}
.cs-staged-size { position: absolute; right: 6px; bottom: 6px; z-index: 1; padding: 1px 7px; border-radius: var(--radius-xs); background: rgba(0, 0, 0, .6); color: #fff; font-size: var(--text-2xs); font-weight: var(--fw-semibold); }
.cs-staged-foot { display: flex; align-items: center; gap: var(--space-1); min-width: 0; }
.cs-staged-name { flex: 1 1 auto; min-width: 0; font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: text; }
.cs-staged-menu { width: 30px; height: 30px; flex: none; }
.cs-staged-menu svg { width: 16px; height: 16px; }

/* editor video preview (in-page lightbox) */
.cs-viewer { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; background: rgba(8, 8, 12, .92); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); opacity: 0; transition: opacity var(--dur) var(--ease); }
.cs-viewer.show { opacity: 1; }
.cs-viewer-video { max-width: 92vw; max-height: 88vh; border-radius: var(--radius-lg); background: #000; box-shadow: var(--shadow-lg); outline: none; }
.cs-viewer-close { position: fixed; top: 16px; right: 16px; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-full); color: #fff; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .25); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); cursor: pointer; }
.cs-viewer-close svg { width: 20px; height: 20px; }

/* client logo in the "browse folder" source */
.cs-source-ico--folder { background: transparent; overflow: hidden; padding: 0; }
.cs-source-ico .proj-logo { width: 40px; height: 40px; border-radius: var(--radius-md); font-size: var(--text-md); }

.cs-create-foot { flex: none; display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-6); border-top: 1px solid var(--border); background: var(--surface); }
.cs-foot-count { font-size: var(--text-sm); color: var(--text-soft); }

/* ---- finder modal (browse the client folder) ---- */
.csf { display: flex; flex-direction: column; gap: var(--space-3); min-height: 420px; }
.csf-bar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.csf-search { flex: none; min-width: 260px; }
.csf-crumb { display: flex; align-items: center; gap: 4px; overflow: hidden; }
.csf-crumb-link { font-size: var(--text-sm); color: var(--text-soft); padding: 2px 4px; border-radius: var(--radius-xs); white-space: nowrap; }
.csf-crumb-link.cur { color: var(--text-strong); font-weight: var(--fw-semibold); }
@media (hover: hover) and (pointer: fine) { .csf-crumb-link:not(.cur):hover { color: var(--text); background: var(--surface-hover); } }
.csf-crumb-sep { display: inline-flex; color: var(--text-soft); }
.csf-crumb-sep svg { width: 14px; height: 14px; }
.csf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-3); align-content: start; overflow-y: auto; max-height: 52vh; padding: 2px; }
.csf-item { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); text-align: left; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
@media (hover: hover) and (pointer: fine) { .csf-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); } }
.csf-item.sel { border-color: var(--primary-500); box-shadow: 0 0 0 1px var(--primary-500); }
.csf-thumb-wrap { position: relative; }
.cs-thumb--finder { width: 100%; }
.csf-check { position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-full); background: var(--surface); color: var(--text-soft); border: 1px solid var(--border); opacity: 0; transform: scale(.8); transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.csf-check svg { width: 13px; height: 13px; }
.csf-item.sel .csf-check { opacity: 1; transform: scale(1); background: var(--primary-600); color: var(--on-primary); border-color: var(--primary-600); }
.csf-name { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csf-meta { font-size: var(--text-xs); color: var(--text-soft); }
.csf-item--folder { align-items: stretch; }
.csf-folder-ico { width: 100%; aspect-ratio: 16 / 9; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md); background: color-mix(in srgb, var(--primary-500) 10%, var(--surface)); color: var(--primary-600); }
.csf-folder-ico svg { width: 30px; height: 30px; }
.csf-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-8); color: var(--text-soft); }
.csf-empty svg { width: 26px; height: 26px; }
.csf-foot { display: flex; align-items: center; gap: var(--space-2); width: 100%; }
.csf-count { font-size: var(--text-sm); color: var(--text-soft); }
.csf-loading { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-8); color: var(--text-soft); }
.csf-loading p { font-size: var(--text-sm); }
.csf-spin { display: inline-flex; animation: spin 0.9s linear infinite; }
.csf-spin svg { width: 22px; height: 22px; }

/* ---- share card: clickable + kebab menu + copy success + inline rename ---- */
.cs-card { cursor: pointer; }
.cs-card:focus-visible { outline: none; box-shadow: var(--ring-primary), var(--shadow-sm); }
.cs-card-actions .btn { cursor: pointer; }

.cs-card-menu { min-width: 0; width: max-content; }
.cs-card-menu .filter-opt { display: flex; align-items: center; justify-content: flex-start; gap: var(--space-2); width: 100%; }
.cs-card-menu .filter-opt svg { width: 16px; height: 16px; margin-left: 0; color: var(--text-soft); }
.cs-menu-sep { height: 1px; margin: 4px 0; background: var(--border-faint); }
.cs-card-menu .cs-menu-danger, .cs-card-menu .cs-menu-danger svg { color: var(--danger-600); }
@media (hover: hover) and (pointer: fine) {
  .cs-card-menu .cs-menu-danger:hover { background: var(--danger-bg); }
}


.cs-staged-name { cursor: text; }
/* inline rename reads exactly like the text — no border/box/ring, just a caret */
.cs-staged-name-input { width: 100%; max-width: 340px; font: inherit; font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text-strong); background: transparent; border: 0; border-radius: 0; padding: 0; margin: 0; outline: none; box-shadow: none; }
.cs-staged-name-input:focus, .cs-staged-name-input:focus-visible { outline: none; box-shadow: none; }

/* Lead analytics empty state */
.lead-empty-body { display: flex; flex-direction: column; align-items: center; text-align: center; padding: var(--space-5) var(--space-4) var(--space-6); }
.lead-empty-art { position: relative; width: 320px; max-width: 100%; height: 184px; display: flex; align-items: center; justify-content: center; margin-bottom: var(--space-2); }
.lead-empty-grid { position: absolute; inset: 0; width: 100%; height: 100%; }
.lead-empty-card { position: relative; width: 150px; height: 150px; }
.lead-empty-title { font-size: var(--text-lg); font-weight: var(--fw-bold); color: var(--text-strong); letter-spacing: -0.01em; }
.lead-empty-desc { margin-top: 6px; max-width: 34ch; font-size: var(--text-sm); color: var(--text-soft); line-height: var(--leading-relaxed); text-wrap: pretty; }
.lead-empty-cta { margin-top: var(--space-4); }

/* New Client modal */
.nc-body { display: flex; flex-direction: column; gap: var(--space-4); }
.nc-seg { width: 100%; }
.nc-seg button { flex: 1; }
.nc-form { display: flex; flex-direction: column; gap: var(--space-4); }
.nc-field { display: flex; flex-direction: column; gap: 6px; }
/* paired fields (Phone / Email) share a row; stack on narrow screens */
.nc-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 640px) { .nc-grid2 { grid-template-columns: 1fr; } }
.nc-label { font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text); }
.nc-opt { font-weight: var(--fw-regular); color: var(--text-soft); }
.nc-help { font-size: var(--text-xs); color: var(--text-soft); }
.nc-select { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); width: 100%; text-align: left; cursor: pointer; }
.nc-select svg { width: 16px; height: 16px; color: var(--text-soft); flex-shrink: 0; }
.nc-select-val { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.nc-select-val.ph { color: var(--text-soft); }
.nc-foot { display: flex; justify-content: flex-end; gap: var(--space-2); }

/* New Client → "Send the onboarding link" opt-in + delivery choice */
/* sunk panel: --surface-sunk is the DS token for inset areas (#f8f8fb light,
   #1f1f26 dark) — a raw hex here would go black-on-black in the dark theme */
.nc-onb { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3); background: var(--surface-sunk); border: 1px solid var(--border); border-radius: var(--radius-lg); }
/* label text is a click target for the checkbox, not prose — a double-click
   should toggle it, never leave a text selection behind (-webkit- for the
   iOS WKWebView shell) */
.nc-onb-head { display: flex; align-items: flex-start; gap: var(--space-2); cursor: pointer; -webkit-user-select: none; user-select: none; }
/* sizing/colour live on the shared .checkbox primitive — only the optical
   alignment against the title's cap-height belongs here */
.nc-onb-head .checkbox { margin-top: 2px; }
.nc-onb-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nc-onb-title { font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text); }
.nc-onb-sub { font-size: var(--text-xs); color: var(--text-soft); line-height: var(--leading-relaxed); }
.nc-onb-ways { display: flex; flex-wrap: wrap; gap: var(--space-2); }
/* --btn-radius (10px) = the radius every other button in the app uses; the
   sunk panel sits one step up at --radius-lg so the nesting reads right */
.nc-way { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: var(--text-xs); font-weight: var(--fw-medium); color: var(--text-soft); background: var(--surface); border: 1px solid var(--border); border-radius: var(--btn-radius); cursor: pointer; transition: color 180ms var(--ease-enter), background-color 180ms var(--ease-enter), border-color 180ms var(--ease-enter); }
.nc-way svg { width: 14px; height: 14px; }
.nc-way:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong, var(--text-soft)); }
.nc-way.active { color: var(--primary-700); border-color: var(--primary-600); background: var(--primary-50); }
/* copied confirmation — the tick pops in, the pill settles to success for a
   beat, then restores itself */
.nc-way.is-copied, .nc-way.is-copied:hover { color: var(--success-600); border-color: var(--success-600); background: var(--success-bg); }
.nc-way.is-copied svg { animation: nc-tick-pop 220ms var(--ease, cubic-bezier(.4, 0, .2, 1)); }
@keyframes nc-tick-pop { from { transform: scale(.5); opacity: 0; } 60% { transform: scale(1.15); } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .nc-way.is-copied svg { animation: none; } }
.nc-way:disabled { opacity: .45; cursor: default; }
/* unticked → the delivery row reads as inactive, but stays visible so the
   choice is discoverable before you tick the box */
.nc-onb.is-off .nc-onb-title, .nc-onb.is-off .nc-onb-sub { color: var(--text-soft); }

/* Single-field edit modal (email / phone) */
.fe-body { display: flex; flex-direction: column; gap: var(--space-4); }
.fe-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); width: 100%; }
.btn-kbd {
  display: inline-flex; align-items: center; justify-content: center;
  height: 18px; min-width: 18px; margin-left: 7px; padding: 0 5px 1px;
  border-radius: 5px; font-family: ui-monospace, Menlo, monospace;
  font-size: 11px; font-weight: var(--fw-semibold); line-height: 1;
  background: var(--surface-2, rgba(0, 0, 0, 0.05)); color: var(--text-soft);
  border: 1px solid var(--border);
}
.btn-kbd--on { background: rgba(255, 255, 255, 0.2); color: rgba(255, 255, 255, 0.92); border-color: transparent; }

/* anchored dropdown for New Client fields */
.nc-dd-menu { position: fixed; z-index: calc(var(--z-modal, 1000) + 20); min-width: 220px; padding: 6px; }
.nc-dd-search { display: flex; align-items: center; gap: 7px; padding: 0 9px; margin-bottom: 4px; border-bottom: 1px solid var(--border-faint); }
.nc-dd-search svg { width: 15px; height: 15px; color: var(--text-soft); flex-shrink: 0; }
.nc-dd-search input { flex: 1; min-width: 0; height: 34px; border: 0; outline: 0; background: transparent; font-family: var(--font-sans); font-size: var(--text-sm); color: var(--text); }
.nc-dd-search input:focus, .nc-dd-search input:focus-visible { outline: none; box-shadow: none; }
.nc-dd-search input::placeholder { color: var(--text-soft); }
.nc-dd-list { display: flex; flex-direction: column; gap: 1px; max-height: 264px; overflow-y: auto; }
.nc-dd-opt { display: flex; align-items: center; gap: var(--space-3); width: 100%; padding: 7px 8px; border-radius: var(--radius-sm); text-align: left; cursor: pointer; transition: background var(--dur-fast) var(--ease); }
@media (hover: hover) and (pointer: fine) {
  .nc-dd-opt:hover { background: var(--gray-100); }
}
.nc-dd-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.nc-dd-name { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nc-dd-sub { font-size: var(--text-xs); color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nc-dd-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: baseline; }
.nc-dd-empty { padding: 14px 10px; text-align: center; font-size: var(--text-sm); color: var(--text-soft); }

/* delete-client PIN field */
.del-pin-field { display: flex; flex-direction: column; gap: 6px; margin-top: var(--space-3); }
.del-pin-label { font-size: var(--text-xs); font-weight: var(--fw-semibold); color: var(--text-muted); }
.del-pin-input { width: 100%; height: 42px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); font-family: var(--font-sans); font-size: var(--text-lg); font-weight: var(--fw-semibold); letter-spacing: 0.3em; color: var(--text-strong); transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.del-pin-input:focus { outline: none; border-color: var(--primary-400); box-shadow: var(--ring-primary); }
.del-pin-input.is-error { border-color: var(--danger-600); box-shadow: 0 0 0 3px var(--danger-bg); animation: pinShake 0.3s var(--ease); }
@keyframes pinShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* activity timeline */
.dw-activity { display: flex; flex-direction: column; gap: 0; }
.dw-act { display: flex; gap: var(--space-3); position: relative; padding-bottom: var(--space-4); }
.dw-act:last-child { padding-bottom: 0; }
.dw-act .marker { width: 9px; height: 9px; border-radius: 50%; background: var(--primary-500); margin-top: 4px; flex-shrink: 0; position: relative; }
.dw-act:not(:last-child) .marker::after { content: ""; position: absolute; left: 50%; top: 13px; transform: translateX(-50%); width: 1.5px; height: calc(100% + var(--space-4) - 13px); background: var(--border); }
.dw-act .at { font-size: var(--text-sm); color: var(--text); }
.dw-act .aw { font-size: var(--text-xs); color: var(--text-soft); margin-top: 1px; }

/* danger */
.drawer-foot { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border); flex-shrink: 0; }
.dw-delete { display: inline-flex; align-items: center; gap: var(--space-2); width: 100%; justify-content: center; height: 38px; border-radius: var(--radius-md); background: transparent; border: 1px solid transparent; color: var(--danger-600); font-size: var(--text-md); font-weight: var(--fw-medium); transition: background var(--dur) var(--ease); }
@media (hover: hover) and (pointer: fine) {
  .dw-delete:hover { background: var(--danger-bg); }
}
.dw-delete svg { width: 17px; height: 17px; }

/* clickable rows / cards */
.ctable tbody tr { cursor: pointer; }
/* relative "time ago" only renders in the mobile card (hidden elsewhere) */
.ctable .date-rel { display: none; }
