/* Eazy Pizzy: portals (admin / agent / client). Tokens only; builds on app.css. */

.portal-page { --side-w: 248px; --head-h: 72px; min-height: 100vh; display: flex; flex-direction: column; }
.portal-page #portal { flex: 1 0 auto; }

/* ------------------------------------------------------------ boot state */
.p-boot { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 70vh; }
.p-boot-side { border-right: 1px solid var(--border); background: var(--bg-elevated); }
.p-boot-main { padding: var(--s-6); }

/* ---------------------------------------------------------------- layout */
.p-app {
  display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr);
  max-width: 1440px; margin-inline: auto; width: 100%; align-items: start;
}
.p-side {
  position: sticky; top: var(--head-h); align-self: start;
  height: calc(100vh - var(--head-h)); overflow-y: auto;
  padding: var(--s-5) var(--s-3) var(--s-6);
  border-right: 1px solid var(--border);
}
.p-side-head { display: flex; gap: var(--s-3); align-items: center; padding: 0 var(--s-3) var(--s-4); margin-bottom: var(--s-3); border-bottom: 1px solid var(--border); }
.p-side-who { display: grid; min-width: 0; line-height: 1.3; }
.p-side-name { font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-side-role { font-size: var(--fs-xs); color: var(--muted); }
.p-nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.p-nav-group { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: var(--s-4) var(--s-3) var(--s-1); }
.p-nav-group:first-child { padding-top: 0; }
.p-nav-link {
  display: flex; align-items: center; gap: var(--s-3); padding: 9px var(--s-3);
  border-radius: var(--r-sm); color: var(--ink-soft); text-decoration: none; font-weight: 500; font-size: var(--fs-sm);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.p-nav-link svg { color: var(--muted); flex: none; transition: color var(--dur) var(--ease); }
.p-nav-link:hover { background: var(--surface-muted); color: var(--ink); }
.p-nav-link.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.p-nav-link.is-active svg { color: var(--primary); }
.p-nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-nav-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--primary); color: var(--on-brand); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.p-nav-badge[hidden] { display: none; }

.p-main { min-width: 0; padding: var(--s-6) clamp(var(--s-4), 3vw, var(--s-7)) var(--s-8); outline: none; }
.p-view-inner { display: grid; gap: var(--s-5); }

.p-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-5); }
.p-page-titles { min-width: 0; }
.p-title { margin: 0; font-size: var(--fs-2xl); line-height: 1.2; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.p-desc { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }
.p-page-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.p-back { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); text-decoration: none; margin-bottom: var(--s-2); font-weight: 500; }
.p-back:hover { color: var(--primary); }

/* ---------------------------------------------------------------- cards */
.p-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.p-card > .p-card-body { padding: var(--s-5); }
.p-card-flush > .p-card-body { padding: 0; }
.p-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-3); padding: var(--s-4) var(--s-5) 0; }
.p-card-flush > .p-card-head { padding-bottom: var(--s-4); border-bottom: 1px solid var(--border); }
.p-card-title { margin: 0; font-size: var(--fs-md); font-weight: 650; }
.p-card-desc { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--muted); }
.p-card-actions { display: flex; gap: var(--s-2); flex: none; }
.p-card-link { font-size: var(--fs-sm); font-weight: 600; color: var(--primary); text-decoration: none; white-space: nowrap; }
.p-card-link:hover { text-decoration: underline; }
.p-card-table > .p-card-body { padding: 0; }
.p-pad { padding: var(--s-5); }
.p-narrow { max-width: 560px; }
.p-narrow-lg { max-width: 860px; }

.p-grid-2 { display: grid; gap: var(--s-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); align-items: stretch; }
.p-grid-top { align-items: start; }
.p-split { display: grid; gap: var(--s-5); grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.p-split-side { display: grid; gap: var(--s-5); }
.p-stack { display: grid; gap: var(--s-4); align-content: start; }
.p-muted { color: var(--muted); }
.p-small { font-size: var(--fs-sm); }
.p-sub { font-size: var(--fs-sm); font-weight: 700; margin: 0; color: var(--ink); letter-spacing: .01em; }
.p-note { margin: var(--s-4) 0 0; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--surface-muted); color: var(--ink-soft); font-size: var(--fs-sm); }
.p-note.is-warn { background: var(--warn-soft); color: var(--warn); }
.p-note.is-bad { background: var(--bad-soft); color: var(--bad); }
.p-notes { white-space: pre-wrap; margin: var(--s-4) 0 0; color: var(--ink-soft); font-size: var(--fs-sm); }

