/* Zelio Pulse design system "Majorelle" — components (Stage B0, 2026-11-27).
   Every class starts with .p- so the old stylesheet and the new components never touch each other during migration.
   Markup comes from /ds/ui.js helpers; a page never invents its own class for something listed here. */

/* ============================================================ base inside the new interface */
.p-root, .p-root * { box-sizing: border-box; }
.p-root { font-family: var(--p-font); font-size: var(--p-t-md); line-height: var(--p-lh-md); color: var(--p-text); background: var(--p-bg);
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
.p-num { font-variant-numeric: tabular-nums; }
.p-muted { color: var(--p-text-2); }
.p-faint { color: var(--p-text-3); }
.p-xs { font-size: var(--p-t-xs); line-height: var(--p-lh-xs); }
.p-sm { font-size: var(--p-t-sm); line-height: var(--p-lh-sm); }
.p-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.p-bdi { unicode-bidi: isolate; }
.p-icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.p-icon-18 { width: 18px; height: 18px; }
.p-icon-20 { width: 20px; height: 20px; }
.p-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.p-root :focus-visible { outline: none; box-shadow: var(--p-focus); border-radius: var(--p-r-md); }
.p-stack { display: flex; flex-direction: column; gap: var(--p-s-6); }
.p-row { display: flex; align-items: center; gap: var(--p-s-2); }
.p-spacer { flex: 1; }
.p-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--p-s-6); }
.p-grid-3-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--p-s-6); }
@media (max-width: 1199px) { .p-grid-2, .p-grid-3-2 { grid-template-columns: minmax(0, 1fr); } }

/* ============================================================ application shell (used from B1) */
.p-shell { display: flex; min-height: 100vh; background: var(--p-bg); }
.p-sidebar { width: var(--p-sidebar-w); flex: none; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--p-sunken); border-inline-end: 1px solid var(--p-border); transition: width var(--p-med) var(--p-ease); }
.p-sidebar[data-collapsed] { width: var(--p-sidebar-w-collapsed); }
/* phone: the sidebar is a drawer opened from "Plus" in the bottom bar */
@media (max-width: 767px) {
  .p-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 75; width: min(300px, 86vw); transform: translateX(-102%); transition: transform var(--p-med) var(--p-ease); box-shadow: var(--p-sh-modal); }
  .p-sidebar[data-open] { transform: none; }
  [dir="rtl"] .p-sidebar { inset: 0 0 0 auto; transform: translateX(102%); }
}
.p-sidebar[data-collapsed] .p-nav-label, .p-sidebar[data-collapsed] .p-ws-txt, .p-sidebar[data-collapsed] .p-nav-count, .p-sidebar[data-collapsed] .p-user-txt { display: none; }
.p-ws { display: flex; align-items: center; gap: var(--p-s-2); margin: var(--p-s-2); padding: var(--p-s-2); border-radius: var(--p-r-md); border: 0; background: none;
  color: inherit; font: inherit; text-align: start; cursor: pointer; min-height: 44px; }
.p-ws:hover { background: var(--p-hover); }
.p-ws-logo { width: 28px; height: 28px; border-radius: var(--p-r-md); flex: none; display: grid; place-items: center; overflow: hidden; background: var(--p-surface); border: 1px solid var(--p-border); }
.p-ws-logo img { width: 100%; height: 100%; object-fit: contain; }
.p-ws-txt { display: grid; min-width: 0; flex: 1; }
.p-ws-name { font-weight: var(--p-w-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-ws-sub { font-size: var(--p-t-xs); line-height: var(--p-lh-xs); color: var(--p-text-3); }
.p-nav { display: flex; flex-direction: column; gap: 2px; padding: var(--p-s-2); flex: 1; overflow-y: auto; }
.p-nav-item { display: flex; align-items: center; gap: var(--p-s-3); min-height: 32px; padding: 0 var(--p-s-2); border-radius: var(--p-r-md); color: var(--p-text-2);
  font-weight: var(--p-w-medium); text-decoration: none; transition: background var(--p-fast), color var(--p-fast); }
.p-nav-item:hover { background: var(--p-hover); color: var(--p-text); }
.p-nav-item[aria-current="page"] { background: var(--p-accent-soft); color: var(--p-text); font-weight: var(--p-w-semibold); }
.p-nav-item[aria-current="page"] .p-icon { color: var(--p-accent); }
.p-nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-nav-count { font-size: var(--p-t-xs); font-weight: var(--p-w-semibold); color: var(--p-text-2); font-variant-numeric: tabular-nums; }
.p-nav-sep { height: 1px; background: var(--p-border); margin: var(--p-s-2) var(--p-s-2); }
.p-user { display: flex; align-items: center; gap: var(--p-s-2); padding: var(--p-s-3); border-top: 1px solid var(--p-border); }
.p-user-txt { display: grid; min-width: 0; flex: 1; }
.p-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.p-topbar { position: sticky; top: 0; z-index: 30; height: var(--p-topbar-h); display: flex; align-items: center; gap: var(--p-s-2); padding: 0 var(--p-s-6) 0 var(--p-s-4);
  background: var(--p-bg); border-bottom: 1px solid var(--p-border); }
.p-search-btn { display: flex; align-items: center; gap: var(--p-s-2); height: 32px; min-width: 220px; padding: 0 var(--p-s-2) 0 var(--p-s-3); border: 1px solid var(--p-border);
  border-radius: var(--p-r-md); background: var(--p-surface); color: var(--p-text-3); font: inherit; font-size: var(--p-t-sm); cursor: pointer; }
.p-search-btn:hover { border-color: var(--p-border-strong); }
.p-search-btn .p-kbd { margin-inline-start: auto; }
.p-op-chip { display: inline-flex; align-items: center; gap: var(--p-s-2); height: 28px; padding: 0 var(--p-s-3); border-radius: var(--p-r-full);
  border: 1px solid var(--p-step-ready); color: var(--p-warn); background: var(--p-warn-soft); font-size: var(--p-t-xs); font-weight: var(--p-w-medium); }
.p-op-chip a { color: inherit; text-decoration: underline; }
.p-page { padding: var(--p-s-6) var(--p-s-8) var(--p-s-12); width: 100%; max-width: var(--p-content-w); margin: 0 auto; }
.p-page[data-wide] { max-width: none; }
.p-subline { display: flex; align-items: center; gap: var(--p-s-2); padding: var(--p-s-2) var(--p-s-6); font-size: var(--p-t-sm); border-bottom: 1px solid var(--p-border); }
.p-subline[data-kind="warn"] { background: var(--p-warn-soft); color: var(--p-warn); }
.p-subline[data-kind="neg"] { background: var(--p-neg-soft); color: var(--p-neg); }
@media (max-width: 767px) {
  .p-page { padding: var(--p-s-4) var(--p-s-4) calc(var(--p-s-12) + 64px); }
  .p-topbar { padding: 0 var(--p-s-2); }
  .p-search-btn { min-width: 0; width: 40px; justify-content: center; padding: 0; }
  .p-search-btn span, .p-search-btn .p-kbd { display: none; }
  .p-op-chip { max-width: 150px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display: inline-block; line-height: 26px; }
}
/* phone bottom bar */
.p-bottombar { position: fixed; inset: auto 0 0 0; z-index: 40; display: none; height: calc(60px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--p-surface); border-top: 1px solid var(--p-border); }
.p-bottombar a, .p-bottombar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--p-text-3);
  font: inherit; font-size: var(--p-t-xs); font-weight: var(--p-w-medium); text-decoration: none; border: 0; background: none; position: relative; }
.p-bottombar [aria-current="page"] { color: var(--p-accent); }
@media (max-width: 767px) { .p-bottombar { display: flex; } }

