/* page styles: workspace — services, users, assets, settings, profile, trash, client portal, public pages. All classes prefixed ws- */

/* shared */
.ws-mono { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 13px; color: var(--text-2); }
.ws-vs { width: 1px; height: 16px; background: var(--border-2); margin: 0 6px; }
.ws-sheet > .card-b { padding: 24px 32px; }
.ws-tabpad { padding: 0 24px; }

/* services: category group rows */
.ws-grp { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.ws-grp-n { color: var(--text); font-weight: 600; font-size: 14px; flex: none; white-space: nowrap; }
.ws-grp-c { display: inline-flex; align-items: center; flex: none; white-space: nowrap; height: 22px; padding: 0 8px; border-radius: 11px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); font-size: 12px; font-weight: 500; color: var(--text-3); }
.ws-grp-a { font-weight: 400; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ws-grp .rowbtns { display: inline-flex; gap: 2px; flex: none; }
.ws-svc tr.group td { padding-top: 2px; padding-bottom: 2px; border-top: 1px solid var(--border); }
.ws-svc tbody tr.group:first-child td { border-top: 0; }
.ws-margin { padding: 2px 16px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.ws-mbar { width: 168px; }

/* users: role and status cells, module lists, steps */
.ws-role .row { flex-wrap: wrap; }
.ws-role .st, .ws-stat > span:not(.pill) { display: block; margin-top: 4px; color: var(--text-3); font-size: 13px; line-height: 18px; }
.ws-stat > span.ok-t { color: var(--success); }
.ws-stat > span.t4 { color: var(--text-4); }
.ws-master { gap: 4px; }
.ws-ph { display: flex; align-items: center; gap: 12px; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.ws-ph .grow { flex: 1; min-width: 0; }
.ws-ph .grow > b { display: block; font-weight: 600; color: var(--text); line-height: 20px; }
.ws-ph .grow > span { color: var(--text-3); font-size: 14px; }
.ws-mods { display: grid; gap: 16px 24px; }
.ws-mods.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ws-mods.c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ws-mods > div { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 6px 6px; background: var(--surface); min-width: 0; }
.ws-mods h4 { display: flex; justify-content: space-between; align-items: center; font-size: 12px; line-height: 18px; font-weight: 600; color: var(--text-3); margin: 0 0 4px; padding: 0 10px; }
.ws-mods .perm { border: 0; height: 36px; padding: 0 10px; border-radius: 6px; }
.ws-mods .perm + .perm { margin-top: 0; }
.ws-mods .perm input.ck { margin: 0; }
.ws-mods .perm:hover, .ws-mods .perm.on:hover { background: var(--surface-2); }
.ws-mods .perm.on { background: none; }
.ws-mods .perm:not(.on) { color: var(--text-3); font-weight: 400; }
.ws-steps { list-style: none; margin: 0; padding: 0; counter-reset: wss; }
.ws-steps > li { position: relative; display: flex; gap: 16px; padding-bottom: 24px; }
.ws-steps > li:last-child { padding-bottom: 0; }
.ws-steps > li::before { counter-increment: wss; content: counter(wss); flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-600); font-weight: 600; font-size: 14px; box-shadow: inset 0 0 0 1px var(--brand-100); }
.ws-steps > li:not(:last-child)::after { content: ""; position: absolute; left: 15px; top: 40px; bottom: 8px; width: 2px; border-radius: 1px; background: var(--border); }
.ws-steps b { display: block; font-weight: 600; color: var(--text-2); line-height: 20px; margin-top: 6px; }
.ws-steps p { margin: 4px 0 0; color: var(--text-3); font-size: 14px; line-height: 20px; }

/* assets */
.ws-asset { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.ws-asset .grow { flex: 1; min-width: 0; }
.ws-asset .grow > b { display: block; font-weight: 600; color: var(--text); }
.ws-asset .grow > span { color: var(--text-3); font-size: 14px; }

/* settings + profile */
.ws-conn { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--sh-xs); }
.ws-conn .grow { flex: 1; min-width: 0; }
.ws-conn .grow > b { display: block; font-weight: 600; color: var(--text); }
.ws-conn .grow > span { display: block; color: var(--text-3); font-size: 14px; margin-top: 2px; }
.ws-ol { margin: 16px 0 0; padding-left: 20px; color: var(--text-3); font-size: 14px; line-height: 20px; }
.ws-ol li + li { margin-top: 6px; }
.ws-ol b { color: var(--text-2); font-weight: 600; }
.ws-linkrow { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin: 0 0 24px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); font-size: 14px; }
.ws-linkrow .grow { flex: 1; min-width: 0; }
.ws-sess { border: 1px solid var(--border); border-radius: var(--r-lg); }
.ws-sess > li { padding: 12px 16px; }
.ws-logo { display: flex; gap: 24px; align-items: center; }
.ws-logo .grow { flex: 1; min-width: 0; }
.ws-logo-cur { display: flex; flex-direction: column; align-items: center; flex: none; width: 112px; }
.ws-prev { display: flex; align-items: center; gap: 12px; height: 64px; margin-bottom: 12px; }
.ws-prev-t { min-width: 0; }
.ws-prev-t b { display: block; font-weight: 500; color: var(--text-2); }
.ws-prev-t span { display: block; color: var(--text-3); font-size: 14px; }
.ws-sig { width: 168px; height: 64px; flex: none; display: grid; place-items: center; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.ws-sig svg { width: 148px; height: 44px; }

/* client portal */
.ws-kp { margin-bottom: 24px; }
.ws-amt .st { display: block; color: var(--text-3); font-size: 13px; font-weight: 400; }
.ws-ins > li { align-items: flex-start; }
.ws-ins .st { margin-top: 2px; }
.ws-ins .st b { color: var(--text-2); font-weight: 600; }
.ws-support .card-b { display: flex; align-items: center; gap: 20px; }
.ws-support .grow { flex: 1; min-width: 0; }
.ws-support h3 { font-size: 16px; line-height: 24px; }
.ws-support p { margin: 2px 0 0; color: var(--text-3); }
.ws-support p b { color: var(--text-2); font-weight: 600; }
.ws-support .row { flex-wrap: wrap; }
.ws-support.col .card-b { flex-direction: column; align-items: flex-start; gap: 16px; }

/* public pages */
.ws-toc { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); padding: 20px 24px; margin: 0 0 48px; font-size: 15px; line-height: 24px; }
.ws-toc b { display: block; color: var(--text); font-size: 14px; margin-bottom: 8px; }
.ws-toc ol { columns: 2; column-gap: 32px; margin: 0; padding-left: 20px; }
.ws-toc li { margin: 0 0 4px; }
.prose .ws-toc a { text-decoration: none; color: var(--text-2); }
.prose .ws-toc a:hover { color: var(--brand-600); }
.prose h2[id] { scroll-margin-top: 24px; }
.public .in.ws-dd { max-width: 1120px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: 64px; padding-top: 64px; padding-bottom: 96px; align-items: start; }
.ws-note { display: flex; gap: 12px; margin-top: 32px; padding: 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.ws-note b { display: block; font-weight: 600; color: var(--text-2); }
.ws-note p { margin: 2px 0 0; color: var(--text-3); font-size: 14px; }
.ws-ddform { box-shadow: var(--sh-lg); }
.ws-ddform > .card-b { padding: 32px; }

/* phone-only pieces (hidden on larger screens) */
.ws-phone, .ws-bnav { display: none; }
.ws-bnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 52px; border-radius: var(--r); color: var(--text-3); font-size: 12px; font-weight: 600; }
.ws-bnav a svg.i { width: 22px; height: 22px; }
.ws-bnav a[aria-current="page"] { color: var(--brand-600); background: var(--brand-50); }

/* ── responsive ──────────────────────────────────────── */
@media (max-width: 1440px) {
  .ws-sheet > .card-b { padding: 24px 28px; }
  .ws-tabpad { padding: 0 20px; }
}
@media (max-width: 1280px) {
  .ws-mbar { width: 120px; }
  .ws-mods.c5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 861px) and (max-width: 1280px) {
  /* the portal has no sidebar, so its KPI tiles stay four across on laptops */
  .kpis.ws-kp { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .public .in.ws-dd { grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 40px; }
}
@media (max-width: 960px) {
  .public .in.ws-dd { grid-template-columns: 1fr; max-width: 640px; }
  .ws-ddform { order: -1; }
  .ws-toc ol { columns: 1; }
}
@media (max-width: 860px) {
  .ws-sheet > .card-b { padding: 4px 16px 16px; }
  .ws-grp-a { display: none; }
  .ws-tabpad { padding: 0 16px; }
  .ws-mods.c3, .ws-mods.c5 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px; }
  .ws-ph { flex-wrap: wrap; }
  .ws-ph .grow { flex: 1 1 200px; }
  .ws-conn { flex-wrap: wrap; padding: 14px 16px; gap: 12px; }
  .ws-conn .grow { flex: 1 1 200px; }
  .ws-linkrow { flex-wrap: wrap; }
  .ws-linkrow .grow { flex: 1 1 100%; }
  .ws-sess > li { flex-wrap: nowrap; }
  .ws-support .card-b { flex-direction: column; align-items: flex-start; gap: 16px; }
  .ws-support .row { width: 100%; }
  .ws-banner { flex-wrap: wrap; gap: 8px 12px; }
  .ws-bnote { flex: 1 1 100%; }
  .public .in.ws-dd { padding-top: 32px; padding-bottom: 56px; gap: 32px; }
  .ws-ddform > .card-b { padding: 20px; }
  .ws-toc { margin-bottom: 32px; padding: 16px 20px; }
}
@media (min-width: 641px) and (max-width: 860px) {
  /* tablets: let two-line cells shrink to their content so tables fit without sideways scrolling */
  .ws-t .cell { min-width: 0; }
  .ws-tr .cell .tt { white-space: nowrap; }
  .ws-usr .cell > .av { display: none; }
  .ws-mbar { width: 96px; }
  .ws-rst { width: 32px; padding: 0; }
  .ws-rst .ws-lbl { display: none; }
  .kpis.ws-k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis.ws-kp { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ws-kp .kpi { padding: 14px; }
  .ws-kp .kpi .val { font-size: 20px; line-height: 28px; }
}
@media (max-width: 640px) {
  /* stacked table cards: row actions span the card (the base td.ra width:1% would squeeze them into a column) */
  .ws-t > tbody > tr > td.ra { width: 100%; }
  .ws-t td.ra .rowbtns { flex-wrap: wrap; gap: 4px; }
  .ws-t > tbody > tr.group > td { white-space: normal; }
  .ws-grp { flex-wrap: wrap; gap: 8px; min-height: 0; }
  .ws-grp .spacer { display: none; }
  .ws-grp .rowbtns { margin-left: auto; }
  .ws-role, .ws-stat { display: inline-block; text-align: right; }
  .ws-role .row { justify-content: flex-end; }
  .ws-mbar { width: 140px; display: inline-flex; }
  .ws-mods.c3, .ws-mods.c5 { grid-template-columns: 1fr !important; }
  .ws-ph > .btn { flex: 1 1 auto; }
  .ws-logo { flex-direction: column; align-items: stretch; gap: 16px; }
  .ws-logo-cur { width: auto; flex-direction: row; gap: 16px; }
  .ws-logo-cur .row { margin-top: 0 !important; }
  .ws-sig { width: 140px; }
  .ws-sig svg { width: 124px; }
  .ws-support .row .btn { flex: 1 1 100%; }
  .ws-asset { flex-wrap: wrap; }
  .ws-steps > li { gap: 12px; }
  /* client portal on phones */
  .ws-desk { display: none; }
  .ws-phone { display: block; }
  .ws-phone .chart-wrap { overflow: visible; margin: 0; padding: 0; }
  .ws-phone .chart-wrap svg.chart { min-width: 0; }
  .kpis.ws-kp { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .ws-kp .kpi { padding: 14px; }
  .ws-kp .kpi .lbl { font-size: 13px; }
  .ws-kp .kpi .val { font-size: 20px; line-height: 28px; }
  .ws-kp .kpi .cmp { font-size: 13px; line-height: 18px; }
  .ws-kp .kpi svg.spark { display: none; }
  /* sticky (not fixed): .pmain keeps a transform from its entry animation, which would pin a fixed bar to the main box */
  .ws-bnav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; position: sticky; bottom: 0; z-index: 40; margin: 24px -16px -48px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--border); box-shadow: 0 -4px 12px -6px rgba(16,24,40,.08); }
}

/* ── live CRM (v3 views) ─────────────────────────────── */
@media (max-width: 640px) {
  .ws-t > tbody > tr.group > td { height: auto; }
  .ws-grp .rowbtns .btn { flex: none; }
}
.ws-sheet button[disabled] { opacity: .5; cursor: not-allowed; }
/* client portal (live CRM) */
.ws-kp2 { margin-bottom: 24px; }
.ws-accstats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--r); }
.ws-accstats > div { padding: 8px 12px; border-left: 1px solid var(--border); border-top: 1px solid var(--border); min-width: 0; }
.ws-accstats > div:nth-child(3n+1) { border-left: 0; }
.ws-accstats > div:nth-child(-n+3) { border-top: 0; }
.ws-accstats span { display: block; font-size: 12px; color: var(--text-3); }
.ws-accstats b { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14px; }
.ws-insgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ws-ins1 { padding: 14px 16px; border: 1px solid var(--border); border-left: 3px solid var(--gray-dot); border-radius: var(--r); background: var(--surface-2); }
.ws-ins1.ok { border-left-color: var(--success-dot); } .ws-ins1.warn { border-left-color: var(--warning-dot); } .ws-ins1.bad { border-left-color: var(--error-dot); } .ws-ins1.info { border-left-color: var(--info-dot); } .ws-ins1.violet { border-left-color: #7A5AF8; }
.ws-ins1 b { display: block; color: var(--text); font-weight: 600; } .ws-ins1 p { margin: 4px 0 0; color: var(--text-3); font-size: 14px; line-height: 20px; }
.ptop .in > .ws-plogout { flex: none; }
@media (max-width: 860px) { .ws-insgrid { grid-template-columns: 1fr; } .ptop .ws-plogout { display: none; } }
.ws-notice.pinned { border-left: 3px solid var(--brand); } .ws-notice.urgent { border-left: 3px solid var(--error-dot); }
.ws-notice h2 { margin-bottom: 8px; } .ws-notice-b { white-space: pre-line; color: var(--text-2); font-size: 14px; line-height: 22px; }
.ws-slots { display: grid; gap: 8px; } .ws-slots.c6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } .ws-slots.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ws-slot { cursor: pointer; } .ws-slot input { position: absolute; opacity: 0; pointer-events: none; }
.ws-slot span { display: block; text-align: center; padding: 8px 6px; border: 1px solid var(--border-2); border-radius: var(--r); background: var(--surface); transition: border-color .15s, background .15s; }
.ws-slot small { display: block; font-size: 12px; color: var(--text-3); } .ws-slot b { display: block; font-size: 18px; font-weight: 600; color: var(--text); } .ws-slot b.sm { font-size: 14px; }
.ws-slot input:checked + span { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: #FFFBFC; } .ws-slot input:checked + span b { color: var(--brand-600); }
.ws-slot input:focus-visible + span { box-shadow: var(--ring); }
.ws-mtg-r { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
@media (max-width: 640px) { .ws-slots.c6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .ws-mtg-r { flex-direction: row; align-items: center; } }
.ws-pfoot { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--text-3); padding-top: 16px; padding-bottom: 16px; }
.ws-pfoot a:hover { color: var(--brand-600); }
.ws-hl { border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: var(--r-lg); background: var(--surface-2); padding: 16px 20px; margin: 0 0 32px; color: var(--text-2); }
/* Users & access: business list in the create drawer / edit modal (classes were used but never styled: items ran inline and the modal grew past the screen) */
.ws-leadbox .label { margin-top: 4px; }
.ws-leadlist { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; margin-top: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.ws-leadlist .cb { display: flex; }
.ws-note-s { display: block; margin-top: 6px; font-size: 12px; color: var(--text-3); }