/* ------------------------------------------------------------- KPI tiles */
.p-kpis { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.p-kpi {
  display: grid; gap: 4px; padding: var(--s-4) var(--s-5); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  color: var(--ink); text-decoration: none; min-width: 0;
}
.p-kpi.is-link { transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
.p-kpi.is-link:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); color: var(--ink); }
.p-kpi-top { display: flex; justify-content: space-between; align-items: center; gap: var(--s-2); }
.p-kpi-label { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.p-kpi-icon { width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.p-kpi-icon.tone-warn { background: var(--warn-soft); color: var(--warn); }
.p-kpi-icon.tone-info { background: var(--info-soft); color: var(--info); }
.p-kpi-value { font-size: var(--fs-2xl); font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.p-kpi-hint { font-size: var(--fs-xs); color: var(--muted); }

/* ------------------------------------------------- leads-by-stage bars */
.p-bars { margin: 0; }
.p-bars-rows { display: grid; gap: 6px; }
.p-bar-row {
  display: grid; grid-template-columns: 116px minmax(0, 1fr) 36px; align-items: center; gap: var(--s-3);
  padding: 6px var(--s-2); margin: 0 calc(var(--s-2) * -1); border: 0; border-radius: var(--r-sm);
  background: none; font: inherit; color: inherit; text-align: left; width: calc(100% + var(--s-4));
}
button.p-bar-row { cursor: pointer; }
button.p-bar-row:hover { background: var(--bg-elevated); }
.p-bar-label { font-size: var(--fs-sm); color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-bar-track { height: 12px; border-radius: 0 4px 4px 0; position: relative; background: linear-gradient(90deg, var(--series-grid) 1px, transparent 1px); }
.p-bar-fill { display: block; height: 100%; width: var(--w, 0%); min-width: 2px; background: var(--series-1); border-radius: 0 4px 4px 0; transition: width 500ms var(--ease); }
.p-bar-fill.is-zero { min-width: 0; width: 0; }
.p-bar-value { font-size: var(--fs-sm); font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.p-bars-cap { margin-top: var(--s-3); font-size: var(--fs-xs); color: var(--muted); }

/* ------------------------------------------------------------------ lists */
.p-list { list-style: none; margin: calc(var(--s-2) * -1) calc(var(--s-3) * -1); padding: 0; }
.p-list-item { display: flex; align-items: center; gap: var(--s-3); padding: 10px var(--s-3); border-radius: var(--r-md); color: var(--ink); text-decoration: none; }
.p-list-item:hover { background: var(--bg-elevated); color: var(--ink); }
.p-list-main { display: grid; flex: 1; min-width: 0; line-height: 1.35; }
.p-list-main > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-list-main .p-muted { font-size: var(--fs-xs); }
.p-list-side { flex: none; font-size: var(--fs-xs); color: var(--muted); }

.p-avatar { display: inline-grid; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; flex: none; letter-spacing: .02em; }
.p-avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.p-avatar-md { width: 40px; height: 40px; font-size: 14px; }
.p-avatar-lg { width: 56px; height: 56px; font-size: 18px; }

.p-cell-2 { display: grid; line-height: 1.35; min-width: 0; }
.p-cell-2 .p-muted { font-size: var(--fs-xs); }
.p-cell-person { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.p-code-inline code, .p-cell-2 code { font-family: var(--font-mono); font-size: .92em; }
.p-code-inline code { background: var(--surface-muted); padding: 2px 8px; border-radius: 6px; font-weight: 600; }

/* ----------------------------------------------------------- toolbar */
.p-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); }
.p-toolbar-bare { padding: 0; border: 0; }
.p-filters { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: flex-end; }
.p-filter { display: grid; gap: 4px; min-width: 160px; }
.p-filter-grow { min-width: 220px; }
.p-filter-label { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.input-sm { min-height: 38px !important; padding-block: 6px !important; font-size: var(--fs-sm) !important; }
.p-results-sum { margin: 0; padding: var(--s-3) var(--s-5); font-size: var(--fs-xs); color: var(--muted); border-bottom: 1px solid var(--border); }
.p-results-sum-bare { padding: 0; border: 0; }

.p-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-muted); border-radius: var(--r-md); }
.p-seg-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; cursor: pointer;
  padding: 6px 12px; border-radius: var(--r-sm); font: inherit; font-size: var(--fs-sm); font-weight: 500; color: var(--ink-soft);
}
.p-seg-btn:hover { color: var(--ink); }
.p-seg-btn[aria-checked="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); }
.p-seg-count { font-size: 11px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ table */
.p-table-wrap { width: 100%; overflow-x: auto; }
.p-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.p-table th, .p-table td { padding: 12px var(--s-4); text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.p-table th:first-child, .p-table td:first-child { padding-left: var(--s-5); }
.p-table th:last-child, .p-table td:last-child { padding-right: var(--s-5); }
.p-table th { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--bg-elevated); white-space: nowrap; }
.p-table tbody tr:last-child td { border-bottom: 0; }
.p-table tbody tr { transition: background var(--dur) var(--ease); }
.p-table tbody tr:hover { background: var(--bg-elevated); }
.p-table tr.is-clickable { cursor: pointer; }
.p-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.p-row-open { all: unset; cursor: pointer; display: block; border-radius: 6px; }
.p-row-open:focus-visible { box-shadow: var(--ring); }
.p-row-open strong { color: var(--ink); }
tr.is-clickable:hover .p-row-open strong { color: var(--primary); }
.p-row-actions { display: inline-flex; flex-wrap: wrap; gap: var(--s-2); justify-content: flex-end; }
.p-actions-cell { text-align: right !important; white-space: nowrap; }
.p-audit-meta { color: var(--muted); font-size: var(--fs-xs); max-width: 360px; overflow-wrap: anywhere; }
.p-audit-action { font-family: var(--font-mono); font-size: var(--fs-xs); background: var(--surface-muted); padding: 2px 8px; border-radius: 6px; }
.p-audit-action.is-bad { background: var(--bad-soft); color: var(--bad); }
.p-order { width: 84px; }
.p-demo-mini { width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }

@media (max-width: 760px) {
  .p-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .p-table, .p-table tbody, .p-table tr, .p-table td { display: block; width: 100%; }
  .p-table tr { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); }
  .p-table tbody tr:last-child { border-bottom: 0; }
  .p-table td, .p-table td:first-child, .p-table td:last-child { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: var(--s-3); align-items: center; text-align: right; }
  .p-table td::before { content: attr(data-label); font-size: var(--fs-xs); font-weight: 600; color: var(--muted); text-align: left; flex: none; }
  .p-table td.is-primary { display: block; text-align: left; padding-bottom: var(--s-2); }
  .p-table td.is-primary::before { display: none; }
  .p-actions-cell { white-space: normal; }
  .p-row-actions { justify-content: flex-end; }
  .p-audit-meta { max-width: none; }
}

/* ------------------------------------------------------------ skeletons */
.p-loading { display: block; }
.p-skel { display: grid; gap: var(--s-3); }
.p-skel-tiles { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: var(--s-4); }
.p-skel-tile { display: grid; gap: var(--s-3); padding: var(--s-5); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.p-skel-row { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.sk { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--surface-muted) 0%, var(--bg-elevated) 50%, var(--surface-muted) 100%); background-size: 200% 100%; animation: p-shimmer 1.4s ease-in-out infinite; }
.sk-sm { height: 12px; width: 40%; }
.sk-lg { height: 28px; width: 55%; }
.sk-dot { width: 32px; height: 32px; border-radius: 50%; flex: none; }
.sk-line { height: 12px; flex: 1; }
.sk-short { height: 12px; width: 18%; flex: none; }
@keyframes p-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.p-error { display: flex; gap: var(--s-4); align-items: flex-start; padding: var(--s-5); border-radius: var(--r-lg); border: 1px solid var(--bad-soft); background: var(--surface); color: var(--ink); flex-wrap: wrap; }
.p-error > svg { color: var(--bad); flex: none; }
.p-error p { margin: 4px 0 0; color: var(--muted); font-size: var(--fs-sm); }
.p-error > div { flex: 1; min-width: 200px; }

/* ------------------------------------------------------------- forms */
.p-form { display: grid; gap: var(--s-4); }
.p-form-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.p-form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-2); padding-top: var(--s-2); }
.p-form .field > .btn--link { justify-self: start; }
.btn--link { --btn-bg: transparent; --btn-fg: var(--primary); --btn-bd: transparent; padding-inline: 0 !important; min-height: 28px !important; text-decoration: underline; text-underline-offset: 3px; }
.btn--link:hover { --btn-fg: var(--primary-hover); }
.btn--danger-ghost { --btn-bg: transparent; --btn-fg: var(--bad); --btn-bd: transparent; }
.btn--danger-ghost:hover { --btn-bg: var(--bad-soft); --btn-fg: var(--bad); }
.btn[hidden] { display: none; }
.field[hidden], fieldset[hidden] { display: none; }
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }

.p-sticky-actions {
  position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; align-items: center; gap: var(--s-4);
  padding: var(--s-3) var(--s-4); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-top: 1px solid var(--border); margin-inline: calc(var(--s-4) * -1);
}
.p-dirty { font-size: var(--fs-sm); color: var(--warn); font-weight: 600; }
.p-settings { gap: var(--s-5); }
.p-settings .p-card-body { display: grid; gap: var(--s-4); }
.p-setting-toggle { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-5); padding-block: var(--s-2); }
.p-setting-toggle .field__hint { margin-top: 2px; max-width: 60ch; }
.p-setting-toggle + .field, .field + .p-setting-toggle { border-top: 1px solid var(--border); padding-top: var(--s-4); }

.p-preview-box { border: 1px dashed var(--border-strong); border-radius: var(--r-md); padding: var(--s-4); background: var(--bg-elevated); }
.p-preview-label { display: block; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--s-2); }
.p-email-preview { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.p-email-preview li { display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; gap: var(--s-3); align-items: center; font-size: var(--fs-sm); }
.p-email-preview code { font-family: var(--font-mono); color: var(--ink); overflow-wrap: anywhere; }
.p-preview-k { color: var(--muted); }
.p-preview-tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-pill); background: var(--primary-soft); color: var(--primary); }
.p-preview-tag.is-auto { background: var(--neutral-soft); color: var(--neutral); }
.p-ann-preview:empty { display: none; }
.p-ann-bar { display: flex; gap: var(--s-2); align-items: center; padding: 10px var(--s-4); border-radius: var(--r-md); background: var(--surface-brand); color: var(--on-brand); font-size: var(--fs-sm); }