/* ============================================================ page header, breadcrumb, tabs, segmented */
.p-crumbs { display: flex; align-items: center; gap: var(--p-s-2); min-width: 0; font-size: var(--p-t-sm); }
.p-crumbs a { color: var(--p-text-2); text-decoration: none; }
.p-crumbs a:hover { color: var(--p-text); }
.p-crumbs .p-crumb-sep { color: var(--p-text-3); }
.p-crumbs [aria-current] { font-weight: var(--p-w-semibold); color: var(--p-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-ph { display: flex; flex-direction: column; gap: var(--p-s-4); margin-bottom: var(--p-s-6); }
.p-ph-top { display: flex; align-items: flex-start; gap: var(--p-s-4); flex-wrap: wrap; }
.p-ph-titles { flex: 1; min-width: 240px; display: grid; gap: var(--p-s-1); }
.p-ph-title { margin: 0; font-size: var(--p-t-xl); line-height: var(--p-lh-xl); font-weight: var(--p-w-semibold); letter-spacing: -.015em; display: flex; align-items: baseline; gap: var(--p-s-2); }
.p-ph-count { font-size: var(--p-t-md); font-weight: var(--p-w-medium); color: var(--p-text-3); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.p-ph-sub { color: var(--p-text-2); font-size: var(--p-t-sm); line-height: var(--p-lh-sm); }
.p-ph-actions { display: flex; align-items: center; gap: var(--p-s-2); flex-wrap: wrap; }
.p-ph-bar { display: flex; align-items: flex-end; gap: var(--p-s-4); border-bottom: 1px solid var(--p-border); }
.p-ph-bar .p-tabs { border-bottom: 0; flex: 1; min-width: 0; }
.p-ph-bar-tools { display: flex; align-items: center; gap: var(--p-s-2); padding-bottom: var(--p-s-2); }
.p-tabs { display: flex; gap: var(--p-s-5); overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--p-border); }
.p-tabs::-webkit-scrollbar { display: none; }
.p-tab { position: relative; display: inline-flex; align-items: center; gap: var(--p-s-2); height: 40px; padding: 0; border: 0; background: none; color: var(--p-text-2);
  font: inherit; font-size: var(--p-t-sm); font-weight: var(--p-w-medium); white-space: nowrap; text-decoration: none; cursor: pointer; }
.p-tab:hover { color: var(--p-text); }
.p-tab[aria-selected="true"], .p-tab[aria-current="page"] { color: var(--p-text); }
.p-tab[aria-selected="true"]::after, .p-tab[aria-current="page"]::after { content: ""; position: absolute; inset: auto 0 -1px 0; height: 2px; background: var(--p-accent); border-radius: 2px 2px 0 0; }
.p-tab-count { font-size: var(--p-t-xs); color: var(--p-text-3); font-variant-numeric: tabular-nums; }
.p-seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--p-r-md); background: var(--p-sunken); border: 1px solid var(--p-border); }
.p-seg button { height: 26px; padding: 0 var(--p-s-3); border: 0; border-radius: var(--p-r-sm); background: none; color: var(--p-text-2); font: inherit; font-size: var(--p-t-sm);
  font-weight: var(--p-w-medium); cursor: pointer; white-space: nowrap; }
.p-seg button:hover { color: var(--p-text); }
.p-seg button[aria-pressed="true"] { background: var(--p-surface); color: var(--p-text); box-shadow: 0 0 0 1px var(--p-border); }
@media (max-width: 767px) { .p-seg button { height: 34px; } }

/* ============================================================ buttons */
.p-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--p-s-2); height: var(--p-hit); padding: 0 var(--p-s-3); border-radius: var(--p-r-md);
  border: 1px solid var(--p-border); background: var(--p-surface); color: var(--p-text); font: inherit; font-size: var(--p-t-sm); font-weight: var(--p-w-medium);
  white-space: nowrap; text-decoration: none; cursor: pointer; transition: background var(--p-fast), border-color var(--p-fast), color var(--p-fast); }
.p-btn:hover { background: var(--p-hover); border-color: var(--p-border-strong); }
.p-btn:disabled, .p-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.p-btn[data-v="primary"] { background: var(--p-accent); border-color: var(--p-accent); color: var(--p-on-accent); }
.p-btn[data-v="primary"]:hover { background: var(--p-accent-hover); border-color: var(--p-accent-hover); }
.p-btn[data-v="ink"] { background: var(--p-ink); border-color: var(--p-ink); color: var(--p-on-ink); }
.p-btn[data-v="ink"]:hover { background: var(--p-ink-hover); }
.p-btn[data-v="wa"] { background: var(--p-wa); border-color: var(--p-wa); color: var(--p-on-wa); }
.p-btn[data-v="wa"]:hover { background: var(--p-wa-hover); border-color: var(--p-wa-hover); }
.p-btn[data-v="ghost"] { background: none; border-color: transparent; color: var(--p-text-2); }
.p-btn[data-v="ghost"]:hover { background: var(--p-hover); color: var(--p-text); }
.p-btn[data-v="danger"] { color: var(--p-neg); }
.p-btn[data-v="danger"]:hover { background: var(--p-neg-soft); border-color: var(--p-neg); }
.p-btn[data-v="danger-solid"] { background: var(--p-neg); border-color: var(--p-neg); color: #fff; }
.p-btn[data-v="ai"] { background: none; border-color: var(--p-ai-line); color: var(--p-ai); }
.p-btn[data-v="ai"]:hover { background: var(--p-ai-soft); }
.p-btn[data-size="lg"] { height: 40px; padding: 0 var(--p-s-4); font-size: var(--p-t-md); }
.p-btn[data-busy] { pointer-events: none; opacity: .7; }
.p-btn[data-busy]::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: p-spin .7s linear infinite; }
.p-iconbtn { width: var(--p-hit); height: var(--p-hit); display: inline-grid; place-items: center; border-radius: var(--p-r-md); border: 0; background: none; color: var(--p-text-2); cursor: pointer; flex: none; position: relative; }
.p-iconbtn:hover { background: var(--p-hover); color: var(--p-text); }
.p-dot-badge { position: absolute; top: 6px; inset-inline-end: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--p-neg); box-shadow: 0 0 0 2px var(--p-bg); }
.p-link { color: var(--p-accent); text-decoration: none; font-weight: var(--p-w-medium); display: inline-flex; align-items: center; gap: var(--p-s-1); }
.p-link:hover { text-decoration: underline; }
.p-kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--p-r-sm); border: 1px solid var(--p-border); background: var(--p-sunken);
  font-size: var(--p-t-xs); font-weight: var(--p-w-medium); color: var(--p-text-2); font-family: var(--p-font); }
@keyframes p-spin { to { transform: rotate(360deg); } }

/* ============================================================ fields */
.p-field { display: grid; gap: 6px; }
.p-label { font-size: var(--p-t-sm); font-weight: var(--p-w-medium); color: var(--p-text); }
.p-hint { font-size: var(--p-t-xs); line-height: var(--p-lh-xs); color: var(--p-text-3); }
.p-error { font-size: var(--p-t-xs); line-height: var(--p-lh-xs); color: var(--p-neg); display: flex; gap: var(--p-s-1); align-items: center; }
.p-input, .p-select, .p-textarea { width: 100%; height: 36px; padding: 0 var(--p-s-3); border: 1px solid var(--p-border-strong); border-radius: var(--p-r-md); background: var(--p-surface);
  color: var(--p-text); font: inherit; font-size: var(--p-t-md); transition: border-color var(--p-fast), box-shadow var(--p-fast); }
.p-textarea { height: auto; min-height: 88px; padding: var(--p-s-2) var(--p-s-3); resize: vertical; line-height: var(--p-lh-md); }
.p-select { appearance: none; padding-inline-end: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B675F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6l6 -6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.p-input::placeholder, .p-textarea::placeholder { color: var(--p-text-3); }
.p-input:hover, .p-select:hover, .p-textarea:hover { border-color: var(--p-text-3); }
.p-input:focus, .p-select:focus, .p-textarea:focus { outline: none; border-color: var(--p-accent); box-shadow: 0 0 0 3px var(--p-accent-soft); }
.p-field[data-invalid] .p-input, .p-field[data-invalid] .p-select, .p-field[data-invalid] .p-textarea { border-color: var(--p-neg); }
.p-input-icon { position: relative; }
.p-input-icon .p-icon { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); color: var(--p-text-3); pointer-events: none; }
.p-input-icon .p-input { padding-inline-start: 34px; }
.p-switch { position: relative; display: inline-flex; align-items: center; gap: var(--p-s-2); cursor: pointer; }
.p-switch input { appearance: none; width: 32px; height: 18px; margin: 0; border-radius: var(--p-r-full); background: var(--p-border-strong); position: relative; cursor: pointer; transition: background var(--p-fast); }
.p-switch input::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform var(--p-fast); }
.p-switch input:checked { background: var(--p-accent); }
.p-switch input:checked::after { transform: translateX(14px); }
@media (max-width: 767px) { .p-input, .p-select { height: 40px; font-size: 16px; } }

/* ============================================================ menus */
.p-menu { position: absolute; z-index: 60; min-width: 200px; max-width: 320px; padding: var(--p-s-1); border-radius: var(--p-r-lg); background: var(--p-surface); box-shadow: var(--p-sh-pop); }
.p-menu-label { padding: var(--p-s-2) var(--p-s-2) var(--p-s-1); font-size: var(--p-t-xs); font-weight: var(--p-w-medium); color: var(--p-text-3); }
.p-menu-item { display: flex; align-items: center; gap: var(--p-s-2); width: 100%; min-height: 32px; padding: 0 var(--p-s-2); border: 0; border-radius: var(--p-r-md); background: none;
  color: var(--p-text); font: inherit; font-size: var(--p-t-sm); text-align: start; text-decoration: none; cursor: pointer; }
.p-menu-item:hover, .p-menu-item:focus-visible { background: var(--p-hover); box-shadow: none; }
.p-menu-item .p-icon { color: var(--p-text-3); }
.p-menu-item[data-danger] { color: var(--p-neg); }
.p-menu-item[data-danger] .p-icon { color: var(--p-neg); }
.p-menu-item .p-kbd { margin-inline-start: auto; }
.p-menu-sep { height: 1px; margin: var(--p-s-1) 0; background: var(--p-border); }

/* ============================================================ badges, steps, score, basis, avatar */
.p-badge { display: inline-flex; align-items: center; gap: 6px; height: 20px; padding: 0 var(--p-s-2); border-radius: var(--p-r-sm); font-size: var(--p-t-xs); line-height: 1;
  font-weight: var(--p-w-medium); white-space: nowrap; background: var(--p-sunken); color: var(--p-text-2); }
.p-badge[data-dot]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.p-badge[data-v="accent"] { background: var(--p-accent-soft); color: var(--p-accent); }
.p-badge[data-v="pos"] { background: var(--p-pos-soft); color: var(--p-pos); }
.p-badge[data-v="warn"] { background: var(--p-warn-soft); color: var(--p-warn); }
.p-badge[data-v="neg"] { background: var(--p-neg-soft); color: var(--p-neg); }
.p-badge[data-v="ai"] { background: var(--p-ai-soft); color: var(--p-ai); }
.p-step { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 var(--p-s-2); border-radius: var(--p-r-sm); font-size: var(--p-t-xs); font-weight: var(--p-w-medium);
  white-space: nowrap; background: var(--p-sunken); color: var(--p-text-2); }