/* switch */
.p-switch { display: inline-flex; align-items: center; gap: var(--s-2); cursor: pointer; position: relative; flex: none; }
.p-switch-input { position: absolute; opacity: 0; width: 40px; height: 24px; margin: 0; cursor: pointer; }
.p-switch-track { width: 40px; height: 24px; border-radius: var(--r-pill); background: var(--border-strong); position: relative; transition: background var(--dur) var(--ease); flex: none; }
.p-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease); }
.p-switch-input:checked + .p-switch-track { background: var(--good); }
.p-switch-input:checked + .p-switch-track::after { transform: translateX(16px); }
.p-switch-input:focus-visible + .p-switch-track { box-shadow: var(--ring); }
.p-switch-input:disabled + .p-switch-track { opacity: .5; }
.p-switch-text { font-size: var(--fs-sm); color: var(--ink-soft); min-width: 48px; }

/* upload */
.p-file { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); padding: var(--s-4); border: 1px dashed var(--border-strong); border-radius: var(--r-md); background: var(--bg-elevated); }
.p-file label.btn { border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; }
.p-file-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.p-file-input:focus-visible + .p-file-name { outline: none; }
.p-file:focus-within label.btn { box-shadow: var(--ring); }
.p-file-name { font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
.p-upload-preview:empty, .p-upload-errors:empty { display: none; }
.p-help-line { font-size: var(--fs-sm); color: var(--muted); margin: 0; }
.p-errors { padding: var(--s-4); border-radius: var(--r-md); background: var(--bad-soft); color: var(--bad); font-size: var(--fs-sm); }
.p-errors ul { margin: var(--s-2) 0 0; padding-left: 1.2em; max-height: 220px; overflow: auto; color: var(--ink); }
.p-errors li + li { margin-top: 4px; }

/* secret */
.p-secret { display: grid; gap: var(--s-3); padding: var(--s-4); border: 1px solid var(--warn); border-radius: var(--r-md); background: var(--warn-soft); }
.p-secret-warn { display: flex; gap: var(--s-2); align-items: flex-start; color: var(--warn); font-size: var(--fs-sm); }
.p-secret-warn p { margin: 0; color: var(--ink); }
.p-secret-warn svg { flex: none; margin-top: 2px; }
.p-secret-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-4); background: var(--surface); border-radius: var(--r-sm); }
.p-secret-label { display: block; font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.p-secret-value { font-family: var(--font-mono); font-size: var(--fs-lg); font-weight: 600; letter-spacing: .04em; user-select: all; overflow-wrap: anywhere; }

/* questionnaire */
.p-q-sec { border: 0; padding: 0; margin: 0; display: grid; gap: var(--s-5); min-width: 0; }
.p-q-title { font-size: var(--fs-lg); font-weight: 650; padding: 0; margin-bottom: var(--s-1); }
.p-q-desc { margin: calc(var(--s-4) * -1) 0 0; color: var(--muted); font-size: var(--fs-sm); }
.p-choices { display: grid; gap: var(--s-2); grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
.p-choice { display: flex; gap: var(--s-2); align-items: flex-start; padding: 10px var(--s-3); border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); cursor: pointer; font-size: var(--fs-sm); transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.p-choice:hover { border-color: var(--primary); }
.p-choice input { margin: 3px 0 0; accent-color: var(--primary); flex: none; }
.p-choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.p-choice:has(input:focus-visible) { box-shadow: var(--ring); }
.p-scale { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r-md); overflow: hidden; }
.p-scale-opt { position: relative; cursor: pointer; }
.p-scale-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.p-scale-opt span { display: grid; place-items: center; width: 48px; height: 42px; font-weight: 600; font-size: var(--fs-sm); background: var(--surface); }
.p-scale-opt + .p-scale-opt span { border-left: 1px solid var(--border); }
.p-scale-opt input:checked + span { background: var(--primary); color: var(--on-brand); }
.p-scale-opt input:focus-visible + span { box-shadow: inset 0 0 0 3px var(--blue-400); }
.p-q.has-error .p-choice, .p-q.has-error .p-scale { border-color: var(--bad); }
.p-q-anchor { display: none; }

.p-answers { display: grid; gap: var(--s-5); }
.p-answer-title { margin: 0 0 var(--s-2); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.p-answer-sec dl { margin: 0; display: grid; gap: 0; }
.p-answer { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--s-4); padding: 10px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.p-answer:last-child { border-bottom: 0; }
.p-answer dt { color: var(--ink-soft); }
.p-answer dd { margin: 0; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.p-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.p-chip { font-size: var(--fs-xs); padding: 3px 10px; border-radius: var(--r-pill); background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* meta lists */
.p-meta { margin: 0; display: grid; gap: 0; }
.p-meta-item { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: var(--s-3); padding: 8px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); align-items: center; }
.p-meta-item:last-child { border-bottom: 0; }
.p-meta-item dt { color: var(--muted); }
.p-meta-item dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; min-width: 0; }
.p-meta-row { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--s-3); }
.p-meta-row .p-meta-item { grid-template-columns: 1fr; gap: 2px; border: 0; padding: 0; }

/* ------------------------------------------------------------- drawer */
.p-drawer-layer { position: fixed; inset: 0; z-index: 900; }
.p-drawer-backdrop { position: absolute; inset: 0; background: rgba(11, 34, 57, 0.38); opacity: 0; transition: opacity 200ms var(--ease); }
.p-drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--bg-elevated);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(24px); opacity: 0;
  transition: transform 220ms var(--ease), opacity 220ms var(--ease); outline: none;
}
.p-drawer.is-wide { width: min(640px, 100%); }
.p-drawer-layer.is-open .p-drawer-backdrop { opacity: 1; }
.p-drawer-layer.is-open .p-drawer { transform: none; opacity: 1; }
.p-drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-3); padding: var(--s-5); border-bottom: 1px solid var(--border); background: var(--surface); }
.p-drawer-title { margin: 0; font-size: var(--fs-xl); line-height: 1.25; overflow-wrap: anywhere; }
.p-drawer-sub { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-sm); }
.p-drawer-body { flex: 1; overflow-y: auto; padding: var(--s-5); }
.p-drawer-stack { display: grid; gap: var(--s-4); }
.p-drawer-stack .p-sub { margin-top: var(--s-3); padding-top: var(--s-4); border-top: 1px solid var(--border); }
.p-drawer-foot { padding: var(--s-4) var(--s-5); border-top: 1px solid var(--border); background: var(--surface); }
.p-icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-soft); display: grid; place-items: center; cursor: pointer; flex: none; }
.p-icon-btn:hover { background: var(--surface-muted); color: var(--ink); }
.p-icon-btn:focus-visible { border-radius: 50%; }
.p-x { font-size: 24px; line-height: 1; }
body.p-no-scroll { overflow: hidden; }
.p-contact-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* ------------------------------------------------------------- tickets */
.p-thread { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-4); }
.p-thread-empty { padding: var(--s-4) 0; }
.p-msg { display: flex; gap: var(--s-3); align-items: flex-start; }
.p-msg-main { flex: 1; min-width: 0; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 4px var(--r-md) var(--r-md) var(--r-md); padding: var(--s-3) var(--s-4); }
.p-msg.is-team .p-msg-main { background: var(--primary-soft); border-color: transparent; }
.p-msg.is-team .p-avatar { background: var(--primary); color: var(--on-brand); }
.p-msg-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--s-2); font-size: var(--fs-xs); color: var(--muted); margin-bottom: 4px; }
.p-msg-meta strong { color: var(--ink); font-size: var(--fs-sm); }
.p-msg-role { font-weight: 600; text-transform: uppercase; letter-spacing: .05em; font-size: 10px; }
.p-msg-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-sm); color: var(--ink); }
.p-thread-wrap { display: grid; gap: var(--s-5); }
.p-reply { padding-top: var(--s-4); border-top: 1px solid var(--border); }
.p-reply textarea { min-height: 96px; }
.p-thread-wrap .alert, .p-card-body > .alert { margin-bottom: var(--s-4); }
.p-stars { color: var(--border-strong); letter-spacing: 2px; }
.p-stars .is-on { color: var(--series-2); }