.p-step::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--p-step-new)); flex: none; }
.p-step[data-step="new"] { --dot: var(--p-step-new); }
.p-step[data-step="talk"] { --dot: var(--p-step-talk); background: var(--p-accent-soft); color: var(--p-text); }
.p-step[data-step="ready"] { --dot: var(--p-step-ready); background: var(--p-warn-soft); color: var(--p-warn); }
.p-step[data-step="won"] { --dot: var(--p-step-won); background: var(--p-pos-soft); color: var(--p-pos); }
.p-step[data-step="lost"] { --dot: var(--p-step-lost); color: var(--p-text-3); }
.p-score { display: inline-flex; align-items: center; gap: 6px; height: 20px; padding: 0 6px; border-radius: var(--p-r-sm); border: 1px solid var(--p-border); font-size: var(--p-t-xs);
  font-weight: var(--p-w-semibold); color: var(--p-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.p-score-bar { display: inline-flex; gap: 2px; }
.p-score-bar i { width: 4px; height: 10px; border-radius: 1px; background: var(--p-border); }
.p-score-bar i[data-on] { background: var(--p-text-2); }
.p-basis { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: var(--p-r-sm); border: 1px solid var(--p-border); color: var(--p-text-3);
  font-size: var(--p-t-xs); font-weight: var(--p-w-semibold); line-height: 1; cursor: help; flex: none; font-family: var(--p-font); }
.p-basis[data-b="E"] { border-style: dashed; }
.p-avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; background: var(--p-sunken); color: var(--p-text-2);
  font-size: var(--p-t-xs); font-weight: var(--p-w-semibold); border: 1px solid var(--p-border); overflow: hidden; }
.p-avatar[data-size="sm"] { width: 24px; height: 24px; font-size: var(--p-t-xs); }
.p-avatar img { width: 100%; height: 100%; object-fit: cover; }
.p-wait { display: inline-flex; align-items: center; gap: var(--p-s-1); font-size: var(--p-t-xs); font-weight: var(--p-w-medium); color: var(--p-text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.p-wait[data-level="warn"] { color: var(--p-warn); }
.p-wait[data-level="neg"] { color: var(--p-neg); }

/* ============================================================ panels, figures, funnel */
.p-panel { background: var(--p-surface); border: 1px solid var(--p-border); border-radius: var(--p-r-lg); min-width: 0; }
.p-panel-head { display: flex; align-items: center; gap: var(--p-s-3); min-height: 48px; padding: var(--p-s-3) var(--p-s-5); border-bottom: 1px solid var(--p-border); }
.p-panel-head[data-flush] { border-bottom: 0; padding-bottom: 0; }
.p-panel-title { margin: 0; font-size: var(--p-t-lg); line-height: var(--p-lh-lg); font-weight: var(--p-w-semibold); flex: 1; min-width: 0; }
.p-panel-sub { font-size: var(--p-t-sm); color: var(--p-text-2); }
.p-panel-body { padding: var(--p-s-4) var(--p-s-5); }
.p-panel-body[data-flush] { padding: 0; }
.p-panel-foot { padding: var(--p-s-3) var(--p-s-5); border-top: 1px solid var(--p-border); font-size: var(--p-t-sm); color: var(--p-text-2); }
.p-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.p-figure { display: grid; align-content: start; gap: var(--p-s-1); padding: var(--p-s-4) var(--p-s-5); min-width: 0; border-inline-start: 1px solid var(--p-border); }
.p-figure:first-child { border-inline-start: 0; }
.p-figure-label { display: flex; align-items: center; gap: var(--p-s-2); font-size: var(--p-t-sm); color: var(--p-text-2); }
.p-figure-value { font-size: var(--p-t-fig); line-height: var(--p-lh-fig); font-weight: var(--p-w-semibold); letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.p-figure-value[data-unavailable] { color: var(--p-text-3); }
.p-figure-note { font-size: var(--p-t-xs); line-height: var(--p-lh-xs); color: var(--p-text-3); }
.p-delta { font-size: var(--p-t-xs); font-weight: var(--p-w-medium); font-variant-numeric: tabular-nums; color: var(--p-text-2); }
.p-delta[data-good="true"] { color: var(--p-pos); }
.p-delta[data-good="false"] { color: var(--p-neg); }
@media (max-width: 767px) {
  .p-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .p-figure { border-inline-start: 0; border-top: 1px solid var(--p-border); }
  .p-figure:nth-child(-n+2) { border-top: 0; }
  .p-figure:nth-child(even) { border-inline-start: 1px solid var(--p-border); }
  .p-figure-value { font-size: var(--p-t-xl); line-height: var(--p-lh-xl); }
}
.p-funnel { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.p-funnel-step { position: relative; display: grid; align-content: start; gap: var(--p-s-1); padding: var(--p-s-4) var(--p-s-5) var(--p-s-4) var(--p-s-6); min-width: 0; }
.p-funnel-step + .p-funnel-step { border-inline-start: 1px solid var(--p-border); }
.p-funnel-rate { position: absolute; top: 50%; inset-inline-start: 0; transform: translate(-50%, -50%); z-index: 1; padding: 2px 6px; border-radius: var(--p-r-full);
  background: var(--p-surface); border: 1px solid var(--p-border); font-size: var(--p-t-xs); font-weight: var(--p-w-semibold); color: var(--p-text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
[dir="rtl"] .p-funnel-rate { transform: translate(50%, -50%); }
.p-funnel-bar { height: 4px; border-radius: 2px; background: var(--p-sunken); overflow: hidden; margin-top: var(--p-s-2); }
.p-funnel-bar i { display: block; height: 100%; background: var(--p-c1); border-radius: 2px; }
@media (max-width: 1199px) {
  .p-funnel { grid-auto-flow: row; }
  .p-funnel-step { padding: var(--p-s-3) var(--p-s-4); grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--p-s-3); align-items: center;
    grid-template-areas: "label value" "note rate" "bar bar"; }
  .p-funnel-step + .p-funnel-step { border-inline-start: 0; border-top: 1px solid var(--p-border); }
  .p-funnel-step > .p-figure-label { grid-area: label; }
  .p-funnel-step > .p-figure-value { grid-area: value; justify-self: end; font-size: var(--p-t-xl); line-height: var(--p-lh-xl); }
  .p-funnel-step > .p-figure-note { grid-area: note; }
  .p-funnel-rate { grid-area: rate; position: static; transform: none; justify-self: end; }
  [dir="rtl"] .p-funnel-rate { transform: none; }
  .p-funnel-bar { grid-area: bar; }
}

/* ============================================================ alerts, attention strip, toasts */
.p-alert { display: flex; align-items: flex-start; gap: var(--p-s-3); padding: var(--p-s-3) var(--p-s-4); border-radius: var(--p-r-lg); border: 1px solid var(--p-border);
  background: var(--p-surface); font-size: var(--p-t-sm); line-height: var(--p-lh-sm); }
.p-alert > .p-icon { margin-top: 1px; color: var(--p-accent); }
.p-alert[data-v="warn"] { background: var(--p-warn-soft); border-color: color-mix(in srgb, var(--p-warn) 25%, transparent); }
.p-alert[data-v="warn"] > .p-icon { color: var(--p-warn); }
.p-alert[data-v="neg"] { background: var(--p-neg-soft); border-color: color-mix(in srgb, var(--p-neg) 25%, transparent); }
.p-alert[data-v="neg"] > .p-icon { color: var(--p-neg); }
.p-alert-body { flex: 1; min-width: 0; }
.p-alert-title { font-weight: var(--p-w-semibold); }
.p-alert-action { margin-inline-start: auto; flex: none; }
.p-attention { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); border: 1px solid var(--p-border); border-radius: var(--p-r-lg); background: var(--p-surface); overflow: hidden; }
.p-attention-item { display: flex; align-items: center; gap: var(--p-s-3); padding: var(--p-s-3) var(--p-s-4); color: var(--p-text); text-decoration: none; border-inline-start: 1px solid var(--p-border); min-width: 0; }
.p-attention-item:first-child { border-inline-start: 0; }
.p-attention-item:hover { background: var(--p-hover); }
.p-attention-count { font-size: var(--p-t-lg); font-weight: var(--p-w-semibold); font-variant-numeric: tabular-nums; }
.p-attention-item[data-v="neg"] .p-attention-count { color: var(--p-neg); }
.p-attention-item[data-v="warn"] .p-attention-count { color: var(--p-warn); }
.p-attention-text { flex: 1; min-width: 0; font-size: var(--p-t-sm); color: var(--p-text-2); }
.p-attention-item > .p-icon { color: var(--p-text-3); }
@media (max-width: 767px) { .p-attention-item { border-inline-start: 0; border-top: 1px solid var(--p-border); } .p-attention-item:first-child { border-top: 0; } }
.p-toasts { position: fixed; z-index: 90; inset: auto auto var(--p-s-6) var(--p-s-6); display: grid; gap: var(--p-s-2); }
.p-toast { display: flex; align-items: center; gap: var(--p-s-3); min-height: 40px; padding: var(--p-s-2) var(--p-s-2) var(--p-s-2) var(--p-s-4); border-radius: var(--p-r-lg);
  background: var(--p-ink); color: var(--p-on-ink); font-size: var(--p-t-sm); box-shadow: var(--p-sh-modal); animation: p-up var(--p-med) var(--p-ease); }
.p-toast .p-btn { height: 28px; background: none; border-color: transparent; color: inherit; text-decoration: underline; }
@keyframes p-up { from { transform: translateY(6px); opacity: 0; } }
@media (max-width: 767px) { .p-toasts { inset: auto var(--p-s-3) calc(72px + env(safe-area-inset-bottom)) var(--p-s-3); } }

/* ============================================================ tables, lists, filters, bulk */
.p-table-wrap { overflow-x: auto; }
.p-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--p-t-sm); }
.p-table th { position: sticky; top: 0; z-index: 1; height: 36px; padding: 0 var(--p-s-3); background: var(--p-sunken); border-bottom: 1px solid var(--p-border); color: var(--p-text-3);
  font-size: var(--p-t-xs); font-weight: var(--p-w-medium); text-align: start; white-space: nowrap; }
.p-table th:first-child { padding-inline-start: var(--p-s-5); } .p-table td:first-child { padding-inline-start: var(--p-s-5); }
.p-table th:last-child { padding-inline-end: var(--p-s-5); } .p-table td:last-child { padding-inline-end: var(--p-s-5); }
.p-table th[data-sort] { cursor: pointer; } .p-table th[data-sort]:hover { color: var(--p-text); }
.p-table th[aria-sort] { color: var(--p-text); }
.p-table th[aria-sort="ascending"]::after { content: " ↑"; } .p-table th[aria-sort="descending"]::after { content: " ↓"; }
.p-table td { height: 44px; padding: var(--p-s-2) var(--p-s-3); border-bottom: 1px solid var(--p-border); vertical-align: middle; }
.p-table tbody tr:last-child td { border-bottom: 0; }
.p-table[data-compact] td { height: 36px; padding-top: var(--p-s-1); padding-bottom: var(--p-s-1); }
.p-table .p-r, .p-table th.p-r { text-align: end; font-variant-numeric: tabular-nums; }
.p-table tbody tr[data-href], .p-table tbody tr[data-open] { cursor: pointer; }
.p-table tbody tr:hover td { background: var(--p-hover); }
.p-table tbody tr[aria-selected="true"] td { background: var(--p-accent-soft); }
.p-table tfoot td { font-weight: var(--p-w-semibold); border-top: 1px solid var(--p-border); border-bottom: 0; background: var(--p-sunken); }
.p-table .p-cell-main { font-weight: var(--p-w-medium); color: var(--p-text); }
.p-table .p-cell-sub { font-size: var(--p-t-xs); color: var(--p-text-3); }
.p-table .p-cell-actions { width: 1%; white-space: nowrap; text-align: end; }
.p-table .p-check { width: 1%; }
.p-pager { display: flex; align-items: center; gap: var(--p-s-2); justify-content: flex-end; padding: var(--p-s-3) var(--p-s-5); font-size: var(--p-t-sm); color: var(--p-text-2); border-top: 1px solid var(--p-border); }
.p-list { display: flex; flex-direction: column; }
.p-li { display: flex; gap: var(--p-s-3); align-items: flex-start; padding: var(--p-s-3) var(--p-s-4); border-bottom: 1px solid var(--p-border); color: inherit; text-decoration: none; cursor: pointer; position: relative; }
.p-li:last-child { border-bottom: 0; }
.p-li:hover { background: var(--p-hover); }
.p-li[aria-selected="true"], .p-li[aria-current="true"] { background: var(--p-accent-soft); }
.p-li[data-unread]::before { content: ""; position: absolute; top: 50%; inset-inline-start: 6px; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--p-accent); }
.p-li-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.p-li-top { display: flex; align-items: baseline; gap: var(--p-s-2); }
.p-li-title { font-weight: var(--p-w-semibold); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: isolate; }
.p-li-time { font-size: var(--p-t-xs); color: var(--p-text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.p-li-text { font-size: var(--p-t-sm); color: var(--p-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; text-align: start; }
.p-li-meta { display: flex; align-items: center; gap: var(--p-s-2); flex-wrap: wrap; margin-top: 2px; }
.p-filterbar { display: flex; align-items: center; gap: var(--p-s-2); flex-wrap: wrap; padding: var(--p-s-3) 0; }
.p-filterbar .p-input-icon { width: 260px; max-width: 100%; }
.p-chip { display: inline-flex; align-items: center; gap: var(--p-s-1); height: 28px; padding: 0 var(--p-s-1) 0 var(--p-s-3); border-radius: var(--p-r-md); background: var(--p-accent-soft);
  color: var(--p-text); font-size: var(--p-t-sm); white-space: nowrap; }
.p-chip b { font-weight: var(--p-w-semibold); }
.p-chip button { width: 22px; height: 22px; display: grid; place-items: center; border: 0; background: none; border-radius: var(--p-r-sm); color: var(--p-text-2); cursor: pointer; }
.p-chip button:hover { background: var(--p-surface); color: var(--p-text); }
.p-bulkbar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--p-s-2); padding: var(--p-s-2) var(--p-s-3); border-radius: var(--p-r-lg); background: var(--p-ink); color: var(--p-on-ink); font-size: var(--p-t-sm); }
.p-bulkbar .p-btn { background: transparent; border-color: color-mix(in srgb, var(--p-on-ink) 30%, transparent); color: var(--p-on-ink); height: 28px; }
.p-bulkbar .p-btn:hover { background: color-mix(in srgb, var(--p-on-ink) 12%, transparent); }
@media (max-width: 767px) { .p-filterbar .p-input-icon { width: 100%; } .p-table td { height: 48px; } }

/* ============================================================ side panel (drawer), dialog */
.p-scrim { position: fixed; inset: 0; z-index: 70; background: rgb(14 14 16 / .32); animation: p-fade var(--p-med) var(--p-ease); }
@keyframes p-fade { from { opacity: 0; } }
.p-drawer { position: fixed; z-index: 71; inset: 8px 8px 8px auto; width: min(var(--p-panel-w), calc(100vw - 16px)); display: flex; flex-direction: column; background: var(--p-surface);
  border-radius: var(--p-r-xl); box-shadow: var(--p-sh-modal); animation: p-slide var(--p-med) var(--p-ease); }
@keyframes p-slide { from { transform: translateX(16px); opacity: 0; } }
.p-drawer-head { display: flex; align-items: center; gap: var(--p-s-2); min-height: 56px; padding: var(--p-s-3) var(--p-s-3) var(--p-s-3) var(--p-s-5); border-bottom: 1px solid var(--p-border); }
.p-drawer-title { margin: 0; flex: 1; min-width: 0; font-size: var(--p-t-lg); line-height: var(--p-lh-lg); font-weight: var(--p-w-semibold); }
.p-drawer-body { flex: 1; overflow-y: auto; padding: var(--p-s-5); display: grid; align-content: start; gap: var(--p-s-5); }
.p-drawer-foot { display: flex; justify-content: flex-end; gap: var(--p-s-2); padding: var(--p-s-3) var(--p-s-5); border-top: 1px solid var(--p-border); }
.p-dialog { position: fixed; z-index: 81; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100vw - 24px)); background: var(--p-surface);
  border-radius: var(--p-r-xl); box-shadow: var(--p-sh-modal); animation: p-pop var(--p-med) var(--p-ease); }
@keyframes p-pop { from { transform: translate(-50%, -48%) scale(.98); opacity: 0; } }
.p-dialog-body { padding: var(--p-s-6) var(--p-s-6) var(--p-s-4); display: grid; gap: var(--p-s-2); }
.p-dialog-title { margin: 0; font-size: var(--p-t-lg); line-height: var(--p-lh-lg); font-weight: var(--p-w-semibold); }
.p-dialog-foot { display: flex; justify-content: flex-end; gap: var(--p-s-2); padding: var(--p-s-3) var(--p-s-6) var(--p-s-5); }
@media (max-width: 767px) {
  .p-drawer { inset: 0; width: 100%; border-radius: 0; }
  .p-dialog { top: auto; bottom: 0; left: 0; transform: none; width: 100%; border-radius: var(--p-r-xl) var(--p-r-xl) 0 0; padding-bottom: env(safe-area-inset-bottom); animation: p-up var(--p-med) var(--p-ease); }
  .p-dialog-foot { flex-direction: column-reverse; } .p-dialog-foot .p-btn { width: 100%; height: 44px; }
}

/* ============================================================ settings rows */
.p-settings { display: grid; grid-template-columns: 200px minmax(0, var(--p-settings-w)); gap: var(--p-s-8); align-items: start; }
.p-settings-nav { position: sticky; top: calc(var(--p-topbar-h) + var(--p-s-6)); display: grid; gap: 2px; }
.p-settings-group { padding: var(--p-s-3) var(--p-s-2) var(--p-s-1); font-size: var(--p-t-xs); font-weight: var(--p-w-medium); color: var(--p-text-3); }
@media (max-width: 1023px) { .p-settings { grid-template-columns: minmax(0, 1fr); } .p-settings-nav { position: static; display: flex; overflow-x: auto; gap: var(--p-s-1); } .p-settings-group { display: none; } }
.p-srow { display: flex; align-items: center; gap: var(--p-s-4); padding: var(--p-s-3) var(--p-s-5); border-bottom: 1px solid var(--p-border); min-height: 56px; }
.p-srow:last-child { border-bottom: 0; }
.p-srow[data-open] { cursor: pointer; } .p-srow[data-open]:hover { background: var(--p-hover); }
.p-srow-label { flex: 1; min-width: 0; display: grid; gap: 2px; }
.p-srow-title { font-weight: var(--p-w-medium); }
.p-srow-value { font-size: var(--p-t-sm); color: var(--p-text-2); }
.p-srow > .p-icon { color: var(--p-text-3); }

/* ============================================================ empty, loading, error */
.p-empty { display: grid; justify-items: center; gap: var(--p-s-3); padding: var(--p-s-10) var(--p-s-6); text-align: center; }
.p-empty-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--p-sunken); color: var(--p-text-2); }
.p-empty-text { max-width: 420px; color: var(--p-text-2); }
.p-empty-text b { display: block; color: var(--p-text); font-weight: var(--p-w-semibold); margin-bottom: 2px; }
.p-skel { display: block; height: 12px; border-radius: var(--p-r-sm); background: var(--p-skel); position: relative; overflow: hidden; }
.p-skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--p-surface) 60%, transparent), transparent);
  animation: p-shimmer 1.4s infinite; }
@keyframes p-shimmer { to { transform: translateX(100%); } }
.p-skel[data-h="fig"] { height: 28px; width: 60%; }
@media (prefers-reduced-motion: reduce) { .p-skel::after { animation: none; } }

/* ============================================================ charts (inline SVG drawn by ui.js) */
.p-chart { width: 100%; height: auto; display: block; overflow: visible; }
.p-chart .p-grid-line { stroke: var(--p-grid); stroke-width: 1; }
.p-chart .p-axis-label { fill: var(--p-text-3); font-size: var(--p-t-xs); font-family: var(--p-font); }
.p-chart .p-series-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.p-chart .p-series-area { opacity: .08; }
.p-chart .p-bar { rx: 2px; }
.p-legend { display: flex; gap: var(--p-s-4); flex-wrap: wrap; font-size: var(--p-t-xs); color: var(--p-text-2); }
.p-legend i { display: inline-block; width: 10px; height: 2px; margin-inline-end: 6px; vertical-align: middle; border-radius: 1px; }

/* ============================================================ conversation */
.p-thread { display: flex; flex-direction: column; gap: 2px; padding: var(--p-s-4) var(--p-s-5); background: var(--p-thread-bg); }
.p-day { align-self: center; margin: var(--p-s-3) 0; padding: 2px var(--p-s-2); border-radius: var(--p-r-sm); background: var(--p-sunken); color: var(--p-text-3); font-size: var(--p-t-xs); }
.p-event { align-self: center; margin: var(--p-s-2) 0; font-size: var(--p-t-xs); color: var(--p-text-3); display: flex; align-items: center; gap: var(--p-s-1); }
.p-bubble { max-width: min(560px, 78%); padding: var(--p-s-2) var(--p-s-3); border-radius: var(--p-r-lg); font-size: var(--p-t-md); line-height: var(--p-lh-md); unicode-bidi: plaintext;
  text-align: start; overflow-wrap: anywhere; position: relative; }
.p-bubble[data-dir="in"] { align-self: flex-start; background: var(--p-bubble-in); border: 1px solid var(--p-border); border-end-start-radius: var(--p-r-sm); }
.p-bubble[data-dir="out"] { align-self: flex-end; background: var(--p-bubble-team); border-end-end-radius: var(--p-r-sm); }
.p-bubble[data-dir="out"][data-ai] { background: var(--p-bubble-ai); border-inline-start: 2px solid var(--p-ai); }
.p-bubble-meta { display: flex; justify-content: flex-end; align-items: center; gap: var(--p-s-1); margin-top: 2px; font-size: var(--p-t-xs); color: var(--p-text-3); font-variant-numeric: tabular-nums; }
.p-bubble-who { display: flex; align-items: center; gap: var(--p-s-1); font-size: var(--p-t-xs); font-weight: var(--p-w-semibold); color: var(--p-ai); margin-bottom: 2px; }
.p-bubble + .p-bubble[data-dir="in"], .p-bubble + .p-bubble[data-dir="out"] { margin-top: 2px; }
.p-bubble[data-dir="in"] + .p-bubble[data-dir="out"], .p-bubble[data-dir="out"] + .p-bubble[data-dir="in"] { margin-top: var(--p-s-2); }
.p-composer { display: flex; gap: var(--p-s-2); align-items: center; padding: var(--p-s-3) var(--p-s-4); border-top: 1px solid var(--p-border); background: var(--p-surface); flex-wrap: wrap; }
.p-composer[data-open] { align-items: flex-end; }
.p-composer .p-textarea { min-height: 40px; flex: 1; }
.p-why { display: flex; align-items: center; gap: var(--p-s-2); padding: var(--p-s-2) var(--p-s-5); font-size: var(--p-t-sm); color: var(--p-text-2); background: var(--p-sunken); border-bottom: 1px solid var(--p-border); }
.p-why b { color: var(--p-text); font-weight: var(--p-w-semibold); }