.p-rating { display: grid; gap: 6px; }
.p-stars-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; }
.p-star { cursor: pointer; font-size: 30px; line-height: 1; color: var(--border-strong); padding: 2px; border-radius: 6px; transition: color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.p-star:hover, .p-star:hover ~ .p-star, .p-star:has(input:checked), .p-star:has(input:checked) ~ .p-star { color: var(--series-2); }
.p-star:has(input:focus-visible) { box-shadow: var(--ring); }
.p-star:active { transform: scale(.92); }
.p-rating.has-error .p-stars-input { outline: 1px solid var(--bad); border-radius: 6px; }
.p-tips { margin: 0; padding-left: 1.1em; display: grid; gap: var(--s-2); font-size: var(--fs-sm); color: var(--ink-soft); }

/* ----------------------------------------------------- inquiries */
.p-inq-list { display: grid; gap: var(--s-4); }
.p-inq { padding: var(--s-4) var(--s-5); display: grid; gap: var(--s-3); }
.p-inq.is-handled { opacity: .78; }
.p-inq-head { display: flex; align-items: center; gap: var(--s-3); }
.p-inq-head .p-cell-2 { flex: 1; }
.p-inq-msg { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-sm); color: var(--ink); background: var(--bg-elevated); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); }
.p-inq-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s-3); }
.p-inq-contacts { display: flex; flex-wrap: wrap; gap: var(--s-4); font-size: var(--fs-sm); }
.p-inq-contacts a { overflow-wrap: anywhere; }

/* ------------------------------------------------------- agent code */
.p-code-card {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--s-5);
  padding: var(--s-5) var(--s-6); border-radius: var(--r-lg); background: var(--surface-brand); color: var(--on-brand);
  box-shadow: var(--shadow-md);
}
.p-code-label { margin: 0 0 var(--s-2); display: block; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--cream-300); }
.p-code-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.p-code-big { font-family: var(--font-mono); font-size: clamp(1.75rem, 4vw, 2.4rem); font-weight: 700; letter-spacing: .06em; color: var(--on-brand); user-select: all; }
.p-code-help { margin: var(--s-2) 0 0; font-size: var(--fs-sm); color: var(--cream-300); max-width: 46ch; }
.p-code-link { align-self: center; min-width: 0; }
.p-code-input { flex: 1; min-width: 0; background: rgba(255, 253, 248, 0.08) !important; border-color: rgba(255, 253, 248, 0.25) !important; color: var(--on-brand) !important; font-family: var(--font-mono); font-size: var(--fs-sm) !important; }

/* ---------------------------------------------------------- pipeline */
.p-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); align-items: start; }
.p-col { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-3); min-width: 0; }
.p-col-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-2); padding: 2px var(--s-1) var(--s-3); }
.p-col-title { margin: 0; font-size: var(--fs-sm); font-weight: 650; display: flex; align-items: center; gap: var(--s-2); flex: 1 1 auto; min-width: 0; line-height: 1.3; }
.p-col-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--info); flex: none; }
.p-col-contacted .p-col-dot { background: var(--neutral); }
.p-col-proposal .p-col-dot { background: var(--warn); }
.p-col-won .p-col-dot { background: var(--good); }
.p-col-lost .p-col-dot { background: var(--bad); }
.p-col-count { flex: none; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: var(--r-pill); background: var(--surface-muted); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.p-col-sum { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.p-col-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.p-col-empty { margin: 0; padding: var(--s-4) var(--s-2); text-align: center; font-size: var(--fs-xs); color: var(--muted); border: 1px dashed var(--border); border-radius: var(--r-md); }
.p-lead { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); padding: var(--s-3); display: grid; gap: var(--s-2); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.p-lead:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.p-lead-open { all: unset; cursor: pointer; display: grid; gap: 2px; border-radius: 6px; min-width: 0; }
.p-lead-open:focus-visible { box-shadow: var(--ring); }
.p-lead-name { font-size: var(--fs-sm); color: var(--ink); overflow-wrap: anywhere; }
.p-lead-open:hover .p-lead-name { color: var(--primary); }
.p-lead-co { font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere; }
.p-lead-meta { display: flex; justify-content: space-between; align-items: center; gap: var(--s-2); margin-top: 6px; font-size: var(--fs-xs); }
.p-lead-val { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.p-lead-next { display: inline-flex; gap: 4px; align-items: center; color: var(--muted); }
.p-lead-next.is-overdue { color: var(--bad); font-weight: 600; }
.p-move { width: 100%; min-width: 0; font-size: var(--fs-xs) !important; min-height: 32px !important; padding-inline-start: 8px !important; padding-inline-end: 28px !important; text-overflow: ellipsis; }

/* ---------------------------------------------------------- wizard */
.p-wizard-card { max-width: 860px; }
.p-stepper { margin-bottom: var(--s-5); }
.p-step { display: grid; gap: var(--s-4); }
.p-step[hidden] { display: none; }
.p-step-title { margin: 0; font-size: var(--fs-lg); outline: none; }
.p-step > .p-muted { margin: calc(var(--s-3) * -1) 0 0; font-size: var(--fs-sm); }
.p-wizard-actions { justify-content: space-between; border-top: 1px solid var(--border); padding-top: var(--s-4); margin-top: var(--s-2); }
.p-wizard-actions > .btn--primary { margin-left: auto; }
.p-review { display: grid; gap: var(--s-5); }
.p-review-grid { display: grid; gap: var(--s-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.p-review-block { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); }
.p-review-head { display: flex; justify-content: space-between; align-items: center; }

/* ------------------------------------------------------------ demos */
.p-demo-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.p-demo {
  height: 100%; display: flex; flex-direction: column; gap: 6px; padding: var(--s-5); text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.p-demo:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); color: var(--ink); }
.p-demo-icon { width: 44px; height: 44px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); margin-bottom: var(--s-2); }
.p-demo-ind { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.p-demo-title { font-size: var(--fs-lg); line-height: 1.3; }
.p-demo-tag { font-size: var(--fs-sm); color: var(--ink-soft); flex: 1; }
.p-demo-foot { display: flex; justify-content: space-between; gap: var(--s-2); margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--muted); }
.p-demo-cta { color: var(--primary); font-weight: 600; white-space: nowrap; }

/* ----------------------------------------------------------- client */
.p-quick { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.p-quick-item { display: flex; gap: var(--s-3); align-items: center; padding: var(--s-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); text-decoration: none; color: var(--ink); box-shadow: var(--shadow-sm); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
.p-quick-item:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); color: var(--ink); }
.p-quick-item strong { font-size: var(--fs-sm); }
.p-quick-icon { width: 40px; height: 40px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.p-agent { display: flex; gap: var(--s-4); align-items: center; }
.p-agent-name { font-size: var(--fs-lg); }
.p-agent-contacts { list-style: none; margin: var(--s-4) 0; padding: 0; display: grid; gap: var(--s-2); font-size: var(--fs-sm); }
.p-agent-contacts li { display: flex; align-items: center; gap: var(--s-2); color: var(--muted); }
.p-agent-contacts a { overflow-wrap: anywhere; }
.p-agent-card .p-card-body { display: grid; align-content: start; }
.p-profile { display: flex; gap: var(--s-4); align-items: flex-start; }
.p-profile .p-meta { flex: 1; min-width: 0; }
.p-help-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.p-help-card { padding: var(--s-5); display: grid; gap: var(--s-2); align-content: start; }
.p-help-card .p-card-title { margin-top: var(--s-2); }
.p-help-card p { margin: 0; font-size: var(--fs-sm); }
.p-help-action { font-weight: 600; overflow-wrap: anywhere; }
.p-help-foot { display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-5); }

/* --------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .p-split { grid-template-columns: 1fr; }
  .p-split-side { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
}
@media (max-width: 860px) {
  .portal-page { --head-h: 64px; }
  .p-app, .p-boot { grid-template-columns: minmax(0, 1fr); }
  .p-boot-side { display: none; }
  .p-side {
    position: sticky; top: var(--head-h); z-index: 20; height: auto; overflow: visible;
    padding: 0; border-right: 0; border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
  }
  .p-side-head { display: none; }
  .p-nav { display: flex; gap: 4px; overflow-x: auto; padding: var(--s-2) var(--s-4); scrollbar-width: none; scroll-snap-type: x proximity; }
  .p-nav::-webkit-scrollbar { display: none; }
  .p-nav > li { flex: none; scroll-snap-align: center; }
  .p-nav-group { display: none; }
  .p-nav-link { padding: 8px 12px; border-radius: var(--r-pill); white-space: nowrap; }
  .p-nav-link.is-active { background: var(--primary); color: var(--on-brand); }
  .p-nav-link.is-active svg { color: var(--on-brand); }
  .p-nav-link.is-active .p-nav-badge { background: var(--on-brand); color: var(--primary); }
  .p-main { padding: var(--s-5) var(--s-4) var(--s-7); }
  .p-title { font-size: var(--fs-xl); }
  .p-code-card { grid-template-columns: 1fr; padding: var(--s-5); }
  .p-board { grid-template-columns: 1fr; }
  .p-col-empty { padding: var(--s-2); }
  .p-sticky-actions { margin-inline: calc(var(--s-4) * -1); }
}
@media (max-width: 560px) {
  .p-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
  .p-kpi { padding: var(--s-3) var(--s-4); }
  .p-kpi-value { font-size: var(--fs-xl); }
  .p-page-head { align-items: stretch; flex-direction: column; }
  .p-page-actions .btn { width: 100%; justify-content: center; }
  .p-card > .p-card-body { padding: var(--s-4); }
  .p-card-head { padding: var(--s-4) var(--s-4) 0; }
  .p-toolbar { padding: var(--s-3) var(--s-4); }
  .p-filter, .p-filter-grow { min-width: 0; flex: 1 1 100%; }
  .p-filters { width: 100%; }
  .p-seg { width: 100%; }
  .p-meta-item { grid-template-columns: 110px minmax(0, 1fr); }
  .p-answer { grid-template-columns: 1fr; gap: 2px; }
  .p-email-preview li { grid-template-columns: 1fr auto; }
  .p-email-preview .p-preview-k { grid-column: 1 / -1; font-size: var(--fs-xs); }
  .p-bar-row { grid-template-columns: 96px minmax(0, 1fr) 28px; gap: var(--s-2); }
  .p-setting-toggle { gap: var(--s-3); }
  .p-scale-opt span { width: 40px; }
  .p-form-actions { justify-content: stretch; }
  .p-form-actions > .btn { flex: 1; justify-content: center; }
  .p-drawer-head, .p-drawer-body { padding: var(--s-4); }
  .p-inq { padding: var(--s-4); }
  .p-profile { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .sk { animation: none; }
}
@media (forced-colors: active) {
  .p-bar-fill { background: CanvasText; }
  .p-nav-link.is-active { outline: 2px solid CanvasText; }
}
.p-scale-labels { display: flex; justify-content: space-between; gap: var(--s-4); font-size: var(--fs-xs); color: var(--muted); max-width: 280px; }

/* ================================================================ sales (Head of Sales + agents) */
.s-sla { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: var(--fs-xs); color: var(--ink-soft); }
.s-sla time { white-space: nowrap; }
.s-sla.is-overdue { color: var(--bad); font-weight: 600; }
.s-q-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.s-q-problem { margin: 0; padding: var(--s-4); border-left: 3px solid var(--primary); background: var(--surface-muted); border-radius: var(--r-sm); font-size: var(--fs-lg); line-height: 1.5; color: var(--ink); }
.s-contact { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.d-actions-split { display: inline-flex; gap: var(--s-2); align-items: center; margin-left: auto; }
.s-target { display: grid; gap: var(--s-2); }
.s-target-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-2); }
.s-target-top strong { font-size: var(--fs-xl); }
.s-target-track { height: 12px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; border: 1px solid var(--border); }
.s-target-fill { display: block; height: 100%; width: var(--w, 0%); background: linear-gradient(90deg, var(--primary), var(--series-2)); border-radius: inherit; transition: width .8s var(--ease); }
.s-target-hint { margin: 0; font-size: var(--fs-sm); }
.s-alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.s-alert { display: flex; align-items: flex-start; gap: var(--s-2); padding: var(--s-3); border-radius: var(--r-sm); background: var(--surface-muted); font-size: var(--fs-sm); line-height: 1.45; }
.s-alert > span { flex: 1; }
.s-alert.tone-bad { background: color-mix(in srgb, var(--bad) 10%, var(--surface)); color: var(--ink); }
.s-alert.tone-bad svg { color: var(--bad); }
.s-alert.tone-warn { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
.s-alert.tone-warn svg { color: var(--warn); }
.s-alert.tone-info svg { color: var(--info); }
.s-board { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.s-board li { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); }
.s-board li:first-child { background: var(--primary-soft); }
.s-board li.is-me { outline: 2px solid var(--primary); }
.s-board-pos { width: 26px; height: 26px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--surface-muted); font-weight: 700; font-size: var(--fs-sm); }
.s-board-val { margin-left: auto; font-weight: 700; }
.s-legend { font-size: var(--fs-xs); margin: var(--s-3) 0 0; }
.s-templates { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin-top: var(--s-3); }
.s-thread-wrap { display: grid; gap: var(--s-3); }
.s-thread { list-style: none; margin: 0; padding: var(--s-2); display: grid; gap: var(--s-2); max-height: 360px; overflow-y: auto; background: var(--surface-muted); border-radius: var(--r-md); }
.s-thread-empty { padding: var(--s-3); }
.s-msg { max-width: 85%; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); justify-self: start; }
.s-msg.is-mine { justify-self: end; background: var(--primary-soft); border-color: transparent; }
.s-msg.is-system { justify-self: center; max-width: 100%; background: transparent; border-style: dashed; font-size: var(--fs-sm); }
.s-msg.is-nudge { border-color: var(--warn); }
.s-msg-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); font-size: var(--fs-xs); color: var(--ink-soft); }
.s-msg-body { margin: 4px 0 0; white-space: pre-wrap; }
.s-today-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--s-5); }
.s-task { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--ink); text-decoration: none; }
.s-task > .s-contact { margin-left: auto; }
.s-task-main .p-muted { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.s-task-main { flex: 1 1 100%; min-width: 0; display: grid; gap: 4px; }
.s-task-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.s-task.is-overdue { border-color: var(--bad); }
@media (max-width: 960px) { .s-today-grid { grid-template-columns: 1fr; } .d-actions-split { margin-left: 0; } }