/* ============================================================ gallery page only */
.p-gallery-section { display: grid; gap: var(--p-s-4); }
.p-gallery-h { margin: 0; font-size: var(--p-t-xs); font-weight: var(--p-w-semibold); color: var(--p-text-3); text-transform: uppercase; letter-spacing: .06em; }
.p-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--p-s-3); }
.p-swatch { border: 1px solid var(--p-border); border-radius: var(--p-r-lg); overflow: hidden; background: var(--p-surface); font-size: var(--p-t-xs); }
.p-swatch i { display: block; height: 40px; border-bottom: 1px solid var(--p-border); }
.p-swatch div { padding: var(--p-s-2); display: grid; gap: 2px; }
.p-swatch code { color: var(--p-text-3); font-size: var(--p-t-xs); }

/* ============================================================ B1: the shell around the pages during the migration
   The old pages render inside .p-main > main.app-content (old classes) until their own stage; heights computed by the
   old stylesheet from --topbar-h follow the new top bar. */
html[data-ui="next"] { --topbar-h: calc(var(--p-topbar-h) + env(safe-area-inset-top)); }
html[data-ui="next"] body { background: var(--p-bg); }
.p-shell .p-topbar { height: var(--topbar-h, var(--p-topbar-h)); padding-top: env(safe-area-inset-top); }
.p-skip { position: absolute; z-index: 90; inset-inline-start: var(--p-s-2); top: -60px; padding: var(--p-s-2) var(--p-s-3); border-radius: var(--p-r-md);
  background: var(--p-ink, var(--p-text)); color: var(--p-bg); text-decoration: none; font-weight: var(--p-w-semibold); }
.p-skip:focus { top: var(--p-s-2); }
.p-side-head { display: flex; align-items: center; padding: var(--p-s-2); min-height: 56px; }
/* workspace switcher (old markup, bindWorkspaceSwitcher) in the new colours */
.p-shell .ws-btn, .p-shell .ws-static { border-radius: var(--p-r-md); color: var(--p-text); font: inherit; }
.p-shell .ws-btn:hover, .p-shell .ws-btn[aria-expanded="true"] { background: var(--p-hover); border-color: var(--p-border); }
.p-shell .ws-name { font-size: var(--p-t-md); font-weight: var(--p-w-semibold); }
.p-shell .ws-sub { font-size: var(--p-t-xs); color: var(--p-text-3); }
.p-shell .ws-pop { background: var(--p-surface); border: 1px solid var(--p-border); border-radius: var(--p-r-lg); box-shadow: var(--p-sh-pop); }
.p-shell .ws-item, .p-shell .ws-co-name, .p-shell .ws-adminlink { font-size: var(--p-t-md); color: var(--p-text); }
.p-shell .ws-item:hover, .p-shell .ws-item:focus-visible { background: var(--p-hover); }
.p-shell .ws-item.is-cur { background: var(--p-accent-soft); }
.p-shell .ws-lab, .p-shell .ws-co-sub { font-size: var(--p-t-xs); color: var(--p-text-3); }
/* collapsed: icons only, tooltips from title */
.p-sidebar[data-collapsed] .ws-txt, .p-sidebar[data-collapsed] .ws-btn > .i { display: none; }
.p-sidebar[data-collapsed] .ws-btn, .p-sidebar[data-collapsed] .ws-static { justify-content: center; padding: 6px 0; }
.p-sidebar[data-collapsed] .p-nav-item { justify-content: center; padding: 0; }
.p-sidebar[data-collapsed] .p-user { flex-direction: column; padding: var(--p-s-2) 0; }
.p-nav-item { position: relative; }
/* Clients' count: plain figure in the menu (the old .count is a red pill) */
.p-shell .p-nav-item .count { display: inline; min-width: 0; height: auto; padding: 0; border-radius: 0; background: none; color: var(--p-text-2);
  font-size: var(--p-t-xs); font-weight: var(--p-w-semibold); font-variant-numeric: tabular-nums; }
.p-shell .p-sidebar[data-collapsed] .p-nav-item .count { display: block; position: absolute; top: 2px; inset-inline-end: 6px; min-width: 8px; height: 8px; padding: 0;
  border-radius: var(--p-r-full); background: var(--p-accent); font-size: 0; }
.p-nav-scrim { display: none; }
/* tabs of the place, above the page (B3+ moves them into each page header) */
.p-tabs-bar { padding: 0 32px; background: var(--p-bg); }
.p-tabs-bar .p-tabs { max-width: calc(1400px - 64px); margin: 0 auto; }
/* bell */
.p-bell { position: relative; }
.p-bell-count { position: absolute; top: 2px; inset-inline-end: 0; min-width: 18px; height: 18px; padding: 0 4px; border-radius: var(--p-r-full);
  background: var(--p-neg); color: var(--p-surface); font-size: var(--p-t-xs); line-height: 18px; font-weight: var(--p-w-semibold); text-align: center; font-variant-numeric: tabular-nums; }
.p-bell-count[hidden] { display: none; }
html[data-ui="next"] .bellpanel { top: calc(var(--topbar-h) + 4px); background: var(--p-surface); border: 1px solid var(--p-border); border-radius: var(--p-r-lg); box-shadow: var(--p-sh-pop); }
.p-shell .p-bottombar .count { position: absolute; display: block; text-align: center; top: 6px; inset-inline-start: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 4px; border-radius: var(--p-r-full);
  background: var(--p-accent); color: var(--p-on-accent); font-size: var(--p-t-xs); line-height: 18px; font-weight: var(--p-w-semibold); }
@media (max-width: 1199px) { .p-tabs-bar { padding: 0 28px; } }
@media (max-width: 767px) {
  .p-shell .p-collapse { display: none; }
  .p-main { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .p-tabs-bar { padding: 0 var(--p-s-4); }
  body.nav-open .p-nav-scrim { display: block; position: fixed; inset: 0; z-index: 74; background: var(--p-scrim, rgba(20, 18, 14, .4)); }
  .p-sidebar[data-collapsed] .p-nav-label, .p-sidebar[data-collapsed] .ws-txt { display: initial; }
}
/* Clients (old page until B3) fills the height under the new top bar: the old height kept 41 px for the old shell */
@media (min-width: 992px) { .p-shell .app-content.cv-page .cv { height: calc(100dvh - var(--topbar-h)); } }

/* ---------------------------------------------------------------- B3 (2026-11-27): Accueil and Clients in the new interface */
.hm { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--p-s-4); align-content: start; }
.hm > * { min-width: 0; }
.hm > div:empty, .hm > [hidden] { display: none; }
.hm .p-ph-bar-tools { display: flex; gap: var(--p-s-2); flex-wrap: wrap; align-items: center; }
.hm-who { width: auto; min-width: 170px; }
.hm-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--p-s-4); align-items: start; }
.hm-cols.is-one { grid-template-columns: minmax(0, 1fr); }
.hm-cols > div > .p-panel, .hm > div > .p-panel { margin: 0; }
.hm-funnel-foot { display: flex; flex-wrap: wrap; gap: var(--p-s-2) var(--p-s-5); margin-top: var(--p-s-3); padding-top: var(--p-s-3); border-top: 1px solid var(--p-border); font-size: var(--p-t-sm); color: var(--p-text-2); }
.hm-ai-in { display: flex; align-items: center; gap: var(--p-s-3); flex-wrap: wrap; padding: var(--p-s-3) var(--p-s-4); font-size: var(--p-t-sm); color: var(--p-text-2); }
.hm-ai-in > .p-icon { color: var(--p-ai); } .hm-ai-in > b { color: var(--p-text); }
.hm .p-li-meta { display: flex; gap: var(--p-s-2); align-items: center; flex-wrap: wrap; }
.hm .p-li-time { color: var(--p-text-3); }
@media (max-width: 1100px) { .hm-cols { grid-template-columns: minmax(0, 1fr); } }

/* Clients: the whole thread at once (R2), the composer behind "Répondre ici"; the why line; neutral time, coloured wait */
html[data-ui="next"] .cv .cv-followbox, html[data-ui="next"] .cv .cv-conv-back { display: none; }
html[data-ui="next"] .cv.cv-follow .ib-scroll { display: flex; }
html[data-ui="next"] .cv.cv-follow [data-approvals] { display: block; }
html[data-ui="next"] .cv.cv-follow.reply-open .ib-compose, html[data-ui="next"] .cv.cv-follow.reply-open .cv-ai { display: block; }
html[data-ui="next"] .cv:not(.cv-follow) [data-replyhere] { display: none; }
.cvn-reply { display: flex; gap: var(--p-s-2); flex: none; }
.cvn-why { padding: var(--p-s-2) var(--p-s-4); font-size: var(--p-t-sm); color: var(--p-text-2); background: var(--p-surface); border-bottom: 1px solid var(--p-border); }
.cvn-why b { color: var(--p-text); font-weight: var(--p-w-semibold); }
.cvn-why:empty { display: none; }
.cvn-meta { display: flex; align-items: center; gap: var(--p-s-2); margin-top: var(--p-s-1); min-width: 0; }
.cvn-row .ib-top time { color: var(--p-text-3); font-weight: var(--p-w-regular); }
.cvn-owner { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-size: var(--p-t-xs); font-weight: var(--p-w-semibold); background: var(--p-sunken); color: var(--p-text-2); }
.cvn-owner.is-none { color: var(--p-text-3); }
.cvn-mbar { display: none; }
@media (max-width: 1520px) { .cvn-reply [data-wabtn] span { display: none; } }
.hm .p-ph-bar-tools { max-width: 100%; min-width: 0; }
.hm .p-ph-bar-tools .p-seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.hm .p-ph-bar-tools .p-seg button { flex: none; }
html[data-ui="next"] .cv-tabs { flex-wrap: wrap; overflow: visible; }
.hm #hm-team th { white-space: normal; vertical-align: bottom; }
@media (min-width: 1101px) and (max-width: 1500px) { .hm-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 62em) {
  html[data-ui="next"] .cvn-mbar { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: var(--p-s-2); padding: var(--p-s-2) var(--p-s-3); border-top: 1px solid var(--p-border); background: var(--p-surface); }
  html[data-ui="next"] .cvn-mbar .p-btn { justify-content: center; height: 44px; }
  html[data-ui="next"] .ib-head .cvn-reply, html[data-ui="next"] .ib-head .cv-hctl, html[data-ui="next"] .ib-head .cv-card-btn { display: none; }
  html[data-ui="next"] .cv-tabs { flex-wrap: nowrap; overflow-x: auto; }
}

/* Clients › Tableau (board by step) and Table, Infos pane with step and owner first (B3, blueprint §2.1–2.3) */
.cvw { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--p-s-3); align-content: start; }
.cvw > * { min-width: 0; }
.app-content.cvw { min-width: 0; }
.cvw .p-ph-bar-tools { display: flex; flex-wrap: wrap; gap: var(--p-s-2); align-items: center; max-width: 100%; }
.cvw-q { width: 240px; max-width: 100%; } .cvw-sel { width: auto; min-width: 160px; }
.cv-titlebar .p-seg { margin-inline-start: auto; }
.cvb { position: relative; display: grid; grid-template-columns: repeat(5, minmax(230px, 1fr)); gap: var(--p-s-3); overflow-x: auto; align-items: start; padding-bottom: var(--p-s-2); }
.cvb-col { background: var(--p-sunken); border-radius: var(--p-r-lg); display: flex; flex-direction: column; min-height: 160px; max-height: calc(100dvh - var(--topbar-h) - 190px); }
.cvb-head { display: flex; align-items: center; justify-content: space-between; gap: var(--p-s-2); padding: var(--p-s-3); }
.cvb-n { font-size: var(--p-t-sm); color: var(--p-text-2); font-weight: var(--p-w-semibold); }
.cvb-cards { display: grid; gap: var(--p-s-2); align-content: start; padding: 0 var(--p-s-2) var(--p-s-2); overflow-y: auto; min-height: 80px; border-radius: var(--p-r-md); }
.cvb-cards.is-over { outline: 2px dashed var(--p-accent); outline-offset: -2px; background: var(--p-accent-soft); }
.cvb-card { position: relative; background: var(--p-surface); border: 1px solid var(--p-border); border-radius: var(--p-r-md); padding: var(--p-s-2) var(--p-s-3); display: grid; gap: var(--p-s-1); cursor: grab; min-width: 0; }
.cvb-card:hover { border-color: var(--p-border-strong); } .cvb-card:focus-visible { outline: 2px solid var(--p-focus); outline-offset: 1px; }
.cvb-card.is-drag { opacity: .45; }
.cvb-top { display: flex; align-items: center; justify-content: space-between; gap: var(--p-s-1); min-width: 0; }
.cvb-top .p-iconbtn { width: 28px; height: 28px; flex: none; }
.cvb-name { font-weight: var(--p-w-semibold); color: var(--p-text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cvb-prev { font-size: var(--p-t-sm); color: var(--p-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cvb-meta { display: flex; align-items: center; gap: var(--p-s-2); min-width: 0; }
.cvb-more, .cvb-empty { margin: 0; padding: var(--p-s-2); font-size: var(--p-t-xs); color: var(--p-text-3); }
.cvb-hint { margin: 0; }
.cvw-tbar { display: flex; align-items: center; gap: var(--p-s-3); padding: var(--p-s-2) var(--p-s-4); border-bottom: 1px solid var(--p-border); }
.cvw-all { display: inline-flex; align-items: center; gap: var(--p-s-2); font-size: var(--p-t-sm); color: var(--p-text-2); cursor: pointer; }
.cvw-tbl tr[data-id] { cursor: pointer; } .cvw-tbl tr[data-id]:hover td { background: var(--p-hover); }
.cvw-tbl td:first-child, .cvw-tbl th:first-child { width: 36px; }
.cvw-tbl input[type=checkbox], .cvw-all input { width: 16px; height: 16px; accent-color: var(--p-accent); }
.cvw-clip { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
#cvwbulk:empty { display: none; }
.cvn-ctx .cv-hctl { flex-wrap: wrap; }
@media (max-width: 62em) {
  .cvb { grid-template-columns: repeat(5, 82%); scroll-snap-type: x mandatory; }
  .cvb-col { scroll-snap-align: start; max-height: calc(100dvh - var(--topbar-h) - 230px); }
  .cvw-q, .cvw-sel { width: 100%; }
}

/* ---------------------------------------------------------------- B4 (2026-11-27): Campagnes */
.cg { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--p-s-4); align-content: start; }
.cg > * { min-width: 0; } .app-content.cg { min-width: 0; }
.cg .p-panel { margin: 0; }
.cg .p-ph-bar-tools { display: flex; flex-wrap: wrap; gap: var(--p-s-2); align-items: center; max-width: 100%; min-width: 0; }
.cg .p-ph-bar-tools .p-seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; } .cg .p-ph-bar-tools .p-seg button { flex: none; }
.cg-dates { display: inline-flex; gap: var(--p-s-2); } .cg-dates .p-input { width: 150px; }
.cg-figs { margin-top: var(--p-s-4); padding-top: var(--p-s-2); border-top: 1px solid var(--p-border); }
.cg-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--p-s-4); align-items: start; }
.cg-name { display: flex; align-items: center; gap: var(--p-s-2); min-width: 0; }
.cg-title { font-weight: var(--p-w-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
tr.cg-click { cursor: pointer; } tr.cg-click:hover td { background: var(--p-hover); }
.cg-ins { list-style: none; margin: 0; padding: 0; }
.cg-ins li { display: flex; gap: var(--p-s-3); align-items: flex-start; padding: var(--p-s-3) var(--p-s-4); border-bottom: 1px solid var(--p-border); font-size: var(--p-t-sm); }
.cg-ins li:last-child { border-bottom: 0; } .cg-ins .p-badge { flex: none; }
.cg-facts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--p-s-2); font-size: var(--p-t-sm); color: var(--p-text-2); }
.cg-facts .p-faint.p-xs { flex-basis: 100%; }
@media (max-width: 1100px) { .cg-cols { grid-template-columns: minmax(0, 1fr); } }

/* B4: Résultats */
.rsn2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--p-s-4); align-content: start; }
.rsn2 > * { min-width: 0; } .app-content.rsn2 { min-width: 0; } .rsn2 .p-panel { margin: 0; }
.rsn2 .p-ph-bar-tools { display: flex; flex-wrap: wrap; gap: var(--p-s-2); align-items: center; max-width: 100%; min-width: 0; }
.rsn2 .p-ph-bar-tools .p-seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; } .rsn2 .p-ph-bar-tools .p-seg button { flex: none; }
.rs-sel { width: auto; min-width: 170px; }
.rsn2 #rs-adv:empty { display: none; }
.rs-adv-note { display: flex; gap: var(--p-s-2); align-items: center; flex-wrap: wrap; margin: 0; }
.rs-recs2 { margin: 0; padding-inline-start: var(--p-s-5); display: grid; gap: var(--p-s-2); font-size: var(--p-t-sm); }
@media (max-width: 62em) { .rs-sel { width: 100%; } }
/* an estimate is smaller than the measured figures (B4, audit §4.5) */
html[data-ui="next"] .kpi.is-est .v { font-size: var(--p-t-lg); color: var(--p-text-2); }
html[data-ui="next"] .kpi .p-basis { vertical-align: middle; }

/* ---------------------------------------------------------------- B5 Réglages (NAVIGATION_BLUEPRINT §4)
   a 200 px sub-nav and a 720 px column (wide pages: 1040 px); under 900 px the sub-nav goes, the breadcrumb leads back */
.p-st { display: flex; align-items: flex-start; gap: var(--p-s-6); max-width: 1320px; width: 100%; margin: 0 auto; padding: 0 var(--p-s-6); min-width: 0; }
.p-st-nav { flex: 0 0 200px; position: sticky; top: calc(var(--topbar-h, 56px) + var(--p-s-4)); padding: 28px 0 var(--p-s-6); display: grid; gap: var(--p-s-3);
  max-height: calc(100dvh - var(--topbar-h, 56px) - var(--p-s-4)); overflow-y: auto; }
.p-st-group { display: grid; gap: 1px; }
.p-st-h { font-size: var(--p-t-xs); line-height: var(--p-lh-xs); font-weight: var(--p-w-semibold); color: var(--p-text-3); padding: 0 var(--p-s-2) var(--p-s-1); text-transform: uppercase; letter-spacing: .04em; }
.p-st-nav a { display: block; padding: 4px var(--p-s-2); border-radius: var(--p-r-md); color: var(--p-text-2); text-decoration: none; font-size: var(--p-t-sm); }
.p-st-nav a:hover { background: var(--p-hover); color: var(--p-text); }
.p-st-nav a[aria-current="page"] { background: var(--p-accent-soft); color: var(--p-text); font-weight: var(--p-w-semibold); }
.p-shell .app-content.p-st-col { flex: 1; min-width: 0; max-width: 720px; margin: 0; padding-left: 0; padding-right: 0; }
.p-shell .app-content.p-st-col[data-wide] { max-width: 1040px; }
@media (max-width: 899px) { .p-st { display: block; padding: 0; } .p-st-nav { display: none; } .p-shell .app-content.p-st-col { max-width: none; padding: 20px 16px 32px; } }
/* overview: groups of rows "label · current value · Modifier" */
.st-g { margin-bottom: var(--p-s-5); }
.p-st-col .p-panel + .p-panel, .p-st-col .p-figures + .p-panel { margin-top: var(--p-s-4); }
.st-g .p-panel-body { padding: 0; }
a.p-srow, button.p-srow { color: inherit; text-decoration: none; width: 100%; text-align: start; font: inherit; background: none; border: 0; border-bottom: 1px solid var(--p-border); cursor: pointer; }
a.p-srow:hover, button.p-srow:hover { background: var(--p-hover); }
.p-srow:last-child { border-bottom: 0; }
.p-srow-act { font-size: var(--p-t-sm); color: var(--p-accent); font-weight: var(--p-w-medium); flex: none; }
.p-srow-value [data-v="neg"], .st-bad { color: var(--p-neg); }
.p-srow-value [data-v="warn"], .st-warn { color: var(--p-warn); }
@media (max-width: 599px) { .p-srow-act { display: none; } }
.st-form { display: grid; gap: var(--p-s-4); }
.st-form label { display: grid; gap: var(--p-s-1); font-size: var(--p-t-sm); font-weight: var(--p-w-medium); }
.st-form input { height: var(--p-hit); padding: 0 var(--p-s-3); border: 1px solid var(--p-border-strong, var(--p-border)); border-radius: var(--p-r-md); font: inherit; background: var(--p-surface); color: var(--p-text); }
.st-form .p-xs { font-weight: normal; color: var(--p-text-3); }
/* Équipe (B5 part 2) */
.tm-bar { display: flex; flex-wrap: wrap; gap: var(--p-s-3); align-items: center; margin: var(--p-s-4) 0; }
.tm-bar .p-input-icon { flex: 1 1 220px; max-width: 320px; }
#tlist + .p-panel, .p-st-col .p-alert + .tm-bar { margin-top: var(--p-s-4); }
#tlist tr[data-u] { cursor: pointer; } #tlist tr[data-u]:hover { background: var(--p-hover); } #tlist tr.is-off { opacity: .6; }
.tm-roles { display: grid; grid-template-columns: max-content 1fr; gap: var(--p-s-2) var(--p-s-4); margin: 0 0 var(--p-s-3); font-size: var(--p-t-sm); }
.tm-roles dt { font-weight: var(--p-w-semibold); } .tm-roles dd { margin: 0; color: var(--p-text-2); }
.tm-head { display: flex; align-items: center; gap: var(--p-s-3); margin-bottom: var(--p-s-5); } .tm-head > div { flex: 1; min-width: 0; }
.tm-facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--p-s-1) var(--p-s-4); margin: var(--p-s-5) 0; font-size: var(--p-t-sm); }
.tm-facts dt { color: var(--p-text-3); } .tm-facts dd { margin: 0; }
.tm-actions { display: flex; flex-wrap: wrap; gap: var(--p-s-2); padding-top: var(--p-s-4); border-top: 1px solid var(--p-border); }
.st-form select.p-select { font-weight: normal; }
@media (max-width: 599px) { .tm-hide-s { display: none; } .tm-roles { grid-template-columns: 1fr; } }
/* Journal (B5 part 2) */
.au-f { display: flex; gap: var(--p-s-2); flex-wrap: wrap; flex: 1 1 320px; } .au-f .p-select { width: auto; min-width: 160px; max-width: 260px; }
.au-clip { display: block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--p-text-2); }
@media (max-width: 599px) { .au-detail { display: none; } .au-f .p-select { flex: 1; min-width: 0; } }
/* Score (B5 part 2): four folding groups */
.sc-grp { border: 1px solid var(--p-border); border-radius: var(--p-r-lg); background: var(--p-surface); }
.sc-grp > summary { list-style: none; display: grid; gap: 2px; padding: var(--p-s-3) var(--p-s-5); cursor: pointer; position: relative; padding-inline-end: 40px; }
.sc-grp > summary::-webkit-details-marker { display: none; }
.sc-grp > summary::after { content: ""; position: absolute; inset-inline-end: var(--p-s-5); top: 50%; width: 8px; height: 8px; border: solid var(--p-text-3); border-width: 0 2px 2px 0; transform: translateY(-70%) rotate(45deg); }
.sc-grp[open] > summary::after { transform: translateY(-30%) rotate(-135deg); }
.sc-grp[open] > summary { border-bottom: 1px solid var(--p-border); }
.sc-grp > .card { border: 0; box-shadow: none; margin: 0; }
/* Odoo (B5 part 2): État first, one column, Zone de danger last */
.app-content .od-grid { display: flex; flex-direction: column-reverse; gap: var(--p-s-4); }
.od-danger { margin-top: var(--p-s-4); border-color: var(--p-neg-soft); }
.od-danger-row { display: flex; align-items: center; gap: var(--p-s-4); justify-content: space-between; flex-wrap: wrap; }
/* sign-in (B5 part 2, blueprint §7): one 400 px column, the title under the logo on the same left edge */
html[data-ui="next"] .login form { width: min(400px, 100%); }
html[data-ui="next"] .login-t { margin: 0; font-size: var(--p-t-lg, 18px); font-weight: var(--p-w-semibold); color: var(--p-text); }
html[data-ui="next"] .login .brand-co + .login-t { text-align: center; }
.p-drawer-body > *, .st-form, .st-form label { min-width: 0; } .st-form .p-select { max-width: 100%; }
.tm-bar .p-seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; } .tm-bar .p-seg button { flex: none; white-space: nowrap; }
.tm-show-s { display: none; } @media (max-width: 599px) { .tm-show-s { display: inline; } #tlist .p-cell-sub { overflow-wrap: anywhere; } }
#au-list td:first-child { white-space: nowrap; }
