/* /portal/ds/css/fonts.css */
/* Self-hosted application fonts. Keep font delivery independent from external CDNs. */
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/vazirmatn/Vazirmatn-Variable.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}


/* /portal/ds/css/main.css */
/* =========================================================
   Diaco Student Panel — Persian RTL BI Dashboard
   ========================================================= */

html.dashboard-live-pending #content>:not(.ds-loading-skeleton):not(.acc-page):not(.ds-empty-state){display:none!important}
.app-boot-screen{display:none}
.app-boot-screen__rail{border:1px solid var(--border,#e2e8f0);border-radius:22px;background:repeating-linear-gradient(180deg,transparent 0 48px,color-mix(in srgb,var(--border,#e2e8f0) 70%,transparent) 49px 50px),var(--surface,#fff)}
.app-boot-screen__main{display:flex;flex-direction:column;gap:18px;min-width:0}
.app-boot-screen__bar,.app-boot-screen__hero,.app-boot-screen__card{border:1px solid var(--border,#e2e8f0);background:var(--surface,#fff);border-radius:18px}
.app-boot-screen__bar{height:62px}.app-boot-screen__hero{height:180px;background:linear-gradient(110deg,var(--surface,#fff),color-mix(in srgb,var(--pastel-mint,#b8e6d3) 28%,var(--surface,#fff)))}
.app-boot-screen__grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}.app-boot-screen__card{height:132px}
.app-boot-screen__bar,.app-boot-screen__hero,.app-boot-screen__card{padding:18px;overflow:hidden;position:relative;box-sizing:border-box}
.app-boot-screen i{display:block;height:12px;margin-block-end:12px;border-radius:999px;background:linear-gradient(90deg,var(--skeleton-base,#edf1f4) 25%,var(--skeleton-shine,#f8fafb) 50%,var(--skeleton-base,#edf1f4) 75%);background-size:220% 100%;animation:app-boot-shimmer 1.25s ease-in-out infinite}
.app-boot-screen i:nth-child(1){width:42%}.app-boot-screen i:nth-child(2){width:72%}.app-boot-screen i:nth-child(3){width:58%}
.app-boot-screen__bar{display:flex;align-items:center;gap:14px}.app-boot-screen__bar i{width:18%!important;margin:0}.app-boot-screen__hero i:first-child{height:24px}.app-boot-screen__card i:first-child{height:18px}
@keyframes app-boot-shimmer{0%{background-position:100% 0}100%{background-position:-120% 0}}
.app-boot-screen__brand{position:absolute;left:50%;top:50%;width:154px;height:154px;transform:translate(-50%,-50%);display:grid;place-items:center;z-index:2}.app-boot-screen__brand::before{content:"";position:absolute;width:92px;height:92px;border-radius:30px;background:color-mix(in srgb,var(--brand-300,#6fb98f) 20%,transparent);filter:blur(12px);animation:app-boot-halo 2.4s ease-in-out infinite}.app-boot-screen__brand::after{content:"";position:absolute;z-index:2;width:74px;height:74px;background:linear-gradient(110deg,transparent 28%,rgba(255,255,255,.08) 40%,rgba(255,255,255,.95) 50%,rgba(184,230,211,.3) 60%,transparent 72%);background-size:260% 100%;-webkit-mask:url('../img/diaco/icon-192x192.png') center/contain no-repeat;mask:url('../img/diaco/icon-192x192.png') center/contain no-repeat;mix-blend-mode:screen;pointer-events:none;animation:app-boot-logo-scan 2.15s ease-in-out infinite}.app-boot-screen__logo{position:relative;z-index:1;width:74px;height:74px;object-fit:contain;border-radius:22px;filter:drop-shadow(0 12px 18px rgba(15,118,110,.22));transform:translateZ(0)}.app-boot-screen__orbit{position:absolute;opacity:.42;border:1px solid color-mix(in srgb,var(--brand-500,#0f766e) 35%,transparent);border-radius:50%;will-change:transform;animation:app-boot-orbit 3.6s linear infinite}.app-boot-screen__orbit--one{width:112px;height:112px}.app-boot-screen__orbit--two{width:146px;height:72px;rotate:-28deg;border-color:color-mix(in srgb,var(--pastel-purple,#cdbbff) 58%,transparent);animation-duration:4.8s;animation-direction:reverse}.app-boot-screen__spark{position:absolute;width:6px;height:6px;opacity:.68;border-radius:50%;background:var(--brand-500,#0f766e);box-shadow:0 0 0 4px color-mix(in srgb,var(--brand-500,#0f766e) 10%,transparent);animation:app-boot-spark 2.2s ease-in-out infinite}.app-boot-screen__spark--one{inset-inline-end:8px;inset-block-start:25px}.app-boot-screen__spark--two{inset-inline-start:11px;inset-block-end:30px;background:var(--accent-purple,#8b5cf6);animation-delay:.5s}.app-boot-screen__label{display:none}
@keyframes app-boot-logo-scan{0%,18%{background-position:130% 0;opacity:0}30%{opacity:.95}58%{opacity:.8}72%,100%{background-position:-130% 0;opacity:0}}@keyframes app-boot-halo{0%,100%{opacity:.4;transform:scale(.9)}50%{opacity:.72;transform:scale(1.05)}}@keyframes app-boot-orbit{to{transform:rotate(1turn)}}@keyframes app-boot-spark{0%,100%{opacity:.25;transform:scale(.7)}50%{opacity:.75;transform:scale(1.08)}}
body.app-ready .app-boot-screen{opacity:0;visibility:hidden;pointer-events:none}
@media(max-width:700px){.app-boot-screen{grid-template-columns:1fr;padding:14px}.app-boot-screen__rail{display:none}.app-boot-screen__grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(prefers-reduced-motion:reduce){.app-boot-screen i,.app-boot-screen__brand::before,.app-boot-screen__brand::after,.app-boot-screen__orbit,.app-boot-screen__spark{animation:none}.app-boot-screen__brand::after{display:none}}

:root {
  /* Brand — Diaco (official identity: "Intelligence That Leads" teal/green) */
  --brand-50:  #eef7f2;
  --brand-100: #d7ebe0;
  --brand-200: #b0d8c1;
  --brand-300: #6fb98f;     /* Greenery */
  --brand-400: #4a9686;     /* [crm-modular-system] diaco-qa fix — interpolated between 300/500; this token was referenced (ds-patterns.css .ds-pattern-wizard::before + 2 other call sites) but never defined, so every consumer's `var(--brand-400)` silently computed to `background-image:none` (confirmed via getComputedStyle) */
  --brand-500: #2c7873;     /* Rain — primary */
  --brand-600: #004445;     /* Cadet Blue */
  --brand-700: #021c1e;     /* Blue Black */

  --accent-300: #a1d2b6;
  --accent-500: #6fb98f;   /* Greenery accent */
  --accent-600: #2a726d;

  --pastel-mint:  #b8e6d3;
  --pastel-sky:   #b8d4f1;
  --pastel-rose:  #f5c2c7;
  --pastel-lemon: #fef3c7;
  --pastel-lilac: #ddd6fe;
  --pastel-peach: #ffe4cc;

  /* Status (pastel-balanced) */
  --green-500: #6dbf8f;
  --green-50:  #ecf9f1;
  --red-500:   #e8788c;
  --red-50:    #fcedef;
  --amber-500: #f0b86e;
  --amber-50:  #fff5e6;
  --purple-500:#a78bfa;

  /* Pipeline stage palette — governed Design System colors (solid + pastel). */
  --stage-solid-teal:#2c7873; --stage-solid-mint:#6fb98f; --stage-solid-blue:#3b82f6;
  --stage-solid-sky:#0ea5e9; --stage-solid-cyan:#06b6d4; --stage-solid-aqua:#14b8a6;
  --stage-solid-green:#22c55e; --stage-solid-lime:#84cc16; --stage-solid-yellow:#eab308;
  --stage-solid-amber:#f59e0b; --stage-solid-orange:#f97316; --stage-solid-red:#ef4444;
  --stage-solid-pink:#ec4899; --stage-solid-violet:#8b5cf6; --stage-solid-slate:#64748b;
  --stage-pastel-mint:#b8e6d3; --stage-pastel-sky:#b8d4f1; --stage-pastel-rose:#f5c2c7;
  --stage-pastel-lemon:#fef3c7; --stage-pastel-lilac:#ddd6fe; --stage-pastel-peach:#ffe4cc;
  --stage-pastel-blue:#dbeafe; --stage-pastel-cyan:#cffafe; --stage-pastel-aqua:#ccfbf1;
  --stage-pastel-green:#dcfce7; --stage-pastel-lime:#ecfccb; --stage-pastel-yellow:#fef9c3;
  --stage-pastel-orange:#ffedd5; --stage-pastel-pink:#fce7f3; --stage-pastel-slate:#e2e8f0;

  /* Light theme — modern clean (Linear/Stripe/Vercel inspired) */
  --bg:           #f7f8fa;
  --surface:      #ffffff;
  --surface-2:    #f5f6f9;
  --surface-3:    #eef0f5;
  --border:       rgba(15, 23, 42, .07);
  --border-strong:rgba(15, 23, 42, .12);
  --text:         #0f172a;
  --text-muted:   #6b7280;
  --text-faint:   #9ca3af;

  /* Modern stacked shadows */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .04), 0 1px 2px rgba(16, 24, 40, .03);
  --shadow:    0 4px 6px -2px rgba(16, 24, 40, .03), 0 12px 16px -4px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 24px -8px rgba(16, 24, 40, .10), 0 24px 40px -12px rgba(16, 24, 40, .08);

  /* Heatmap (navy gradient) */
  --hm-0: #f5e8ff;
  --hm-1: #e2bfff;
  --hm-2: #c98dff;
  --hm-3: #a020f0;
  --hm-4: #6a0dad;

  --radius-sm: 8px;
  --radius:    16px;
  --radius-lg: 24px;

  --sidebar-w: 320px;
  --sidebar-rail-w: 72px;
  --topbar-h:  64px;

  /* Font — overridden at runtime by DsFontPicker via localStorage */
  --ds-font: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Spacing scale — Progressive Disclosure/White-Space pass (ux-cognitive-load-review).
     Macro (between top-level sections) > meso (card head→body) > micro (rows inside a
     card) should read as visually distinct tiers, not one flat rhythm. */
  --space-micro: 8px;
  --space-meso:  20px;
  --space-macro: 26px;
}

/* Colour theme «یاسی» (lilac; owner request 1405/08/01). A scoped variant of
 * the light theme: only the brand/accent scale changes, built on the existing
 * --pastel-lilac (#ddd6fe), --purple-500 (#a78bfa) and violet stage tokens.
 * White text on --brand-500/600 keeps 5.7:1 / 7.1:1 contrast. Opt in with
 * data-ds-theme="lilac" on a page root; semantic tones (red, rose, mint) stay. */
[data-ds-theme="lilac"] {
  --brand-50:  #f5f3ff;
  --brand-100: #ede9fe;
  --brand-200: #ddd6fe;
  --brand-300: #c4b5fd;
  --brand-400: #a78bfa;
  --brand-500: #7c3aed;
  --brand-600: #6d28d9;
  --brand-700: #4c1d95;
  --accent-300: #c4b5fd;
  --accent-500: #a78bfa;
  --accent-600: #6d28d9;
}
[data-ds-theme="lilac"] .btn.primary { box-shadow: 0 6px 16px color-mix(in srgb, var(--brand-500) 32%, transparent); }
[data-ds-theme="lilac"] .btn.primary:hover { box-shadow: 0 10px 24px color-mix(in srgb, var(--brand-500) 40%, transparent); }
[data-ds-theme="lilac"] .btn.ghost:hover { background: color-mix(in srgb, var(--pastel-lilac) 45%, var(--surface)); border-color: color-mix(in srgb, var(--brand-400) 40%, var(--border)); }

/* Colour theme «آلویی» (plum, owner approval 1405/08/02 for the DiaMeet
 * meetings page: «طرح ۶ با تقویم طرح ۴»). Only the brand/accent scale changes.
 * White text on --brand-500 (#a23b8c) is 5.9:1 and on --brand-600 8.1:1; the
 * accent stays in the same family and carries decoration only. Semantic tones
 * stay. Opt in with data-ds-theme="plum" on a page root. */
[data-ds-theme="plum"] {
  --brand-50:  #fbf3f9;
  --brand-100: #f7e3f1;
  --brand-200: #edc4e2;
  --brand-300: #dc96c8;
  --brand-400: #c065aa;
  --brand-500: #a23b8c;
  --brand-600: #83286f;
  --brand-700: #5e1a50;
  --accent-300: #edc4e2;
  --accent-500: #c065aa;
  --accent-600: #83286f;
}
[data-ds-theme="plum"] .btn.primary { box-shadow: 0 6px 16px color-mix(in srgb, var(--brand-500) 28%, transparent); }
[data-ds-theme="plum"] .btn.primary:hover { box-shadow: 0 10px 24px color-mix(in srgb, var(--brand-500) 36%, transparent); }
[data-ds-theme="plum"] .btn.ghost:hover { background: color-mix(in srgb, var(--brand-50) 80%, var(--surface)); border-color: color-mix(in srgb, var(--brand-400) 40%, var(--border)); }

/* Colour theme «دیامایند» (owner brand sheet 1405/08/01: #1BAE9F, #0E3A78,
 * #E8EEFA). The DiaMind app's own theme: the brand scale is the logo's navy
 * (white text on --brand-500 11.1:1, on --brand-400 7.6:1) from the sheet's
 * light #E8EEFA, and the accent is the logo's teal (decoration only: white on
 * --accent-500 is 2.8:1, so it never carries text). Semantic tones stay.
 * Opt in with data-ds-theme="diamind" on a page root (diamind-app-brand.js
 * sets it inside the installed app). */
[data-ds-theme="diamind"] {
  --brand-50:  #e8eefa;
  --brand-100: #d2ddf2;
  --brand-200: #a7bbe2;
  --brand-300: #6f8ec8;
  --brand-400: #2a5296;
  --brand-500: #0e3a78;
  --brand-600: #0a2d5f;
  --brand-700: #061f43;
  --accent-300: #7ad6cc;
  --accent-500: #1bae9f;
  --accent-600: #12877b;
}
[data-ds-theme="diamind"] .btn.primary { box-shadow: 0 6px 16px color-mix(in srgb, var(--brand-500) 30%, transparent); }
[data-ds-theme="diamind"] .btn.primary:hover { box-shadow: 0 10px 24px color-mix(in srgb, var(--brand-500) 38%, transparent); }
[data-ds-theme="diamind"] .btn.ghost:hover { background: color-mix(in srgb, var(--brand-50) 70%, var(--surface)); border-color: color-mix(in srgb, var(--accent-500) 45%, var(--border)); }

/* Dark theme «زغالی» (owner choice 1405/07/30, sample D2): neutral charcoal instead of navy; brand unchanged. */
[data-theme="dark"] {
  --bg:        #111214;
  --surface:   #1a1b1f;
  --surface-2: #222429;
  --surface-3: #2a2c32;
  --border:    #2c2f35;
  --border-strong: #3a3d44;
  --text:      #ececef;
  --text-muted:#9b9ea6;
  --text-faint:#6e717a;
  --shadow:    0 6px 22px rgba(0,0,0,.45);
  --shadow-lg: 0 18px 40px rgba(0,0,0,.45);

  --hm-0: #2a1146;
  --hm-1: #4a1f7a;
  --hm-2: #7c2dbf;
  --hm-3: #a020f0;
  --hm-4: #d18bff;
}

/* ---------- Reset & base ---------- */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: var(--ds-font, 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', sans-serif);
  background:
    radial-gradient(circle at 0% 0%,   rgba(111, 185, 143, .22) 0%, transparent 35%),
    radial-gradient(circle at 100% 0%, rgba(44, 120, 115, .16) 0%, transparent 30%),
    radial-gradient(circle at 50% 100%, rgba(0, 68, 69, .12) 0%, transparent 40%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -.005em;
  overflow-x: hidden;
  max-width: 100vw;
}
body { display: flex; min-height: 100vh; }
.main { min-width: 0; overflow-x: hidden; }
.content { min-width: 0; }
.card, .kpi { min-width: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; border-radius: 6px; }

/* [FE23-global-min-width-zero] Grid/flex items inside .content automatically
   get min-width:0 so they never block their parent track from shrinking.
   Without this, a grid item's intrinsic content size becomes the track's
   effective floor even when the track definition says minmax(0, Xpx).
   img excluded: explicit width/height on avatars already constrains them. */
.content * { min-width: 0; }
.content img { min-width: auto; }

body { font-feature-settings: 'ss02' on; }

/* ---------- App-wide selection & cursor defaults ---------- */
/* Dashboard surfaces should feel like a native app, not a document — no text-caret,
   no accidental selection. Allow opt-in selection on inputs and dialog/transcript
   content where users genuinely need to copy. */
body {
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}
input, textarea {
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}
select { cursor: pointer; user-select: none; }
:where(
  a[href], button:not(:disabled), summary,
  input[type="button"]:not(:disabled), input[type="submit"]:not(:disabled),
  input[type="reset"]:not(:disabled), input[type="checkbox"]:not(:disabled),
  input[type="radio"]:not(:disabled), input[type="file"]:not(:disabled),
  select:not(:disabled), label[for], label:has(input:not(:disabled)),
  [role="button"]:not([aria-disabled="true"]), [role="link"]:not([aria-disabled="true"]),
  [role="tab"]:not([aria-disabled="true"]), [role="menuitem"]:not([aria-disabled="true"]),
  [role="option"]:not([aria-disabled="true"]), [role="switch"]:not([aria-disabled="true"]),
  [onclick], [data-route], [data-action], [data-page], [data-href], [data-nav], [data-clickable]
) {
  cursor: pointer;
  z-index: 2;
}
:where(button, input, select, textarea):disabled,
[aria-disabled="true"], [inert], [inert] * {
  cursor: not-allowed !important;
}
/* Canonical RTL order for labelled switches: copy at the right, control at the left. */
.ds-switch { flex-direction: row-reverse; }
[contenteditable="true"], code, pre,
.allow-select, .allow-select *,
.call-transcript, .call-transcript *,
.msg-advisor, .msg-other, .msg-system, .msg-bubble {
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

/* ---------- Animations (rich, polished) ---------- */
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp  { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUpLg { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInLeft  { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scaleIn  { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
@keyframes popIn    { 0% { opacity: 0; transform: scale(.7); } 60% { transform: scale(1.05); } 100% { opacity: 1; transform: scale(1); } }
@keyframes shimmer {
  0%   { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(44, 120, 115, .4); }
  50%      { box-shadow: 0 0 0 14px rgba(44, 120, 115, 0); }
}
@keyframes pulseGlowRed {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 120, 140, .5); }
  50%      { box-shadow: 0 0 0 12px rgba(232, 120, 140, 0); }
}
@keyframes pulseGlowGreen {
  0%, 100% { box-shadow: 0 0 0 0 rgba(109, 191, 143, .5); }
  50%      { box-shadow: 0 0 0 12px rgba(109, 191, 143, 0); }
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
@keyframes floatSmall {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2px); }
}
@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes shineGlide {
  0%   { transform: translateX(-100%) skewX(-20deg); }
  100% { transform: translateX(300%) skewX(-20deg); }
}
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(-4deg); }
  75%      { transform: rotate(4deg); }
}
@keyframes growBar {
  from { transform: scaleY(0); transform-origin: bottom; }
  to   { transform: scaleY(1); transform-origin: bottom; }
}
@keyframes drawRing {
  from { stroke-dashoffset: 100; }
  to   { stroke-dashoffset: 0; }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
  20%, 40%, 60%, 80%      { transform: translateX(2px); }
}
@keyframes gradientFlow {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
@keyframes flipIn {
  from { opacity: 0; transform: perspective(600px) rotateX(-30deg); }
  to   { opacity: 1; transform: perspective(600px) rotateX(0deg); }
}

/* Stagger children with attr-based delay */
.content > * { animation: slideUpLg .55s cubic-bezier(.22,.7,.16,1) both; }
.content > *:nth-child(1) { animation-delay: .02s; }
.content > *:nth-child(2) { animation-delay: .07s; }
.content > *:nth-child(3) { animation-delay: .12s; }
.content > *:nth-child(4) { animation-delay: .17s; }
.content > *:nth-child(5) { animation-delay: .22s; }
.content > *:nth-child(6) { animation-delay: .27s; }
.content > *:nth-child(7) { animation-delay: .32s; }
.content > *:nth-child(8) { animation-delay: .37s; }
.content > *:nth-child(9) { animation-delay: .42s; }
.content > *:nth-child(n+10) { animation-delay: .47s; }

/* KPI pop in with stagger */
.kpi      { animation: popIn .5s cubic-bezier(.34, 1.56, .64, 1) both; }
.kpi:nth-child(1) { animation-delay: .08s; }
.kpi:nth-child(2) { animation-delay: .16s; }
.kpi:nth-child(3) { animation-delay: .24s; }
.kpi:nth-child(4) { animation-delay: .32s; }

/* Pulse cells stagger */
.pulse-cell { animation: scaleIn .45s cubic-bezier(.22,.7,.16,1) both; }
.pulse-cell:nth-child(1) { animation-delay: .05s; }
.pulse-cell:nth-child(2) { animation-delay: .10s; }
.pulse-cell:nth-child(3) { animation-delay: .15s; }
.pulse-cell:nth-child(4) { animation-delay: .20s; }
.pulse-cell:nth-child(5) { animation-delay: .25s; }
.pulse-cell:nth-child(6) { animation-delay: .30s; }

/* Goal items stagger */
.goal-item { animation: slideInRight .5s cubic-bezier(.22,.7,.16,1) both; }
.goal-item:nth-child(odd)  { animation-name: slideInRight; }
.goal-item:nth-child(even) { animation-name: slideInLeft; }
.goal-item:nth-child(1) { animation-delay: .05s; }
.goal-item:nth-child(2) { animation-delay: .12s; }
.goal-item:nth-child(3) { animation-delay: .19s; }
.goal-item:nth-child(4) { animation-delay: .26s; }
.goal-item:nth-child(5) { animation-delay: .33s; }
.goal-item:nth-child(6) { animation-delay: .40s; }

/* Alerts list */
.alert { animation: slideInLeft .4s cubic-bezier(.22,.7,.16,1) both; }
[dir="rtl"] .alert { animation-name: slideInRight; }
.alert:nth-child(1) { animation-delay: .04s; }
.alert:nth-child(2) { animation-delay: .10s; }
.alert:nth-child(3) { animation-delay: .16s; }
.alert:nth-child(4) { animation-delay: .22s; }
.alert:nth-child(5) { animation-delay: .28s; }
.alert:nth-child(6) { animation-delay: .34s; }
.alert:nth-child(7) { animation-delay: .40s; }
.alert:nth-child(8) { animation-delay: .46s; }

/* VIP / Hot leads list — wave pattern */
.vip-row { animation: slideUp .4s cubic-bezier(.22,.7,.16,1) both; }
.vip-row:nth-child(1) { animation-delay: .06s; }
.vip-row:nth-child(2) { animation-delay: .12s; }
.vip-row:nth-child(3) { animation-delay: .18s; }
.vip-row:nth-child(4) { animation-delay: .24s; }
.vip-row:nth-child(5) { animation-delay: .30s; }

/* Live feed entries */
.live-item { animation: slideInRight .4s cubic-bezier(.22,.7,.16,1) both; }
[dir="rtl"] .live-item { animation-name: slideInLeft; }
.live-item:nth-child(1) { animation-delay: .04s; }
.live-item:nth-child(2) { animation-delay: .09s; }
.live-item:nth-child(3) { animation-delay: .14s; }
.live-item:nth-child(4) { animation-delay: .19s; }
.live-item:nth-child(5) { animation-delay: .24s; }
.live-item:nth-child(6) { animation-delay: .29s; }
.live-item:nth-child(7) { animation-delay: .34s; }
.live-item:nth-child(8) { animation-delay: .39s; }
.live-item:nth-child(n+9) { animation-delay: .44s; }
.live-item:first-child .live-icon { animation: wiggle 2s ease-in-out infinite; }

/* Account cards */
.account-card { animation: flipIn .55s cubic-bezier(.22,.7,.16,1) both; }
.account-card:nth-child(1) { animation-delay: .06s; }
.account-card:nth-child(2) { animation-delay: .12s; }
.account-card:nth-child(3) { animation-delay: .18s; }
.account-card:nth-child(4) { animation-delay: .24s; }
.account-card:nth-child(5) { animation-delay: .30s; }
.account-card:nth-child(6) { animation-delay: .36s; }
.account-card:nth-child(7) { animation-delay: .42s; }

/* Priority cards — pop in with bounce */
.priority-card { animation: popIn .55s cubic-bezier(.34, 1.56, .64, 1) both; }
.priority-card:nth-child(1) { animation-delay: .15s; }
.priority-card:nth-child(2) { animation-delay: .22s; }
.priority-card:nth-child(3) { animation-delay: .29s; }
.priority-card:nth-child(4) { animation-delay: .36s; }

/* Heatmap cells reveal in waves */
.hm-cell { animation: scaleIn .35s cubic-bezier(.22,.7,.16,1) both; }
.hm-col:nth-child(1) .hm-cell:nth-child(1) { animation-delay: .02s; }
.hm-col:nth-child(1) .hm-cell:nth-child(2) { animation-delay: .04s; }
.hm-col:nth-child(1) .hm-cell:nth-child(3) { animation-delay: .06s; }
.hm-col:nth-child(2) .hm-cell:nth-child(1) { animation-delay: .04s; }
.hm-col:nth-child(2) .hm-cell:nth-child(2) { animation-delay: .06s; }
.hm-col:nth-child(2) .hm-cell:nth-child(3) { animation-delay: .08s; }
.hm-col:nth-child(3) .hm-cell:nth-child(1) { animation-delay: .06s; }
.hm-col:nth-child(3) .hm-cell:nth-child(2) { animation-delay: .08s; }
.hm-col:nth-child(3) .hm-cell:nth-child(3) { animation-delay: .10s; }
.hm-col:nth-child(4) .hm-cell:nth-child(1) { animation-delay: .08s; }
.hm-col:nth-child(4) .hm-cell:nth-child(2) { animation-delay: .10s; }
.hm-col:nth-child(4) .hm-cell:nth-child(3) { animation-delay: .12s; }
.hm-col:nth-child(5) .hm-cell:nth-child(1) { animation-delay: .10s; }
.hm-col:nth-child(5) .hm-cell:nth-child(2) { animation-delay: .12s; }
.hm-col:nth-child(5) .hm-cell:nth-child(3) { animation-delay: .14s; }
.hm-col:nth-child(6) .hm-cell:nth-child(1) { animation-delay: .12s; }
.hm-col:nth-child(7) .hm-cell:nth-child(1) { animation-delay: .14s; }
.hm-col:nth-child(8) .hm-cell:nth-child(1) { animation-delay: .16s; }

/* Channel rows entrance */
.channel-row { animation: slideUp .5s cubic-bezier(.22,.7,.16,1) both; }
.channel-row:nth-child(1) { animation-delay: .04s; }
.channel-row:nth-child(2) { animation-delay: .10s; }
.channel-row:nth-child(3) { animation-delay: .16s; }
.channel-row:nth-child(4) { animation-delay: .22s; }
.channel-row:nth-child(5) { animation-delay: .28s; }
.channel-row:nth-child(6) { animation-delay: .34s; }
.channel-row:nth-child(7) { animation-delay: .40s; }
.channel-row:nth-child(n+8) { animation-delay: .46s; }

/* Course/scorecard grid items */
.course-card, .res-card, .cert-card, .job-card, .mk-card, .funnel-row {
  animation: scaleIn .5s cubic-bezier(.22,.7,.16,1) both;
}
.course-card:nth-child(1), .res-card:nth-child(1), .cert-card:nth-child(1), .job-card:nth-child(1), .mk-card:nth-child(1), .funnel-row:nth-child(1) { animation-delay: .05s; }
.course-card:nth-child(2), .res-card:nth-child(2), .cert-card:nth-child(2), .job-card:nth-child(2), .mk-card:nth-child(2), .funnel-row:nth-child(2) { animation-delay: .10s; }
.course-card:nth-child(3), .res-card:nth-child(3), .cert-card:nth-child(3), .job-card:nth-child(3), .mk-card:nth-child(3), .funnel-row:nth-child(3) { animation-delay: .15s; }
.course-card:nth-child(4), .res-card:nth-child(4), .cert-card:nth-child(4), .job-card:nth-child(4), .mk-card:nth-child(4), .funnel-row:nth-child(4) { animation-delay: .20s; }
.course-card:nth-child(5), .res-card:nth-child(5), .funnel-row:nth-child(5) { animation-delay: .25s; }
.course-card:nth-child(6), .res-card:nth-child(6), .funnel-row:nth-child(6) { animation-delay: .30s; }

/* Sidebar nav items glide in — uses nth-of-type so .nav-section <div> dividers don't break the count */
.nav > .nav-item { animation: slideInRight .35s cubic-bezier(.22,.7,.16,1) both; }
[dir="rtl"] .nav > .nav-item { animation-name: slideInLeft; }
.nav > .nav-item:nth-of-type(1)  { animation-delay: .04s; }
.nav > .nav-item:nth-of-type(2)  { animation-delay: .07s; }
.nav > .nav-item:nth-of-type(3)  { animation-delay: .10s; }
.nav > .nav-item:nth-of-type(4)  { animation-delay: .13s; }
.nav > .nav-item:nth-of-type(5)  { animation-delay: .16s; }
.nav > .nav-item:nth-of-type(6)  { animation-delay: .19s; }
.nav > .nav-item:nth-of-type(7)  { animation-delay: .22s; }
.nav > .nav-item:nth-of-type(8)  { animation-delay: .25s; }
.nav > .nav-item:nth-of-type(9)  { animation-delay: .28s; }
.nav > .nav-item:nth-of-type(10) { animation-delay: .31s; }
.nav > .nav-item:nth-of-type(n+11) { animation-delay: .34s; }

/* Card head shimmer on hover */
.card { position: relative; }
.card::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.2), transparent);
  transition: left .8s cubic-bezier(.22,.7,.16,1);
  pointer-events: none;
  border-radius: inherit;
}
.card:hover::after { left: 200%; }

/* KPI value — solid color first so short digits (۰) stay visible;
   gradient clip is progressive enhancement when the browser paints it. */
.kpi-value, .stat-value, .mk-value, .pulse-value {
  color: var(--text);
  background: linear-gradient(135deg, var(--text), var(--brand-500));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .kpi-value, .stat-value, .mk-value, .pulse-value {
    -webkit-text-fill-color: var(--text);
    background: none;
  }
}
[data-theme="dark"] .kpi-value, [data-theme="dark"] .stat-value, [data-theme="dark"] .mk-value, [data-theme="dark"] .pulse-value {
  background: linear-gradient(135deg, var(--text), #b8d4f1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Mood ring accent rotation */
@keyframes moodRotate {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.mood-ring {
  background-size: 100% 100%;
  position: relative;
}
.mood-ring::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(transparent 0%, var(--accent-500) 30%, transparent 60%);
  z-index: -1;
  animation: moodRotate 8s linear infinite;
  opacity: .35;
}

/* Notif badge — blink + pulse ring */
.notif-dot { animation: notifBadgeBlink 1.6s ease-in-out infinite; }

/* Brand logo wiggle on hover */
.brand-logo:hover { animation: wiggle .6s ease-in-out; }

/* Active nav icon — kept subtle; SVG icons handle transform fine */
.nav-item.active .nav-icon { animation: floatSmall 3.2s ease-in-out infinite; }

/* Topbar avatar bounces gently (sidebar footer button avatar stays still — it's inside a clickable button) */
.topbar .user-mini .avatar { animation: floatSmall 4s ease-in-out infinite; }
/* The sidebar rail toggle is intentionally removed from the desktop chrome
   (the icon rail opens on hover/click). Phones and tablets have no rail, so
   there it is the only way into the menu. */
@media (min-width: 901px) {
  #sidebar-toggle,
  .sidebar-toggle,
  [data-sidebar-toggle] { display: none !important; }
}
@media (max-width: 900px) {
  #sidebar-toggle { flex: 0 0 auto; }
}
/* Notification UI remains functional in code, but the global header trigger
   is intentionally hidden for this product surface. */
#notif-toggle { display: none !important; }

/* Live dot pulses red-then-green */
.live-dot { animation: pulseGlowGreen 1.8s infinite; }

/* Score-pill subtle pop on hover */
.score-pill, .chip, .type-pill {
  transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s ease;
}
.score-pill:hover, .chip:hover, .type-pill:hover {
  transform: scale(1.08) translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, .08);
}

/* Account card header icon floats */
.account-icon { animation: floatSmall 3s ease-in-out infinite; }

/* Drawer entrance */
.drawer.open .dsec, .drawer.open .drawer-hero, .drawer.open .drawer-score-row,
.drawer.open .power-card {
  animation: slideUp .5s cubic-bezier(.22,.7,.16,1) both;
}
.drawer.open .drawer-hero       { animation-delay: .05s; }
.drawer.open .drawer-score-row  { animation-delay: .12s; }
.drawer.open .power-card        { animation-delay: .19s; }
.drawer.open .dsec:nth-of-type(1) { animation-delay: .26s; }
.drawer.open .dsec:nth-of-type(2) { animation-delay: .31s; }
.drawer.open .dsec:nth-of-type(3) { animation-delay: .36s; }
.drawer.open .dsec:nth-of-type(4) { animation-delay: .41s; }
.drawer.open .dsec:nth-of-type(5) { animation-delay: .46s; }
.drawer.open .dsec:nth-of-type(n+6) { animation-delay: .51s; }

/* Roadmap steps slide in */
.roadmap-step { animation: slideInRight .4s cubic-bezier(.22,.7,.16,1) both; }
[dir="rtl"] .roadmap-step { animation-name: slideInLeft; }
.roadmap-step:nth-child(1) { animation-delay: .35s; }
.roadmap-step:nth-child(2) { animation-delay: .42s; }
.roadmap-step:nth-child(3) { animation-delay: .49s; }
.roadmap-step:nth-child(4) { animation-delay: .56s; }
.roadmap-step:nth-child(5) { animation-delay: .63s; }

/* Power bars fill in */
.power-bar::before { animation: shineGlide 2.5s ease-in-out infinite; }

/* Smooth scroll global */
html { scroll-behavior: smooth; }

/* =============================================================
   NOTIFICATION POPUP
   ============================================================= */
.notif-wrap { position: relative; overflow: visible; }
.notif-popup {
  position: absolute;
  top: calc(100% + 12px);
  inset-inline-end: 0;          /* RTL: anchor left edge to wrapper left → popup extends RIGHT into screen */
  inset-inline-start: auto;
  width: 380px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-10px) scale(.96);
  transform-origin: top left;
  pointer-events: none;
  transition: all .25s cubic-bezier(.22,.7,.16,1);
  z-index: 200;
  overflow: hidden;
}
.notif-popup.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.notif-popup-head {
  padding: 14px 18px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--pastel-sky), var(--pastel-lilac));
}
.notif-popup-head strong { font-size: 14px; }
/* [erp-menu-dual-views] Founder broadcast-announcements request — compose
   entry point, grouped with the title so .notif-popup-head keeps its
   two-slot (title-group / count) space-between layout. */
.notif-popup-head-left { display: flex; align-items: center; gap: 8px; }
.notif-compose-btn {
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--brand-300);
  background: var(--surface); color: var(--brand-600, var(--brand-500));
  font-size: 11px; font-weight: 600; cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.notif-compose-btn:hover { background: var(--brand-50); }
.notif-compose-btn:active { transform: scale(.97); }
/* RFC-0052 T5 ([erp-gaps-group-e-workspace]) — gear link to the personal
   notification-preference card in #profile-settings. */
.notif-settings-link {
  font-size: 14px; line-height: 1; text-decoration: none; opacity: .7;
  transition: opacity .15s ease, transform .15s ease;
}
.notif-settings-link:hover { opacity: 1; transform: rotate(20deg); }
.notif-popup-body { max-height: 380px; overflow-y: auto; padding: 6px; }
.notif-popup-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.notif-popup-foot a {
  font-size: 12px;
  color: var(--brand-500);
  font-weight: 600;
}
.notif-item {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .2s ease;
}
.notif-item:hover { background: var(--surface-2); }
/* [erp-menu-dual-views] Founder broadcast-announcements request — a real
   admin-posted announcement (core.broadcast_announcements, GET /core/
   broadcasts) needs to visually read as "from an admin", not a generic
   auto-generated smart-alert: a filled pastel background + a slightly
   thicker inline-start accent bar reusing the SAME red/amber/green tone
   variables .notif-dot-color already keys off of. */
.notif-broadcast {
  background: var(--surface-2);
  border-inline-start: 3px solid var(--border);
  border-radius: 8px;
}
.notif-broadcast.notif-red    { border-inline-start-color: var(--red-500); background: color-mix(in srgb, var(--red-500) 8%, var(--surface-2)); }
.notif-broadcast.notif-amber  { border-inline-start-color: var(--amber-500); background: color-mix(in srgb, var(--amber-500) 8%, var(--surface-2)); }
.notif-broadcast.notif-green  { border-inline-start-color: var(--green-500); background: color-mix(in srgb, var(--green-500) 8%, var(--surface-2)); }
/* live-header-feed.js (RFC-0052 T4, [erp-gaps-group-e-workspace]) — a real
   Live Feed Engine item gets a THIRD grid column for its own dismiss button
   (`.notif-item`'s base grid-template-columns is only `10px 1fr`, sized for
   .notif-dot-color + .notif-info; a broadcast never needed a third slot). */
.notif-livefeed { grid-template-columns: 6px 38px minmax(0,1fr) auto; align-items: start; }
.notif-livefeed.is-actionable { cursor: pointer; }
.notif-livefeed.is-actionable:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.lhf-icon { display:grid;place-items:center;width:34px;height:34px;border-radius:11px;background:#e8f3ff;color:#3478c7; }
.lhf-icon.is-green { background:#dff5e9;color:#23815b; }
.lhf-icon.is-rose,.lhf-icon.is-red { background:#ffe3e8;color:#bd3d55; }
.lhf-icon.is-amber { background:#fff0c9;color:#b66e13; }
.lhf-call-details { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px 10px;margin-top:7px; }
.lhf-call-details span { display:flex;align-items:center;gap:5px;min-width:0;color:var(--text-muted);font-size:11px;line-height:1.55; }
.lhf-call-details span i { display:grid;place-items:center;flex:0 0 auto; }
.lhf-call-details span:first-child { direction:ltr;justify-content:flex-end;text-align:end;font-variant-numeric:tabular-nums; }
@media(max-width:520px){.lhf-call-details{grid-template-columns:1fr}}
.notif-livefeed-dismiss {
  border: none; background: transparent; color: var(--text-muted);
  cursor: pointer; font-size: 12px; line-height: 1; padding: 4px 6px;
  border-radius: 6px; align-self: start;
}
.notif-livefeed-dismiss:hover { background: var(--surface-3); color: var(--text); }
.notif-livefeed-dismiss:disabled { opacity: .5; cursor: default; }
.notif-dot-color {
  width: 8px; height: 8px; border-radius: 50%;
  align-self: flex-start; margin-top: 5px;
}
.notif-red    .notif-dot-color { background: var(--red-500); animation: pulseGlowRed 2s infinite; }
.notif-amber  .notif-dot-color { background: var(--amber-500); }
.notif-green  .notif-dot-color { background: var(--green-500); }
.notif-title { font-weight: 600; font-size: 13px; line-height: 1.5; }
.notif-detail { font-size: 11px; color: var(--text-muted); margin-top: 2px; line-height: 1.6; }

/* =============================================================
   NAV-FEATURED (journey/workspace/automation)
   ============================================================= */
.nav-item.nav-featured {
  color: var(--text);
  font-weight: 600;
}
.nav-item.nav-featured .nav-icon {
  color: var(--accent-600);
  opacity: 1;
}
.nav-item.nav-featured.active {
  background: linear-gradient(135deg, rgba(244, 162, 97, .14), rgba(244, 162, 97, .04));
  color: var(--accent-700, var(--accent-600));
  box-shadow: inset 0 0 0 1px rgba(244, 162, 97, .22);
}
.nav-item.nav-featured.active::before {
  background: linear-gradient(180deg, var(--accent-500), var(--accent-600));
}
.nav-item.nav-featured.active .nav-icon { color: var(--accent-600); }

.nav-badge {
  margin-inline-start: auto;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: .4px;
  flex-shrink: 0;
  line-height: 1.4;
}
.nav-badge-new {
  background: rgba(34, 197, 94, .12);
  color: var(--green-600, #16a34a);
  border: 1px solid rgba(34, 197, 94, .22);
}
.nav-badge-star {
  background: rgba(244, 162, 97, .14);
  color: var(--accent-600);
  border: 1px solid rgba(244, 162, 97, .25);
  position: relative;
}
.nav-badge-star::before {
  content: '✦';
  margin-inline-end: 3px;
  font-size: 9px;
  opacity: .85;
}
.nav-item.nav-featured.active .nav-badge {
  background: rgba(255, 255, 255, .55);
  border-color: transparent;
}
[data-theme="dark"] .nav-badge-new {
  background: rgba(34, 197, 94, .14);
  color: #4ade80;
  border-color: rgba(34, 197, 94, .25);
}
[data-theme="dark"] .nav-badge-star {
  background: rgba(244, 162, 97, .16);
  color: #fbbf77;
  border-color: rgba(244, 162, 97, .3);
}

/* =============================================================
   SIDEBAR COLLAPSE (desktop)
   ============================================================= */
@media (min-width: 901px) {
  body.sidebar-collapsed .sidebar {
    width: 0;
    min-width: 0;
    overflow: hidden;
    border-inline-start: none;
    transition: width .25s cubic-bezier(.22,.7,.16,1);
  }
  body:not(.sidebar-collapsed) .sidebar {
    transition: width .25s cubic-bezier(.22,.7,.16,1);
  }
}

/* =============================================================
   JOURNEY HERO (full page)
   ============================================================= */
/* #journey-host (renderJourney() in app.js) appends a dozen-odd sections —
   hero, c360-strip/insights/vitals/timeline, identity graph, sales
   playbook, Diaco-attribution power-card, a closing grid-2 — as plain
   block children. Most carry their own ~14-16px margin, but the last
   three (playbook-card/power-card/grid-2, all shared classes used
   elsewhere with their own spacing context) don't, so they were rendering
   flush against each other with zero white space. A flex column + the
   site's macro gap fixes every gap at once, including ones that already
   have a margin (margin doesn't collapse between flex items, so those
   just get a bit more — matching the .dash-mc-hero/.dash-mc-tabs
   precedent inside .content). [ux-cognitive-load-review] */
#journey-host { display: flex; flex-direction: column; gap: var(--space-macro, 26px); }

.journey-hero {
  background: linear-gradient(135deg, rgba(184,212,241,.3), rgba(255,228,204,.25));
  border: 1px solid var(--border);
}
.journey-hero .score-ring {
  width: 100px; height: 100px;
  background: conic-gradient(var(--green-500) calc(var(--p) * 1%), var(--surface-2) 0);
}
.journey-hero .score-ring::before {
  background: var(--surface);
}
.journey-hero .score-ring .pct { font-size: 20px; }
.journey-hero .score-ring .lbl { font-size: 9px; }

/* =============================================================
   SALES PLAYBOOK (در CRM دیدار · راهنمای کارشناس)
   ============================================================= */
.playbook-card {
  background: linear-gradient(135deg, rgba(212,160,23,.06), rgba(184,212,241,.10));
  border: 1px solid var(--accent-300);
}
.playbook-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}
.playbook-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 14px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: 10px;
  border-inline-start: 3px solid var(--accent-500);
  font-size: 13px;
  align-items: center;
}
@media (max-width: 800px) {
  .playbook-row { grid-template-columns: 1fr; }
}
.playbook-label {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 12px;
}
.playbook-value { line-height: 1.7; }
.playbook-tip {
  background: linear-gradient(135deg, rgba(244,162,97,.10), transparent);
  padding: 10px 12px;
  border-radius: 8px;
  font-style: italic;
}

.playbook-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}
@media (max-width: 700px) { .playbook-cols { grid-template-columns: 1fr; } }
.playbook-col {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface);
}
.playbook-col h5 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
}
.playbook-col ul {
  margin: 0;
  padding-inline-start: 18px;
  font-size: 12px;
  line-height: 1.9;
}
.playbook-col li { padding: 4px 0; }
.playbook-do {
  border: 1px solid rgba(109, 191, 143, .35);
  background: linear-gradient(135deg, rgba(184,230,211,.18), transparent);
}
.playbook-do h5 { color: #2f8a5e; }
.playbook-dont {
  border: 1px solid rgba(232, 120, 140, .35);
  background: linear-gradient(135deg, rgba(245,194,199,.18), transparent);
}
.playbook-dont h5 { color: #b14458; }

/* =============================================================
   PEOPLE GRID (Customer Journey list)
   ============================================================= */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.person-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: all .25s cubic-bezier(.22,.7,.16,1);
  position: relative;
  overflow: hidden;
}
.person-card::before {
  content: '';
  position: absolute;
  top: 0; inset-inline-start: 0;
  width: 100%; height: 4px;
  background: linear-gradient(90deg, var(--brand-500), var(--accent-500));
  transform: scaleX(0);
  transform-origin: start;
  transition: transform .3s cubic-bezier(.22,.7,.16,1);
}
.person-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--brand-300);
}
.person-card:hover::before { transform: scaleX(1); }
.person-card.active {
  border-color: var(--brand-500);
  box-shadow: 0 8px 24px rgba(44, 120, 115, .25);
}
.person-card.active::before { transform: scaleX(1); }

.person-head {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}
.avatar.anonymous {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  font-weight: 800;
}
.person-info { flex: 1; min-width: 0; }
.person-name { font-weight: 700; font-size: 14px; }
.person-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.person-body {
  display: flex; flex-direction: column;
  gap: 10px;
  padding: 12px 0;
}
.person-section {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 12px;
}
.person-section-title {
  font-weight: 700;
  font-size: 11px;
  margin-bottom: 6px;
  color: var(--brand-700);
}
.person-line {
  font-size: 11px;
  line-height: 1.7;
  color: var(--text);
  padding: 2px 0;
}

.person-foot {
  display: flex; gap: 12px; align-items: center;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}
.person-stat { font-size: 11px; }
.person-cta { white-space: nowrap; }

/* =============================================================
   AUTOMATION BUILDER — n8n-style canvas (full clone)
   prefix: nx- (Node eXperience)
   ============================================================= */

.nx-shell {
  --nx-bg:        var(--surface-2);
  --nx-surface:   var(--surface);
  --nx-surface-2: var(--surface-3);
  --nx-border:    var(--border-strong);
  --nx-text:      var(--text);
  --nx-muted:     var(--text-muted);
  --nx-grid-dot:  rgba(15, 23, 42, .12);
  --nx-trigger:   #2c7873;
  --nx-condition: #f0b86e;
  --nx-action:    #6dbf8f;
  --nx-shadow:    0 1px 2px rgba(16,24,40,.05), 0 6px 18px rgba(16,24,40,.07);
  --nx-shadow-lg: 0 10px 30px rgba(16,24,40,.18);
  --nx-radius:    14px;

  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  inset-inline-start: var(--sidebar-w);
  display: grid;
  grid-template-rows: 56px 1fr;
  background: var(--nx-bg);
  z-index: 30;
  font-size: 13px;
  color: var(--nx-text);
  transition: inset-inline-start .25s cubic-bezier(.22,.7,.16,1);
}
body.sidebar-collapsed .nx-shell {
  inset-inline-start: 0;
}
body.sidebar-rail-mode:not(.sidebar-collapsed) .nx-shell {
  inset-inline-start: var(--sidebar-rail-w);
}
.nx-shell[data-nx-theme="dark"] {
  --nx-bg:        #0a1226;
  --nx-surface:   #11193a;
  --nx-surface-2: #182253;
  --nx-border:    #243168;
  --nx-text:      #e6ecff;
  --nx-muted:     #94a3b8;
  --nx-grid-dot:  rgba(180, 200, 255, .10);
  --nx-shadow:    0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --nx-shadow-lg: 0 14px 40px rgba(0,0,0,.5);
}
@media (max-width: 900px) {
  .nx-shell { inset-inline-start: 0; }
}

/* ---------- TOPBAR ---------- */
.nx-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: var(--nx-surface);
  border-bottom: 1px solid var(--nx-border);
  gap: 16px;
  z-index: 5;
}
.nx-topbar-left, .nx-topbar-right {
  display: flex; align-items: center; gap: 8px;
}
.nx-topbar-right {
  padding: 4px;
  border: 1px solid color-mix(in srgb, var(--nx-border) 78%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--nx-surface-2) 72%, transparent);
}
.nx-brand {
  display: flex; align-items: center; gap: 10px;
  padding-inline-end: 12px;
}
.nx-brand-copy {
  display: grid;
  grid-template-rows: auto 22px;
  align-content: center;
  gap: 1px;
}
.nx-brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #8064d8, #5b3db7);
  display: grid; place-items: center;
  line-height: 0;
  box-shadow: 0 4px 14px rgba(91,61,183,.34);
  color: #fff;
}
.nx-brand-mark > [data-ds-icon] {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: #fff !important;
  line-height: 0;
}
.nx-brand-mark > [data-ds-icon] > .ds-ico {
  display: block;
  width: 20px;
  height: 20px;
  margin: 0;
  color: #fff !important;
}
.nx-brand-title {
  font-weight: 800;
  font-size: 14px;
  line-height: 1.2;
}
.nx-brand-sub {
  font-size: 11px;
  color: var(--nx-muted);
  line-height: 1.2;
}
.nx-flow-name-input.ds-field__input {
  width: 160px;
  inline-size: 160px;
  height: 22px;
  min-height: 0;
  min-block-size: 0;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  padding: 2px 5px;
  font-family: inherit;
  font-size: 11px;
  line-height: 16px;
  box-shadow: none;
}
.nx-flow-name-input.ds-field__input:hover { border-color: var(--nx-border); }
.nx-flow-name-input.ds-field__input:focus { outline: 2px solid var(--brand-500); outline-offset: 1px; background: var(--nx-surface-2); box-shadow: none; }
.nx-divider {
  width: 1px; height: 24px;
  background: var(--nx-border);
}
.nx-topbar-actions {
  display: flex; gap: 4px;
}
.nx-tbtn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--nx-text);
  border-radius: 8px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
  font-family: inherit;
}
.nx-tbtn:hover {
  background: var(--nx-surface-2);
  border-color: var(--nx-border);
}
.nx-tbtn > [data-ds-icon] {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}
.nx-tbtn[data-nx-act="undo"],
.nx-tbtn[data-nx-act="redo"],
.nx-tbtn[data-nx-act="theme"] {
  width: 32px;
  min-width: 32px;
  padding: 0;
  justify-content: center;
  border-color: var(--nx-border);
  background: var(--nx-surface);
}
.nx-tbtn[data-nx-act="undo"] { color: #5265b5; }
.nx-tbtn[data-nx-act="redo"] { color: #2c7873; }
.nx-tbtn[data-nx-act="theme"] { color: #7657c8; }
.nx-tbtn[data-nx-act="history"] {
  color: #7657c8;
  background: rgba(155,123,245,.1);
}
.nx-tbtn[data-nx-act="pause"] {
  background: linear-gradient(135deg, #f29aa9, #dc657b);
  box-shadow: 0 2px 8px rgba(220,101,123,.28);
}
.nx-tbtn[data-nx-act="activate"] {
  background: linear-gradient(135deg, #62bd8d, #318766);
  box-shadow: 0 2px 8px rgba(49,135,102,.3);
}
.nx-tbtn.nx-tbtn-sm { height: 26px; padding: 0 8px; font-size: 11px; }
.nx-tbtn.nx-tbtn-primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(44,120,115,.35);
}
.nx-tbtn.nx-tbtn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(44,120,115,.5);
}
.nx-tbtn.nx-tbtn-warn {
  background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(244,162,97,.35);
}
.nx-tbtn.nx-tbtn-warn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(244,162,97,.5);
}
.nx-status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--nx-surface-2);
  border-radius: 99px;
  font-size: 11px; font-weight: 600;
  color: var(--nx-muted);
}
.nx-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green-500);
  box-shadow: 0 0 0 3px rgba(109,191,143,.25);
  animation: nxPulseDot 2.2s ease-in-out infinite;
}
.nx-status-pill.is-running .nx-status-dot { background: var(--accent-500); box-shadow: 0 0 0 3px rgba(244,162,97,.3); }
.nx-status-pill.is-error   .nx-status-dot { background: var(--red-500); box-shadow: 0 0 0 3px rgba(232,120,140,.3); }
@keyframes nxPulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.25); opacity: .65; }
}

/* ---------- BODY LAYOUT ---------- */
.nx-body {
  position: relative;
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 0;
  overflow: hidden;
}
@media (max-width: 1080px) {
  .nx-body { grid-template-columns: 240px 1fr; }
}
@media (max-width: 800px) {
  .nx-body { grid-template-columns: 1fr; }
  .nx-palette { display: none; }
}

/* ---------- PALETTE ---------- */
.nx-palette {
  display: flex; flex-direction: column;
  background: var(--nx-surface);
  border-inline-end: 1px solid var(--nx-border);
  min-height: 0;
}
.nx-palette-search {
  position: relative;
  padding: 12px;
  border-bottom: 1px solid var(--nx-border);
}
.nx-palette-search-icon {
  position: absolute;
  inset-inline-start: 22px;
  top: 50%; transform: translateY(-50%);
  font-size: 13px;
  color: var(--nx-muted);
  pointer-events: none;
}
.nx-palette-search input {
  width: 100%;
  height: 34px;
  padding: 0 28px;
  border: 1px solid var(--nx-border);
  background: var(--nx-surface-2);
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  color: var(--nx-text);
  transition: all .15s ease;
}
.nx-palette-search input:focus {
  outline: none;
  border-color: var(--brand-500);
  background: var(--nx-surface);
  box-shadow: 0 0 0 3px rgba(44,120,115,.15);
}
.nx-palette-search-hint {
  position: absolute;
  inset-inline-end: 22px;
  top: 50%; transform: translateY(-50%);
  font-size: 10px;
  color: var(--nx-muted);
  background: var(--nx-surface);
  border: 1px solid var(--nx-border);
  border-radius: 4px;
  padding: 1px 5px;
  pointer-events: none;
}
.nx-palette-tabs {
  display: flex; gap: 2px;
  padding: 8px;
  border-bottom: 1px solid var(--nx-border);
}
/* Tabs take the width of their own label so the longest one («چندشاخه») is
   never clipped in the narrow tablet palette. */
.nx-palette-tab {
  flex: 1 1 auto;
  padding: 0 4px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--nx-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s ease;
}
/* Short explanation and guide button above a palette group. */
.nx-palette-help { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: 0 0 10px; }
.nx-palette-help > .nx-cfield-help { margin: 0; }
.nx-palette-tab:hover { background: var(--nx-surface-2); color: var(--nx-text); }
.nx-palette-tab:not(.active) { border: 1px solid transparent; }
.nx-palette-tab:not(.active):hover { border-color: var(--nx-border); }
.nx-palette-tab[data-nx-tab="trigger"] > [data-ds-icon] { color: #5265b5; }
.nx-palette-tab[data-nx-tab="condition"] > [data-ds-icon] { color: #bd712e; }
.nx-palette-tab[data-nx-tab="action"] > [data-ds-icon] { color: #318766; }
.nx-palette-tab[data-nx-tab="flow"] > [data-ds-icon] { color: #6f56c9; }
.nx-palette-tab.active {
  background: var(--brand-500);
  color: #fff;
  box-shadow: 0 2px 6px rgba(44,120,115,.3);
}
.nx-palette-tab.active > [data-ds-icon] {
  color: #fff;
}
/* A glyph with a default semantic tone (bolt, share) gets that tone with
   !important on its inner svg; inside a tab it follows the tab's own icon
   colour instead, so it turns white on the active tab like the others. */
.nx-palette-tab > [data-ds-icon] > :is(.ds-ico, .material-symbols-rounded) {
  color: inherit !important;
}
.nx-palette-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.nx-palette-scroll::-webkit-scrollbar { width: 6px; }
.nx-palette-scroll::-webkit-scrollbar-thumb { background: var(--nx-border); border-radius: 4px; }
.nx-palette-scroll::-webkit-scrollbar-thumb:hover { background: var(--nx-muted); }

.nx-palette-section { margin-bottom: 18px; }
.nx-palette-section.is-hidden { display: none; }
.nx-palette-title {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--nx-muted);
  text-transform: none;
  letter-spacing: 0;
}
.nx-palette-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px currentColor;
  opacity: .9;
}
.nx-palette-list {
  display: flex; flex-direction: column;
  gap: 4px;
}
.nx-pnode {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--nx-surface-2);
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: grab;
  font-size: 12px;
  font-weight: 500;
  user-select: none;
  transition: all .15s ease;
  position: relative;
}
.nx-pnode:hover {
  background: var(--nx-surface);
  border-color: var(--nx-border);
  transform: translateX(-2px);
  box-shadow: var(--nx-shadow);
}
[dir="rtl"] .nx-pnode:hover { transform: translateX(2px); }
.nx-pnode:active, .nx-pnode.is-dragging {
  cursor: grabbing;
  opacity: .55;
  transform: scale(.98);
}
.nx-pnode.is-hidden { display: none; }
.nx-pnode-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: grid; place-items: center;
  font-size: 14px;
  flex-shrink: 0;
}
.nx-pnode[data-kind="trigger"]   .nx-pnode-icon { background: rgba(44,120,115,.18); color: var(--brand-600); }
.nx-pnode[data-kind="condition"] .nx-pnode-icon { background: rgba(240,184,110,.22); color: var(--accent-600); }
.nx-pnode[data-kind="action"]    .nx-pnode-icon { background: rgba(109,191,143,.22); color: #2f8a5e; }
.nx-pnode-label { flex: 1; line-height: 1.4; }
.nx-pnode-grip {
  font-size: 12px;
  color: var(--nx-muted);
  opacity: 0;
  letter-spacing: -2px;
  transition: opacity .15s ease;
}
.nx-pnode:hover .nx-pnode-grip { opacity: .8; }

.nx-palette-foot {
  padding: 10px 12px;
  font-size: 11px;
  color: var(--nx-muted);
  border-top: 1px solid var(--nx-border);
  text-align: center;
}
.nx-palette-empty {
  margin: 18px 10px;
  padding: 14px 12px;
  border: 1px dashed var(--nx-border);
  border-radius: 10px;
  color: var(--nx-muted);
  background: var(--nx-surface-2);
  font-size: 12px;
  line-height: 1.8;
  text-align: center;
}
.nx-palette-tab > [data-ds-icon] {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

@media (max-width: 1180px) {
  .nx-topbar {
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
  }
  .nx-topbar-left,
  .nx-topbar-right,
  .nx-topbar-actions { flex: 0 0 auto; }
}
@media (min-width: 801px) and (max-width: 1180px) {
  .nx-shell { grid-template-rows: 96px 1fr; }
  .nx-topbar {
    flex-wrap: wrap;
    align-content: center;
    justify-content: space-between;
    overflow: visible;
    padding-block: 7px;
  }
  .nx-topbar-left,
  .nx-topbar-right { flex: 1 1 100%; justify-content: space-between; }
}
@media (max-width: 800px) {
  .nx-shell { grid-template-rows: 56px 1fr; }
  .nx-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(260px, 45vh) minmax(360px, 1fr);
    overflow-y: auto;
  }
  .nx-palette { display: flex; max-height: 45vh; border-inline-end: 0; border-bottom: 1px solid var(--nx-border); }
  .nx-canvas-wrap { min-height: 360px; }
}
@media (max-width: 520px) {
  .nx-topbar { padding-inline: 8px; gap: 8px; }
  .nx-brand { padding-inline-end: 4px; }
  .nx-brand-sub:not(.nx-flow-name-input),
  .nx-divider { display: none; }
  .nx-flow-name-input.ds-field__input { width: 112px; inline-size: 112px; }
  .nx-tbtn { padding-inline: 9px; }
  .nx-palette-search { padding: 8px 12px; }
  .nx-palette-scroll { padding: 10px 12px; }
  .nx-minimap { display: none; }
  .nx-canvas-empty { max-width: calc(100% - 96px); }
}

/* ---------- CANVAS WRAPPER ---------- */
.nx-canvas-wrap {
  position: relative;
  overflow: hidden;
  background: var(--nx-bg);
  min-width: 0;
}
.nx-canvas {
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, var(--nx-grid-dot) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 0 0;
  cursor: grab;
  overflow: hidden;
  user-select: none;
}
.nx-canvas.is-panning { cursor: grabbing; }
.nx-canvas.is-connecting { cursor: crosshair; }
.nx-canvas.is-drop-target {
  background-image:
    radial-gradient(circle, rgba(44,120,115,.4) 1.5px, transparent 1.5px),
    linear-gradient(rgba(44,120,115,.04), rgba(44,120,115,.04));
  background-size: 24px 24px, auto;
}

.nx-edges {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 1;
}
.nx-edges g { pointer-events: auto; }
.nx-edge-path {
  fill: none;
  stroke: var(--brand-500);
  stroke-width: 2.5;
  stroke-linecap: round;
  cursor: pointer;
  transition: stroke-width .15s ease;
  filter: drop-shadow(0 1px 2px rgba(44,120,115,.25));
}
.nx-edge-path:hover, .nx-edge-path.is-selected {
  stroke-width: 3.5;
  filter: drop-shadow(0 2px 4px rgba(44,120,115,.45));
}
.nx-edge-path.is-yes { stroke: var(--green-500); }
.nx-edge-path.is-no  { stroke: var(--red-500); }
.nx-edge-flow {
  fill: var(--accent-500);
  filter: drop-shadow(0 0 6px rgba(244,162,97,.6));
}
.nx-temp-edge {
  fill: none;
  stroke: var(--brand-500);
  stroke-width: 2.5;
  stroke-dasharray: 6 6;
  opacity: 0;
  pointer-events: none;
  animation: nxDash 1s linear infinite;
}
.nx-canvas.is-connecting .nx-temp-edge { opacity: 1; }
@keyframes nxDash {
  to { stroke-dashoffset: -24; }
}

/* ---------- NODES ---------- */
.nx-nodes {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  z-index: 2;
}
.nx-node {
  position: absolute;
  width: 240px;
  background: var(--nx-surface);
  border: 1.5px solid var(--nx-border);
  border-radius: var(--nx-radius);
  box-shadow: var(--nx-shadow);
  cursor: move;
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
  animation: nxNodePop .35s cubic-bezier(.34,1.56,.64,1) both;
  user-select: none;
}
@keyframes nxNodePop {
  from { opacity: 0; transform: scale(.85); }
  to   { opacity: 1; transform: scale(1); }
}
.nx-node:hover {
  border-color: var(--brand-300);
  box-shadow: var(--nx-shadow-lg);
  z-index: 4;
}
.nx-node.is-selected {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(44,120,115,.25), var(--nx-shadow-lg);
  z-index: 5;
}
.nx-node.is-dragging {
  cursor: grabbing;
  box-shadow: var(--nx-shadow-lg);
  transform: scale(1.02);
  z-index: 6;
}
.nx-node.is-disabled { opacity: .4; }
.nx-node.is-running {
  border-color: var(--accent-500);
  box-shadow: 0 0 0 4px rgba(244,162,97,.3), 0 8px 24px rgba(244,162,97,.4);
  animation: nxRunPulse 1.2s ease-in-out infinite;
}
@keyframes nxRunPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(244,162,97,.3), 0 8px 24px rgba(244,162,97,.4); }
  50%      { box-shadow: 0 0 0 8px rgba(244,162,97,.15), 0 12px 32px rgba(244,162,97,.5); }
}
.nx-node.is-success {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(109,191,143,.25), var(--nx-shadow);
}
.nx-node.is-error {
  border-color: var(--red-500);
  box-shadow: 0 0 0 3px rgba(232,120,140,.25), var(--nx-shadow);
}

.nx-node-stripe {
  position: absolute;
  top: 0; bottom: 0;
  inset-inline-start: 0;
  width: 4px;
  border-start-start-radius: var(--nx-radius);
  border-end-start-radius: var(--nx-radius);
}
.nx-node[data-kind="trigger"]   .nx-node-stripe { background: linear-gradient(180deg, var(--brand-500), var(--brand-700)); }
.nx-node[data-kind="condition"] .nx-node-stripe { background: linear-gradient(180deg, var(--accent-500), var(--accent-600)); }
.nx-node[data-kind="action"]    .nx-node-stripe { background: linear-gradient(180deg, var(--green-500), #2f8a5e); }

.nx-node-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px 8px;
  border-bottom: 1px dashed var(--nx-border);
}
.nx-node-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 17px;
  flex-shrink: 0;
}
.nx-node[data-kind="trigger"]   .nx-node-icon { background: rgba(44,120,115,.18); }
.nx-node[data-kind="condition"] .nx-node-icon { background: rgba(240,184,110,.22); }
.nx-node[data-kind="action"]    .nx-node-icon { background: rgba(109,191,143,.22); }
.nx-node-meta { flex: 1; min-width: 0; }
.nx-node-kind {
  font-size: 9px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.nx-node[data-kind="trigger"]   .nx-node-kind { color: var(--brand-600); }
.nx-node[data-kind="condition"] .nx-node-kind { color: var(--accent-600); }
.nx-node[data-kind="action"]    .nx-node-kind { color: #2f8a5e; }
.nx-node-title {
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.nx-node-body {
  padding: 8px 12px 12px;
  font-size: 11px;
  color: var(--nx-muted);
  line-height: 1.6;
  min-height: 30px;
}
.nx-node-body .nx-node-config {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.nx-node-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px;
  border-top: 1px dashed var(--nx-border);
  font-size: 10px;
  color: var(--nx-muted);
}
.nx-node-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--nx-surface-2);
  font-size: 9px;
  font-weight: 800;
  color: var(--nx-muted);
}

/* Node handles */
.nx-handle {
  position: absolute;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--nx-surface);
  border: 2.5px solid var(--brand-500);
  cursor: crosshair;
  transition: all .15s ease;
  z-index: 3;
}
.nx-handle:hover {
  transform: scale(1.4);
  background: var(--brand-500);
  box-shadow: 0 0 0 6px rgba(44,120,115,.2);
}
.nx-handle.is-target-valid {
  background: var(--green-500);
  border-color: var(--green-500);
  transform: scale(1.4);
  box-shadow: 0 0 0 6px rgba(109,191,143,.3);
}
/* Use direct left/right (geometric) — flow is L→R like n8n, regardless of RTL text */
.nx-handle-in {
  left: -8px;
  top: 50%; transform: translateY(-50%);
}
.nx-handle-out {
  right: -8px;
  top: 50%; transform: translateY(-50%);
}
.nx-handle-in:hover { transform: translateY(-50%) scale(1.4); }
.nx-handle-out:hover { transform: translateY(-50%) scale(1.4); }
.nx-handle-in.is-target-valid,
.nx-handle-out.is-target-valid { transform: translateY(-50%) scale(1.4); }

/* Condition node has 2 outputs on the right */
.nx-node[data-kind="condition"] .nx-handle-out-yes,
.nx-node[data-exits="2"] .nx-handle-out-yes {
  right: -8px;
  top: 35%;
  border-color: var(--green-500);
}
.nx-node[data-kind="condition"] .nx-handle-out-no,
.nx-node[data-exits="2"] .nx-handle-out-no {
  right: -8px;
  top: 65%;
  border-color: var(--red-500);
}
.nx-node[data-kind="condition"] .nx-handle-out-yes:hover,
.nx-node[data-exits="2"] .nx-handle-out-yes:hover { background: var(--green-500); box-shadow: 0 0 0 6px rgba(109,191,143,.25); }
.nx-node[data-kind="condition"] .nx-handle-out-no:hover,
.nx-node[data-exits="2"] .nx-handle-out-no:hover  { background: var(--red-500);   box-shadow: 0 0 0 6px rgba(232,120,140,.25); }

.nx-handle-label {
  position: absolute;
  font-size: 9px;
  font-weight: 700;
  pointer-events: none;
  white-space: nowrap;
  direction: rtl;
}
.nx-node[data-kind="condition"] .nx-handle-label.yes,
.nx-node[data-exits="2"] .nx-handle-label.yes {
  right: -28px;
  top: 30%;
  color: var(--green-500);
}
.nx-node[data-kind="condition"] .nx-handle-label.no,
.nx-node[data-exits="2"] .nx-handle-label.no {
  right: -28px;
  top: 60%;
  color: var(--red-500);
}

/* Trigger has only output, action/condition default has only input + output */
.nx-node[data-kind="trigger"] .nx-handle-in { display: none; }

/* Empty state */
.nx-canvas-empty {
  position: absolute;
  inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  pointer-events: none;
  color: var(--nx-muted);
  z-index: 1;
}
.nx-empty-art {
  position: relative;
  width: 110px; height: 110px;
  display: grid; place-items: center;
  margin-bottom: 14px;
}
.nx-empty-circle {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(44,120,115,.15), transparent 70%);
  animation: nxEmptyFloat 4s ease-in-out infinite;
}
.nx-empty-icon {
  font-size: 56px;
  filter: drop-shadow(0 4px 14px rgba(44,120,115,.35));
  animation: nxEmptyFloat 4s ease-in-out infinite reverse;
}
@keyframes nxEmptyFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
.nx-empty-title {
  font-weight: 800;
  font-size: 16px;
  color: var(--nx-text);
  margin-bottom: 4px;
}
.nx-empty-sub {
  font-size: 12px;
  max-width: 360px;
  margin-bottom: 14px;
  line-height: 1.7;
}
.nx-empty-hints {
  display: flex; gap: 4px; flex-wrap: wrap; justify-content: center;
  font-size: 11px;
}
.nx-kbd {
  display: inline-block;
  padding: 1px 6px;
  background: var(--nx-surface);
  border: 1px solid var(--nx-border);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  font-family: monospace;
  color: var(--nx-text);
  box-shadow: 0 1px 0 var(--nx-border);
  margin-inline-end: 2px;
}
.nx-kbd-sep { color: var(--nx-muted); margin: 0 4px; }

/* ---------- ZOOM CONTROLS ---------- */
.nx-zoom {
  position: absolute;
  bottom: 16px; inset-inline-start: 16px;
  display: flex; flex-direction: column;
  background: var(--nx-surface);
  border: 1px solid var(--nx-border);
  border-radius: 10px;
  box-shadow: var(--nx-shadow);
  overflow: hidden;
  z-index: 10;
}
.nx-zbtn {
  width: 36px; height: 32px;
  border: none;
  background: transparent;
  color: var(--nx-text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease;
  font-family: inherit;
  border-bottom: 1px solid var(--nx-border);
}
.nx-zbtn:last-child { border-bottom: none; }
.nx-zbtn:hover { background: var(--nx-surface-2); color: var(--brand-500); }
.nx-zbtn-percent {
  font-size: 10px;
  font-weight: 700;
  color: var(--nx-muted);
  cursor: default;
}
.nx-zbtn-percent:hover { background: transparent; color: var(--nx-muted); }

/* ---------- MINIMAP ---------- */
.nx-minimap {
  position: absolute;
  bottom: 16px; inset-inline-end: 16px;
  width: 200px;
  background: var(--nx-surface);
  border: 1px solid var(--nx-border);
  border-radius: 10px;
  box-shadow: var(--nx-shadow);
  overflow: hidden;
  z-index: 10;
  transition: all .25s ease;
}
.nx-minimap.is-collapsed {
  width: 90px;
}
.nx-minimap.is-collapsed .nx-minimap-svg { display: none; }
.nx-minimap-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--nx-muted);
  border-bottom: 1px solid var(--nx-border);
  background: var(--nx-surface-2);
}
.nx-minimap-toggle {
  width: 18px; height: 18px;
  border: none;
  background: transparent;
  color: var(--nx-muted);
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
}
.nx-minimap-toggle:hover { background: var(--nx-surface); color: var(--nx-text); }
.nx-minimap-svg {
  display: block;
  width: 100%;
  height: 130px;
  background:
    radial-gradient(circle, var(--nx-grid-dot) 1px, transparent 1px) 0 0/12px 12px,
    var(--nx-bg);
}
.nx-minimap-node {
  fill: var(--brand-500);
  opacity: .75;
  stroke: var(--nx-surface);
  stroke-width: 1;
}
.nx-minimap-node.condition { fill: var(--accent-500); }
.nx-minimap-node.action    { fill: var(--green-500); }
.nx-minimap-viewport {
  fill: rgba(44,120,115,.12);
  stroke: var(--brand-500);
  stroke-width: 1.5;
  stroke-dasharray: 3 2;
  cursor: move;
}

/* ---------- EXEC LOG ---------- */
.nx-execlog {
  position: absolute;
  inset-inline-start: 16px; inset-inline-end: 232px;
  bottom: -300px;
  height: 220px;
  background: var(--nx-surface);
  border: 1px solid var(--nx-border);
  border-radius: 12px;
  box-shadow: var(--nx-shadow-lg);
  display: flex; flex-direction: column;
  z-index: 11;
  transition: bottom .35s cubic-bezier(.22,.7,.16,1);
}
.nx-execlog.is-open { bottom: 16px; }
.nx-execlog-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--nx-border);
  font-size: 12px;
}
.nx-execlog-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 11px;
  line-height: 1.7;
}
.nx-log-row {
  display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap;
  padding: 4px 0;
  animation: nxLogIn .25s ease;
}
.nx-log-action {
  border: 1px solid var(--nx-border);
  border-radius: 7px;
  background: var(--nx-surface);
  color: var(--nx-text);
  padding: 2px 7px;
  font: inherit;
  cursor: pointer;
}
.nx-log-action:focus-visible { outline: 2px solid var(--nx-primary); outline-offset: 2px; }
.nx-log-action:disabled { cursor: wait; opacity: .6; }
.nx-log-detail { flex: 0 0 100%; display: grid; gap: 4px; padding-inline-start: 72px; }
.nx-log-detail[hidden] { display: none; }
.nx-log-step { display: grid; grid-template-columns: minmax(120px,1fr) auto; gap: 4px 10px; padding: 5px 8px; border-inline-start: 3px solid var(--nx-border); background: var(--nx-surface-soft); }
.nx-log-step.success { border-inline-start-color: var(--green-500); }
.nx-log-step.error { border-inline-start-color: var(--red-500); }
.nx-log-step small { grid-column: 1 / -1; color: var(--nx-muted); white-space: normal; overflow-wrap: anywhere; }
@keyframes nxLogIn {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.nx-log-time { color: var(--nx-muted); flex-shrink: 0; min-width: 64px; }
.nx-log-icon { flex-shrink: 0; }
.nx-log-text { flex: 1; }
.nx-log-row.success .nx-log-icon { color: var(--green-500); }
.nx-log-row.error   .nx-log-icon { color: var(--red-500); }
.nx-log-row.info    .nx-log-icon { color: var(--brand-500); }

/* ---------- CTX MENU ---------- */
.nx-ctxmenu {
  position: absolute;
  background: var(--nx-surface);
  border: 1px solid var(--nx-border);
  border-radius: 10px;
  box-shadow: var(--nx-shadow-lg);
  padding: 4px;
  min-width: 170px;
  z-index: 100;
  display: none;
  animation: nxCtxIn .15s ease;
}
.nx-ctxmenu.is-open { display: block; }
@keyframes nxCtxIn {
  from { opacity: 0; transform: scale(.95); }
  to   { opacity: 1; transform: scale(1); }
}
.nx-ctxmenu button {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  background: transparent;
  color: var(--nx-text);
  font-family: inherit;
  font-size: 12px;
  text-align: start;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s ease;
}
.nx-ctxmenu button:hover { background: var(--nx-surface-2); }
.nx-ctxmenu button.nx-ctxmenu-danger { color: var(--red-500); }
.nx-ctxmenu button.nx-ctxmenu-danger:hover { background: var(--red-50); }
.nx-shell[data-nx-theme="dark"] .nx-ctxmenu button.nx-ctxmenu-danger:hover { background: rgba(232,120,140,.15); }
.nx-ctxmenu-sep {
  height: 1px;
  background: var(--nx-border);
  margin: 4px 6px;
}

/* ---------- CONFIG PANEL (floating, slides in from inline-end side) ---------- */
.nx-config {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: min(340px, 90vw);
  background: var(--nx-surface);
  border-inline-start: 1px solid var(--nx-border);
  display: flex; flex-direction: column;
  min-height: 0;
  z-index: 8;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.22, .7, .16, 1);
  box-shadow: 8px 0 24px rgba(0, 0, 0, .12);
  pointer-events: none;
}
.nx-config.is-open {
  transform: translateX(0);
  pointer-events: auto;
}
.nx-config-card {
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 0;
}
.nx-config-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--nx-border);
}
.nx-config-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.nx-config-card[data-kind="trigger"]   .nx-config-icon { background: rgba(44,120,115,.18); }
.nx-config-card[data-kind="condition"] .nx-config-icon { background: rgba(240,184,110,.22); }
.nx-config-card[data-kind="action"]    .nx-config-icon { background: rgba(109,191,143,.22); }
.nx-config-meta { flex: 1; min-width: 0; }
.nx-config-kind {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase;
  color: var(--nx-muted);
}
.nx-config-card[data-kind="trigger"]   .nx-config-kind { color: var(--brand-600); }
.nx-config-card[data-kind="condition"] .nx-config-kind { color: var(--accent-600); }
.nx-config-card[data-kind="action"]    .nx-config-kind { color: #2f8a5e; }
.nx-config-title {
  font-weight: 800;
  font-size: 14px;
  margin-top: 2px;
}
.nx-config-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}
.nx-cfield {
  margin-bottom: 14px;
}
.nx-cfield label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--nx-muted);
  margin-bottom: 6px;
}
.nx-cfield input,
.nx-cfield textarea,
.nx-cfield select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--nx-border);
  background: var(--nx-surface-2);
  border-radius: 7px;
  font-family: inherit;
  font-size: 12px;
  color: var(--nx-text);
  transition: all .15s ease;
  resize: vertical;
}
.nx-cfield textarea { min-height: 70px; line-height: 1.7; }
.nx-cfield input:focus,
.nx-cfield textarea:focus,
.nx-cfield select:focus {
  outline: none;
  border-color: var(--brand-500);
  background: var(--nx-surface);
  box-shadow: 0 0 0 3px rgba(44,120,115,.15);
}
.nx-cfield-help {
  margin-top: 4px;
  font-size: 10px;
  color: var(--nx-muted);
  line-height: 1.5;
}
.nx-cfield-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.nx-cswitch {
  display: grid; gap: 8px;
  padding: 10px 12px;
  background: var(--nx-surface-2);
  border-radius: 8px;
  font-size: 12px;
}
.nx-cswitch .ds-switch { margin: 0; }
.nx-financial-trigger { display: grid; gap: 2px; }
.nx-financial-trigger > .ds-field { margin-bottom: 14px; }
.nx-financial-trigger .ds-dropdown { width: 100%; }
.nx-financial-trigger__offset,
.nx-financial-trigger__time { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px; }
@media (max-width: 560px) {
  .nx-financial-trigger__offset,
  .nx-financial-trigger__time { grid-template-columns: 1fr; }
}
.nx-config-foot {
  padding: 12px 14px;
  border-top: 1px solid var(--nx-border);
  display: flex; gap: 8px;
}
.nx-config-foot button {
  flex: 1;
}

/* ---------- MODAL ---------- */
.nx-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
}
.nx-modal.is-open { display: flex; }
.nx-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(10,18,38,.45);
  backdrop-filter: blur(4px);
  animation: nxFadeIn .2s ease;
}
@keyframes nxFadeIn { from { opacity: 0; } to { opacity: 1; } }
.nx-modal-card {
  position: relative;
  background: var(--nx-surface);
  border: 1px solid var(--nx-border);
  border-radius: 16px;
  box-shadow: var(--nx-shadow-lg);
  width: min(800px, 92vw);
  max-height: 85vh;
  display: flex; flex-direction: column;
  animation: nxModalIn .3s cubic-bezier(.34,1.56,.64,1);
  overflow: hidden;
}
@keyframes nxModalIn {
  from { opacity: 0; transform: scale(.92) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.nx-modal-head {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 22px 20px 20px;
  background: linear-gradient(155deg, #9b7bf5 0%, #3d2a70 115%);
  border-radius: 16px 16px 0 0;
}
.nx-modal-copy {
  flex: 1 1 auto;
  min-width: 0;
}
.nx-modal-head::before, .nx-modal-head::after {
  content: ''; position: absolute; border-radius: 50%; background: #fff; filter: blur(24px); pointer-events: none; z-index: -1;
}
.nx-modal-head::before { width: 130px; height: 130px; top: -60px; inset-inline-start: -30px; opacity: .16; }
.nx-modal-head::after { width: 90px; height: 90px; bottom: -45px; inset-inline-end: 60px; opacity: .12; }
.nx-modal-title {
  font-weight: 800;
  font-size: 16px;
  color: #fff;
}
.nx-modal-sub {
  font-size: 12px;
  color: rgba(255,255,255,.82);
  margin-top: 4px;
}
.nx-modal-head .nx-tbtn {
  background: rgba(255,255,255,.2); backdrop-filter: blur(6px); color: #fff;
  border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255,255,255,.3);
  transition: background .15s, transform .2s;
}
.nx-modal-head .nx-modal-close {
  flex: 0 0 36px;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}
.nx-modal-head .nx-modal-close > [data-ds-icon] {
  width: 16px;
  height: 16px;
}
.nx-modal-head .nx-tbtn:hover { background: rgba(255,255,255,.34); transform: rotate(90deg); }
.nx-modal-body {
  padding: 20px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  min-height: 0;
}
.nx-template-empty {
  grid-column: 1 / -1;
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
  color: var(--nx-muted);
}
.nx-template-empty > [data-ds-icon] { width: 34px; height: 34px; color: #7657c8; }
.nx-template-empty strong { color: var(--nx-text); font-size: 14px; }
.nx-template-empty small { max-width: 360px; line-height: 1.8; }

@media (max-width: 620px) {
  .nx-modal-card { width: calc(100vw - 24px); max-height: calc(100vh - 32px); }
  .nx-modal-head { padding: 16px 14px; gap: 12px; }
  .nx-modal-body { grid-template-columns: 1fr; padding: 14px; }
}

.nx-tplcard {
  appearance: none;
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: start;
  background: var(--nx-surface-2);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all .2s ease;
  position: relative;
}
.nx-tplcard:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand-500) 38%, transparent);
  outline-offset: 2px;
  border-color: var(--brand-500);
}
.nx-tplcard:hover {
  border-color: var(--brand-500);
  background: var(--nx-surface);
  transform: translateY(-2px);
  box-shadow: var(--nx-shadow);
}
.nx-tplcard-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.nx-tplcard-name {
  font-weight: 700;
  font-size: 13px;
}
.nx-tplcard-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 700;
}
.nx-tplcard-badge.is-active { background: rgba(109,191,143,.18); color: #2f8a5e; }
.nx-tplcard-badge.is-inactive { background: var(--nx-surface); color: var(--nx-muted); border: 1px solid var(--nx-border); }
.nx-tplcard-desc {
  font-size: 11px;
  color: var(--nx-muted);
  line-height: 1.7;
  margin-bottom: 10px;
  min-height: 38px;
}
.nx-tplcard-stats {
  display: flex; gap: 12px;
  font-size: 11px;
  color: var(--nx-muted);
  padding-top: 8px;
  border-top: 1px dashed var(--nx-border);
}
.nx-tplcard-stats strong { color: var(--nx-text); }
.flow-condition .branch-yes { background: var(--green-500); color: #fff; }
.flow-condition .branch-no  { background: var(--red-500); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]) *,
  html:not([data-motion="full"]) *::before,
  html:not([data-motion="full"]) *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* =============================================================
   SIDEBAR · Modern redesign (2026-06-17)
   ============================================================= */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-inline-start: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0;
  inset-inline-start: 0;
  height: 100vh;
  flex-shrink: 0;
  z-index: 10;
  box-shadow: -1px 0 0 0 rgba(15, 23, 42, .02);
}
[data-theme="dark"] .sidebar {
  background: var(--surface);
  box-shadow: -1px 0 0 0 rgba(255, 255, 255, .03);
}
.main {
  margin-inline-start: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
}
body.sidebar-collapsed .main {
  margin-inline-start: 0;
  width: 100%;
}

/* Desktop navigation shell: a persistent icon rail plus a temporary overlay.
   The main canvas always reserves only the rail, so opening navigation never
   reflows charts, grids or cards. */
@media (min-width:901px) {
  body.sidebar-rail-mode .sidebar {
    width:var(--sidebar-rail-w);
    min-width:var(--sidebar-rail-w);
    overflow:hidden;
    z-index:80;
    will-change:width,box-shadow;
    transition:
      width .34s cubic-bezier(.22,.78,.18,1),
      min-width .34s cubic-bezier(.22,.78,.18,1),
      box-shadow .3s ease,
      border-color .3s ease;
  }
  body.sidebar-rail-mode.sidebar-peek-open .sidebar {
    width:var(--sidebar-w);
    min-width:var(--sidebar-w);
    border-inline-start-color:color-mix(in srgb,var(--brand-500) 18%,var(--border));
    box-shadow:-22px 0 52px -26px rgba(15,23,42,.34),-5px 0 18px -12px rgba(44,120,115,.2);
  }
  body.sidebar-rail-mode .main,
  body.sidebar-rail-mode.sidebar-peek-open .main,
  body.sidebar-rail-mode.sidebar-collapsed .main {
    margin-inline-start:var(--sidebar-rail-w);
    width:calc(100% - var(--sidebar-rail-w));
    transition:none;
  }

  body.sidebar-rail-mode .sidebar .brand {
    height:var(--topbar-h);
    min-height:var(--topbar-h);
    box-sizing:border-box;
    transition:padding .3s cubic-bezier(.22,.78,.18,1),gap .22s ease;
  }
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .brand {
    justify-content:center;
    gap:0;
    padding:16px 10px;
  }
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .brand-logo {
    width:44px;
    height:44px;
  }

  body.sidebar-rail-mode .sidebar .brand-text,
  body.sidebar-rail-mode .sidebar .nav-label,
  body.sidebar-rail-mode .sidebar .nav-caret,
  body.sidebar-rail-mode .sidebar .nav-badge,
  body.sidebar-rail-mode .sidebar .user-mini-text,
  body.sidebar-rail-mode .sidebar .user-chevron {
    opacity:1;
    visibility:visible;
    transform:translateX(0);
    max-width:260px;
    transition:
      opacity .2s ease .1s,
      transform .28s cubic-bezier(.22,.78,.18,1) .08s,
      max-width .3s ease,
      visibility 0s linear 0s;
  }
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .brand-text,
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-label,
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-section span,
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-caret,
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-badge,
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .user-mini-text,
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .user-chevron {
    opacity:0;
    visibility:hidden;
    transform:translateX(10px);
    max-width:0;
    pointer-events:none;
    transition:
      opacity .1s ease,
      transform .16s ease,
      max-width .22s ease,
      visibility 0s linear .16s;
  }
  body.sidebar-rail-mode.sidebar-peek-open .sidebar .nav-group-head[aria-expanded="true"] .nav-caret,
  body.sidebar-rail-mode.sidebar-peek-open .sidebar .nav-pillar.is-open > .nav-pillar-head .nav-caret {
    transform: rotate(180deg) !important;
  }
  body.sidebar-rail-mode.sidebar-peek-open .sidebar .nav-group-head[aria-expanded="false"] .nav-caret {
    transform: rotate(0deg) !important;
  }

  body.sidebar-rail-mode .sidebar .sidebar-org-ctx,
  body.sidebar-rail-mode .sidebar .nav-quick {
    max-height:90px;
    opacity:1;
    overflow:visible;
    transform:translateY(0);
    transition:max-height .28s ease .05s,opacity .2s ease .1s,transform .28s ease .06s,padding .28s ease;
  }
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .sidebar-org-ctx,
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-quick {
    max-height:0;
    opacity:0;
    overflow:hidden;
    transform:translateY(-6px);
    padding-block:0;
    pointer-events:none;
    transition:max-height .2s ease,opacity .12s ease,transform .16s ease,padding .2s ease;
  }

  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav {
    padding-inline:10px;
  }
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-item,
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-pillar-head,
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-group-head {
    justify-content:center;
    gap:0;
    padding-inline:0;
  }
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-pillar-head,
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-group-head {
    /* Keep the closed rail on the exact expanded-row geometry. Otherwise
       opening the clicked pillar shrinks every row and moves its icon away
       from the pointer before the submenu appears. */
    min-height:31px;
    padding-block:7px;
  }
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-toplevel {
    width:52px;
    height:auto;
    min-height:0;
    margin:0 auto 8px;
    margin-inline:auto;
    padding:12px 14px;
    box-sizing:border-box;
    display:grid;
    grid-template-columns:1fr;
    grid-template-rows:1fr;
    place-items:center;
  }
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-toplevel > * {
    grid-area:1 / 1;
  }
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-toplevel > .nav-icon {
    place-self:center;
    animation:none;
    transform:none;
  }
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-item .nav-icon,
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-group-head .nav-icon {
    width:20px;
    height:20px;
    margin:0;
  }
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-pillar-icon {
    width:17px;
    height:17px;
    margin:0;
  }
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-pillar-body,
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-group-body {
    max-height:0 !important;
    padding:0 !important;
    margin:0 !important;
    border:0 !important;
    opacity:0 !important;
    overflow:hidden !important;
  }
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-pillar::before,
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-group::after,
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .nav-toplevel-flash {
    display:none;
  }
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar-footer { padding-inline:10px; }
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .user-mini { justify-content:center;gap:0;padding-inline:0; }
  body.sidebar-rail-mode:not(.sidebar-peek-open) .sidebar .avatar { width:40px;height:40px; }

  body.sidebar-rail-mode .sidebar::after {
    content:'';
    position:absolute;
    inset-block:0;
    inset-inline-end:0;
    width:1px;
    background:linear-gradient(180deg,transparent,color-mix(in srgb,var(--brand-500) 30%,transparent),transparent);
    opacity:0;
    pointer-events:none;
    transition:opacity .3s ease;
  }
  body.sidebar-rail-mode.sidebar-peek-open .sidebar::after { opacity:1; }
}

/* ---------- Brand ---------- */
.brand {
  display: flex; gap: 12px; align-items: center;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand-logo {
  width: 42px; height: 42px;
  background: transparent;
  display: grid; place-items: center;
  position: relative;
  overflow: visible;
  box-shadow: none;
  flex-shrink: 0;
  transition: transform .3s ease;
}
.brand-logo:hover { transform: translateY(-1px) rotate(-2deg); }
.brand-logo img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 0;
  display: block;
  transition: transform .3s ease;
}
.brand-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.2px;
  color: var(--text);
  white-space: nowrap;
}
.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.brand-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green-500);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .15);
  flex-shrink: 0;
  animation: pulseGlow 2.4s ease-in-out infinite;
}

/* ---------- Live KPI Ticker (rotating pulse strip) ---------- */
.nav-ticker {
  position: relative;
  margin: 10px 14px 0;
  padding: 7px 11px 7px 38px;
  border-radius: 11px;
  background:
    linear-gradient(135deg,
      rgba(111, 185, 143, .12) 0%,
      rgba(125, 211, 252, .08) 50%,
      rgba(94, 234, 212, .10) 100%);
  border: 1px solid rgba(111, 185, 143, .18);
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(111, 185, 143, .06);
}
[dir="rtl"] .nav-ticker { padding: 7px 38px 7px 11px; }

.nav-ticker-pulse {
  position: absolute;
  inset-inline-start: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .25);
  animation: tickerPulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

.nav-ticker-stack {
  flex: 1;
  position: relative;
  min-height: 18px;
  overflow: hidden;
}
.nav-ticker-item {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .35s ease, transform .35s cubic-bezier(.2,.7,.3,1.25);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-ticker-item.is-on {
  opacity: 1;
  transform: translateY(0);
}
.nav-ticker-item.is-out {
  opacity: 0;
  transform: translateY(-8px);
}
.nav-ticker-icon {
  font-size: 13px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.08));
}
.nav-ticker-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-ticker-tag {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .5px;
  padding: 2px 6px;
  border-radius: 5px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(239, 68, 68, .35);
  animation: tickerTagBreathe 2.2s ease-in-out infinite;
}

@keyframes tickerPulse {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .25);
    transform: translateY(-50%) scale(1);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(239, 68, 68, .12);
    transform: translateY(-50%) scale(1.15);
  }
}
@keyframes tickerTagBreathe {
  0%, 100% { box-shadow: 0 1px 4px rgba(239, 68, 68, .35); }
  50%      { box-shadow: 0 1px 8px rgba(239, 68, 68, .55); }
}

[data-theme="dark"] .nav-ticker {
  background:
    linear-gradient(135deg,
      rgba(111, 185, 143, .14) 0%,
      rgba(125, 211, 252, .08) 50%,
      rgba(94, 234, 212, .10) 100%);
  border-color: rgba(111, 185, 143, .24);
}

/* ---------- Sidebar org context chip + dropdown [sidebar-org-ctx] ---------- */
.sidebar-org-ctx { padding: 0 12px 8px; }

/* Wrapper — dropdown anchor */
.soc-wrap { position: relative; }

/* Trigger chip */
.soc-chip {
  display: flex; align-items: center; gap: 7px;
  width: 100%; min-width: 0; min-height: 34px; padding: 5px 6px 5px 2px;
  background: transparent;
  border: 0; border-radius: 8px;
  font-family: inherit; font-size: 12.5px; text-align: start;
  cursor: pointer; transition: background .18s, color .18s;
  color: var(--ink);
}
.soc-chip:hover { background: color-mix(in srgb, var(--accent, #635bff) 8%, transparent); color: var(--accent, #635bff); }
.soc-chip.is-open { background: color-mix(in srgb, var(--accent, #635bff) 10%, transparent); color: var(--accent, #635bff); }
.soc-icon { flex-shrink: 0; color: var(--accent, #635bff); }
.soc-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.soc-name.soc-empty-text { font-weight: 400; color: var(--muted); font-style: italic; }
.soc-chevron { flex-shrink: 0; color: var(--muted); transition: transform .2s ease; }
.soc-chip.is-open .soc-chevron { transform: rotate(180deg); }

/* Dropdown menu */
.soc-menu {
  position: absolute;
  inset-block-start: calc(100% + 4px);
  inset-inline-start: 0;
  inset-inline-end: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.08);
  z-index: 300;
  overflow: hidden;
  animation: socMenuIn .18s ease;
}
@keyframes socMenuIn {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)  scale(1); }
}
.soc-menu-header {
  padding: 9px 12px 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  color: var(--muted); text-transform: uppercase;
  border-block-end: 1px solid var(--border);
}
.soc-menu-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 12px;
  background: transparent; border: 0;
  font-family: inherit; font-size: 12.5px; text-align: start;
  cursor: pointer; color: var(--ink);
  transition: background .14s;
}
.soc-menu-item:hover { background: var(--surface-2); }
.soc-menu-item.soc-current { font-weight: 700; color: var(--accent, #635bff); }
.soc-menu-item.soc-current:hover { background: color-mix(in srgb, var(--accent, #635bff) 8%, transparent); }
.soc-menu-check { flex-shrink: 0; color: var(--accent, #635bff); opacity: 0; }
.soc-menu-item.soc-current .soc-menu-check { opacity: 1; }
.soc-menu-item-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Collapsed sidebar: icon only, dropdown still works */
.sidebar.is-collapsed .sidebar-org-ctx { padding: 0 6px 8px; }
.sidebar.is-collapsed .soc-chip { justify-content: center; padding: 7px; }
.sidebar.is-collapsed .soc-name,
.sidebar.is-collapsed .soc-chevron { display: none; }
.sidebar.is-collapsed .soc-menu { inset-inline-start: calc(100% + 4px); inset-inline-end: auto; min-width: 200px; }

/* ---------- Command palette trigger (sidebar) ---------- */
.nav-quick {
  padding: 4px 12px 8px;
  flex-shrink: 0;
}
.palette-trigger {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.palette-trigger:hover,
.palette-trigger:focus-visible {
  background: var(--surface);
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(44, 120, 115, .14);
  outline: none;
}
.palette-trigger-icon {
  width: 14px; height: 14px;
  flex-shrink: 0;
}
.palette-trigger-label {
  flex: 1;
  min-width: 0;
  text-align: start;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.palette-trigger-kbd {
  padding: 1px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 10px;
  font-family: ui-monospace, Menlo, monospace;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}


/* ---------- Nav scroll area ---------- */
.nav {
  padding: 4px 10px 32px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-padding-block: 10px 48px;
  overscroll-behavior: contain;
}
.nav::-webkit-scrollbar { width: 5px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
}
.nav:hover::-webkit-scrollbar-thumb { background: var(--border-strong); }

/* ---------- Section header ---------- */
.nav-section {
  padding: 14px 12px 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-section span {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .8px;
  text-transform: uppercase;
  opacity: .75;
}
.nav-section::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to left, transparent, var(--border) 30%, var(--border));
  opacity: .6;
}
[dir="rtl"] .nav-section::after {
  background: linear-gradient(to right, transparent, var(--border) 30%, var(--border));
}
.nav-section:first-child { padding-top: 4px; }

/* ---------- Nav item ---------- */
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9.5px 11px;
  border-radius: 9px;
  color: var(--text-muted);
  font-weight: 400;
  font-size: 11.5px;
  line-height: 1.4;
  position: relative;
  margin-bottom: 1px;
  transition:
    background .22s cubic-bezier(.4,0,.2,1),
    color .18s ease,
    box-shadow .22s ease,
    transform .18s cubic-bezier(.2,.7,.3,1.25);
  text-decoration: none;
  isolation: isolate;
}
.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
  transform: translateX(-2px);
  box-shadow: 0 2px 8px rgba(15,23,42,.04);
}
[dir="rtl"] .nav-item:hover { transform: translateX(2px); }
.nav-item .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: currentColor;
  opacity: .82;
  transition: opacity .18s ease, transform .25s cubic-bezier(.2,.7,.3,1.25);
}
.nav-item:hover .nav-icon { opacity: 1; transform: scale(1.08); }
.nav-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Active state — soft brand fill + animated indicator bar + sheen */
.nav-item.active {
  background: linear-gradient(135deg, rgba(44, 120, 115, .14), rgba(155, 175, 230, .06));
  color: var(--brand-700);
  font-weight: 500;
  box-shadow:
    inset 0 0 0 1px rgba(44, 120, 115, .2),
    0 4px 14px rgba(44, 120, 115, .12);
  transform: translateX(0);
}
[dir="rtl"] .nav-item.active:hover { transform: translateX(0); }
.nav-item.active .nav-icon { opacity: 1; color: var(--brand-600); }

/* Animated indicator bar — slides up + glows */
.nav-item::before {
  content: '';
  position: absolute;
  inset-inline-start: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: linear-gradient(180deg, var(--brand-500), var(--accent-500));
  border-radius: 0 4px 4px 0;
  transition: height .35s cubic-bezier(.22,.7,.16,1), box-shadow .35s ease;
  z-index: 2;
}
[dir="rtl"] .nav-item::before { border-radius: 4px 0 0 4px; }
.nav-item.active::before {
  height: 24px;
  box-shadow: 0 0 12px rgba(44, 120, 115, .5);
  animation: navIndicatorPulse 2.4s ease-in-out infinite;
}

/* Sheen — subtle moving highlight across active item */
.nav-item.active::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 9px;
  background: linear-gradient(115deg,
    transparent 30%,
    rgba(255,255,255,.18) 50%,
    transparent 70%);
  background-size: 200% 100%;
  background-position: 200% 0;
  animation: navSheen 4.5s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}
.nav-item.active .nav-label,
.nav-item.active .nav-icon,
.nav-item.active .nav-badge { position: relative; z-index: 2; }

@keyframes navIndicatorPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(44, 120, 115, .5); }
  50%      { box-shadow: 0 0 18px rgba(44, 120, 115, .75); }
}
@keyframes navSheen {
  0%   { background-position: 200% 0; }
  60%  { background-position: -100% 0; }
  100% { background-position: -100% 0; }
}

[data-theme="dark"] .nav-item.active {
  background: linear-gradient(135deg, rgba(120, 150, 230, .18), rgba(180, 200, 245, .06));
  color: #b8c8f5;
  box-shadow:
    inset 0 0 0 1px rgba(120, 150, 230, .28),
    0 4px 14px rgba(120, 150, 230, .12);
}
[data-theme="dark"] .nav-item.active .nav-icon { color: #b8c8f5; }
[data-theme="dark"] .nav-item.active::before { box-shadow: 0 0 14px rgba(120, 150, 230, .6); }
[data-theme="dark"] .nav-item.active::after {
  background: linear-gradient(115deg,
    transparent 30%,
    rgba(255,255,255,.08) 50%,
    transparent 70%);
  background-size: 200% 100%;
  background-position: 200% 0;
}

/* =========================================================================
   NAV GROUPS (collapsible parent + nested sub-items)
   ========================================================================= */
.nav-group {
  margin: 2px 0 2px;
  border-radius: 12px;
  position: relative;
  isolation: isolate;
  animation: slideInRight .35s cubic-bezier(.22,.7,.16,1) both;
}
[dir="rtl"] .nav-group { animation-name: slideInLeft; }
.nav-group:nth-of-type(1) { animation-delay: .04s; }
.nav-group:nth-of-type(2) { animation-delay: .09s; }
.nav-group:nth-of-type(3) { animation-delay: .14s; }
.nav-group:nth-of-type(4) { animation-delay: .19s; }
.nav-group:nth-of-type(5) { animation-delay: .24s; }
.nav-group:nth-of-type(6) { animation-delay: .29s; }
.nav-group:nth-of-type(7) { animation-delay: .34s; }
.nav-group:nth-of-type(8) { animation-delay: .39s; }

/* Parent button (the toggle head) */
.nav-group-head {
  box-sizing: border-box;
  min-height: 40px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px 10px 11px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  text-align: start;
  position: relative;
  letter-spacing: .1px;
  transition:
    background .22s cubic-bezier(.4,0,.2,1),
    color .18s ease,
    box-shadow .22s ease;
}
.nav-group-head:hover {
  background: var(--surface-2);
  color: var(--brand-700);
  box-shadow: 0 2px 8px rgba(15,23,42,.04);
}
.nav-group-head:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 1px;
}
.nav-group-head .nav-icon {
  width: 17px; height: 17px;
  flex-shrink: 0;
  opacity: .78;
  color: var(--brand-600);
  transition: transform .25s cubic-bezier(.2,.7,.3,1.25), opacity .18s ease;
}
.nav-group-head:hover .nav-icon { opacity: 1; transform: scale(1.08); }
.nav-group-head .nav-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  font-weight: 500;
}

.nav-group-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 2px 7px;
  letter-spacing: .3px;
  font-feature-settings: "tnum";
  flex-shrink: 0;
  transition: background .22s ease, color .18s ease;
}
.nav-group-head:hover .nav-group-count {
  background: color-mix(in srgb, var(--brand-500) 12%, transparent);
  color: var(--brand-700);
}

/* hide item-count badges from all nav groups (Founder instruction 2026-08-01) */
.nav-group-count { display: none !important; }

.nav-caret {
  width: 14px; height: 14px;
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: .65;
  transition: transform .28s cubic-bezier(.2,.7,.3,1.25), opacity .18s ease;
}
.nav-group-head:hover .nav-caret { opacity: 1; }
/* When expanded, caret points up */
.nav-group-head[aria-expanded="true"] .nav-caret { transform: rotate(180deg); }

/* Nested menu disclosure state must remain distinct from the active-route
   highlight. Closed = neutral downward caret; open = branded surface,
   leading accent and a filled upward caret. */
.nav-group-head .nav-caret {
  box-sizing: content-box;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
  transition: transform .28s cubic-bezier(.2,.7,.3,1.25), opacity .18s ease,
    color .18s ease, background .18s ease, box-shadow .18s ease;
}
.nav-group-head[aria-expanded="true"] {
  background: color-mix(in srgb, var(--brand-500) 11%, var(--surface));
  color: var(--brand-700);
  box-shadow: inset 3px 0 0 var(--brand-500), inset 0 0 0 1px color-mix(in srgb, var(--brand-500) 28%, transparent);
  font-weight: 700;
}
.nav-group-head[aria-expanded="true"] .nav-caret {
  color: var(--surface);
  background: var(--brand-600);
  opacity: 1;
  box-shadow: 0 2px 7px color-mix(in srgb, var(--brand-600) 28%, transparent);
}
.nav-group-head[aria-expanded="true"] .nav-icon { color: var(--brand-700); opacity: 1; }

/* Group container hint when any child is active */
.nav-group.has-active > .nav-group-head {
  background: linear-gradient(135deg, rgba(44, 120, 115, .08), rgba(155, 175, 230, .03));
  color: var(--brand-700);
  box-shadow: inset 0 0 0 1px rgba(44, 120, 115, .12);
}
.nav-group.has-active > .nav-group-head .nav-icon { color: var(--brand-600); opacity: 1; }
.nav-group.has-active > .nav-group-head .nav-group-count {
  background: color-mix(in srgb, var(--brand-500) 14%, transparent);
  color: var(--brand-700);
}

/* Body (collapsible) — max-height transition. grid-template-rows:0fr only
   collapses the first grid track, so direct-child items would stay visible.
   max-height + overflow:hidden actually clips every child reliably. */
.nav-group-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    max-height .34s cubic-bezier(.22,.7,.16,1),
    opacity   .22s ease;
}
.nav-group[data-open="true"] > .nav-group-body {
  /* 1200px handles up to ~37 items (largest group: growth=20 items × 32px ≈ 640px). */
  max-height: 1200px;
  opacity: 1;
}

/* Sub-item (child link inside group) */
.nav-subitem {
  box-sizing: border-box;
  width: calc(100% - 14px);
  min-height: 32px;
  position: relative;
  margin-inline-start: 14px;
  padding: 7.5px 10px 7.5px 10px;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  border-radius: 8px;
}
.nav-subitem .nav-label {
  font-size: 11px;
  letter-spacing: .1px;
}

/* Vertical guide line for sub-items (only when group is open) */
.nav-group[data-open="true"] > .nav-group-body::before {
  content: '';
  position: absolute;
  inset-block: 0;
  inset-inline-start: 22px;
  width: 1px;
  background: linear-gradient(180deg,
    transparent,
    color-mix(in srgb, var(--brand-500) 22%, transparent) 12%,
    color-mix(in srgb, var(--brand-500) 22%, transparent) 88%,
    transparent);
  pointer-events: none;
}
/* Wait — the body has overflow:hidden + grid-template-rows. Use the group itself instead */
.nav-group > .nav-group-body::before { display: none; } /* disable */

.nav-group {
  /* host the guide line */
}
.nav-group[data-open="true"]::after {
  content: '';
  position: absolute;
  inset-inline-start: 22px;
  top: 42px;
  bottom: 4px;
  width: 1px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--brand-500) 18%, transparent),
    color-mix(in srgb, var(--brand-500) 18%, transparent) 90%,
    transparent);
  pointer-events: none;
  z-index: 0;
}

/* Sub-item dot (decorative bullet sitting on the guide line) */
.nav-sub-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  position: relative;
  margin-inline-end: 6px;
  margin-inline-start: -4px;
  transition: background .22s ease, transform .22s ease, box-shadow .22s ease;
}
.nav-subitem:hover .nav-sub-dot {
  background: var(--brand-500);
  transform: scale(1.4);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 18%, transparent);
}
.nav-subitem.active .nav-sub-dot {
  background: var(--brand-600);
  transform: scale(1.5);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-500) 22%, transparent);
}
.nav-sub-dot-report {
  background: var(--accent-500, #c9a86b);
}
.nav-subitem:hover .nav-sub-dot-report,
.nav-subitem.active .nav-sub-dot-report {
  background: var(--accent-600, #b08540);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-500, #c9a86b) 22%, transparent);
}

/* nav-subitem-live: leaves the mock demo panel for a real backend-connected
   tool (opens in a new tab) — TRFC-0001 P4c migration admin. Visually
   flagged so operators don't mistake it for another mock page.
 *
 * [erp-menu-dual-views] Founder feedback (live, 2026-07-17): the full-word
 * "واقعی" tag read as noisy repeated across many nav rows. Replaced with a
 * compact single-letter badge — "C" (Canonical/real backend) green, "D"
 * (Demo/mock data) amber — applied both to these 4 static items and
 * dynamically (nav-live-badges.js) to any nav item whose route is a known
 * real-ERP route (window.__erpLiveRoutes) or a known mock-only dual-view
 * route (window.__erpMockOnlyRoutes). ".is-new" adds an "N" suffix + a
 * brand-colored ring for items added to the menu this round (platform-users/
 * profile-settings, TRFC-0017) so they stand out from long-standing ones. */
.nav-live-badge, .nav-demo-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 6px;
  margin-inline-start: auto;
  white-space: nowrap;
}
.nav-live-badge {
  color: var(--ok-600, #1f8a4c);
  background: color-mix(in srgb, var(--ok-500, #2e8b57) 14%, transparent);
}
.nav-demo-badge {
  color: var(--warn-600, #a3690f);
  background: color-mix(in srgb, var(--warn-500, #d99416) 16%, transparent);
}
.nav-subitem-live:hover .nav-live-badge,
.nav-item:hover .nav-live-badge {
  background: color-mix(in srgb, var(--ok-500, #2e8b57) 24%, transparent);
}
.nav-item:hover .nav-demo-badge {
  background: color-mix(in srgb, var(--warn-500, #d99416) 26%, transparent);
}
.nav-live-badge.is-new, .nav-demo-badge.is-new {
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--brand-500, #2c7873) 55%, transparent);
}
/* [erp-menu-dual-views] Founder: a "C" (canonical) row is, by definition,
   also an ERP row (both badges read window.__erpLiveRoutes) — merge into
   one purple "CE" badge instead of stacking the green "C" pill + the
   separate purple "ERP" pill (nav-live-badges.js decides when to apply
   .is-erp; see that file + erp-menu-mode.js's applyBadges()). */
.nav-live-badge.is-erp {
  color: var(--brand-700, #4c3f9e);
  background: color-mix(in srgb, var(--brand-500, #2c7873) 18%, transparent);
}

/* Demo presentation mode: technical source/ERP markers are implementation
   diagnostics, not part of the original customer-facing sidebar. */
.nav-live-badge,
.nav-demo-badge,
.nav-erp-badge {
  display: none !important;
}
.nav-item:hover .nav-live-badge.is-erp {
  background: color-mix(in srgb, var(--brand-500, #2c7873) 30%, transparent);
}

/* Sub-item hover/active styles override the bigger nav-item.active gradient */
.nav-subitem:hover {
  background: color-mix(in srgb, var(--brand-500) 6%, transparent);
  color: var(--text);
  transform: none;
  box-shadow: none;
}
.nav-subitem.active {
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--brand-500) 14%, transparent),
    color-mix(in srgb, var(--brand-500) 4%, transparent));
  color: var(--brand-700);
  font-weight: 500;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-500) 18%, transparent);
}
.nav-subitem.active::before,
.nav-subitem.active::after { display: none; }

/* sub-featured tweak */
.nav-subitem.nav-subfeatured .nav-sub-dot {
  background: var(--brand-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 14%, transparent);
}

/* Badge inside sub-item: keep compact */
.nav-subitem .nav-badge {
  font-size: 9.5px;
  padding: 1px 6px;
  height: 16px;
}

/* Sub-items that carry a badge: use a 2-row layout so the Persian label
   has the FULL width for word-boundary wrapping (never breaks mid-word),
   and the badge sits neatly on line 2 under the label — not competing for
   space. This preserves both the label AND the meaningful badge label
   (e.g. "مزیت دیاکو"), instead of shortening either. */
.nav-subitem {
  flex-wrap: wrap;
  row-gap: 3px;
}
.nav-subitem .nav-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: normal;   /* wrap only at word boundaries — no mid-word break */
  word-break: normal;
}
.nav-subitem .nav-badge {
  order: 3;
  flex-basis: 100%;
  margin-inline-start: 21px;   /* align with label baseline (past the 10px dot + 11px gap) */
  align-self: flex-start;
  width: fit-content;
  margin-inline-end: 0;
}

/* Dark theme overrides */
[data-theme="dark"] .nav-group-head {
  color: #e4e8f5;
}
[data-theme="dark"] .nav-group-head:hover {
  color: #c8d4f5;
  background: rgba(255,255,255,.04);
}
[data-theme="dark"] .nav-group.has-active > .nav-group-head {
  background: linear-gradient(135deg, rgba(120, 150, 230, .14), rgba(180, 200, 245, .04));
  color: #c8d4f5;
  box-shadow: inset 0 0 0 1px rgba(120, 150, 230, .22);
}
[data-theme="dark"] .nav-group-count {
  background: rgba(255,255,255,.06);
  color: var(--text-muted);
}
[data-theme="dark"] .nav-group.has-active > .nav-group-count {
  background: rgba(120, 150, 230, .18);
  color: #c8d4f5;
}
[data-theme="dark"] .nav-subitem.active {
  background: linear-gradient(90deg, rgba(120, 150, 230, .2), rgba(120, 150, 230, .04));
  color: #c8d4f5;
  box-shadow: inset 0 0 0 1px rgba(120, 150, 230, .26);
}
[data-theme="dark"] .nav-group[data-open="true"]::after {
  background: linear-gradient(180deg,
    rgba(120, 150, 230, .2),
    rgba(120, 150, 230, .2) 90%,
    transparent);
}

/* Sidebar collapsed mode: hide labels + caret, only icons */
.sidebar-collapsed .nav-group-head .nav-label,
.sidebar-collapsed .nav-group-head .nav-group-count,
.sidebar-collapsed .nav-group-head .nav-caret { display: none; }
.sidebar-collapsed .nav-group-body { display: none !important; }
.sidebar-collapsed .nav-subitem { display: none !important; }

/* Deep-link section flash — pulses target card briefly when arriving via #route/section */
@keyframes sectionFlash {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-500) 55%, transparent), 0 0 0 0 color-mix(in srgb, var(--brand-500) 30%, transparent); }
  35%  { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-500) 38%, transparent), 0 0 24px 6px color-mix(in srgb, var(--brand-500) 22%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-500) 0%, transparent), 0 0 0 0 color-mix(in srgb, var(--brand-500) 0%, transparent); }
}
.section-flash {
  animation: sectionFlash 1.8s cubic-bezier(.22,.7,.16,1);
  border-radius: 16px;
  scroll-margin-top: 90px;
}

/* ---------- Nav dot legend (color key for sub-item dots) ---------- */
.nav-dot-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 8px 14px 10px;
  border-top: 1px dashed var(--border);
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.4;
  flex-shrink: 0;
}
.ndl-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.ndl-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ndl-dot-idle {
  background: var(--border);
}
.ndl-dot-hover {
  background: var(--brand-500);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-500) 18%, transparent);
}
.ndl-dot-active {
  background: var(--brand-600);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 22%, transparent);
}
.ndl-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 6px;
  line-height: 1.4;
}
.ndl-badge-soon {
  background: color-mix(in srgb, var(--purple-500, #a020f0) 14%, transparent);
  color: var(--purple-600, #7c17bd);
}
.sidebar-collapsed .nav-dot-legend { display: none; }
[data-theme="dark"] .nav-dot-legend { color: rgba(226, 232, 240, .55); }

/* ---------- Sidebar footer ---------- */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  flex-shrink: 0;
}
.user-mini {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 7px 9px;
  border-radius: 10px;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  text-align: start;
  transition: background .18s ease, box-shadow .18s ease;
}
.user-mini:hover {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border);
}
.avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--purple-500), var(--brand-500));
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(44, 120, 115, .25);
}
#user-mini .avatar.has-self-avatar {
  background: none;
  box-shadow: none;
}
#user-mini .avatar [data-ds-icon],
#user-mini .avatar [data-ds-icon] > svg {
  color: #fff !important;
  fill: currentColor;
  stroke: currentColor;
}
#user-mini .avatar [data-ds-icon] {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  line-height: 0;
}
#user-mini .avatar [data-ds-icon] > svg {
  display: block;
  width: 18px;
  height: 18px;
  margin: 0;
  vertical-align: 0;
}
.user-mini-text { flex: 1; min-width: 0; }
.user-name {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.user-chevron {
  width: 14px; height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform .2s ease;
}
[dir="rtl"] .user-chevron { transform: rotate(180deg); }
.user-mini:hover .user-chevron { color: var(--text); }

/* ---------- Main ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
  padding: 0 28px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
  animation: slideDown .35s cubic-bezier(.22,.7,.16,1) both;
}
.icon-btn {
  box-sizing: border-box;
  width: 40px; height: 40px;
  padding: 0; margin: 0;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  display: grid; place-items: center; place-content: center;
  font-size: 0; line-height: 0;
  appearance: none; -webkit-appearance: none;
  position: relative;
  overflow: visible;
  transition: all .2s cubic-bezier(.22,.7,.16,1);
}
.icon-btn .ds-ico,
.icon-btn .ds-grid__ico,
.icon-btn svg,
.icon-btn [data-ds-icon] {
  display: block;
  width: 20px;
  height: 20px;
  margin: 0;
  line-height: 0;
  vertical-align: 0;
}
.icon-btn:hover {
  background: var(--brand-50); border-color: var(--brand-300);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.icon-btn:active { transform: translateY(0); }
[data-theme="dark"] .icon-btn:hover { background: var(--surface); }
.notif-dot {
  --notif-badge-size: 26px;
  position: absolute;
  z-index: 2;
  inset: 50% auto auto 50%;
  min-width: var(--notif-badge-size);
  height: var(--notif-badge-size);
  padding: 0 4px;
  border-radius: 999px;
  background: var(--red-500);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  display: grid;
  place-items: center;
  border: 0;
  box-shadow: 0 2px 8px -2px rgba(220, 38, 38, .45);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

#notif-toggle .notif-bell { display:grid; place-items:center; width:20px; height:20px; }
#notif-toggle .notif-bell[hidden] { display:none !important; }

/* Live leads mode hides legacy demo analytics; author layout rules must not
   override the semantic hidden state. */
.leads-hub-page--operational [hidden] { display: none !important; }
#notif-toggle.has-unread { color:transparent; }

.notif-dot::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid rgba(239, 68, 68, .52);
  animation: notifBadgeRing 1.8s ease-out infinite;
  pointer-events: none;
}

@keyframes notifBadgeBlink {
  0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: .72; transform: translate(-50%, -50%) scale(.94); }
}

@keyframes notifBadgeRing {
  0% { opacity: .88; transform: scale(1); }
  75% { opacity: 0; transform: scale(1.75); }
  100% { opacity: 0; transform: scale(1.75); }
}

.search {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  position: relative;
}
.search input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 12px;
  padding: 0 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
}
.search input:focus { background: var(--surface); border-color: var(--brand-300); }
.search-key {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: var(--text-muted);
  background: var(--surface);
  padding: 3px 8px; border-radius: 6px;
  border: 1px solid var(--border);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 0 0 auto;
}
.topbar-actions > * { flex: 0 1 auto; min-width: 0; }
.topbar-actions > .date-pill,
.topbar-actions > .chip,
.topbar-actions > .topbar-org-ctx .soc-chip {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  height: 40px;
  padding-block: 0;
  border-radius: 12px;
  vertical-align: middle;
}
.topbar-actions > .date-pill,
.topbar-actions > .chip { line-height: 1; }
.topbar-actions > .topbar-org-ctx .soc-chip { line-height: 1; }
@media (min-width: 901px) {
  /* Keep the utility cluster anchored to the physical left edge. The search
     owns every remaining pixel between the sidebar toggle and today's date. */
  .topbar > .search {
    flex: 1 1 auto;
    min-width: 160px;
    max-width: none;
  }
  .topbar > .topbar-actions {
    flex: 0 0 auto;
    margin-inline-start: auto;
    margin-left: 0;
  }
}
.topbar-org-ctx {
  flex:0 1 auto;
  min-width:0;
  max-width:max-content;
  padding:0;
}
.topbar-org-ctx .soc-chip {
  width:max-content;
  max-width:100%;
  min-height:40px;
  padding:6px 10px;
  background:var(--surface-2);
  border:1px solid var(--border);
  border-radius:12px;
}
.topbar-org-ctx .soc-menu {
  inset-block-start:calc(100% + 8px);
  inset-inline-start:auto;
  inset-inline-end:0;
  width:220px;
}
.topbar-palette-trigger {
  width:40px;
  min-width:40px;
  min-height:40px;
  padding:0;
  justify-content:center;
  flex:0 0 auto;
}
@media (max-width:1180px) and (min-width:901px) {
  .topbar-org-ctx { min-width:40px; flex-basis:40px; }
  .topbar-org-ctx .soc-chip { justify-content:center; padding-inline:8px; }
  .topbar-org-ctx .soc-name,
  .topbar-org-ctx .soc-chevron { display:none; }
}
.lang-pill {
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

/* ---------- Content ---------- */
.content {
  padding: 30px 28px;
  display: flex; flex-direction: column; gap: var(--space-macro);
  flex: 1;
}
.footer {
  padding: 18px 28px;
  display: flex; justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
  background: var(--surface);
}
.footer-product-version {
  appearance: none;
  font-family: inherit;
  cursor: pointer;
  direction: ltr;
  flex: 0 0 auto;
  padding: 5px 10px;
  border: 1px solid color-mix(in srgb, var(--border) 82%, var(--accent, #6256d9));
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface) 92%, var(--accent-soft, #eeebff));
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: .025em;
  white-space: nowrap;
}
.footer-product-version:hover { color:var(--accent,#6256d9); border-color:color-mix(in srgb,var(--accent,#6256d9) 48%,var(--border)); transform:translateY(-1px); }
.footer-product-version:focus-visible { outline:2px solid var(--accent,#6256d9); outline-offset:3px; }
.pv-history { display:grid; gap:10px; direction:rtl; }
.pv-history__intro { margin:0 0 4px; color:var(--text-muted); font-size:12.5px; line-height:1.8; }
.pv-history__item { display:grid; grid-template-columns:auto minmax(0,1fr); gap:12px; align-items:start; padding:13px 14px; border:1px solid color-mix(in srgb,var(--border) 82%,var(--pastel-lilac,#ddd6fe)); border-radius:14px; background:color-mix(in srgb,var(--surface) 94%,var(--pastel-sky,#bae6fd)); }
.pv-history__item.is-current { border-color:color-mix(in srgb,var(--brand-500,#2c7873) 46%,var(--border)); background:color-mix(in srgb,var(--pastel-mint,#a7f3d0) 23%,var(--surface)); }
.pv-history__version { direction:ltr; display:inline-flex; align-items:center; justify-content:center; min-width:72px; padding:4px 8px; border-radius:999px; background:var(--surface); color:var(--brand-700,#0f766e); font-size:11px; font-weight:800; box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--brand-500,#2c7873) 20%,var(--border)); }
.pv-history__copy>strong { display:block; margin-bottom:9px; color:var(--text); font-size:13.5px; }
.pv-history__changes { display:grid; gap:7px; }
.pv-change { display:grid; grid-template-columns:76px minmax(0,1fr); gap:9px; align-items:start; padding:8px 9px; border:1px solid color-mix(in srgb,var(--border) 76%,transparent); border-radius:10px; background:color-mix(in srgb,var(--surface) 88%,transparent); }
.pv-change__type { display:inline-flex; align-items:center; justify-content:center; min-height:24px; padding:3px 7px; border-radius:999px; font-size:9.5px; font-weight:800; white-space:nowrap; }
.pv-change__type.is-feature { background:var(--pastel-mint,#dcfce7); color:#166534; }
.pv-change__type.is-improvement { background:var(--pastel-sky,#e0f2fe); color:#075985; }
.pv-change__type.is-fix { background:var(--pastel-rose,#ffe4e6); color:#9f1239; }
.pv-change__area { display:block; margin-bottom:2px; color:var(--text); font-size:11px; font-weight:800; }
.pv-change p { margin:0; color:var(--text-muted); font-size:11px; line-height:1.8; }
@media (max-width:520px) { .pv-history__item { grid-template-columns:1fr; } .pv-history__version { justify-self:start; } }
@media (max-width:420px) { .pv-change { grid-template-columns:1fr; } .pv-change__type { justify-self:start; } }
@media (max-width: 640px) {
  .footer { padding: 14px 16px; gap: 10px; }
  .footer-product-version { padding: 4px 8px; font-size: 10px; }
}

/* ---------- Embed mode (chrome-less iframe embedding) ----------
   [crm-modular-system] ARFC-0043 §6.4.8 amendment (2026-08-01) — set on
   <html> by embed-mode.js (window.DiacoEmbedMode.activate()) once the CRM
   Embed Kit's SSO exchange succeeds. Hides every piece of panel chrome that
   makes sense standalone but not inside a host app's own <iframe>: the full
   nav sidebar, the topbar (search/notifications/branding/theme toggle), the
   footer, and the floating Diaco Pilot widget (#rp-root, diaco-pilot.js) — a
   generic class, not a CRM-specific one; any future embeddable module reuses
   it unchanged. The Diaco Financial ASP embed keeps DiaMate (#rp-root): it
   is the customer's only entry point and DiaMate scopes itself by the
   external menu permissions there. */
html.rlx-embed-mode .sidebar,
html.rlx-embed-mode .topbar,
html.rlx-embed-mode .footer,
html.rlx-embed-mode:not([data-asp-embed="true"]) #rp-root {
  display: none !important;
}
html.rlx-embed-mode .main {
  margin-inline-start: 0;
  width: 100%;
  background: var(--bg);
}
html.rlx-embed-mode .content {
  padding: 16px;
  background: var(--bg);
}

/* The ASP iframe owns the document scroller. Keep its chrome aligned with the
   shared green brand and visually attach the global-search tab to that gutter. */
html[data-asp-embed="true"] {
  --asp-scrollbar-track: rgb(15,118,110);
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, white 50%, transparent) var(--asp-scrollbar-track);
}
/* `scrollbar-color` is inherited. Stop the ASP document scrollbar theme at
   the viewport so modal, drawer and popover scrollers retain their original
   browser/component appearance. Component-specific scrollbar rules below can
   still opt in to their own appearance. */
html[data-asp-embed="true"] body { scrollbar-color: auto; }
html[data-asp-embed="true"]::-webkit-scrollbar { width: 10px; height: 10px; }
html[data-asp-embed="true"]::-webkit-scrollbar-track { background: var(--asp-scrollbar-track); }
html[data-asp-embed="true"]::-webkit-scrollbar-button { width: 0; height: 0; background: transparent; }
html[data-asp-embed="true"]::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, white 50%, transparent);
  background-clip: padding-box;
}
html[data-asp-embed="true"]::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, white 68%, transparent);
  background-clip: padding-box;
}
html[data-asp-embed="true"] .crm-global-finder__tab { left: -6px; }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 16px;
}
.page-title { font-size: 26px; font-weight: 700; margin: 0 0 4px; }
.page-sub { color: var(--text-muted); margin: 0; }
.crm-taxonomy-head { align-items: center; margin: 0; }
.crm-taxonomy-head > div { min-width: 0; }
.crm-taxonomy-head .page-title { margin: 0 0 6px; }
.crm-taxonomy-head .page-sub { max-width: 760px; line-height: 1.8; }
.crm-taxonomy-head [data-tax-create] { flex: 0 0 auto; }
.crm-taxonomy-page { display: grid; gap: 16px; }
.crm-taxonomy-page > [data-crm-taxonomy-hero] { margin: 0; }
.crm-taxonomy-page > [data-crm-taxonomy-hero] .ds-page-hero__actions {
  justify-content: flex-start;
  margin-top: 16px;
}
.crm-taxonomy-page__grid-card { margin: 0; overflow: hidden; }
@media (max-width: 640px) {
  .crm-taxonomy-head { align-items: stretch; flex-direction: column; }
  .crm-taxonomy-head [data-tax-create] { align-self: flex-start; }
}

/* ---------- Buttons ---------- */
.btn {
  height: 40px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 600; font-size: 13px;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all .25s cubic-bezier(.22,.7,.16,1);
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.3), transparent);
  transition: left .5s;
}
.btn:hover::before { left: 100%; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff; border-color: transparent;
  box-shadow: 0 6px 16px rgba(44, 120, 115, .35);
}
.btn.primary:hover { box-shadow: 0 10px 24px rgba(44, 120, 115, .45); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red-500); border-color: var(--red-500); }

.chip {
  padding: 5px 11px; border-radius: 999px;
  background: var(--pastel-sky); color: var(--brand-700);
  font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
  transition: transform .2s ease;
}
.chip:hover { transform: scale(1.04); }
.chip.green { background: var(--pastel-mint);  color: #2f8a5e; }
.chip.red   { background: var(--pastel-rose);  color: #b14458; }
.chip.amber { background: var(--pastel-peach); color: #c46920; }
.chip.purple{ background: var(--pastel-lilac); color: #6d50d4; }
/* Social chips · brand-tinted icons for Instagram/Telegram/WhatsApp */
.chip.social-ig { background: linear-gradient(135deg, #fce4ec, #fff3e0); color: #c13584; }
.chip.social-tg { background: #e3f2fd; color: #0088cc; }
.chip.social-wa { background: #e8f5e9; color: #25d366; }
.chip .social-ico { width: 13px; height: 13px; flex-shrink: 0; display: inline-block; vertical-align: -2px; }
.chip.lemon { background: var(--pastel-lemon); color: #a37919; }
.topbar-actions > .diaco-financial-source-status { cursor:default; }
.topbar-actions > .diaco-financial-source-status.is-checking,
.topbar-actions > .diaco-financial-source-status.is-local { color:#a86000;background:var(--pastel-amber,#fff4d6);border-color:color-mix(in srgb,#d97706 22%,transparent); }
.topbar-actions > .diaco-financial-source-status.is-main { color:#08794c;background:var(--pastel-mint,#e8f8ef);border-color:color-mix(in srgb,#16a34a 20%,transparent); }
.topbar-actions > .diaco-financial-source-status.is-main :is(.ds-ico,svg),
.topbar-actions > .diaco-financial-source-status.is-main [data-ds-icon-tone] { color:#08794c!important; }
.topbar-actions > .diaco-financial-source-status.is-unavailable { color:#b91c1c;background:var(--pastel-rose,#fff0f2);border-color:color-mix(in srgb,#ef4444 20%,transparent); }
.topbar-actions > .diaco-financial-source-status:is(.is-checking,.is-local) :is([data-ds-icon],.ds-ico,svg,path){color:#a86000!important;fill:currentColor!important}
.topbar-actions > .diaco-financial-source-status.is-main :is([data-ds-icon],.ds-ico,svg,path){color:#08794c!important;fill:currentColor!important}
.topbar-actions > .diaco-financial-source-status.is-unavailable :is([data-ds-icon],.ds-ico,svg,path){color:#b91c1c!important;fill:currentColor!important}
.topbar-actions > :has(> .diaco-financial-source-status) {
  box-sizing: border-box;
  display: inline-flex;
  align-items: stretch;
  min-height: 40px;
  height: 40px;
}
.topbar-actions > :has(> .diaco-financial-source-status) > .diaco-financial-source-status {
  height: 40px;
  min-height: 40px;
  padding-block: 0;
  border-radius: 12px !important;
}
.diaco-financial-source-status { flex:0 0 40px; }

[data-theme="dark"] .chip { background: rgba(30,109,255,.15); color: #8eb6ff; }
[data-theme="dark"] .chip.green { background: rgba(16,185,129,.15); color: #34d399; }
[data-theme="dark"] .chip.red   { background: rgba(239,68,68,.15);  color: #f87171; }
[data-theme="dark"] .chip.amber { background: rgba(245,158,11,.15); color: #fbbf24; }

.chip-btn {
  padding: 6px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted); font-weight: 500;
}
.chip-btn.active {
  background: var(--brand-500); color: #fff; border-color: transparent;
}

/* ---------- Cards & Grids ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-xs);
  transition: transform .25s cubic-bezier(.22,.7,.16,1), box-shadow .25s ease, border-color .2s ease;
  position: relative;
}
.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: var(--space-meso); gap: 12px; flex-wrap: wrap;
}
.card-title { font-weight: 700; font-size: 15px; letter-spacing: -.015em; }
.card-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }

/* [accounting-implementation-p17jan] — pastel section-header band for
   .card-head, opt-in via an extra class (does not change .card-head's
   default look anywhere else in the app). Set --pastel-tint per usage,
   e.g. style="--pastel-tint:var(--pastel-mint)", rotating through the
   existing --pastel-* palette (main.css §5) instead of introducing new
   colors, per the Founder's "پاستیلی نه طوسی" direction for boxed
   section headers on the #accounting page. */
.card-head--pastel {
  --pastel-tint: var(--pastel-sky);
  margin: -22px -22px var(--space-meso);
  padding: 14px 22px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: color-mix(in srgb, var(--pastel-tint) 38%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--pastel-tint) 55%, transparent);
}

/* CRM workbench — PL-03 operational dashboard consuming DS hero/cards/charts. */
.crm-workbench-page { display:grid; gap:var(--space-meso); }
.crm-global-finder { position:fixed; inset:0; z-index:1200; pointer-events:none; }
.crm-global-finder__tab { --crm-finder-tab-surface:rgb(15,118,110); position:fixed; left:0; top:82px; display:flex; align-items:center; justify-content:center; width:29px; min-height:0; padding:10px 4px; border:1px solid rgba(255,255,255,.3); border-left:0; border-radius:0 12px 12px 0; color:#fff; background:var(--crm-finder-tab-surface); box-shadow:0 8px 20px rgba(15,118,110,.24); font:700 12px/1.2 inherit; cursor:pointer; opacity:1; pointer-events:auto; transition:transform 320ms cubic-bezier(.22,1,.36,1),background-color 260ms ease,box-shadow 180ms ease,opacity 180ms ease; writing-mode:vertical-rl; }
.crm-global-finder__tab::before,.crm-global-finder__tab::after { content:""; position:absolute; left:0; z-index:-1; width:18px; height:18px; pointer-events:none; }
.crm-global-finder__tab::before { top:-18px; border-radius:0 0 0 18px; box-shadow:-9px 9px 0 9px var(--crm-finder-tab-surface); }
.crm-global-finder__tab::after { bottom:-18px; border-radius:18px 0 0 0; box-shadow:-9px -9px 0 9px var(--crm-finder-tab-surface); }
.crm-global-finder__tab:hover { box-shadow:0 12px 34px rgba(15,118,110,.42); opacity:1; transform:none; }
.crm-global-finder__tab:focus-visible,.crm-global-finder__close:focus-visible { outline:3px solid color-mix(in srgb,var(--brand) 32%,white); outline-offset:2px; }
.crm-global-finder__backdrop { position:absolute; inset:0; background:rgba(15,23,42,.28); opacity:0; pointer-events:none; transition:opacity 220ms ease; }
.crm-global-finder__panel { --crm-finder-content-width:min(1460px,calc(100% - 160px)); position:absolute; top:82px; left:0; right:calc(var(--sidebar-rail-w,72px) + 24px); z-index:1; display:block; height:75px; min-height:75px; max-height:none; box-sizing:border-box; padding:0; overflow:visible; visibility:hidden; pointer-events:none; transform:translateX(calc(-100% - 1px)); transition:transform 520ms cubic-bezier(.64,0,.78,0),visibility 0s linear 520ms; }
.crm-global-finder__panel.ds-governed-dialog { overflow:visible; border:0!important; border-radius:0!important; background:transparent!important; box-shadow:none!important; }
.crm-global-finder__panel::before { content:""; position:absolute; inset:0; z-index:0; border:1px solid rgba(255,255,255,.96); border-left:0; border-radius:0 22px 22px 0; background:rgba(15,118,110,.8); box-shadow:0 7px 22px -16px rgba(15,23,42,.42); transition:background-color 520ms cubic-bezier(.64,0,.78,0),box-shadow 440ms ease; }
.crm-global-finder-open { overflow:hidden; }
.crm-global-finder.is-open { pointer-events:auto; }
.crm-global-finder.is-open .crm-global-finder__backdrop { opacity:1; pointer-events:auto; }
.crm-global-finder.is-open .crm-global-finder__panel { visibility:visible; pointer-events:auto; transform:translateX(0); transition:transform 520ms cubic-bezier(.22,1,.36,1),visibility 0s; }
.crm-global-finder.is-closing .crm-global-finder__panel { visibility:visible; pointer-events:none; transform:translateX(calc(-100% + 29px)); transition:transform 520ms cubic-bezier(.64,0,.78,0),visibility 0s; }
.crm-global-finder.is-open .crm-global-finder__panel::before { background:var(--surface); transition:background-color 520ms cubic-bezier(.22,1,.36,1),box-shadow 440ms ease; }
.crm-global-finder.is-closing .crm-global-finder__panel::before { background:rgba(15,118,110,.8); transition:background-color 520ms cubic-bezier(.64,0,.78,0),box-shadow 440ms ease; }
.crm-global-finder.is-open .crm-global-finder__tab { pointer-events:none; transform:translateX(-100%); background:var(--surface); }
.crm-global-finder.is-closing .crm-global-finder__tab { visibility:hidden; pointer-events:none; transform:none; }
.crm-global-finder.is-closed-snap .crm-global-finder__panel { transition:none; }
.crm-global-finder.is-closed-snap .crm-global-finder__tab { transition:none; }
.crm-global-finder__head { position:absolute; inset:0; z-index:2; display:block; margin:0; }
.crm-global-finder__head::before,.crm-global-finder__head::after { content:""; position:absolute; left:0; z-index:-1; width:22px; height:22px; pointer-events:none; }
.crm-global-finder__head::before { top:-22px; border-radius:0 0 0 22px; box-shadow:-11px 11px 0 11px var(--surface); }
.crm-global-finder__head::after { bottom:-22px; border-radius:22px 0 0 0; box-shadow:-11px -11px 0 11px var(--surface); }
.crm-global-finder__label { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.crm-global-finder__label strong,.crm-global-finder__label small { display:block; }
.crm-global-finder__label small { margin-block-start:2px; color:var(--text-muted); font-size:11px; }
.crm-global-finder__close { position:absolute; left:18px; top:50%; display:grid; place-items:center; width:40px; height:40px; padding:0; border:0; border-radius:0; color:var(--text-muted); background:transparent; box-shadow:none; cursor:pointer; pointer-events:auto; transform:translateY(-50%); }
.crm-global-finder__close:hover { color:var(--brand-strong); background:transparent; }
.crm-global-finder__control { position:absolute; left:50%; top:50%; z-index:2; display:flex; align-items:center; justify-content:center; gap:8px; width:var(--crm-finder-content-width); box-sizing:border-box; padding:12px; border:1px solid color-mix(in srgb,var(--brand) 18%,var(--border)); border-radius:22px; background:var(--surface); box-shadow:0 22px 48px -28px rgba(15,23,42,.56); transform:translate(-50%,-50%); }
.crm-global-finder__control .ds-grid__search-wrap { flex:1 1 auto; width:auto; min-width:220px; }
.crm-global-finder__control .ds-grid__search { width:100%; }
.crm-global-finder__control .ds-grid__search::-webkit-search-cancel-button { display:none; appearance:none; }
.crm-global-finder__clear { position:absolute; inset-inline-end:9px; top:50%; z-index:2; display:flex; align-items:center; justify-content:center; width:24px; height:24px; padding:0; border:0; border-radius:7px; color:var(--text-muted); background:transparent; cursor:pointer; transform:translateY(-50%); }
.crm-global-finder__clear:hover { color:var(--brand-strong); background:color-mix(in srgb,var(--brand) 10%,transparent); }
.crm-global-finder__clear:focus-visible { outline:2px solid var(--brand); outline-offset:1px; }
.crm-global-finder__clear[hidden],.crm-global-finder__control .ds-grid__field-icon[hidden] { display:none !important; }
.crm-global-finder__clear svg { display:block; width:16px; height:16px; }
.crm-global-finder__results-bridge { position:absolute; top:calc(50% + 32px); left:50%; z-index:2; width:var(--crm-finder-content-width); height:30px; pointer-events:none; opacity:0; background:linear-gradient(180deg,var(--surface) 0%,color-mix(in srgb,var(--surface) 82%,transparent) 48%,transparent 100%); transform:translateX(-50%) scaleY(0); transform-origin:top center; transition:opacity 150ms ease,transform 300ms cubic-bezier(.22,1,.36,1); }
.crm-global-finder__results-bridge::before,.crm-global-finder__results-bridge::after { content:""; position:absolute; top:0; width:22px; height:22px; pointer-events:none; }
.crm-global-finder__results-bridge::before { left:-22px; border-radius:0 22px 0 0; box-shadow:11px -11px 0 11px var(--surface); }
.crm-global-finder__results-bridge::after { right:-22px; border-radius:22px 0 0 0; box-shadow:-11px -11px 0 11px var(--surface); }
.crm-global-finder.is-open .crm-global-finder__results-bridge.has-results { opacity:1; transform:translateX(-50%) scaleY(1); }
.crm-global-finder__results { position:absolute; top:calc(50% + 32px); left:50%; z-index:1; width:var(--crm-finder-content-width); box-sizing:border-box; height:0; min-height:0; max-height:min(calc(100vh - 160px),720px); margin:0; padding:0 8px; border:0 solid var(--border); border-width:0 1px 1px; border-radius:0 0 22px 22px; clip-path:inset(0 round 0 0 22px 22px); background:var(--surface); box-shadow:var(--shadow-lg); display:grid; align-content:start; grid-template-columns:1fr; grid-auto-rows:max-content; gap:6px; overflow-x:hidden; overflow-y:auto; scrollbar-gutter:stable; opacity:0; visibility:hidden; pointer-events:none; transform:translate(-50%,-4px); transform-origin:top center; transition:height 340ms cubic-bezier(.22,1,.36,1),padding 340ms cubic-bezier(.22,1,.36,1),opacity 180ms ease,visibility 0s linear 340ms,transform 340ms cubic-bezier(.22,1,.36,1); }
.crm-global-finder__results::-webkit-scrollbar-track { margin-block:8px 18px; background:transparent; }
.crm-global-finder.is-open .crm-global-finder__results.has-results:not([hidden]) { height:var(--crm-finder-results-height,0px); padding:20px 8px 8px; opacity:1; visibility:visible; pointer-events:auto; transform:translate(-50%,0); transition-delay:0s; }
.crm-global-finder.is-open.is-results-closing .crm-global-finder__results.has-results:not([hidden]) { height:0; padding:0 8px; opacity:1; visibility:visible; pointer-events:none; transform:translate(-50%,-4px); transition:height 340ms cubic-bezier(.22,1,.36,1),padding 340ms cubic-bezier(.22,1,.36,1),opacity 0s linear 340ms,visibility 0s linear 340ms,transform 340ms cubic-bezier(.22,1,.36,1); }
.crm-global-finder.is-open.is-results-closing .crm-global-finder__results-bridge.has-results { opacity:0; transform:translateX(-50%) scaleY(0); transition:opacity 340ms cubic-bezier(.22,1,.36,1),transform 340ms cubic-bezier(.22,1,.36,1); }
.crm-global-finder__results[hidden] { display:none !important; }
.crm-global-finder__result { width:100%; min-width:0; box-sizing:border-box; display:grid; grid-template-columns:minmax(0,1.25fr) minmax(0,.85fr) minmax(0,1.15fr) minmax(0,.85fr) minmax(0,1.2fr); align-items:center; gap:clamp(6px,1vw,12px); padding:11px 13px; border:1px solid transparent; border-radius:10px; color:var(--text); text-align:start; font-family:inherit; background:var(--surface-2); cursor:pointer; overflow:hidden; }
.crm-global-finder__result:hover { background:var(--pastel-mint); }
.crm-global-finder__result:focus-visible { outline:2px solid var(--brand); outline-offset:1px; }
.crm-global-finder__result > span { display:flex; flex-direction:column; min-width:0; gap:3px; }
.crm-global-finder__result small { color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:11px; }
.crm-global-finder__result b { color:var(--text); font-size:13px; overflow-wrap:anywhere; }
.crm-global-finder__person b { color:var(--brand-strong); font-size:14px; }
.crm-global-finder__empty { padding:10px; color:var(--text-muted); }
@media (max-width:1100px) { .crm-global-finder__result { grid-template-columns:minmax(0,1.25fr) repeat(2,minmax(0,1fr)); } .crm-global-finder__result > span:nth-child(4), .crm-global-finder__result > span:nth-child(5) { display:none; } }
@keyframes crm-finder-surface-morph { 0% { background:rgba(15,118,110,.8); } 58% { background:color-mix(in srgb,var(--pastel-mint) 55%,var(--surface)); } 100% { background:var(--surface); } }
@keyframes crm-finder-results-in { from { opacity:0; transform:translate(-50%,-10px) scale(.98); } to { opacity:1; transform:translate(-50%,0) scale(1); } }
@media (max-width:900px) { .crm-global-finder__panel { --crm-finder-content-width:calc(100% - 104px); top:82px; left:0; right:calc(var(--sidebar-rail-w,72px) + 16px); height:75px; min-height:75px; } .crm-global-finder__close { left:12px; } .crm-global-finder__control .ds-grid__search-wrap { flex:1; width:auto; } .crm-global-finder__result { grid-template-columns:minmax(0,1.25fr) minmax(0,1fr); } .crm-global-finder__result > span:nth-child(3) { display:none; } }
@media (max-width:640px) { .topbar #ql-wrap { display:none !important; } }
@media (max-width:520px) { .crm-global-finder__tab { top:72px; width:29px; } .crm-global-finder__panel { --crm-finder-content-width:calc(100% - 104px); top:72px; left:0; right:8px; height:75px; min-height:75px; } .crm-global-finder__close { left:8px; width:36px; height:36px; } .crm-global-finder__control { padding:8px; border-radius:18px; } .crm-global-finder__control .ds-grid__search-wrap { min-width:0; } .crm-global-finder__control .btn { flex:0 0 auto; padding-inline:12px; } .crm-global-finder__results { border-radius:22px; } .crm-global-finder__result { grid-template-columns:1fr; } .crm-global-finder__result > span:not(:first-child) { display:none; } }
@media (prefers-reduced-motion:reduce) { .crm-global-finder__tab,.crm-global-finder__backdrop,.crm-global-finder__panel,.crm-global-finder__panel::before,.crm-global-finder__head,.crm-global-finder__control,.crm-global-finder__results-bridge,.crm-global-finder__results { transition:none; animation:none; } }
.crm-workbench-page .rich-statband { margin:0; }
.cwb-hero { margin:0; }
.cwb-hero-focus { display:flex; flex-direction:column; align-items:flex-start; gap:8px; min-width:min(100%,310px); padding:16px 18px; border-radius:14px; background:color-mix(in srgb,var(--surface) 78%,transparent); border:1px solid color-mix(in srgb,var(--brand) 14%,var(--border)); box-shadow:var(--shadow-xs); }
.cwb-hero-focus .cwb-focus-label { color:var(--text-muted); font-size:12px; }
.cwb-hero-focus strong { font-size:22px; color:var(--text); }
.cwb-hero-focus small { color:var(--text-muted); line-height:1.8; }
.cwb-analytics-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.25fr) minmax(0,1.25fr); gap:var(--space-macro); align-items:stretch; }
.cwb-analytics-grid > .card { min-width:0; margin:0; overflow:hidden; container-type:inline-size; container-name:cwb-card; }
.cwb-analytics-grid .card-title { font-weight:500; }
.cwb-analytics-grid .card-sub { font-weight:400; }
.cwb-analytics-grid .rich-donut-wrap { min-height:210px; }
.cwb-analytics-grid .rich-donut-center b,
.cwb-analytics-grid .rich-dleg .n,
.cwb-analytics-grid .rich-dleg .v { font-weight:500; }
.cwb-analytics-grid .rich-bars { padding-block:4px; min-width:0; }
.cwb-analytics-grid .card-head { min-height:66px; align-items:flex-start; flex-wrap:nowrap; }
.cwb-card-link { width:36px; height:36px; min-width:36px; padding:0; display:grid; place-items:center; border-radius:10px; }
.cwb-card-link [data-ds-icon] { display:grid; place-items:center; }
.cwb-deal-link { white-space:nowrap; display:inline-flex; align-items:center; gap:5px; }
.cwb-deal-link .material-symbols-rounded { font-size:17px; }
.cwb-analytics-grid .rich-bar {
  display:grid;
  grid-template-columns:minmax(0,1fr) clamp(64px,18%,96px) max-content;
  align-items:center;
  min-width:0;
  gap:8px;
}
.cwb-analytics-grid .rich-bar-l {
  min-width:0;
  font-weight:400; font-size:clamp(11px, 3.2cqi, 13px);
  white-space:normal; overflow:visible; text-overflow:clip;
  text-align:start; overflow-wrap:anywhere;
}
.cwb-analytics-grid .rich-bar-t { min-width:0; width:100%; }
.cwb-analytics-grid .rich-bar-v {
  min-width:0;
  font-weight:400; font-size:clamp(10px, 3cqi, 12px);
  white-space:nowrap; line-height:1.45;
  direction:rtl; text-align:end; padding-inline-end:2px;
}
.cwb-analytics-grid [data-cwb-deal-status],
.cwb-analytics-grid [data-cwb-advisors],
.cwb-analytics-grid [data-cwb-activity-load] { min-height:210px; min-width:0; padding:4px 18px 18px; overflow:hidden; }
@media (max-width:1200px) { .cwb-analytics-grid { grid-template-columns:1fr 1fr; } .cwb-analytics-grid > :first-child { grid-column:1 / -1; } }
@media (max-width:760px) { .cwb-analytics-grid { grid-template-columns:1fr; } .cwb-analytics-grid > :first-child { grid-column:auto; } }
.crm-workbench-page .ws-split { margin-top:0; }
.cwb-followups-split .card { margin:0; }
.cwb-quality-card { overflow:hidden; margin:0; }
.cwb-quality-card .cwb-quality-band { border:none; border-radius:0; }
.cwb-activity-list { display:flex; flex-direction:column; gap:8px; padding:0 14px 14px; min-height:120px; }
.cwb-activity-row {
  display:flex; align-items:center; flex-wrap:nowrap; gap:12px;
  padding:12px 14px; border-radius:12px;
  border:1px solid var(--border); background:var(--surface);
  box-shadow:var(--shadow-xs);
}
.cwb-activity-row.is-overdue {
  background:linear-gradient(135deg, var(--surface) 58%, color-mix(in srgb,var(--pastel-rose) 36%,var(--surface)) 100%);
  border-color:color-mix(in srgb,var(--pastel-rose) 68%,var(--border));
  box-shadow:0 8px 18px -12px color-mix(in srgb,var(--red-500) 32%,transparent);
}
.cwb-activity-row .cf-type-icon-wrap { flex-shrink:0; }
.cwb-activity-row { flex-wrap:wrap; }
.cwb-activity-body { flex:1 1 180px; min-width:0; }
.cwb-activity-row .cwb-deal-link { margin-inline-start:auto; }
.cwb-activity-title { font-size:13px; font-weight:400; color:var(--text); line-height:1.55; }
.cwb-activity-party { font-size:12.5px; color:var(--text); margin-block-start:3px; gap:6px; flex-wrap:wrap; }
.cwb-activity-party strong { font-weight:700; }
.cwb-activity-party .chip { font-weight:500; }
.cwb-activity-party a { color:inherit; text-decoration:none; }
.cwb-activity-party a:hover { color:var(--brand-600); }
.cwb-activity-meta { font-size:11.5px; font-weight:400; color:var(--text-muted); margin-block-start:4px; gap:6px; flex-wrap:wrap; }
.cwb-activity-meta .cwb-activity-dot { color:var(--text-faint,#9aa3b0); }
.cwb-activity-meta .chip { font-weight:500; }
.cwb-activity-more { display:inline-flex; align-self:flex-start; margin-inline:2px; }
/* CRM workbench — opportunity-detail visual language */
.crm-workbench-page { --cwb-radius:var(--radius-xl,18px); gap:18px; }
.cwb-command-hero.ddp-hero { margin:0; padding:0; gap:0; overflow:hidden; border-radius:var(--cwb-radius); border-color:color-mix(in srgb,var(--brand-400) 22%,var(--border)); background:linear-gradient(135deg,color-mix(in srgb,var(--pastel-mint) 25%,var(--surface)) 0%,var(--surface) 48%,color-mix(in srgb,var(--pastel-sky) 20%,var(--surface)) 100%); box-shadow:0 18px 48px -32px color-mix(in srgb,var(--brand-700) 38%,transparent); }
.cwb-command-hero__top { display:grid; grid-template-columns:minmax(0,1fr) minmax(280px,390px); align-items:stretch; gap:22px; padding:24px; }
.cwb-command-hero__identity { display:flex; align-items:flex-start; gap:14px; min-width:0; }
.cwb-command-hero__icon { width:48px; height:48px; min-width:48px; border-radius:15px; }
.cwb-command-hero__icon .ds-ico { width:24px; height:24px; }
.cwb-command-hero__eyebrow { margin-bottom:5px; color:var(--brand-700); font-size:11px; font-weight:800; letter-spacing:.02em; }
.cwb-command-hero h1 { margin:0 0 7px; color:var(--text); font-size:clamp(22px,2.15vw,31px); font-weight:850; line-height:1.35; }
.cwb-command-hero__identity p { margin:0; color:var(--text-muted); font-size:13px; line-height:1.9; }
.cwb-hero-focus { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:12px; min-width:0; padding:14px 16px; border:1px solid color-mix(in srgb,var(--brand-400) 18%,var(--border)); border-radius:15px; background:color-mix(in srgb,var(--surface) 88%,transparent); box-shadow:var(--shadow-xs); }
.cwb-hero-focus>.ds-ico-tile { width:42px; height:42px; border-radius:13px; }
.cwb-hero-focus>div { display:flex; flex-direction:column; min-width:0; gap:2px; }
.cwb-hero-focus .cwb-focus-label { color:var(--text-muted); font-size:10.5px; font-weight:700; }
.cwb-hero-focus strong { color:var(--text); font-size:17px; font-weight:850; line-height:1.5; }
.cwb-hero-focus small { color:var(--text-muted); font-size:10.5px; line-height:1.7; }
.cwb-hero-focus .btn { white-space:nowrap; }
.cwb-command-hero__facts { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); border-top:1px solid color-mix(in srgb,var(--brand-400) 15%,var(--border)); background:color-mix(in srgb,var(--surface) 72%,transparent); }
.cwb-hero-fact { display:flex; align-items:center; justify-content:center; gap:10px; min-width:0; padding:14px 18px; }
.cwb-hero-fact+.cwb-hero-fact { border-inline-start:1px solid var(--border); }
.cwb-hero-fact>.ds-ico-tile { width:34px; height:34px; min-width:34px; border-radius:10px; }
.cwb-hero-fact>span:last-child { display:flex; flex-direction:column; gap:1px; min-width:0; }
.cwb-hero-fact small { color:var(--text-muted); font-size:10.5px; font-weight:650; }
.cwb-hero-fact strong { color:var(--text); font-size:15px; font-weight:850; font-variant-numeric:tabular-nums; }
.cwb-kpi-section { margin:0; }
.cwb-command-kpis .kpi-grid,.cwb-quality-band .kpi-grid { display:grid; gap:12px; margin:0; }
.cwb-command-kpis .kpi-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
.cwb-command-kpis .kpi,.cwb-quality-band .kpi { min-height:90px; margin:0; border:1px solid var(--border); border-radius:15px; box-shadow:0 12px 30px -26px color-mix(in srgb,var(--text) 38%,transparent); }
.cwb-command-kpis .kpi-icon,.cwb-quality-band .kpi-icon { width:42px; height:42px; border-radius:13px; }
.cwb-command-kpis .kpi-value,.cwb-quality-band .kpi-value { font-weight:850; }
.cwb-analytics-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.cwb-analytics-grid>.cwb-analytics-card { display:grid; grid-template-rows:auto 1fr; border-radius:var(--cwb-radius); border-color:color-mix(in srgb,var(--border) 78%,var(--tc,var(--brand-400))); box-shadow:0 16px 42px -34px color-mix(in srgb,var(--text) 44%,transparent); }
.cwb-analytics-grid .card-head,.cwb-quality-card .card-head,.cwb-plan-card .card-head { min-height:74px; padding:15px 16px; align-items:center; }
.cwb-section-heading { display:flex; align-items:center; gap:11px; min-width:0; }
.cwb-section-heading>.ds-ico-tile { width:39px; height:39px; min-width:39px; border-radius:12px; }
.cwb-section-heading>div { min-width:0; }
.cwb-section-heading .card-title { margin:0 0 3px; color:var(--text); font-size:13.5px; font-weight:800; }
.cwb-section-heading .card-sub { color:var(--text-muted); font-size:10.5px; line-height:1.7; }
.cwb-card-link { flex:0 0 auto; border:1px solid color-mix(in srgb,var(--tc,var(--brand-400)) 22%,var(--border)); background:color-mix(in srgb,var(--surface) 86%,transparent); }
.cwb-analytics-grid [data-cwb-deal-status],.cwb-analytics-grid [data-cwb-advisors],.cwb-analytics-grid [data-cwb-activity-load] { display:grid; width:100%; min-height:230px; padding:10px 18px 18px; place-items:center; align-content:center; }
.cwb-analytics-grid [data-cwb-deal-status] > *,
.cwb-analytics-grid [data-cwb-advisors] > *,
.cwb-analytics-grid [data-cwb-activity-load] > * { width:100%; }
.cwb-quality-card { border-radius:var(--cwb-radius); border-color:color-mix(in srgb,var(--brand-400) 18%,var(--border)); box-shadow:0 16px 42px -36px color-mix(in srgb,var(--brand-700) 40%,transparent); }
.cwb-quality-band { padding:14px 16px 16px; }
.cwb-quality-band .kpi-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
.cwb-quality-band .kpi { min-height:82px; }
.cwb-followups-split { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.cwb-followups-split>.cwb-plan-card { min-width:0; margin:0; overflow:hidden; border-radius:var(--cwb-radius); box-shadow:0 16px 42px -36px color-mix(in srgb,var(--text) 42%,transparent); }
.cwb-plan-card--overdue { border-color:color-mix(in srgb,var(--rose-500,#e11d48) 20%,var(--border)); }
.cwb-plan-card--today { border-color:color-mix(in srgb,var(--lilac-500,#7c3aed) 18%,var(--border)); }
.cwb-activity-list { min-height:170px; padding:14px; }
.cwb-activity-row { padding:11px 12px; border-radius:12px; background:var(--surface); box-shadow:0 7px 20px -20px color-mix(in srgb,var(--text) 45%,transparent); }
.cwb-activity-title { font-weight:650; }
.cwb-plan-card .rui-empty { min-height:150px; border:1px dashed color-mix(in srgb,var(--border) 82%,var(--brand-300)); border-radius:14px; background:color-mix(in srgb,var(--surface-2) 55%,var(--surface)); }
@media(max-width:1180px){.cwb-command-hero__top{grid-template-columns:1fr}.cwb-analytics-grid{grid-template-columns:1fr 1fr}.cwb-analytics-grid>:first-child{grid-column:1/-1}.cwb-quality-band .kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:760px){.cwb-command-hero__top{padding:18px}.cwb-hero-focus{grid-template-columns:auto minmax(0,1fr)}.cwb-hero-focus .btn{grid-column:1/-1;width:100%}.cwb-command-hero__facts,.cwb-command-kpis .kpi-grid,.cwb-analytics-grid,.cwb-followups-split{grid-template-columns:1fr}.cwb-analytics-grid>:first-child{grid-column:auto}.cwb-hero-fact{justify-content:flex-start}.cwb-hero-fact+.cwb-hero-fact{border-inline-start:0;border-top:1px solid var(--border)}}
@media(max-width:480px){.cwb-command-hero__identity{flex-direction:column}.cwb-quality-band .kpi-grid{grid-template-columns:1fr}}
/* CRM follow-ups — Design System KPI/pastel boxes (#dashboard sample) */
.cf-followups-page { display:grid; gap:var(--space-meso); }
.cf-followups-hero-chips .cf-hero-chip { display:inline-flex; align-items:center; gap:6px; }
.cf-followups-hero-chips .cf-hero-chip .ds-ico { width:15px; height:15px; }
.cf-followups-hero .cf-hero-chip--today { background:color-mix(in srgb,var(--pastel-mint) 62%,var(--surface)); border-color:color-mix(in srgb,var(--green-500) 32%,var(--border)); color:#18794e; }
.cf-followups-hero .cf-hero-chip--today b { color:#18794e; }
.cf-followups-hero .cf-hero-chip--upcoming { background:color-mix(in srgb,var(--pastel-lilac) 62%,var(--surface)); border-color:color-mix(in srgb,var(--purple-500) 32%,var(--border)); color:#6d28d9; }
.cf-followups-hero .cf-hero-chip--upcoming b { color:#6d28d9; }
.cf-followups-hero .cf-hero-chip--overdue { background:color-mix(in srgb,var(--pastel-rose) 58%,var(--surface)); border-color:color-mix(in srgb,var(--red-500) 30%,var(--border)); color:#be334d; }
.cf-followups-hero .cf-hero-chip--overdue b { color:#be334d; }
.cf-followups-hero .cf-hero-chip--done { background:color-mix(in srgb,var(--pastel-sky) 58%,var(--surface)); border-color:color-mix(in srgb,var(--pastel-sky) 80%,var(--border)); color:#2c6cb0; }
.cf-followups-hero .cf-hero-chip--done b { color:#2c6cb0; }
.cf-followups-hero-side { display:flex; align-items:center; gap:14px; min-width:0; }
.cf-followups-hero-next { display:flex; align-items:center; gap:10px; min-width:0; }
.cf-followups-hero-next-text { display:grid; gap:1px; min-width:0; }
.cf-followups-hero-next-meta { display:flex; align-items:baseline; flex-wrap:wrap; gap:0 8px; }
.cf-followups-hero-icon { display:grid; place-items:center; flex:0 0 auto; width:36px; height:36px; border-radius:11px; background:var(--pastel-lilac); }
.cf-followups-hero-icon .ds-ico { width:18px; height:18px; }
.cf-followups-hero-next-label { font-size:12px; font-weight:700; color:#6d28d9; }
.cf-followups-hero-next strong { max-inline-size:34ch; font-size:13px; font-weight:800; color:var(--text); line-height:1.5; }
.cf-followups-hero-next small { font-size:12px; color:var(--text-muted); }
.cf-followups-hero-side .btn { flex:0 0 auto; min-height:38px; }
.cf-followups-card { margin:0; overflow:hidden; }
.cf-followups-card-head { flex-direction:column; align-items:stretch; gap:10px; }
.cf-followups-head-row { display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; width:100%; }
.cf-followups-tabs { display:flex; gap:7px; flex-wrap:wrap; border:0 !important; margin:0; }
.cf-followups-tabs .ds-tab { display:inline-flex; align-items:center; gap:6px; min-height:38px; padding:7px 13px; border:1px solid color-mix(in srgb,var(--pastel-sky) 40%,var(--border)); border-radius:10px; background:var(--surface); color:var(--text-secondary); font:inherit; font-size:12px; font-weight:700; cursor:pointer; transition:background .15s,border-color .15s,color .15s; }
.cf-followups-tabs .ds-tab .ds-ico { width:16px; height:16px; }
.cf-followups-tabs .ds-tab.active[data-cf-tab="today"] { background:color-mix(in srgb,var(--pastel-mint) 62%,var(--surface)); border-color:color-mix(in srgb,var(--green-500) 42%,var(--border)); color:#18794e; }
.cf-followups-tabs .ds-tab.active[data-cf-tab="upcoming"] { background:color-mix(in srgb,var(--pastel-lilac) 62%,var(--surface)); border-color:color-mix(in srgb,var(--purple-500) 40%,var(--border)); color:#6d28d9; }
.cf-followups-tabs .ds-tab.active[data-cf-tab="overdue"] { background:color-mix(in srgb,var(--pastel-rose) 62%,var(--surface)); border-color:color-mix(in srgb,var(--red-500) 40%,var(--border)); color:#be334d; }
.cf-followups-tabs .ds-tab.active[data-cf-tab="done"] { background:color-mix(in srgb,var(--pastel-mint) 48%,var(--surface)); border-color:color-mix(in srgb,var(--green-500) 32%,var(--border)); color:#23764c; }
.cf-followups-tabs .ds-tab.active[data-cf-tab=""] { background:color-mix(in srgb,var(--pastel-sky) 58%,var(--surface)); border-color:color-mix(in srgb,var(--brand-500) 28%,var(--border)); color:var(--brand-600); }
.cf-followups-date-bar { width:100%; }
.cf-followups-date-bar .afc-pipeline-date-bar {
  display:flex;
  direction:rtl;
  align-items:center;
  flex-wrap:wrap;
  gap:10px 12px;
  margin:0;
  padding:10px 12px;
  border-radius:12px;
  background:color-mix(in srgb,var(--pastel-sky) 28%,var(--surface));
  border:1px solid color-mix(in srgb,var(--pastel-sky) 55%,var(--border));
}
.cf-followups-date-bar .spb-period-filter-label { flex:0 0 auto; min-inline-size:auto; }
.cf-followups-date-bar .afc-date-field { display:inline-flex; flex-direction:row; align-items:center; gap:7px; margin:0; }
.cf-followups-date-bar .afc-date-field__label { flex:0 0 auto; margin:0; font-size:11.5px; font-weight:700; color:var(--text-secondary); }
.cf-followups-date-bar .afc-date-field__input { inline-size:176px; min-inline-size:0; min-block-size:38px; padding-block:7px; }
.cf-followups-date-bar .afc-date-presets { display:flex; align-items:center; flex-wrap:wrap; gap:6px; margin-inline-start:auto; }
.cf-followups-date-bar .chip-btn.active { background:color-mix(in srgb,var(--pastel-mint) 55%,var(--surface)); border-color:color-mix(in srgb,var(--green-500) 36%,var(--border)); color:#18794e; }
@media (max-width:900px) {
  .cf-followups-hero { gap:12px; }
  .cf-followups-hero-side { justify-self:stretch; flex-wrap:wrap; justify-content:space-between; }
}
@media (max-width:720px) {
  .cf-followups-date-bar .afc-date-presets { flex-basis:100%; margin-inline-start:0; }
}
@media (max-width:430px) {
  .cf-followups-hero .cf-followups-hero-chips { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .cf-followups-hero-chips .cf-hero-chip { justify-content:center; white-space:nowrap; }
  .cf-followups-hero-side .btn { flex:1 1 100%; justify-content:center; }
  .cf-followups-card .card-sub { display:none; }
  .cf-followups-tabs { flex-wrap:nowrap; gap:4px; width:100%; }
  .cf-followups-tabs .ds-tab { flex:1 1 auto; justify-content:center; padding-inline:6px; white-space:nowrap; }
  .cf-followups-tabs .ds-tab [data-ds-icon] { display:none; }
  .cf-followups-date-bar .afc-date-field { width:100%; }
  .cf-followups-date-bar .afc-date-field__input { flex:1 1 auto; inline-size:auto; }
}
.rld-followups-grid .cf-type-label { display:flex; align-items:center; gap:8px; font-size:12.5px; font-weight:700; min-width:0; }
.cf-type-icon-wrap { display:grid; place-items:center; width:30px; height:30px; min-width:30px; border-radius:9px; background:var(--tc50,var(--surface-2)); }
.cf-type-icon-wrap [data-ds-icon] { display:grid; place-items:center; width:100%; height:100%; line-height:0; }
.cf-type-icon-wrap .ds-ico { display:block; width:16px; height:16px; margin:0; color:var(--tc,var(--brand-600)); }
.cf-followup-popup{--cf-popup-accent:var(--brand-500,#14b8a6);display:grid;gap:14px}.cf-followup-popup--sky{--cf-popup-accent:#4f8edc}.cf-followup-popup--lilac{--cf-popup-accent:#8064d8}.cf-followup-popup--mint,.cf-followup-popup--green{--cf-popup-accent:#249c73}.cf-followup-popup--amber,.cf-followup-popup--peach{--cf-popup-accent:#cf7b35}.cf-followup-popup__hero{display:grid;grid-template-columns:52px minmax(0,1fr) auto;align-items:center;gap:12px;padding:16px;border:1px solid color-mix(in srgb,var(--cf-popup-accent) 24%,var(--border));border-radius:18px;background:linear-gradient(135deg,color-mix(in srgb,var(--cf-popup-accent) 14%,var(--surface)),var(--surface))}.cf-followup-popup__hero-icon{display:grid;place-items:center;width:52px;height:52px;border-radius:16px;background:color-mix(in srgb,var(--cf-popup-accent) 18%,var(--surface));color:var(--cf-popup-accent)}.cf-followup-popup__hero-icon .ds-ico{width:25px;height:25px}.cf-followup-popup__hero small,.cf-followup-popup__fact small,.cf-followup-popup__note small,.cf-followup-popup__result small{display:block;color:var(--text-muted);font-size:11px;font-weight:700}.cf-followup-popup__hero h3{margin:3px 0 0;font-size:17px;color:var(--text)}.cf-followup-popup__facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.cf-followup-popup__fact{display:flex;align-items:center;gap:10px;min-width:0;padding:12px;border:1px solid var(--border);border-radius:14px;background:var(--surface-2)}.cf-followup-popup__fact-icon{display:grid;place-items:center;width:34px;height:34px;flex:0 0 34px;border-radius:10px;background:color-mix(in srgb,var(--cf-popup-accent) 13%,var(--surface));color:var(--cf-popup-accent)}.cf-followup-popup__fact strong{display:block;margin-top:3px;font-size:13px;color:var(--text);overflow-wrap:anywhere}.cf-followup-popup__note,.cf-followup-popup__result{display:flex;align-items:flex-start;gap:10px;padding:14px 16px;border-radius:14px;background:color-mix(in srgb,var(--cf-popup-accent) 8%,var(--surface));border-inline-start:4px solid var(--cf-popup-accent)}.cf-followup-popup__note>span{color:var(--cf-popup-accent);margin-top:2px}.cf-followup-popup__note p,.cf-followup-popup__result p{margin:5px 0 0;line-height:1.9;color:var(--text);white-space:pre-line}.cf-followup-popup__result{display:block;background:var(--pastel-mint);border-inline-start-color:var(--green-500,#22a06b)}@media(max-width:640px){.cf-followup-popup__hero{grid-template-columns:46px minmax(0,1fr)}.cf-followup-popup__hero>.chip{grid-column:1/-1;width:max-content}.cf-followup-popup__hero-icon{width:46px;height:46px}.cf-followup-popup__facts{grid-template-columns:1fr}}
.cf-type-note { font-size:11px; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:220px; margin-block-start:3px; font-weight:400; }
.rld-followups-grid .ds-grid__cell--body { display:flex; align-items:center; }
.rld-followups-grid .ds-grid__cell--body[data-align="center"] { justify-content:center; }
.cf-followups-card .ds-grid__row[data-id]:hover { background:color-mix(in srgb,var(--pastel-sky) 22%,var(--surface)); }
[data-cf-new] { display:inline-flex; align-items:center; gap:7px; }
[data-cf-new] .ds-ico { color:#fff !important; }
.rlx-modal.rlx-modal--data-form.cf-new-action-modal { width:min(736px,calc(100vw - 32px)); }
.cf-new-action-modal .rlx-field:has(#rlx-f-record_id) .ds-dropdown__trigger,
.cf-new-action-modal .rlx-field:has(#rlx-f-record_id) .ds-dropdown__menu { inline-size:100%; max-inline-size:none; }
.cf-new-action-modal .rlx-field:has(#rlx-f-record_id) .ds-dropdown__value,
.cf-new-action-modal .rlx-field:has(#rlx-f-record_id) .ds-dropdown__option { white-space:normal; overflow:visible; text-overflow:clip; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 1100px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* Constrain chart heights inside cards. Width/height are the CSS display box;
   JS backs the canvas bitmap at devicePixelRatio to match — do not fight that
   with mismatched inline sizes (caused blurry stretched charts). */
.card > canvas,
.card canvas:not(.kpi-spark) {
  max-height: 280px !important;
  height: 240px !important;
  width: 100% !important;
  image-rendering: auto;
}
.card canvas[height="160"] { height: 200px !important; }
.card canvas[height="180"] { height: 220px !important; }
.card canvas[height="200"] { height: 240px !important; }
.card canvas[height="220"] { height: 260px !important; }
.card canvas[height="320"] { height: 380px !important; max-height: 420px !important; }
/* Sparklines inside KPI cards must remain tiny */
.kpi-spark { height: 32px !important; max-height: 32px !important; }

/* ---------- KPI cards ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-meso);
  width: 100%;
  min-width: 0;
  align-items: stretch;
}
.kpi-grid.kpi-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid.kpi-grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }

/* Canonical work KPI summaries are page-level sections. Some PM shells use
   grid children for their operational content, so the summary must claim the
   complete row instead of inheriting a single content column. */
.work-kpi-summary {
  width: 100%;
  max-width: none;
  align-self: stretch;
  grid-column: 1 / -1;
}
/* The colleague picker sits in the summary head with the width of the same
   page's team filter (rich-pages.css .pm-team-filter), so names stay on one line. */
.work-kpi-summary .work-kpi-summary__people {
  inline-size: min(320px, 100%);
  margin: 0;
}

@media (max-width: 1200px) {
  .kpi-grid.kpi-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* The official sales-intelligence summary contains exactly four canonical
   observations. Keep the complete desktop snapshot on one scan line even
   when compact-monitor narrows the application content column. */
#content [data-domain-kpi-summary="advisor-team-tree"] .kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 900px) {
  #content [data-domain-kpi-summary="advisor-team-tree"] .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  #content [data-domain-kpi-summary="advisor-team-tree"] .kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* Crm KPI catalogue: use the available canvas efficiently without
   squeezing labels/targets. Wide desktops get four cards; regular desktop
   content columns get three. The #content scope intentionally outranks the
   generic compact-monitor two-column fallback. */
#content [data-afc-kpi] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1440px) {
  #content [data-afc-kpi] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1050px) {
  #content [data-afc-kpi] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  #content [data-afc-kpi] { grid-template-columns: 1fr; }
}
/* Keep 4-up on laptop; wrap only on tablet/phone */
@media (max-width: 900px) {
  .kpi-grid,
  .kpi-grid.kpi-grid-3,
  .kpi-grid.kpi-grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px)  {
  .kpi-grid,
  .kpi-grid.kpi-grid-3,
  .kpi-grid.kpi-grid-6 { grid-template-columns: 1fr; }
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  position: relative;
  overflow: hidden;
  transition: transform .3s cubic-bezier(.22,.7,.16,1), box-shadow .3s ease, border-color .25s ease;
  box-shadow: var(--shadow-xs);
  /* Compact card (owner request 1405/08/23, all pages): the icon sits beside
     the label, value and hint instead of above them, so a summary card is
     about half as tall. The spark line stays laid over the card's bottom edge. */
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 12px;
  align-items: center;
  align-content: center;
}
.kpi:not(:has(> .kpi-icon)) { grid-template-columns: minmax(0, 1fr); }
/* The corner hint stays on the card's own corner, not inside a grid cell. */
.kpi > :not(.kpi-icon):not(.kpi-spark):not(.kpi-delta):not(.ds-hint-corner) { grid-column: -2; min-width: 0; }
.kpi > .kpi-icon { grid-column: 1; grid-row: 1 / span 2; align-self: center; margin-bottom: 0 !important; }
/* The hint takes the whole width under icon and number, so narrow cards do not wrap it into a tall column. */
.kpi > .kpi-delta { grid-column: 1 / -1; justify-self: start; margin-top: 6px; }
.kpi:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: 0 18px 36px -8px rgba(15, 23, 42, .12), 0 4px 12px rgba(15, 23, 42, .04);
}
/* Tinted hover shadows per tone (pastel glow) */
.kpi.blue:hover    { box-shadow: 0 18px 36px -8px rgba(44, 120, 115, .35), 0 4px 12px rgba(15,23,42,.04); }
.kpi.green:hover   { box-shadow: 0 18px 36px -8px rgba(109, 191, 143, .35), 0 4px 12px rgba(15,23,42,.04); }
.kpi.amber:hover   { box-shadow: 0 18px 36px -8px rgba(244, 162, 97,  .40), 0 4px 12px rgba(15,23,42,.04); }
.kpi.purple:hover  { box-shadow: 0 18px 36px -8px rgba(111, 185, 143, .35), 0 4px 12px rgba(15,23,42,.04); }
.kpi.red:hover     { box-shadow: 0 18px 36px -8px rgba(232, 120, 140, .40), 0 4px 12px rgba(15,23,42,.04); }

/* Pastel highlight blob in upper-end corner */
.kpi::before {
  content: '';
  position: absolute;
  top: -30px; inset-inline-end: -30px;
  width: 160px; height: 160px;
  border-radius: 50%;
  filter: blur(42px);
  opacity: .55;
  pointer-events: none;
  transition: opacity .3s ease, transform .4s cubic-bezier(.22,.7,.16,1);
  z-index: 0;
}
.kpi:hover::before { opacity: .9; transform: scale(1.15); }

/* Subtle full-card pastel tint per tone */
.kpi.blue   { background: linear-gradient(135deg, var(--surface) 55%, rgba(184, 212, 241, .35) 100%); }
.kpi.green  { background: linear-gradient(135deg, var(--surface) 55%, rgba(184, 230, 211, .40) 100%); }
.kpi.amber  { background: linear-gradient(135deg, var(--surface) 55%, rgba(255, 228, 204, .45) 100%); }
.kpi.purple { background: linear-gradient(135deg, var(--surface) 55%, rgba(221, 214, 254, .40) 100%); }
.kpi.red    { background: linear-gradient(135deg, var(--surface) 55%, rgba(245, 194, 199, .35) 100%); }
.kpi:not(:has(.kpi-spark)) { padding-bottom: 12px; }
.kpi-icon {
  width: 36px; height: 36px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 17px;
  margin-bottom: 8px;
  transition: transform .3s cubic-bezier(.22,.7,.16,1);
}
.kpi-icon .ds-ico { width: 20px; height: 20px; color: inherit; }
.kpi:hover .kpi-icon { transform: scale(1.08) rotate(-3deg); }

.kpi-icon.blue   { background: var(--pastel-sky);   color: #3b5998; }
.kpi-icon.green  { background: var(--pastel-mint);  color: #2f8a5e; }
.kpi-icon.amber  { background: var(--pastel-peach); color: #c46920; }
.kpi-icon.purple { background: var(--pastel-lilac); color: #6d50d4; }
.kpi-icon.red    { background: var(--pastel-rose);  color: #b14458; }

.kpi.blue::before   { background: var(--pastel-sky); }
.kpi.green::before  { background: var(--pastel-mint); }
.kpi.amber::before  { background: var(--pastel-peach); }
.kpi.purple::before { background: var(--pastel-lilac); }

/* Sharpen the macro (value) vs. micro (label) contrast per the information-
   hierarchy pyramid — the number is the level-1 takeaway, the label is
   supporting context, they shouldn't compete for the same glance. */
.kpi-label {
  font-size: 11.5px; color: var(--text-muted); font-weight: 500; line-height: 1.35;
  max-width: 100%;
}
.kpi-value {
  font-size: clamp(16px, 1.4vw, 22px); font-weight: 800; margin: 3px 0 5px;
  letter-spacing: -.5px; line-height: 1.25;
  max-width: 100%;
  /* Do NOT use overflow:hidden here — it breaks gradient text-fill and collapses the value */
}
.kpi-delta {
  font-size: 10.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
}
.kpi-delta.up   { color: #2f8a5e; background: var(--green-50); }
.kpi-delta.down { color: #b14458; background: var(--red-50); }

.kpi-spark {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  width: 100% !important;
  max-width: 100% !important;
  height: 32px !important;
  max-height: 34px !important;
  opacity: .7;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* ---------- Stat card ---------- */
.stat .stat-label { color: var(--text-muted); font-size: 12px; }
.stat .stat-value { font-size: 24px; font-weight: 700; margin: 6px 0; letter-spacing: -.5px; }
.stat .stat-value.green { color: var(--green-500); }
.stat .stat-value.red   { color: var(--red-500); }
.stat .stat-meta { font-size: 12px; color: var(--text-muted); }

/* ---------- Rank / Leaderboard ---------- */
.rank-display { display: flex; align-items: center; gap: 16px; margin: 6px 0 14px; }
.rank-num {
  font-size: 56px; font-weight: 800;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  line-height: 1;
}
.rank-meta { font-size: 12px; }
.up { color: var(--green-500); }
.down { color: var(--red-500); }

.leaderboard { display: flex; flex-direction: column; gap: 6px; }
.lb-row {
  display: grid; grid-template-columns: 28px 1fr auto;
  align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
}
.lb-row:hover { background: var(--surface-2); }
.lb-row.me   { background: linear-gradient(90deg, rgba(30,109,255,.08), transparent); border: 1px dashed var(--brand-300); }
.lb-rank { font-weight: 700; color: var(--text-muted); font-size: 13px; }
.lb-name { font-size: 13px; }
.lb-score { font-weight: 700; font-size: 13px; }

/* ---------- Heatmap (v2: with day + week labels, RTL aware, 4 weeks) ---------- */
.heatmap {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  margin-top: 4px;
}
.hm-col { display: grid; grid-template-rows: repeat(7, 1fr); gap: 4px; }

/* New v2 layout (compact — height matches sibling card via flex) */
.card:has(> .heatmap-v2) {
  display: flex;
  flex-direction: column;
}
.heatmap-v2 {
  display: grid !important;
  grid-template-columns: 56px repeat(4, 1fr);
  grid-auto-rows: minmax(26px, 1fr);
  gap: 6px;
  margin-top: 8px;
  align-content: stretch;
  flex: 1;
}
.heatmap-v2 .hm-cell { aspect-ratio: auto; width: auto; height: 100%; }
.hm-corner { background: transparent; }
.hm-week-label {
  display: flex; align-items: end; justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding-bottom: 4px;
  border-bottom: 2px solid var(--brand-100);
}
.hm-week-label:last-of-type {
  color: var(--brand-600);
  border-bottom-color: var(--brand-500);
}
.hm-day-label {
  display: flex; align-items: center; justify-content: end;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  padding-inline-end: 8px;
}
.hm-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--hm-0);
  position: relative;
  transition: transform .2s cubic-bezier(.22,.7,.16,1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .28);
  user-select: none;
}
.hm-cell.lvl0 { color: var(--text-muted); text-shadow: none; }
.hm-cell.lvl1 { background: var(--hm-1); }
.hm-cell.lvl2 { background: var(--hm-2); }
.hm-cell.lvl3 { background: var(--hm-3); }
.hm-cell.lvl4 { background: var(--hm-4); }
.hm-cell:hover {
  transform: scale(1.4);
  z-index: 3;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .25);
}
.hm-cell::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #0f172a;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .2s ease;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.hm-cell::before {
  content: '';
  position: absolute;
  bottom: calc(130% - 6px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #0f172a;
  opacity: 0;
  transition: opacity .15s ease;
  pointer-events: none;
  z-index: 10;
}
.hm-cell:hover::after,
.hm-cell:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--text-muted); }
.legend-item { display: inline-flex; align-items: center; gap: 4px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--hm-0); }
.sw.lvl1 { background: var(--hm-1); }
.sw.lvl2 { background: var(--hm-2); }
.sw.lvl3 { background: var(--hm-3); }
.sw.lvl4 { background: var(--hm-4); }

/* ---------- Timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl-item {
  display: grid; grid-template-columns: 60px 1fr auto;
  gap: 12px; align-items: center;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 10px;
}
.tl-date {
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 4px;
}
.tl-day  { font-weight: 700; font-size: 16px; }
.tl-mon  { font-size: 10px; color: var(--text-muted); }
.tl-title { font-weight: 600; font-size: 13px; }
.tl-sub { font-size: 11px; color: var(--text-muted); }
.tl-time { font-size: 12px; font-weight: 600; }

/* ---------- AI banner ---------- */
.ai-banner {
  display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: flex-start;
  background: linear-gradient(135deg, rgba(30,109,255,.06), rgba(20,184,166,.06));
  border: 1px solid var(--brand-100);
}
[data-theme="dark"] .ai-banner {
  background: linear-gradient(135deg, rgba(30,109,255,.12), rgba(20,184,166,.10));
  border-color: rgba(108,177,255,.25);
}
.ai-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.ai-icon.ds-ico-tile .ds-ico { width: 28px; height: 28px; }
.ai-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.ai-text { margin: 0 0 12px; line-height: 1.85; font-size: 13px; }
.ai-text strong { color: var(--brand-600); font-weight: 700; }
[data-theme="dark"] .ai-text strong { color: #8eb6ff; }
.ai-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Course grid ---------- */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.course-banner {
  height: 90px;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
  position: relative;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 36px; font-weight: 800; letter-spacing: -1px;
}
.course-banner.b2 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.course-banner.b3 { background: linear-gradient(135deg, #8b5cf6, #ec4899); }
.course-banner.b4 { background: linear-gradient(135deg, #10b981, #06b6d4); }
.course-banner.b5 { background: linear-gradient(135deg, #6366f1, #8b5cf6); }

.course-body { padding: 16px 18px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.course-title { font-weight: 700; font-size: 15px; }
.course-meta { display: flex; gap: 12px; font-size: 11px; color: var(--text-muted); }
.course-progress {
  height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden;
}
.course-progress > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--brand-500), var(--accent-500));
  border-radius: 99px;
}
.course-foot {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--border); padding-top: 10px;
}
.course-pct { font-weight: 700; font-size: 13px; }

/* ---------- Schedule ---------- */
.schedule-grid {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  gap: 6px;
}
.sg-head, .sg-time, .sg-cell {
  font-size: 12px;
  padding: 8px;
  text-align: center;
  border-radius: 8px;
}
.sg-head { font-weight: 700; color: var(--text-muted); }
.sg-time { color: var(--text-muted); }
.sg-cell { background: var(--surface-2); min-height: 50px; }
.sg-cell.has {
  background: linear-gradient(135deg, rgba(30,109,255,.15), rgba(20,184,166,.15));
  border: 1px solid rgba(30,109,255,.3);
  color: var(--brand-700);
  font-weight: 600;
  text-align: start;
  padding: 8px 10px;
}
[data-theme="dark"] .sg-cell.has { color: #8eb6ff; }

.recordings { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 14px; }
.rec-item {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 12px;
  display: flex; gap: 12px; align-items: center;
}
.rec-thumb {
  width: 60px; height: 44px; border-radius: 6px;
  background: linear-gradient(135deg, var(--brand-500), var(--purple-500));
  display: grid; place-items: center;
  color: #fff; font-size: 18px;
}
.rec-title { font-weight: 600; font-size: 13px; }
.rec-meta { font-size: 11px; color: var(--text-muted); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 12px 14px; text-align: start; }
.table thead th {
  background: var(--surface-2);
  color: var(--text-muted); font-weight: 600; font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.table tbody tr { border-bottom: 1px solid var(--border); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child { border-bottom: none; }

.score-pill {
  display: inline-block;
  padding: 4px 10px; border-radius: 99px;
  font-weight: 700; font-size: 12px;
  background: var(--green-50); color: var(--green-500);
}
.score-pill.mid { background: var(--amber-50); color: var(--amber-500); }
.score-pill.low { background: var(--red-50);   color: var(--red-500); }

[data-theme="dark"] .score-pill     { background: rgba(16,185,129,.15); color: #34d399; }
[data-theme="dark"] .score-pill.mid { background: rgba(245,158,11,.15); color: #fbbf24; }
[data-theme="dark"] .score-pill.low { background: rgba(239,68,68,.15);  color: #f87171; }

/* ---------- Kanban ---------- */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 1100px) { .kanban { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 600px)  { .kanban { grid-template-columns: 1fr; } }
.kb-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 240px;
}
.kb-col-head {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; font-size: 13px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.kb-card {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 12px;
  border-inline-start: 3px solid var(--brand-500);
}
.kb-card.amber  { border-color: var(--amber-500); }
.kb-card.red    { border-color: var(--red-500); }
.kb-card.green  { border-color: var(--green-500); }
.kb-title { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.kb-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Resource grid ---------- */
.resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.res-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
  transition: all .15s ease;
}
.res-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand-300); }
.res-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--brand-50); color: var(--brand-500);
  display: grid; place-items: center; font-size: 18px;
}
[data-theme="dark"] .res-icon { background: rgba(30,109,255,.15); color: #8eb6ff; }
.res-title { font-weight: 600; font-size: 13px; }
.res-meta { font-size: 11px; color: var(--text-muted); }

/* ---------- Jobs (career) ---------- */
.jobs { display: flex; flex-direction: column; gap: 12px; }
.job-card {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px; align-items: center;
  padding: 14px;
  background: var(--surface-2);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.job-logo {
  width: 56px; height: 56px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 18px;
}
.job-title { font-weight: 700; font-size: 14px; }
.job-company { font-size: 12px; color: var(--text-muted); }
.job-tags { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.job-tag {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
}
.match-circle {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800;
  background: conic-gradient(var(--green-500) calc(var(--p) * 1%), var(--surface) 0);
  position: relative;
}
.match-circle::before {
  content: '';
  position: absolute; inset: 5px;
  background: var(--surface-2);
  border-radius: 50%;
}
.match-circle span { position: relative; font-size: 13px; }

/* ---------- Chat / Tickets ---------- */
.chat-card { display: flex; flex-direction: column; height: 480px; }
.chat {
  flex: 1;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 14px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 12px;
}
.msg { max-width: 75%; padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.7; }
.msg.bot { background: var(--surface); border: 1px solid var(--border); align-self: flex-start; }
.msg.me  { background: linear-gradient(135deg, var(--brand-500), var(--brand-600)); color: #fff; align-self: flex-end; }
.msg-meta { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

.chat-input { display: flex; gap: 8px; }
.chat-input input {
  flex: 1; height: 42px;
  border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 10px; padding: 0 14px; font-family: inherit; color: var(--text);
}

.tickets { display: flex; flex-direction: column; gap: 10px; }
.tk-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center; gap: 10px;
  padding: 12px; background: var(--surface-2);
  border-radius: 10px;
}
.tk-title { font-weight: 600; font-size: 13px; }
.tk-meta { font-size: 11px; color: var(--text-muted); }

/* ---------- Certificates ---------- */
.cert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.cert-card {
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
}
.cert-card::before {
  content: '';
  position: absolute; inset-inline-start: -40px; bottom: -40px;
  width: 140px; height: 140px;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
  opacity: .08;
  border-radius: 50%;
}
.cert-icon {
  width: 50px; height: 50px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  display: grid; place-items: center;
  color: #fff; font-size: 24px;
  margin-bottom: 12px;
}
.cert-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.cert-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.cert-actions { display: flex; gap: 8px; }

/* ---------- Misc ---------- */
.link { color: var(--brand-500); font-weight: 600; font-size: 12px; }
.link:hover { color: var(--brand-700); }
.muted { color: var(--text-muted); }

@media (max-width: 900px) {
  /* Fully off-canvas: the sidebar is var(--sidebar-w) (320px) wide plus its
     shadow, so a fixed -300px left a 20px strip over every page's edge. */
  /* The drawer opens under the top bar, so the bar no longer covers the DiaMind logo
     and name at the top of the menu and its menu button stays in reach (owner request 1405/08/04). */
  .sidebar { position: fixed; inset-inline-start: calc(-1 * var(--sidebar-w) - 24px); transition: inset-inline-start .25s ease; top: var(--topbar-h, 64px); height: auto; z-index: 45; }
  body.sidebar-open .sidebar { inset-inline-start: 0; }
  .main { margin-inline-start: 0; width: 100%; }
  .content { padding: 18px; }
  .topbar {
    padding: 0 16px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }
  .topbar::-webkit-scrollbar { display: none; }
  .search-key { display: none; }
  /* The bar scrolls sideways here, so its chips keep their full width
     instead of shrinking under the search box. */
  .topbar .search { flex: 1 0 180px; }
  .topbar-actions > * { flex-shrink: 0; }
  /* topbar-mobile-overflow.js keeps only the phone, call status and
     notifications here and moves the rest into «بیشتر»; the organization
     switcher floats under the bar while its own list is open. */
  .topbar-actions > .topbar-org-ctx.is-topbar-revealed {
    position: fixed;
    inset-block-start: calc(var(--topbar-h, 64px) + 4px);
    inset-inline-end: 16px;
    z-index: var(--z-popover, 80);
    max-width: calc(100vw - 32px);
  }
}
@media (max-width: 640px) {
  /* With the actions folded into «بیشتر» the search takes what is left
     instead of forcing the bar wider than the phone. */
  .topbar .search { flex: 1 1 auto; min-width: 0; }
}

/* ---------- New: Date pill in topbar ---------- */
.date-pill {
  flex: 0 0 auto;
  min-inline-size: max-content;
  padding: 6px 14px;
  background: linear-gradient(135deg, var(--brand-50), rgba(20,184,166,.08));
  border: 1px solid var(--brand-100);
  color: var(--brand-700);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
[data-theme="dark"] .date-pill {
  background: rgba(30,109,255,.12);
  border-color: rgba(108,177,255,.25);
  color: #8eb6ff;
}

/* ---------- New: Funnel visualization ---------- */
.funnel { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; }
.funnel-row {
  position: relative;
  border-radius: 10px;
  padding: 14px 16px;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: var(--shadow-sm);
}
.funnel-row .fnr-stage { font-weight: 600; }
.funnel-row .fnr-meta { font-size: 12px; opacity: .92; }
.funnel-row.f0 { background: linear-gradient(135deg, #1e6dff, #4e8eff); }
.funnel-row.f1 { background: linear-gradient(135deg, #2575e6, #5a96ff); width: 92%; align-self: flex-end; }
.funnel-row.f2 { background: linear-gradient(135deg, #2c80c4, #6ba0e8); width: 78%; align-self: flex-end; }
.funnel-row.f3 { background: linear-gradient(135deg, #1d8a8a, #3aaeb8); width: 60%; align-self: flex-end; }
.funnel-row.f4 { background: linear-gradient(135deg, #14b8a6, #4dd5c8); width: 46%; align-self: flex-end; }
.funnel-row.f5 { background: linear-gradient(135deg, #10b981, #34d399); width: 36%; align-self: flex-end; }

/* ---------- New: Channel list (rich card per channel) ---------- */
.channel-list { display: flex; flex-direction: column; gap: 12px; }
.channel-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 14px; align-items: center;
  padding: 14px;
  background: var(--surface-2);
  border-radius: 12px;
  border-inline-start: 4px solid var(--brand-500);
}
.channel-row.tone-green   { border-color: var(--green-500); }
.channel-row.tone-purple  { border-color: var(--purple-500); }
.channel-row.tone-amber   { border-color: var(--amber-500); }
.channel-row.tone-red     { border-color: var(--red-500); }
.channel-row.tone-blue    { border-color: var(--brand-500); }

.channel-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--surface);
  display: grid; place-items: center;
  font-size: 22px;
}
.channel-name { font-weight: 700; font-size: 14px; }
.channel-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.channel-stats {
  display: flex; gap: 14px;
  font-size: 11px; color: var(--text-muted);
  margin-top: 6px; flex-wrap: wrap;
}
.channel-stats b { color: var(--text); font-weight: 700; }

/* ---------- New: SWOT cards ---------- */
.swot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
}
.swot-col h5 {
  font-size: 11px; font-weight: 700; margin: 0 0 4px;
  display: inline-flex; align-items: center; gap: 4px;
}
.swot-col.strength h5 { color: var(--green-500); }
.swot-col.weak h5 { color: var(--red-500); }
.swot-col ul { margin: 0; padding-inline-start: 16px; font-size: 11px; line-height: 1.7; color: var(--text-muted); }

/* ---------- New: Marketing KPI grid ---------- */
.mk-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 1100px) { .mk-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .mk-grid { grid-template-columns: 1fr; } }
.mk-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.mk-label { font-size: 11px; color: var(--text-muted); }
.mk-value { font-size: 18px; font-weight: 700; margin: 4px 0 4px; letter-spacing: -.3px; }
.mk-delta { font-size: 11px; font-weight: 600; }
.mk-delta.green { color: var(--green-500); }
.mk-delta.amber { color: var(--amber-500); }
.mk-delta.red   { color: var(--red-500); }

/* ---------- Department summary cards (3-column, decorative) ---------- */
.dept-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 1100px) { .dept-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .dept-grid { grid-template-columns: 1fr; } }

.dept-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.dept-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--dept-accent, #2c7873);
  border-start-end-radius: 14px;
  border-end-end-radius: 14px;
}
.dept-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15,23,42,.06);
  border-color: var(--dept-accent, var(--brand-300));
}
.dept-blue   { --dept-accent: #1e6dff; --dept-soft: rgba(30,109,255,.10); }
.dept-green  { --dept-accent: #10b981; --dept-soft: rgba(16,185,129,.10); }
.dept-amber  { --dept-accent: #f59e0b; --dept-soft: rgba(245,158,11,.12); }
.dept-purple { --dept-accent: #8b5cf6; --dept-soft: rgba(139,92,246,.12); }
.dept-red    { --dept-accent: #ef4444; --dept-soft: rgba(239,68,68,.10); }
.dept-lemon  { --dept-accent: #d4a017; --dept-soft: rgba(212,160,23,.12); }

.dept-head {
  display: flex; align-items: center; gap: 10px;
}
.dept-icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--dept-soft, var(--brand-50));
  font-size: 18px;
  flex-shrink: 0;
}
.dept-meta { flex: 1; min-width: 0; }
.dept-name { font-weight: 700; font-size: 14px; color: var(--text-strong, #0f172a); }
.dept-count { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
[data-theme="dark"] .dept-name { color: #e2e8f0; }

.dept-bar {
  margin-top: 12px;
  height: 6px;
  border-radius: 3px;
  background: var(--brand-50, #f3f5fc);
  overflow: hidden;
}
.dept-bar > span {
  display: block;
  height: 100%;
  background: var(--dept-accent, var(--brand-500));
  border-radius: 3px;
  transition: width .6s cubic-bezier(.22,.7,.16,1);
}
[data-theme="dark"] .dept-bar { background: rgba(255,255,255,.06); }

.dept-trend {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
}
.dept-trend.muted { color: var(--text-muted); }
.dept-trend.green { color: var(--green-500); }

/* ---------- People mini cards (hot/newest people quick view) ---------- */
.person-card-mini {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 11px 12px 10px;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}
.person-card-mini::before {
  content: '';
  position: absolute;
  inset-block-start: 0; inset-inline-start: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--brand-500), var(--accent-500, #14b8a6));
  opacity: 0;
  transition: opacity .25s ease;
}
.person-card-mini:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(15,23,42,.07);
  border-color: var(--brand-300);
}
.person-card-mini:hover::before { opacity: 1; }

.person-mini-head {
  display: flex; align-items: center; gap: 9px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}
.person-mini-avatar { width: 36px; height: 36px; font-size: 11px; flex: 0 0 36px; }
.person-mini-info { flex: 1; min-width: 0; }
.person-mini-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-strong, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="dark"] .person-mini-name { color: #e2e8f0; }
.person-mini-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.person-mini-score {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  font-size: 12px;
  font-weight: 800;
  border-radius: 12px;
  white-space: nowrap;
}
.person-mini-score.score-green { background: rgba(16,185,129,.12); color: #059669; }
.person-mini-score.score-amber { background: rgba(245,158,11,.14); color: #d97706; }
.person-mini-score.score-red   { background: rgba(239,68,68,.12);  color: #dc2626; }
[data-theme="dark"] .person-mini-score.score-green { background: rgba(16,185,129,.20); color: #6ee7b7; }
[data-theme="dark"] .person-mini-score.score-amber { background: rgba(245,158,11,.22); color: #fbbf24; }
[data-theme="dark"] .person-mini-score.score-red   { background: rgba(239,68,68,.22);  color: #fca5a5; }

.person-mini-body { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); gap: 6px; }
.person-mini-fact { min-width: 0; gap: 7px; padding: 6px 7px; border-radius: 10px; background: var(--surface-soft, #f8fafc); }
.person-mini-fact-icon { width: 24px; height: 24px; flex: 0 0 24px; border-radius: 8px; display: grid; place-items: center; }
.person-mini-fact > span:last-child { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.person-mini-fact small { color: var(--text-muted); font-size: 9px; line-height: 1.3; }
.person-mini-fact b { color: var(--text); font-size: 10.5px; font-weight: 650; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-mini-segment { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; min-width: 0; }
.person-mini-segment .chip { max-width: calc(100% - 28px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-mini-segment > [data-ds-icon] { opacity: .68; transition: transform .2s ease, opacity .2s ease; }
.person-card-mini:hover .person-mini-segment > [data-ds-icon] { transform: translateX(-2px); opacity: 1; }
[data-theme="dark"] .person-mini-fact { background: rgba(148,163,184,.08); }

/* ---------- Donut wrapper (keeps chart perfectly circular) ---------- */
.donut-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}
.donut-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}
.dropout-row { align-items: center; }

/* ---------- New: Forecast chips ---------- */
.forecast-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) { .forecast-row { grid-template-columns: 1fr; } }
.forecast-card {
  padding: 18px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(30,109,255,.06), rgba(20,184,166,.06));
  border: 1px solid var(--brand-100);
}
[data-theme="dark"] .forecast-card {
  background: linear-gradient(135deg, rgba(30,109,255,.12), rgba(20,184,166,.10));
  border-color: rgba(108,177,255,.25);
}
.forecast-card h3 { margin: 0 0 6px; font-size: 14px; font-weight: 700; }
.forecast-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin: 12px 0; }
.forecast-grid > div .lab { font-size: 11px; color: var(--text-muted); }
.forecast-grid > div .val { font-size: 20px; font-weight: 700; letter-spacing: -.4px; }
.forecast-card ul { margin: 8px 0 0; padding-inline-start: 18px; font-size: 12px; color: var(--text-muted); line-height: 1.9; }

/* ---------- New: Report narrative ---------- */
.report-narrative h2 { font-size: 18px; margin: 0 0 12px; }
.report-narrative p { margin: 0 0 10px; font-size: 13px; line-height: 1.95; }
.report-narrative strong { color: var(--brand-600); }
[data-theme="dark"] .report-narrative strong { color: #8eb6ff; }
.report-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  border-inline-start: 4px solid var(--brand-500);
}
.report-stat.tone-green  { border-color: var(--green-500); }
.report-stat.tone-amber  { border-color: var(--amber-500); }
.report-stat.tone-red    { border-color: var(--red-500); }
.report-stat.tone-purple { border-color: var(--purple-500); }
.report-stat.tone-blue   { border-color: var(--brand-500); }
.report-stat .lab { font-size: 11px; color: var(--text-muted); }
.report-stat .val { font-size: 20px; font-weight: 700; margin-top: 4px; }

/* ---------- Filters chip-btn group ---------- */
.filters { display: flex; gap: 6px; flex-wrap: wrap; }

/* =============================================================
   CUSTOMER 360° TRACK DRAWER
   ============================================================= */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
  z-index: 100;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  inset-inline-start: 0;            /* RTL: pinned to right edge */
  top: 0; bottom: 0;
  width: min(840px, 96vw);
  background: var(--bg);
  border-inline-end: 1px solid var(--border);
  box-shadow: -24px 0 48px rgba(0,0,0,.18);
  /* In RTL the drawer sits on the right; push it OFF-SCREEN to the right */
  transform: translateX(105%);
  transition: transform .3s cubic-bezier(.22,.7,.16,1);
  display: flex; flex-direction: column;
  z-index: 101;
  overflow: hidden;
  visibility: hidden;
}
[dir="ltr"] .drawer { transform: translateX(-105%); box-shadow: 24px 0 48px rgba(0,0,0,.18); }
.drawer.open { transform: translateX(0); visibility: visible; }

/* Shared rich-drawer header recipe (see also .rui-drawer__head in ui-kit.css
   and .fq-drawer-top in quotes-module.css): gradient band + soft decorative
   orbs + frosted-glass badge + white text. Reused here via ::before/::after
   pseudo-orbs so no JS changes were needed for this specific drawer. */
.drawer-head {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; gap: 14px;
  padding: 22px 22px 20px;
  background: linear-gradient(155deg, #5b93d6 0%, #223a63 115%);
  flex-shrink: 0;
  color: #fff;
}
.drawer-head::before, .drawer-head::after {
  content: ''; position: absolute; border-radius: 50%; background: #fff; filter: blur(28px); pointer-events: none; z-index: -1;
}
.drawer-head::before { width: 160px; height: 160px; top: -70px; inset-inline-start: -45px; opacity: .16; }
.drawer-head::after { width: 110px; height: 110px; bottom: -55px; inset-inline-end: 40px; opacity: .12; }
.drawer-head .avatar {
  width: 50px; height: 50px; font-size: 15px; font-weight: 700; flex: none;
  background: rgba(255,255,255,.2); backdrop-filter: blur(6px); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.32), 0 8px 18px -8px rgba(0,0,0,.3);
}
.drawer-head h2 { font-size: 17px; font-weight: 800; margin: 0; color: #fff; }
.drawer-head .meta { font-size: 12px; color: rgba(255,255,255,.82); margin-top: 3px; }
.drawer-head .spacer { flex: 1; }
.drawer-close {
  width: 34px; height: 34px; flex: none;
  border-radius: 50%; border: none;
  background: rgba(255,255,255,.2); backdrop-filter: blur(6px); color: #fff;
  font-size: 15px; cursor: pointer; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.3);
  transition: background .15s, transform .2s;
}
.drawer-close:hover { background: rgba(255,255,255,.34); color: #fff; border-color: transparent; transform: rotate(90deg); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 32px;
  display: flex; flex-direction: column; gap: 16px;
}

/* Hero strip with chips */
.drawer-hero {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding-bottom: 8px;
}
.drawer-hero .chip { font-size: 12px; padding: 6px 12px; }

/* Big AI score circle */
.drawer-score-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(30,58,138,.08), rgba(212,160,23,.08));
  border: 1px solid var(--brand-100);
}
[data-theme="dark"] .drawer-score-row {
  background: linear-gradient(135deg, rgba(30,58,138,.20), rgba(212,160,23,.12));
  border-color: rgba(108,127,177,.25);
}
.score-ring {
  width: 110px; height: 110px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--green-500) calc(var(--p) * 1%), var(--surface-2) 0);
  position: relative;
}
.score-ring::before {
  content: '';
  position: absolute; inset: 8px;
  background: var(--surface);
  border-radius: 50%;
}
.score-ring .pct { position: relative; font-weight: 800; font-size: 22px; }
.score-ring .lbl { position: relative; font-size: 10px; color: var(--text-muted); margin-top: -2px; }

.drawer-score-info .row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.drawer-score-info .row .lab { color: var(--text-muted); }
.drawer-score-info .row .val { font-weight: 600; }

/* Diaco attribution showcase (POWER) */
.power-card {
  background: linear-gradient(135deg, var(--brand-700), var(--brand-500));
  color: #fff;
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
/* Also prevent shrink on sibling drawer sections inside flex column parent */
.drawer-body > .dsec, .drawer-body > .drawer-hero, .drawer-body > .drawer-score-row { flex-shrink: 0; }
.power-card::after {
  content: '';
  position: absolute;
  inset-inline-end: -40px; top: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-500), transparent 70%);
  opacity: .25;
}
.power-card h3 {
  margin: 0 0 6px;
  font-size: 14px; opacity: .85; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.power-card .big {
  font-size: 42px; font-weight: 800; letter-spacing: -1px;
  color: var(--accent-500);
  display: flex; align-items: baseline; gap: 6px;
}
.power-card .big small { font-size: 14px; color: #fff; opacity: .85; font-weight: 500; }
.power-card p { margin: 6px 0 14px; font-size: 13px; opacity: .92; }
.power-bars { display: flex; flex-direction: column; gap: 8px; }
.power-bar {
  background: rgba(255,255,255,.08);
  border-radius: 8px; padding: 8px 12px;
  display: grid; grid-template-columns: 1fr auto; gap: 12px;
  font-size: 12px;
  position: relative;
  overflow: hidden;
}
.power-bar::before {
  content: '';
  position: absolute; top: 0; bottom: 0;
  inset-inline-start: 0;
  width: var(--w);
  background: linear-gradient(90deg, var(--accent-500), rgba(212,160,23,.2));
  opacity: .25;
  z-index: 0;
}
.power-bar .src, .power-bar .pct { position: relative; z-index: 1; }
.power-bar .pct { font-weight: 700; color: var(--accent-500); }

/* Section block in drawer */
.dsec {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.dsec h4 {
  margin: 0 0 12px;
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.dsec h4 .count { color: var(--text-muted); font-weight: 500; font-size: 11px; }
.dsec .row {
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.dsec .row:last-child { border-bottom: none; }
.dsec .row .when { font-size: 11px; color: var(--text-muted); }

/* Roadmap */
.roadmap-list { display: flex; flex-direction: column; gap: 10px; }
.roadmap-step {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: 10px;
  border-inline-start: 3px solid var(--brand-500);
}
.roadmap-step.done { opacity: .6; border-color: var(--green-500); }
.roadmap-step .num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand-500); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
}
.roadmap-step.done .num { background: var(--green-500); }
.roadmap-step .act { font-weight: 600; font-size: 13px; }
.roadmap-step .when { font-size: 11px; color: var(--text-muted); }
.roadmap-step .priority {
  align-self: center;
  font-size: 10px; padding: 3px 8px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
}

/* Auto/manual badge for messages */
.tag-auto, .tag-manual {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 600; margin-inline-end: 6px;
}
.tag-auto   { background: rgba(20,184,166,.15); color: var(--accent-600); }
.tag-manual { background: rgba(139,92,246,.15); color: #8b5cf6; }
[data-theme="dark"] .tag-auto   { color: #5ee0d3; }

/* Customer table — clickable rows */
.customers-clickable tbody tr { cursor: pointer; }
.customers-clickable tbody tr:hover { background: linear-gradient(90deg, rgba(30,58,138,.08), transparent); }
.type-pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.type-pill.مشتری سازمانی          { background: rgba(16,185,129,.15); color: var(--green-500); }
.type-pill.گرم            { background: rgba(245,158,11,.18); color: var(--amber-500); }
.type-pill.ناشناس         { background: rgba(148,163,184,.18); color: var(--text-muted); }
[data-theme="dark"] .type-pill.مشتری سازمانی { color: #34d399; }

/* Transcript (collapsible) */
.transcript {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
  margin-top: 0;
}
.transcript.open {
  max-height: 1200px;
  margin-top: 10px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: 10px;
}

/* Journey call row (clickable card with transcript) */
.journey-call-row {
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
  transition: background .15s ease;
  border-radius: 8px;
}
.journey-call-row.has-transcript { cursor: pointer; }
.journey-call-row.has-transcript:hover {
  background: var(--surface-2);
  padding-inline: 10px;
  margin-inline: -10px;
}
.journey-call-row.expanded {
  background: var(--surface-2);
  padding: 12px 10px;
  margin-inline: -10px;
  border-bottom-color: transparent;
}
.journey-call-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.jc-toggle {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-500);
  background: rgba(160, 32, 240, .08);
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .15s ease;
}
.journey-call-row.has-transcript:hover .jc-toggle { background: rgba(160, 32, 240, .16); }
.jc-toggle.muted { color: var(--text-muted); background: transparent; }

/* Collapsible wrapper for bubble transcript (uses .call-detail / .msg-* like advisors page) */
.journey-transcript-wrap {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s ease;
}
.journey-transcript-wrap.open {
  max-height: 2000px;
  margin-top: 8px;
}
.journey-transcript-wrap .call-detail {
  padding: 12px;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.journey-transcript-wrap .call-transcript {
  max-height: none;
  padding: 4px 0;
}

.t-line {
  padding: 6px 0;
  font-size: 12px;
  line-height: 1.85;
}
.t-line .t-speaker {
  font-weight: 700;
  font-size: 11px;
  display: block;
  margin-bottom: 2px;
}
.t-line.advisor .t-speaker { color: var(--brand-500); }
.t-line.customer .t-speaker { color: var(--accent-600); }
.t-line.ai {
  background: linear-gradient(135deg, rgba(139,92,246,.10), rgba(139,92,246,.02));
  border-inline-start: 3px solid #8b5cf6;
  padding: 8px 10px;
  border-radius: 6px;
  margin-top: 8px;
}
.t-line.ai .t-speaker { color: #8b5cf6; }
.t-line.ai .t-text { font-style: italic; font-size: 11px; }

/* Content Journey track */
.journey-track {
  display: flex; flex-direction: column; gap: 4px;
  position: relative;
  padding-inline-start: 8px;
}
.journey-step {
  display: grid;
  grid-template-columns: 60px 24px 1fr;
  gap: 8px;
  align-items: stretch;
  position: relative;
  min-height: 48px;
}
.journey-step .js-day {
  font-size: 10px;
  color: var(--text-muted);
  align-self: center;
  text-align: center;
  padding: 4px 6px;
  background: var(--surface-2);
  border-radius: 6px;
  font-weight: 600;
}
.journey-step .js-line {
  position: relative;
  display: flex; justify-content: center;
}
.journey-step .js-line::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}
.journey-step .js-line::after {
  content: '';
  position: relative;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--brand-500);
  align-self: center;
  z-index: 1;
}
.journey-step.success .js-line::after { border-color: var(--green-500); background: var(--green-500); }
.journey-step.partial .js-line::after { border-color: var(--amber-500); }
.journey-step.fail    .js-line::after { border-color: var(--red-500); }
.journey-step:first-child .js-line::before { top: 50%; }
.journey-step:last-child .js-line::before  { bottom: 50%; }
.journey-step .js-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  align-self: center;
}

/* Score-pill green class for green status */
[data-theme="dark"] .green-50 { background: rgba(16,185,129,.15); }
.dsec .row .green-50, .green-50 { background: var(--green-50); padding: 8px 10px; border-radius: 6px; }

@media (max-width: 600px) {
  .drawer { width: 100vw; }
  .drawer-body { padding: 14px; }
}

/* =============================================================
   EXECUTIVE DASHBOARD
   ============================================================= */

/* CEO Hero Banner */
.ceo-hero {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(184,212,241,.4), rgba(221,214,254,.4) 50%, rgba(255,228,204,.35)),
    var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.ceo-hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 90% 10%, rgba(244,162,97,.18), transparent 40%),
    radial-gradient(circle at 10% 90%, rgba(111,185,143,.15), transparent 40%);
}
.ceo-hero-content {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  align-items: center;
  margin-bottom: 22px;
}
.ceo-platform-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700;
  padding: 5px 12px;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
  color: #fff;
  border-radius: 999px;
  letter-spacing: .2px;
  box-shadow: 0 4px 12px rgba(44, 120, 115, .3);
  margin-bottom: 12px;
  animation: floatSmall 3s ease-in-out infinite;
  background-size: 200% 200%;
  background-position: 0% 50%;
}
.ceo-platform-tag:hover { animation: gradientFlow 2s linear infinite; }

.ceo-greeting h1 {
  margin: 8px 0 6px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.8px;
}
.ceo-greeting p { margin: 0 0 4px; font-size: 14px; color: var(--text); }
.ceo-status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  box-shadow: var(--shadow-xs);
}
.ceo-status-pill .status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green-500);
  box-shadow: 0 0 0 0 var(--green-500);
  animation: pulseGlow 2.5s infinite;
}
.ceo-status-pill.status-amber .status-dot { background: var(--amber-500); }
.ceo-status-pill.status-red   .status-dot { background: var(--red-500); }

/* =============================================================
   HEALTH ORB — Modern concentric rings (Apple-watch style)
   ============================================================= */
.health-orb {
  position: relative;
  width: 240px; height: 240px;
  display: grid; place-items: center;
  flex-shrink: 0;
  filter: drop-shadow(0 18px 40px rgba(44, 120, 115, .22));
  animation: breathe 5s ease-in-out infinite;
}
.health-svg {
  width: 100%; height: 100%;
  transform: rotate(0deg);
}
.orb-track {
  stroke: rgba(15, 23, 42, .06);
  fill: none;
}
[data-theme="dark"] .orb-track { stroke: rgba(255, 255, 255, .08); }
.orb-arc { fill: none; }
.orb-arc-1 {
  stroke-dasharray: 578;
  stroke-dashoffset: 578;
  animation: orbDraw1 2.6s cubic-bezier(.25, .1, .25, 1) .35s forwards;
}
.orb-arc-2 {
  stroke-dasharray: 452;
  stroke-dashoffset: 452;
  animation: orbDraw2 2.8s cubic-bezier(.25, .1, .25, 1) .60s forwards;
}
.orb-arc-3 {
  stroke-dasharray: 339;
  stroke-dashoffset: 339;
  animation: orbDraw3 3.0s cubic-bezier(.25, .1, .25, 1) .85s forwards;
}
/* targets: c - c*p/100  →  arc-1: 578*0.14=80.92, arc-2: 452*0.22=99.44, arc-3: 339*0.08=27.12 */
@keyframes orbDraw1 { from { stroke-dashoffset: 578; } to { stroke-dashoffset: 80.92; } }
@keyframes orbDraw2 { from { stroke-dashoffset: 452; } to { stroke-dashoffset: 99.44; } }
@keyframes orbDraw3 { from { stroke-dashoffset: 339; } to { stroke-dashoffset: 27.12; } }

.health-orb-center {
  position: absolute;
  inset: 0;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  pointer-events: none;
}
.health-orb-pct {
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -2px;
  background: linear-gradient(135deg, #2c7873 0%, #6fb98f 50%, #f4a261 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.health-orb-pct small {
  font-size: 22px;
  margin-inline-start: 3px;
  -webkit-text-fill-color: var(--text-muted);
  color: var(--text-muted);
  font-weight: 700;
}
.health-orb-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: -.2px;
}

/* Floating sparkles around orb */
.orb-spark {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, var(--accent-500) 60%, transparent 100%);
  box-shadow: 0 0 12px var(--accent-500);
  pointer-events: none;
  animation: sparkFloat 4s ease-in-out infinite;
}
.orb-spark.s1 { top: 8%;  left: 12%; animation-delay: 0s;   background: radial-gradient(circle, #fff, #6fb98f, transparent); box-shadow: 0 0 12px #6fb98f; }
.orb-spark.s2 { top: 18%; right: 8%; animation-delay: .8s;  background: radial-gradient(circle, #fff, #2c7873, transparent); box-shadow: 0 0 12px #2c7873; }
.orb-spark.s3 { bottom: 14%; left: 10%; animation-delay: 1.6s; background: radial-gradient(circle, #fff, #14b8a6, transparent); box-shadow: 0 0 12px #14b8a6; }
.orb-spark.s4 { bottom: 8%;  right: 18%; animation-delay: 2.4s; background: radial-gradient(circle, #fff, #f4a261, transparent); box-shadow: 0 0 12px #f4a261; }
@keyframes sparkFloat {
  0%, 100% { transform: translateY(0)    scale(1);   opacity: .85; }
  25%      { transform: translateY(-8px) scale(1.3); opacity: 1;   }
  50%      { transform: translateY(0)    scale(.85); opacity: .6;  }
  75%      { transform: translateY(8px)  scale(1.15);opacity: .9;  }
}

/* Mini legend below orb (in normal flow, not absolute) */
.health-orb {
  margin-bottom: 8px;
}
.orb-legend {
  position: absolute;
  bottom: -8px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 14px;
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  background: transparent;
}
.orb-leg { display: inline-flex; align-items: center; gap: 4px; }
.orb-leg i {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
}

/* (legacy mood-ring kept for fallback) */
.mood-ring {
  width: 170px; height: 170px;
  border-radius: 50%;
  background: conic-gradient(
    from -90deg,
    #6dbf8f 0%,
    #2c7873 calc(var(--p) * 0.5%),
    #6fb98f calc(var(--p) * 0.85%),
    #f4a261 calc(var(--p) * 1%),
    rgba(220, 226, 240, .6) calc(var(--p) * 1%),
    rgba(220, 226, 240, .6) 100%
  );
  display: grid; place-items: center;
  position: relative;
  animation: breathe 4s ease-in-out infinite;
  box-shadow:
    0 18px 40px rgba(44, 120, 115, .18),
    inset 0 0 0 1px rgba(255, 255, 255, .6);
  flex-shrink: 0;
}
.mood-ring::before {
  content: '';
  position: absolute; inset: 14px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow:
    inset 0 2px 8px rgba(15, 23, 42, .06),
    0 0 0 4px rgba(255, 255, 255, .9);
}
.mood-ring::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  top: 4px; left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--accent-500);
  box-shadow: 0 0 0 4px var(--surface), 0 4px 10px rgba(244, 162, 97, .4);
  z-index: 2;
}
.mood-pct {
  position: relative;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1;
  background: linear-gradient(135deg, #2c7873 0%, #6fb98f 50%, #f4a261 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  z-index: 1;
}
.mood-pct::after {
  content: '٪';
  font-size: 18px;
  margin-inline-start: 2px;
  -webkit-text-fill-color: var(--text-muted);
  color: var(--text-muted);
  font-weight: 600;
}
.mood-lbl {
  position: relative;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 600;
  letter-spacing: -.2px;
  z-index: 1;
  white-space: nowrap;
}

.ceo-priorities-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}
.ceo-priorities-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.ceo-priorities-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}
.ceo-priorities-head p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.7;
}
.ceo-priorities-count {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.72);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 800;
}
.ceo-hero-priorities {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}
@media (max-width: 1100px) { .ceo-hero-priorities { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px)  {
  .ceo-priorities-head { align-items: flex-start; flex-direction: column; }
  .ceo-hero-priorities { grid-template-columns: 1fr; }
}

.priority-card {
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  position: relative;
  overflow: hidden;
  transition: transform .25s cubic-bezier(.22,.7,.16,1);
}
.priority-card:hover { transform: translateY(-3px); }
.priority-card::before {
  content: '';
  position: absolute;
  top: 0; inset-inline-start: 0;
  width: 100%; height: 3px;
}
.priority-red::before    { background: linear-gradient(90deg, var(--red-500), var(--accent-500)); }
.priority-amber::before  { background: linear-gradient(90deg, var(--amber-500), var(--accent-500)); }
.priority-blue::before   { background: linear-gradient(90deg, var(--brand-500), var(--purple-500)); }

.prio-tag {
  display: inline-block; padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px; font-weight: 700;
  margin-bottom: 6px;
}
.priority-red .prio-tag    { background: var(--pastel-rose); color: #b14458; }
.priority-amber .prio-tag  { background: var(--pastel-peach); color: #c46920; }
.priority-blue .prio-tag   { background: var(--pastel-sky); color: #3b5998; }
.prio-title { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.prio-why { font-size: 11px; color: var(--text-muted); line-height: 1.7; }

/* Today's Pulse — DS tiles (#icons) + soft KPI tint; no emoji / side-bars */
.today-pulse {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}
@media (max-width: 1200px) { .today-pulse { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px)  { .today-pulse { grid-template-columns: repeat(2, 1fr); } }
.pulse-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 14px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-xs, none);
  transition: transform .2s ease, background .2s ease, border-color .2s ease;
  cursor: default;
  user-select: none;
  min-width: 0;
}
.pulse-cell:hover { transform: translateY(-2px); background: var(--surface-2); }
.pulse-cell.level-green {
  background: linear-gradient(135deg, var(--surface) 55%, rgba(184, 230, 211, .40) 100%);
}
.pulse-cell.level-amber {
  background: linear-gradient(135deg, var(--surface) 55%, rgba(255, 228, 204, .45) 100%);
}
.pulse-cell.level-red {
  background: linear-gradient(135deg, var(--surface) 55%, rgba(245, 194, 199, .35) 100%);
}
.pulse-cell > .ds-ico-tile {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  flex-shrink: 0;
}
.pulse-cell > .ds-ico-tile .ds-ico { width: 20px; height: 20px; }
.pulse-cell.level-green .pulse-value { color: #0e8a5e; }
.pulse-cell.level-amber .pulse-value { color: #b27512; }
.pulse-cell.level-red   .pulse-value { color: #b14458; }
.pulse-info {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px;
  min-width: 0; width: 100%;
}
.pulse-label {
  font-size: 11px; color: var(--text-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.pulse-value { font-size: 19px; font-weight: 700; letter-spacing: -.4px; line-height: 1.15; }
.pulse-target {
  font-size: 11px; color: var(--text-muted);
  display: inline-flex; flex-wrap: wrap; gap: 4px 6px;
  align-items: center; justify-content: center;
  line-height: 1.3;
}
.pulse-pct.up   { color: #2f8a5e; font-weight: 700; white-space: nowrap; }
.pulse-pct.down { color: #b14458; font-weight: 700; white-space: nowrap; }

/* Goals */
.goals-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .goals-grid { grid-template-columns: 1fr; } }
.goal-item {
  display: grid; grid-template-columns: 56px 1fr; gap: 14px;
  align-items: center;
  padding: 12px;
  background: var(--surface-2);
  border-radius: 12px;
  transition: transform .2s ease;
}
.goal-item:hover { transform: translateY(-2px); }
.goal-ring {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0);
  display: grid; place-items: center;
  position: relative;
}
.goal-ring::before {
  content: '';
  position: absolute; inset: 5px;
  background: var(--surface);
  border-radius: 50%;
}
.goal-ring span {
  position: relative;
  font-size: 11px; font-weight: 700;
}
.goal-name { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.goal-progress { font-size: 13px; }
.goal-progress strong { font-size: 14px; letter-spacing: -.3px; }

/* Smart Alerts */
.alerts-list { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; padding-inline-end: 4px; }
.alerts-list::-webkit-scrollbar { width: 6px; }
.alerts-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.alert {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: 12px;
  transition: transform .2s ease, background .2s ease;
}
.alert:hover { transform: translateX(-2px); }
[dir="rtl"] .alert:hover { transform: translateX(2px); }
.alert-dot {
  width: 10px; height: 10px; border-radius: 50%;
  align-self: flex-start; margin-top: 6px;
  position: relative;
}
.alert-red    .alert-dot { background: var(--red-500); animation: pulseGlow 2s infinite; }
.alert-amber  .alert-dot { background: var(--amber-500); }
.alert-green  .alert-dot { background: var(--green-500); }
.alert-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.alert-detail { font-size: 11px; color: var(--text-muted); line-height: 1.6; }
.alert-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 11px; font-weight: 600; color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s ease;
}
.alert-btn:hover { background: var(--brand-500); color: #fff; border-color: var(--brand-500); }

/* VIP / Hot list (top customers / hot leads) */
.vip-list { display: flex; flex-direction: column; gap: 8px; }
.vip-row {
  display: grid;
  grid-template-columns: 24px 36px 1fr auto;
  gap: 10px; align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  transition: background .2s ease;
}
.vip-row:hover { background: var(--surface-2); }
.vip-rank {
  font-weight: 800;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}
.vip-row:nth-child(1) .vip-rank { color: var(--accent-500); font-size: 16px; }
.vip-info { min-width: 0; }
.vip-name { font-weight: 600; font-size: 13px; }
.vip-meta { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vip-value { font-weight: 700; font-size: 13px; color: var(--brand-500); }
.vip-score {
  font-weight: 800;
  font-size: 14px;
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
}
.vip-score.score-green { background: var(--pastel-mint); color: #2f8a5e; }
.vip-score.score-amber { background: var(--pastel-peach); color: #c46920; }
.vip-score.score-red   { background: var(--pastel-rose); color: #b14458; }

/* Live Feed */
.live-feed-card { display: flex; flex-direction: column; }
.live-feed {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 380px; overflow-y: auto;
  padding-inline-end: 4px;
}
.live-feed::-webkit-scrollbar { width: 6px; }
.live-feed::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.live-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--green-500);
  animation: pulseGlow 1.8s infinite;
}
.live-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  border-inline-start: 3px solid transparent;
  animation: slideUp .4s cubic-bezier(.22,.7,.16,1) both;
}
.live-green  { border-color: var(--green-500); }
.live-blue   { border-color: var(--brand-500); }
.live-amber  { border-color: var(--amber-500); }
.live-red    { border-color: var(--red-500); }
.live-purple { border-color: var(--purple-500); }
.live-icon {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.live-icon.ds-ico-tile .ds-ico { width: 18px; height: 18px; }
.live-text  { font-size: 12px; font-weight: 600; }
.live-detail{ font-size: 10px; color: var(--text-muted); }
.live-time  { font-size: 10px; color: var(--text-muted); white-space: nowrap; }

/* External Accounts grid (Google Ads / GA4 / GTM / SC / Meta / Hotjar / Mailerlite) */
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  transition: transform .25s ease, box-shadow .25s ease;
}
.account-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.account-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}
.account-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 18px;
  background: var(--pastel-sky);
  color: var(--brand-700);
  flex-shrink: 0;
}
.account-amber  .account-icon { background: var(--pastel-peach); color: #c46920; }
.account-blue   .account-icon { background: var(--pastel-sky);   color: var(--brand-700); }
.account-purple .account-icon { background: var(--pastel-lilac); color: #6d50d4; }
.account-green  .account-icon { background: var(--pastel-mint);  color: #2f8a5e; }
.account-red    .account-icon { background: var(--pastel-rose);  color: #b14458; }
.account-name { font-weight: 700; font-size: 14px; }
.account-meta { font-size: 11px; color: var(--text-muted); font-family: monospace; }

.account-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.account-stat {
  display: flex; justify-content: space-between;
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 11px;
}
.account-stat strong { font-weight: 700; }

/* ======= 2-column channel list (fix for empty space) ======= */
.channel-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 1100px) {
  .channel-list { grid-template-columns: 1fr; }
}

/* =========================================================
   ADVISORS · Last 10 Calls (AI tags + transcript)
   ========================================================= */
.calls-table .chip { white-space: nowrap; }
.calls-table tbody tr.call-row { cursor: pointer; transition: background-color .15s ease; }
.calls-table tbody tr.call-row:hover { background: var(--hover-bg, rgba(30,109,255,.04)); }
.calls-table tbody tr.call-row.expanded {
  background: var(--hover-bg, rgba(30,109,255,.06));
  box-shadow: inset 3px 0 0 var(--brand, #1e6dff);
}

.calls-table .mono-num {
  font-family: 'Vazirmatn', monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: .3px;
  font-weight: 600;
  color: var(--text-strong, #0f172a);
}

.call-person {
  display: flex; align-items: center; gap: 10px;
}
.call-person-name { font-weight: 600; color: var(--text-strong, #0f172a); }
.call-person-meta { font-size: .78rem; color: var(--text-muted, #64748b); margin-top: 2px; }

[data-theme="dark"] .calls-table .mono-num,
[data-theme="dark"] .call-person-name { color: #e2e8f0; }
[data-theme="dark"] .call-person-meta { color: #94a3b8; }

/* AI tag pills */
.tag-ai-row { display: flex; flex-wrap: wrap; gap: 4px; max-width: 280px; }
.tag-ai {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  font-size: .72rem; font-weight: 600;
  line-height: 1.6;
  background: linear-gradient(135deg, rgba(139,92,246,.12), rgba(30,109,255,.12));
  color: #6d50d4;
  border: 1px solid rgba(139,92,246,.25);
  border-radius: 999px;
  white-space: nowrap;
}
.tag-ai::before {
  content: '✦';
  margin-left: 4px;
  font-size: .68rem;
  opacity: .7;
}
[data-theme="dark"] .tag-ai {
  background: linear-gradient(135deg, rgba(139,92,246,.18), rgba(30,109,255,.18));
  color: #c4b5fd;
  border-color: rgba(139,92,246,.35);
}

/* Expandable transcript row */
.call-detail-row { display: none; }
.call-detail-row.open { display: table-row; }
.call-detail-row td {
  background: var(--surface-2, #f8fafc);
  padding: 0 !important;
  border-top: none !important;
}
[data-theme="dark"] .call-detail-row td { background: rgba(15,23,42,.6); }

.call-detail {
  padding: 16px 20px 20px;
  animation: callDetailIn .25s ease;
}
@keyframes callDetailIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.call-summary {
  position: relative;
  background:
    linear-gradient(135deg, rgba(160,32,240,.10), rgba(96,165,250,.08) 50%, rgba(16,185,129,.08));
  border: 1px solid rgba(160,32,240,.18);
  border-inline-end: 3px solid #a020f0;
  padding: 12px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
  font-size: .9rem;
  line-height: 1.85;
  color: var(--text-strong, #0f172a);
  box-shadow: 0 6px 20px -14px rgba(160,32,240,.4);
  animation: msgSummaryIn .5s cubic-bezier(.2,.7,.3,1.1) both;
}
.call-summary::before {
  content: '✦ خلاصه دیاکو';
  display: block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .3px;
  color: #7e22ce;
  margin-bottom: 4px;
}
@keyframes msgSummaryIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
[data-theme="dark"] .call-summary { color: #e2e8f0; }

.call-transcript {
  display: flex; flex-direction: column; gap: 14px;
  max-height: 460px;
  overflow-y: auto;
  padding: 6px 4px 10px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(160,32,240,.3) transparent;
}
.call-transcript::-webkit-scrollbar { width: 6px; }
.call-transcript::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(160,32,240,.35), rgba(96,165,250,.25));
  border-radius: 999px;
}

.msg {
  position: relative;
  display: flex; flex-direction: column;
  max-width: 76%;
  padding: 10px 14px 11px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.85;
  box-shadow: 0 4px 14px -8px rgba(0,0,0,.18), 0 1px 2px rgba(0,0,0,.04);
  border: 1px solid transparent;
  transition: transform .18s ease, box-shadow .22s ease;
  animation: msgPop .42s cubic-bezier(.2,.7,.3,1.25) both;
  animation-delay: calc(var(--msg-i, 0) * 70ms);
  word-break: break-word;
}
.msg:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -10px rgba(0,0,0,.22), 0 1px 3px rgba(0,0,0,.06);
}
@keyframes msgPop {
  0%   { opacity: 0; transform: translateY(10px) scale(.92); }
  60%  { opacity: 1; transform: translateY(-2px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.msg-name {
  font-size: 11px;
  font-weight: 700;
  opacity: .95;
  margin-bottom: 5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}
.msg-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border-radius: 999px;
  background: rgba(255,255,255,.75);
  color: inherit;
  font-size: 10px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px currentColor;
  flex-shrink: 0;
}
.msg-sys-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #a020f0, #60a5fa);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  flex-shrink: 0;
  animation: msgSysSpin 6s linear infinite;
}
@keyframes msgSysSpin {
  to { transform: rotate(360deg); }
}
.msg-text {
  white-space: pre-wrap;
  font-weight: 500;
}

/* Advisor bubble — blue */
.msg-advisor {
  align-self: flex-start;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 70%, #bfdbfe 100%);
  color: #1e3a8a;
  border-color: rgba(30,109,255,.18);
  border-bottom-right-radius: 4px;
}
.msg-advisor::after {
  content: '';
  position: absolute;
  bottom: -1px; inset-inline-end: -7px;
  width: 14px; height: 14px;
  background: inherit;
  border-inline-end: 1px solid rgba(30,109,255,.18);
  border-bottom: 1px solid rgba(30,109,255,.18);
  border-bottom-right-radius: 14px;
  -webkit-mask: radial-gradient(circle 14px at 0 0, transparent 14px, #000 14.5px);
          mask: radial-gradient(circle 14px at 0 0, transparent 14px, #000 14.5px);
}
.msg-advisor .msg-avatar { color: #1e40af; background: rgba(255,255,255,.85); }

/* Customer/other bubble — mint/green */
.msg-other {
  align-self: flex-end;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 70%, #a7f3d0 100%);
  color: #064e3b;
  border-color: rgba(16,185,129,.20);
  border-bottom-left-radius: 4px;
}
.msg-other::after {
  content: '';
  position: absolute;
  bottom: -1px; inset-inline-start: -7px;
  width: 14px; height: 14px;
  background: inherit;
  border-inline-start: 1px solid rgba(16,185,129,.20);
  border-bottom: 1px solid rgba(16,185,129,.20);
  border-bottom-left-radius: 14px;
  -webkit-mask: radial-gradient(circle 14px at 100% 0, transparent 14px, #000 14.5px);
          mask: radial-gradient(circle 14px at 100% 0, transparent 14px, #000 14.5px);
}
.msg-other .msg-avatar { color: #065f46; background: rgba(255,255,255,.85); }

/* System bubble — center, dashed pill */
.msg-system {
  align-self: center;
  background: linear-gradient(135deg, rgba(160,32,240,.10), rgba(96,165,250,.08));
  color: #4b5563;
  font-size: 12px;
  font-style: italic;
  border-radius: 999px;
  padding: 7px 18px;
  border: 1px dashed rgba(160,32,240,.34);
  box-shadow: none;
  max-width: 86%;
  text-align: center;
}
.msg-system::after { display: none; }
.msg-system .msg-name { opacity: 1; color: #6d28d9; margin-bottom: 3px; justify-content: center; }
.msg-system .msg-text { font-weight: 500; }

/* Dark theme overrides */
[data-theme="dark"] .msg-advisor {
  background: linear-gradient(135deg, rgba(59,130,246,.20), rgba(59,130,246,.10));
  color: #93c5fd;
  border-color: rgba(59,130,246,.28);
}
[data-theme="dark"] .msg-other {
  background: linear-gradient(135deg, rgba(16,185,129,.20), rgba(16,185,129,.10));
  color: #6ee7b7;
  border-color: rgba(16,185,129,.32);
}
[data-theme="dark"] .msg-system {
  background: rgba(160,32,240,.12);
  color: #cbd5e1;
  border-color: rgba(160,32,240,.4);
}
[data-theme="dark"] .msg-advisor .msg-avatar,
[data-theme="dark"] .msg-other   .msg-avatar { background: rgba(0,0,0,.25); }
[data-theme="dark"] .call-summary {
  background: linear-gradient(135deg, rgba(160,32,240,.18), rgba(96,165,250,.10));
  border-color: rgba(160,32,240,.30);
}

/* =========================================================
   ADVISORS · Hourly heatmap (day x hour)
   ========================================================= */
.hour-heatmap {
  display: grid;
  grid-template-columns: 70px repeat(12, 1fr);
  gap: 4px;
  margin-top: 10px;
  direction: rtl;
}
.hour-heatmap .hh-corner { }
.hour-heatmap .hh-hour {
  font-size: .7rem;
  text-align: center;
  color: var(--text-muted, #64748b);
  font-weight: 600;
  padding: 2px 0;
}
.hour-heatmap .hh-day {
  font-size: .78rem;
  color: var(--text-strong, #0f172a);
  font-weight: 600;
  display: flex; align-items: center;
  padding-left: 8px;
}
[data-theme="dark"] .hour-heatmap .hh-day { color: #e2e8f0; }

.hh-cell {
  height: 26px;
  border-radius: 6px;
  background: var(--pastel-sky, #e0e7ff);
  transition: transform .15s ease;
}
.hh-cell:hover { transform: scale(1.12); cursor: pointer; }
.hh-l0 { background: rgba(148,163,184,.15); }
.hh-l1 { background: rgba(30,109,255,.18); }
.hh-l2 { background: rgba(30,109,255,.38); }
.hh-l3 { background: rgba(30,109,255,.62); }
.hh-l4 { background: rgba(30,109,255,.92); }

[data-theme="dark"] .hh-l0 { background: rgba(148,163,184,.10); }
[data-theme="dark"] .hh-l1 { background: rgba(59,130,246,.22); }
[data-theme="dark"] .hh-l2 { background: rgba(59,130,246,.42); }
[data-theme="dark"] .hh-l3 { background: rgba(59,130,246,.66); }
[data-theme="dark"] .hh-l4 { background: rgba(59,130,246,.95); }

@media (max-width: 700px) {
  .hour-heatmap { grid-template-columns: 56px repeat(12, 1fr); }
  .hh-cell { height: 18px; }
  .tag-ai-row { max-width: 200px; }
}

/* Advisor + customer name links (in tables / lists / call cards) */
.advisor-link,
.customer-link {
  color: var(--brand-700);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: border-color .15s ease, color .15s ease;
  cursor: pointer;
}
.advisor-link:hover,
.customer-link:hover {
  color: var(--brand-500);
  border-bottom-color: var(--brand-500);
}

/* =========================================================
   Advisor Roster (clickable cards in #advisors page)
   ========================================================= */
.advisor-roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-top: 4px;
}
.roster-card {
  position: relative;
  display: block;
  padding: 16px 16px 14px;
  background: var(--surface-2);
  border-radius: 16px;
  border: 1px solid var(--border);
  text-decoration: none; color: inherit;
  transition: transform .2s ease, box-shadow .25s ease, border-color .2s ease;
  cursor: pointer;
  overflow: hidden;
}
.roster-card::before {
  content: '';
  position: absolute; inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand-500), transparent);
}
.roster-card.tier-gold::before   { background: linear-gradient(90deg, #f4b942, #ffe199); }
.roster-card.tier-silver::before { background: linear-gradient(90deg, #94a3b8, #cbd5e1); }
.roster-card.tier-bronze::before { background: linear-gradient(90deg, #c08457, #e2b07c); }
.roster-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(15,23,42,.10);
  border-color: var(--brand-300);
}
.roster-tier {
  position: absolute;
  top: 12px;
  inset-inline-start: 14px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .2px;
}
.roster-top {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}
.roster-avatar {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 18px;
  background: var(--surface);
  color: var(--brand-700);
  box-shadow: inset 0 0 0 1px var(--border);
}
.roster-avatar.tier-gold   { background: linear-gradient(135deg, #fff6d8, #ffdd83); color: #8c6a1e; }
.roster-avatar.tier-silver { background: linear-gradient(135deg, #f1f5f9, #cbd5e1); color: #475569; }
.roster-avatar.tier-bronze { background: linear-gradient(135deg, #f5e3d1, #e2b07c); color: #7a4a25; }
.roster-headline { min-width: 0; }
.roster-name { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.roster-role { font-size: 11px; color: var(--text-muted); }
.roster-score-wrap { text-align: center; }
.roster-score-num { margin-bottom: 2px; }
.roster-score-lbl { font-size: 10px; color: var(--text-muted); }
.roster-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.roster-tag {
  font-size: 10.5px;
  padding: 3px 9px;
  background: var(--surface);
  color: var(--brand-700);
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid var(--border);
}
.roster-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.roster-stat { text-align: center; }
.rs-num { font-weight: 700; font-size: 13px; letter-spacing: -.3px; }
.rs-lbl { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.roster-cta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--brand-700);
}
.roster-card:hover .roster-cta { background: var(--brand-soft); }
.roster-actions { margin-top: 10px; }
.roster-qr-btn {
  width: 100%; font-family: inherit; font-size: 11.5px; font-weight: 700;
  padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; transition: .18s;
}
.roster-qr-btn:hover { background: var(--brand-soft); border-color: var(--brand-300, var(--border)); }
.ad-head-qr-btn { width: auto; margin-top: 10px; padding-inline: 16px; }

/* =========================================================
   Advisor Detail Page (#advisor/<idx>)
   ========================================================= */
.ad-page { display: flex; flex-direction: column; gap: 16px; }
.ad-back { margin-bottom: -4px; }
.ad-back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-muted); font-weight: 600;
  padding: 6px 12px; background: var(--surface-2); border-radius: 999px;
  transition: background .2s ease, color .2s ease;
}
.ad-back-link:hover { background: var(--brand-soft); color: var(--brand-700); }

/* Header */
.ad-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  padding: 22px 24px;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  border-radius: 18px;
  border: 1px solid var(--border);
}
.ad-head-left { display: grid; grid-template-columns: 88px 1fr; gap: 18px; align-items: start; }
.ad-avatar {
  width: 88px; height: 88px;
  border-radius: 22px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 28px;
  box-shadow: inset 0 0 0 1px var(--border);
}
.ad-avatar.tier-gold   { background: linear-gradient(135deg, #fff6d8, #ffdd83); color: #8c6a1e; }
.ad-avatar.tier-silver { background: linear-gradient(135deg, #f1f5f9, #cbd5e1); color: #475569; }
.ad-avatar.tier-bronze { background: linear-gradient(135deg, #f5e3d1, #e2b07c); color: #7a4a25; }
.ad-head-info { min-width: 0; }
.ad-head-row { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.ad-name { font-size: 22px; font-weight: 800; letter-spacing: -.4px; margin: 0; }
.ad-tier-badge {
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.ad-tier-badge.tier-gold   { background: #fff6d8; color: #8c6a1e; }
.ad-tier-badge.tier-silver { background: #f1f5f9; color: #475569; }
.ad-tier-badge.tier-bronze { background: #f5e3d1; color: #7a4a25; }
.ad-head-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.ad-head-meta .sep { opacity: .5; }
.ad-bio { font-size: 13px; color: var(--text); line-height: 1.7; margin: 0 0 8px 0; }
.ad-head-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ad-head-score { text-align: center; align-self: center; }
.ad-score-num { font-size: 32px; }
.ad-score-num .score-pill { font-size: 22px; padding: 10px 20px; }
.ad-score-lbl { font-size: 11px; color: var(--text-muted); margin-top: 6px; line-height: 1.4; }

/* Valuation */
.ad-valuation-card { background: linear-gradient(135deg, var(--surface), var(--brand-soft)); }
.ad-valuation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 6px;
}
.val-item {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
}
.val-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 20px;
  background: var(--surface-2);
}
.val-icon.green  { background: rgba(16,185,129,.14); }
.val-icon.amber  { background: rgba(245,158,11,.14); }
.val-icon.blue   { background: rgba(30,109,255,.14); }
.val-icon.purple { background: rgba(139,92,246,.14); }
.val-label { font-size: 11.5px; color: var(--text-muted); margin-bottom: 2px; }
.val-value { font-size: 17px; font-weight: 800; letter-spacing: -.3px; line-height: 1.1; }
.val-sub   { font-size: 10.5px; color: var(--text-muted); margin-top: 3px; }

/* Attendance — single full-width row of 30 days */
.ad-attendance {
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  gap: 7px;
  margin-top: 8px;
}
.ad-attendance > .ds-tip {
  display: grid;
  width: 100%;
  min-width: 0;
  place-items: center;
}
@media (max-width: 1100px) {
  .ad-attendance { grid-template-columns: repeat(15, minmax(0, 1fr)); }
}
.att-cell {
  width: 100%;
  min-width: 26px;
  max-width: 34px;
  aspect-ratio: 1;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 800;
  line-height: 1;
  color: #fff;
  position: relative;
  cursor: default;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.24), 0 2px 7px rgba(15,23,42,.08);
  transition: transform .16s ease, box-shadow .16s ease;
}
.att-cell span { user-select: none; }
.att-cell:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px rgba(255,255,255,.34), 0 6px 12px rgba(15,23,42,.14); }
.att-work { background: linear-gradient(145deg, #20c58c, #0da876); }
.att-late { background: linear-gradient(145deg, #ffb52e, #ee9200); }
.att-sick { background: linear-gradient(145deg, #ff6570, #e83d49); }
.att-off  { background: linear-gradient(145deg, var(--surface-2), var(--surface-3)); color: var(--text-muted); box-shadow: inset 0 0 0 1px var(--border); }
.att-cell::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 130%; left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #0f172a; color: #fff;
  padding: 6px 10px; border-radius: 6px;
  font-size: 10.5px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
  z-index: 10;
}
.att-cell:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }
.ad-att-stats {
  display: flex; flex-wrap: wrap; gap: 14px;
  font-size: 12px;
  align-items: center;
}
.att-stat { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); }
.att-stat strong { color: var(--text); font-weight: 700; }
.att-dot { width: 10px; height: 10px; border-radius: 3px; }
.att-dot.work { background: #10b981; }
.att-dot.late { background: #f59e0b; }
.att-dot.sick { background: #ef4444; }
.att-dot.off  { background: var(--surface-3); }

/* Sales charts — full-width 3-column grid */
.ad-sales-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 16px;
  margin-top: 6px;
  align-items: stretch;
}
@media (max-width: 1100px) {
  .ad-sales-grid { grid-template-columns: 1fr 1fr; }
  .ad-sales-grid .ad-daily-wrap { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .ad-sales-grid { grid-template-columns: 1fr; }
  .ad-sales-grid .ad-daily-wrap { grid-column: auto; }
}
.ad-mini-donut {
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 14px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  min-width: 0;
}
.ad-mini-donut canvas { width: min(100%, 190px) !important; height: 190px !important; }
.ad-mini-title { width: 100%; font-size: 12.5px; color: var(--text); font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; justify-content: center; gap: 7px; }
.ad-chart-help {
  width: 22px; height: 22px; padding: 0; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--brand-700, #26645f);
  display: inline-grid; place-items: center; font: 800 11px/1 Vazirmatn, sans-serif; cursor: help;
}
.ad-chart-help:hover, .ad-chart-help:focus-visible { outline: none; border-color: var(--brand-300, #86bdb7); box-shadow: 0 0 0 3px rgba(44,120,115,.12); }
.ad-chart-legend { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 10px; margin-top: 10px; }
.ad-chart-legend-item { min-width: 0; display: flex; align-items: center; gap: 6px; padding: 5px 7px; border-radius: 9px; background: var(--surface); color: var(--text-muted); font-size: 10.5px; line-height: 1.35; }
.ad-chart-legend-item i { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 3px; }
.ad-chart-legend-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-chart-legend-item b { margin-inline-start: auto; color: var(--text); font-size: 10.5px; }
.ad-daily-wrap {
  padding: 16px 18px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex; flex-direction: column;
  align-self: stretch;
  width: 100%;
}
.ad-daily-wrap canvas { min-height: 235px; max-height: 235px; }

/* Leads list */
.ad-leads-list { display: flex; flex-direction: column; gap: 10px; max-height: 480px; overflow-y: auto; padding-inline-end: 4px; }
.ad-lead-item {
  position: relative;
  display: grid;
  grid-template-columns: 4px 40px 1fr 22px;
  gap: 12px;
  align-items: stretch;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: 14px;
  border: 1px solid var(--border);
  transition: border-color .2s ease, transform .15s ease, background-color .2s ease, box-shadow .25s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.ad-lead-item > .ad-lead-avatar { align-self: center; }
.ad-lead-item > .ad-lead-go { align-self: center; }
.ad-lead-item:hover {
  border-color: var(--brand-300);
  background: var(--surface);
  box-shadow: 0 10px 26px -16px rgba(160, 32, 240, .45), 0 2px 6px -2px rgba(0,0,0,.06);
  transform: translateY(-1px);
}
.ad-lead-item:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.ad-lead-bar {
  width: 4px; height: 100%; min-height: 38px; border-radius: 999px;
  background: linear-gradient(180deg, var(--brand-500), #c084fc);
  align-self: stretch;
}
.ad-lead-item.heat-hot  .ad-lead-bar { background: linear-gradient(180deg, #ef4444, #f97316); }
.ad-lead-item.heat-warm .ad-lead-bar { background: linear-gradient(180deg, #f59e0b, #fbbf24); }
.ad-lead-item.heat-mild .ad-lead-bar { background: linear-gradient(180deg, var(--brand-500), #c084fc); }
.ad-lead-item.heat-cold .ad-lead-bar { background: linear-gradient(180deg, #64748b, #94a3b8); }
.ad-lead-avatar {
  width: 40px; height: 40px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 12.5px; letter-spacing: .3px;
  box-shadow: 0 4px 10px -6px rgba(0,0,0,.4), inset 0 0 0 2px rgba(255,255,255,.18);
}
.ad-lead-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ad-lead-row1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ad-lead-row2 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.ad-lead-name {
  font-weight: 700; font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 180px;
  flex-shrink: 0;
}
.ad-lead-score {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; padding: 1px 7px; height: 18px;
  border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1;
  background: linear-gradient(135deg, var(--brand-500), #c084fc);
  color: #fff;
  box-shadow: 0 2px 6px -3px rgba(160,32,240,.6);
}
.ad-lead-item.heat-hot  .ad-lead-score { background: linear-gradient(135deg, #ef4444, #f97316); box-shadow: 0 2px 6px -3px rgba(239,68,68,.6); }
.ad-lead-item.heat-warm .ad-lead-score { background: linear-gradient(135deg, #f59e0b, #fbbf24); box-shadow: 0 2px 6px -3px rgba(245,158,11,.6); color: #5a3b00; }
.ad-lead-item.heat-cold .ad-lead-score { background: linear-gradient(135deg, #64748b, #94a3b8); box-shadow: 0 2px 6px -3px rgba(100,116,139,.5); }
.ad-lead-value {
  margin-inline-start: auto;
}
.ad-lead-meta {
  font-size: 11px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  min-width: 0;
}
.ad-lead-meta .ad-lead-dot { color: var(--border-strong, #d1d5db); }
.ad-lead-meta .ad-lead-src { font-weight: 600; color: var(--text); }
.ad-stage-chip {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; padding: 4px 10px;
  border-radius: 999px; border: 1px solid transparent;
  white-space: nowrap; line-height: 1.2;
}
.ad-stage-chip.stage-cool   { background: rgba(30,109,255,.08);  color: #1e6dff; border-color: rgba(30,109,255,.22); }
.ad-stage-chip.stage-amber  { background: rgba(245,158,11,.10);  color: #b45309; border-color: rgba(245,158,11,.28); }
.ad-stage-chip.stage-purple { background: rgba(160,32,240,.10);  color: #7e22ce; border-color: rgba(160,32,240,.28); }
.ad-stage-chip.stage-green  { background: rgba(16,185,129,.10);  color: #047857; border-color: rgba(16,185,129,.28); }
.ad-stage-chip.stage-pink   { background: rgba(244,63,94,.10);   color: #be185d; border-color: rgba(244,63,94,.28); }
.ad-lead-value {
  display: inline-flex; align-items: baseline; gap: 4px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ad-lead-val-num { font-size: 16px; font-weight: 800; letter-spacing: -.3px; color: var(--text); }
.ad-lead-val-unit { font-size: 10.5px; font-weight: 600; color: var(--text-muted); }
.ad-lead-go {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 999px;
  color: var(--text-muted);
  background: transparent;
  transition: color .2s ease, background-color .2s ease, transform .2s ease;
}
.ad-lead-item:hover .ad-lead-go {
  color: #fff;
  background: var(--brand-500);
  transform: translateX(-2px);
}
.ad-lead-prob {
  display: flex; flex-direction: row; align-items: center; gap: 8px;
  min-width: 180px; flex: 0 0 auto;
}
.ad-lead-prob .prob-bar { flex: 1; min-width: 100px; }
.prob-bar { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.prob-fill { height: 100%; background: linear-gradient(90deg, var(--brand-500), #10b981); border-radius: 999px; transition: width .35s ease; }
.ad-lead-item.heat-hot  .prob-fill { background: linear-gradient(90deg, #f97316, #ef4444); }
.ad-lead-item.heat-warm .prob-fill { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.ad-lead-item.heat-cold .prob-fill { background: linear-gradient(90deg, #94a3b8, #64748b); }
.prob-num { font-size: 11px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.prob-num strong { color: var(--text); font-weight: 800; }
.chip-soft {
  font-size: 11px; padding: 3px 9px;
  background: var(--surface); border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--brand-700); font-weight: 600;
}

/* Calls list */
.ad-calls-list { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; padding-inline-end: 4px; }
.ad-call-item {
  padding: 12px;
  background: var(--surface-2);
  border-radius: 12px;
  border-inline-start: 3px solid var(--border);
}
.ad-call-item .ad-call-head { display: flex; gap: 10px; align-items: center; font-size: 11px; margin-bottom: 6px; flex-wrap: wrap; }
.ad-call-dir { font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.ad-call-dir.in  { background: rgba(16,185,129,.15); color: #0e8a5e; }
.ad-call-dir.out { background: rgba(30,109,255,.15); color: #1e6dff; }
.ad-call-time { color: var(--text-muted); }
.ad-call-dur { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ad-call-actions { margin-inline-start: auto; display: inline-flex; gap: 6px; }
.ad-call-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700;
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, transform .15s ease, color .2s ease;
  line-height: 1;
}
.ad-call-btn:hover { background: var(--surface-3); border-color: var(--brand-300); transform: translateY(-1px); }
.ad-call-btn:disabled { opacity: .5; cursor: not-allowed; }
.ad-call-btn.ad-call-play { color: var(--brand-700); }
.ad-call-btn.ad-call-play:hover { background: rgba(160,32,240,.10); color: var(--brand-700); }
.ad-call-btn.ad-call-show { color: #047857; }
.ad-call-btn.ad-call-show:hover { background: rgba(16,185,129,.10); }
.ad-call-btn svg { display: block; }

.ad-call-person { font-size: 12.5px; margin-bottom: 6px; }
.ad-call-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.ad-call-summary { font-size: 11.5px; color: var(--text-muted); line-height: 1.7; }

/* Inline play widget (simulated) */
.ad-call-player {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(160,32,240,.08), rgba(96,165,250,.06));
  border: 1px solid rgba(160,32,240,.18);
  position: relative;
}
.ad-pl-toggle {
  width: 32px; height: 32px; border-radius: 999px;
  background: var(--brand-500); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
  box-shadow: 0 4px 10px -4px rgba(160,32,240,.55);
  transition: background-color .15s ease, transform .15s ease;
}
.ad-pl-toggle:hover { background: var(--brand-700); transform: scale(1.05); }
.ad-pl-toggle .ad-pl-icon-pause { display: none; }
.ad-call-player.playing .ad-pl-toggle .ad-pl-icon-play  { display: none; }
.ad-call-player.playing .ad-pl-toggle .ad-pl-icon-pause { display: block; }
.ad-pl-wave {
  position: relative;
  display: flex; align-items: center; gap: 2px;
  height: 28px; min-width: 0;
  overflow: hidden;
}
.ad-pl-wave > span {
  display: inline-block;
  width: 2px; min-height: 4px;
  background: linear-gradient(180deg, var(--brand-500), #c084fc);
  border-radius: 999px;
  opacity: .55;
  flex: 1 1 0;
}
.ad-call-player.playing .ad-pl-wave > span {
  animation: adPlWaveBeat 1.1s ease-in-out infinite;
  opacity: .9;
}
.ad-call-player.playing .ad-pl-wave > span:nth-child(3n)  { animation-delay: .1s; }
.ad-call-player.playing .ad-pl-wave > span:nth-child(3n+1){ animation-delay: .35s; }
.ad-call-player.playing .ad-pl-wave > span:nth-child(3n+2){ animation-delay: .6s; }
@keyframes adPlWaveBeat {
  0%, 100% { transform: scaleY(.5); }
  50%      { transform: scaleY(1.2); }
}
.ad-pl-progress {
  position: absolute; inset-inline-start: 0; top: 0; bottom: 0;
  width: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(160,32,240,.18), rgba(160,32,240,.06));
  border-inline-end: 2px solid var(--brand-500);
  border-radius: 4px;
}
.ad-call-player.playing .ad-pl-progress {
  animation: adPlProgress 12s linear forwards;
}
@keyframes adPlProgress {
  from { width: 0; }
  to   { width: 100%; }
}
.ad-pl-time {
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  direction: ltr;
  unicode-bidi: embed;
}
.ad-pl-note {
  position: absolute;
  inset-inline-end: 10px; top: -8px;
  font-size: 9px;
  padding: 2px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
}

/* Call transcript modal */
.ad-call-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 130;
  padding: 24px;
  opacity: 0;
  transition: opacity .25s ease;
}
.ad-call-modal-overlay.open { display: flex; opacity: 1; }
.ad-call-modal {
  width: min(720px, 100%);
  max-height: 86vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 28px 60px -16px rgba(0,0,0,.45);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: adCmPop .25s ease;
}
@keyframes adCmPop {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ad-call-modal-head {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 20px 18px 18px;
  background: linear-gradient(155deg, #e0607a 0%, #6e2338 115%);
}
.ad-call-modal-head::before, .ad-call-modal-head::after {
  content: ''; position: absolute; border-radius: 50%; background: #fff; filter: blur(24px); pointer-events: none; z-index: -1;
}
.ad-call-modal-head::before { width: 130px; height: 130px; top: -60px; inset-inline-start: -30px; opacity: .16; }
.ad-call-modal-head::after { width: 90px; height: 90px; bottom: -45px; inset-inline-end: 60px; opacity: .12; }
.ad-call-modal-head h3 { margin: 0; font-size: 14px; font-weight: 800; color: #fff; }
.ad-cm-title-row { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ad-cm-dir { font-weight: 700; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.2); color: #fff; }
.ad-cm-name { font-weight: 800; color: #fff; }
.ad-cm-sep, .ad-cm-meta { color: rgba(255,255,255,.8); font-weight: 500; font-size: 12px; }
.ad-call-modal-close {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  border: none;
  background: rgba(255,255,255,.2); backdrop-filter: blur(6px);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.3);
  cursor: pointer;
  transition: background-color .15s ease, transform .2s ease;
}
.ad-call-modal-close:hover { background: rgba(255,255,255,.34); color: #fff; border-color: transparent; transform: rotate(90deg); }
.ad-call-modal-body {
  padding: 16px 18px 20px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
}
.ad-cm-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ad-cm-transcript { display: flex; flex-direction: column; gap: 8px; }

/* Advisor lead drawer body (rich profile, independent of customerTracks) */
.adl-hero { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.adl-grid {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 8px; margin-bottom: 16px;
}
.adl-stat {
  background: var(--surface-2);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 8px 6px;
  text-align: center;
}
.adl-stat-val { font-size: 14px; font-weight: 800; color: var(--text); letter-spacing: -.2px; }
.adl-stat-lbl { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.adl-section {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
}
.adl-section.warn { border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.06); }
.adl-section.accent {
  border-color: rgba(160,32,240,.3);
  background: linear-gradient(135deg, rgba(160,32,240,.10), rgba(96,165,250,.06));
}
.adl-sec-title { font-weight: 800; font-size: 12.5px; margin-bottom: 6px; }
.adl-sec-body { font-size: 12.5px; line-height: 1.7; color: var(--text); }
.adl-talk-list { margin: 0; padding-inline-start: 18px; font-size: 12px; line-height: 1.9; color: var(--text); }
.adl-actions {
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; margin-top: 12px;
}
.adl-actions .btn {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 700; font-size: 12.5px;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.adl-actions .btn:hover { background: var(--surface-3); border-color: var(--brand-300); }
.adl-actions .btn-primary {
  background: var(--brand-500); color: #fff; border-color: var(--brand-500);
  box-shadow: 0 4px 12px -4px rgba(160,32,240,.55);
}
.adl-actions .btn-primary:hover { background: var(--brand-700); border-color: var(--brand-700); }

/* Insights */
.ad-insights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-top: 6px;
}
@media (max-width: 980px) { .ad-insights-grid { grid-template-columns: 1fr; } }
.insight-card {
  padding: 16px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.insight-card.insight-good { background: linear-gradient(135deg, rgba(16,185,129,.08), var(--surface-2)); border-color: rgba(16,185,129,.30); }
.insight-card.insight-warn { background: linear-gradient(135deg, rgba(245,158,11,.08), var(--surface-2)); border-color: rgba(245,158,11,.30); }
.insight-card.insight-rec  { background: linear-gradient(135deg, rgba(139,92,246,.08), var(--surface-2)); border-color: rgba(139,92,246,.30); }
.insight-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.insight-icon { font-size: 18px; }
.insight-title { font-weight: 700; font-size: 13px; }
.insight-list { margin: 0; padding-inline-start: 18px; font-size: 12.5px; line-height: 1.8; color: var(--text); }
.insight-list li { margin-bottom: 4px; }
.insight-rec-text { font-size: 12.5px; line-height: 1.8; margin: 0; color: var(--text); }

.empty-state {
  text-align: center;
  padding: 30px 14px;
  color: var(--text-muted);
  font-size: 12.5px;
}

@media (max-width: 760px) {
  .ad-header { grid-template-columns: 1fr; }
  .ad-head-left { grid-template-columns: 72px 1fr; }
  .ad-head-score { text-align: start; }
  .ad-attendance { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .ad-lead-item { grid-template-columns: 1fr; }
}

/* ============================================================
   TEAM PAGE — redesigned with isolated department blocks +
   CEO hero + Diaco AI suggestions per member
   ============================================================ */

/* --- CEO HERO --- */
.team-ceo-hero {
  position: relative;
  margin-bottom: 22px;
  padding: 22px 26px;
  border-radius: 22px;
  background: linear-gradient(135deg, #1a1b3a 0%, #2d2058 45%, #4a2a72 100%);
  color: #fff;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(74, 42, 114, 0.28);
}
.ceo-hero-glow {
  position: absolute;
  inset: -40% -10% auto auto;
  width: 360px; height: 360px;
  background: radial-gradient(circle, rgba(244, 162, 97, 0.35), transparent 60%);
  filter: blur(20px);
  pointer-events: none;
}
.ceo-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ceo-hero-badge {
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(244, 162, 97, 0.22);
  color: #ffd8b0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  border: 1px solid rgba(244, 162, 97, 0.45);
}
.ceo-hero-main {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 18px;
  align-items: center;
}
.ceo-hero-avatar {
  width: 88px; height: 88px;
  border-radius: 24px;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 30px;
  background: linear-gradient(135deg, #f4a261, #e76f51);
  color: #fff;
  box-shadow: 0 10px 28px rgba(231, 111, 81, 0.4), inset 0 0 0 2px rgba(255,255,255,0.18);
}
.ceo-hero-name {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 4px;
}
.ceo-hero-role {
  font-size: 13px;
  color: rgba(255,255,255,0.78);
  margin-bottom: 8px;
}
.ceo-hero-tenure {
  display: inline-block;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.12);
  margin-bottom: 6px;
}
.ceo-hero-mantle {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  line-height: 1.7;
}
.ceo-hero-stats {
  display: flex;
  gap: 14px;
}
.ceo-stat {
  text-align: center;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  min-width: 96px;
}
.ceo-stat-v {
  font-size: 14px;
  font-weight: 700;
  color: #ffd8b0;
  margin-bottom: 4px;
}
.ceo-stat-k {
  font-size: 10.5px;
  color: rgba(255,255,255,0.62);
}
.ceo-hero-rahin {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(244, 162, 97, 0.3);
}
.ceo-hero-rahin .diaco-spark {
  font-size: 16px;
  color: #ffd8b0;
  text-shadow: 0 0 8px rgba(255,216,176,0.6);
  margin-top: 1px;
}
.ceo-hero-diaco-title {
  font-size: 12px;
  font-weight: 700;
  color: #ffd8b0;
  margin-bottom: 4px;
}
.ceo-hero-diaco-body {
  font-size: 12.5px;
  line-height: 1.7;
  color: rgba(255,255,255,0.85);
}
@media (max-width: 920px) {
  .ceo-hero-main { grid-template-columns: 1fr; }
  .ceo-hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); }
}

/* --- RAHIN ORG HIGHLIGHTS --- */
.team-diaco-card { margin-bottom: 22px; }
.diaco-spark {
  display: inline-block;
  color: var(--accent-500);
  text-shadow: 0 0 8px rgba(244,162,97,0.5);
}
.diaco-highlight-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 1100px) { .diaco-highlight-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .diaco-highlight-grid { grid-template-columns: 1fr; } }
.diaco-highlight {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  position: relative;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}
.diaco-highlight:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15,23,42,.07); }
.diaco-highlight::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--rh-accent, var(--brand-500));
}
.diaco-highlight-red    { --rh-accent: #ef4444; --rh-soft: rgba(239,68,68,0.08); }
.diaco-highlight-purple { --rh-accent: #8b5cf6; --rh-soft: rgba(139,92,246,0.08); }
.diaco-highlight-amber  { --rh-accent: #f59e0b; --rh-soft: rgba(245,158,11,0.08); }
.diaco-highlight-green  { --rh-accent: #10b981; --rh-soft: rgba(16,185,129,0.08); }
.rh-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 8px; }
.rh-icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 16px;
  background: var(--rh-soft);
  flex-shrink: 0;
}
.rh-meta { flex: 1; min-width: 0; }
.rh-pill {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--rh-soft);
  color: var(--rh-accent);
  font-weight: 700;
  margin-bottom: 4px;
}
.rh-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-strong, #0f172a);
}
[data-theme="dark"] .rh-title { color: #e2e8f0; }
.rh-body {
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-muted);
}

/* --- DEPARTMENT BLOCKS --- */
.team-departments {
  display: flex;
  flex-direction: column;
  gap: 26px;
  margin-top: 24px;
}
.team-dept-block {
  position: relative;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(15,23,42,.04);
}
.team-dept-block::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: var(--dept-accent, var(--brand-500));
}

/* Department-level header */
.team-dept-header {
  display: grid;
  grid-template-columns: 56px 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 20px 24px;
  background: linear-gradient(90deg, var(--dept-soft, rgba(44,120,115,0.08)), transparent 80%);
  border-bottom: 1px solid var(--border);
}
.tdh-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 26px;
  background: var(--dept-soft, var(--brand-50));
  color: var(--dept-accent);
  flex-shrink: 0;
}
.tdh-meta { min-width: 0; }
.tdh-name {
  font-weight: 800;
  font-size: 18px;
  color: var(--text-strong, #0f172a);
  margin-bottom: 4px;
}
[data-theme="dark"] .tdh-name { color: #e2e8f0; }
.tdh-mission {
  font-size: 12px;
  color: var(--text-muted);
}
.tdh-stats {
  display: flex;
  gap: 16px;
  padding-inline: 12px;
  border-inline-start: 1px dashed var(--border);
  border-inline-end: 1px dashed var(--border);
}
.tdh-stat { text-align: center; min-width: 60px; }
.tdh-stat-v {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-strong, #0f172a);
}
[data-theme="dark"] .tdh-stat-v { color: #e2e8f0; }
.tdh-stat-v.score-tone-green { color: var(--green-500); }
.tdh-stat-v.score-tone-amber { color: var(--amber-500); }
.tdh-stat-v.score-tone-red   { color: var(--red-500); }
.tdh-stat-v.tone-green { color: var(--green-500); }
.tdh-stat-v.tone-muted { color: var(--text-muted); }
.tdh-stat-k {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 3px;
}
.tdh-actions-summary {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 200px;
  justify-content: flex-end;
}
.tdh-action-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}
.tdh-action-green  { background: rgba(16,185,129,0.12);  color: #0f8a5a; border-color: rgba(16,185,129,0.25); }
.tdh-action-blue   { background: rgba(30,109,255,0.12);  color: #1e6dff; border-color: rgba(30,109,255,0.25); }
.tdh-action-purple { background: rgba(139,92,246,0.12);  color: #6d50d4; border-color: rgba(139,92,246,0.25); }
.tdh-action-amber  { background: rgba(245,158,11,0.14);  color: #c46920; border-color: rgba(245,158,11,0.3); }
.tdh-action-lemon  { background: rgba(212,160,23,0.14);  color: #a37919; border-color: rgba(212,160,23,0.3); }
.tdh-action-red    { background: rgba(239,68,68,0.12);   color: #b14458; border-color: rgba(239,68,68,0.3); }

@media (max-width: 920px) {
  .team-dept-header {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .tdh-stats {
    border: 0;
    padding: 0;
    justify-content: space-between;
  }
  .tdh-actions-summary {
    max-width: none;
    justify-content: flex-start;
  }
}

/* Department body (members grid inside dept block) */
.team-dept-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 18px 24px 22px;
  background: var(--surface);
}
@media (max-width: 1240px) { .team-dept-body { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px)  { .team-dept-body { grid-template-columns: 1fr; padding: 14px; } }

/* --- MEMBER CARD --- */
.team-member-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.team-member-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15,23,42,.06);
  border-color: var(--tm-stripe-c, var(--dept-accent));
}
.tm-tone-green { --tm-stripe-c: var(--green-500); }
.tm-tone-blue  { --tm-stripe-c: var(--brand-500); }
.tm-tone-amber { --tm-stripe-c: var(--amber-500); }
.tm-tone-red   { --tm-stripe-c: var(--red-500); }
.tm-stripe {
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--tm-stripe-c, var(--brand-500));
}
.tm-head {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
}
.tm-avatar {
  width: 44px; height: 44px;
  font-size: 12px;
}
.tm-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-strong, #0f172a);
}
[data-theme="dark"] .tm-name { color: #e2e8f0; }
.tm-role {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.tm-tenure {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  opacity: .8;
}
.tm-score { text-align: center; padding-inline-start: 6px; }
.tm-score-v {
  font-size: 22px;
  font-weight: 800;
  color: var(--tm-stripe-c, var(--brand-500));
  line-height: 1;
}
.tm-score-k {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
}
.tm-meta {
  font-size: 11.5px;
  line-height: 1.6;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: 8px;
}
.tm-kpis { display: flex; flex-direction: column; gap: 5px; }
.tm-kpi-row {
  display: grid;
  grid-template-columns: 90px 1fr 28px;
  gap: 8px;
  align-items: center;
  font-size: 11px;
}
.tm-kpi-k { color: var(--text-muted); }
.tm-kpi-bar {
  background: var(--surface-2);
  height: 7px;
  border-radius: 4px;
  overflow: hidden;
}
.tm-kpi-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--tm-stripe-c, var(--brand-500)), var(--accent-500));
  border-radius: 4px;
  transition: width .6s cubic-bezier(.22,.7,.16,1);
}
.tm-kpi-v {
  font-weight: 700;
  font-size: 11px;
  text-align: end;
}
.tm-note {
  font-size: 11px;
  padding: 6px 10px;
  background: rgba(245,158,11,0.08);
  color: var(--amber-500);
  border-inline-start: 3px solid var(--amber-500);
  border-radius: 6px;
  line-height: 1.6;
}

/* Diaco AI suggestion block inside member card */
.tm-rahin {
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed var(--diaco-c, var(--brand-500));
  background: var(--diaco-bg, rgba(44,120,115,0.06));
  font-size: 11.5px;
  line-height: 1.65;
}
.diaco-green  { --diaco-c: #10b981; --diaco-bg: rgba(16,185,129,0.07); }
.diaco-blue   { --diaco-c: #1e6dff; --diaco-bg: rgba(30,109,255,0.06); }
.diaco-purple { --diaco-c: #8b5cf6; --diaco-bg: rgba(139,92,246,0.07); }
.diaco-amber  { --diaco-c: #f59e0b; --diaco-bg: rgba(245,158,11,0.08); }
.diaco-lemon  { --diaco-c: #d4a017; --diaco-bg: rgba(212,160,23,0.08); }
.diaco-red    { --diaco-c: #ef4444; --diaco-bg: rgba(239,68,68,0.07); }

.tm-diaco-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.tm-rahin .diaco-spark { color: var(--diaco-c); }
.tm-diaco-pill {
  font-weight: 800;
  font-size: 11.5px;
  color: var(--diaco-c);
  padding: 3px 9px;
  background: var(--diaco-bg);
  border-radius: 999px;
  border: 1px solid var(--diaco-c);
}
.tm-diaco-reason { color: var(--text); margin-bottom: 4px; }
.tm-diaco-idea {
  color: var(--text);
  padding-top: 4px;
  border-top: 1px dotted color-mix(in srgb, var(--diaco-c) 40%, transparent);
}
.tm-rahin strong { color: var(--diaco-c); font-weight: 700; }

/* =========================================================
   WORKSPACE — Advisor Desk
   namespace: ws-*  (Pipeline + Tasks + Inbox + Kanban + Table)
   ========================================================= */

/* ---------- Toolbar (filters above KPI) ---------- */
.ws-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.ws-viewas, .ws-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ws-toolbar-label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
}
.ws-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px 8px 30px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(8px) calc(50% - 2px), calc(13px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.ws-select:hover  { border-color: var(--border-strong); }
.ws-select:focus  { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(44,120,115,.18); }
.ws-add-lead { margin-inline-start: 4px; }

/* ---------- Split: Inbox + Tasks ---------- */
.ws-split {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  margin-top: 20px;
}
@media (max-width: 1100px) { .ws-split { grid-template-columns: 1fr; } }

/* [crm-l1-menu-p1] Founder feedback on #crm-reports — "ظاهر باکس قیف به
   کناریشِ که خالیه نمیخوره": the funnel's stacked colored bars are much
   taller than the RFM donut, and grid stretch gives both cards equal
   height, so the shorter donut sat pinned to the top with a large blank
   gap below it. Centering each card's body in the available height (same
   .crp-funnel-body wrapper on both sides) uses that space instead of
   leaving it empty, so the two cards read as one balanced row. */
.crp-page{display:grid;gap:var(--space-macro,24px)}
.crp-page>.page-head{margin:0;padding-block:4px}
.crp-toolbar{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap;padding:14px 16px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);box-shadow:var(--shadow-xs)}
.crp-filter-group{display:grid;gap:7px}.crp-filter-label{font-size:11px;font-weight:700;color:var(--text-muted)}
.crp-toolbar .filters{margin:0;gap:8px}.crp-toolbar .chip-btn{min-height:36px;padding-inline:14px}
.crp-page>[data-crp-kpis] .kpi-grid{grid-template-columns:repeat(6,minmax(0,1fr));gap:14px}
.crp-page>[data-crp-kpis] .kpi{--crp-kpi-tone:var(--brand-500);min-height:0;padding:12px 14px;border-color:transparent;border-radius:calc(var(--radius) + 2px);box-shadow:0 10px 28px -18px color-mix(in srgb,var(--crp-kpi-tone) 72%,transparent),0 2px 8px -6px color-mix(in srgb,var(--crp-kpi-tone) 44%,transparent);isolation:isolate;animation:crp-kpi-enter .56s cubic-bezier(.2,.75,.25,1) both}
.crp-page>[data-crp-kpis] .kpi:nth-child(2){animation-delay:55ms}.crp-page>[data-crp-kpis] .kpi:nth-child(3){animation-delay:110ms}.crp-page>[data-crp-kpis] .kpi:nth-child(4){animation-delay:165ms}.crp-page>[data-crp-kpis] .kpi:nth-child(5){animation-delay:220ms}.crp-page>[data-crp-kpis] .kpi:nth-child(6){animation-delay:275ms}
.crp-page>[data-crp-kpis] .kpi.blue{--crp-kpi-tone:#3b5998}.crp-page>[data-crp-kpis] .kpi.green{--crp-kpi-tone:#0f766e}.crp-page>[data-crp-kpis] .kpi.amber{--crp-kpi-tone:#c46920}.crp-page>[data-crp-kpis] .kpi.purple{--crp-kpi-tone:#6d50d4}.crp-page>[data-crp-kpis] .kpi.red{--crp-kpi-tone:#b14458}
.crp-page>[data-crp-kpis] .kpi:hover{transform:translateY(-6px) scale(1.012);border-color:transparent;box-shadow:0 22px 42px -22px color-mix(in srgb,var(--crp-kpi-tone) 82%,transparent),0 8px 18px -12px color-mix(in srgb,var(--crp-kpi-tone) 58%,transparent)}
.crp-page>[data-crp-kpis] .kpi-icon{width:40px;height:40px;margin-block-end:12px;border-radius:13px}
.crp-page>[data-crp-kpis] .kpi-icon [data-ds-icon-tone]{color:var(--crp-kpi-tone)}
.crp-page>[data-crp-kpis] .kpi-label{min-height:32px;font-size:12px;font-weight:650;line-height:1.55;color:var(--text-muted)}
.crp-page>[data-crp-kpis] .kpi-value{margin:2px 0 0;font-size:clamp(15px,1.22vw,20px);line-height:1.45;white-space:normal}
@keyframes crp-kpi-enter{from{opacity:0;transform:translateY(16px) scale(.975)}to{opacity:1;transform:translateY(0) scale(1)}}
.crp-page>.card,.crp-page>.ws-split>.card{margin:0;border-color:color-mix(in srgb,var(--border) 88%,var(--brand-500));box-shadow:var(--shadow-xs)}
.crp-page .card-head{padding-block-end:14px;margin-block-end:16px;border-block-end:1px solid var(--border)}
.crp-funnel-split{align-items:start;margin:0;grid-template-columns:minmax(0,1.65fr) minmax(300px,.75fr)}
.crp-funnel-split:has(>[data-section="segments"][hidden])>[data-section="funnel"]{grid-column:1/-1}
.crp-funnel-split .card { display: flex; flex-direction: column; min-height:0; }
.crp-funnel-split .crp-funnel-body { display: flex; flex-direction: column; justify-content: flex-start; min-height:280px; }
.crp-funnel-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-block-end:18px}
.crp-funnel-summary>div{display:grid;grid-template-columns:38px minmax(0,1fr) auto;grid-template-rows:auto auto;align-items:center;column-gap:10px;padding:12px 14px;border:1px solid color-mix(in srgb,var(--brand-500) 10%,var(--border));border-radius:14px;background:color-mix(in srgb,var(--pastel-mint) 18%,var(--surface));box-shadow:var(--shadow-xs)}
.crp-funnel-summary [data-ds-icon]{grid-row:1/3;width:38px;height:38px;display:grid;place-items:center;border-radius:11px;background:color-mix(in srgb,currentColor 13%,var(--surface))}.crp-funnel-summary .ds-ico{width:20px;height:20px}
.crp-funnel-summary small{font-size:11px;color:var(--text-muted)}.crp-funnel-summary b{grid-column:2/4;font-size:16px;color:var(--text);line-height:1.5}
.crp-funnel-dashboard{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(270px,.65fr);gap:18px;align-items:start}
.crp-funnel-stages,.crp-funnel-insights{min-width:0;border:1px solid color-mix(in srgb,var(--brand-500) 12%,var(--border));border-radius:16px;background:var(--surface)}
.crp-funnel-stages{display:grid;gap:10px;padding:16px}
.crp-funnel-subhead{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-block-end:2px}.crp-funnel-subhead strong{font-size:13px;color:var(--text)}.crp-funnel-subhead>span{font-size:10.5px;font-weight:750;color:var(--brand-700);padding:3px 8px;border-radius:999px;background:var(--green-50)}
.crp-funnel-stage{--tc:var(--brand-500);display:grid;grid-template-columns:34px minmax(0,1fr);align-items:center;gap:11px;padding:11px 12px;border:1px solid color-mix(in srgb,var(--tc) 18%,var(--border));border-radius:13px;background:color-mix(in srgb,var(--tc) 5%,var(--surface));transition:transform .22s ease,box-shadow .22s ease,border-color .22s ease;animation:crp-stage-enter .45s cubic-bezier(.2,.75,.25,1) both}
.crp-funnel-stage:hover{transform:translateX(-3px);border-color:color-mix(in srgb,var(--tc) 36%,var(--border));box-shadow:0 12px 24px -20px var(--tc)}
.crp-funnel-stage.tone-sky,.crp-funnel-stage.tone-blue{--tc:#3b5998}.crp-funnel-stage.tone-lilac{--tc:#6d50d4}.crp-funnel-stage.tone-amber{--tc:#c46920}.crp-funnel-stage.tone-green,.crp-funnel-stage.tone-mint{--tc:#0f766e}.crp-funnel-stage.tone-rose{--tc:#b14458}
.crp-funnel-stage__index{width:32px;height:32px;display:grid;place-items:center;border-radius:10px;background:color-mix(in srgb,var(--tc) 14%,var(--surface));color:var(--tc);font-size:12px;font-weight:850}.crp-funnel-stage__copy{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:5px 12px}.crp-funnel-stage__copy strong{font-size:13px;color:var(--text);overflow-wrap:anywhere}.crp-funnel-stage__copy>span{font-size:11.5px;color:var(--text-muted);white-space:nowrap}.crp-funnel-stage__track{grid-column:1/-1;height:7px;border-radius:999px;background:color-mix(in srgb,var(--tc) 10%,var(--surface-2));overflow:hidden}.crp-funnel-stage__track i{display:block;width:var(--crp-stage-width);height:100%;border-radius:inherit;background:linear-gradient(90deg,color-mix(in srgb,var(--tc) 68%,#fff),var(--tc));animation:crp-track-grow .72s cubic-bezier(.2,.75,.25,1) both;transform-origin:right}
.crp-funnel-no-active{display:flex;align-items:center;gap:10px;padding:14px;border-radius:13px;background:var(--surface-2);color:var(--text-muted)}.crp-funnel-no-active>span{width:34px;height:34px;display:grid;place-items:center}.crp-funnel-no-active>div{display:grid;gap:3px}.crp-funnel-no-active strong{font-size:12.5px;color:var(--text)}.crp-funnel-no-active span{font-size:11px}
.crp-funnel-inactive{display:grid;gap:9px;margin-block-start:5px;padding-block-start:13px;border-block-start:1px dashed var(--border)}.crp-funnel-inactive__grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}.crp-funnel-inactive__grid>span{display:flex;align-items:center;gap:7px;min-width:0;padding:7px 9px;border-radius:10px;background:var(--surface-2);color:var(--text-muted);font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.crp-funnel-inactive__grid b{display:grid;place-items:center;min-width:22px;height:22px;border-radius:7px;background:var(--surface);color:var(--brand-700);font-size:10px}
.crp-funnel-insights{display:grid;align-content:start;gap:10px;padding:16px;background:linear-gradient(145deg,color-mix(in srgb,var(--pastel-mint) 42%,var(--surface)),var(--surface) 70%)}.crp-funnel-insights__head{display:flex;align-items:center;gap:10px;padding-block-end:12px;border-block-end:1px solid color-mix(in srgb,var(--brand-500) 14%,var(--border))}.crp-funnel-insights__head>span{width:38px;height:38px;display:grid;place-items:center;border-radius:11px;background:var(--pastel-mint)}.crp-funnel-insights__head>div{display:grid;gap:2px}.crp-funnel-insights__head strong{font-size:13px;color:var(--text)}.crp-funnel-insights__head small{font-size:10.5px;color:var(--text-muted)}
.crp-funnel-insight{display:grid;gap:4px;padding:11px 12px;border-radius:12px;background:var(--surface);box-shadow:var(--shadow-xs)}.crp-funnel-insight small{font-size:10.5px;color:var(--text-muted)}.crp-funnel-insight strong{font-size:12px;color:var(--text);overflow-wrap:anywhere}.crp-funnel-insight b{font-size:12px}.crp-funnel-insight.is-positive b{color:var(--success-600,#16805d)}.crp-funnel-insight.is-risk b{color:var(--danger-600,#c2405a)}
.crp-funnel-insight-note{display:flex;align-items:flex-start;gap:8px;padding:11px 12px;border-radius:12px;background:color-mix(in srgb,var(--pastel-sky) 28%,var(--surface));font-size:11px;color:var(--text-muted);line-height:1.7}.crp-funnel-insight-note>span{flex:0 0 auto;margin-block-start:2px}.crp-funnel-insight-note p{margin:0}.crp-funnel-insights__help{margin:2px 0 0;font-size:10.5px;line-height:1.8;color:var(--text-muted)}
@keyframes crp-stage-enter{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes crp-track-grow{from{transform:scaleX(0)}to{transform:scaleX(1)}}
.crp-page>[data-section="channels"] [data-crp-channels]{min-height:240px}
.crp-page>.ws-split:not(.crp-funnel-split){margin:0;align-items:start}
.crp-page>[data-section="activity-performance"] [data-crp-activity-kpis] .kpi-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-block-end:18px}
.crp-page>[data-section="activity-performance"] [data-crp-activity-types]{max-height:560px;overflow:auto;padding-inline-end:6px}
@media(max-width:1100px){.crp-page>[data-crp-kpis] .kpi-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.crp-funnel-split{grid-template-columns:minmax(0,1fr)}.crp-page>[data-section="activity-performance"] [data-crp-activity-kpis] .kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:900px){.crp-funnel-dashboard{grid-template-columns:minmax(0,1fr)}.crp-toolbar{align-items:stretch}.crp-filter-group{width:100%}.crp-funnel-inactive__grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){.crp-page>[data-crp-kpis] .kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.crp-page>[data-crp-kpis] .kpi{min-height:0;padding:12px 14px}.crp-page>[data-crp-kpis] .kpi-icon{width:36px;height:36px;margin-block-end:8px}.crp-page>[data-section="activity-performance"] [data-crp-activity-kpis] .kpi-grid{grid-template-columns:1fr}.crp-toolbar .filters{overflow:auto;flex-wrap:nowrap}.crp-toolbar .chip-btn{white-space:nowrap}}
@media(max-width:600px){.crp-funnel-summary{grid-template-columns:1fr}.crp-funnel-inactive__grid{grid-template-columns:1fr}.crp-funnel-stage__copy{grid-template-columns:1fr}.crp-funnel-stage__copy>span{white-space:normal}.crp-funnel-summary>div{grid-template-columns:38px minmax(0,1fr)}}
@media(max-width:420px){.crp-page>[data-crp-kpis] .kpi-grid{grid-template-columns:1fr}.crp-page>[data-crp-kpis] .kpi-label{min-height:0}}
@media(prefers-reduced-motion:reduce){.crp-page>[data-crp-kpis] .kpi,.crp-funnel-stage,.crp-funnel-stage__track i{animation:none}.crp-page>[data-crp-kpis] .kpi,.crp-funnel-stage{transition:none}}

.ws-inbox-card, .ws-tasks-card { padding: 18px 18px 14px; }
.ws-inbox-list, .ws-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  margin: -4px -4px 0;
  padding: 4px;
}
.ws-inbox-list::-webkit-scrollbar,
.ws-tasks-list::-webkit-scrollbar { width: 6px; }
.ws-inbox-list::-webkit-scrollbar-thumb,
.ws-tasks-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }

/* Inbox items */
.ws-inbox-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  border-inline-start: 3px solid var(--tone-c, var(--brand-500));
  transition: background .15s, transform .15s;
}
.ws-inbox-item:hover {
  background: color-mix(in srgb, var(--tone-c, var(--brand-500)) 6%, var(--surface));
  transform: translateX(2px);
}
.ws-inbox-icon {
  font-size: 18px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--tone-c) 14%, var(--surface));
  border-radius: 10px;
}
.ws-inbox-body { min-width: 0; }
.ws-inbox-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 2px;
  color: var(--text);
}
.ws-inbox-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.55;
}
.ws-inbox-go {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 28px; height: 28px;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .15s;
}
.ws-inbox-go:hover {
  background: var(--brand-500);
  color: #fff;
  border-color: transparent;
}
.ws-tone-red    { --tone-c: #ef4444; }
.ws-tone-amber  { --tone-c: #f59e0b; }
.ws-tone-sky    { --tone-c: #0ea5e9; }
.ws-tone-purple { --tone-c: #8b5cf6; }
.ws-tone-green  { --tone-c: #10b981; }

/* Tasks Today */
.ws-tasks-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.ws-task-item {
  display: grid;
  grid-template-columns: 22px 50px 28px 1fr 32px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: background .15s, opacity .15s;
}
.ws-task-item.is-done {
  opacity: 0.55;
  background: var(--surface);
}
.ws-task-item.is-done .ws-task-who,
.ws-task-item.is-done .ws-task-note { text-decoration: line-through; }
.ws-task-check {
  appearance: none;
  width: 18px; height: 18px;
  border: 2px solid var(--border-strong);
  border-radius: 5px;
  cursor: pointer;
  transition: all .15s;
  position: relative;
}
.ws-task-check:checked {
  background: var(--brand-500);
  border-color: var(--brand-500);
}
.ws-task-check:checked::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.ws-task-time {
  font-family: 'Vazirmatn', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-600);
}
.ws-task-channel {
  font-size: 18px;
  text-align: center;
}
.ws-task-body { min-width: 0; }
.ws-task-who {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text);
}
.ws-task-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}
.ws-task-advisor {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ac, var(--brand-500)) 18%, var(--surface));
  color: var(--ac, var(--brand-500));
  border: 2px solid var(--ac, var(--brand-500));
  font-size: 10px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Pipeline Card + Tabs ---------- */
.ws-pipeline-card { margin-top: 20px; padding: 18px; }
.ws-tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; }
.ws-tab {
  padding: 7px 18px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}
.ws-tab:hover { color: var(--text); }
.ws-tab.active {
  background: var(--surface);
  color: var(--brand-600);
  box-shadow: var(--shadow-xs);
}
.ws-tab-panel { display: none; }
.ws-tab-panel.active { display: block; animation: wsFade .25s ease-out; }
@keyframes wsFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ==========================================================
   Workspace Kanban — Pipeline Health + Stepper + Density-aware
   ========================================================== */

/* ----- Pipeline Health Bar (stacked horizontal funnel) ----- */
.ws-kb-health {
  display: flex;
  height: 10px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-bottom: 14px;
  position: relative;
}
.ws-kb-health-seg {
  height: 100%;
  background: var(--seg-c, var(--brand-500));
  position: relative;
  cursor: pointer;
  min-width: 2px;
  transition: filter .2s, transform .2s;
}
.ws-kb-health-seg:hover { filter: brightness(1.12) saturate(1.1); }
.ws-kb-health-seg + .ws-kb-health-seg { box-shadow: inset 1px 0 0 var(--surface); }
.ws-kb-health-tt {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%; transform: translateX(-50%);
  background: var(--text);
  color: var(--surface);
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s, bottom .15s;
  z-index: 6;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
}
.ws-kb-health-tt::after {
  content: '';
  position: absolute;
  top: 100%; left: 50%; transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--text);
}
.ws-kb-health-seg:hover .ws-kb-health-tt { opacity: 1; bottom: calc(100% + 10px); }

/* ----- Stage Stepper (clickable chips above kanban) ----- */
.ws-kb-stepper {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.ws-kb-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 9px 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: transform .18s, border-color .18s, box-shadow .18s, background .18s;
  position: relative;
  overflow: hidden;
  font-family: inherit;
}
.ws-kb-step::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--step-c, var(--brand-500));
  opacity: .25;
  transition: opacity .18s, height .18s;
}
.ws-kb-step:hover {
  border-color: var(--step-c, var(--brand-500));
  transform: translateY(-2px);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--step-c, var(--brand-500)) 14%, transparent);
}
.ws-kb-step:hover::before { opacity: .55; height: 4px; }
.ws-kb-step.is-active {
  background: color-mix(in srgb, var(--step-c, var(--brand-500)) 7%, var(--surface));
  border-color: var(--step-c, var(--brand-500));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--step-c, var(--brand-500)) 22%, transparent);
}
.ws-kb-step.is-active::before { opacity: 1; height: 4px; }
.ws-kb-step-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--step-c, var(--brand-500));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--step-c, var(--brand-500)) 14%, var(--surface));
  flex-shrink: 0;
}
.ws-kb-step-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  line-height: 1.25;
  letter-spacing: -.15px;
  white-space: nowrap;
}
.ws-kb-step-count {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--step-c, var(--brand-500));
  background: color-mix(in srgb, var(--step-c, var(--brand-500)) 12%, var(--surface));
  padding: 1px 8px;
  border-radius: 99px;
  min-width: 24px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.ws-kb-step.is-zero { opacity: .55; }
.ws-kb-step.is-zero .ws-kb-step-count { background: var(--surface-2); color: var(--text-muted); }

/* ----- Density grid ----- */
/* Container: horizontal scroll only; no scroll-snap (RTL anomalies) */
.ws-kanban {
  display: grid;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 4px 14px;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
}
/* 7 active pipeline stages (won is archived separately) */
.ws-kanban[data-density="comfort"] { grid-template-columns: repeat(7, 400px); }
.ws-kanban[data-density="cozy"]    { grid-template-columns: repeat(7, 340px); }
.ws-kanban[data-density="compact"] { grid-template-columns: repeat(7, 260px); }
.ws-kanban.is-fit                  { grid-template-columns: repeat(7, minmax(0, 1fr)) !important; overflow-x: hidden; }
.ws-kanban::-webkit-scrollbar { height: 9px; }
.ws-kanban::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
.ws-kanban::-webkit-scrollbar-track { background: var(--surface-2); border-radius: 99px; }

/* [crm-l1-menu-p1] rich-live-workspace.js — card CONTENT only (the board
   chrome itself comes from DsKanban's own `.ds-pattern-kanban*` classes,
   design-system/assets/css/ds-patterns.css, once DsKanban.mount() takes
   over [data-ws-kanban]'s className). */
.ws2-card-title { font-size: 12.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws2-card-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws2-card-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.ws2-kanban-loading, .ws2-kanban-error { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }
.ws2-kanban-error-msg { margin-bottom: 10px; }
.ws2-offline-banner { display: flex; align-items: center; gap: .5rem; padding: 8px 14px; background: var(--amber-50, #fffbeb); border: 1px solid var(--amber-200, #fde68a); border-radius: 8px; font-size: 12.5px; color: var(--amber-800, #92400e); margin-bottom: 10px; }

/* [crm-l1-menu-p1] Phase 3 — "ارتباطات"/"وظیفه‌ها" read-heavy overlays, built
   on rich-live-crud.js's shared `.rlx-backdrop`/`.rlx-modal` chrome (see
   openOverlay() in rich-live-workspace.js) — only the BODY content below is
   page-specific. */
.ws2-overlay-modal { width: min(560px, 94vw); }
.ws2-overlay-empty { color: var(--text-muted); font-size: 13px; padding: 12px 0; text-align: center; }
.ws2-overlay-note { font-size: 11.5px; color: var(--text-muted); margin-top: 10px; }
.ws2-overlay-section-title { font-size: 12.5px; font-weight: 700; margin: 14px 0 8px; }
.ws2-timeline-list, .ws2-task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 42vh; overflow: auto; }
.ws2-timeline-item, .ws2-task-item { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.ws2-timeline-item-head, .ws2-task-item-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; }
.ws2-timeline-kind { font-weight: 700; }
.ws2-timeline-item-body, .ws2-task-item-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.ws2-task-state-badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); }
.ws2-task-state-done .ws2-task-state-badge { color: var(--green-600, #1f9e5a); }
.ws2-task-add-form { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 10px; }

/* [crm-l1-menu-p1] Phase 4 — Smart Inbox ("unread" list only, [data-ws-inbox]). */
.ws2-inbox-item { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
.ws2-inbox-item-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted); }
.ws2-inbox-channel { font-weight: 700; }

/* [crm-l1-menu-p1] Phase 4 — Sequences (templates library + active runs +
   per-lead start/pause/resume/stop overlay). */
.ws2-seq-tpl { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.ws2-seq-run { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.ws2-seq-tpl-start { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.ws2-seq-tpl-start:last-child { border-bottom: none; }

.ws-kb-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  min-height: 320px;
  max-height: 68vh;
  position: relative;
  transition: background .2s, border-color .2s, box-shadow .2s;
  min-width: 0;
}
.ws-kb-col.is-drop {
  background: color-mix(in srgb, var(--stage-c, var(--brand-500)) 10%, var(--surface));
  border-color: var(--stage-c, var(--brand-500));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--stage-c, var(--brand-500)) 22%, transparent);
}
.ws-kb-col.is-flash { animation: wsKbFlash .9s ease-out; }
@keyframes wsKbFlash {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--stage-c, var(--brand-500)) 50%, transparent); }
  60%  { box-shadow: 0 0 0 6px color-mix(in srgb, var(--stage-c, var(--brand-500)) 0%, transparent); }
  100% { box-shadow: none; }
}
.ws-kb-head {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--stage-c, var(--brand-500)) 30%, var(--border));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--stage-c, var(--brand-500)) 10%, transparent), transparent),
    color-mix(in srgb, var(--surface) 92%, var(--stage-c, var(--brand-500)) 4%);
  border-radius: 14px 14px 0 0;
  position: sticky; top: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1;
}
.ws-kb-head-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--stage-c, var(--brand-500));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--stage-c, var(--brand-500)) 18%, transparent);
}
.ws-kb-title {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text);
  letter-spacing: -.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-kb-count {
  background: var(--stage-c, var(--brand-500));
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 99px;
  min-width: 24px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.2px;
}
.ws-kb-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  overflow-y: auto;
  flex: 1;
}
.ws-kb-body::-webkit-scrollbar { width: 5px; }
.ws-kb-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }

/* ----- Lead card (modern, 3-row with right-side stage strip) ----- */
.ws-lead {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  cursor: grab;
  transition: transform .16s, box-shadow .16s, border-color .16s;
  position: relative;
  overflow: hidden;
  /* CRITICAL: never shrink inside a flex column (was clipping rows 2 & 3) */
  flex-shrink: 0;
}
/* Each row must hold its full height even when sibling rows could push it */
.ws-lead-top,
.ws-lead-meta,
.ws-lead-bottom { flex-shrink: 0; }
.ws-lead-meta { min-height: 22px; }
.ws-lead-bottom { min-height: 26px; }
/* Right-side colored strip = stage indicator (RTL geometric per RTL canvas gotcha) */
.ws-lead::after {
  content: '';
  position: absolute;
  top: 9px; bottom: 9px;
  right: 0;
  width: 3px;
  background: var(--stage-c, var(--brand-500));
  border-radius: 99px 0 0 99px;
  opacity: .85;
}
.ws-lead:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--stage-c, var(--brand-500)) 16%, transparent);
  border-color: color-mix(in srgb, var(--stage-c, var(--brand-500)) 35%, var(--border));
}
.ws-lead:hover::after { opacity: 1; width: 4px; }
.ws-lead:active { cursor: grabbing; }
.ws-lead.is-dragging { opacity: .4; transform: rotate(2deg); }
.ws-lead.is-stale { border-color: #fcd9d9; }
.ws-lead.is-bounced { border-color: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,.10) inset; }
.ws-lead.is-bounced::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 18px; height: 18px;
  background: #ef4444;
  clip-path: polygon(0 0, 100% 0, 0 100%);
  border-radius: 9px 0 0 0;
}
/* Top row: avatar + name + score — name has min-width:0 for proper ellipsis */
.ws-lead-top {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.ws-lead-source {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  /* If element also has .src-brand, the brand color background applies via --brand */
  background: var(--brand, color-mix(in srgb, var(--sc) 14%, var(--surface)));
  border: 0;
  color: #fff;
  flex-shrink: 0;
  padding: 5px;
}
.ws-lead-source svg { width: 100%; height: 100%; }
.ws-chip-src .src-brand,
.ws-dr-chip .src-brand,
.ws-arc-chip .src-brand { margin-inline-end: 2px; }
.ws-chip-src, .ws-dr-chip, .ws-arc-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ws-arc-avatar { color: #fff; padding: 6px; }
.ws-arc-avatar svg { width: 100%; height: 100%; }
/* Universal source-icon glyph styling (SVG inside source chips/badges everywhere) */
.src-glyph-text {
  font-family: 'Vazirmatn', system-ui, sans-serif;
  font-weight: 800;
  font-size: 0.78em;
  letter-spacing: -0.5px;
  color: currentColor;
}
.ws-chip-src svg, .ws-dr-chip svg, .ws-arc-chip svg, .ws-arc-avatar svg, .src-badge svg {
  width: 14px; height: 14px;
  vertical-align: -2px;
  display: inline-block;
}
.ws-arc-avatar svg { width: 60%; height: 60%; vertical-align: 0; }
/* Standalone source badge — usable anywhere (drawer hero, leads list, archive) */
.src-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--sc, #94a3b8) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--sc, #94a3b8) 30%, transparent);
  color: var(--sc, #94a3b8);
  flex-shrink: 0;
}
.src-badge svg { width: 60%; height: 60%; display: block; }
.src-badge .src-glyph-text { font-size: 11px; line-height: 1; }
.src-badge-sm { width: 18px; height: 18px; border-radius: 5px; }
.src-badge-lg { width: 28px; height: 28px; border-radius: 8px; }
/* Inside ws-chip-src/ws-dr-chip etc., the chip uses --sc; set color so SVG inherits */
.ws-chip-src, .ws-dr-chip, .ws-arc-chip { color: var(--sc, var(--c, #94a3b8)); }
.ws-lead-name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  letter-spacing: -.1px;
  min-width: 0;
}
.ws-lead-score {
  font-weight: 800;
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 99px;
  min-width: 32px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.2px;
  flex-shrink: 0;
}
.ws-lead-score[data-score="hot"]  { background: rgba(16,185,129,.14); color: #059669; box-shadow: inset 0 0 0 1px rgba(16,185,129,.22); }
.ws-lead-score[data-score="warm"] { background: rgba(245,158,11,.14); color: #b45309; box-shadow: inset 0 0 0 1px rgba(245,158,11,.22); }
.ws-lead-score[data-score="cold"] { background: rgba(148,163,184,.18); color: #475569; box-shadow: inset 0 0 0 1px rgba(148,163,184,.22); }

/* Middle row: course chip (flex) + followup chip (auto) — never wraps */
.ws-lead-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  min-width: 0;
}
.ws-lead-course {
  background: var(--surface-2);
  padding: 4px 9px;
  border-radius: 7px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}
.ws-lead-course::before { content: '📚'; font-size: 10.5px; opacity: .85; flex-shrink: 0; }
.ws-lead-course-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.ws-lead-followup {
  background: var(--surface-2);
  padding: 4px 9px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}
.ws-lead-followup::before { content: '↻'; font-size: 11px; opacity: .8; }

/* Bottom row: advisor + time + alerts — time has min-width:0 ellipsis */
.ws-lead-bottom {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  min-width: 0;
}
.ws-lead-advisor {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ac, var(--brand-500)) 18%, var(--surface));
  color: var(--ac, var(--brand-500));
  border: 1.5px solid var(--ac, var(--brand-500));
  font-size: 9.5px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: -.2px;
  flex-shrink: 0;
}
.ws-lead-touch {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-lead-touch::before { content: '🕒'; font-size: 10px; opacity: .75; flex-shrink: 0; }
.ws-lead-alerts {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-shrink: 0;
}
.ws-lead-alert {
  font-size: 13px;
  filter: saturate(1.15);
  line-height: 1;
}
.ws-lead-alert-red { color: #ef4444; }

/* ---- Compact density: shrink but keep all 3 rows visible ---- */
.ws-kanban[data-density="compact"] .ws-lead {
  padding: 9px 11px 9px 10px;
  gap: 7px;
  border-radius: 10px;
}
.ws-kanban[data-density="compact"] .ws-lead-name { font-size: 12.5px; }
.ws-kanban[data-density="compact"] .ws-lead-source { width: 26px; height: 26px; font-size: 12px; border-radius: 7px; }
.ws-kanban[data-density="compact"] .ws-lead-top { gap: 8px; grid-template-columns: 26px minmax(0, 1fr) auto; }
.ws-kanban[data-density="compact"] .ws-lead-score { font-size: 10.5px; padding: 2px 8px; min-width: 28px; }
.ws-kanban[data-density="compact"] .ws-lead-meta { font-size: 10px; gap: 5px; min-height: 20px; }
.ws-kanban[data-density="compact"] .ws-lead-course { padding: 3px 7px; border-radius: 6px; }
.ws-kanban[data-density="compact"] .ws-lead-followup { padding: 3px 7px; border-radius: 6px; }
.ws-kanban[data-density="compact"] .ws-lead-course::before,
.ws-kanban[data-density="compact"] .ws-lead-followup::before,
.ws-kanban[data-density="compact"] .ws-lead-touch::before { display: none; }
.ws-kanban[data-density="compact"] .ws-lead-bottom { padding-top: 6px; gap: 6px; min-height: 24px; grid-template-columns: 22px minmax(0, 1fr) auto; }
.ws-kanban[data-density="compact"] .ws-lead-touch { font-size: 10.5px; }
.ws-kanban[data-density="compact"] .ws-lead-advisor { width: 22px; height: 22px; }
.ws-kanban[data-density="compact"] .ws-lead-alert { font-size: 11.5px; }

/* ---- Comfort density: slightly larger card with more breathing room ---- */
.ws-kanban[data-density="comfort"] .ws-lead {
  padding: 13px 16px 13px 14px;
  gap: 11px;
}
.ws-kanban[data-density="comfort"] .ws-lead-name { font-size: 14.5px; }
.ws-kanban[data-density="comfort"] .ws-lead-source { width: 32px; height: 32px; font-size: 14.5px; }
.ws-kanban[data-density="comfort"] .ws-lead-top { gap: 10px; grid-template-columns: 32px minmax(0, 1fr) auto; }
.ws-kanban[data-density="comfort"] .ws-lead-score { font-size: 12px; padding: 3px 11px; min-width: 34px; }
.ws-kanban[data-density="comfort"] .ws-lead-meta { font-size: 11.5px; }
.ws-kanban[data-density="comfort"] .ws-lead-course { padding: 5px 10px; }
.ws-kanban[data-density="comfort"] .ws-lead-followup { padding: 5px 10px; }
.ws-kanban[data-density="comfort"] .ws-lead-bottom { padding-top: 10px; }
.ws-kanban[data-density="comfort"] .ws-lead-advisor { width: 26px; height: 26px; font-size: 10px; }
.ws-kanban[data-density="comfort"] .ws-lead-touch { font-size: 11.5px; }

/* ---- Fit mode (8 cols squeezed): same as compact but tighter ---- */
.ws-kanban.is-fit .ws-lead {
  padding: 7px 8px 7px 7px;
  gap: 4px;
  border-radius: 8px;
}
.ws-kanban.is-fit .ws-lead-name { font-size: 11px; }
.ws-kanban.is-fit .ws-lead-source { width: 20px; height: 20px; font-size: 10.5px; border-radius: 6px; }
.ws-kanban.is-fit .ws-lead-top { gap: 5px; grid-template-columns: 20px minmax(0, 1fr) auto; }
.ws-kanban.is-fit .ws-lead-score { font-size: 9.5px; padding: 1px 6px; min-width: 22px; }
.ws-kanban.is-fit .ws-lead-meta { font-size: 9px; gap: 3px; }
.ws-kanban.is-fit .ws-lead-course { padding: 1px 5px; }
.ws-kanban.is-fit .ws-lead-followup { padding: 1px 5px; }
.ws-kanban.is-fit .ws-lead-course::before,
.ws-kanban.is-fit .ws-lead-followup::before,
.ws-kanban.is-fit .ws-lead-touch::before { display: none; }
.ws-kanban.is-fit .ws-lead-bottom { padding-top: 4px; gap: 4px; grid-template-columns: 18px minmax(0, 1fr) auto; }
.ws-kanban.is-fit .ws-lead-advisor { width: 18px; height: 18px; font-size: 8px; }
.ws-kanban.is-fit .ws-lead-touch { font-size: 9px; }
.ws-kanban.is-fit .ws-lead-alert { font-size: 10px; }
.ws-kanban.is-fit .ws-kb-head { padding: 8px 9px; gap: 6px; }
.ws-kanban.is-fit .ws-kb-title { font-size: 11px; }
.ws-kanban.is-fit .ws-kb-count { font-size: 10px; padding: 1px 7px; min-width: 22px; }
.ws-kanban.is-fit .ws-kb-add { width: 22px; height: 22px; font-size: 14px; }

/* ----- Empty column placeholder ----- */
.ws-kb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 22px 12px 24px;
  border: 1.5px dashed var(--border);
  border-radius: 11px;
  margin: 4px 0;
  color: var(--text-muted);
  font-size: 11.5px;
  text-align: center;
  background: var(--surface);
  transition: border-color .15s, background .15s;
}
.ws-kb-col.is-drop .ws-kb-empty {
  border-color: var(--stage-c, var(--brand-500));
  background: color-mix(in srgb, var(--stage-c, var(--brand-500)) 4%, var(--surface));
}
.ws-kb-empty-icon {
  font-size: 24px;
  opacity: .35;
  line-height: 1;
}
.ws-kb-empty-text {
  line-height: 1.5;
  max-width: 160px;
}
.ws-kb-empty-btn {
  background: transparent;
  border: 1px dashed var(--stage-c, var(--brand-500));
  color: var(--stage-c, var(--brand-500));
  padding: 4px 12px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  margin-top: 2px;
  transition: all .15s;
}
.ws-kb-empty-btn:hover {
  background: var(--stage-c, var(--brand-500));
  color: #fff;
  transform: translateY(-1px);
}

/* ---------- Table view ---------- */
.ws-table-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.ws-search {
  flex: 1;
  padding: 9px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
}
.ws-search:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(44,120,115,.18);
}
.ws-table th {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: right;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-strong);
  background: var(--surface-2);
}
.ws-table td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  vertical-align: middle;
}
.ws-table tr:hover td { background: color-mix(in srgb, var(--brand-500) 3%, transparent); }
.ws-table-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  max-width: 260px;
}
.ws-mono { font-family: 'Vazirmatn', monospace; font-size: 12px; }
.ws-chip-src, .ws-chip-stage {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  background: color-mix(in srgb, var(--sc) 12%, var(--surface));
  color: color-mix(in srgb, var(--sc) 85%, var(--text));
  border: 1px solid color-mix(in srgb, var(--sc) 35%, transparent);
}
.ws-advisor-dot {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ac, var(--brand-500)) 18%, var(--surface));
  color: var(--ac, var(--brand-500));
  border: 1.5px solid var(--ac, var(--brand-500));
  font-size: 9px;
  font-weight: 800;
  margin-inline-end: 4px;
  vertical-align: middle;
}
.ws-score-pill {
  display: inline-block;
  font-weight: 800;
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 99px;
  min-width: 32px;
  text-align: center;
}
.ws-score-pill[data-score="hot"]  { background: rgba(16,185,129,.12); color: #059669; }
.ws-score-pill[data-score="warm"] { background: rgba(245,158,11,.12); color: #b45309; }
.ws-score-pill[data-score="cold"] { background: rgba(148,163,184,.18); color: #475569; }
.ws-alerts-cell { font-size: 14px; letter-spacing: 4px; }

/* dark-theme tweaks for ws-* */
[data-theme="dark"] .ws-lead { background: var(--surface-2); }
[data-theme="dark"] .ws-inbox-item,
[data-theme="dark"] .ws-task-item { background: var(--surface); }
[data-theme="dark"] .ws-kb-col { background: var(--surface); }
[data-theme="dark"] .ws-select { background-color: var(--surface-2); }
[data-theme="dark"] .ws-kb-step { background: var(--surface-2); }
[data-theme="dark"] .ws-kb-step.is-active { background: color-mix(in srgb, var(--step-c, var(--brand-500)) 14%, var(--surface)); }
[data-theme="dark"] .ws-kb-health { background: var(--surface); }
[data-theme="dark"] .ws-kb-empty { background: var(--surface-2); }
[data-theme="dark"] .ws-kb-den-btn.is-active { background: var(--surface); }
[data-theme="dark"] .ws-kb-fit:hover { background: color-mix(in srgb, var(--brand-500) 10%, var(--surface)); }

/* ============================================================
   Archive panel — closed leads (won + lost)
   ============================================================ */

/* Tab badge (the chip on the "آرشیو" tab) */
.ws-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-inline-start: 6px;
  font-size: 10.5px;
  font-weight: 800;
  background: color-mix(in srgb, var(--brand-500) 15%, var(--surface));
  color: var(--brand-600);
  padding: 1px 8px;
  border-radius: 99px;
  min-width: 22px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.2px;
}
.ws-tab.active .ws-tab-badge {
  background: var(--brand-500);
  color: #fff;
}

/* KPI hero — 4 stat cards (won, lost, conversion, top loss reason) */
.ws-arc-kpi {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.ws-arc-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.ws-arc-kpi-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 4px;
  background: var(--kpi-c, var(--brand-500));
}
.ws-arc-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--kpi-c, var(--brand-500)) 12%, transparent);
}
.ws-arc-kpi-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--kpi-c, var(--brand-500)) 14%, var(--surface));
  color: var(--kpi-c, var(--brand-500));
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.ws-arc-kpi-body { min-width: 0; flex: 1; }
.ws-arc-kpi-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 3px;
}
.ws-arc-kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.4px;
}
.ws-arc-kpi-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-arc-kpi-card.kpi-won    { --kpi-c: #10b981; }
.ws-arc-kpi-card.kpi-lost   { --kpi-c: #ef4444; }
.ws-arc-kpi-card.kpi-conv   { --kpi-c: #2c7873; }
.ws-arc-kpi-card.kpi-reason { --kpi-c: #f59e0b; }

/* Sub-filter row */
.ws-arc-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.ws-arc-filters {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}
.ws-arc-filt {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all .15s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ws-arc-filt:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--brand-500) 5%, transparent);
}
.ws-arc-filt.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}
.ws-arc-filt-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.ws-arc-dot-won  { background: #10b981; box-shadow: 0 0 0 2px rgba(16,185,129,.18); }
.ws-arc-dot-lost { background: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,.18); }
.ws-arc-reason {
  min-width: 180px;
  flex-shrink: 0;
}
.ws-arc-search {
  flex: 1;
  min-width: 200px;
}

/* Archive cards grid */
.ws-arc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

/* Single archive card — richer than kanban card (shows reason + date + value) */
.ws-arc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
/* Status accent — green for won, red for lost */
.ws-arc-card::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  right: 0;
  width: 4px;
  background: var(--arc-c, var(--brand-500));
}
.ws-arc-card.is-won  { --arc-c: #10b981; }
.ws-arc-card.is-lost { --arc-c: #ef4444; }
.ws-arc-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--arc-c) 16%, transparent);
  border-color: color-mix(in srgb, var(--arc-c) 35%, var(--border));
}

.ws-arc-head {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
}
.ws-arc-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  background: color-mix(in srgb, var(--arc-c) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--arc-c) 28%, transparent);
  flex-shrink: 0;
}
.ws-arc-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -.1px;
  min-width: 0;
}
.ws-arc-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 99px;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--arc-c) 14%, var(--surface));
  color: var(--arc-c);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--arc-c) 24%, transparent);
}

.ws-arc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.ws-arc-chip {
  background: var(--surface-2);
  padding: 3px 9px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-arc-reason-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 9px 11px;
  background: color-mix(in srgb, var(--arc-c) 6%, var(--surface-2));
  border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--arc-c) 14%, transparent);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
}
.ws-arc-reason-icon {
  font-size: 14px;
  flex-shrink: 0;
  filter: saturate(1.15);
}
.ws-arc-reason-body { min-width: 0; flex: 1; }
.ws-arc-reason-label {
  font-weight: 700;
  color: var(--arc-c);
}
.ws-arc-reason-note {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.5;
}

.ws-arc-foot {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding-top: 9px;
  border-top: 1px dashed var(--border);
  min-width: 0;
}
.ws-arc-advisor {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ac, var(--brand-500)) 18%, var(--surface));
  color: var(--ac, var(--brand-500));
  border: 1.5px solid var(--ac, var(--brand-500));
  font-size: 9.5px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ws-arc-advisor-name {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.ws-arc-date {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.ws-arc-date::before { content: '🕒'; font-size: 10px; opacity: .75; }

/* Empty state for archive */
.ws-arc-empty {
  text-align: center;
  padding: 60px 24px;
  background: var(--surface-2);
  border: 1.5px dashed var(--border);
  border-radius: 14px;
  color: var(--text-muted);
}
.ws-arc-empty-icon { font-size: 44px; opacity: .45; margin-bottom: 8px; }
.ws-arc-empty-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.ws-arc-empty-sub { font-size: 12px; line-height: 1.6; max-width: 320px; margin: 0 auto; }

@media (max-width: 1100px) {
  .ws-arc-kpi { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .ws-arc-kpi { grid-template-columns: 1fr; }
}

/* Dark mode tweaks */
[data-theme="dark"] .ws-arc-kpi-card { background: var(--surface-2); }
[data-theme="dark"] .ws-arc-card { background: var(--surface-2); }
[data-theme="dark"] .ws-arc-filt.is-active { background: var(--surface); }
[data-theme="dark"] .ws-arc-empty { background: var(--surface); }

/* ============================================================
   CLASSROOMS / PROGRAMS — LMS-style class management
   ============================================================ */

/* ----- KPI row variants ----- */
.cl-kpi {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.cl-kpi::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--cl-kpi-c, var(--brand-500));
}
.cl-kpi-blue   { --cl-kpi-c: #1e6dff; --cl-kpi-soft: rgba(30,109,255,.10); }
.cl-kpi-green  { --cl-kpi-c: #10b981; --cl-kpi-soft: rgba(16,185,129,.10); }
.cl-kpi-amber  { --cl-kpi-c: #f59e0b; --cl-kpi-soft: rgba(245,158,11,.12); }
.cl-kpi-purple { --cl-kpi-c: #8b5cf6; --cl-kpi-soft: rgba(139,92,246,.12); }
.cl-kpi-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 20px;
  background: var(--cl-kpi-soft);
}

/* ----- Toolbar (tabs + search + filters) ----- */
.cl-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  flex-wrap: wrap;
}
.cl-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.cl-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all .18s ease;
  font-family: inherit;
}
.cl-tab:hover { background: var(--surface-2); }
.cl-tab.active {
  background: var(--brand-500);
  color: #fff;
  border-color: var(--brand-500);
  box-shadow: 0 4px 12px rgba(44,120,115,.3);
}
.cl-tab.active .cl-tab-dot { background: #fff !important; }
.cl-tab.active .cl-tab-badge { background: rgba(255,255,255,.22); color: #fff; }
.cl-tab-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.cl-tab-dot.tone-blue  { background: #1e6dff; }
.cl-tab-dot.tone-amber { background: #f59e0b; }
.cl-tab-dot.tone-green { background: #10b981; }
.cl-tab-dot.tone-grey  { background: #94a3b8; }
.cl-tab-badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px; height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
}
.cl-toolbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.cl-search { position: relative; display: flex; align-items: center; }
.cl-search-icon {
  position: absolute;
  inset-inline-start: 10px;
  font-size: 13px;
  pointer-events: none;
  color: var(--text-muted);
}
.cl-search input {
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 12.5px;
  width: 240px;
  font-family: inherit;
  color: var(--text);
}
.cl-search input:focus { outline: none; border-color: var(--brand-500); background: var(--surface); }
.cl-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
}
.cl-select:focus { outline: none; border-color: var(--brand-500); }
[data-theme="dark"] .cl-select,
[data-theme="dark"] .cl-search input { background-color: var(--surface); }

/* ----- Classroom grid + cards ----- */
.cl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 18px;
  margin-top: 20px;
}
.cl-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
  font-size: 13px;
}
.cl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  position: relative;
}
.cl-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(15,23,42,.10);
  border-color: var(--cl-c, var(--brand-300));
}
.cl-card-blue   { --cl-c: #1e6dff; }
.cl-card-amber  { --cl-c: #f59e0b; }
.cl-card-green  { --cl-c: #10b981; }
.cl-card-grey   { --cl-c: #94a3b8; }

.cl-card-banner {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: #fff;
  font-weight: 800;
  font-size: 36px;
}
.cl-card-banner.b1 { background: linear-gradient(135deg, #2c7873, #004445); }
.cl-card-banner.b2 { background: linear-gradient(135deg, #f4a261, #e76f51); }
.cl-card-banner.b3 { background: linear-gradient(135deg, #6dbf8f, #4d9c70); }
.cl-card-banner.b4 { background: linear-gradient(135deg, #6fb98f, #7c5cf0); }
.cl-card-banner.b5 { background: linear-gradient(135deg, #f0b86e, #d49545); }
.cl-card-banner-init {
  text-shadow: 0 4px 14px rgba(0,0,0,.25);
  letter-spacing: -1px;
}
.cl-card-status {
  position: absolute;
  inset-block-start: 10px;
  inset-inline-end: 10px;
}
.cl-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255,255,255,.92);
  color: var(--cl-status-c, #0f172a);
  backdrop-filter: blur(8px);
}
.cl-status-pill.cl-status-blue  { --cl-status-c: #1e6dff; }
.cl-status-pill.cl-status-amber { --cl-status-c: #c46920; }
.cl-status-pill.cl-status-green { --cl-status-c: #0f8a5a; }
.cl-status-pill.cl-status-grey  { --cl-status-c: #475569; }
.cl-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cl-status-c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cl-status-c) 25%, transparent);
}
.cl-card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.cl-card-head { display: flex; flex-direction: column; gap: 4px; }
.cl-card-code {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: .02em;
}
.cl-card-title {
  font-weight: 800;
  font-size: 15px;
  color: var(--text-strong, #0f172a);
  line-height: 1.5;
}
[data-theme="dark"] .cl-card-title { color: #e2e8f0; }
.cl-card-meta { display: flex; flex-direction: column; gap: 6px; }
.cl-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
}
.cl-meta-icon { font-size: 14px; flex-shrink: 0; }
.cl-meta-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-meta-text strong { font-weight: 700; }
.cl-meta-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  flex-shrink: 0;
}
.avatar-mini {
  width: 24px; height: 24px;
  font-size: 9px;
  font-weight: 700;
}
.cl-card-progress {
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 10px;
}
.cl-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  margin-bottom: 6px;
}
.cl-progress-bar {
  background: var(--brand-50, #f3f5fc);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
}
.cl-progress-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cl-c, var(--brand-500)), var(--accent-500));
  border-radius: 4px;
  transition: width .8s cubic-bezier(.22,.7,.16,1);
}
.cl-card-countdown {
  padding: 10px 12px;
  background: rgba(245,158,11,0.08);
  color: #c46920;
  border-radius: 10px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cl-countdown-icon { font-size: 16px; }
.cl-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.cl-stat {
  text-align: center;
  padding: 8px 6px;
  background: var(--surface-2);
  border-radius: 10px;
}
.cl-stat-v {
  font-weight: 800;
  font-size: 18px;
  color: var(--text-strong, #0f172a);
  line-height: 1.1;
}
[data-theme="dark"] .cl-stat-v { color: #e2e8f0; }
.cl-stat-v small { font-weight: 600; font-size: 11px; color: var(--text-muted); }
.cl-stat-k {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}
.att-good { color: #0f8a5a !important; }
.att-mid  { color: #c46920 !important; }
.att-low  { color: #b14458 !important; }
.cl-card-rahin {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(244,162,97,0.08), rgba(111,185,143,0.06));
  border-inline-start: 3px solid var(--accent-500);
  border-radius: 8px;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--text);
}
.cl-card-rahin .diaco-spark { color: var(--accent-500); margin-top: 1px; }
.cl-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}
.cl-card-actions .btn {
  height: 34px;
  padding: 0 12px;
  font-size: 12px;
  flex: 1;
  min-width: 0;
}

/* ============================================================
   CLASSROOM DRAWER
   ============================================================ */
.cl-drawer {
  width: min(1100px, 96vw);
  max-width: 96vw;
  display: flex;
  flex-direction: column;
}
.cl-drawer-head {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 16px;
  align-items: center;
  padding: 26px 56px 24px 24px;
  background: linear-gradient(155deg, #5b93d6 0%, #223a63 115%);
  position: relative; overflow: hidden; isolation: isolate;
}
.cl-drawer-head::before, .cl-drawer-head::after {
  content: ''; position: absolute; border-radius: 50%; background: #fff; filter: blur(28px); pointer-events: none; z-index: -1;
}
.cl-drawer-head::before { width: 160px; height: 160px; top: -70px; inset-inline-start: -45px; opacity: .16; }
.cl-drawer-head::after { width: 110px; height: 110px; bottom: -55px; inset-inline-end: 60px; opacity: .12; }
.cl-dh-banner {
  width: 78px; height: 78px;
  border-radius: 18px;
  display: grid; place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -1px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.32), 0 8px 18px -8px rgba(0,0,0,.3);
}
.cl-dh-banner.b1 { background: linear-gradient(135deg, #2c7873, #004445); }
.cl-dh-banner.b2 { background: linear-gradient(135deg, #f4a261, #e76f51); }
.cl-dh-banner.b3 { background: linear-gradient(135deg, #6dbf8f, #4d9c70); }
.cl-dh-banner.b4 { background: linear-gradient(135deg, #6fb98f, #7c5cf0); }
.cl-dh-banner.b5 { background: linear-gradient(135deg, #f0b86e, #d49545); }
.cl-dh-code {
  font-size: 11.5px;
  color: rgba(255,255,255,.82);
  margin-bottom: 4px;
}
.cl-dh-title {
  font-size: 19px;
  font-weight: 800;
  margin: 0 0 10px;
  color: #fff;
}
[data-theme="dark"] .cl-dh-title { color: #fff; }
.cl-dh-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.cl-drawer-head .drawer-close {
  position: absolute;
  inset-block-start: 14px;
  inset-inline-end: 14px;
}
.cl-drawer-tabs {
  display: flex;
  gap: 4px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  overflow-x: auto;
}
.cl-dtab {
  padding: 14px 16px;
  border: 0;
  background: transparent;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  font-family: inherit;
  transition: color .18s ease, border-color .18s ease;
}
.cl-dtab:hover { color: var(--text); }
.cl-dtab.active {
  color: var(--brand-500);
  border-bottom-color: var(--brand-500);
}
.cl-drawer-body {
  padding: 20px 24px 32px;
  overflow-y: auto;
  flex: 1;
}

.cl-section { margin-top: 22px; }
.cl-section:first-child { margin-top: 0; }
.cl-section-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-strong, #0f172a);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}
[data-theme="dark"] .cl-section-title { color: #e2e8f0; }

.cl-ov-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 4px;
}
.cl-ov-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.cl-ov-icon { font-size: 20px; margin-bottom: 8px; }
.cl-ov-k {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.cl-ov-v {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-strong, #0f172a);
  margin-bottom: 4px;
}
[data-theme="dark"] .cl-ov-v { color: #e2e8f0; }
.cl-ov-v small { font-weight: 500; font-size: 11px; color: var(--text-muted); }
.cl-ov-meta {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
}
.cl-ov-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.cl-ov-stat {
  text-align: center;
  padding: 14px 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.cl-ov-stat-v {
  font-weight: 800;
  font-size: 22px;
  color: var(--text-strong, #0f172a);
}
[data-theme="dark"] .cl-ov-stat-v { color: #e2e8f0; }
.cl-ov-stat-v small { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.cl-ov-stat-k {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.cl-att-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.cl-att-chip {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cl-att-chip strong { font-size: 16px; font-weight: 800; }
.cl-att-present { background: rgba(16,185,129,.12); color: #0f8a5a; }
.cl-att-late    { background: rgba(245,158,11,.14); color: #c46920; }
.cl-att-excused { background: rgba(30,109,255,.12); color: #1e6dff; }
.cl-att-absent  { background: rgba(239,68,68,.12); color: #b14458; }

.cl-diaco-panel {
  margin-top: 22px;
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(244,162,97,0.10), rgba(111,185,143,0.08));
  border: 1px solid color-mix(in srgb, var(--accent-500) 30%, transparent);
}
.cl-diaco-head {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--accent-500);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cl-diaco-body {
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text);
}

.cl-sess-table .cl-sess-future { opacity: .55; }
.cl-sess-att {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}
.cl-att-bar {
  display: flex;
  flex: 1;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface-2);
}
.cl-att-bar-present { background: #10b981; }
.cl-att-bar-late    { background: #f59e0b; }
.cl-att-bar-excused { background: #1e6dff; }
.cl-att-bar-absent  { background: #ef4444; }
.cl-sess-att-num {
  font-weight: 700;
  font-size: 12px;
  min-width: 36px;
  text-align: end;
}
.cl-sess-pending {
  color: var(--text-muted);
  font-size: 11.5px;
  font-style: italic;
}
.btn-xs { height: 28px !important; padding: 0 10px !important; font-size: 11px !important; }

.cl-stu-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cl-att-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 130px;
}
.cl-att-mini-bar {
  flex: 1;
  height: 7px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}
.cl-att-mini-bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
}
.cl-att-mini-bar i.att-good { background: #10b981; }
.cl-att-mini-bar i.att-mid  { background: #f59e0b; }
.cl-att-mini-bar i.att-low  { background: #ef4444; }

.cl-att-legend {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.cl-att-leg {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}
.cl-att-leg.att-present { background: rgba(16,185,129,.14); color: #0f8a5a; }
.cl-att-leg.att-late    { background: rgba(245,158,11,.14); color: #c46920; }
.cl-att-leg.att-excused { background: rgba(30,109,255,.12); color: #1e6dff; }
.cl-att-leg.att-absent  { background: rgba(239,68,68,.12); color: #b14458; }
.cl-att-leg.att-future  { background: var(--surface-2); color: var(--text-muted); }

.cl-att-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.cl-att-matrix {
  border-collapse: collapse;
  width: 100%;
  font-size: 11px;
}
.cl-att-matrix th, .cl-att-matrix td {
  padding: 6px 4px;
  text-align: center;
  border-inline-end: 1px solid var(--border);
  border-block-end: 1px solid var(--border);
  white-space: nowrap;
}
.cl-att-matrix thead th {
  background: var(--surface-2);
  font-weight: 700;
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
}
.cl-att-name-h, .cl-att-total-h {
  text-align: start !important;
  font-size: 11px;
}
.cl-att-name {
  text-align: start !important;
  padding: 6px 10px !important;
  position: sticky;
  inset-inline-start: 0;
  background: var(--surface);
  z-index: 1;
  min-width: 180px;
  border-inline-end: 2px solid var(--border) !important;
}
.cl-att-future-h { color: var(--text-muted); font-weight: 500 !important; }
.cl-att-total {
  text-align: start !important;
  padding: 6px 10px !important;
  background: var(--surface-2);
  border-inline-start: 2px solid var(--border) !important;
  min-width: 70px;
  font-size: 12px;
}
.cl-att-total small { font-size: 10px; color: var(--text-muted); font-weight: 500; }
.cl-att-cell { width: 28px; font-weight: 700; cursor: help; }
.cl-att-cell.att-present { background: rgba(16,185,129,.14); color: #0f8a5a; }
.cl-att-cell.att-late    { background: rgba(245,158,11,.18); color: #c46920; }
.cl-att-cell.att-excused { background: rgba(30,109,255,.14); color: #1e6dff; }
.cl-att-cell.att-absent  { background: rgba(239,68,68,.14); color: #b14458; }
.cl-att-cell.att-future  { color: var(--text-muted); opacity: .4; }

.cl-finance-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.cl-fin-chip {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
}
.cl-fin-chip strong { font-size: 16px; font-weight: 800; }
.cl-fin-chip.green { background: rgba(16,185,129,.12); color: #0f8a5a; }
.cl-fin-chip.amber { background: rgba(245,158,11,.14); color: #c46920; }
.cl-fin-chip.red   { background: rgba(239,68,68,.12); color: #b14458; }

@media (max-width: 920px) {
  .cl-grid { grid-template-columns: 1fr; }
  .cl-toolbar { flex-direction: column; align-items: stretch; }
  .cl-toolbar-right { flex-direction: column; align-items: stretch; }
  .cl-search input { width: 100%; }
  .cl-drawer-head { grid-template-columns: 60px 1fr; padding-inline-end: 50px; }
  .cl-dh-banner { width: 60px; height: 60px; font-size: 22px; }
}

/* =========================================================
   WORKSPACE — Compact KPI strip + Drawer + Sortable + Add buttons
   namespace: ws-* (extends the earlier ws-* block above)
   ========================================================= */

/* ---------- Compact KPI strip (6 in a row) ---------- */
.ws-kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
@media (max-width: 1400px) { .ws-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px)  { .ws-kpis { grid-template-columns: repeat(2, 1fr); } }

.ws-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
  box-shadow: var(--shadow-xs);
  border-inline-start: 3px solid var(--tone-c, var(--brand-500));
  transition: transform .15s, box-shadow .15s;
}
.ws-kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.ws-kpi-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  background: color-mix(in srgb, var(--tone-c, var(--brand-500)) 14%, var(--surface-2));
  border-radius: 9px;
}
.ws-kpi-body { min-width: 0; }
.ws-kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 1px;
}
.ws-kpi-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
  line-height: 1.1;
}
.ws-kpi-delta {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ---------- Kanban add-button (+ in column header) ---------- */
.ws-kb-head { gap: 8px; }
.ws-kb-add {
  background: transparent;
  border: 1.5px dashed var(--stage-c, var(--brand-500));
  color: var(--stage-c, var(--brand-500));
  width: 24px; height: 24px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  padding: 0;
  transition: all .15s;
}
.ws-kb-add:hover {
  background: var(--stage-c, var(--brand-500));
  color: #fff;
}

/* ---- Toolbar above kanban (density + hint + fit) ---- */
.ws-kanban-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 12px;
  flex-wrap: wrap;
}
.ws-kb-density {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}
.ws-kb-den-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 11px;
  border-radius: 7px;
  font-size: 14px;
  color: var(--text-muted);
  transition: all .15s;
  font-family: inherit;
  line-height: 1;
}
.ws-kb-den-btn:hover { color: var(--text); background: color-mix(in srgb, var(--brand-500) 6%, transparent); }
.ws-kb-den-btn.is-active {
  background: var(--surface);
  color: var(--brand-600);
  box-shadow: var(--shadow-xs);
}
.ws-hint {
  font-size: 11.5px;
  flex: 1;
  text-align: center;
  color: var(--text-muted);
  min-width: 200px;
}
.ws-kb-fit {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 6px 13px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  font-family: inherit;
  transition: all .15s;
  white-space: nowrap;
}
.ws-kb-fit:hover {
  border-color: var(--brand-500);
  color: var(--brand-600);
  background: color-mix(in srgb, var(--brand-500) 5%, var(--surface-2));
}
.ws-kb-fit.is-active {
  background: color-mix(in srgb, var(--brand-500) 12%, var(--surface));
  border-color: var(--brand-500);
  color: var(--brand-600);
}

/* ---------- Table: sortable + actions ---------- */
.ws-table th.ws-sortable {
  cursor: pointer;
  user-select: none;
  transition: background .15s, color .15s;
}
.ws-table th.ws-sortable:hover {
  background: color-mix(in srgb, var(--brand-500) 8%, var(--surface-2));
  color: var(--brand-600);
}
.ws-table th.ws-sortable.is-sorted {
  color: var(--brand-600);
  background: color-mix(in srgb, var(--brand-500) 6%, var(--surface-2));
}
.ws-sort-arrow {
  font-size: 9px;
  color: var(--brand-500);
  margin-inline-start: 2px;
}
.ws-table tbody tr { cursor: pointer; }
.ws-row-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  white-space: nowrap;
}
.ws-row-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 26px; height: 26px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.ws-row-btn:hover {
  background: var(--brand-500);
  color: #fff;
  border-color: transparent;
}
.ws-row-btn-danger:hover { background: #ef4444; }

/* ---------- DRAWER (slide-in side panel) ---------- */
.ws-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, visibility .25s;
  z-index: 200;
}
.ws-drawer-overlay.is-open { opacity: 1; visibility: visible; }
.ws-drawer {
  position: fixed;
  top: 0; bottom: 0;
  inset-inline-start: 0;            /* RTL: pinned to right edge */
  width: min(960px, 95vw);
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  box-shadow: -24px 0 48px rgba(0,0,0,.18);
  /* RTL: push off-screen to the right (positive X = right) */
  transform: translateX(105%);
  transition: transform .35s cubic-bezier(.22,.7,.16,1), visibility 0s linear .35s;
  display: flex;
  flex-direction: column;
  z-index: 210;
  visibility: hidden;
  overflow: hidden;
}
.ws-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform .35s cubic-bezier(.22,.7,.16,1), visibility 0s;
}

.ws-drawer-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand-500) 6%, var(--surface)), var(--surface));
}
.ws-drawer-mode-pill {
  font-weight: 800;
  font-size: 13.5px;
  color: var(--brand-600);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-drawer-close {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 30px; height: 30px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, border-color .15s, transform .2s;
}
.ws-drawer-close:hover {
  background: #ef4444;
  color: #fff;
  border-color: transparent;
  transform: rotate(90deg);
}

.ws-drawer-tabs {
  display: flex;
  gap: 0;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.ws-dr-tab {
  background: transparent;
  border: 0;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .15s;
}
.ws-dr-tab:hover { color: var(--text); }
.ws-dr-tab.active {
  color: var(--brand-600);
  border-bottom-color: var(--brand-500);
}

.ws-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 8px;
}
.ws-drawer-body::-webkit-scrollbar { width: 6px; }
.ws-drawer-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }

.ws-dr-panel { display: none; }
.ws-dr-panel.active { display: block; animation: wsFade .25s ease-out; }

.ws-dr-section {
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}
.ws-dr-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.ws-dr-section-title {
  font-weight: 700;
  font-size: 11.5px;
  color: var(--brand-600);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ws-dr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.ws-dr-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ws-dr-field > span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}
.ws-dr-field input,
.ws-dr-field select,
.ws-dr-field textarea {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 9px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.ws-dr-field textarea { resize: vertical; min-height: 52px; line-height: 1.6; }
.ws-dr-field input:focus,
.ws-dr-field select:focus,
.ws-dr-field textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(44,120,115,.18);
}

.ws-dr-flags {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.ws-dr-flag {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 11.5px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.ws-dr-flag:hover {
  background: color-mix(in srgb, var(--brand-500) 4%, var(--surface-2));
  border-color: var(--border-strong);
}
.ws-dr-flag input { width: 15px; height: 15px; accent-color: var(--brand-500); }

.ws-dr-quickadd {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
  margin-bottom: 8px;
}
.ws-dr-quickadd select,
.ws-dr-quickadd input {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 9px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
}
.ws-dr-quickadd select { min-width: 110px; }

.ws-dr-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ws-tl-item {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.ws-tl-icon {
  font-size: 16px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--brand-500) 10%, var(--surface));
  border-radius: 7px;
}
.ws-tl-text { font-size: 12.5px; color: var(--text); line-height: 1.6; }
.ws-tl-time { font-size: 11px; margin-top: 2px; }
.ws-empty {
  text-align: center;
  padding: 30px 10px;
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.ws-dr-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.ws-stage-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  border-inline-start: 3px solid var(--sc, var(--brand-500));
  transition: all .15s;
}
.ws-stage-btn:hover {
  background: color-mix(in srgb, var(--sc, var(--brand-500)) 10%, var(--surface));
}
.ws-stage-btn.is-active {
  background: var(--sc, var(--brand-500));
  color: #fff;
  border-color: var(--sc, var(--brand-500));
}

.ws-dr-actions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ws-dr-action {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  text-align: start;
  transition: all .15s;
}
.ws-dr-action:hover {
  background: color-mix(in srgb, var(--brand-500) 8%, var(--surface));
  border-color: var(--brand-500);
}
.ws-dr-action-danger { color: #ef4444; }
.ws-dr-action-danger:hover {
  background: rgba(239, 68, 68, .08);
  border-color: #ef4444;
}

[data-theme="dark"] .ws-drawer { background: var(--surface); }
[data-theme="dark"] .ws-kpi { background: var(--surface-2); }
[data-theme="dark"] .ws-dr-field input,
[data-theme="dark"] .ws-dr-field select,
[data-theme="dark"] .ws-dr-field textarea { background: var(--surface); }

/* ============================================================
   STUDENT PROFILE DRAWER (360°) — namespace .sp-*
   ============================================================ */
.sp-drawer {
  width: min(960px, 96vw);
  display: flex;
  flex-direction: column;
  z-index: 121;
}
#sp-drawer-overlay { z-index: 120; }
.sp-drawer-head {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 28px 56px 26px 28px;
  background: linear-gradient(155deg, #5b93d6 0%, #223a63 115%);
  position: relative; overflow: hidden; isolation: isolate;
}
.sp-drawer-head::before, .sp-drawer-head::after {
  content: ''; position: absolute; border-radius: 50%; background: #fff; filter: blur(28px); pointer-events: none; z-index: -1;
}
.sp-drawer-head::before { width: 170px; height: 170px; top: -75px; inset-inline-start: -50px; opacity: .16; }
.sp-drawer-head::after { width: 120px; height: 120px; bottom: -60px; inset-inline-end: 90px; opacity: .12; }
.sp-drawer-head .drawer-close {
  position: absolute;
  inset-block-start: 14px;
  inset-inline-end: 14px;
}
.sp-hero-avatar {
  width: 96px; height: 96px;
  border-radius: 24px;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 28px;
  color: #fff;
  letter-spacing: -1px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.32), 0 10px 24px rgba(0,0,0,.3);
}
.sp-hero-avatar.avatar-m { background: linear-gradient(135deg, #2c7873, #004445); }
.sp-hero-avatar.avatar-f { background: linear-gradient(135deg, #f4a261, #e76f51); }

.sp-hero-meta { min-width: 0; }
.sp-hero-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.sp-hero-name {
  font-size: 22px;
  font-weight: 800;
  margin: 0;
  color: #fff;
}
[data-theme="dark"] .sp-hero-name { color: #fff; }
.sp-hero-gender { font-size: 20px; }
.sp-hero-contact {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: rgba(255,255,255,.82);
  margin-bottom: 8px;
}
.sp-hero-contact a {
  color: #fff;
  text-decoration: none;
}
.sp-hero-contact a:hover { text-decoration: underline; }
.sp-hero-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.sp-hero-kpis {
  display: flex;
  gap: 12px;
}
.sp-hero-kpi {
  text-align: center;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,.14);
  backdrop-filter: blur(6px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.24);
  min-width: 76px;
}
.sp-hero-kpi-v {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}
[data-theme="dark"] .sp-hero-kpi-v { color: #fff; }
.sp-hero-kpi-v small { font-size: 11px; font-weight: 600; color: rgba(255,255,255,.75); }
.sp-hero-kpi-k {
  font-size: 10.5px;
  color: rgba(255,255,255,.75);
  margin-top: 6px;
}

.sp-drawer-tabs {
  display: flex;
  gap: 4px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  overflow-x: auto;
}
.sp-dtab {
  padding: 14px 16px;
  border: 0;
  background: transparent;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  font-family: inherit;
  transition: color .18s ease, border-color .18s ease;
}
.sp-dtab:hover { color: var(--text); }
.sp-dtab.active {
  color: var(--brand-500);
  border-bottom-color: var(--brand-500);
}
.sp-drawer-body {
  padding: 20px 28px 32px;
  overflow-y: auto;
  flex: 1;
}

.sp-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 14px;
}
.sp-info {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.sp-info-k {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.sp-info-v {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.sp-class-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.sp-class-banner {
  width: 56px; height: 56px;
  border-radius: 14px;
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 20px;
}
.sp-class-banner.b1 { background: linear-gradient(135deg, #2c7873, #004445); }
.sp-class-banner.b2 { background: linear-gradient(135deg, #f4a261, #e76f51); }
.sp-class-banner.b3 { background: linear-gradient(135deg, #6dbf8f, #4d9c70); }
.sp-class-banner.b4 { background: linear-gradient(135deg, #6fb98f, #7c5cf0); }
.sp-class-banner.b5 { background: linear-gradient(135deg, #f0b86e, #d49545); }
.sp-class-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text-strong, #0f172a);
}
[data-theme="dark"] .sp-class-title { color: #e2e8f0; }
.sp-class-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.sp-alert {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  margin-top: 16px;
  border-inline-start: 4px solid;
  font-size: 12.5px;
  line-height: 1.65;
}
.sp-alert > span:first-child { font-size: 20px; }
.sp-alert-red {
  background: rgba(239,68,68,.06);
  border-color: #ef4444;
  color: #b14458;
}
.sp-alert strong { color: #b14458; display: block; margin-bottom: 4px; }

.sp-academic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.sp-acad-card {
  padding: 16px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
}
.sp-acad-final {
  background: linear-gradient(135deg, rgba(244,162,97,.06), rgba(111,185,143,.05));
  border-color: color-mix(in srgb, var(--accent-500) 35%, transparent);
}
.sp-acad-icon { font-size: 24px; margin-bottom: 8px; }
.sp-acad-k {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.sp-acad-v {
  font-weight: 800;
  font-size: 26px;
  color: var(--text-strong, #0f172a);
}
[data-theme="dark"] .sp-acad-v { color: #e2e8f0; }
.sp-acad-v small { font-size: 13px; font-weight: 600; color: var(--text-muted); }

.sp-cert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sp-cert {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(244,162,97,.06), rgba(255,221,131,.04));
}
.sp-cert-icon { font-size: 24px; }
.sp-cert-info { min-width: 0; }
.sp-cert-name { font-weight: 700; font-size: 13px; }
.sp-cert-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.sp-att-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.sp-att-cell {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: help;
  position: relative;
  transition: transform .15s ease;
}
.sp-att-cell:hover { transform: translateY(-2px); }
.sp-att-num {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 4px;
}
.sp-att-sym {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 4px;
}
.sp-att-topic {
  font-size: 10.5px;
  color: var(--text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sp-att-cell.att-present { background: rgba(16,185,129,.10); border-color: rgba(16,185,129,.3); }
.sp-att-cell.att-present .sp-att-sym { color: #0f8a5a; }
.sp-att-cell.att-late { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.3); }
.sp-att-cell.att-late .sp-att-sym { color: #c46920; }
.sp-att-cell.att-absent { background: rgba(239,68,68,.10); border-color: rgba(239,68,68,.3); }
.sp-att-cell.att-absent .sp-att-sym { color: #b14458; }
.sp-att-cell.att-excused { background: rgba(30,109,255,.08); border-color: rgba(30,109,255,.3); }
.sp-att-cell.att-excused .sp-att-sym { color: #1e6dff; }
.sp-att-cell.att-future { opacity: .55; border-style: dashed; }
.sp-att-cell.att-future .sp-att-sym { color: var(--text-muted); }

.sp-fin-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.sp-fin-stat {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.sp-fin-paid { background: rgba(16,185,129,.05); border-color: rgba(16,185,129,.3); }
.sp-fin-remaining { background: rgba(245,158,11,.05); border-color: rgba(245,158,11,.3); }
.sp-fin-k {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.sp-fin-v {
  font-weight: 800;
  font-size: 18px;
  color: var(--text-strong, #0f172a);
}
[data-theme="dark"] .sp-fin-v { color: #e2e8f0; }
.sp-fin-v small { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.sp-fin-bar {
  margin-top: 10px;
  height: 6px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}
.sp-fin-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #6dbf8f);
  border-radius: 4px;
}
.sp-fin-meta {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 6px;
}

.sp-installments {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sp-inst {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.sp-inst-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 14px;
  background: var(--surface-2);
  color: var(--text-muted);
}
.sp-inst-paid { background: rgba(16,185,129,.06); border-color: rgba(16,185,129,.3); }
.sp-inst-paid .sp-inst-icon { background: #10b981; color: #fff; }
.sp-inst-paid .sp-inst-status { color: #0f8a5a; }
.sp-inst-pending { background: rgba(245,158,11,.06); border-color: rgba(245,158,11,.3); }
.sp-inst-pending .sp-inst-icon { background: #f59e0b; color: #fff; }
.sp-inst-pending .sp-inst-status { color: #c46920; font-weight: 700; }
.sp-inst-upcoming .sp-inst-status { color: var(--text-muted); }
.sp-inst-label { font-weight: 700; font-size: 13px; }
.sp-inst-date { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.sp-inst-amount { font-weight: 700; font-size: 14px; }
.sp-inst-amount small { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.sp-inst-status { font-size: 11.5px; font-weight: 600; min-width: 70px; text-align: end; }

.sp-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}
.sp-tl-item {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 14px;
  padding: 14px 0;
}
.sp-tl-item:not(:last-child) {
  border-bottom: 1px dashed var(--border);
}
.sp-tl-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2);
  font-size: 18px;
}
.sp-tl-call .sp-tl-icon { background: rgba(30,109,255,.12); }
.sp-tl-sms .sp-tl-icon { background: rgba(245,158,11,.14); }
.sp-tl-email .sp-tl-icon { background: rgba(139,92,246,.12); }
.sp-tl-whatsapp .sp-tl-icon { background: rgba(16,185,129,.14); }
.sp-tl-enroll .sp-tl-icon { background: rgba(244,162,97,.16); }
.sp-tl-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.sp-tl-type {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text);
}
.sp-tl-date {
  font-size: 11px;
  color: var(--text-muted);
}
.sp-tl-text {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 4px;
}
.sp-tl-by {
  font-size: 10.5px;
  color: var(--text-muted);
}

.sp-quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sp-quick-actions .btn {
  height: 36px;
  padding: 0 14px;
  font-size: 12.5px;
}

.sp-diaco-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 720px) { .sp-diaco-stats { grid-template-columns: 1fr; } }
.sp-diaco-stat {
  padding: 18px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
  border-inline-start: 5px solid var(--rs-c, var(--brand-500));
}
.sp-diaco-green { --rs-c: #10b981; background: rgba(16,185,129,.04); }
.sp-diaco-amber { --rs-c: #f59e0b; background: rgba(245,158,11,.06); }
.sp-diaco-red   { --rs-c: #ef4444; background: rgba(239,68,68,.06); }
.sp-diaco-icon { font-size: 28px; margin-bottom: 8px; }
.sp-diaco-k {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.sp-diaco-v {
  font-size: 32px;
  font-weight: 800;
  color: var(--rs-c, var(--brand-500));
  line-height: 1;
  margin-bottom: 6px;
}
.sp-diaco-v small { font-size: 14px; font-weight: 600; }
.sp-diaco-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.sp-rec-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sp-rec {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  border: 1px dashed color-mix(in srgb, var(--accent-500) 35%, transparent);
  background: linear-gradient(135deg, rgba(244,162,97,.06), rgba(111,185,143,.04));
}
.sp-rec-spark {
  color: var(--accent-500);
  font-size: 20px;
  text-shadow: 0 0 8px rgba(244,162,97,0.4);
}
.sp-rec-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
}
.sp-rec-detail {
  font-size: 12px;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.65;
}
.sp-rec-action {
  font-size: 12px;
  line-height: 1.65;
  padding-top: 6px;
  border-top: 1px dotted color-mix(in srgb, var(--accent-500) 40%, transparent);
}
.sp-rec-action strong { color: var(--accent-500); }

@media (max-width: 760px) {
  .sp-drawer-head { grid-template-columns: 64px 1fr; padding-inline-end: 50px; }
  .sp-hero-avatar { width: 64px; height: 64px; font-size: 20px; }
  .sp-hero-kpis { grid-column: 1 / -1; justify-content: center; }
}

/* =========================================================
   WORKSPACE — DRAWER REDESIGN (Phase 2: Customer 360°)
   Hero + stats bar + 4 tabs + Won/Lost close bar
   ========================================================= */

/* ----- Hero header (avatar + name + chips + closed badge) ----- */
.ws-drawer-head {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  padding: 12px 16px 10px;
  align-items: center;
  flex-shrink: 0;
}
.ws-dr-avatar {
  width: 44px; height: 44px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 14px -4px rgba(44,120,115,.4);
  text-transform: uppercase;
}
.ws-dr-head-info { min-width: 0; }
.ws-dr-head-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
}
.ws-dr-head-name {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.012em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  line-height: 1.3;
}
.ws-dr-closed-badge {
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 99px;
  flex-shrink: 0;
}
.ws-dr-closed-badge.is-won  { background: rgba(16,185,129,.16); color: #059669; border: 1px solid #10b981; }
.ws-dr-closed-badge.is-lost { background: rgba(239,68,68,.14); color: #dc2626; border: 1px solid #ef4444; }

/* Chips: single line, horizontal scroll if overflow */
.ws-dr-head-chips {
  display: flex;
  gap: 5px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.ws-dr-head-chips::-webkit-scrollbar { display: none; }
.ws-dr-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 600;
  background: color-mix(in srgb, var(--c, var(--brand-500)) 12%, var(--surface));
  color: color-mix(in srgb, var(--c, var(--brand-500)) 80%, var(--text));
  border: 1px solid color-mix(in srgb, var(--c, var(--brand-500)) 30%, transparent);
  flex-shrink: 0;
  white-space: nowrap;
}
.ws-dr-chip-score[data-score="hot"]  { background: rgba(16,185,129,.14); color: #059669; border-color: #10b981; }
.ws-dr-chip-score[data-score="warm"] { background: rgba(245,158,11,.14); color: #b45309; border-color: #f59e0b; }
.ws-dr-chip-score[data-score="cold"] { background: rgba(148,163,184,.18); color: #475569; border-color: #94a3b8; }
.ws-dr-chip-tag {
  background: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
}

/* Stats bar: single-row horizontal strip with inline items */
.ws-dr-statsbar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 8px 14px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex-shrink: 0;
}
.ws-dr-statsbar::-webkit-scrollbar { display: none; }
.ws-stat {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 0 12px;
  border-inline-end: 1px solid var(--border);
  white-space: nowrap;
  flex-shrink: 0;
}
.ws-stat:first-child { padding-inline-start: 0; }
.ws-stat:last-child { border-inline-end: 0; padding-inline-end: 0; }
.ws-stat-icon { font-size: 12px; line-height: 1; }
.ws-stat-val {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.ws-stat-lbl {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ----- Section count (number badge in title) ----- */
.ws-dr-section-count {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  margin-inline-start: 6px;
}

/* ----- Communications: filter chips ----- */
.ws-dr-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.ws-dr-filter-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}
.ws-dr-filter-chip:hover { color: var(--text); background: var(--surface); }
.ws-dr-filter-chip.active {
  background: var(--brand-500);
  color: #fff;
  border-color: transparent;
}

/* ----- Comm timeline accent stripes (by type) ----- */
.ws-tl-item.ws-tl-call    { border-inline-start: 3px solid #fb7185; }
.ws-tl-item.ws-tl-message { border-inline-start: 3px solid #25D366; }
.ws-tl-item.ws-tl-sms     { border-inline-start: 3px solid #d4a017; }
.ws-tl-item.ws-tl-instagram { border-inline-start: 3px solid #E4405F; }
.ws-tl-item.ws-tl-meeting { border-inline-start: 3px solid #8b5cf6; }
.ws-tl-item.ws-tl-stage   { border-inline-start: 3px solid var(--brand-500); }
.ws-tl-item.ws-tl-payment { border-inline-start: 3px solid #10b981; background: rgba(16,185,129,.04); }
.ws-tl-item.ws-tl-ai      { border-inline-start: 3px solid #6fb98f; background: rgba(111,185,143,.06); }
.ws-tl-item.ws-tl-note    { border-inline-start: 3px solid #94a3b8; }

/* ----- Tasks tab: row layout ----- */
.ws-dr-task-add {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 10px;
}
.ws-dr-task-add > input {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 9px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text);
  margin-bottom: 6px;
}
.ws-dr-task-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
}
.ws-dr-task-row select,
.ws-dr-task-row input {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 9px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
}
.ws-dr-task-row select { min-width: 100px; }

.ws-dr-tasks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ws-task-row {
  display: grid;
  grid-template-columns: 18px 22px 1fr 22px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: opacity .15s;
}
.ws-task-row.is-done {
  opacity: .55;
  background: var(--surface);
}
.ws-task-row.is-done .ws-task-row-title { text-decoration: line-through; }
.ws-task-row-check {
  appearance: none;
  width: 18px; height: 18px;
  border: 2px solid var(--border-strong);
  border-radius: 5px;
  cursor: pointer;
  position: relative;
  transition: all .15s;
}
.ws-task-row-check:checked {
  background: var(--brand-500);
  border-color: var(--brand-500);
}
.ws-task-row-check:checked::after {
  content: '✓';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 800;
}
.ws-task-row-icon { font-size: 16px; text-align: center; }
.ws-task-row-body { min-width: 0; }
.ws-task-row-title { font-weight: 700; font-size: 12.5px; color: var(--text); }
.ws-task-row-due { font-size: 11px; margin-top: 1px; }
.ws-task-row-delete {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 22px; height: 22px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.ws-task-row-delete:hover {
  background: #ef4444;
  color: #fff;
  border-color: transparent;
}

/* ----- Coach tab ----- */
.ws-dr-coach {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ws-coach-hero {
  padding: 16px;
  background: linear-gradient(135deg, rgba(111,185,143,.10), rgba(44,120,115,.08));
  border: 1px dashed #6fb98f;
  border-radius: 12px;
  text-align: center;
}
.ws-coach-tag {
  font-size: 11px;
  font-weight: 800;
  color: #8b5cf6;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.ws-coach-persona {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.015em;
}
.ws-coach-tone {
  font-size: 12px;
  margin-top: 3px;
}
.ws-coach-pred-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ws-coach-pred {
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.ws-coach-pred-lbl {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 3px;
}
.ws-coach-pred-val {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}
.ws-coach-conv { color: #059669; font-size: 18px; }
.ws-coach-section {
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.ws-coach-dos   { border-inline-start: 3px solid #10b981; }
.ws-coach-donts { border-inline-start: 3px solid #ef4444; }
.ws-coach-section-title {
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 8px;
}
.ws-coach-dos .ws-coach-section-title   { color: #059669; }
.ws-coach-donts .ws-coach-section-title { color: #dc2626; }
.ws-coach-section ul {
  margin: 0;
  padding-inline-start: 18px;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--text);
}
.ws-coach-warn {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  background: rgba(245,158,11,.08);
  border: 1px solid #f59e0b;
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.6;
}
.ws-coach-warn-icon { font-size: 16px; flex-shrink: 0; }
.ws-coach-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.ws-coach-actions .btn { flex: 1; }

/* ----- [hidden] attribute overrides for flex/grid components ----- */
.ws-dr-closed-badge[hidden],
.ws-dr-actions-menu[hidden],
.ws-dr-lost-overlay[hidden],
.ws-dr-save-pill[hidden],
.ws-dr-closed-banner[hidden],
.ws-dr-create-bar[hidden],
.ws-dr-act-item[hidden] { display: none !important; }

/* ===================================================================
   NEW: Drawer header controls (action menu + close)
   =================================================================== */
.ws-dr-head-ctrls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.ws-dr-actions-wrap {
  position: relative;
}
.ws-dr-act-trigger {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 30px; height: 30px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.ws-dr-act-trigger:hover,
.ws-dr-act-trigger.is-active {
  background: var(--brand-500);
  color: #fff;
  border-color: transparent;
}

.ws-dr-actions-menu {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-end: 0;
  min-width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 40px -8px rgba(15,23,42,.18), 0 4px 12px rgba(15,23,42,.06);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 50;
  animation: wsFade .15s ease-out;
}
.ws-dr-act-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 9px 10px;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
  text-align: start;
  transition: background .12s;
}
.ws-dr-act-item:hover {
  background: var(--surface-2);
}
.ws-dr-act-icon { font-size: 17px; text-align: center; }
.ws-dr-act-text { display: flex; flex-direction: column; min-width: 0; }
.ws-dr-act-title {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text);
}
.ws-dr-act-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 1px;
}
.ws-dr-act-won .ws-dr-act-title { color: #059669; }
.ws-dr-act-won:hover { background: rgba(16,185,129,.08); }
.ws-dr-act-lost .ws-dr-act-title { color: #b45309; }
.ws-dr-act-lost:hover { background: rgba(245,158,11,.08); }
.ws-dr-act-reopen .ws-dr-act-title { color: var(--brand-600); }
.ws-dr-act-reopen:hover { background: rgba(44,120,115,.08); }
.ws-dr-act-danger .ws-dr-act-title { color: #dc2626; }
.ws-dr-act-danger:hover { background: rgba(239,68,68,.08); }
.ws-dr-act-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}

/* ===================================================================
   NEW: Save pill (toast feedback for auto-save)
   =================================================================== */
.ws-dr-save-pill {
  position: absolute;
  top: 12px;
  inset-inline-start: 16px;
  z-index: 25;
  padding: 6px 12px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
  box-shadow: 0 6px 16px -4px rgba(16,185,129,.45);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
.ws-dr-save-pill.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===================================================================
   NEW: Closed-lead banner (top of body)
   =================================================================== */
.ws-dr-closed-banner {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--c, var(--brand-500));
  background: color-mix(in srgb, var(--c, var(--brand-500)) 8%, var(--surface));
}
.ws-dr-closed-banner.is-won  { --c: #10b981; }
.ws-dr-closed-banner.is-lost { --c: #ef4444; }
.ws-dr-cb-icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: var(--c);
  color: #fff;
  border-radius: 10px;
}
.ws-dr-cb-body { min-width: 0; }
.ws-dr-cb-title {
  font-weight: 800;
  font-size: 13px;
  color: var(--c);
  margin-bottom: 2px;
}
.ws-dr-cb-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ===================================================================
   NEW: Create-mode bar (top of body when creating new lead)
   =================================================================== */
.ws-dr-create-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(44,120,115,.10), rgba(111,185,143,.08));
  border: 1px dashed var(--brand-500);
  border-radius: 12px;
  margin-bottom: 16px;
}
.ws-dr-create-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}
.ws-dr-create-text strong { font-size: 13px; color: var(--brand-600); }

/* ===================================================================
   NEW: Lost reason overlay (modal-style inside drawer body)
   =================================================================== */
.ws-dr-lost-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 40;
  animation: wsFade .2s ease-out;
}
.ws-dr-lost-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 24px 60px -12px rgba(15,23,42,.4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ws-dr-lost-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(239,68,68,.06), var(--surface));
}
.ws-dr-lost-card-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: #dc2626;
}
.ws-dr-lost-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ws-dr-lost-card-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* ===================================================================
   Body: relative positioning so absolute children (overlay/pill) work
   =================================================================== */
.ws-drawer-body { position: relative; }

/* ----- Kanban / Table closed-state visuals ----- */
.ws-lead.is-closed-won  { background: linear-gradient(135deg, rgba(16,185,129,.06), var(--surface)); border-color: #10b981; }
.ws-lead.is-closed-lost { opacity: .55; background: linear-gradient(135deg, rgba(239,68,68,.04), var(--surface)); border-color: #ef4444; }
.ws-lead.is-closed-lost .ws-lead-name { text-decoration: line-through; }
.ws-table tr.is-closed-won  { background: rgba(16,185,129,.04); }
.ws-table tr.is-closed-lost { opacity: .6; background: rgba(239,68,68,.03); }
.ws-table tr.is-closed-lost strong { text-decoration: line-through; }

/* dark theme adjustments */
[data-theme="dark"] .ws-dr-statsbar { background: var(--surface); }
[data-theme="dark"] .ws-task-row    { background: var(--surface); }
[data-theme="dark"] .ws-coach-section { background: var(--surface); }

/* =========================================================
   AI Page — Diaco Insight Engine (expanded)
   ========================================================= */

/* ---- Hero ---- */
.ai-hero {
  padding: 20px 22px;
  background: linear-gradient(135deg, rgba(160,32,240,.06), rgba(96,165,250,.04) 50%, rgba(16,185,129,.04));
  border: 1px solid rgba(160,32,240,.18);
  overflow: hidden;
  position: relative;
}
.ai-hero::before {
  content: '';
  position: absolute;
  inset-inline-end: -40px; top: -40px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(160,32,240,.16), transparent 70%);
  pointer-events: none;
}
.ai-hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: center;
}
.ai-hero-main { display: flex; flex-direction: column; gap: 12px; }
.ai-engine-badge { display: flex; align-items: center; gap: 14px; }
.ai-engine-orb {
  position: relative; width: 80px; height: 80px; flex-shrink: 0;
}
.ai-engine-orb svg { display: block; }
.ai-ring-1 { animation: aiRingSpin 14s linear infinite; transform-origin: 40px 40px; }
.ai-ring-2 { animation: aiRingSpin 10s linear infinite reverse; transform-origin: 40px 40px; }
.ai-ring-3 { animation: aiRingSpin 6s linear infinite; transform-origin: 40px 40px; }
.ai-orb-core { animation: aiCorePulse 2.2s ease-in-out infinite; transform-origin: 40px 40px; }
@keyframes aiRingSpin { to { transform: rotate(360deg); } }
@keyframes aiCorePulse {
  0%, 100% { transform: scale(1);   filter: drop-shadow(0 0 4px rgba(160,32,240,.6)); }
  50%      { transform: scale(1.3); filter: drop-shadow(0 0 12px rgba(160,32,240,.9)); }
}
.ai-engine-name {
  font-size: 19px; font-weight: 800; letter-spacing: -.2px;
  display: flex; align-items: baseline; gap: 8px;
}
.ai-engine-ver {
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(160,32,240,.12);
  color: #7e22ce;
}
.ai-engine-meta { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.ai-engine-models { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ai-model-pill {
  font-size: 10.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  letter-spacing: .2px;
}
.ai-engine-tasks {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 10px 12px;
  background: rgba(160,32,240,.04);
  border: 1px dashed rgba(160,32,240,.25);
  border-radius: 12px;
}
.ai-engine-tasks-lab { font-size: 11.5px; font-weight: 700; color: var(--text-muted); }
.ai-task-pill {
  font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface);
  border: 1px solid rgba(160,32,240,.20);
  color: #7e22ce;
  animation: aiTaskFlash 3s ease-in-out infinite;
}
.ai-task-pill:nth-child(3) { animation-delay: .3s; }
.ai-task-pill:nth-child(4) { animation-delay: .6s; }
.ai-task-pill:nth-child(5) { animation-delay: .9s; }
.ai-task-pill:nth-child(6) { animation-delay: 1.2s; }
@keyframes aiTaskFlash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(160,32,240,.0); }
  50%      { box-shadow: 0 0 0 4px rgba(160,32,240,.10); }
}
.ai-engine-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-hero-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.ai-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.ai-stat:hover { transform: translateY(-2px); box-shadow: 0 8px 20px -10px rgba(0,0,0,.15); }
.ai-stat-icon { font-size: 22px; margin-bottom: 6px; }
.ai-stat-val { font-size: 18px; font-weight: 800; letter-spacing: -.3px; color: var(--text); }
.ai-stat-lbl { font-size: 10.5px; color: var(--text-muted); margin-top: 4px; }

/* ---- LIVE feed ---- */
.ai-feed-card .card-head { align-items: flex-start; }
.ai-live-dot {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 800; letter-spacing: 1px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(239,68,68,.10);
  color: #dc2626;
  border: 1px solid rgba(239,68,68,.22);
}
.ai-live-pulse {
  width: 7px; height: 7px; border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 0 0 rgba(239,68,68,.55);
  animation: aiLivePulse 1.4s ease-in-out infinite;
}
@keyframes aiLivePulse {
  0%   { box-shadow: 0 0 0 0 rgba(239,68,68,.55); transform: scale(1); }
  70%  { box-shadow: 0 0 0 8px rgba(239,68,68,0);  transform: scale(1.1); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0);    transform: scale(1); }
}
.ai-feed {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 460px;
  overflow-y: auto;
  padding-inline-end: 4px;
  scrollbar-width: thin;
}
.ai-feed-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  border-inline-end: 3px solid var(--brand-500);
  transition: transform .15s ease, box-shadow .2s ease;
  animation: aiFeedSlide .42s cubic-bezier(.2,.7,.3,1.2) backwards;
  animation-delay: calc(var(--feed-i, 0) * 50ms);
}
.ai-feed-item:hover { transform: translateX(2px); box-shadow: 0 4px 12px -8px rgba(0,0,0,.2); }
[dir="rtl"] .ai-feed-item:hover { transform: translateX(-2px); }
.ai-feed-item.tone-purple { border-inline-end-color: #a020f0; }
.ai-feed-item.tone-blue   { border-inline-end-color: #1e6dff; }
.ai-feed-item.tone-amber  { border-inline-end-color: #f59e0b; }
.ai-feed-item.tone-red    { border-inline-end-color: #ef4444; }
.ai-feed-item.tone-green  { border-inline-end-color: #10b981; }
@keyframes aiFeedSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ai-feed-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.ai-feed-task { font-weight: 700; font-size: 12.5px; margin-bottom: 2px; }
.ai-feed-detail { font-size: 11.5px; color: var(--text-muted); line-height: 1.7; }
.ai-feed-time {
  font-size: 10.5px; font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---- Donut wrapper for AI page ---- */
.ai-donut-wrap { max-width: 240px; margin: 0 auto 14px; aspect-ratio: 1/1; position: relative; }

/* ---- Models list ---- */
.ai-models-list { display: flex; flex-direction: column; gap: 8px; }
.ai-model-row {
  display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: center;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 12px;
}
.ai-model-dot { width: 12px; height: 12px; border-radius: 999px; flex-shrink: 0; }
.ai-model-name { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ai-model-name strong {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 11.5px;
}
.ai-model-purpose { font-size: 10.5px; color: var(--text-muted); }
.ai-model-stat { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-align: end; }
.ai-model-req { font-size: 10.5px; color: var(--text-muted); }
.ai-model-cost { font-weight: 800; font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---- Insight tabs + cards ---- */
.ai-ins-tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 999px; }
.ai-tab {
  font-size: 11.5px; font-weight: 700;
  padding: 6px 14px;
  border: none; border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.ai-tab:hover { color: var(--text); }
.ai-tab.active { background: var(--surface); color: var(--brand-700); box-shadow: 0 2px 6px -3px rgba(0,0,0,.15); }
.ai-ins-card {
  position: relative;
  animation: aiInsPop .4s cubic-bezier(.2,.7,.3,1.2) backwards;
  animation-delay: calc(var(--ins-i, 0) * 60ms);
  border-inline-start: 3px solid var(--border);
  padding-inline-start: 16px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.ai-ins-card:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -14px rgba(0,0,0,.2); }
.ai-ins-card.ai-ins-risk        { border-inline-start-color: #ef4444; }
.ai-ins-card.ai-ins-opportunity { border-inline-start-color: #f59e0b; }
.ai-ins-card.ai-ins-trend       { border-inline-start-color: #10b981; }
.ai-ins-card.ai-ins-action      { border-inline-start-color: #a020f0; }
@keyframes aiInsPop {
  from { opacity: 0; transform: translateY(6px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)  scale(1); }
}
.ai-ins-cat {
  font-size: 10px; font-weight: 800; letter-spacing: .3px;
  margin-bottom: 6px;
  padding: 2px 8px; border-radius: 999px;
  display: inline-block;
  background: var(--surface-2); color: var(--text-muted);
}
.ai-ins-risk        .ai-ins-cat { background: rgba(239,68,68,.10);  color: #b91c1c; }
.ai-ins-opportunity .ai-ins-cat { background: rgba(245,158,11,.10); color: #b45309; }
.ai-ins-trend       .ai-ins-cat { background: rgba(16,185,129,.10); color: #047857; }
.ai-ins-action      .ai-ins-cat { background: rgba(160,32,240,.10); color: #7e22ce; }

/* ---- Sentiment ---- */
.ai-sentiment-wrap { display: grid; grid-template-columns: 240px 1fr; gap: 18px; align-items: center; }
.ai-sentiment-wrap .ai-donut-wrap { margin: 0; }
.ai-sent-trend {
  font-size: 12px; font-weight: 700;
  color: #047857;
  padding: 8px 12px;
  background: rgba(16,185,129,.10);
  border-radius: 10px;
  margin-bottom: 12px;
}
.ai-sent-section { margin-bottom: 12px; }
.ai-sent-h { font-size: 12px; font-weight: 700; margin-bottom: 6px; }
.ai-sent-list { margin: 0; padding-inline-start: 18px; font-size: 12px; line-height: 1.9; color: var(--text); }
.ai-sent-list-neg li { color: #b45309; }

/* ---- Topics list ---- */
.ai-topics { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; padding-inline-end: 4px; }
.ai-topic-row {
  display: grid;
  grid-template-columns: 24px 1fr 26px 1fr 50px;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  animation: aiInsPop .42s cubic-bezier(.2,.7,.3,1.2) backwards;
  animation-delay: calc(var(--topic-i, 0) * 45ms);
}
.ai-topic-rank {
  width: 24px; height: 24px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.ai-topic-row:nth-child(1) .ai-topic-rank { background: linear-gradient(135deg,#fbbf24,#f59e0b); color: #fff; border-color: transparent; }
.ai-topic-row:nth-child(2) .ai-topic-rank { background: linear-gradient(135deg,#cbd5e1,#94a3b8); color: #fff; border-color: transparent; }
.ai-topic-row:nth-child(3) .ai-topic-rank { background: linear-gradient(135deg,#fb923c,#ea580c); color: #fff; border-color: transparent; }
.ai-topic-name { font-weight: 600; font-size: 12.5px; }
.ai-topic-sent { font-size: 16px; text-align: center; }
.ai-topic-bar { height: 7px; background: var(--surface); border-radius: 999px; overflow: hidden; }
.ai-topic-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand-500), #c084fc); }
.ai-topic-row.tone-green .ai-topic-fill  { background: linear-gradient(90deg, #34d399, #10b981); }
.ai-topic-row.tone-red   .ai-topic-fill  { background: linear-gradient(90deg, #fb7185, #ef4444); }
.ai-topic-row.tone-amber .ai-topic-fill  { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.ai-topic-row.tone-blue  .ai-topic-fill  { background: linear-gradient(90deg, #60a5fa, #1e6dff); }
.ai-topic-row.tone-purple .ai-topic-fill { background: linear-gradient(90deg, #c084fc, #a020f0); }
.ai-topic-count {
  font-weight: 800; font-size: 12.5px; text-align: end;
  color: var(--text); font-variant-numeric: tabular-nums;
}

/* ---- Decision Audit Table ---- */
.ai-decisions-table { font-size: 12.5px; }
.ai-decisions-table th { font-weight: 700; font-size: 11.5px; padding: 10px 12px; color: var(--text-muted); }
.ai-decisions-table td { padding: 12px; vertical-align: top; }
.ai-dec-row { animation: aiInsPop .4s cubic-bezier(.2,.7,.3,1.2) backwards; animation-delay: calc(var(--dec-i,0) * 40ms); }
.ai-dec-row:hover { background: var(--surface-2); }
.ai-dec-time { font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ai-dec-type { font-size: 20px; }
.ai-dec-reason { font-size: 11.5px; color: var(--text-muted); line-height: 1.7; max-width: 260px; }
.ai-conf { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.ai-conf-bar { flex: 1; height: 7px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.ai-conf-fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.ai-conf-fill.ai-conf-high { background: linear-gradient(90deg, #34d399, #10b981); }
.ai-conf-fill.ai-conf-mid  { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.ai-conf-fill.ai-conf-low  { background: linear-gradient(90deg, #fb7185, #ef4444); }
.ai-conf-num { font-weight: 800; font-size: 11.5px; min-width: 36px; text-align: end; }
.ai-model-tag {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 10.5px; font-weight: 600;
  padding: 3px 8px; border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.ai-outcome {
  font-size: 10.5px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
  white-space: nowrap;
  display: inline-block;
}
.ai-outcome.pending    { background: rgba(245,158,11,.10); color: #b45309; border: 1px solid rgba(245,158,11,.24); }
.ai-outcome.approved   { background: rgba(16,185,129,.10); color: #047857; border: 1px solid rgba(16,185,129,.24); }
.ai-outcome.escalated  { background: rgba(239,68,68,.10);  color: #b91c1c; border: 1px solid rgba(239,68,68,.24); }
.ai-outcome.sent       { background: rgba(30,109,255,.10); color: #1e6dff; border: 1px solid rgba(30,109,255,.24); }
.ai-outcome.applied    { background: rgba(160,32,240,.10); color: #7e22ce; border: 1px solid rgba(160,32,240,.24); }

/* ---- Cost Projection ---- */
.ai-cost-card .card-head { margin-bottom: 14px; }
.ai-cost-body { display: flex; flex-direction: column; gap: 16px; }
.ai-cost-big {
  display: flex; align-items: baseline; gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(160,32,240,.08), rgba(96,165,250,.04));
  border-radius: 14px;
  border: 1px solid rgba(160,32,240,.18);
}
.ai-cost-num {
  font-size: 36px; font-weight: 800; letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #a020f0, #60a5fa);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.ai-cost-currency { font-size: 22px; font-weight: 700; margin-inline-start: 4px; }
.ai-cost-rial { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.ai-cost-progress { display: flex; flex-direction: column; gap: 8px; }
.ai-cost-progress-row {
  display: flex; align-items: center; gap: 10px;
}
.ai-cost-progress-cap {
  font-size: 10.5px; font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
.ai-cost-progress-cap.end { color: var(--brand-700); }
.ai-cost-progress-bar {
  position: relative;
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}
.ai-cost-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #10b981, #f59e0b 80%, #ef4444);
  transition: width 1.2s cubic-bezier(.2,.7,.3,1);
  animation: aiCostFill 1.4s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes aiCostFill { from { width: 0; } }
.ai-cost-progress-meta { font-size: 11.5px; color: var(--text-muted); }
.ai-cost-breakdown { display: flex; flex-direction: column; gap: 6px; }
.ai-cost-bd-h { font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
.ai-cost-bd-bars { display: flex; height: 20px; border-radius: 8px; overflow: hidden; gap: 2px; }
.ai-cost-seg {
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 10px; font-weight: 700; white-space: nowrap;
  min-width: 30px;
  transition: flex-grow .3s ease;
  position: relative;
}
.ai-cost-foot {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.ai-cost-foot-item { display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; }
.ai-cost-foot-item span { color: var(--text-muted); }
.ai-cost-foot-item strong { font-size: 13px; font-weight: 800; }
.ai-cost-foot-item strong.green { color: #10b981; }

/* ---- Cost by Task list ---- */
.ai-cost-task-list { display: flex; flex-direction: column; gap: 6px; }
.ai-cost-task-row {
  display: grid; grid-template-columns: 14px 1fr auto auto; gap: 10px; align-items: center;
  padding: 7px 10px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 12px;
}
.ai-cost-task-name { font-weight: 600; }
.ai-cost-task-pct { color: var(--text-muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.ai-cost-task-amt { font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; min-width: 48px; text-align: end; }

/* ---- A/B Tests ---- */
.ai-ab-list { display: flex; flex-direction: column; gap: 14px; }
.ai-ab-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  animation: aiInsPop .42s cubic-bezier(.2,.7,.3,1.2) backwards;
  animation-delay: calc(var(--ab-i, 0) * 80ms);
}
.ai-ab-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ai-ab-title { font-weight: 700; font-size: 13.5px; }
.ai-ab-meta { font-size: 11.5px; color: var(--text-muted); }
.ai-ab-lift { color: #10b981; font-weight: 800; margin-inline-start: 6px; }
.ai-ab-variants { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ai-ab-variant {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  transition: border-color .2s ease, box-shadow .2s ease;
  position: relative;
}
.ai-ab-variant.winner {
  border-color: rgba(16,185,129,.4);
  background: linear-gradient(135deg, rgba(16,185,129,.06), transparent);
  box-shadow: 0 8px 18px -10px rgba(16,185,129,.4);
}
.ai-ab-v-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.ai-ab-v-letter {
  width: 26px; height: 26px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.ai-ab-variant.winner .ai-ab-v-letter { background: #10b981; color: #fff; border-color: #10b981; }
.ai-ab-v-label { font-size: 12.5px; font-weight: 600; }
.ai-ab-win-chip {
  margin-inline-start: auto;
  font-size: 10.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(16,185,129,.15); color: #047857;
}
.ai-ab-v-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.ai-ab-v-stat {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 4px;
  background: var(--surface-2);
  border-radius: 8px;
  gap: 2px;
}
.ai-ab-v-stat span { font-size: 10.5px; color: var(--text-muted); }
.ai-ab-v-stat strong { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ai-ab-variant.winner .ai-ab-v-stat strong { color: #047857; }

/* ---- Integrations ---- */
.ai-integrations { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.ai-int-card {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: transform .15s ease, box-shadow .2s ease;
}
.ai-int-card:hover { transform: translateY(-2px); box-shadow: 0 8px 18px -10px rgba(0,0,0,.2); }
.ai-int-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.ai-int-name { font-weight: 700; font-size: 12.5px; }
.ai-int-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.ai-int-status { font-size: 11px; font-weight: 700; }
.ai-int-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 999px;
  margin-inline-end: 4px;
  animation: aiIntDot 2s ease-in-out infinite;
}
.ai-int-dot.ok   { background: #10b981; }
.ai-int-dot.warn { background: #f59e0b; }
.ai-int-dot.err  { background: #ef4444; }
@keyframes aiIntDot {
  0%, 100% { box-shadow: 0 0 0 0 currentColor; }
  50%      { box-shadow: 0 0 0 4px transparent; }
}

/* ---- Chat suggestions ---- */
.ai-chat-suggestions {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 0 12px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 10px;
}
.ai-sug-chip {
  font-size: 11.5px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, transform .15s ease;
}
.ai-sug-chip:hover {
  background: var(--surface-3);
  border-color: var(--brand-300);
  transform: translateY(-1px);
}
.ai-chip-online {
  display: inline-flex; align-items: center; gap: 6px;
}
.ai-online-dot {
  width: 7px; height: 7px; border-radius: 999px;
  background: #10b981;
  animation: aiLivePulse 1.4s ease-in-out infinite;
}

/* Dark theme overrides */
[data-theme="dark"] .ai-hero { background: linear-gradient(135deg, rgba(160,32,240,.12), rgba(96,165,250,.06)); }
[data-theme="dark"] .ai-feed-item { background: var(--surface); }
[data-theme="dark"] .ai-model-row,
[data-theme="dark"] .ai-topic-row,
[data-theme="dark"] .ai-int-card,
[data-theme="dark"] .ai-ab-card { background: var(--surface); }
[data-theme="dark"] .ai-ab-variant { background: var(--surface-2); }
[data-theme="dark"] .ai-ins-cat { background: var(--surface-3); }
[data-theme="dark"] .ai-cost-num {
  background: linear-gradient(135deg, #c084fc, #93c5fd);
  -webkit-background-clip: text; background-clip: text;
}

/* Responsive */
@media (max-width: 1024px) {
  .ai-hero-grid { grid-template-columns: 1fr; }
  .ai-hero-stats { grid-template-columns: repeat(4, 1fr); }
  .ai-sentiment-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .ai-hero-stats { grid-template-columns: 1fr 1fr; }
  .ai-ab-variants { grid-template-columns: 1fr; }
  .ai-engine-orb { width: 60px; height: 60px; }
  .ai-engine-orb svg { width: 60px; height: 60px; }
}

/* =====================================================================
   CRM HUB — Didar Integration Center  (namespace: crm-*)
   ===================================================================== */

/* Page head actions */
.crm-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crm-btn-sync { font-weight: 700; }
.crm-btn-sync.is-syncing { background: var(--surface-3); color: var(--text); animation: crmSyncPulse 1s ease-in-out infinite; }
@keyframes crmSyncPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ===== 1. HERO ===== */
.crm-hero { margin: 14px 0 18px; }
.crm-hero-card {
  position: relative;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  padding: 20px 22px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(30,109,255,0.05), rgba(160,32,240,0.04) 60%, rgba(16,185,129,0.04));
  border: 1px solid var(--border);
  overflow: hidden;
}
.crm-hero-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 28%, rgba(30,109,255,0.18), transparent 38%),
    radial-gradient(circle at 88% 72%, rgba(160,32,240,0.16), transparent 42%);
  pointer-events: none;
  opacity: 0.7;
}
.crm-hero-left { display: flex; gap: 18px; align-items: center; position: relative; z-index: 1; }
.crm-hero-orb { position: relative; width: 110px; height: 110px; flex-shrink: 0; }
.crm-hero-orb svg { display: block; }
.crm-orb-ring { transform-origin: 55px 55px; }
.crm-orb-r1 { animation: crmOrbSpin 14s linear infinite; }
.crm-orb-r2 { animation: crmOrbSpinRev 10s linear infinite; }
.crm-orb-r3 { animation: crmOrbSpin 6s linear infinite; }
.crm-orb-core { animation: crmOrbCorePulse 2.4s ease-in-out infinite; }
@keyframes crmOrbSpin    { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes crmOrbSpinRev { from { transform: rotate(360deg); } to { transform: rotate(0deg); } }
@keyframes crmOrbCorePulse {
  0%, 100% { opacity: 0.9; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.18); }
}
.crm-orb-score {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.crm-orb-score-val {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, #10b981, #1e6dff);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}
.crm-orb-score-lbl { font-size: 10px; color: var(--muted); margin-top: 4px; }
.crm-hero-meta { flex: 1; min-width: 0; }
.crm-hero-title {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.crm-hero-status { font-size: 12px; animation: crmStatusPulse 1.6s ease-in-out infinite; }
.crm-hero-status-green  { color: #10b981; }
.crm-hero-status-amber  { color: #f59e0b; }
.crm-hero-status-red    { color: #ef4444; }
@keyframes crmStatusPulse {
  0%, 100% { opacity: 1; text-shadow: 0 0 8px currentColor; }
  50% { opacity: 0.5; text-shadow: 0 0 2px currentColor; }
}
.crm-hero-sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-inline-start: 6px; }
.crm-hero-chips { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.crm-hero-chip { font-size: 11px; display: inline-flex; align-items: center; gap: 4px; }
.crm-hero-chip-i { font-size: 10px; }
.crm-hero-foot {
  font-size: 11px;
  color: var(--muted);
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.crm-hero-foot b { color: var(--text); font-weight: 600; }
.crm-hero-err { color: #ef4444; }

.crm-hero-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  position: relative;
  z-index: 1;
}
.crm-hero-stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  position: relative;
}
.crm-hero-stat-i { font-size: 16px; opacity: 0.8; }
.crm-hero-stat-v {
  font-size: 22px;
  font-weight: 800;
  margin-top: 4px;
  line-height: 1.1;
  background: linear-gradient(135deg, #1e6dff, #a020f0);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.crm-hero-stat-u { font-size: 13px; font-weight: 600; opacity: 0.7; margin-inline-start: 2px; }
.crm-hero-stat-l { font-size: 11px; color: var(--muted); margin-top: 2px; }
.crm-hero-stat-bar {
  height: 4px;
  border-radius: 4px;
  background: var(--surface-3);
  margin-top: 8px;
  overflow: hidden;
}
.crm-hero-stat-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #f59e0b 70%, #ef4444);
  border-radius: 4px;
  transition: width 0.6s ease;
}

/* ===== 3. SYNC MONITOR ===== */
.crm-monitor-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
.crm-monitor-chart canvas { max-height: 220px; }
.crm-mon-legend { display: flex; gap: 12px; font-size: 11px; color: var(--muted); }
.crm-mon-leg { display: inline-flex; align-items: center; gap: 6px; }
.crm-mon-leg i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.crm-mon-leg-in i { background: #1e6dff; }
.crm-mon-leg-out i { background: #a020f0; }
.crm-mon-foot { font-size: 12px; color: var(--muted); display: flex; gap: 6px; margin-top: 10px; }
.crm-mon-foot b { color: var(--text); font-weight: 700; }

.crm-runs-card { display: flex; flex-direction: column; }
.crm-runs-filter { cursor: pointer; user-select: none; }
.crm-runs-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; padding-inline-end: 4px; }
.crm-run {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background 0.15s;
}
.crm-run:hover { background: var(--surface-3); }
.crm-run-dir {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}
.crm-run-dir-inbound  { background: rgba(30,109,255,0.12); color: #1e6dff; }
.crm-run-dir-outbound { background: rgba(160,32,240,0.12); color: #a020f0; }
.crm-run-body { min-width: 0; }
.crm-run-src { font-size: 12px; font-weight: 600; font-family: 'Courier New', monospace; direction: ltr; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-run-meta { font-size: 11px; color: var(--muted); display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.crm-run-err { color: #ef4444; }
.crm-run-status { text-align: end; }
.crm-run-st {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}
.crm-run-st-ok    { background: rgba(16,185,129,0.18); color: #10b981; }
.crm-run-st-retry { background: rgba(245,158,11,0.18); color: #f59e0b; animation: crmRetrySpin 1.6s linear infinite; }
.crm-run-st-fail  { background: rgba(239,68,68,0.18); color: #ef4444; }
@keyframes crmRetrySpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.crm-run-when { font-size: 10px; color: var(--muted); margin-top: 4px; }
.crm-run-fail { border-color: rgba(239,68,68,0.25); }

/* ===== 4. FUNNEL ===== */
.crm-funnel-card { margin-top: 14px; }
.crm-funnel-totals { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crm-funnel-totals b { font-weight: 700; }
.crm-funnel { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.crm-funnel-row {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 14px;
  align-items: center;
}
.crm-funnel-bar {
  position: relative;
  min-height: 44px;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.crm-funnel-bar:hover { transform: translateX(-4px); box-shadow: 0 4px 14px rgba(15,23,42,0.08); }
[dir="rtl"] .crm-funnel-bar:hover { transform: translateX(4px); }
.crm-funnel-bar-inner {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  opacity: 0.92;
}
.crm-funnel-bar-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  color: #fff;
  font-weight: 700;
}
.crm-funnel-stage { font-size: 13px; }
.crm-funnel-count { font-size: 16px; opacity: 0.95; }
.crm-funnel-money {
  margin-inline-start: auto;
  font-size: 12px;
  background: rgba(255,255,255,0.2);
  padding: 3px 10px;
  border-radius: 8px;
  backdrop-filter: blur(4px);
}
.crm-funnel-side {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--muted);
}
.crm-funnel-conv { color: var(--text); font-weight: 600; font-size: 12px; }
.crm-funnel-desc { font-size: 11px; }

.crm-funnel-sky    .crm-funnel-bar-inner { background: linear-gradient(135deg, #38bdf8, #0ea5e9); }
.crm-funnel-blue   .crm-funnel-bar-inner { background: linear-gradient(135deg, #60a5fa, #1e6dff); }
.crm-funnel-purple .crm-funnel-bar-inner { background: linear-gradient(135deg, #c084fc, #8b5cf6); }
.crm-funnel-amber  .crm-funnel-bar-inner { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.crm-funnel-green  .crm-funnel-bar-inner { background: linear-gradient(135deg, #34d399, #10b981); }
.crm-funnel-red    .crm-funnel-bar-inner { background: linear-gradient(135deg, #f87171, #ef4444); }

/* ===== 5. ACTIVITIES STREAM ===== */
.crm-activities-card { margin-top: 14px; }
.crm-act-filter { display: flex; gap: 4px; flex-wrap: wrap; }
.crm-act-tab {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.crm-act-tab:hover { background: var(--surface-3); }
.crm-act-tab.is-active {
  background: linear-gradient(135deg, #1e6dff, #a020f0);
  color: #fff;
  border-color: transparent;
  font-weight: 700;
}
.crm-act-stream { display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow-y: auto; padding-inline-end: 4px; }
.crm-act-empty {
  text-align: center;
  padding: 28px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 10px;
  font-size: 13px;
}
.crm-act-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border-inline-end: 3px solid;
  animation: crmActSlide 0.32s cubic-bezier(.2,.7,.3,1.05) backwards;
  animation-delay: calc(var(--act-i, 0) * 30ms);
  transition: background 0.15s;
}
.crm-act-item:hover { background: var(--surface-3); }
@keyframes crmActSlide {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}
.crm-act-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}
.crm-act-line { font-size: 13px; }
.crm-act-line b { font-weight: 700; }
.crm-act-action { color: var(--muted); margin: 0 4px; }
.crm-act-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.crm-act-when { text-align: end; font-size: 11px; color: var(--muted); }
.crm-act-sync {
  display: block;
  font-size: 9px;
  font-family: 'Courier New', monospace;
  direction: ltr;
  opacity: 0.6;
  margin-top: 2px;
}
.crm-act-sky    { border-inline-end-color: #0ea5e9; }
.crm-act-sky    .crm-act-icon { background: rgba(14,165,233,0.14); }
.crm-act-blue   { border-inline-end-color: #1e6dff; }
.crm-act-blue   .crm-act-icon { background: rgba(30,109,255,0.14); }
.crm-act-green  { border-inline-end-color: #10b981; }
.crm-act-green  .crm-act-icon { background: rgba(16,185,129,0.14); }
.crm-act-amber  { border-inline-end-color: #f59e0b; }
.crm-act-amber  .crm-act-icon { background: rgba(245,158,11,0.14); }
.crm-act-purple { border-inline-end-color: #8b5cf6; }
.crm-act-purple .crm-act-icon { background: rgba(139,92,246,0.14); }
.crm-act-mint   { border-inline-end-color: #14b8a6; }
.crm-act-mint   .crm-act-icon { background: rgba(20,184,166,0.14); }
.crm-act-lemon  { border-inline-end-color: #eab308; }
.crm-act-lemon  .crm-act-icon { background: rgba(234,179,8,0.14); }
.crm-act-red    { border-inline-end-color: #ef4444; }
.crm-act-red    .crm-act-icon { background: rgba(239,68,68,0.14); }

/* ===== 6. CONTACTS OVERVIEW ===== */
.crm-contacts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
.crm-contacts-stats {
  background: linear-gradient(160deg, rgba(30,109,255,0.06), rgba(160,32,240,0.05));
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.crm-cstats-title { font-size: 14px; font-weight: 700; }
.crm-cstats-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.crm-cstats-big {
  text-align: center;
  padding: 12px 0;
  border-block: 1px solid var(--border);
}
.crm-cstats-big-v {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, #1e6dff, #a020f0);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}
.crm-cstats-big-l { font-size: 11px; color: var(--muted); margin-top: 4px; }
.crm-cstats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.crm-cstats-cell {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
}
.crm-cstats-v { font-size: 16px; font-weight: 700; }
.crm-cstats-l { font-size: 10px; color: var(--muted); margin-top: 2px; }

.crm-contact-list { display: flex; flex-direction: column; gap: 8px; }
.crm-contact {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 8px;
  background: var(--surface-2);
  transition: background 0.15s;
}
.crm-contact:hover { background: var(--surface-3); }
/* contactهایی که با یک مشتری واقعی تطبیق دارند → کلیک‌پذیر به پروفایل ۳۶۰° (RFC-0008 phase 3) */
.crm-contact-link { cursor: pointer; }
.crm-contact-link:hover { background: var(--surface-3); box-shadow: inset -2px 0 0 var(--brand-400, #6fb98f); }
.crm-contact-link .crm-contact-name { color: var(--brand-700, #6d28d9); }
[data-theme="dark"] .crm-contact-link .crm-contact-name { color: #c4b5fd; }
.crm-contact-av {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}
.crm-contact-av-dupe {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
}
.crm-contact-body { min-width: 0; }
.crm-contact-name { font-size: 12.5px; font-weight: 600; }
.crm-contact-tag {
  font-size: 9px;
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: 6px;
  margin-inline-start: 4px;
  font-weight: 500;
  color: var(--muted);
}
.crm-contact-meta { font-size: 10.5px; color: var(--muted); margin-top: 2px; direction: ltr; text-align: start; }
.crm-contact-when { font-size: 10px; color: var(--muted); }
.crm-contact-val { text-align: end; }
.crm-contact-total { font-size: 12.5px; font-weight: 700; color: #10b981; }
.crm-contact-deals { font-size: 10px; color: var(--muted); margin-top: 2px; }
.crm-contact-action { display: flex; flex-direction: column; align-items: end; gap: 3px; }

/* ===== 7. WEBHOOK ERRORS ===== */
.crm-errors-card {
  margin-top: 14px;
  border: 1px solid rgba(239,68,68,0.22);
}
.crm-err-empty {
  text-align: center;
  padding: 24px;
  color: #10b981;
  font-weight: 600;
  background: rgba(16,185,129,0.05);
  border-radius: 10px;
}
.crm-errors-list { display: flex; flex-direction: column; gap: 10px; }
.crm-err-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: 10px;
  background: rgba(239,68,68,0.04);
  border: 1px solid rgba(239,68,68,0.15);
}
.crm-err-code {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 48px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 18px;
  font-family: 'Courier New', monospace;
}
.crm-err-code-srv { background: rgba(239,68,68,0.16); color: #ef4444; }
.crm-err-code-cli { background: rgba(245,158,11,0.16); color: #f59e0b; }
.crm-err-ep { font-family: 'Courier New', monospace; font-size: 12px; direction: ltr; text-align: start; font-weight: 600; }
.crm-err-msg { font-size: 12.5px; margin-top: 3px; }
.crm-err-payload { font-size: 11px; color: var(--muted); margin-top: 3px; }
.crm-err-payload code { background: var(--surface-3); padding: 1px 6px; border-radius: 4px; direction: ltr; }
.crm-err-meta { text-align: end; display: flex; flex-direction: column; align-items: end; gap: 4px; }
.crm-err-when { font-size: 11px; color: var(--muted); }
.crm-err-retry { font-size: 11px; color: var(--text); font-weight: 600; }

/* ===== 8. FIELD MAPPING ===== */
.crm-mapping-card { margin-top: 14px; }
.crm-map-legend { display: flex; gap: 10px; font-size: 11px; color: var(--muted); }
.crm-map-leg { display: inline-flex; align-items: center; gap: 4px; }
.crm-map-leg i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.crm-map-leg-ok i      { background: #10b981; }
.crm-map-leg-partial i { background: #f59e0b; }
.crm-map-leg-missing i { background: #ef4444; }

.crm-map-list { display: flex; flex-direction: column; gap: 6px; }
.crm-map-row {
  display: grid;
  grid-template-columns: 1.2fr 36px 1.2fr 1.6fr;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: background 0.15s;
}
.crm-map-row:hover { background: var(--surface-3); }
.crm-map-row-missing { border-color: rgba(239,68,68,0.25); background: rgba(239,68,68,0.04); }
.crm-map-row-partial { border-color: rgba(245,158,11,0.22); }
.crm-map-side { display: flex; flex-direction: column; gap: 2px; }
.crm-map-lbl { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.crm-map-field {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  direction: ltr;
  text-align: start;
  background: transparent;
  font-weight: 600;
}
.crm-map-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 32px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
}
.crm-map-arrow-two   { background: rgba(30,109,255,0.12); color: #1e6dff; }
.crm-map-arrow-one   { background: rgba(160,32,240,0.10); color: #a020f0; }
.crm-map-arrow-none  { background: rgba(239,68,68,0.10); color: #ef4444; }
.crm-map-info { font-size: 11px; color: var(--muted); }
.crm-map-info-row { display: flex; gap: 6px; align-items: center; }
.crm-map-type {
  font-size: 10px;
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: 5px;
  font-family: 'Courier New', monospace;
  direction: ltr;
}
.crm-map-status {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
}
.crm-map-status-mapped  { background: rgba(16,185,129,0.14); color: #10b981; }
.crm-map-status-partial { background: rgba(245,158,11,0.14); color: #f59e0b; }
.crm-map-status-missing { background: rgba(239,68,68,0.14); color: #ef4444; }
.crm-map-notes { font-size: 10.5px; margin-top: 3px; }

/* ===== 9. API USAGE ===== */
.crm-api-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
.crm-api-quota { text-align: end; min-width: 220px; }
.crm-quota-text { font-size: 12px; color: var(--muted); }
.crm-quota-text b { color: var(--text); font-weight: 700; }
.crm-quota-bar {
  height: 6px;
  background: var(--surface-3);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 6px;
}
.crm-quota-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #f59e0b 70%, #ef4444);
  border-radius: 6px;
  transition: width 0.6s ease;
}
.crm-api-chart canvas { max-height: 220px; }
.crm-api-eps { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; padding-inline-end: 4px; }
.crm-api-ep { padding: 8px; border-radius: 8px; background: var(--surface-2); }
.crm-api-ep-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.crm-api-ep-name { font-family: 'Courier New', monospace; font-size: 11.5px; direction: ltr; text-align: start; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-api-ep-count { font-size: 12px; font-weight: 700; }
.crm-api-ep-bar { height: 4px; background: var(--surface-3); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.crm-api-ep-bar > span { display: block; height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.crm-api-ep-blue   .crm-api-ep-bar > span { background: linear-gradient(90deg, #60a5fa, #1e6dff); }
.crm-api-ep-green  .crm-api-ep-bar > span { background: linear-gradient(90deg, #34d399, #10b981); }
.crm-api-ep-amber  .crm-api-ep-bar > span { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.crm-api-ep-purple .crm-api-ep-bar > span { background: linear-gradient(90deg, #c084fc, #8b5cf6); }
.crm-api-ep-mint   .crm-api-ep-bar > span { background: linear-gradient(90deg, #5eead4, #14b8a6); }
.crm-api-ep-sky    .crm-api-ep-bar > span { background: linear-gradient(90deg, #38bdf8, #0ea5e9); }
.crm-api-ep-lemon  .crm-api-ep-bar > span { background: linear-gradient(90deg, #facc15, #eab308); }
.crm-api-ep-share { font-size: 10px; color: var(--muted); margin-top: 3px; }

/* Dark theme tweaks */
[data-theme="dark"] .crm-hero-card { background: linear-gradient(135deg, rgba(30,109,255,0.08), rgba(160,32,240,0.07) 60%, rgba(16,185,129,0.07)); }
[data-theme="dark"] .crm-act-item { background: var(--surface-3); }
[data-theme="dark"] .crm-contact { background: var(--surface-3); }
[data-theme="dark"] .crm-run     { background: var(--surface-3); }
[data-theme="dark"] .crm-map-row { background: var(--surface-3); }
[data-theme="dark"] .crm-api-ep  { background: var(--surface-3); }

/* Responsive */
@media (max-width: 1280px) {
  .crm-contacts-grid { grid-template-columns: 1fr 1fr; }
  .crm-monitor-grid { grid-template-columns: 1fr; }
  .crm-api-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .crm-hero-card { grid-template-columns: 1fr; }
  .crm-hero-stats { grid-template-columns: repeat(4, 1fr); }
  .crm-funnel-row { grid-template-columns: 1fr; }
  .crm-funnel-side { padding-inline: 6px; }
  .crm-map-row { grid-template-columns: 1fr 36px 1fr; grid-template-rows: auto auto; }
  .crm-map-info { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .crm-hero-stats { grid-template-columns: 1fr 1fr; }
  .crm-contacts-grid { grid-template-columns: 1fr; }
  .crm-err-item { grid-template-columns: 48px 1fr; }
  .crm-err-meta { grid-column: 1 / -1; align-items: start; flex-direction: row; gap: 8px; }
}

/* =====================================================================
   WORKSPACE — PHASE 3: FINANCE TAB  (namespace: ws-fin-*)
   ===================================================================== */

/* Tab alert dot */
.ws-dr-tab-dot {
  color: #ef4444;
  font-size: 8px;
  margin-inline-start: 4px;
  animation: wsFinDotPulse 1.4s ease-in-out infinite;
}
@keyframes wsFinDotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.ws-fin-body { display: flex; flex-direction: column; gap: 14px; }

/* Lock banner — top of tab when sessions are locked */
.ws-fin-lock-banner {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(239,68,68,0.10), rgba(245,158,11,0.08));
  border: 1px solid rgba(239,68,68,0.22);
  animation: wsFinLockSlide 0.42s cubic-bezier(.2,.7,.3,1.05);
}
@keyframes wsFinLockSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.ws-fin-lock-icon {
  font-size: 22px;
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239,68,68,0.14);
  border-radius: 10px;
  animation: wsFinLockShake 2.2s ease-in-out infinite;
}
@keyframes wsFinLockShake {
  0%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(-6deg); }
  20%, 40% { transform: rotate(6deg); }
  50% { transform: rotate(0deg); }
}
.ws-fin-lock-title { font-size: 13px; font-weight: 700; color: #ef4444; }
.ws-fin-lock-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.ws-fin-lock-sub b { color: var(--text); font-weight: 700; }
.ws-fin-lock-cta { font-size: 11px; padding: 6px 10px; }

/* Role toggle */
.ws-fin-role {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 10px;
  flex-wrap: wrap;
}
.ws-fin-role-lbl { font-size: 12px; color: var(--muted); }
.ws-fin-role-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text);
}
.ws-fin-role-btn:hover { background: var(--surface-3); }
.ws-fin-role-btn.is-active {
  background: linear-gradient(135deg, #1e6dff, #a020f0);
  color: #fff;
  border-color: transparent;
  font-weight: 700;
}
.ws-fin-role-hint { font-size: 10.5px; color: var(--muted); margin-inline-start: auto; flex-basis: 100%; padding: 4px 0 0; }
@media (min-width: 720px) { .ws-fin-role-hint { flex-basis: auto; padding: 0; } }

/* Summary card */
.ws-fin-summary {
  background: linear-gradient(135deg, rgba(30,109,255,0.05), rgba(16,185,129,0.04) 60%, rgba(160,32,240,0.04));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
}
.ws-fin-sum-head { display: flex; justify-content: space-between; align-items: baseline; }
.ws-fin-sum-course { font-size: 13px; font-weight: 700; }
.ws-fin-sum-price {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #1e6dff, #a020f0);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ws-fin-sum-progress { margin-top: 10px; }
.ws-fin-sum-bar {
  height: 8px;
  background: var(--surface-3);
  border-radius: 6px;
  overflow: hidden;
}
.ws-fin-sum-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #1e6dff);
  border-radius: 6px;
  transition: width 0.6s ease;
}
.ws-fin-sum-bar-label { font-size: 11px; color: var(--muted); margin-top: 4px; }
.ws-fin-sum-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.ws-fin-sum-cell {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 8px 10px;
  border-inline-start: 3px solid;
}
.ws-fin-cell-paid      { border-color: #10b981; }
.ws-fin-cell-pending   { border-color: #f59e0b; }
.ws-fin-cell-overdue   { border-color: #ef4444; }
.ws-fin-cell-zero      { border-color: var(--border); }
.ws-fin-cell-remaining { border-color: #8b5cf6; }
.ws-fin-cell-l { font-size: 10px; color: var(--muted); }
.ws-fin-cell-v { font-size: 13.5px; font-weight: 700; margin-top: 2px; }
.ws-fin-next {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  background: rgba(245,158,11,0.08);
  border-radius: 8px;
  border-inline-start: 3px solid #f59e0b;
}
.ws-fin-next b { color: var(--text); font-weight: 700; }

/* Section */
.ws-fin-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.ws-fin-section-title {
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.ws-fin-section-count { font-size: 10.5px; color: var(--muted); font-weight: 500; }

/* Pre-payment */
.ws-fin-prepay {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(16,185,129,0.06);
  border-radius: 10px;
}
.ws-fin-prepay-amt { font-size: 16px; font-weight: 700; color: #10b981; }
.ws-fin-prepay-meta { font-size: 11px; color: var(--muted); }

/* Installments */
.ws-fin-inst-list { display: flex; flex-direction: column; gap: 8px; }
.ws-fin-inst {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border-inline-end: 3px solid var(--border);
  transition: background 0.15s;
}
.ws-fin-inst:hover { background: var(--surface-3); }
.ws-fin-inst-paid     { border-inline-end-color: #10b981; }
.ws-fin-inst-overdue  { border-inline-end-color: #ef4444; background: rgba(239,68,68,0.04); }
.ws-fin-inst-pending  { border-inline-end-color: #f59e0b; }
.ws-fin-inst-num {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  font-weight: 800;
  font-size: 13px;
}
.ws-fin-inst-paid .ws-fin-inst-num    { background: rgba(16,185,129,0.18); color: #10b981; }
.ws-fin-inst-overdue .ws-fin-inst-num { background: rgba(239,68,68,0.18); color: #ef4444; }
.ws-fin-inst-amt { font-size: 13px; font-weight: 700; }
.ws-fin-inst-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.ws-fin-inst-action { display: flex; flex-direction: column; align-items: end; gap: 4px; }
.ws-fin-inst-when { font-size: 10px; color: var(--muted); }

.ws-fin-mini-btn {
  font-size: 11px;
  padding: 4px 8px;
  min-height: 0;
  height: auto;
}
.ws-fin-mini-btn-danger { color: #ef4444; border-color: rgba(239,68,68,0.3); }

/* Cheque add form (advisor only) */
.ws-fin-cheque-add {
  background: rgba(30,109,255,0.04);
  border: 1px dashed rgba(30,109,255,0.3);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.ws-fin-cheque-add-head { font-size: 13px; font-weight: 700; margin-bottom: 10px; color: #1e6dff; }
.ws-fin-cheque-add-grid {
  display: grid;
  grid-template-columns: 1fr 140px 1fr 1fr;
  gap: 10px;
  align-items: start;
}
.ws-fin-cheque-add-grid .ws-dr-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ws-fin-cheque-add-grid .ws-dr-field > span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.ws-fin-cheque-add-grid input,
.ws-fin-cheque-add-grid select {
  padding: 7px 9px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
.ws-fin-cheque-add-foot {
  margin-top: 12px;
  display: flex;
  justify-content: flex-start;
}
.ws-fin-cheque-submit-btn {
  font-size: 13px;
  padding: 10px 20px;
  font-weight: 700;
  min-width: 240px;
}

/* Cheque list */
.ws-fin-cheque-list { display: flex; flex-direction: column; gap: 8px; }
.ws-fin-empty {
  text-align: center;
  padding: 18px;
  color: var(--muted);
  font-size: 12px;
  background: var(--surface-2);
  border-radius: 8px;
}
.ws-fin-cheque {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border-inline-end: 3px solid var(--border);
}
.ws-fin-cheque-submitted       { border-inline-end-color: #0ea5e9; }
.ws-fin-cheque-pending-finance { border-inline-end-color: #f59e0b; background: rgba(245,158,11,0.04); }
.ws-fin-cheque-cashed          { border-inline-end-color: #10b981; }
.ws-fin-cheque-bounced         { border-inline-end-color: #ef4444; background: rgba(239,68,68,0.04); }
.ws-fin-cheque-img {
  width: 44px; height: 56px;
  border-radius: 6px;
  background: linear-gradient(160deg, #fef3c7, #fde68a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 1px dashed rgba(245,158,11,0.4);
}
.ws-fin-cheque-bounced .ws-fin-cheque-img {
  background: linear-gradient(160deg, rgba(239,68,68,0.16), rgba(239,68,68,0.08));
  border-color: rgba(239,68,68,0.4);
  filter: grayscale(0.4);
}
.ws-fin-cheque-line1 { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ws-fin-cheque-num   { font-family: 'Courier New', monospace; font-weight: 700; font-size: 13px; direction: ltr; }
.ws-fin-cheque-bank  { font-size: 12px; color: var(--muted); }
.ws-fin-cheque-amt   { font-size: 13px; font-weight: 700; color: var(--text); margin-inline-start: auto; }
.ws-fin-cheque-line2 { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.ws-fin-cheque-line3 { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.ws-fin-cheque-line3 b { color: var(--text); font-weight: 700; }
.ws-fin-cheque-action { display: flex; flex-direction: column; align-items: end; gap: 6px; min-width: 110px; }
.ws-fin-cheque-buttons { display: flex; gap: 4px; }

/* Offline sessions */
.ws-fin-sessions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 8px;
}
.ws-fin-session {
  position: relative;
  text-align: center;
  padding: 10px 6px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11px;
  transition: transform 0.15s;
  cursor: help;
}
.ws-fin-session:hover { transform: translateY(-1px); }
.ws-fin-session-num {
  display: inline-block;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--surface-3);
  line-height: 22px;
  font-weight: 700;
  font-size: 11px;
  margin-bottom: 4px;
}
.ws-fin-session-topic { font-size: 10.5px; font-weight: 600; }
.ws-fin-session-date { font-size: 10px; color: var(--muted); margin-top: 2px; }
.ws-fin-session-st {
  position: absolute;
  top: 4px; inset-inline-end: 6px;
  font-size: 11px;
}
.ws-fin-session-done {
  background: rgba(16,185,129,0.10);
  border-color: rgba(16,185,129,0.32);
}
.ws-fin-session-done .ws-fin-session-num { background: #10b981; color: #fff; }
.ws-fin-session-done .ws-fin-session-st { color: #10b981; font-weight: 700; }
.ws-fin-session-future {
  background: rgba(14,165,233,0.06);
  border-color: rgba(14,165,233,0.22);
}
.ws-fin-session-future .ws-fin-session-num { background: rgba(14,165,233,0.18); color: #0ea5e9; }
.ws-fin-session-future .ws-fin-session-st { color: #94a3b8; }
.ws-fin-session-locked {
  background: rgba(239,68,68,0.06);
  border-color: rgba(239,68,68,0.32);
  opacity: 0.92;
}
.ws-fin-session-locked .ws-fin-session-num { background: rgba(239,68,68,0.18); color: #ef4444; }
.ws-fin-session-locked .ws-fin-session-st  { color: #ef4444; animation: wsFinLockShake 2.6s ease-in-out infinite; }
.ws-fin-session-locked .ws-fin-session-topic,
.ws-fin-session-locked .ws-fin-session-date { opacity: 0.6; }

.ws-fin-sessions-legend {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
  justify-content: center;
  flex-wrap: wrap;
}
.ws-fin-leg { display: inline-flex; align-items: center; gap: 5px; }
.ws-fin-leg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ws-fin-leg-done i   { background: #10b981; }
.ws-fin-leg-future i { background: rgba(14,165,233,0.4); border: 1px solid #0ea5e9; }
.ws-fin-leg-locked i { background: #ef4444; }

/* Activity log */
.ws-fin-log { display: flex; flex-direction: column; gap: 6px; }
.ws-fin-log-item {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: 6px;
  font-size: 11.5px;
}
.ws-fin-log-icon { font-size: 13px; }
.ws-fin-log-text { color: var(--text); }
.ws-fin-log-meta { font-size: 10px; color: var(--muted); }

/* Dark theme tweaks */
[data-theme="dark"] .ws-fin-summary { background: linear-gradient(135deg, rgba(30,109,255,0.10), rgba(16,185,129,0.08) 60%, rgba(160,32,240,0.08)); }
[data-theme="dark"] .ws-fin-section { background: var(--surface-2); }
[data-theme="dark"] .ws-fin-inst,
[data-theme="dark"] .ws-fin-cheque { background: var(--surface-3); }

/* Responsive */
@media (max-width: 1024px) {
  .ws-fin-sum-grid { grid-template-columns: repeat(2, 1fr); }
  .ws-fin-cheque-add-grid { grid-template-columns: 1fr 1fr; }
  .ws-fin-cheque-add-grid button { grid-column: 1 / -1; }
}

/* =====================================================================
   WORKSPACE — Coach tab AI upgrade (ws-coach-ai-*, ws-coach-prob-*, ws-coach-sent-*, ws-coach-call-*, ws-coach-nba-*)
   ===================================================================== */

.ws-coach-ai-hero {
  background: linear-gradient(135deg, rgba(160,32,240,0.06), rgba(30,109,255,0.05) 60%, rgba(16,185,129,0.05));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.ws-coach-ai-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 88% 12%, rgba(160,32,240,0.10), transparent 50%);
  pointer-events: none;
}
.ws-coach-ai-head { display: flex; justify-content: space-between; align-items: start; position: relative; }
.ws-coach-ai-tag {
  font-size: 10px;
  background: linear-gradient(135deg, #a020f0, #1e6dff);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.ws-coach-ai-spark { animation: aiTaskFlash 1.4s ease-in-out infinite; }
.ws-coach-ai-title { font-size: 14px; font-weight: 700; margin-top: 2px; }
.ws-coach-explain-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}
.ws-coach-explain-btn:hover { color: var(--text); background: var(--surface-2); }

.ws-coach-prob { margin-top: 10px; position: relative; }
.ws-coach-prob-val {
  font-size: 48px;
  font-weight: 800;
  line-height: 1;
}
.ws-coach-prob-val span { font-size: 22px; font-weight: 600; opacity: 0.6; margin-inline-start: 2px; }
.ws-coach-prob-high { background: linear-gradient(135deg, #10b981, #1e6dff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.ws-coach-prob-mid  { background: linear-gradient(135deg, #f59e0b, #a020f0); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.ws-coach-prob-low  { background: linear-gradient(135deg, #ef4444, #f59e0b); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.ws-coach-prob-bar {
  height: 6px;
  background: var(--surface-3);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 8px;
}
.ws-coach-prob-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #f59e0b 50%, #10b981);
  border-radius: 6px;
  animation: wsCoachProbFill 0.8s ease-out;
}
@keyframes wsCoachProbFill { from { width: 0; } }
.ws-coach-prob-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 10px;
}
.ws-coach-prob-meta b { color: var(--text); font-weight: 700; }

/* Factors breakdown */
.ws-coach-factors {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  animation: wsCoachFactorReveal 0.32s ease-out;
}
@keyframes wsCoachFactorReveal { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 600px; } }
.ws-coach-factors-title { font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.ws-coach-factor {
  display: grid;
  grid-template-columns: 140px 1fr 40px;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
  font-size: 11px;
}
.ws-coach-factor-lbl { color: var(--text); font-weight: 600; }
.ws-coach-factor-bar { height: 6px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.ws-coach-factor-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #1e6dff, #a020f0);
  border-radius: 4px;
}
.ws-coach-factor-val { text-align: end; font-weight: 700; color: var(--text); }
.ws-coach-factor-why {
  grid-column: 1 / -1;
  font-size: 10.5px;
  color: var(--muted);
  padding-block: 4px 8px;
  border-bottom: 1px dotted var(--border);
  margin-bottom: 4px;
}
.ws-coach-factor:last-child .ws-coach-factor-why { border-bottom: 0; }

/* Mini help text */
.ws-coach-mini-help { font-size: 10.5px; font-weight: 400; }

/* Predictions warn highlight */
.ws-coach-pred-warn .ws-coach-pred-val { color: #ef4444; }
.ws-coach-pred-warn { border-color: rgba(239,68,68,0.32); background: rgba(239,68,68,0.05); }

/* Sentiment timeline */
.ws-coach-sent-trend {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}
.ws-coach-sent-trend-up   { color: #10b981; background: rgba(16,185,129,0.10); }
.ws-coach-sent-trend-down { color: #ef4444; background: rgba(239,68,68,0.10); }
.ws-coach-sent-trend-flat { color: var(--muted); background: var(--surface-3); }
.ws-coach-sent-row { padding: 6px 0; }
.ws-coach-sent-svg { width: 100%; height: 60px; display: block; }
.ws-coach-sent-points {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  margin-top: 8px;
}
.ws-coach-sent-pt {
  text-align: center;
  padding: 6px 4px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ws-coach-sent-pt-icon { font-size: 16px; }
.ws-coach-sent-pt-lbl { font-weight: 600; color: var(--text); }
.ws-coach-sent-pt-when { color: var(--muted); }
.ws-coach-sent-pt-pos { background: rgba(16,185,129,0.06); }
.ws-coach-sent-pt-mid { background: rgba(245,158,11,0.06); }
.ws-coach-sent-pt-neg { background: rgba(239,68,68,0.06); }

/* Call quality */
.ws-coach-calls { display: flex; flex-direction: column; gap: 10px; }
.ws-coach-call {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 70px;
  grid-template-rows: auto auto auto;
  gap: 8px 12px;
  border-inline-end: 3px solid;
}
.ws-coach-call-pos { border-inline-end-color: #10b981; }
.ws-coach-call-mid { border-inline-end-color: #f59e0b; }
.ws-coach-call-neg { border-inline-end-color: #ef4444; }
.ws-coach-call-head { display: flex; flex-direction: column; gap: 2px; }
.ws-coach-call-title { font-size: 12.5px; font-weight: 700; }
.ws-coach-call-meta { font-size: 10.5px; color: var(--muted); }
.ws-coach-call-avg {
  grid-row: 1 / 3;
  grid-column: 2;
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  align-self: center;
  background: linear-gradient(135deg, #1e6dff, #a020f0);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ws-coach-call-pos .ws-coach-call-avg { background: linear-gradient(135deg, #10b981, #1e6dff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.ws-coach-call-neg .ws-coach-call-avg { background: linear-gradient(135deg, #ef4444, #f59e0b); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.ws-coach-call-axes { display: flex; flex-direction: column; gap: 4px; grid-column: 1; }
.ws-coach-call-axis {
  display: grid;
  grid-template-columns: 80px 1fr 26px;
  gap: 6px;
  align-items: center;
  font-size: 10.5px;
}
.ws-coach-call-axis-lbl { color: var(--muted); }
.ws-coach-call-axis-bar { height: 4px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.ws-coach-call-axis-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #ef4444, #f59e0b 50%, #10b981); border-radius: 3px; }
.ws-coach-call-axis-val { text-align: end; font-weight: 700; }
.ws-coach-call-hl {
  grid-column: 1 / -1;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--surface-3);
  padding: 6px 10px;
  border-radius: 6px;
}
.ws-coach-call-hl b { color: var(--text); font-weight: 600; }

/* Next Best Actions */
.ws-coach-nba { display: flex; flex-direction: column; gap: 8px; }
.ws-coach-nba-item {
  display: grid;
  grid-template-columns: 26px 32px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 10px;
  border-inline-end: 3px solid #1e6dff;
  transition: transform 0.15s, box-shadow 0.15s;
}
.ws-coach-nba-item:hover { transform: translateX(-2px); box-shadow: 0 3px 12px rgba(15,23,42,0.06); }
[dir="rtl"] .ws-coach-nba-item:hover { transform: translateX(2px); }
.ws-coach-nba-rank {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
}
.ws-coach-nba-item:nth-child(2) .ws-coach-nba-rank { background: linear-gradient(135deg, #cbd5e1, #94a3b8); }
.ws-coach-nba-item:nth-child(3) .ws-coach-nba-rank { background: linear-gradient(135deg, #fcd34d, #d97706); }
.ws-coach-nba-icon { font-size: 20px; }
.ws-coach-nba-lbl { font-size: 12.5px; font-weight: 700; }
.ws-coach-nba-why {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}
.ws-coach-nba-why-tag {
  background: linear-gradient(135deg, #a020f0, #1e6dff);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}
.ws-coach-nba-score {
  font-size: 14px;
  font-weight: 800;
  color: var(--brand-600, #0f766e);
  padding-inline-end: 4px;
}
.ws-coach-nba-go { font-size: 11px; padding: 5px 10px; min-height: 0; }

/* Triggers + risks side-by-side */
.ws-coach-trig-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ws-coach-section-trig,
.ws-coach-section-risk {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}
.ws-coach-triggers { display: flex; flex-direction: column; gap: 6px; }
.ws-coach-trig {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  background: var(--surface-2);
  border-radius: 8px;
}
.ws-coach-trig-i { font-size: 17px; text-align: center; }
.ws-coach-trig-lbl { font-size: 12px; font-weight: 700; }
.ws-coach-trig-why { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.ws-coach-risks { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }

/* Do/Dont grid */
.ws-coach-dd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Dark theme */
[data-theme="dark"] .ws-coach-ai-hero { background: linear-gradient(135deg, rgba(160,32,240,0.10), rgba(30,109,255,0.08) 60%, rgba(16,185,129,0.08)); }
[data-theme="dark"] .ws-coach-call,
[data-theme="dark"] .ws-coach-nba-item,
[data-theme="dark"] .ws-coach-sent-pt,
[data-theme="dark"] .ws-coach-trig { background: var(--surface-3); }

/* Responsive */
@media (max-width: 720px) {
  .ws-coach-sent-points { grid-template-columns: repeat(3, 1fr); }
  .ws-coach-trig-grid { grid-template-columns: 1fr; }
  .ws-coach-dd-grid { grid-template-columns: 1fr; }
  .ws-coach-nba-item { grid-template-columns: 26px 32px 1fr; }
  .ws-coach-nba-score, .ws-coach-nba-go { grid-column: 1 / -1; }
  .ws-coach-factor { grid-template-columns: 1fr 60px; }
  .ws-coach-factor-bar { grid-column: 1 / -1; }
}

/* =====================================================================
   WORKSPACE — Smart Inbox + Sequences (Phase 3.2)
   namespace: ws-inbox-* (enhancements), ws-seq-* (new)
   ===================================================================== */

/* Inbox filters */
.ws-inbox-filters {
  display: flex;
  gap: 4px;
  padding: 8px 0 10px;
  flex-wrap: wrap;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 8px;
}
.ws-inbox-filt {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 11.5px;
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s;
}
.ws-inbox-filt:hover { background: var(--surface-3); }
.ws-inbox-filt.is-active {
  background: linear-gradient(135deg, #a020f0, #1e6dff);
  color: #fff;
  border-color: transparent;
  font-weight: 700;
}
.ws-inbox-empty {
  text-align: center;
  padding: 18px;
  color: var(--muted);
  font-size: 12px;
}

/* Inbox item enhancements */
.ws-inbox-item.is-expanded {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(15,23,42,0.06);
}
.ws-inbox-item-unread { position: relative; }
.ws-inbox-unread-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #1e6dff;
  margin-inline-end: 4px;
  animation: wsInboxUnreadPulse 1.6s ease-in-out infinite;
}
@keyframes wsInboxUnreadPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(30,109,255,0.4); }
  50% { opacity: 0.5; box-shadow: 0 0 0 4px rgba(30,109,255,0); }
}
.ws-inbox-line1 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ws-inbox-channel {
  font-size: 9.5px;
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: 5px;
  color: var(--muted);
  font-weight: 500;
}
.ws-inbox-preview {
  margin-top: 6px;
  padding: 6px 10px;
  background: var(--surface-3);
  border-radius: 8px;
  font-size: 11.5px;
  color: var(--muted);
  border-inline-start: 2px solid #a020f0;
  display: flex;
  gap: 6px;
  align-items: start;
}
.ws-inbox-preview-icon { font-size: 12px; flex-shrink: 0; }

.ws-inbox-actions { display: flex; gap: 4px; align-items: center; }
.ws-inbox-toggle {
  background: linear-gradient(135deg, #a020f0, #1e6dff);
  color: #fff;
  border: 0;
  border-radius: 6px;
  width: 28px; height: 28px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s;
}
.ws-inbox-toggle:hover { transform: scale(1.08); box-shadow: 0 3px 10px rgba(160,32,240,0.3); }
.ws-inbox-item.is-expanded .ws-inbox-toggle { animation: wsInboxToggleRotate 0.32s ease-out; }
@keyframes wsInboxToggleRotate { from { transform: rotate(-180deg); } to { transform: rotate(0); } }

/* AI suggestions */
.ws-inbox-ai {
  margin-top: 10px;
  padding: 10px;
  background: linear-gradient(135deg, rgba(160,32,240,0.04), rgba(30,109,255,0.03));
  border: 1px solid rgba(160,32,240,0.18);
  border-radius: 10px;
  animation: wsInboxAiReveal 0.32s ease-out;
}
@keyframes wsInboxAiReveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.ws-inbox-ai-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.ws-inbox-ai-tag {
  font-size: 11.5px;
  font-weight: 700;
  background: linear-gradient(135deg, #a020f0, #1e6dff);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ws-inbox-ai-meta { font-size: 10.5px; color: var(--muted); }
.ws-inbox-ai-sug {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  transition: border-color 0.15s;
}
.ws-inbox-ai-sug:last-child { margin-bottom: 0; }
.ws-inbox-ai-sug:hover { border-color: rgba(160,32,240,0.32); }
.ws-inbox-ai-sug-positive { border-inline-start: 3px solid #10b981; }
.ws-inbox-ai-sug-neutral  { border-inline-start: 3px solid #0ea5e9; }
.ws-inbox-ai-sug-consult  { border-inline-start: 3px solid #8b5cf6; }
.ws-inbox-ai-sug-urgency  { border-inline-start: 3px solid #f59e0b; }
.ws-inbox-ai-sug-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--muted);
  margin-bottom: 4px;
}
.ws-inbox-ai-sug-icon { font-size: 12px; }
.ws-inbox-ai-sug-tone { font-weight: 600; }
.ws-inbox-ai-sug-text { font-size: 12px; line-height: 1.6; }
.ws-inbox-ai-sug-actions { display: flex; gap: 4px; margin-top: 6px; }
.ws-inbox-mini-btn { font-size: 10.5px; padding: 4px 8px; min-height: 0; }
.ws-inbox-mini-btn.is-sent { background: #10b981; color: #fff; }

/* ===== SEQUENCES ===== */
.ws-seq-card { margin: 14px 0; }
.ws-seq-tabs { display: flex; gap: 4px; }
.ws-seq-tab {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s;
}
.ws-seq-tab:hover { background: var(--surface-3); }
.ws-seq-tab.is-active {
  background: linear-gradient(135deg, #10b981, #1e6dff);
  color: #fff;
  border-color: transparent;
  font-weight: 700;
}
.ws-seq-tab-badge {
  background: rgba(255,255,255,0.25);
  color: inherit;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  margin-inline-start: 4px;
}
.ws-seq-tab:not(.is-active) .ws-seq-tab-badge {
  background: var(--surface-3);
  color: var(--text);
}

.ws-seq-body { padding-top: 8px; }
.ws-seq-panel { display: none; }
.ws-seq-panel.is-active { display: block; }
.ws-seq-empty {
  text-align: center;
  padding: 32px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 10px;
  font-size: 12.5px;
}

/* Templates grid */
.ws-seq-templates {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.ws-seq-tpl {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  transition: transform 0.15s, box-shadow 0.15s;
  border-inline-start: 3px solid;
}
.ws-seq-tpl:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(15,23,42,0.08); }
.ws-seq-tone-sky    { border-inline-start-color: #0ea5e9; }
.ws-seq-tone-amber  { border-inline-start-color: #f59e0b; }
.ws-seq-tone-green  { border-inline-start-color: #10b981; }
.ws-seq-tone-purple { border-inline-start-color: #8b5cf6; }

.ws-seq-tpl-head { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; }
.ws-seq-tpl-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 1px solid var(--border);
}
.ws-seq-tone-sky    .ws-seq-tpl-icon { background: rgba(14,165,233,0.10); border-color: rgba(14,165,233,0.32); }
.ws-seq-tone-amber  .ws-seq-tpl-icon { background: rgba(245,158,11,0.10); border-color: rgba(245,158,11,0.32); }
.ws-seq-tone-green  .ws-seq-tpl-icon { background: rgba(16,185,129,0.10); border-color: rgba(16,185,129,0.32); }
.ws-seq-tone-purple .ws-seq-tpl-icon { background: rgba(139,92,246,0.10); border-color: rgba(139,92,246,0.32); }
.ws-seq-tpl-name { font-size: 13px; font-weight: 700; }
.ws-seq-tpl-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }
.ws-seq-tpl-stats { display: flex; flex-direction: column; gap: 4px; align-items: end; }

.ws-seq-steps {
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--surface);
  border-radius: 8px;
}
.ws-seq-step {
  display: grid;
  grid-template-columns: 56px 28px 1fr;
  gap: 8px;
  align-items: start;
  padding: 4px 0;
  font-size: 11px;
}
.ws-seq-step-day {
  font-size: 9.5px;
  background: var(--surface-3);
  padding: 3px 7px;
  border-radius: 5px;
  color: var(--muted);
  text-align: center;
  font-weight: 600;
}
.ws-seq-step-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: var(--surface-2);
}
.ws-seq-step-title { font-weight: 700; font-size: 11.5px; }
.ws-seq-step-preview { color: var(--muted); margin-top: 1px; font-size: 10.5px; }
.ws-seq-step-connector {
  grid-column: 2;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  opacity: 0.5;
  padding: 1px 0;
}

.ws-seq-tpl-foot {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}
.ws-seq-start-btn { font-size: 11.5px; padding: 5px 10px; min-height: 0; }

/* Active sequences */
.ws-seq-active-list { display: flex; flex-direction: column; gap: 8px; }
.ws-seq-active {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1.2fr 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 10px;
  border-inline-end: 3px solid #1e6dff;
  transition: background 0.15s;
}
.ws-seq-active:hover { background: var(--surface-3); }
.ws-seq-active-name { font-size: 12.5px; font-weight: 700; }
.ws-seq-active-seq { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.ws-seq-active-bar {
  height: 6px;
  background: var(--surface-3);
  border-radius: 4px;
  overflow: hidden;
}
.ws-seq-active-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #1e6dff);
  border-radius: 4px;
}
.ws-seq-active-step { font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.ws-seq-active-last,
.ws-seq-active-next { font-size: 11px; }
.ws-seq-active-last-lbl,
.ws-seq-active-next-lbl { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.ws-seq-active-last-val,
.ws-seq-active-next-val { font-weight: 600; margin-top: 1px; }
.ws-seq-active-next-val { color: #1e6dff; }
.ws-seq-active-actions { display: flex; gap: 4px; }
.ws-seq-mini-btn { font-size: 10.5px; padding: 4px 8px; min-height: 0; }

/* Dark theme */
[data-theme="dark"] .ws-inbox-ai { background: linear-gradient(135deg, rgba(160,32,240,0.08), rgba(30,109,255,0.06)); }
[data-theme="dark"] .ws-inbox-ai-sug,
[data-theme="dark"] .ws-seq-step-icon { background: var(--surface-3); }

/* Responsive */
@media (max-width: 1280px) {
  .ws-seq-active { grid-template-columns: 1fr 1fr 1fr auto; }
  .ws-seq-active-last { grid-column: 1; }
}
@media (max-width: 1024px) {
  .ws-seq-templates { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .ws-seq-active { grid-template-columns: 1fr; }
  .ws-seq-active > * { grid-column: 1; }
}

/* =====================================================================
   Shared form validation + Persian date+time + Multi-channel composer
   + Locked drawer + Source icon select
   ===================================================================== */

/* Inline error text — always a block under the field */
.field-err {
  display: block;
  width: 100%;
  font-size: 11px;
  color: #ef4444;
  margin-top: 4px;
  font-weight: 500;
  animation: fieldErrSlide 0.18s ease-out;
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.18);
  border-radius: 6px;
  padding: 4px 8px;
  line-height: 1.4;
}
.field-err:empty {
  display: none !important;
  padding: 0;
  border: 0;
  background: transparent;
  margin: 0;
}
@keyframes fieldErrSlide { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: translateY(0); } }
input.is-invalid,
select.is-invalid,
textarea.is-invalid {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 2px rgba(239,68,68,0.10);
}

/* Inline date+time row */
.ws-dt-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* =====================================================================
   Persian date+time picker (pdp-*)
   ===================================================================== */

/* Input wrapper with embedded trigger button */
.pdp-wrap {
  position: relative;
  display: flex;
  width: 100%;
}
.pdp-wrap input {
  flex: 1;
  min-width: 0;
  /* The calendar trigger is physically on the left in RTL. The date text is
     intentionally LTR, so a logical inline-end padding would land on the
     right and let the icon collide with the year. */
  padding-left: 36px !important;
  padding-right: 12px !important;
  cursor: pointer;
  text-align: center;
  direction: ltr;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
}
.pdp-trigger {
  position: absolute;
  inset-inline-end: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: #1e6dff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: background 0.15s;
  padding: 0;
}
.pdp-trigger:hover { background: color-mix(in srgb, var(--brand-500, #2c7873) 12%, transparent); }
.pdp-trigger svg { display: block; }

/* Popup — compact size (≈250px wide) */
.pdp-popup {
  position: fixed;
  z-index: 10050;
  width: 250px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15,23,42,0.16);
  padding: 8px;
  zoom: 1;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.18s, transform 0.18s;
  font-family: 'Vazirmatn', system-ui, sans-serif;
}
.pdp-popup.is-open { opacity: 1; transform: translateY(0); }
.pdp-popup--date {
  box-sizing: border-box;
  padding: 5px;
  zoom: 1;
  transform: none;
  transform-origin: bottom right;
}
.pdp-popup--date.is-open { transform: none; }
.pdp-popup--date .pdp-head { margin-bottom: 2px; }
.pdp-popup--date .pdp-weekdays { padding: 1px 0; }
.pdp-popup--date .pdp-cell {
  aspect-ratio: auto;
  height: 34px;
  min-height: 34px;
}
.pdp-popup--date .pdp-day { padding: 0; }
.pdp-popup--date .pdp-foot { margin-top: 3px; }
[data-theme="dark"] .pdp-popup { background: var(--surface-2); border-color: var(--border); }

.pdp-head {
  display: grid;
  grid-template-columns: 26px 1fr 26px;
  gap: 4px;
  align-items: center;
  margin-bottom: 6px;
}
.pdp-nav {
  width: 26px; height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
}
.pdp-nav:hover { background: color-mix(in srgb, var(--brand-500, #2c7873) 12%, transparent); color: var(--brand-600, #0f766e); border-color: transparent; }
.pdp-title-wrap {
  display: flex;
  justify-content: center;
  gap: 4px;
}
.pdp-title {
  background: var(--surface-2);
  border: 0;
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: inherit;
  transition: background 0.12s;
}
.pdp-title:hover { background: color-mix(in srgb, var(--brand-500, #2c7873) 14%, transparent); color: var(--brand-600, #0f766e); }
.pdp-title-static {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 4px 10px;
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
}

.pdp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 3px;
}
.pdp-weekdays > div {
  text-align: center;
  font-size: 9.5px;
  color: var(--muted);
  font-weight: 700;
  padding: 3px 0;
}

.pdp-grid {
  display: grid;
  gap: 2px;
}
.pdp-grid-days { grid-template-columns: repeat(7, 1fr); }
.pdp-grid-months { grid-template-columns: repeat(3, 1fr); }
.pdp-grid-years  { grid-template-columns: repeat(3, 1fr); }

.pdp-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.12s;
  padding: 0;
  font-family: inherit;
}
.pdp-cell.pdp-empty { background: transparent; pointer-events: none; }
.pdp-cell.pdp-day:hover { background: color-mix(in srgb, var(--brand-500, #2c7873) 10%, transparent); color: var(--brand-600, #0f766e); }
.pdp-cell.is-today {
  background: color-mix(in srgb, var(--brand-300, #6fb98f) 18%, transparent);
  color: var(--brand-700, #0b5f59);
  font-weight: 700;
  outline: 1px solid color-mix(in srgb, var(--brand-500, #2c7873) 32%, transparent);
}
.pdp-cell.is-selected {
  background: linear-gradient(135deg, var(--brand-400, #6fb98f), var(--brand-700, #0b5f59));
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(30,109,255,0.32);
}

/* Month/Year cells */
.pdp-mo-cell, .pdp-yr-cell {
  padding: 8px 4px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  transition: all 0.12s;
  font-family: inherit;
}
.pdp-mo-cell:hover, .pdp-yr-cell:hover { background: color-mix(in srgb, var(--brand-500, #2c7873) 10%, transparent); color: var(--brand-600, #0f766e); }
.pdp-mo-cell.is-today, .pdp-yr-cell.is-today {
  background: color-mix(in srgb, var(--brand-300, #6fb98f) 18%, transparent);
  color: var(--brand-700, #0b5f59);
  font-weight: 700;
  outline: 1px solid color-mix(in srgb, var(--brand-500, #2c7873) 32%, transparent);
}
.pdp-mo-cell.is-selected, .pdp-yr-cell.is-selected {
  background: linear-gradient(135deg, var(--brand-400, #6fb98f), var(--brand-700, #0b5f59));
  color: #fff;
  font-weight: 700;
}

.pdp-foot {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.pdp-foot-btn {
  flex: 1;
  padding: 5px 8px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: linear-gradient(135deg, var(--brand-400, #6fb98f), var(--brand-700, #0b5f59));
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
  transition: all 0.15s;
}
.pdp-foot-btn-today { flex: 2; }
.pdp-foot-btn:hover { transform: translateY(-1px); box-shadow: 0 3px 10px color-mix(in srgb, var(--brand-500, #2c7873) 32%, transparent); }
.pdp-foot-btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  flex: 0 0 auto;
  min-width: 36px;
}
.pdp-foot-btn-ghost:hover { background: var(--surface-3); box-shadow: none; transform: none; }

/* Time picker popup also compact */
.pdp-popup-time { width: 230px; }

/* ===== Time picker (pdp-popup-time) ===== */
.pdp-popup-time { min-width: 240px; }
.ptp-row {
  display: flex;
  direction: ltr;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.ptp-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.ptp-spin {
  width: 56px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 6px;
  font-size: 12px;
  padding: 4px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}
.ptp-spin:hover { background: color-mix(in srgb, var(--brand-500, #2c7873) 10%, transparent); color: var(--brand-600, #0f766e); border-color: transparent; }
.ptp-input {
  width: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 4px;
  background: var(--surface);
  color: var(--text);
  font-family: 'Vazirmatn', system-ui, sans-serif;
  direction: ltr;
}
.ptp-lbl { font-size: 10px; color: var(--muted); }
.ptp-sep {
  font-size: 26px;
  font-weight: 800;
  color: var(--muted);
  align-self: center;
  margin-top: -16px;
}
.ptp-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.ptp-preset {
  padding: 5px 6px;
  font-size: 11px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  direction: ltr;
  transition: all 0.15s;
}
.ptp-preset:hover { background: linear-gradient(135deg, var(--brand-400, #6fb98f), var(--brand-700, #0b5f59)); color: #fff; border-color: transparent; }

/* ===== Multi-channel composer ===== */
.ws-mc-composer {
  border: 1px dashed rgba(160,32,240,0.32);
  background: linear-gradient(135deg, rgba(160,32,240,0.04), rgba(30,109,255,0.03));
  border-radius: 12px;
  padding: 12px;
  margin-top: 12px;
}
.ws-mc-head {
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #a020f0, #1e6dff);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ws-mc-channels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.ws-mc-ch {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 11.5px;
  user-select: none;
}
.ws-mc-ch:hover { background: var(--surface-2); }
.ws-mc-ch.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, #a020f0, #1e6dff);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(160,32,240,0.22);
}
.ws-mc-ch input { display: none; }
.ws-mc-ch-i { font-size: 14px; }
.ws-mc-msg {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
}
.ws-mc-attach {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.ws-mc-attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s;
}
.ws-mc-attach-btn:hover { background: var(--surface-2); border-color: rgba(160,32,240,0.32); }
.ws-mc-attach-btn input[type="file"] { display: none; }
.ws-mc-files {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.ws-mc-file {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 10.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ws-mc-file-rm {
  background: transparent;
  border: 0;
  color: #ef4444;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.ws-mc-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  gap: 8px;
}
.ws-mc-foot-info {
  font-size: 10.5px;
  color: var(--muted);
}
.ws-mc-foot-info b { color: var(--text); font-weight: 700; }
.ws-mc-send {
  font-size: 12px;
  padding: 7px 16px;
  font-weight: 700;
}

/* ===== Locked drawer (after Won/Lost) ===== */
.ws-drawer.is-locked .ws-drawer-body input,
.ws-drawer.is-locked .ws-drawer-body select,
.ws-drawer.is-locked .ws-drawer-body textarea {
  pointer-events: none;
  opacity: 0.7;
  background: var(--surface-2) !important;
  cursor: not-allowed;
}
.ws-drawer.is-locked .ws-drawer-body button:not(.ws-drawer-close):not(.ws-dr-tab):not([data-ws-act-trigger]):not([data-ws-act-do="reopen"]):not(.ws-mc-attach-btn):not([data-ws-coach-explain]):not(.ws-inbox-mini-btn):not(.ws-inbox-toggle):not(.ws-inbox-go) {
  pointer-events: none;
  opacity: 0.4;
}
.ws-drawer.is-locked [data-ws-act-do="won"],
.ws-drawer.is-locked [data-ws-act-do="lost"],
.ws-drawer.is-locked [data-ws-act-do="delete"] {
  display: none !important;
}
.ws-locked-overlay-msg {
  background: linear-gradient(135deg, rgba(245,158,11,0.10), rgba(239,68,68,0.06));
  border: 1px solid rgba(245,158,11,0.32);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ws-locked-icon { font-size: 22px; }
.ws-locked-text { flex: 1; font-size: 12.5px; }
.ws-locked-text b { color: var(--text); font-weight: 700; }
.ws-locked-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ===== Branded source badges (real social SVG logos) ===== */
.src-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: #fff;
  background: var(--brand, #94a3b8);
  flex-shrink: 0;
  vertical-align: middle;
}
.src-brand-sm { width: 16px; height: 16px; padding: 2px; border-radius: 5px; }
.src-brand-md { width: 22px; height: 22px; padding: 3px; }
.src-brand-lg { width: 32px; height: 32px; padding: 5px; border-radius: 8px; }
.src-brand svg { width: 100%; height: 100%; display: block; color: #fff; }
/* Instagram: gradient bg (instead of single brand color) */
.src-brand[data-src-id="instagram"] {
  background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}
/* Google: white bg with original colored SVG */
.src-brand[data-src-id="google"] {
  background: #fff;
  border: 1px solid var(--border, rgba(15,23,42,0.1));
  color: initial;
}
.src-brand[data-src-id="google"] svg { color: initial; }
/* Telegram: lighter blue + tilt the plane slightly */
.src-brand[data-src-id="telegram"] {
  background: linear-gradient(135deg, #2AABEE, #229ED9);
}

/* ===== Custom select (pcs-*) — supports SVG icons per option ===== */
.pcs-wrap {
  position: relative;
  width: 100%;
}
.pcs-native {
  /* keep native for form value but hide visually */
  position: absolute !important;
  width: 100% !important;
  height: 100% !important;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}
.pcs-display {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  text-align: start;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pcs-display:hover { border-color: rgba(30,109,255,0.4); }
.pcs-display:focus { outline: 0; border-color: #1e6dff; box-shadow: 0 0 0 2px rgba(30,109,255,0.14); }
.pcs-display-icon {
  width: 22px; height: 22px;
  padding: 3px;
  border-radius: 6px;
  background: var(--brand, #94a3b8);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pcs-display-icon svg { width: 100%; height: 100%; }
.pcs-display-icon[style*="instagram"],
.pcs-display .pcs-row-icon[data-src-id="instagram"] { /* fallback if attr applied */ }
.pcs-display-label { flex: 1; font-weight: 600; }
.pcs-display-arrow {
  color: var(--muted);
  font-size: 10px;
  transition: transform 0.18s;
}
.pcs-wrap:has(.pcs-popup) .pcs-display-arrow { transform: rotate(180deg); color: #1e6dff; }

/* Popup */
.pcs-popup {
  position: absolute;
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15,23,42,0.16);
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.16s, transform 0.16s;
  font-family: inherit;
}
.pcs-popup.is-open { opacity: 1; transform: translateY(0); }
[data-theme="dark"] .pcs-popup { background: var(--surface-2); }

.pcs-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12.5px;
  text-align: start;
  transition: background 0.12s;
}
.pcs-row:hover { background: var(--surface-2); }
.pcs-row.is-selected {
  background: linear-gradient(135deg, rgba(30,109,255,0.10), rgba(160,32,240,0.10));
  font-weight: 700;
}
.pcs-row-icon {
  width: 24px; height: 24px;
  padding: 3px;
  border-radius: 6px;
  background: var(--brand, #94a3b8);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pcs-row-icon svg { width: 100%; height: 100%; }
.pcs-row-label { flex: 1; }
/* per-brand styling override for instagram + google in custom select */
.pcs-row-icon[style*="#E4405F"], .pcs-display-icon[style*="#E4405F"] {
  background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%) !important;
}
.pcs-row-icon[style*="#4285F4"], .pcs-display-icon[style*="#4285F4"] {
  background: #fff !important;
  border: 1px solid var(--border);
  color: initial !important;
}
.pcs-row-icon[style*="#4285F4"] svg, .pcs-display-icon[style*="#4285F4"] svg { color: initial; }
.pcs-row-icon[style*="#26A5E4"], .pcs-display-icon[style*="#26A5E4"] {
  background: linear-gradient(135deg, #2AABEE, #229ED9) !important;
}

/* ===================================================================== */
/* ================== CHANNELS HUB — namespace `ch-*` ================= */
/* ===================================================================== */
.ch-head-actions { display: flex; gap: 8px; align-items: center; }
.ch-jump, .ch-compose { white-space: nowrap; }

/* === 1) Platforms Hero === */
.ch-platforms {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-bottom: 18px;
}
@media (max-width: 620px)  { .ch-platforms { grid-template-columns: 1fr; } }
.ch-pf-card {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center;
  padding: 14px 14px 12px; background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 16px; cursor: pointer; position: relative; overflow: hidden;
  transition: transform .25s, box-shadow .25s, border-color .25s;
  animation: chPfPop .55s cubic-bezier(.2,.7,.3,1.25) both;
}
.ch-pf-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.08); border-color: var(--brand-500); }
.ch-pf-card::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, transparent, currentColor, transparent); opacity: .25;
}
.ch-pf-icon {
  width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center;
  font-size: 24px; color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.16);
}
.ch-pf-body { min-width: 0; }
.ch-pf-name { font-weight: 800; font-size: 14px; color: var(--text); margin-bottom: 2px; }
.ch-pf-account { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; direction: ltr; text-align: start; }
.ch-pf-stats { display: flex; gap: 10px; font-size: 12px; align-items: center; flex-wrap: wrap; }
.ch-pf-stats b { color: var(--text); font-weight: 800; }
.ch-pf-growth { color: var(--green-600); font-weight: 700; background: rgba(16,185,129,.10); padding: 1px 8px; border-radius: 10px; font-size: 11px; }
.ch-pf-sync { font-size: 10px; color: var(--text-muted); margin-top: 4px; }
.ch-pf-status-dot {
  position: absolute; top: 12px; inset-inline-end: 12px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--green-500);
  box-shadow: 0 0 0 3px rgba(16,185,129,.18); animation: chDotPulse 2s infinite;
}
.ch-pf-status-dot[data-status="paused"] { background: var(--amber-500); box-shadow: 0 0 0 3px rgba(245,158,11,.18); animation: none; }
.ch-pf-pulse { animation: chPfPulseSection 1.4s ease; }
@keyframes chPfPop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes chDotPulse { 0%,100% { box-shadow: 0 0 0 3px rgba(16,185,129,.18); } 50% { box-shadow: 0 0 0 6px rgba(16,185,129,.30); } }
@keyframes chPfPulseSection { 0% { box-shadow: 0 0 0 0 rgba(160,32,240,.40); } 100% { box-shadow: 0 0 0 14px rgba(160,32,240,0); } }

/* === 3) Live Stream + AI === */
.ch-live-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-bottom: 18px; }
@media (max-width: 1100px) { .ch-live-grid { grid-template-columns: 1fr; } }
.ch-live-card .card-head { align-items: center; }
.ch-live-dot {
  display: inline-flex; gap: 4px; align-items: center; font-size: 10px; font-weight: 800;
  color: #d00; padding: 2px 8px; border: 1px solid rgba(220,0,0,.18); border-radius: 10px;
  background: rgba(220,0,0,.06); margin-inline-start: 8px; letter-spacing: .5px;
}
.ch-live-dot i { width: 6px; height: 6px; border-radius: 50%; background: #d00; animation: chLiveBlink 1.4s infinite; }
@keyframes chLiveBlink { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.ch-live-filter { display: flex; gap: 4px; flex-wrap: wrap; }
.ch-live-tab {
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
  padding: 4px 10px; border-radius: 12px; font-size: 12px; cursor: pointer;
  transition: all .2s;
}
.ch-live-tab:hover { color: var(--text); background: var(--surface-2); }
.ch-live-tab.is-active { background: var(--brand-500); color: #fff; border-color: var(--brand-500); }

.ch-live-feed { max-height: 520px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.ch-live-item {
  display: grid; grid-template-columns: 36px 1fr; gap: 10px;
  padding: 10px 12px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px;
  border-inline-start: 3px solid var(--text-muted);
  animation: chLiveSlide .4s cubic-bezier(.2,.7,.3,1) both; animation-delay: calc(var(--ch-i,0) * 32ms);
}
.ch-live-item.ch-live-tone-positive { border-inline-start-color: var(--green-500); }
.ch-live-item.ch-live-tone-question { border-inline-start-color: var(--amber-500); }
.ch-live-item.ch-live-tone-inquiry  { border-inline-start-color: var(--brand-500); }
.ch-live-item.ch-live-tone-warning  { border-inline-start-color: var(--red-500); }
.ch-live-item.ch-live-tone-reply,
.ch-live-item.ch-live-ai            { border-inline-start-color: #a020f0; background: linear-gradient(135deg, rgba(160,32,240,.04), transparent); }
.ch-live-item.ch-live-tone-system   { border-inline-start-color: var(--text-muted); }
.ch-live-pf { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; }
.ch-live-body { min-width: 0; }
.ch-live-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; font-size: 12px; }
.ch-live-who { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; color: var(--text); }
.ch-live-avatar { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 10px; font-weight: 800; }
.ch-live-time { color: var(--text-muted); font-size: 11px; }
.ch-live-msg { font-size: 13px; color: var(--text); line-height: 1.55; word-break: break-word; }
.ch-live-post { font-size: 11px; color: var(--text-muted); margin-top: 4px; font-style: italic; }
.ch-live-meta { margin-top: 4px; }
.ch-live-kind { font-size: 10px; padding: 1px 8px; border-radius: 10px; background: var(--surface-2); color: var(--text-muted); }
.ch-live-badge { font-size: 10px; padding: 1px 6px; border-radius: 8px; font-weight: 700; }
.ch-badge-ai { background: linear-gradient(135deg,#a020f0,#6f1bb8); color: #fff; }
.ch-badge-human { background: linear-gradient(135deg,#1e6dff,#0b3fae); color: #fff; }
@keyframes chLiveSlide { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: translateX(0); } }

/* AI box */
.ch-ai-card { display: flex; flex-direction: column; }
.ch-ai-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px dashed var(--border); }
.ch-ai-total-num { font-size: 32px; font-weight: 900; background: linear-gradient(135deg,#a020f0,#6f1bb8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ch-ai-total-label { font-size: 12px; color: var(--text-muted); }
.ch-ai-stats { display: flex; flex-direction: column; gap: 6px; }
.ch-ai-stat { display: flex; justify-content: space-between; align-items: center; }
.ch-ai-stat-v { font-weight: 800; color: var(--text); font-size: 14px; }
.ch-ai-stat-l { font-size: 11px; color: var(--text-muted); }
.ch-ai-platforms { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-bottom: 1px dashed var(--border); }
.ch-ai-pf-row { display: grid; grid-template-columns: 110px 1fr 110px; gap: 8px; align-items: center; font-size: 12px; }
.ch-ai-pf-name { color: var(--text); font-weight: 700; }
.ch-ai-pf-bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.ch-ai-pf-bar i { display: block; height: 100%; background: linear-gradient(90deg,#a020f0,#6f1bb8); transition: width .6s; }
.ch-ai-pf-val { text-align: end; font-size: 11px; color: var(--text-muted); }
.ch-ai-intents-title { font-size: 12px; font-weight: 700; color: var(--text); margin: 14px 0 8px; }
.ch-ai-intents { display: flex; flex-direction: column; gap: 8px; }
.ch-ai-intent {}
.ch-ai-intent-head { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.ch-ai-intent-name { color: var(--text); }
.ch-ai-intent-total { color: var(--text-muted); font-weight: 700; }
.ch-ai-intent-bar { height: 22px; border-radius: 6px; overflow: hidden; display: flex; background: var(--surface-2); }
.ch-ai-intent-bar i { display: inline-flex; align-items: center; padding: 0 6px; font-size: 10px; font-weight: 700; color: #fff; transition: width .6s; }
.ch-ai-intent-ai { background: linear-gradient(135deg,#a020f0,#6f1bb8); }
.ch-ai-intent-hu { background: linear-gradient(135deg,#1e6dff,#0b3fae); }

/* === Deep card head pattern (used for ig/tg/wa/sms) === */
.ch-deep-card { margin-bottom: 18px; }
.ch-deep-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.ch-deep-head-left { display: flex; gap: 12px; align-items: center; }
.ch-deep-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 20px; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.ch-deep-title { display: inline-flex; gap: 6px; align-items: center; }
.ch-verified { color: #1e6dff; font-size: 13px; }
.ch-deep-sub { direction: ltr; text-align: start; }
.ch-deep-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.ch-deep-tab { background: transparent; border: 1px solid var(--border); color: var(--text-muted); padding: 6px 12px; border-radius: 10px; font-size: 12px; cursor: pointer; transition: all .2s; }
.ch-deep-tab:hover { color: var(--text); background: var(--surface-2); }
.ch-deep-tab.is-active { background: var(--brand-500); color: #fff; border-color: var(--brand-500); }

/* === 4) Instagram === */
.ch-ig-posts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding-top: 12px; }
@media (max-width: 1024px) { .ch-ig-posts { grid-template-columns: 1fr; } }
.ch-ig-post {
  display: grid; grid-template-columns: 120px 1fr; gap: 14px;
  padding: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px;
  animation: chLiveSlide .5s both; animation-delay: calc(var(--ch-i,0) * 60ms);
}
.ch-ig-cover { width: 120px; height: 160px; border-radius: 12px; position: relative; box-shadow: 0 4px 12px rgba(0,0,0,.12); overflow: hidden; }
.ch-ig-type { position: absolute; top: 6px; inset-inline-end: 6px; font-size: 16px; }
.ch-ig-meta { min-width: 0; }
.ch-ig-title { font-weight: 800; font-size: 14px; color: var(--text); margin-bottom: 6px; line-height: 1.4; }
.ch-ig-caption { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; line-height: 1.55; }
.ch-ig-hashtags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.ch-ig-hash { font-size: 11px; color: #1e6dff; background: rgba(30,109,255,.08); padding: 1px 8px; border-radius: 10px; }
.ch-ig-stats { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); margin-bottom: 10px; padding: 6px 0; border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); }
.ch-ig-reach { color: var(--brand-500); font-weight: 700; }
.ch-ig-time { margin-inline-start: auto; }
.ch-ig-comments-title { font-size: 11px; font-weight: 700; color: var(--text); margin-bottom: 6px; opacity: .8; }
.ch-ig-comments { display: flex; flex-direction: column; gap: 6px; }

/* Stories grid */
.ch-ig-stories { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; padding-top: 12px; }
@media (max-width: 1100px) { .ch-ig-stories { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 620px)  { .ch-ig-stories { grid-template-columns: repeat(2, 1fr); } }
.ch-ig-story { display: flex; flex-direction: column; gap: 8px; animation: chLiveSlide .5s both; animation-delay: calc(var(--ch-i,0) * 60ms); }
.ch-ig-st-cover {
  height: 200px; border-radius: 14px; position: relative; display: grid; place-items: center;
  box-shadow: 0 6px 16px rgba(0,0,0,.10);
}
.ch-ig-st-ring {
  position: absolute; inset: -3px; border-radius: 16px;
  background: linear-gradient(135deg,#f09433,#e6683c 30%,#dc2743 60%,#cc2366 80%,#bc1888);
  z-index: -1; opacity: .35;
}
.ch-ig-st-icon { font-size: 28px; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.ch-ig-st-body { padding: 0 4px; }
.ch-ig-st-title { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 6px; line-height: 1.4; }
.ch-ig-st-stats { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.ch-ig-st-poll { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 8px; margin-bottom: 6px; }
.ch-ig-st-poll-q { font-size: 11px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.ch-ig-st-poll-row { display: grid; grid-template-columns: 60px 1fr 36px; gap: 6px; align-items: center; font-size: 10px; margin-bottom: 4px; }
.ch-ig-st-poll-bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.ch-ig-st-poll-bar i { display: block; height: 100%; background: linear-gradient(90deg,#E4405F,#bc1888); }
.ch-ig-st-poll-v { text-align: end; font-weight: 700; color: var(--text); }
.ch-ig-st-time { font-size: 10px; color: var(--text-muted); }

/* Flat comments view */
.ch-ig-flat { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.ch-ig-flat-item { padding: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; animation: chLiveSlide .4s both; animation-delay: calc(var(--ch-i,0) * 28ms); }
.ch-ig-flat-post { font-size: 11px; color: var(--text-muted); margin-top: 6px; font-style: italic; }

/* === Comment block (shared by IG/TG) === */
.ch-cmt { display: grid; grid-template-columns: 28px 1fr; gap: 8px; padding: 8px; border-radius: 10px; background: var(--surface-1); border: 1px solid var(--border); }
.ch-cmt.ch-cmt-reply { margin-inline-start: 20px; background: linear-gradient(135deg, rgba(160,32,240,.05), transparent); border-color: rgba(160,32,240,.18); }
.ch-cmt.ch-cmt-ai { background: linear-gradient(135deg, rgba(160,32,240,.07), transparent); border-color: rgba(160,32,240,.22); }
.ch-cmt-av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 800; }
.ch-cmt-body { min-width: 0; }
.ch-cmt-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.ch-cmt-who { font-size: 12px; font-weight: 700; color: var(--text); }
.ch-cmt-handle { font-size: 11px; color: var(--text-muted); font-weight: 400; direction: ltr; }
.ch-cmt-badge { font-size: 9px; padding: 1px 6px; border-radius: 8px; color: #fff; font-weight: 700; }
.ch-cmt-time { font-size: 10px; color: var(--text-muted); margin-inline-start: auto; }
.ch-cmt-msg { font-size: 12px; color: var(--text); line-height: 1.6; word-break: break-word; }

/* === 5) Telegram === */
.ch-tg-posts { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }
.ch-tg-post {
  display: grid; grid-template-columns: 48px 1fr; gap: 12px;
  padding: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px;
  border-inline-start: 3px solid #0088cc;
  animation: chLiveSlide .5s both; animation-delay: calc(var(--ch-i,0) * 50ms);
}
.ch-tg-media { width: 48px; height: 48px; border-radius: 10px; background: linear-gradient(135deg,#37bbfe,#007dbb); display: grid; place-items: center; font-size: 20px; color: #fff; align-self: start; }
.ch-tg-title { font-weight: 800; font-size: 14px; color: var(--text); margin-bottom: 6px; }
.ch-tg-text { font-size: 13px; color: var(--text-muted); line-height: 1.55; margin-bottom: 8px; }
.ch-tg-stats { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); align-items: center; }
.ch-tg-views { color: #0088cc; font-weight: 700; }
.ch-tg-rx { background: var(--surface-1); padding: 2px 6px; border-radius: 10px; border: 1px solid var(--border); }
.ch-tg-time { margin-inline-start: auto; }
.ch-tg-disc { display: flex; flex-direction: column; gap: 14px; padding-top: 12px; }
.ch-tg-disc-thread { padding: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.ch-tg-disc-post { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px dashed var(--border); }
.ch-tg-disc-thread .ch-cmt { background: var(--surface-1); margin-bottom: 6px; }

/* === 6) WhatsApp === */
.ch-wa-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding-top: 12px; }
@media (max-width: 1024px) { .ch-wa-list { grid-template-columns: 1fr; } }
.ch-wa-bc {
  padding: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px;
  animation: chLiveSlide .4s both; animation-delay: calc(var(--ch-i,0) * 40ms);
}
.ch-wa-bc-head { display: grid; grid-template-columns: 4px 1fr auto; gap: 10px; align-items: center; margin-bottom: 10px; }
.ch-wa-bc-tone { width: 4px; align-self: stretch; border-radius: 2px; background: #25D366; }
.ch-tone-promo { background: #f59e0b !important; } .ch-tone-reminder { background: #1e6dff !important; }
.ch-tone-info { background: #6b7280 !important; } .ch-tone-survey { background: #a020f0 !important; }
.ch-tone-content { background: #10b981 !important; } .ch-tone-greeting { background: #ec4899 !important; }
.ch-tone-announce { background: #06b6d4 !important; } .ch-tone-event { background: #f97316 !important; }
.ch-wa-bc-title { font-weight: 800; font-size: 13px; color: var(--text); }
.ch-wa-bc-aud { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.ch-wa-bc-sent { font-weight: 800; font-size: 18px; color: #25D366; text-align: end; }
.ch-wa-bc-sent span { font-size: 10px; color: var(--text-muted); font-weight: 400; display: block; }
.ch-wa-bc-bars { display: flex; flex-direction: column; gap: 6px; }
.ch-wa-bar { display: grid; grid-template-columns: 50px 1fr 48px; gap: 8px; align-items: center; font-size: 11px; }
.ch-wa-bar span { color: var(--text-muted); }
.ch-wa-bar b { text-align: end; color: var(--text); font-weight: 700; }
.ch-wa-bar-bar { height: 6px; background: var(--surface-1); border-radius: 3px; overflow: hidden; border: 1px solid var(--border); }
.ch-wa-bar-bar i { display: block; height: 100%; transition: width .6s; }
.ch-wa-bar-d   { background: #25D366; }
.ch-wa-bar-r   { background: #128C7E; }
.ch-wa-bar-rep { background: #075E54; }

.ch-wa-conv { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; }
.ch-wa-cv-item {
  display: grid; grid-template-columns: 40px 1fr; gap: 12px;
  padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  animation: chLiveSlide .4s both; animation-delay: calc(var(--ch-i,0) * 32ms);
}
.ch-wa-cv-item.has-unread { border-color: #25D366; box-shadow: 0 0 0 2px rgba(37,211,102,.10); }
.ch-wa-cv-av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; }
.ch-wa-cv-body { min-width: 0; }
.ch-wa-cv-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.ch-wa-cv-name { font-weight: 800; font-size: 13px; color: var(--text); }
.ch-wa-cv-phone { font-size: 11px; color: var(--text-muted); direction: ltr; }
.ch-wa-cv-time { font-size: 10px; color: var(--text-muted); margin-inline-start: auto; }
.ch-wa-cv-msg { font-size: 12px; color: var(--text); line-height: 1.55; }
.ch-wa-cv-foot { display: flex; gap: 8px; align-items: center; margin-top: 6px; font-size: 11px; }
.ch-wa-cv-sent { padding: 1px 8px; border-radius: 10px; background: var(--surface-1); }
.ch-tone-positive { color: #10b981; }
.ch-tone-inquiry  { color: #1e6dff; }
.ch-tone-urgent   { color: #ef4444; background: rgba(239,68,68,.10) !important; }
.ch-wa-cv-unread { color: #25D366; font-weight: 700; }

/* === 7) SMS === */
.ch-sms-list { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.ch-sms-c { padding: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; animation: chLiveSlide .4s both; animation-delay: calc(var(--ch-i,0) * 30ms); }
.ch-sms-c-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ch-sms-c-title { font-weight: 800; font-size: 13px; color: var(--text); }
.ch-sms-c-time { font-size: 11px; color: var(--text-muted); }
.ch-sms-c-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
@media (max-width: 720px) { .ch-sms-c-grid { grid-template-columns: repeat(2, 1fr); } }
.ch-sms-c-grid div { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.ch-sms-c-grid span { display: block; font-size: 10px; color: var(--text-muted); margin-bottom: 2px; }
.ch-sms-c-grid b { font-weight: 800; color: var(--text); font-size: 13px; }
.ch-sms-c-grid b em { font-style: normal; color: var(--green-600); font-size: 10px; font-weight: 700; }
.ch-sms-d   { color: #10b981 !important; }
.ch-sms-rep { color: #1e6dff !important; }

.ch-sms-tpl { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding-top: 12px; }
@media (max-width: 900px) { .ch-sms-tpl { grid-template-columns: 1fr; } }
.ch-sms-tpl-item { padding: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; animation: chLiveSlide .4s both; animation-delay: calc(var(--ch-i,0) * 30ms); }
.ch-sms-tpl-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ch-sms-tpl-title { font-weight: 800; color: var(--text); font-size: 13px; }
.ch-sms-tpl-usage { font-size: 11px; color: var(--text-muted); }
.ch-sms-tpl-body { padding: 10px; background: var(--surface-1); border: 1px dashed var(--border); border-radius: 8px; font-size: 12px; color: var(--text); line-height: 1.7; margin-bottom: 8px; direction: rtl; }
.ch-sms-tpl-foot { display: flex; justify-content: space-between; align-items: center; }
.ch-sms-tpl-vars { font-size: 11px; color: #a020f0; font-weight: 700; }

.ch-sms-sched { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; }
.ch-sms-sq {
  display: grid; grid-template-columns: 160px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  animation: chLiveSlide .4s both; animation-delay: calc(var(--ch-i,0) * 30ms);
}
.ch-sms-sq-when { font-size: 12px; color: var(--brand-500); font-weight: 700; background: rgba(160,32,240,.06); padding: 6px 10px; border-radius: 8px; text-align: center; }
.ch-sms-sq-info { min-width: 0; }
.ch-sms-sq-title { font-weight: 800; font-size: 13px; color: var(--text); margin-bottom: 2px; }
.ch-sms-sq-meta { font-size: 11px; color: var(--text-muted); }
.ch-sms-sq-st { padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.ch-st-scheduled { background: rgba(30,109,255,.10); color: #1e6dff; }
.ch-st-draft     { background: rgba(245,158,11,.10); color: var(--amber-600); }
.ch-st-recurring { background: rgba(160,32,240,.10); color: #a020f0; }
.ch-st-completed { background: rgba(16,185,129,.10); color: var(--green-600); }

/* === 8) Iranian platforms === */
.ch-iranian-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 1100px) { .ch-iranian-grid { grid-template-columns: 1fr; } }
.ch-irn-card .ch-deep-icon { width: 36px; height: 36px; font-size: 16px; border-radius: 10px; }
.ch-irn-head-l { display: flex; gap: 10px; align-items: center; }
.ch-irn-name { font-size: 15px; }
.ch-irn-paused { color: var(--amber-600); }
.ch-irn-growth { background: rgba(16,185,129,.10); color: var(--green-600); font-weight: 700; }
.ch-irn-posts { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; max-height: 360px; overflow-y: auto; }
.ch-irn-post {
  padding: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  animation: chLiveSlide .4s both; animation-delay: calc(var(--ch-i,0) * 28ms);
}
.ch-irn-post-title { font-weight: 700; font-size: 12px; color: var(--text); margin-bottom: 4px; line-height: 1.45; }
.ch-irn-post-stats { display: flex; gap: 8px; flex-wrap: wrap; font-size: 11px; color: var(--text-muted); }
.ch-irn-post-time { margin-inline-start: auto; }

/* === 9) Scheduler === */
.ch-sched-filter { display: flex; gap: 4px; flex-wrap: wrap; }
.ch-sched-tab { background: transparent; border: 1px solid var(--border); color: var(--text-muted); padding: 4px 12px; border-radius: 12px; font-size: 12px; cursor: pointer; transition: all .2s; }
.ch-sched-tab:hover { color: var(--text); background: var(--surface-2); }
.ch-sched-tab.is-active { background: var(--brand-500); color: #fff; border-color: var(--brand-500); }
.ch-sched-list { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; }
.ch-sched-item {
  display: grid; grid-template-columns: 160px 1fr auto; gap: 14px; align-items: center;
  padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  cursor: grab; transition: transform .2s, box-shadow .2s;
  animation: chLiveSlide .4s both; animation-delay: calc(var(--ch-i,0) * 28ms);
}
.ch-sched-item:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.ch-sched-item:active { cursor: grabbing; }
.ch-sched-when { display: flex; align-items: center; gap: 8px; }
.ch-sched-when-tag { width: 8px; height: 36px; border-radius: 4px; }
.ch-sched-when span { font-weight: 700; font-size: 12px; color: var(--text); }
.ch-sched-title { font-weight: 800; font-size: 13px; color: var(--text); margin-bottom: 2px; }
.ch-sched-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 11px; color: var(--text-muted); }
.ch-sched-type { background: var(--surface-1); padding: 1px 8px; border-radius: 10px; border: 1px solid var(--border); }
.ch-sched-pfs { display: inline-flex; gap: 4px; }
.ch-sched-pf { font-size: 14px; }
.ch-sched-st { padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.ch-sched-st-scheduled .ch-sched-st { background: rgba(30,109,255,.10); color: #1e6dff; }
.ch-sched-st-draft .ch-sched-st     { background: rgba(245,158,11,.10); color: var(--amber-600); }
.ch-sched-st-recurring .ch-sched-st { background: rgba(160,32,240,.10); color: #a020f0; }

/* === 10) Reports === */
.ch-reports-grid { display: grid; grid-template-columns: 1.6fr 1fr; align-items: start; gap: 14px; margin-bottom: 18px; }
@media (max-width: 1100px) { .ch-reports-grid { grid-template-columns: 1fr; } }
.ch-rep-trend { display: flex; flex-direction: column; }
.ch-weekly-chart { position: relative; min-height: 240px; }
.ch-rep-trend canvas { max-height: 240px; }
.ch-weekly-insights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.ch-weekly-insight { display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 72px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.ch-weekly-insight-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--insight-color, var(--brand-600)); background: color-mix(in srgb, var(--insight-color, var(--brand-500)) 13%, var(--surface-1)); }
.ch-weekly-insight-icon .ds-icon { width: 19px; height: 19px; }
.ch-weekly-insight-label { display: block; margin-bottom: 3px; color: var(--text-muted); font-size: 11px; line-height: 1.5; }
.ch-weekly-insight-value { display: block; color: var(--text); font-size: 13px; font-weight: 800; line-height: 1.55; }
@media (max-width: 620px) { .ch-weekly-insights { grid-template-columns: 1fr; } }
.ch-rep-attr-list { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.ch-attr-row { animation: chLiveSlide .4s both; animation-delay: calc(var(--ch-i,0) * 50ms); }
.ch-attr-head { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; font-size: 12px; }
.ch-attr-dot { width: 10px; height: 10px; border-radius: 50%; }
.ch-attr-name { font-weight: 700; color: var(--text); }
.ch-attr-share { margin-inline-start: auto; font-weight: 800; color: var(--text); }
.ch-attr-bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.ch-attr-bar i { display: block; height: 100%; transition: width .6s; }
.ch-attr-stats { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }
.ch-attr-rev { font-weight: 700; color: var(--green-600); }

/* === Compose Modal === */
.ch-compose-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; }
.ch-compose-modal[hidden] { display: none; }
.ch-cm-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(4px); }
.ch-cm-card { position: relative; width: min(640px, 92vw); max-height: 86vh; overflow-y: auto; background: var(--surface-1); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.30); animation: chCmPop .35s cubic-bezier(.2,.7,.3,1.25); display: flex; flex-direction: column; }
@keyframes chCmPop { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.ch-cm-head { display: flex; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.ch-cm-title { font-weight: 800; font-size: 16px; color: var(--text); }
.ch-cm-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ch-cm-x { background: transparent; border: none; cursor: pointer; font-size: 18px; color: var(--text-muted); padding: 4px 8px; border-radius: 6px; }
.ch-cm-x:hover { background: var(--surface-2); color: var(--text); }
.ch-cm-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.ch-cm-row { display: flex; flex-direction: column; gap: 6px; }
.ch-cm-label { font-size: 12px; font-weight: 700; color: var(--text); }
.ch-cm-channels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 540px) { .ch-cm-channels { grid-template-columns: repeat(2, 1fr); } }
.ch-cm-ch { display: flex; gap: 6px; align-items: center; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 12px; transition: border-color .2s, background .2s; }
.ch-cm-ch:has(input:checked) { border-color: var(--c, var(--brand-500)); background: color-mix(in srgb, var(--c, var(--brand-500)) 10%, var(--surface-1)); }
.ch-cm-ch-icon { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; color: #fff; }
.ch-cm-types { display: flex; gap: 8px; flex-wrap: wrap; }
.ch-cm-types label { display: flex; gap: 4px; align-items: center; padding: 4px 10px; background: var(--surface-2); border-radius: 8px; font-size: 12px; cursor: pointer; }
.ch-cm-text { width: 100%; padding: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; font-family: inherit; font-size: 13px; resize: vertical; }
.ch-cm-counter { text-align: end; font-size: 11px; color: var(--text-muted); }
.ch-cm-when-opts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ch-cm-when-opts label { display: flex; gap: 4px; align-items: center; font-size: 12px; cursor: pointer; }
.ch-cm-when-date { padding: 6px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 12px; }
.ch-cm-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: end; gap: 8px; }

/* Toast */
.ch-toast { position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translateX(50%) translateY(20px); background: linear-gradient(135deg,#10b981,#059669); color: #fff; padding: 10px 20px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.20); font-weight: 700; font-size: 13px; opacity: 0; transition: transform .3s, opacity .3s; z-index: 300; }
.ch-toast.show { opacity: 1; transform: translateX(50%) translateY(0); }

.ch-empty { padding: 30px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* Dark theme adjustments */
[data-theme="dark"] .ch-pf-card { background: var(--surface-2); }
[data-theme="dark"] .ch-live-item,
[data-theme="dark"] .ch-cmt,
[data-theme="dark"] .ch-ig-post,
[data-theme="dark"] .ch-tg-post,
[data-theme="dark"] .ch-wa-bc,
[data-theme="dark"] .ch-wa-cv-item,
[data-theme="dark"] .ch-sms-c,
[data-theme="dark"] .ch-sms-tpl-item,
[data-theme="dark"] .ch-sms-sq,
[data-theme="dark"] .ch-sched-item,
[data-theme="dark"] .ch-irn-post { background: var(--surface-1); }
[data-theme="dark"] .ch-sms-tpl-body,
[data-theme="dark"] .ch-sms-c-grid div { background: var(--surface-2); }

/* ===================================================================== */
/* ============== CHANNELS HUB — UI/UX POLISH v2 (2026-06-20) =========== */
/* ===================================================================== */

/* === Page head: nicer action buttons === */
.ch-head-actions .ch-jump,
.ch-head-actions .ch-compose { font-weight: 700; font-size: 13px; padding: 8px 14px; border-radius: 12px; }
.ch-head-actions .ch-compose { background: linear-gradient(135deg, var(--brand-500), #6f1bb8); color: #fff; border: none; box-shadow: 0 4px 12px rgba(160,32,240,.25); transition: transform .2s, box-shadow .2s; }
.ch-head-actions .ch-compose:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(160,32,240,.40); }

/* === 1) PLATFORMS HERO polish === */
.ch-pf-card {
  position: relative;
  background: linear-gradient(180deg, var(--surface-1), color-mix(in srgb, var(--surface-1) 92%, transparent));
  border-radius: 18px; padding: 16px 14px 14px;
  transition: transform .3s cubic-bezier(.2,.7,.3,1.25), box-shadow .3s, border-color .3s;
}
.ch-pf-card::before {
  content: ''; position: absolute; inset: 0; border-radius: 18px;
  background: linear-gradient(135deg, transparent 60%, color-mix(in srgb, currentColor 18%, transparent));
  opacity: 0; transition: opacity .3s; pointer-events: none;
}
.ch-pf-card:hover { transform: translateY(-4px) scale(1.01); box-shadow: 0 18px 40px rgba(0,0,0,.10); }
.ch-pf-card:hover::before { opacity: 1; }
.ch-pf-card::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 6px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, currentColor 40%, currentColor 60%, transparent);
  opacity: .35;
}
.ch-pf-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 8px 22px color-mix(in srgb, currentColor 30%, transparent), inset 0 1px 0 rgba(255,255,255,.30);
}
.ch-pf-icon .ds-ico,
.ch-pf-icon svg { width: 28px; height: 28px; color: #fff; }
.ch-live-pf .ds-ico,
.ch-live-pf svg,
.ch-deep-icon .ds-ico,
.ch-deep-icon svg,
.ch-cm-ch-icon .ds-ico,
.ch-cm-ch-icon svg,
.ch-sched-pf .ds-ico,
.ch-sched-pf svg {
  width: 1em; height: 1em;
  vertical-align: middle;
}
.ch-deep-icon {
  display: inline-grid; place-items: center;
  color: #fff;
}
.ch-deep-icon .ds-ico,
.ch-deep-icon svg { width: 22px; height: 22px; color: #fff; }
.ch-pf-card[data-ch-pf="instagram"] { color: #E4405F; }
.ch-pf-card[data-ch-pf="telegram"]  { color: #0088cc; }
.ch-pf-card[data-ch-pf="whatsapp"]  { color: #25D366; }
.ch-pf-card[data-ch-pf="sms"]       { color: #a020f0; }
.ch-pf-card[data-ch-pf="bale"]      { color: #2C5DC8; }
.ch-pf-card[data-ch-pf="eitaa"]     { color: #F0631C; }
.ch-pf-card[data-ch-pf="rubika"]    { color: #D6206C; }
.ch-pf-card[data-ch-pf="webpush"]   { color: #1e6dff; }
.ch-pf-card[data-ch-pf="linkedin"]  { color: #0A66C2; }
.ch-pf-card[data-ch-pf="youtube"]   { color: #cc0000; }
.ch-pf-card[data-ch-pf="aparat"]    { color: #ED1A3B; }
.ch-pf-card[data-ch-pf="linkedin"] .ch-pf-icon {
  font-family: Arial, sans-serif; font-weight: 900; font-style: italic;
  font-size: 22px !important; letter-spacing: -1px;
}
.ch-pf-card[data-ch-pf="youtube"] .ch-pf-icon { font-size: 20px !important; }
.ch-pf-card[data-ch-pf="aparat"] .ch-pf-icon  { font-size: 22px !important; }

.ch-pf-name { font-size: 15px; font-weight: 800; color: var(--text); }
.ch-pf-account { color: color-mix(in srgb, currentColor 65%, var(--text-muted)); font-weight: 600; }
.ch-pf-growth {
  font-size: 10px; padding: 2px 10px; border-radius: 12px;
  background: color-mix(in srgb, var(--green-500) 14%, transparent);
  color: var(--green-700, var(--green-600));
  font-weight: 800; line-height: 1.6;
  display: inline-flex; align-items: center; gap: 2px;
}
.ch-pf-growth::before { content: '▲'; font-size: 8px; }
.ch-pf-sync {
  margin-top: 6px; font-size: 10px; color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 4px;
}
.ch-pf-sync::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--green-500); box-shadow: 0 0 0 2px rgba(16,185,129,.18); }
.ch-pf-status-dot {
  width: 12px; height: 12px;
  background: radial-gradient(circle at 30% 30%, #34d57a, #10b981);
  box-shadow: 0 0 0 3px rgba(16,185,129,.20), 0 0 12px rgba(16,185,129,.35);
}

/* === Live grid layout polish === */
.ch-live-grid { gap: 16px; }
.ch-live-card, .ch-ai-card { border-radius: 18px; }
.ch-live-card .card-head, .ch-ai-card .card-head { padding-bottom: 14px; border-bottom: 1px solid var(--border); margin-bottom: 0; }

/* === LIVE STREAM polish === */
.ch-live-dot {
  background: linear-gradient(135deg, rgba(239,68,68,.10), rgba(239,68,68,.04));
  color: #ef4444; border: none; padding: 3px 10px; font-size: 10px;
  box-shadow: 0 0 0 1px rgba(239,68,68,.25), 0 4px 12px rgba(239,68,68,.10);
}
.ch-live-dot i { background: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,.60); }

.ch-live-feed { padding: 12px 4px 4px 4px; gap: 8px; }
.ch-live-feed::-webkit-scrollbar { width: 6px; }
.ch-live-feed::-webkit-scrollbar-thumb { background: linear-gradient(180deg,#a020f0,#6f1bb8); border-radius: 3px; }
.ch-live-feed::-webkit-scrollbar-track { background: transparent; }

.ch-live-item {
  position: relative;
  background: linear-gradient(180deg, var(--surface-1), color-mix(in srgb, var(--surface-1) 92%, transparent));
  border-radius: 14px; padding: 11px 14px;
  border-inline-start-width: 4px;
  transition: transform .2s, box-shadow .2s, background .2s;
}
.ch-live-item:hover { transform: translateX(-3px); box-shadow: 0 8px 22px rgba(0,0,0,.08); }
.ch-live-item:first-child {
  background: linear-gradient(135deg, rgba(160,32,240,.07), color-mix(in srgb, var(--surface-1) 95%, transparent));
  border-color: rgba(160,32,240,.20);
}
.ch-live-item:first-child::after {
  content: 'جدید'; position: absolute; top: 8px; inset-inline-end: 12px;
  font-size: 9px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg,#10b981,#059669);
  padding: 2px 8px; border-radius: 10px;
  animation: chNewBadge 1.6s ease-out;
}
@keyframes chNewBadge {
  0% { opacity: 0; transform: scale(.6); }
  20% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}
.ch-live-pf {
  position: relative; width: 38px; height: 38px;
  background: linear-gradient(135deg, color-mix(in srgb, currentColor 18%, transparent), color-mix(in srgb, currentColor 8%, transparent)) !important;
  border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
}
.ch-live-item.ch-live-ai .ch-live-pf {
  background: linear-gradient(135deg, rgba(160,32,240,.18), rgba(111,27,184,.10)) !important;
  border-color: rgba(160,32,240,.35);
  box-shadow: 0 0 12px rgba(160,32,240,.20);
}
.ch-live-msg { font-size: 12.5px; line-height: 1.65; }
.ch-live-kind {
  text-transform: uppercase; letter-spacing: .4px; font-size: 9px; font-weight: 700;
  padding: 1px 8px; border-radius: 8px;
  background: linear-gradient(135deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 80%, transparent));
}
.ch-live-avatar { box-shadow: 0 2px 6px rgba(0,0,0,.12); border: 1.5px solid var(--surface-1); }
.ch-live-badge.ch-badge-ai {
  background: linear-gradient(135deg,#a020f0,#6f1bb8);
  box-shadow: 0 2px 8px rgba(160,32,240,.32);
}
.ch-live-badge.ch-badge-human {
  background: linear-gradient(135deg,#1e6dff,#0b3fae);
  box-shadow: 0 2px 8px rgba(30,109,255,.30);
}

/* live time groups (now/this hour/today) */
.ch-live-time-group {
  font-size: 10px; font-weight: 800; color: var(--text-muted);
  letter-spacing: .4px; text-transform: uppercase;
  padding: 8px 4px 4px; display: flex; align-items: center; gap: 8px;
}
.ch-live-time-group::before, .ch-live-time-group::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

/* === AI box polish — tone-colored intent bars === */
.ch-ai-card { padding-bottom: 6px; }
.ch-ai-hero { padding: 18px 0 16px; }
.ch-ai-total-num {
  font-size: 36px; line-height: 1; font-weight: 900;
  background: linear-gradient(135deg,#a020f0,#6f1bb8 60%,#3b1860); -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: -1px;
  position: relative;
}
.ch-ai-total-num::after {
  content: '✦'; position: absolute; top: -4px; inset-inline-start: -16px;
  font-size: 14px; color: #a020f0; animation: chSparkle 2.4s infinite;
}
@keyframes chSparkle { 0%,100% { opacity: .4; transform: rotate(0); } 50% { opacity: 1; transform: rotate(180deg) scale(1.2); } }
.ch-ai-total-label { font-size: 11px; font-weight: 700; color: var(--text-muted); margin-top: 6px; }
.ch-ai-stats { gap: 8px; padding-block: 4px; }
.ch-ai-stat {
  background: linear-gradient(135deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 70%, transparent));
  border-radius: 10px; padding: 6px 10px; border: 1px solid var(--border);
}
.ch-ai-stat-v { font-size: 15px; font-weight: 800; background: linear-gradient(135deg, var(--text), color-mix(in srgb, var(--text) 70%, var(--text-muted))); -webkit-background-clip: text; background-clip: text; color: transparent; }

.ch-ai-pf-bar { height: 8px; border-radius: 4px; background: linear-gradient(180deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 80%, transparent)); border: 1px solid var(--border); }
.ch-ai-pf-bar i { border-radius: 4px; box-shadow: 0 1px 4px rgba(160,32,240,.40); }
.ch-ai-pf-row { padding: 2px 0; }
.ch-ai-pf-val b { color: var(--text); }

/* Intent bars — per-row varied tone colors based on data-tone attribute */
.ch-ai-intent { padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--surface-2) 50%, transparent); border: 1px solid color-mix(in srgb, var(--border) 60%, transparent); transition: background .2s; }
.ch-ai-intent:hover { background: var(--surface-2); }
.ch-ai-intent-bar { height: 24px; border-radius: 8px; background: linear-gradient(180deg, var(--surface-1), var(--surface-2)); border: 1px solid var(--border); padding: 1px; gap: 1px; }
.ch-ai-intent-bar i { border-radius: 6px; }
.ch-ai-intent-ai { background: linear-gradient(135deg,#a020f0,#6f1bb8); box-shadow: inset 0 1px 0 rgba(255,255,255,.20); }
.ch-ai-intent-hu { background: linear-gradient(135deg,#1e6dff,#0b3fae); box-shadow: inset 0 1px 0 rgba(255,255,255,.20); }
/* Per-row tones override */
.ch-ai-intent[data-tone="price"]   .ch-ai-intent-ai { background: linear-gradient(135deg,#10b981,#059669); }
.ch-ai-intent[data-tone="time"]    .ch-ai-intent-ai { background: linear-gradient(135deg,#0088cc,#005f8f); }
.ch-ai-intent[data-tone="job"]     .ch-ai-intent-ai { background: linear-gradient(135deg,#f59e0b,#d97706); }
.ch-ai-intent[data-tone="teacher"] .ch-ai-intent-ai { background: linear-gradient(135deg,#ec4899,#be185d); }
.ch-ai-intent[data-tone="cert"]    .ch-ai-intent-ai { background: linear-gradient(135deg,#06b6d4,#0891b2); }
.ch-ai-intent[data-tone="discount"].ch-ai-intent-ai { background: linear-gradient(135deg,#ef4444,#b91c1c); }
.ch-ai-intent[data-tone="complaint"].ch-ai-intent-ai { background: linear-gradient(135deg,#dc2626,#7f1d1d); }
.ch-ai-intent[data-tone="payment"] .ch-ai-intent-hu { background: linear-gradient(135deg,#a020f0,#6f1bb8); }

/* === Deep card heads — glassy === */
.ch-deep-card {
  position: relative; overflow: hidden; border-radius: 18px;
}
.ch-deep-head {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 50%, transparent), transparent);
  border-radius: 14px 14px 0 0; padding: 6px 0 14px;
  margin: -8px -8px 12px;
  padding: 16px 14px;
}
.ch-deep-icon {
  position: relative;
  box-shadow: 0 8px 22px color-mix(in srgb, currentColor 25%, transparent), inset 0 1px 0 rgba(255,255,255,.22);
}
.ch-deep-icon::after {
  content: ''; position: absolute; inset: -2px; border-radius: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, currentColor 40%, transparent), transparent);
  z-index: -1; filter: blur(8px); opacity: .6;
}
.ch-deep-title { font-size: 17px; font-weight: 800; }
.ch-deep-tab {
  font-size: 12.5px; font-weight: 700; padding: 7px 14px; border-radius: 11px;
  transition: all .2s;
}
.ch-deep-tab.is-active { box-shadow: 0 4px 12px color-mix(in srgb, var(--brand-500) 30%, transparent); }
.ch-verified {
  display: inline-grid; place-items: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: #1e6dff; color: #fff; font-size: 9px; font-weight: 900;
  box-shadow: 0 2px 6px rgba(30,109,255,.40);
}

/* === INSTAGRAM polish === */
.ch-ig-posts { gap: 16px; }
.ch-ig-post {
  display: grid; grid-template-columns: 140px 1fr;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 16px;
  padding: 14px; gap: 16px; overflow: hidden;
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.ch-ig-post:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(228,64,95,.10); border-color: rgba(228,64,95,.20); }
.ch-ig-cover {
  width: 140px; height: 180px; border-radius: 14px;
  background-blend-mode: overlay;
  background-image: radial-gradient(circle at 30% 20%, rgba(255,255,255,.50), transparent 60%),
                    radial-gradient(circle at 70% 80%, rgba(0,0,0,.20), transparent 50%),
                    linear-gradient(135deg, var(--ch-cover-c, #f8d6e8), color-mix(in srgb, var(--ch-cover-c, #f8d6e8) 60%, #fff));
  position: relative; box-shadow: 0 8px 22px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.40);
  overflow: hidden;
}
.ch-ig-cover::before {
  content: attr(data-letter); position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 64px; font-weight: 900; color: rgba(255,255,255,.65);
  text-shadow: 0 4px 18px rgba(0,0,0,.25);
  font-family: Vazirmatn, sans-serif;
}
.ch-ig-cover::after {
  content: ''; position: absolute; inset: auto 0 0 0; height: 50%;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.20));
}
.ch-ig-type {
  z-index: 2; top: 8px; inset-inline-end: 8px;
  background: rgba(0,0,0,.55); color: #fff;
  width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center; font-size: 12px;
  backdrop-filter: blur(6px);
}
.ch-ig-title { font-size: 14.5px; }
.ch-ig-caption { font-size: 12.5px; }
.ch-ig-hashtags { gap: 6px; }
.ch-ig-hash { font-weight: 700; }
.ch-ig-stats {
  gap: 14px; padding: 8px 0; margin-bottom: 10px;
  border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border);
  font-size: 12px; font-weight: 700;
}
.ch-ig-stats > span { display: inline-flex; align-items: center; gap: 4px; color: var(--text); }
.ch-ig-stats > span:nth-child(1) { color: #E4405F; }   /* likes — pink */
.ch-ig-stats > span:nth-child(2) { color: #1e6dff; }   /* comments — blue */
.ch-ig-stats > span:nth-child(3) { color: #f59e0b; }   /* saves — amber */
.ch-ig-stats > span:nth-child(4) { color: #10b981; }   /* shares — green */
.ch-ig-stats > span.ch-ig-reach  { color: #a020f0 !important; font-weight: 800; }
.ch-ig-stats > span.ch-ig-time   { color: var(--text-muted) !important; font-weight: 400; }
.ch-ig-comments-title {
  font-size: 10.5px; letter-spacing: .4px; text-transform: uppercase;
  font-weight: 800; color: var(--brand-500);
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 8px;
}
.ch-ig-comments-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border), transparent); }
.ch-ig-comments { gap: 6px; position: relative; }
.ch-ig-comments::before {
  content: ''; position: absolute; inset-inline-start: 13px; top: 14px; bottom: 14px; width: 2px;
  background: linear-gradient(180deg, transparent, var(--border) 20%, var(--border) 80%, transparent);
  opacity: .5;
}

/* Comment block polish */
.ch-cmt {
  position: relative;
  border-radius: 12px; padding: 10px;
  background: linear-gradient(180deg, var(--surface-1), color-mix(in srgb, var(--surface-1) 92%, transparent));
}
.ch-cmt.ch-cmt-reply {
  margin-inline-start: 28px;
  border-color: rgba(160,32,240,.18);
  background: linear-gradient(135deg, rgba(160,32,240,.06), color-mix(in srgb, var(--surface-1) 92%, transparent));
}
.ch-cmt.ch-cmt-reply::before {
  content: ''; position: absolute;
  inset-inline-start: -16px; top: 18px;
  width: 14px; height: 12px;
  border: 2px solid rgba(160,32,240,.25);
  border-top: none; border-inline-end: none;
  border-radius: 0 0 0 8px;
}
.ch-cmt.ch-cmt-ai {
  background: linear-gradient(135deg, rgba(160,32,240,.08), color-mix(in srgb, var(--surface-1) 92%, transparent));
  border-color: rgba(160,32,240,.28);
  box-shadow: 0 4px 14px rgba(160,32,240,.06);
}
.ch-cmt-av { box-shadow: 0 2px 6px rgba(0,0,0,.16); border: 1.5px solid var(--surface-1); width: 30px; height: 30px; font-size: 13px; }
.ch-cmt-badge { letter-spacing: .2px; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.ch-cmt-badge.ch-badge-ai { background: linear-gradient(135deg,#a020f0,#6f1bb8); box-shadow: 0 2px 6px rgba(160,32,240,.30); }
.ch-cmt-badge.ch-badge-human { background: linear-gradient(135deg,#1e6dff,#0b3fae); box-shadow: 0 2px 6px rgba(30,109,255,.30); }
.ch-cmt-handle { font-size: 11px; padding: 1px 6px; background: var(--surface-2); border-radius: 8px; }
.ch-cmt-msg { font-size: 12.5px; }

/* === STORIES polish === */
.ch-ig-stories { gap: 14px; }
.ch-ig-story { position: relative; }
.ch-ig-st-cover {
  height: 220px; border-radius: 18px;
  background-image: radial-gradient(circle at 25% 20%, rgba(255,255,255,.55), transparent 55%),
                    radial-gradient(circle at 75% 75%, rgba(0,0,0,.18), transparent 55%),
                    linear-gradient(135deg, var(--ch-cover-c, #f8d6e8), color-mix(in srgb, var(--ch-cover-c, #f8d6e8) 55%, #fff));
  position: relative; overflow: hidden;
  box-shadow: 0 10px 26px rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.45);
  transition: transform .3s;
  cursor: pointer;
}
.ch-ig-story:hover .ch-ig-st-cover { transform: scale(1.02); }
.ch-ig-st-cover::before {
  content: attr(data-letter); position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 92px; font-weight: 900; color: rgba(255,255,255,.55);
  text-shadow: 0 6px 24px rgba(0,0,0,.30);
  font-family: Vazirmatn, sans-serif;
}
.ch-ig-st-cover::after {
  content: ''; position: absolute; inset: auto 0 0 0; height: 70%;
  background: linear-gradient(180deg, transparent 30%, rgba(0,0,0,.45));
}
.ch-ig-st-ring {
  inset: -4px; border-radius: 22px; opacity: .85;
  background: conic-gradient(from 0deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888, #f09433);
  animation: chRingSpin 16s linear infinite;
}
@keyframes chRingSpin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.ch-ig-st-icon {
  position: absolute; bottom: 14px; inset-inline-start: 14px;
  z-index: 2;
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.95); color: #E4405F;
  display: grid; place-items: center;
  font-size: 15px; text-shadow: none;
  box-shadow: 0 6px 16px rgba(0,0,0,.30);
}
.ch-ig-st-title { font-size: 13px; line-height: 1.4; padding-top: 8px; }
.ch-ig-st-stats { font-size: 11px; font-weight: 700; }
.ch-ig-st-stats > span:nth-child(1) { color: #a020f0; }
.ch-ig-st-stats > span:nth-child(2) { color: #1e6dff; }
.ch-ig-st-stats > span:nth-child(3) { color: #E4405F; }
.ch-ig-st-stats > span:nth-child(4) { color: var(--text-muted); font-weight: 400; }
.ch-ig-st-poll {
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface-1) 92%, transparent), var(--surface-1));
  box-shadow: 0 4px 14px rgba(0,0,0,.06);
  border-radius: 12px;
}
.ch-ig-st-poll-bar { height: 8px; border-radius: 4px; background: var(--surface-2); }
.ch-ig-st-poll-bar i { background: linear-gradient(90deg,#E4405F,#bc1888); border-radius: 4px; box-shadow: 0 1px 4px rgba(228,64,95,.40); }
.ch-ig-st-time { padding-top: 4px; }

/* expired story styling */
.ch-ig-st-cover[data-expired] { filter: grayscale(.4) brightness(.95); }
.ch-ig-st-cover[data-expired] .ch-ig-st-ring { background: conic-gradient(#999, #555); opacity: .4; animation: none; }

/* === TELEGRAM polish === */
.ch-tg-post {
  background: var(--surface-1); border-radius: 16px; padding: 14px;
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.ch-tg-post:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0,136,204,.10); border-color: rgba(0,136,204,.25); }
.ch-tg-media {
  width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(135deg, #37bbfe, #0088cc 70%, #005a8a);
  box-shadow: 0 6px 16px rgba(0,136,204,.30), inset 0 1px 0 rgba(255,255,255,.30);
  font-size: 22px;
}
.ch-tg-title { font-size: 14.5px; line-height: 1.4; }
.ch-tg-text { font-size: 12.5px; line-height: 1.7; }
.ch-tg-stats { gap: 12px; }
.ch-tg-views {
  font-weight: 800;
  padding: 2px 8px; border-radius: 10px;
  background: linear-gradient(135deg, rgba(0,136,204,.10), rgba(0,136,204,.04));
  color: #0088cc !important;
  border: 1px solid rgba(0,136,204,.15);
}
.ch-tg-rx { font-weight: 600; }
.ch-tg-disc-thread { border-radius: 14px; }

/* === WHATSAPP polish === */
.ch-wa-bc {
  background: var(--surface-1); border-radius: 16px; padding: 14px;
  transition: transform .25s, box-shadow .25s;
}
.ch-wa-bc:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(37,211,102,.10); }
.ch-wa-bc-head { grid-template-columns: 6px 1fr auto; }
.ch-wa-bc-tone { width: 6px; border-radius: 3px; box-shadow: 0 0 8px currentColor; }
.ch-wa-bc-title { font-size: 14px; }
.ch-wa-bc-sent {
  font-size: 22px; font-weight: 900;
  background: linear-gradient(135deg, #25D366, #128C7E); -webkit-background-clip: text; background-clip: text; color: transparent;
  line-height: 1.2;
}
.ch-wa-bc-bars { gap: 8px; padding-top: 4px; }
.ch-wa-bar { grid-template-columns: 56px 1fr 52px; font-size: 11px; }
.ch-wa-bar span { font-weight: 700; }
.ch-wa-bar-bar { height: 8px; border-radius: 4px; box-shadow: inset 0 1px 2px rgba(0,0,0,.08); border: none; background: var(--surface-2); }
.ch-wa-bar-bar i { border-radius: 4px; box-shadow: 0 1px 4px currentColor; }
.ch-wa-bar-d   { background: linear-gradient(90deg, #25D366, #1ebd5c) !important; }
.ch-wa-bar-r   { background: linear-gradient(90deg, #128C7E, #0e7368) !important; }
.ch-wa-bar-rep { background: linear-gradient(90deg, #075E54, #054943) !important; }

.ch-wa-cv-item {
  background: var(--surface-1); border-radius: 14px;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.ch-wa-cv-item:hover { transform: translateX(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.06); }
.ch-wa-cv-item.has-unread {
  border-inline-start: 4px solid #25D366;
  padding-inline-start: 14px;
}
.ch-wa-cv-av { box-shadow: 0 4px 12px rgba(0,0,0,.16); border: 2px solid var(--surface-1); }
.ch-wa-cv-name { font-size: 13.5px; }
.ch-wa-cv-msg { color: color-mix(in srgb, var(--text) 80%, var(--text-muted)); }
.ch-wa-cv-foot { padding-top: 8px; border-top: 1px dashed var(--border); margin-top: 8px; }
.ch-wa-cv-sent { font-weight: 700; }
.ch-wa-cv-unread {
  background: linear-gradient(135deg,#25D366,#128C7E); color: #fff !important;
  padding: 1px 10px; border-radius: 10px;
  box-shadow: 0 2px 8px rgba(37,211,102,.30);
  animation: chUnreadPulse 2s infinite;
}
@keyframes chUnreadPulse { 0%,100% { box-shadow: 0 2px 8px rgba(37,211,102,.30); } 50% { box-shadow: 0 2px 14px rgba(37,211,102,.60); } }

/* === SMS polish === */
.ch-sms-c {
  background: var(--surface-1); border-radius: 16px; padding: 14px;
  transition: transform .25s, box-shadow .25s;
}
.ch-sms-c:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(160,32,240,.08); }
.ch-sms-c-head { padding-bottom: 8px; border-bottom: 1px dashed var(--border); margin-bottom: 12px; }
.ch-sms-c-title {
  font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px;
}
.ch-sms-c-title::before {
  content: '✉'; width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg,#a020f0,#6f1bb8); color: #fff;
  display: grid; place-items: center; font-size: 11px;
  box-shadow: 0 2px 6px rgba(160,32,240,.30);
}
.ch-sms-c-grid {
  grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
  gap: 10px;
}
@media (max-width: 720px) { .ch-sms-c-grid { grid-template-columns: repeat(2, 1fr); } }
.ch-sms-c-grid div {
  background: linear-gradient(180deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 70%, transparent));
  border-radius: 10px; padding: 8px 10px;
  text-align: center;
}
.ch-sms-c-grid div:first-child { background: linear-gradient(135deg, rgba(160,32,240,.10), rgba(160,32,240,.04)); border-color: rgba(160,32,240,.18); }
.ch-sms-c-grid div:first-child b { color: #a020f0; font-size: 16px; }
.ch-sms-c-grid span { font-size: 10.5px; font-weight: 700; }
.ch-sms-c-grid b { font-size: 14px; }
.ch-sms-d { color: var(--green-600) !important; font-weight: 800 !important; }
.ch-sms-d em { background: rgba(16,185,129,.15); padding: 1px 6px; border-radius: 8px; }
.ch-sms-rep { color: #1e6dff !important; font-weight: 800 !important; }

/* SMS templates */
.ch-sms-tpl-item {
  background: var(--surface-1); border-radius: 16px; padding: 14px;
  transition: transform .25s, box-shadow .25s;
}
.ch-sms-tpl-item:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0,0,0,.08); }
.ch-sms-tpl-head { padding-bottom: 8px; border-bottom: 1px dashed var(--border); margin-bottom: 10px; }
.ch-sms-tpl-title { font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.ch-sms-tpl-title::before {
  content: '📄'; width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg,#1e6dff,#0b3fae); color: #fff;
  display: grid; place-items: center; font-size: 11px;
}
.ch-sms-tpl-usage {
  background: var(--surface-2); padding: 2px 8px; border-radius: 10px;
  font-weight: 700;
}
.ch-sms-tpl-body { background: var(--surface-2); font-size: 12.5px; line-height: 1.75; }
.ch-sms-tpl-body { position: relative; }
.ch-sms-tpl-body strong { background: rgba(160,32,240,.12); color: #a020f0; padding: 0 4px; border-radius: 4px; font-weight: 700; }

/* SMS scheduled */
.ch-sms-sq {
  background: var(--surface-1); border-radius: 14px;
  transition: transform .2s, box-shadow .2s;
}
.ch-sms-sq:hover { transform: translateX(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.06); }
.ch-sms-sq-when {
  background: linear-gradient(135deg, rgba(160,32,240,.12), rgba(160,32,240,.04));
  border: 1px solid rgba(160,32,240,.18); border-radius: 10px;
  padding: 8px 12px; font-size: 12.5px;
}
.ch-sms-sq-when span { display: block; line-height: 1.4; }

/* === IRANIAN platforms polish === */
.ch-irn-card { padding: 0; overflow: hidden; }
.ch-irn-card .card-head { padding: 14px; }
.ch-irn-card::before {
  content: ''; position: absolute; top: 0; inset-inline-start: 0; right: 0; height: 4px;
}
.ch-irn-card.ch-irn-bale::before   { background: linear-gradient(90deg,#3b78e6,#1f4ea1); }
.ch-irn-card.ch-irn-eitaa::before  { background: linear-gradient(90deg,#ff8a3d,#d94a05); }
.ch-irn-card.ch-irn-rubika::before { background: linear-gradient(90deg,#ff4d8a,#a91454); }
.ch-irn-card .ch-deep-icon { width: 44px; height: 44px; font-size: 20px; }
.ch-irn-name { font-size: 16px; }
.ch-irn-paused {
  background: rgba(245,158,11,.14); color: var(--amber-600);
  padding: 1px 8px; border-radius: 8px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 4px;
}
.ch-irn-growth { background: rgba(16,185,129,.14); color: var(--green-600); font-weight: 800; padding: 4px 12px; border-radius: 12px; }
.ch-irn-posts { padding: 12px 14px 14px; gap: 10px; max-height: 380px; }
.ch-irn-posts::-webkit-scrollbar { width: 4px; }
.ch-irn-posts::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.ch-irn-post {
  background: linear-gradient(180deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 80%, transparent));
  border-radius: 10px; padding: 10px 12px;
  transition: transform .2s, box-shadow .2s, background .2s;
}
.ch-irn-post:hover { transform: translateX(-2px); background: var(--surface-2); box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.ch-irn-post-title { font-size: 12.5px; line-height: 1.5; margin-bottom: 6px; }
.ch-irn-post-stats { font-size: 11px; font-weight: 700; gap: 10px; }
.ch-irn-card.ch-irn-bale .ch-irn-post-stats > span:first-child { color: #2C5DC8; }
.ch-irn-card.ch-irn-eitaa .ch-irn-post-stats > span:first-child { color: #F0631C; }
.ch-irn-card.ch-irn-rubika .ch-irn-post-stats > span:first-child { color: #D6206C; }
.ch-irn-post-time { color: var(--text-muted); font-weight: 400; }

/* === SCHEDULER polish === */
.ch-sched-item {
  background: var(--surface-1); border-radius: 14px;
  grid-template-columns: 140px 1fr auto;
}
.ch-sched-item:hover { box-shadow: 0 8px 22px rgba(0,0,0,.08); }
.ch-sched-when { gap: 10px; align-items: stretch; }
.ch-sched-when-tag { width: 6px; border-radius: 3px; height: auto; min-height: 40px; box-shadow: 0 0 8px currentColor; }
.ch-sched-when span { font-size: 12.5px; font-weight: 800; }
.ch-sched-title { font-size: 13.5px; }
.ch-sched-type {
  background: linear-gradient(135deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 70%, transparent));
  font-weight: 700; padding: 2px 10px;
}
.ch-sched-pf { font-size: 16px; transition: transform .2s; }
.ch-sched-pf:hover { transform: scale(1.2); }
.ch-sched-st { font-weight: 700; padding: 4px 12px; }

/* === REPORTS polish === */
.ch-rep-trend, .ch-rep-attr { border-radius: 18px; }
.ch-attr-row { padding: 10px 0; }
.ch-attr-row + .ch-attr-row { border-top: 1px dashed var(--border); }
.ch-attr-dot {
  width: 14px; height: 14px;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 20%, transparent), 0 2px 6px rgba(0,0,0,.16);
}
.ch-attr-name { font-size: 13px; }
.ch-attr-share { font-size: 14px; background: linear-gradient(135deg, var(--text), var(--text-muted)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ch-attr-bar { height: 10px; border-radius: 5px; background: var(--surface-2); box-shadow: inset 0 1px 2px rgba(0,0,0,.08); }
.ch-attr-bar i { border-radius: 5px; box-shadow: 0 1px 4px currentColor; }
.ch-attr-stats { padding-top: 6px; font-size: 11.5px; }
.ch-attr-rev { font-weight: 800; }

/* === COMPOSE MODAL polish === */
.ch-cm-card { width: min(720px, 94vw); border-radius: 20px; }
.ch-cm-head { padding: 18px 22px; background: linear-gradient(180deg, color-mix(in srgb, var(--brand-500) 6%, transparent), transparent); border-radius: 20px 20px 0 0; }
.ch-cm-title { font-size: 18px; background: linear-gradient(135deg, var(--text), var(--brand-500) 90%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ch-cm-body { padding: 20px 22px; }
.ch-cm-channels { gap: 10px; }
.ch-cm-ch {
  position: relative; padding: 10px 12px; border-radius: 12px; gap: 8px;
  background: var(--surface-1); border: 1.5px solid var(--border);
  cursor: pointer; transition: all .2s; user-select: none;
}
.ch-cm-ch:hover { border-color: var(--c); background: color-mix(in srgb, var(--c) 5%, var(--surface-1)); }
.ch-cm-ch input { position: absolute; opacity: 0; pointer-events: none; }
.ch-cm-ch::after {
  content: '✓'; position: absolute; top: 6px; inset-inline-end: 8px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--c); color: #fff; font-size: 11px; font-weight: 900;
  display: grid; place-items: center;
  opacity: 0; transform: scale(0); transition: all .2s;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--c) 40%, transparent);
}
.ch-cm-ch:has(input:checked) {
  border-color: var(--c);
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 12%, var(--surface-1)), var(--surface-1));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--c) 18%, transparent);
}
.ch-cm-ch:has(input:checked)::after { opacity: 1; transform: scale(1); }
.ch-cm-ch-icon { width: 28px; height: 28px; box-shadow: 0 2px 8px rgba(0,0,0,.16); }
.ch-cm-ch-name { font-weight: 700; font-size: 12.5px; }

.ch-cm-types label,
.ch-cm-when-opts label {
  background: var(--surface-1); border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 10px; font-weight: 700;
  cursor: pointer; transition: all .2s;
}
.ch-cm-types label:has(input:checked),
.ch-cm-when-opts label:has(input:checked) {
  background: linear-gradient(135deg, var(--brand-500), #6f1bb8); color: #fff; border-color: transparent;
  box-shadow: 0 4px 12px rgba(160,32,240,.30);
}
.ch-cm-text {
  background: var(--surface-1); border: 1.5px solid var(--border); border-radius: 12px;
  padding: 12px 14px; font-size: 13.5px; line-height: 1.75; transition: border-color .2s, box-shadow .2s;
}
.ch-cm-text:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(160,32,240,.12); outline: none; }
.ch-cm-counter { font-weight: 700; }
.ch-cm-foot { padding: 14px 22px 18px; }
.ch-cm-foot .btn.primary { background: linear-gradient(135deg,#a020f0,#6f1bb8); border: none; box-shadow: 0 6px 18px rgba(160,32,240,.30); }

/* === Empty state polish === */
.ch-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 40px 20px;
  color: var(--text-muted); font-size: 13px;
}
.ch-empty::before {
  content: '✦'; font-size: 32px; color: var(--brand-500); opacity: .5;
}

/* === Dark theme tweaks === */
[data-theme="dark"] .ch-pf-card { background: linear-gradient(180deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 92%, transparent)); }
[data-theme="dark"] .ch-ig-cover,
[data-theme="dark"] .ch-ig-st-cover { box-shadow: 0 10px 26px rgba(0,0,0,.40), inset 0 1px 0 rgba(255,255,255,.18); }
[data-theme="dark"] .ch-sms-tpl-body { background: var(--surface-1); }
[data-theme="dark"] .ch-live-item:first-child { background: linear-gradient(135deg, rgba(160,32,240,.12), color-mix(in srgb, var(--surface-1) 88%, transparent)); }

/* ===================================================================== */
/* ========== LINKEDIN + YOUTUBE + APARAT (3 new platforms) =========== */
/* ===================================================================== */

/* LinkedIn icon override (in) */
.ch-icon-linkedin {
  font-family: Arial, sans-serif !important;
  font-weight: 900 !important;
  font-style: italic;
  font-size: 22px !important;
  letter-spacing: -1px;
}

/* === LINKEDIN posts === */
.ch-li-body { padding-top: 12px; }
.ch-li-posts { display: flex; flex-direction: column; gap: 16px; }
.ch-li-post {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
  transition: transform .25s, box-shadow .25s, border-color .25s;
  animation: chLiveSlide .5s both; animation-delay: calc(var(--ch-i,0) * 60ms);
}
.ch-li-post:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(10,102,194,.10); border-color: rgba(10,102,194,.25); }
.ch-li-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ch-li-author { display: flex; gap: 10px; align-items: center; }
.ch-li-author-av {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-size: 16px; font-weight: 800;
  box-shadow: 0 4px 12px rgba(0,0,0,.12); border: 2px solid var(--surface-1);
}
.ch-li-author-name { font-weight: 800; color: var(--text); font-size: 13.5px; }
.ch-li-author-role { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.ch-li-type {
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 10px;
  background: var(--surface-2); color: var(--text);
}
.ch-li-type-article { background: rgba(10,102,194,.10); color: #0A66C2; }
.ch-li-type-image   { background: rgba(245,158,11,.10); color: var(--amber-600); }
.ch-li-type-video   { background: rgba(255,0,0,.10); color: #cc0000; }
.ch-li-type-event   { background: rgba(160,32,240,.10); color: #a020f0; }
.ch-li-type-job     { background: rgba(16,185,129,.12); color: var(--green-600); font-weight: 800; }

.ch-li-cover {
  height: 160px; border-radius: 12px;
  background-image: radial-gradient(circle at 25% 20%, rgba(255,255,255,.50), transparent 55%),
                    radial-gradient(circle at 75% 80%, rgba(0,0,0,.16), transparent 50%),
                    linear-gradient(135deg, var(--ch-cover-c, #cfe1ff), color-mix(in srgb, var(--ch-cover-c, #cfe1ff) 60%, #fff));
  position: relative; overflow: hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,.10), inset 0 1px 0 rgba(255,255,255,.40);
}
.ch-li-cover::before {
  content: attr(data-letter); position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 72px; font-weight: 900; color: rgba(255,255,255,.55);
  text-shadow: 0 4px 18px rgba(0,0,0,.20);
}
.ch-li-cover::after {
  content: 'in'; position: absolute; top: 10px; inset-inline-start: 10px;
  width: 28px; height: 28px; border-radius: 6px;
  background: linear-gradient(135deg,#0A66C2,#004182); color: #fff;
  display: grid; place-items: center;
  font-family: Arial, sans-serif; font-weight: 900; font-size: 14px; font-style: italic;
  letter-spacing: -1px;
  box-shadow: 0 4px 10px rgba(10,102,194,.30);
}
.ch-li-title { font-size: 15px; font-weight: 800; color: var(--text); line-height: 1.5; }
.ch-li-body-text { font-size: 13px; color: var(--text-muted); line-height: 1.75; }
.ch-li-stats {
  display: flex; gap: 14px; flex-wrap: wrap;
  padding: 10px 0; margin: 4px 0;
  border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border);
  font-size: 12px; font-weight: 700;
}
.ch-li-stats > span:nth-child(1) { color: #0A66C2; }
.ch-li-stats > span:nth-child(2) { color: #1e6dff; }
.ch-li-stats > span:nth-child(3) { color: #10b981; }
.ch-li-views { color: var(--text-muted) !important; margin-inline-start: auto; font-weight: 600 !important; }

/* === VIDEO PLATFORMS (YouTube + Aparat) === */
.ch-video-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 18px; }
@media (max-width: 1100px) { .ch-video-grid { grid-template-columns: 1fr; } }
.ch-video-card { padding: 0; overflow: hidden; border-radius: 18px; position: relative; }
.ch-video-card .card-head { padding: 16px 18px 14px; }
.ch-video-card::before {
  content: ''; position: absolute; top: 0; inset-inline-start: 0; right: 0; height: 4px;
}
.ch-video-card.ch-video-youtube::before { background: linear-gradient(90deg, #ff4444, #cc0000, #800000); }
.ch-video-card.ch-video-aparat::before  { background: linear-gradient(90deg, #ff3a5a, #ED1A3B, #b81230); }

.ch-video-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ch-video-head-l { display: flex; gap: 12px; align-items: center; }
.ch-video-card .ch-deep-icon { width: 48px; height: 48px; font-size: 22px; border-radius: 14px; }
.ch-video-name { font-size: 16px; font-weight: 800; }
.ch-video-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; direction: ltr; text-align: start; }
.ch-video-growth-chip {
  background: rgba(16,185,129,.14); color: var(--green-600);
  font-weight: 800; font-size: 12px;
  padding: 4px 12px; border-radius: 12px;
}

.ch-video-stats-bar {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 60%, transparent), transparent);
  padding: 10px 18px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.ch-video-stats-bar > div { text-align: center; padding: 4px 6px; }
.ch-video-stats-bar > div + div { border-inline-start: 1px dashed var(--border); }
.ch-video-stats-bar > div span { display: block; font-size: 10px; color: var(--text-muted); margin-bottom: 3px; font-weight: 700; letter-spacing: .3px; }
.ch-video-stats-bar > div b { font-size: 13px; font-weight: 800; color: var(--text); }
.ch-video-card.ch-video-youtube .ch-video-stats-bar > div b { background: linear-gradient(135deg, #cc0000, #800000); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ch-video-card.ch-video-aparat  .ch-video-stats-bar > div b { background: linear-gradient(135deg, #ED1A3B, #b81230); -webkit-background-clip: text; background-clip: text; color: transparent; }

.ch-video-list { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 10px; max-height: 480px; overflow-y: auto; }
.ch-video-list::-webkit-scrollbar { width: 4px; }
.ch-video-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.ch-video-item {
  display: grid; grid-template-columns: 120px 1fr; gap: 12px;
  padding: 8px; border-radius: 12px;
  background: linear-gradient(180deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 70%, transparent));
  transition: background .2s, transform .2s, box-shadow .2s;
  animation: chLiveSlide .4s both; animation-delay: calc(var(--ch-i,0) * 30ms);
}
.ch-video-item:hover { background: var(--surface-2); transform: translateX(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.ch-video-thumb {
  width: 120px; height: 72px; border-radius: 10px;
  background-image: radial-gradient(circle at 30% 25%, rgba(255,255,255,.48), transparent 55%),
                    radial-gradient(circle at 70% 80%, rgba(0,0,0,.22), transparent 50%),
                    linear-gradient(135deg, var(--ch-cover-c, #fde2e4), color-mix(in srgb, var(--ch-cover-c, #fde2e4) 55%, #fff));
  position: relative; overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,.10), inset 0 1px 0 rgba(255,255,255,.35);
}
.ch-video-thumb::before {
  content: attr(data-letter); position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 36px; font-weight: 900; color: rgba(255,255,255,.55);
  text-shadow: 0 3px 12px rgba(0,0,0,.25);
}
.ch-video-play {
  position: absolute; top: 50%; inset-inline-start: 50%;
  transform: translate(50%, -50%);
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.92); color: #cc0000;
  display: grid; place-items: center; font-size: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,.30);
  z-index: 2;
}
.ch-video-card.ch-video-aparat .ch-video-play { color: #ED1A3B; }
.ch-video-dur {
  position: absolute; bottom: 6px; inset-inline-end: 6px;
  background: rgba(0,0,0,.75); color: #fff;
  font-size: 10px; font-weight: 800;
  padding: 2px 6px; border-radius: 5px;
  direction: ltr;
  z-index: 2;
}
.ch-video-meta { min-width: 0; align-self: center; }
.ch-video-title {
  font-size: 13px; font-weight: 700; color: var(--text);
  line-height: 1.45; margin-bottom: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ch-video-stats { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; color: var(--text-muted); font-weight: 600; align-items: center; }
.ch-video-views { color: #cc0000 !important; font-weight: 800 !important; }
.ch-video-card.ch-video-aparat .ch-video-views { color: #ED1A3B !important; }
.ch-video-ret {
  background: rgba(16,185,129,.12); color: var(--green-600);
  padding: 1px 6px; border-radius: 8px; font-weight: 800;
}
.ch-video-time { margin-inline-start: auto; color: var(--text-muted); }

/* Dark theme for new platforms */
[data-theme="dark"] .ch-li-post,
[data-theme="dark"] .ch-video-item { background: var(--surface-1); }
[data-theme="dark"] .ch-video-card { background: var(--surface-2); }


/* ============================================================
   VOIP HUB — namespace `vp-*`
   صف زنده + تماس‌های فعال + وضعیت کارشناسان + شماره‌ها
   ============================================================ */

/* ----- HERO ----- */
.vp-hero {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 28px 32px 0;
  margin-bottom: 18px;
  background: linear-gradient(135deg, rgba(125, 159, 245, .14) 0%, rgba(111, 185, 143, .14) 40%, rgba(244, 162, 97, .12) 100%), var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  isolation: isolate;
}
.vp-hero-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 8% 12%, rgba(125,159,245,.30), transparent 38%),
    radial-gradient(circle at 92% 18%, rgba(244,162,97,.22), transparent 42%),
    radial-gradient(circle at 50% 100%, rgba(111,185,143,.22), transparent 45%);
  animation: vpHeroFlow 16s ease-in-out infinite alternate;
}
@keyframes vpHeroFlow {
  0%   { transform: translate3d(0,0,0) scale(1); }
  100% { transform: translate3d(0,-6px,0) scale(1.04); }
}
.vp-hero-top {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: center;
}
.vp-hero-left { min-width: 0; }
.vp-hero-title {
  font-size: 28px; font-weight: 800; margin: 6px 0 4px;
  background: linear-gradient(135deg, var(--text), #2c7873 60%, #6fb98f);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  letter-spacing: -.02em;
}
.vp-hero-sub { font-size: 13px; color: var(--text-muted); margin: 0 0 14px; }

.vp-pbx-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: rgba(16, 185, 129, .10);
  border: 1px solid rgba(16, 185, 129, .25);
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  color: #047857;
}
[data-theme="dark"] .vp-pbx-chip { color: #6ee7b7; background: rgba(16,185,129,.14); }
.vp-pbx-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16,185,129,.55);
  animation: vpDotPulse 1.6s ease-out infinite;
}
@keyframes vpDotPulse {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,.55); }
  70%  { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
.vp-pbx-ping { font-family: ui-monospace, 'Cascadia Code', monospace; color: var(--text-muted); }

.vp-hero-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.vp-hchip {
  font-size: 12px; padding: 5px 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; color: var(--text-muted);
}
.vp-hchip b { color: var(--text); font-weight: 700; margin-inline-end: 2px; }
.vp-hchip-live {
  background: linear-gradient(135deg, rgba(220,38,38,.10), rgba(244,114,182,.12));
  color: #b91c1c; border-color: rgba(220,38,38,.25); font-weight: 600;
}
[data-theme="dark"] .vp-hchip-live { color: #fca5a5; }
.vp-live-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: #ef4444; margin-inline-end: 6px;
  animation: vpDotPulse 1.4s ease-out infinite;
}

/* hero right (wave + headset) */
.vp-hero-right {
  position: relative;
  height: 140px;
  display: flex; align-items: center; justify-content: center;
}
.vp-wave {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  opacity: .9;
}
.vp-wave svg { width: 100%; height: 100%; }
.vp-wave-back, .vp-wave-front {
  fill: none; stroke: url(#vp-wave-g); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 2px 6px rgba(125,159,245,.35));
}
.vp-wave-back { opacity: .35; animation: vpWaveBob 4s ease-in-out infinite; }
.vp-wave-front { animation: vpWaveBob 2.6s ease-in-out infinite reverse; }
@keyframes vpWaveBob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.vp-wave-bars {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 5px; align-items: flex-end; height: 40px; pointer-events: none;
}
.vp-wave-bars span {
  width: 4px; border-radius: 2px;
  background: linear-gradient(180deg, #7c9cf4, #6fb98f);
  animation: vpEq 1.2s ease-in-out infinite;
}
.vp-wave-bars span:nth-child(1) { height: 12px; animation-delay: -.1s; }
.vp-wave-bars span:nth-child(2) { height: 20px; animation-delay: -.3s; }
.vp-wave-bars span:nth-child(3) { height: 30px; animation-delay: -.5s; }
.vp-wave-bars span:nth-child(4) { height: 24px; animation-delay: -.2s; }
.vp-wave-bars span:nth-child(5) { height: 36px; animation-delay: -.6s; }
.vp-wave-bars span:nth-child(6) { height: 18px; animation-delay: -.4s; }
.vp-wave-bars span:nth-child(7) { height: 28px; animation-delay: -.1s; }
.vp-wave-bars span:nth-child(8) { height: 38px; animation-delay: -.7s; }
.vp-wave-bars span:nth-child(9) { height: 22px; animation-delay: -.2s; }
.vp-wave-bars span:nth-child(10){ height: 30px; animation-delay: -.5s; }
.vp-wave-bars span:nth-child(11){ height: 18px; animation-delay: -.3s; }
.vp-wave-bars span:nth-child(12){ height: 14px; animation-delay: -.1s; }
@keyframes vpEq {
  0%, 100% { transform: scaleY(.5); opacity: .6; }
  50%      { transform: scaleY(1.4); opacity: 1; }
}
.vp-headset {
  position: relative; z-index: 2;
  width: 88px; height: 88px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(255,255,255,.55), rgba(255,255,255,.20));
  backdrop-filter: blur(6px) saturate(140%);
  border: 1px solid rgba(255,255,255,.6);
  box-shadow: 0 10px 30px rgba(125,159,245,.30);
  color: #2c7873;
  animation: vpHeadFloat 4s ease-in-out infinite;
}
.vp-headset svg { width: 50px; height: 50px; }
@keyframes vpHeadFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-6px) rotate(2deg); }
}
[data-theme="dark"] .vp-headset {
  background: linear-gradient(135deg, rgba(255,255,255,.10), rgba(255,255,255,.04));
  border-color: rgba(255,255,255,.10); color: #c7d2fe;
}

/* KPI grid inside hero */
.vp-kpi-grid {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
  padding-bottom: 22px;
}

/* ----- BAND (queue + active side by side) ----- */
.vp-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 18px;
  margin-bottom: 18px;
}
@media (max-width: 1180px) {
  .vp-band { grid-template-columns: 1fr; }
}

/* ----- Generic card shell ----- */
.vp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 22px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.vp-card + .vp-card { margin-top: 18px; }
.vp-card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.vp-card-title {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 700; letter-spacing: -.01em;
}
.vp-card-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.vp-title-icon {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 10px;
  background: linear-gradient(135deg, rgba(125,159,245,.18), rgba(111,185,143,.22));
  font-size: 15px;
}
.vp-title-icon-queue  { background: linear-gradient(135deg, #fef3c7, #fcd34d); color: #92400e; }
.vp-title-icon-active { background: linear-gradient(135deg, #d1fae5, #6ee7b7); color: #065f46; }
.vp-title-icon-status { background: linear-gradient(135deg, #dbeafe, #93c5fd); color: #1e40af; }
.vp-title-icon-num    { background: linear-gradient(135deg, #ede9fe, #c4b5fd); color: #5b21b6; }
[data-theme="dark"] .vp-title-icon-queue  { background: linear-gradient(135deg,#78350f,#b45309); color:#fef3c7; }
[data-theme="dark"] .vp-title-icon-active { background: linear-gradient(135deg,#064e3b,#047857); color:#d1fae5; }
[data-theme="dark"] .vp-title-icon-status { background: linear-gradient(135deg,#1e3a8a,#2563eb); color:#dbeafe; }
[data-theme="dark"] .vp-title-icon-num    { background: linear-gradient(135deg,#4c1d95,#7c3aed); color:#ede9fe; }

.vp-card-actions { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vp-card-actions-sep {
  width: 1px; height: 20px; background: var(--border);
  margin: 0 4px;
}

/* Tabs */
.vp-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 999px; border: 1px solid var(--border); }
.vp-tab {
  padding: 5px 12px; font-size: 12px; font-weight: 600;
  background: transparent; border: none; border-radius: 999px;
  color: var(--text-muted); transition: .18s;
}
.vp-tab:hover { color: var(--text); }
.vp-tab.active {
  background: var(--surface); color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}

.vp-pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 0 rgba(239,68,68,.5);
  animation: vpDotPulse 1.4s ease-out infinite;
}
.vp-count { font-size: 13px; font-weight: 700; color: var(--text); }

/* ===== QUEUE LIST ===== */
/* [crm-l1-menu-p1] UX audit fix — .vp-q-row's 6-column grid needs ~780px of
   minimum content width (38+160+180+130+90px fixed/min tracks + the actions
   column), but this widget normally sits in a 2-column dashboard split at
   ~560-600px wide. The @media(max-width:920px) stacked layout below never
   fired because it checks the VIEWPORT, not this card's own width — so on
   an ordinary desktop viewport (well over 920px) the row silently overflowed
   its own card, and .vp-card's overflow:hidden clipped the spillover
   (wait-time text/action icons rendering cut off at the card edge). A
   container query reacts to the CARD's width instead, so it also fires
   correctly on typical desktop viewports.
*/
.vp-queue-list { display: flex; flex-direction: column; gap: 10px; container-type: inline-size; }
.vp-q-row {
  display: grid;
  grid-template-columns: 38px minmax(160px, 1.4fr) minmax(180px, 2fr) 130px 90px auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  position: relative;
  transition: .22s;
  animation: vpRowSlide .42s cubic-bezier(.25,.8,.3,1) both;
  animation-delay: calc(var(--vp-i,0) * 35ms);
}
@keyframes vpRowSlide {
  from { opacity: 0; transform: translateY(8px) translateX(-4px); }
  to   { opacity: 1; transform: translateY(0) translateX(0); }
}
.vp-q-row:hover {
  background: var(--surface);
  transform: translateX(-2px);
  box-shadow: var(--shadow-sm);
}
.vp-q-row-vip {
  background: linear-gradient(90deg, rgba(244,114,182,.10), var(--surface-2) 30%);
  border-color: rgba(244,114,182,.30);
}
.vp-q-row-vip::before {
  content: ''; position: absolute; inset-inline-start: 0; top: 10%; bottom: 10%;
  width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #f472b6, #6fb98f);
}
.vp-q-row-high {
  background: linear-gradient(90deg, rgba(244,162,97,.08), var(--surface-2) 30%);
  border-color: rgba(244,162,97,.28);
}
.vp-q-row-high::before {
  content: ''; position: absolute; inset-inline-start: 0; top: 10%; bottom: 10%;
  width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #f59e0b, #ef4444);
}
.vp-q-row-normal::before {
  content: ''; position: absolute; inset-inline-start: 0; top: 30%; bottom: 30%;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--border-strong);
}
/* [crm-l1-menu-p1] UX audit fix — same stacked layout the @media(max-width:
   920px) block below already uses for narrow viewports, applied by CARD
   width via @container instead (see .vp-queue-list's container-type above).
   Threshold set above the ~780px this row's fixed/min tracks actually need. */
@container (max-width: 780px) {
  .vp-q-row {
    grid-template-columns: 32px 1fr auto;
    grid-template-areas:
      "rank id prio"
      "tag tag tag"
      "wait wait actions";
    gap: 8px;
  }
  .vp-q-rank { grid-area: rank; }
  .vp-q-id { grid-area: id; }
  .vp-q-prio { grid-area: prio; }
  .vp-q-tag-col { grid-area: tag; flex-direction: row; gap: 8px; flex-wrap: wrap; }
  .vp-q-wait { grid-area: wait; }
  .vp-q-actions { grid-area: actions; justify-content: flex-end; }
}

.vp-q-rank {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 13px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text);
}
.vp-q-row-vip .vp-q-rank {
  background: linear-gradient(135deg, #f472b6, #6fb98f);
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 10px rgba(111,185,143,.30);
}
.vp-q-row-high .vp-q-rank {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 10px rgba(245,158,11,.28);
}

.vp-q-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.vp-q-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  font-weight: 700; font-size: 14px; color: #fff;
  background: linear-gradient(135deg, #2c7873, #6fb98f);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.18);
}
.vp-q-avatar[data-iden="customer"] { background: linear-gradient(135deg, #10b981, #14b8a6); }
.vp-q-avatar[data-iden="student"]  { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.vp-q-avatar[data-iden="lead"]     { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.vp-q-avatar[data-iden="unknown"]  { background: linear-gradient(135deg, #94a3b8, #64748b); }

.vp-q-meta { min-width: 0; }
.vp-q-name { font-size: 13.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vp-q-phone { font-size: 12px; color: var(--text-muted); font-family: ui-monospace, 'Cascadia Code', monospace; margin-top: 1px; }

.vp-q-tag-col {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.vp-q-tag {
  font-size: 11.5px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vp-q-city { font-size: 11px; color: var(--text-faint); }

/* Identity chip (shared with active + numbers) */
.vp-q-iden, .vp-ac-iden {
  display: inline-flex; align-items: center;
  font-size: 10.5px; padding: 2px 8px; border-radius: 999px;
  font-weight: 600; line-height: 1.5;
  width: fit-content;
}
.vp-iden-customer { background: rgba(16,185,129,.12); color: #047857; }
.vp-iden-student  { background: rgba(99,102,241,.12); color: #4338ca; }
.vp-iden-lead     { background: rgba(245,158,11,.14); color: #b45309; }
.vp-iden-unknown  { background: rgba(148,163,184,.18); color: #475569; }
[data-theme="dark"] .vp-iden-customer { color: #6ee7b7; background: rgba(16,185,129,.16); }
[data-theme="dark"] .vp-iden-student  { color: #c7d2fe; background: rgba(99,102,241,.20); }
[data-theme="dark"] .vp-iden-lead     { color: #fcd34d; background: rgba(245,158,11,.20); }
[data-theme="dark"] .vp-iden-unknown  { color: #cbd5e1; background: rgba(148,163,184,.24); }

.vp-q-ainote {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11.5px;
  padding: 6px 10px 6px 6px;
  background:
    linear-gradient(135deg, rgba(111,185,143,.10), rgba(125,159,245,.10)),
    linear-gradient(90deg, rgba(111,185,143,.06), transparent 70%);
  border: 1px solid rgba(111,185,143,.22);
  border-radius: 999px;
  margin-top: 4px;
}
.vp-q-ainote-badge {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6fb98f, #2c7873);
  box-shadow: 0 2px 6px rgba(111,185,143,.30), inset 0 0 0 2px rgba(255,255,255,.22);
  color: #fff;
  flex-shrink: 0;
}
.vp-q-ainote-spark {
  font-size: 12px;
  line-height: 1;
  animation: vpAiSparkPulse 2.4s ease-in-out infinite;
}
@keyframes vpAiSparkPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.18) rotate(20deg); opacity: .85; }
}
.vp-q-ainote-label {
  font-weight: 800;
  font-size: 11px;
  background: linear-gradient(135deg, #7c3aed, #004445);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  flex-shrink: 0;
  letter-spacing: -.01em;
}
.vp-q-ainote-sep {
  color: var(--text-faint);
  font-weight: 700;
  flex-shrink: 0;
}
.vp-q-ainote-text {
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
  line-height: 1.6;
}
[data-theme="dark"] .vp-q-ainote {
  background:
    linear-gradient(135deg, rgba(111,185,143,.14), rgba(125,159,245,.10)),
    linear-gradient(90deg, rgba(111,185,143,.10), transparent 70%);
  border-color: rgba(111,185,143,.35);
}
[data-theme="dark"] .vp-q-ainote-text { color: var(--text-muted); }
[data-theme="dark"] .vp-q-ainote-label {
  background: linear-gradient(135deg, #c4b5fd, #6fb98f);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Wait time bar */
.vp-q-wait { display: flex; flex-direction: column; gap: 4px; }
.vp-q-wait-bar {
  height: 6px; border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.vp-q-wait-bar span {
  display: block; height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #f59e0b 60%, #ef4444 100%);
  border-radius: 999px;
  transition: width .8s ease;
}
.vp-q-wait-time { font-size: 12.5px; font-weight: 700; color: var(--text); font-family: ui-monospace, monospace; }

/* Priority chip */
.vp-q-pchip {
  font-size: 11px; padding: 3px 10px; border-radius: 999px; font-weight: 700;
  white-space: nowrap;
}
.vp-pri-vip {
  background: linear-gradient(135deg, #f472b6, #6fb98f); color: #fff;
  box-shadow: 0 4px 10px rgba(111,185,143,.28);
}
.vp-pri-high {
  background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff;
}
.vp-pri-normal { background: var(--surface-3); color: var(--text-muted); }

.vp-q-actions { display: inline-flex; gap: 4px; }
.vp-q-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 9px;
  padding: 6px 10px;
  font-size: 12px; font-weight: 600;
  transition: .15s;
}
.vp-q-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.vp-q-btn-primary {
  background: linear-gradient(135deg, #10b981, #14b8a6);
  color: #fff; border-color: transparent;
}
.vp-q-btn-ghost { background: transparent; }

.vp-queue-foot {
  display: flex; gap: 18px;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.vp-foot-stat b { color: var(--text); font-weight: 700; font-family: ui-monospace, monospace; }
.vp-foot-warn b { color: #b45309; }
[data-theme="dark"] .vp-foot-warn b { color: #fcd34d; }

/* ===== ACTIVE CALLS GRID ===== */
.vp-active-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(16,185,129,.10);
  border: 1px solid rgba(16,185,129,.28);
  font-size: 12px; font-weight: 700; color: #047857;
}
[data-theme="dark"] .vp-active-pill { color: #6ee7b7; }
.vp-active-pill-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #10b981;
  animation: vpDotPulse 1.4s ease-out infinite;
}

.vp-active-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.vp-ac-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  animation: vpRowSlide .45s cubic-bezier(.25,.8,.3,1) both;
  animation-delay: calc(var(--vp-i,0) * 50ms);
}
.vp-ac-card::before {
  content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #10b981, #14b8a6);
}
.vp-ac-positive::before { background: linear-gradient(180deg, #10b981, #6ee7b7); }
.vp-ac-neutral::before  { background: linear-gradient(180deg, #6366f1, #a5b4fc); }
.vp-ac-negative::before { background: linear-gradient(180deg, #ef4444, #f97316); }
.vp-ac-state-hold       { background: linear-gradient(90deg, rgba(244,162,97,.10), var(--surface-2) 40%); }
.vp-ac-state-hold::before { background: linear-gradient(180deg, #f59e0b, #f97316); }

.vp-ac-state {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700;
  color: #047857;
  margin-bottom: 10px;
}
[data-theme="dark"] .vp-ac-state { color: #6ee7b7; }
.vp-ac-state-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #10b981;
  animation: vpDotPulse 1.4s ease-out infinite;
}
.vp-ac-state-hold .vp-ac-state { color: #b45309; }
.vp-ac-state-hold .vp-ac-state-dot { background: #f59e0b; }
.vp-ac-rec {
  margin-inline-start: auto;
  font-size: 10.5px; padding: 2px 8px;
  background: rgba(239,68,68,.10); color: #b91c1c;
  border-radius: 999px;
  letter-spacing: .04em;
  animation: vpRecBlink 1.6s ease-in-out infinite;
}
@keyframes vpRecBlink { 50% { opacity: .55; } }
[data-theme="dark"] .vp-ac-rec { color: #fca5a5; background: rgba(239,68,68,.16); }

.vp-ac-bridge {
  display: grid;
  grid-template-columns: 1fr 70px 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.vp-ac-side {
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
}
.vp-ac-side-customer { justify-content: flex-end; }
.vp-ac-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13.5px; color: #fff;
  background: var(--vp-c, #2c7873);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.20);
  flex-shrink: 0;
}
.vp-ac-avatar-cust { background: linear-gradient(135deg, #10b981, #14b8a6); }
.vp-ac-avatar-cust[data-iden="lead"]    { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.vp-ac-avatar-cust[data-iden="student"] { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.vp-ac-avatar-cust[data-iden="unknown"] { background: linear-gradient(135deg, #94a3b8, #64748b); }

.vp-ac-side-info { min-width: 0; }
.vp-ac-side-info-right { text-align: end; }
.vp-ac-name { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vp-ac-role { font-size: 11px; color: var(--text-muted); margin-top: 1px; font-family: ui-monospace, monospace; }

.vp-ac-link {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  height: 24px;
}
.vp-ac-link-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: #6fb98f;
  animation: vpLinkFlow 1.6s ease-in-out infinite;
}
.vp-ac-link-dot:nth-child(2) { animation-delay: -.4s; }
.vp-ac-link-dot:nth-child(3) { animation-delay: -.8s; }
@keyframes vpLinkFlow {
  0%, 100% { transform: scale(.7); opacity: .35; }
  50%      { transform: scale(1.2); opacity: 1; }
}

.vp-ac-meta-row {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-bottom: 8px;
}
.vp-ac-tag {
  font-size: 11.5px; padding: 2px 9px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-muted);
}
.vp-ac-sent {
  font-size: 11px; padding: 2px 9px; border-radius: 999px;
  background: rgba(16,185,129,.10); color: #047857;
  font-weight: 600;
}
.vp-ac-negative .vp-ac-sent { background: rgba(239,68,68,.10); color: #b91c1c; }
.vp-ac-neutral .vp-ac-sent  { background: rgba(99,102,241,.10); color: #4338ca; }

.vp-ac-foot {
  display: flex; align-items: center; gap: 12px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.vp-ac-timer {
  font-size: 16px; font-weight: 700;
  font-family: ui-monospace, 'Cascadia Code', monospace;
  color: var(--text);
  letter-spacing: .02em;
  background: linear-gradient(135deg, #2c7873, #6fb98f);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.vp-ac-eq {
  display: flex; gap: 3px; align-items: flex-end; flex: 1;
  height: 22px;
}
.vp-ac-eq span {
  width: 3px; border-radius: 2px;
  background: linear-gradient(180deg, #6fb98f, #2c7873);
  animation: vpEq 1s ease-in-out infinite;
}
.vp-ac-eq span:nth-child(1) { height: 8px;  animation-delay: -.1s; }
.vp-ac-eq span:nth-child(2) { height: 14px; animation-delay: -.3s; }
.vp-ac-eq span:nth-child(3) { height: 20px; animation-delay: -.5s; }
.vp-ac-eq span:nth-child(4) { height: 12px; animation-delay: -.2s; }
.vp-ac-eq span:nth-child(5) { height: 16px; animation-delay: -.6s; }
.vp-ac-eq span:nth-child(6) { height: 22px; animation-delay: -.4s; }
.vp-ac-eq span:nth-child(7) { height: 10px; animation-delay: -.1s; }
.vp-ac-eq span:nth-child(8) { height: 18px; animation-delay: -.7s; }
.vp-ac-state-hold .vp-ac-eq span,
.vp-ac-state-hold .vp-ac-timer {
  animation-play-state: paused;
  opacity: .5;
}

.vp-ac-ctrls { display: inline-flex; gap: 4px; }
.vp-ac-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  font-size: 13px;
  display: grid; place-items: center;
  transition: .15s;
}
.vp-ac-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.vp-ac-btn-warn { color: #b45309; }
.vp-ac-btn-danger { color: #b91c1c; }
.vp-ac-btn-danger:hover { background: rgba(239,68,68,.10); }

.vp-ac-ai {
  margin-top: 10px;
  padding: 7px 12px 7px 7px;
  background:
    linear-gradient(135deg, rgba(111,185,143,.12), rgba(125,159,245,.10)),
    linear-gradient(90deg, rgba(111,185,143,.06), transparent 70%);
  border-radius: 999px;
  font-size: 11.5px;
  border: 1px solid rgba(111,185,143,.22);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.vp-ac-ai-topic {
  color: #004445;
  font-weight: 600;
  flex-shrink: 0;
}
.vp-ac-ai-note { color: var(--text-muted); flex: 1; min-width: 0; line-height: 1.6; }
[data-theme="dark"] .vp-ac-ai {
  background:
    linear-gradient(135deg, rgba(111,185,143,.16), rgba(125,159,245,.12)),
    linear-gradient(90deg, rgba(111,185,143,.10), transparent 70%);
  border-color: rgba(111,185,143,.35);
}
[data-theme="dark"] .vp-ac-ai-topic { color: #6fb98f; }

/* ===== STATUS GRID ===== */
.vp-status-legend { display: inline-flex; gap: 12px; flex-wrap: wrap; }
.vp-legend {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted);
}
.vp-legend b { color: var(--text); font-weight: 700; font-family: ui-monospace, monospace; margin-inline-start: 3px; }
.vp-leg-dot { width: 8px; height: 8px; border-radius: 50%; }
.vp-leg-ready   { background: #10b981; box-shadow: 0 0 0 2px rgba(16,185,129,.20); }
.vp-leg-busy    { background: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,.20); }
.vp-leg-break   { background: #f59e0b; box-shadow: 0 0 0 2px rgba(245,158,11,.20); }
.vp-leg-offline { background: #94a3b8; box-shadow: 0 0 0 2px rgba(148,163,184,.20); }

.vp-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.vp-st-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  position: relative;
  overflow: hidden;
  animation: vpRowSlide .42s cubic-bezier(.25,.8,.3,1) both;
  animation-delay: calc(var(--vp-i,0) * 28ms);
}
.vp-st-card::before {
  content: ''; position: absolute; top: 0; inset-inline-start: 0; inset-inline-end: 0;
  height: 3px; opacity: .85;
}
.vp-st-ready::before    { background: linear-gradient(90deg, #10b981, #14b8a6); }
.vp-st-busy::before     { background: linear-gradient(90deg, #ef4444, #f59e0b); }
.vp-st-break::before    { background: linear-gradient(90deg, #f59e0b, #fcd34d); }
.vp-st-offline::before  { background: linear-gradient(90deg, #94a3b8, #64748b); }
.vp-st-offline { opacity: .68; }

.vp-st-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.vp-st-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px; color: #fff;
  background: var(--vp-c, #2c7873);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.18);
  flex-shrink: 0;
}
.vp-st-info { flex: 1; min-width: 0; }
.vp-st-name { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vp-st-ext { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.vp-st-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
}
.vp-st-pill-dot { width: 6px; height: 6px; border-radius: 50%; }
.vp-st-pill-ready   { background: rgba(16,185,129,.12);  color: #047857; }
.vp-st-pill-ready   .vp-st-pill-dot { background: #10b981; animation: vpDotPulse 1.6s ease-out infinite; }
.vp-st-pill-busy    { background: rgba(239,68,68,.12);   color: #b91c1c; }
.vp-st-pill-busy    .vp-st-pill-dot { background: #ef4444; }
.vp-st-pill-break   { background: rgba(245,158,11,.14);  color: #b45309; }
.vp-st-pill-break   .vp-st-pill-dot { background: #f59e0b; }
.vp-st-pill-offline { background: rgba(148,163,184,.18); color: #475569; }
.vp-st-pill-offline .vp-st-pill-dot { background: #94a3b8; }
[data-theme="dark"] .vp-st-pill-ready   { color: #6ee7b7; }
[data-theme="dark"] .vp-st-pill-busy    { color: #fca5a5; }
[data-theme="dark"] .vp-st-pill-break   { color: #fcd34d; }
[data-theme="dark"] .vp-st-pill-offline { color: #cbd5e1; }

.vp-st-current, .vp-st-ready, .vp-st-break, .vp-st-offline {
  font-size: 11.5px;
  padding: 7px 10px;
  border-radius: 9px;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.vp-st-current {
  background: rgba(239,68,68,.06);
  border: 1px dashed rgba(239,68,68,.25);
}
.vp-st-current-label { color: #b91c1c; font-weight: 600; }
.vp-st-current-name { color: var(--text); font-weight: 700; }
.vp-st-current-time { margin-inline-start: auto; font-family: ui-monospace, monospace; color: var(--text); font-weight: 700; }
[data-theme="dark"] .vp-st-current-label { color: #fca5a5; }
.vp-st-ready    { background: rgba(16,185,129,.06);  border: 1px dashed rgba(16,185,129,.25);  color: #047857; }
.vp-st-break    { background: rgba(245,158,11,.07);  border: 1px dashed rgba(245,158,11,.25);  color: #b45309; }
.vp-st-offline  { background: var(--surface);         border: 1px dashed var(--border);         color: var(--text-muted); }
[data-theme="dark"] .vp-st-ready { color: #6ee7b7; }
[data-theme="dark"] .vp-st-break { color: #fcd34d; }

.vp-st-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  margin-bottom: 10px;
}
.vp-st-stat {
  text-align: center;
  padding: 6px 4px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.vp-st-stat-v { display: block; font-weight: 700; font-size: 13px; font-family: ui-monospace, monospace; color: var(--text); }
.vp-st-stat-l { display: block; font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.vp-st-stat-warn .vp-st-stat-v { color: #b91c1c; }
[data-theme="dark"] .vp-st-stat-warn .vp-st-stat-v { color: #fca5a5; }

.vp-st-perf {
  display: flex; align-items: center; gap: 8px;
}
.vp-st-perf-bar {
  flex: 1; height: 6px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}
.vp-st-perf-bar span {
  display: block; height: 100%;
  background: linear-gradient(90deg, #10b981, #14b8a6);
  border-radius: 999px;
}
.vp-st-perf-lbl { font-size: 11px; color: var(--text-muted); font-weight: 600; }

/* ===== NUMBERS TABLE ===== */
.vp-num-toolbar { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.vp-num-search, .vp-num-filter {
  padding: 7px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text);
}
.vp-num-search { min-width: 220px; }
.vp-num-search:focus, .vp-num-filter:focus {
  outline: none;
  border-color: var(--brand-300);
  box-shadow: 0 0 0 3px rgba(44,120,115,.15);
}

.vp-num-wrap {
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.vp-num-table {
  width: 100%; border-collapse: collapse;
  font-size: 12.5px;
}
.vp-num-table thead {
  background: var(--surface-2);
}
.vp-num-table th {
  text-align: start;
  padding: 10px 12px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  letter-spacing: -.01em;
}
.vp-num-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.vp-num-row {
  background: var(--surface);
  transition: .12s;
  animation: vpRowSlide .35s ease-out both;
  animation-delay: calc(var(--vp-i, 0) * 18ms);
}
.vp-num-row:hover { background: var(--surface-2); }
.vp-num-row:last-child td { border-bottom: none; }
.vp-num-row-active { background: linear-gradient(90deg, rgba(16,185,129,.06), transparent 40%); }
.vp-num-row-queued { background: linear-gradient(90deg, rgba(245,158,11,.06), transparent 40%); }
.vp-num-row-missed { background: linear-gradient(90deg, rgba(239,68,68,.06), transparent 40%); }

.vp-num-time { font-family: ui-monospace, monospace; color: var(--text-muted); font-size: 12px; }
.vp-num-phone { font-family: ui-monospace, monospace; font-weight: 600; }
.vp-num-name { font-weight: 700; font-size: 12.5px; margin-bottom: 3px; }
.vp-num-dur { font-family: ui-monospace, monospace; color: var(--text-muted); }
.vp-num-tag { color: var(--text-muted); font-size: 12px; }
.vp-num-adv { font-weight: 600; }

.vp-num-stchip {
  display: inline-flex; align-items: center;
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  font-weight: 700;
}
.vp-stchip-active   { background: rgba(16,185,129,.12); color: #047857; }
.vp-stchip-queued   { background: rgba(245,158,11,.14); color: #b45309; }
.vp-stchip-missed   { background: rgba(239,68,68,.12);  color: #b91c1c; }
.vp-stchip-answered { background: rgba(99,102,241,.12); color: #4338ca; }
.vp-stchip-callback { background: rgba(168,85,247,.14); color: #6d28d9; }
[data-theme="dark"] .vp-stchip-active   { color: #6ee7b7; }
[data-theme="dark"] .vp-stchip-queued   { color: #fcd34d; }
[data-theme="dark"] .vp-stchip-missed   { color: #fca5a5; }
[data-theme="dark"] .vp-stchip-answered { color: #c7d2fe; }
[data-theme="dark"] .vp-stchip-callback { color: #c4b5fd; }

.vp-num-btn {
  font-size: 11.5px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  font-weight: 600;
  color: var(--text);
  transition: .15s;
}
.vp-num-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.vp-num-btn-primary {
  background: linear-gradient(135deg, #10b981, #14b8a6);
  color: #fff; border-color: transparent;
}
.vp-num-btn-warn {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff; border-color: transparent;
}
.vp-num-btn-ghost { background: transparent; color: var(--text-muted); }

.vp-num-foot {
  padding: 10px 4px 0;
  font-size: 12px;
  color: var(--text-muted);
}
.vp-num-foot b { color: var(--text); font-weight: 700; }

.vp-empty {
  text-align: center; padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--surface-2);
  border-radius: 12px;
}

/* ----- Dark theme tweaks ----- */
[data-theme="dark"] .vp-q-row,
[data-theme="dark"] .vp-ac-card,
[data-theme="dark"] .vp-st-card { background: var(--surface); }
[data-theme="dark"] .vp-q-row:hover,
[data-theme="dark"] .vp-num-row:hover { background: var(--surface-2); }
[data-theme="dark"] .vp-q-rank { background: var(--surface-2); border-color: var(--border); }
[data-theme="dark"] .vp-ac-tag { background: var(--surface-2); }

/* ===== TRANSCRIPT — inline trigger button + popup modal with typing ===== */

/* Trigger button on active card */
.vp-ac-trans-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
  padding: 9px 12px;
  background: linear-gradient(135deg, rgba(125,159,245,.10), rgba(111,185,143,.10));
  border: 1px dashed rgba(111,185,143,.32);
  border-radius: 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: .15s;
}
.vp-ac-trans-btn:hover {
  background: linear-gradient(135deg, rgba(125,159,245,.18), rgba(111,185,143,.18));
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: rgba(111,185,143,.55);
}
.vp-ac-trans-btn-label { color: var(--text); }
.vp-ac-trans-btn-count {
  margin-inline-start: auto;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 8px;
  background: var(--surface);
  border-radius: 999px;
}
.vp-ac-trans-btn-chev {
  color: var(--brand-500);
  font-weight: 800;
  font-size: 14px;
  transition: transform .2s ease;
}
.vp-ac-trans-btn:hover .vp-ac-trans-btn-chev { transform: translateX(-3px); }
.vp-trans-live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(239,68,68,.6);
  animation: vpDotPulse 1.4s ease-out infinite;
}

/* ===== Modal overlay + card ===== */
/* lock body + html scroll while modal open so only inner transcript scrolls */
html.vp-tm-lock,
body.vp-tm-lock { overflow: hidden !important; }
/* override legacy .call-transcript constraints inside modal so only .vp-tm-body scrolls */
#vp-tm-body .call-transcript,
.vp-tm-list {
  max-height: none !important;
  overflow: visible !important;
}
.vp-tm-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(6px) saturate(140%);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
  animation: none !important; /* exempt from .content > * slideUpLg */
}
.vp-tm-overlay[data-tm-open="1"] {
  opacity: 1;
  pointer-events: auto;
}
.vp-tm-card {
  width: min(780px, 96vw);
  max-height: min(82vh, 760px);
  background: var(--surface);
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px -12px rgba(15, 23, 42, .42);
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(.96);
  transition: transform .35s cubic-bezier(.2,.7,.3,1.15);
}
.vp-tm-overlay[data-tm-open="1"] .vp-tm-card {
  transform: translateY(0) scale(1);
}

/* Modal header */
.vp-tm-head {
  padding: 24px 22px 18px;
  background: linear-gradient(155deg, #9b7bf5 0%, #3d2a70 115%);
  position: relative; overflow: hidden; isolation: isolate;
  /* [crm-l1-menu-p1] UX audit fix — .vp-tm-card is a column flex container
     and .vp-tm-body has flex:1. Per the flexbox spec, a flex item with
     overflow other than 'visible' gets an automatic min-height of 0 (not
     its content size) for shrink purposes — so without flex-shrink:0 this
     header silently collapsed to ~84px (just the top avatar row) whenever
     the card's max-height was tight, clipping the whole meta badge row
     (tag/sentiment/state/timer) and the AI-summary strip below it via its
     own overflow:hidden, almost invisibly (found live via scrollHeight 233
     vs offsetHeight 84 on a real modal instance). */
  flex-shrink: 0;
}
.vp-tm-head::before, .vp-tm-head::after {
  content: ''; position: absolute; border-radius: 50%; background: #fff; filter: blur(26px); pointer-events: none; z-index: -1;
}
.vp-tm-head::before { width: 150px; height: 150px; top: -65px; inset-inline-start: -40px; opacity: .15; }
.vp-tm-head::after { width: 100px; height: 100px; bottom: -50px; inset-inline-end: 70px; opacity: .12; }
.vp-tm-head .vp-tm-side-name, .vp-tm-head .vp-tm-side-sub { color: #fff; }
.vp-tm-head .vp-tm-side-sub { color: rgba(255,255,255,.78); }
.vp-tm-head .vp-tm-tag { background: rgba(255,255,255,.16); border-color: transparent; color: #fff; backdrop-filter: blur(4px); }
/* [crm-l1-menu-p1] UX audit fix — .vp-tm-sent-* and .vp-tm-state only had a
   light-tint/dark-text palette (meant for a plain --surface background); on
   this header's purple gradient that reads as barely-legible dark text on a
   near-transparent tint. Same header-scoped override pattern as .vp-tm-tag
   just above — opaque translucent white background + solid #fff text. */
.vp-tm-head .vp-tm-sent-positive,
.vp-tm-head .vp-tm-sent-neutral,
.vp-tm-head .vp-tm-sent-negative,
.vp-tm-head .vp-tm-state { background: rgba(255,255,255,.16); color: #fff; backdrop-filter: blur(4px); }
.vp-tm-head .vp-tm-state.is-hold { background: rgba(255,255,255,.24); }
.vp-tm-pair {
  display: grid;
  grid-template-columns: 1fr 60px 1fr auto;
  align-items: center;
  gap: 10px;
}
.vp-tm-side {
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
}
.vp-tm-side-customer { justify-content: flex-end; }
.vp-tm-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
  color: #fff;
  background: var(--vp-c, #2c7873);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.22), 0 4px 12px rgba(15,23,42,.10);
  flex-shrink: 0;
}
.vp-tm-avatar-cust { background: linear-gradient(135deg, #10b981, #14b8a6); }
.vp-tm-avatar-cust[data-iden="lead"]    { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.vp-tm-avatar-cust[data-iden="student"] { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.vp-tm-avatar-cust[data-iden="unknown"] { background: linear-gradient(135deg, #94a3b8, #64748b); }
.vp-tm-side-info { min-width: 0; }
.vp-tm-side-info-right { text-align: end; }
.vp-tm-side-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vp-tm-side-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-family: ui-monospace, monospace; }
.vp-tm-link {
  display: flex; justify-content: center; align-items: center; gap: 4px;
}
.vp-tm-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  color: var(--text-muted);
  display: grid; place-items: center;
  transition: .15s;
}
.vp-tm-close:hover { background: rgba(239,68,68,.10); color: #b91c1c; border-color: rgba(239,68,68,.25); transform: rotate(90deg); }

.vp-tm-meta {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-top: 12px;
  font-size: 11.5px;
}
.vp-tm-tag {
  padding: 3px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-muted);
}
.vp-tm-sent {
  padding: 3px 10px; border-radius: 999px;
  font-weight: 600;
}
.vp-tm-sent-positive { background: rgba(16,185,129,.10);  color: #047857; }
.vp-tm-sent-neutral  { background: rgba(99,102,241,.10);  color: #4338ca; }
.vp-tm-sent-negative { background: rgba(239,68,68,.10);   color: #b91c1c; }
.vp-tm-state {
  padding: 3px 10px; border-radius: 999px;
  background: rgba(16,185,129,.10); color: #047857; font-weight: 600;
}
.vp-tm-state.is-hold { background: rgba(245,158,11,.14); color: #b45309; }
.vp-tm-timer {
  margin-inline-start: auto;
  font-size: 17px; font-weight: 800;
  font-family: ui-monospace, monospace;
  background: linear-gradient(135deg, #2c7873, #6fb98f);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

.vp-tm-summary {
  margin-top: 14px;
  margin-bottom: -4px;
}

/* Modal body (scrollable transcript) */
.vp-tm-body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 8px;
  scroll-behavior: smooth;
}
.vp-tm-list {
  display: flex; flex-direction: column; gap: 8px;
}
.vp-tm-body::-webkit-scrollbar { width: 8px; }
.vp-tm-body::-webkit-scrollbar-track { background: transparent; }
.vp-tm-body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--brand-200), var(--brand-300));
  border-radius: 4px;
}
.vp-tm-body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--brand-300), var(--brand-500));
}

/* Typing caret on text being typed */
.msg-text.is-typing::after {
  content: '▌';
  display: inline-block;
  margin-inline-start: 1px;
  color: var(--brand-500);
  font-weight: 200;
  font-size: 1em;
  animation: vpCaretBlink .8s steps(2, jump-none) infinite;
}
@keyframes vpCaretBlink { 50% { opacity: 0; } }

/* Modal footer */
.vp-tm-foot {
  padding: 10px 22px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
  font-size: 11.5px;
  background: var(--surface-2);
}
.vp-tm-foot-live {
  display: inline-flex; align-items: center; gap: 6px;
  color: #b91c1c;
  font-weight: 700;
  font-size: 11px;
}
.vp-tm-foot-counter {
  font-family: ui-monospace, monospace;
  color: var(--text-muted);
  padding: 3px 10px;
  background: var(--surface);
  border-radius: 999px;
  border: 1px solid var(--border);
}
.vp-tm-foot-typing {
  display: none;
  align-items: center; gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.vp-tm-foot-typing .vp-trans-typing-name { font-weight: 700; color: var(--text); }
.vp-trans-typing-dots {
  display: inline-flex; gap: 3px;
}
.vp-trans-typing-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--brand-300);
  animation: vpTypingPulse 1.1s ease-in-out infinite;
}
.vp-trans-typing-dots span:nth-child(2) { animation-delay: .15s; }
.vp-trans-typing-dots span:nth-child(3) { animation-delay: .30s; }
@keyframes vpTypingPulse {
  0%, 80%, 100% { transform: scale(.4); opacity: .35; }
  40%           { transform: scale(1);  opacity: 1; }
}
.vp-trans-typing-label { color: var(--text-faint); }
.vp-tm-foot-btn {
  margin-inline-start: auto;
  padding: 5px 12px;
  background: linear-gradient(135deg, rgba(125,159,245,.14), rgba(111,185,143,.18));
  border: 1px solid rgba(111,185,143,.30);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: #6d28d9;
  font-family: inherit;
  transition: .15s;
}
.vp-tm-foot-btn:hover { transform: translateY(-1px); background: linear-gradient(135deg, rgba(125,159,245,.22), rgba(111,185,143,.28)); }
[data-theme="dark"] .vp-tm-foot-btn { color: #c4b5fd; }

@media (max-width: 720px) {
  .vp-tm-card { width: 100vw; max-height: 100vh; border-radius: 0; }
  .vp-tm-pair { grid-template-columns: 1fr auto; grid-template-areas: "advisor close" "customer customer"; }
  .vp-tm-side-advisor { grid-area: advisor; }
  .vp-tm-side-customer { grid-area: customer; justify-content: flex-start; }
  .vp-tm-close { grid-area: close; }
  .vp-tm-link { display: none; }
}

/* ----- Responsive ----- */
@media (max-width: 920px) {
  .vp-hero { padding: 22px 18px 0; }
  .vp-hero-top { grid-template-columns: 1fr; }
  .vp-hero-right { height: 110px; }
  .vp-q-row {
    grid-template-columns: 32px 1fr auto;
    grid-template-areas:
      "rank id prio"
      "tag tag tag"
      "wait wait actions";
    gap: 8px;
  }
  .vp-q-rank { grid-area: rank; }
  .vp-q-id { grid-area: id; }
  .vp-q-prio { grid-area: prio; }
  .vp-q-tag-col { grid-area: tag; flex-direction: row; gap: 8px; flex-wrap: wrap; }
  .vp-q-wait { grid-area: wait; }
  .vp-q-actions { grid-area: actions; justify-content: flex-end; }
  .vp-ac-bridge { grid-template-columns: 1fr 40px 1fr; }
}

/* =========================================================================
   REPORTS — Category-aware report dashboards (rpt-* namespace)
   #reports overview + #reports/{education|sales|comms|finance|team}
   ========================================================================= */

.rpt-page {
  --rpt-accent: #a020f0;
  --rpt-accent-soft: color-mix(in srgb, var(--rpt-accent) 16%, transparent);
  --rpt-accent-glow: color-mix(in srgb, var(--rpt-accent) 28%, transparent);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ===== HERO ===== */
.rpt-hero {
  position: relative;
  border-radius: 22px;
  padding: 24px 28px 0;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--rpt-accent) 8%, var(--bg-card, #fff)) 0%,
    var(--bg-card, #fff) 60%);
  border: 1px solid color-mix(in srgb, var(--rpt-accent) 16%, var(--border, #e7e9ee));
  overflow: hidden;
  box-shadow: 0 14px 40px -28px var(--rpt-accent-glow);
  isolation: isolate;
}
.rpt-hero-bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.rpt-hero-glow {
  position: absolute;
  top: -120px; right: -120px;
  width: 360px; height: 360px;
  background: radial-gradient(circle, var(--rpt-accent-soft) 0%, transparent 70%);
  filter: blur(20px);
  animation: rptHeroGlow 8s ease-in-out infinite;
}
.rpt-hero-orb {
  position: absolute;
  border-radius: 50%;
  background: var(--rpt-accent);
  opacity: 0.4;
  filter: blur(8px);
  animation: rptHeroOrbFloat 6s ease-in-out infinite;
}
.rpt-hero-orb-1 { width: 22px; height: 22px; top: 22%; left: 12%; animation-delay: 0s;   }
.rpt-hero-orb-2 { width: 16px; height: 16px; top: 60%; left: 32%; animation-delay: 1.5s; }
.rpt-hero-orb-3 { width: 12px; height: 12px; top: 40%; left: 88%; animation-delay: 3s;   }
@keyframes rptHeroGlow {
  0%, 100% { transform: scale(1) translate(0, 0); opacity: 0.7; }
  50%      { transform: scale(1.25) translate(-20px, 20px); opacity: 1; }
}
@keyframes rptHeroOrbFloat {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(-12px, -16px); }
}

.rpt-hero-body {
  position: relative;
  display: grid;
  grid-template-columns: 88px 1fr auto;
  align-items: center;
  gap: 22px;
}
.rpt-hero-icon {
  width: 76px; height: 76px;
  display: grid; place-items: center;
  font-size: 38px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--rpt-accent) 0%, color-mix(in srgb, var(--rpt-accent) 60%, #fff) 100%);
  color: #fff;
  box-shadow: 0 12px 30px -10px var(--rpt-accent-glow);
  animation: rptHeroIconPop 0.7s cubic-bezier(.34,1.6,.64,1) both;
}
@keyframes rptHeroIconPop {
  0%   { transform: scale(0.5) rotate(-12deg); opacity: 0; }
  100% { transform: scale(1)   rotate(0); opacity: 1; }
}

.rpt-hero-text { min-width: 0; }
.rpt-hero-eyebrow { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.rpt-hero-chip {
  font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
  background: var(--rpt-accent-soft);
  color: var(--rpt-accent);
  letter-spacing: 0.4px;
}
.rpt-hero-date { font-size: 12px; color: var(--text-muted, #888); }
.rpt-hero-title {
  font-size: 28px; font-weight: 800;
  margin: 0 0 4px; color: var(--text, #1a1f2e);
  background: linear-gradient(120deg, var(--rpt-accent), color-mix(in srgb, var(--rpt-accent) 50%, #1a1f2e));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: rptHeroSlide 0.6s ease-out both;
}
.rpt-hero-sub { font-size: 14px; color: var(--text-muted, #6b7280); margin: 0; }
@keyframes rptHeroSlide {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

.rpt-hero-cta { display: flex; gap: 10px; }
.rpt-btn {
  height: 38px; padding: 0 16px;
  border-radius: 11px;
  font-size: 13px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
  transition: all 0.18s ease;
  display: inline-flex; align-items: center; gap: 6px;
}
.rpt-btn-primary {
  background: var(--rpt-accent);
  color: #fff;
  box-shadow: 0 6px 20px -8px var(--rpt-accent-glow);
}
.rpt-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -8px var(--rpt-accent-glow); }
.rpt-btn-ghost {
  background: transparent;
  color: var(--rpt-accent);
  border-color: color-mix(in srgb, var(--rpt-accent) 32%, transparent);
}
.rpt-btn-ghost:hover { background: var(--rpt-accent-soft); }
.rpt-btn.is-done { background: var(--green-500, #22c55e); color: #fff; border-color: transparent; }

.rpt-hero-periods {
  display: flex; gap: 8px;
  padding: 16px 0 20px;
  border-top: 1px dashed color-mix(in srgb, var(--rpt-accent) 16%, var(--border, #e7e9ee));
  margin-top: 22px;
  position: relative;
}
.rpt-period {
  height: 34px; padding: 0 18px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  background: transparent;
  color: var(--text-muted, #6b7280);
  border: 1px solid var(--border, #e7e9ee);
  cursor: pointer;
  transition: all 0.18s ease;
}
.rpt-period:hover { color: var(--rpt-accent); border-color: color-mix(in srgb, var(--rpt-accent) 32%, var(--border, #e7e9ee)); }
.rpt-period.active {
  background: var(--rpt-accent);
  color: #fff;
  border-color: var(--rpt-accent);
  box-shadow: 0 4px 14px -4px var(--rpt-accent-glow);
}

/* ===== CATEGORY STRIP (overview only) ===== */
.rpt-cat-strip {
  border-radius: 18px;
  padding: 20px 22px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #e7e9ee);
}
.rpt-cat-strip-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.rpt-cat-strip-title { font-size: 16px; font-weight: 700; color: var(--text, #1a1f2e); }
.rpt-cat-strip-hint { font-size: 12px; color: var(--text-muted, #888); }

.rpt-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.rpt-cat-card {
  --rpt-cat-accent: #2c7be5;
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--rpt-cat-accent) 6%, var(--bg-card, #fff)) 0%,
    var(--bg-card, #fff) 70%);
  border: 1px solid color-mix(in srgb, var(--rpt-cat-accent) 18%, var(--border, #e7e9ee));
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  position: relative;
  overflow: hidden;
}
.rpt-cat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--rpt-cat-accent);
  opacity: 0.8;
}
.rpt-cat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px -16px color-mix(in srgb, var(--rpt-cat-accent) 40%, transparent);
}
.rpt-cat-head { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; }
.rpt-cat-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 24px;
  background: color-mix(in srgb, var(--rpt-cat-accent) 14%, transparent);
}
.rpt-cat-meta { min-width: 0; }
.rpt-cat-title { font-size: 14px; font-weight: 700; color: var(--text, #1a1f2e); margin-bottom: 2px; }
.rpt-cat-sub   { font-size: 11px; color: var(--text-muted, #6b7280); line-height: 1.5; }
.rpt-cat-arrow {
  font-size: 18px; color: var(--rpt-cat-accent);
  transition: transform 0.18s ease;
}
.rpt-cat-card:hover .rpt-cat-arrow { transform: translateX(-4px); }
.rpt-cat-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  padding: 10px;
  background: color-mix(in srgb, var(--rpt-cat-accent) 5%, transparent);
  border-radius: 10px;
}
.rpt-cat-stat { text-align: center; }
.rpt-cat-stat-val { font-size: 14px; font-weight: 700; color: var(--rpt-cat-accent); margin-bottom: 2px; }
.rpt-cat-stat-lab { font-size: 10px; color: var(--text-muted, #888); }
.rpt-cat-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 4px;
}
.rpt-cat-count { font-size: 11px; color: var(--text-muted, #888); }
.rpt-cat-cta { font-size: 12px; font-weight: 700; color: var(--rpt-cat-accent); }

/* ===== KPI GRID ===== */
.rpt-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.rpt-kpi {
  --rpt-kpi-i: 0;
  --rpt-kpi-color: #2c7be5;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #e7e9ee);
  border-radius: 14px;
  padding: 14px 14px 12px;
  display: flex; flex-direction: column; gap: 6px;
  position: relative;
  overflow: hidden;
  animation: rptKpiRise 0.5s cubic-bezier(.34,1.5,.64,1) both;
  animation-delay: calc(var(--rpt-kpi-i) * 50ms);
}
.rpt-kpi::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--rpt-kpi-color);
}
.rpt-kpi.tone-blue   { --rpt-kpi-color: #2c7be5; }
.rpt-kpi.tone-green  { --rpt-kpi-color: #22c55e; }
.rpt-kpi.tone-amber  { --rpt-kpi-color: #f59e0b; }
.rpt-kpi.tone-red    { --rpt-kpi-color: #ef4444; }
.rpt-kpi.tone-purple { --rpt-kpi-color: #a855f7; }
.rpt-kpi.tone-rose   { --rpt-kpi-color: #ef4444; }
@keyframes rptKpiRise {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.rpt-kpi-lab { font-size: 11px; color: var(--text-muted, #6b7280); font-weight: 500; }
.rpt-kpi-val { font-size: 22px; font-weight: 800; color: var(--text, #1a1f2e); line-height: 1; }
.rpt-kpi-delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; color: var(--text-muted, #888);
  margin-top: 2px;
}
.rpt-kpi-trend-up   { color: #22c55e; }
.rpt-kpi-trend-down { color: #ef4444; }
.rpt-kpi-trend-flat { color: var(--text-muted, #888); }
.rpt-kpi-arrow { font-size: 9px; }

/* ===== NARRATIVE + side ===== */
.rpt-narrative-wrap {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(280px, 1fr);
  gap: 18px;
}
.rpt-narrative {
  position: relative;
  padding: 22px 24px;
  border: 1px solid color-mix(in srgb, var(--rpt-accent) 14%, var(--border, #e7e9ee));
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--rpt-accent) 4%, var(--bg-card, #fff)) 0%,
    var(--bg-card, #fff) 50%);
}
.rpt-narrative-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.rpt-narrative-badge {
  font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
  background: linear-gradient(135deg, var(--rpt-accent) 0%, color-mix(in srgb, var(--rpt-accent) 70%, #2c7be5) 100%);
  color: #fff;
  box-shadow: 0 4px 10px -3px var(--rpt-accent-glow);
}
.rpt-narrative-title { font-size: 18px; font-weight: 700; color: var(--text, #1a1f2e); margin: 0; flex: 1; min-width: 200px; }
.rpt-narrative-meta { font-size: 11px; color: var(--text-muted, #888); }
.rpt-narrative-body { font-size: 14px; line-height: 1.85; color: var(--text, #333); }
.rpt-narrative-body p { margin: 0 0 12px; }
.rpt-narrative-body strong { color: var(--rpt-accent); font-weight: 700; }

.rpt-narrative-side { display: flex; flex-direction: column; gap: 14px; }
.rpt-side-head {
  font-size: 12px; font-weight: 700; color: var(--text, #1a1f2e);
  text-transform: none;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border, #e7e9ee);
}
.rpt-side-stats { padding: 16px; }
.rpt-side-stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.rpt-side-stat {
  --rpt-side-color: #2c7be5;
  padding: 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--rpt-side-color) 8%, transparent);
  border-inline-start: 3px solid var(--rpt-side-color);
}
.rpt-side-stat.tone-blue   { --rpt-side-color: #2c7be5; }
.rpt-side-stat.tone-green  { --rpt-side-color: #22c55e; }
.rpt-side-stat.tone-amber  { --rpt-side-color: #f59e0b; }
.rpt-side-stat.tone-red    { --rpt-side-color: #ef4444; }
.rpt-side-stat.tone-purple { --rpt-side-color: #a855f7; }
.rpt-side-stat-lab { font-size: 10px; color: var(--text-muted, #888); margin-bottom: 4px; }
.rpt-side-stat-val { font-size: 16px; font-weight: 700; color: var(--rpt-side-color); }

.rpt-side-actions { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.rpt-side-action {
  height: 38px; padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border, #e7e9ee);
  background: transparent;
  color: var(--text, #333);
  font-size: 13px; font-weight: 500;
  text-align: start;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex; align-items: center; gap: 8px;
}
.rpt-side-action:hover {
  background: var(--rpt-accent-soft);
  border-color: color-mix(in srgb, var(--rpt-accent) 28%, transparent);
  color: var(--rpt-accent);
}

/* ===== CHARTS ===== */
.rpt-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
}
.rpt-chart-card { padding: 16px 16px 12px; min-height: 260px; display: flex; flex-direction: column; }
.rpt-chart-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border, #e7e9ee);
}
.rpt-chart-title { font-size: 13px; font-weight: 700; color: var(--text, #1a1f2e); }
.rpt-chart-actions { display: flex; gap: 6px; }
.rpt-chip-mini {
  font-size: 10px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  background: var(--bg-soft, #f3f5f9); border: none;
  color: var(--text-muted, #6b7280);
  cursor: pointer; transition: all 0.18s ease;
}
.rpt-chip-mini:hover { background: var(--rpt-accent-soft); color: var(--rpt-accent); }
.rpt-chart-card canvas { flex: 1; max-height: 220px; }

/* ===== TOP rows table ===== */
.rpt-top { padding: 18px 20px 16px; }
.rpt-top-table thead th {
  font-size: 11px; font-weight: 700;
  text-transform: none;
  color: var(--text-muted, #6b7280);
  padding: 10px 12px;
  border-bottom: 2px solid var(--border, #e7e9ee);
}
.rpt-top-table tbody tr {
  --rpt-row-i: 0;
  animation: rptRowSlide 0.4s ease both;
  animation-delay: calc(var(--rpt-row-i) * 40ms);
  transition: background 0.15s ease;
}
.rpt-top-table tbody tr:hover { background: var(--rpt-accent-soft); }
.rpt-top-table tbody td { padding: 12px; font-size: 13px; border-bottom: 1px solid var(--border, #e7e9ee); }
@keyframes rptRowSlide {
  from { transform: translateY(4px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ===== GENERATORS ===== */
.rpt-gen-card { padding: 18px 20px 22px; }
.rpt-gen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.rpt-gen-card-item {
  --rpt-gen-i: 0;
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border, #e7e9ee);
  background: var(--bg-card, #fff);
  transition: all 0.18s ease;
  animation: rptKpiRise 0.45s ease both;
  animation-delay: calc(var(--rpt-gen-i) * 60ms);
}
.rpt-gen-card-item:hover {
  border-color: color-mix(in srgb, var(--rpt-accent) 28%, var(--border, #e7e9ee));
  box-shadow: 0 10px 24px -16px var(--rpt-accent-glow);
}
.rpt-gen-item-head { display: flex; align-items: center; gap: 8px; }
.rpt-gen-item-icon {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  font-size: 14px;
  border-radius: 8px;
  background: var(--rpt-accent-soft);
  color: var(--rpt-accent);
}
.rpt-gen-item-title { font-size: 14px; font-weight: 700; color: var(--text, #1a1f2e); }
.rpt-gen-item-desc {
  font-size: 12px; color: var(--text-muted, #6b7280); line-height: 1.6;
  flex: 1;
  padding-bottom: 4px;
}
.rpt-gen-item-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rpt-gen-btn {
  flex: 1;
  height: 32px; padding: 0 12px;
  border-radius: 9px;
  font-size: 11px; font-weight: 600;
  border: 1px solid var(--border, #e7e9ee);
  background: var(--bg-soft, #f8fafc);
  color: var(--text, #333);
  cursor: pointer;
  transition: all 0.15s ease;
}
.rpt-gen-btn:hover { transform: translateY(-1px); }
.rpt-gen-btn-excel:hover { background: #22c55e; color: #fff; border-color: #22c55e; }
.rpt-gen-btn-pdf:hover   { background: #ef4444; color: #fff; border-color: #ef4444; }
.rpt-gen-btn-chart:hover { background: var(--rpt-accent); color: #fff; border-color: var(--rpt-accent); }
.rpt-gen-btn.is-loading { background: var(--rpt-accent-soft); color: var(--rpt-accent); border-color: transparent; }
.rpt-gen-btn.is-done { background: #22c55e; color: #fff; border-color: transparent; }

/* ===== ARCHIVE ===== */
.rpt-archive { padding: 16px 18px 18px; }
.rpt-archive .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.rpt-archive-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.rpt-arc-chip {
  height: 30px; padding: 0 14px;
  border-radius: 999px;
  background: var(--bg-soft, #f3f5f9);
  border: none;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted, #6b7280);
  cursor: pointer; transition: all 0.15s ease;
}
.rpt-arc-chip:hover { background: var(--rpt-accent-soft); color: var(--rpt-accent); }
.rpt-arc-chip.active { background: var(--rpt-accent); color: #fff; }

.rpt-arc-cat-chip {
  --rpt-arc-color: #2c7be5;
  display: inline-block;
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--rpt-arc-color) 14%, transparent);
  color: var(--rpt-arc-color);
}
.rpt-arc-cat-chip.tone-blue   { --rpt-arc-color: #2c7be5; }
.rpt-arc-cat-chip.tone-green  { --rpt-arc-color: #22c55e; }
.rpt-arc-cat-chip.tone-amber  { --rpt-arc-color: #f59e0b; }
.rpt-arc-cat-chip.tone-red    { --rpt-arc-color: #ef4444; }
.rpt-arc-cat-chip.tone-purple { --rpt-arc-color: #a855f7; }

.rpt-arc-act {
  width: 28px; height: 28px;
  display: inline-grid; place-items: center;
  border-radius: 8px;
  border: 1px solid var(--border, #e7e9ee);
  background: transparent;
  font-size: 13px;
  cursor: pointer;
  margin-inline-end: 4px;
  transition: all 0.15s ease;
}
.rpt-arc-act:hover { background: var(--rpt-accent-soft); border-color: var(--rpt-accent); color: var(--rpt-accent); }
.rpt-archive-empty { text-align: center; padding: 28px; color: var(--text-muted, #888); }

/* ===== DARK THEME ===== */
[data-theme="dark"] .rpt-hero        { background: linear-gradient(135deg, color-mix(in srgb, var(--rpt-accent) 12%, var(--bg-card, #1a1f2e)) 0%, var(--bg-card, #1a1f2e) 60%); }
[data-theme="dark"] .rpt-narrative   { background: linear-gradient(135deg, color-mix(in srgb, var(--rpt-accent) 8%, var(--bg-card, #1a1f2e)) 0%, var(--bg-card, #1a1f2e) 50%); }
[data-theme="dark"] .rpt-cat-card    { background: linear-gradient(135deg, color-mix(in srgb, var(--rpt-cat-accent) 12%, var(--bg-card, #1a1f2e)) 0%, var(--bg-card, #1a1f2e) 70%); }
[data-theme="dark"] .rpt-gen-card-item { background: var(--bg-card, #1a1f2e); }
[data-theme="dark"] .rpt-side-action { background: transparent; color: var(--text, #e7e9ee); border-color: var(--border, #2a2f3e); }
[data-theme="dark"] .rpt-chip-mini   { background: rgba(255,255,255,0.06); color: var(--text-muted, #999); }
[data-theme="dark"] .rpt-arc-chip    { background: rgba(255,255,255,0.06); color: var(--text-muted, #999); }
[data-theme="dark"] .rpt-gen-btn     { background: rgba(255,255,255,0.04); border-color: var(--border, #2a2f3e); color: var(--text, #e7e9ee); }

/* ===== RESPONSIVE ===== */
@media (max-width: 980px) {
  .rpt-hero-body { grid-template-columns: 64px 1fr; }
  .rpt-hero-icon { width: 56px; height: 56px; font-size: 28px; border-radius: 16px; }
  .rpt-hero-title { font-size: 22px; }
  .rpt-hero-cta { grid-column: 1 / -1; }
  .rpt-narrative-wrap { grid-template-columns: 1fr; }
  .rpt-charts { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .rpt-hero { padding: 18px 18px 0; }
  .rpt-hero-periods { gap: 6px; }
  .rpt-period { padding: 0 12px; font-size: 12px; }
  .rpt-cat-grid { grid-template-columns: 1fr; }
  .rpt-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================ */
/* EXAMS & ASSESSMENT (ارزیابی عملکرد) — namespace exm-*       */
/* ============================================================ */
.exm-hero {
  position: relative; padding: 24px 28px; border-radius: 24px; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, #a020f0 16%, var(--card)) 0%, color-mix(in srgb, #22c55e 10%, var(--card)) 100%);
  border: 1px solid color-mix(in srgb, #a020f0 18%, transparent);
  display: grid; grid-template-columns: 1fr 200px; gap: 24px; align-items: center;
  margin-bottom: 18px; animation: exmHeroPop .6s cubic-bezier(.25,.5,.25,1) both;
}
@keyframes exmHeroPop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.exm-hero-bg { position: absolute; inset: 0; background: radial-gradient(circle at 90% 10%, color-mix(in srgb, #a020f0 22%, transparent) 0%, transparent 50%), radial-gradient(circle at 20% 90%, color-mix(in srgb, #22c55e 14%, transparent) 0%, transparent 50%); pointer-events: none; }
.exm-hero-left { position: relative; z-index: 1; }
.exm-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: color-mix(in srgb, #a020f0 14%, var(--card)); border: 1px solid color-mix(in srgb, #a020f0 24%, transparent); font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 14px; }
.exm-chip-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px color-mix(in srgb, #22c55e 24%, transparent); animation: exmDotPulse 1.8s ease-in-out infinite; }
@keyframes exmDotPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
.exm-hero-title { font-size: 26px; font-weight: 800; margin: 0 0 6px; }
.exm-hero-sub { color: var(--text-muted); font-size: 13px; margin: 0 0 16px; }
.exm-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.exm-btn-primary { padding: 8px 18px; border-radius: 10px; border: 0; background: linear-gradient(135deg, #a020f0, #6c3aff); color: #fff; font-weight: 700; cursor: pointer; box-shadow: 0 6px 18px color-mix(in srgb, #a020f0 24%, transparent); transition: transform .15s; }
.exm-btn-primary:hover { transform: translateY(-2px); }
.exm-btn-ghost { padding: 8px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-weight: 600; cursor: pointer; transition: all .15s; }
.exm-btn-ghost:hover { border-color: color-mix(in srgb, #a020f0 32%, var(--border)); background: color-mix(in srgb, #a020f0 8%, var(--card)); }
.exm-btn-sm { padding: 4px 10px; font-size: 12px; }
.exm-hero-orb svg { width: 180px; height: 180px; color: var(--text); animation: exmOrbSpin 22s linear infinite; }
@keyframes exmOrbSpin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

.exm-kpi-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 18px; }
.exm-kpi { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); transition: all .2s; animation: exmKpiRise .5s ease-out both; }
.exm-kpi:nth-child(1) { animation-delay: .04s; } .exm-kpi:nth-child(2) { animation-delay: .08s; } .exm-kpi:nth-child(3) { animation-delay: .12s; }
.exm-kpi:nth-child(4) { animation-delay: .16s; } .exm-kpi:nth-child(5) { animation-delay: .20s; } .exm-kpi:nth-child(6) { animation-delay: .24s; }
@keyframes exmKpiRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.exm-kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 24px color-mix(in srgb, var(--brand) 10%, transparent); }
.exm-kpi-icn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: color-mix(in srgb, var(--brand) 12%, var(--card)); }
.exm-kpi-mint .exm-kpi-icn { background: color-mix(in srgb, #22c55e 16%, var(--card)); color: #16a34a; }
.exm-kpi-sky .exm-kpi-icn { background: color-mix(in srgb, #38bdf8 16%, var(--card)); color: #0ea5e9; }
.exm-kpi-purple .exm-kpi-icn { background: color-mix(in srgb, #a020f0 16%, var(--card)); color: #a020f0; }
.exm-kpi-peach .exm-kpi-icn { background: color-mix(in srgb, #fb923c 16%, var(--card)); color: #f97316; }
.exm-kpi-lilac .exm-kpi-icn { background: color-mix(in srgb, #c084fc 16%, var(--card)); color: #a855f7; }
.exm-kpi-val { font-size: 20px; font-weight: 800; }
.exm-kpi-lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.exm-kpi-delta { font-size: 11px; color: #22c55e; font-weight: 600; margin-top: 2px; }

.exm-band { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; margin-bottom: 18px; }
.exm-live-list { display: flex; flex-direction: column; gap: 10px; }
.exm-live-row { padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: linear-gradient(135deg, color-mix(in srgb, #22c55e 6%, var(--card)) 0%, var(--card) 60%); transition: all .15s; }
.exm-live-row:hover { border-color: color-mix(in srgb, #22c55e 28%, var(--border)); }
.exm-live-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.exm-live-title { display: flex; gap: 10px; align-items: center; min-width: 0; }
.exm-live-dot { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 4px color-mix(in srgb, #ef4444 24%, transparent); animation: exmDotPulse 1.4s ease-in-out infinite; flex: 0 0 auto; }
.exm-live-name { font-weight: 700; font-size: 14px; }
.exm-live-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.exm-live-progress { height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--text) 8%, var(--card)); overflow: hidden; margin-bottom: 8px; }
.exm-live-prog-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #22c55e, #16a34a); transition: width .6s ease; }
.exm-live-foot { display: flex; gap: 12px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.exm-live-foot b { color: var(--text); }
.exm-time-left { padding: 2px 8px; border-radius: 6px; background: color-mix(in srgb, #f59e0b 16%, var(--card)); color: #f59e0b; font-weight: 700; }

.exm-up-list { display: flex; flex-direction: column; gap: 8px; }
.exm-up-row { display: grid; grid-template-columns: 70px 1fr auto; gap: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); align-items: center; }
.exm-up-date { text-align: center; padding: 6px; border-radius: 8px; background: color-mix(in srgb, #a020f0 10%, var(--card)); }
.exm-up-day { font-weight: 800; font-size: 18px; color: #a020f0; }
.exm-up-mon { font-size: 9px; color: var(--text-muted); }
.exm-up-title { font-weight: 700; font-size: 13px; }
.exm-up-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.exm-up-side { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.exm-up-reg { font-size: 11px; color: var(--text-muted); }

.exm-type-chip { display: inline-block; padding: 2px 10px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.exm-type-purple { background: color-mix(in srgb, #a020f0 14%, var(--card)); color: #a020f0; }
.exm-type-sky    { background: color-mix(in srgb, #38bdf8 14%, var(--card)); color: #0ea5e9; }
.exm-type-mint   { background: color-mix(in srgb, #22c55e 14%, var(--card)); color: #16a34a; }
.exm-type-peach  { background: color-mix(in srgb, #fb923c 14%, var(--card)); color: #f97316; }

.exm-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.exm-tab { padding: 6px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s; }
.exm-tab:hover { border-color: color-mix(in srgb, #a020f0 32%, var(--border)); }
.exm-tab.is-active { background: linear-gradient(135deg, #a020f0, #6c3aff); color: #fff; border-color: transparent; }

.exm-table-wrap { overflow-x: auto; }
.exm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.exm-table thead th { padding: 10px 12px; text-align: right; font-size: 11px; color: var(--text-muted); font-weight: 600; border-bottom: 2px solid var(--border); background: color-mix(in srgb, var(--text) 4%, var(--card)); }
.exm-table tbody td { padding: 12px; border-bottom: 1px solid var(--border); }
.exm-table tbody tr:hover { background: color-mix(in srgb, #a020f0 4%, transparent); }
.exm-pass { padding: 3px 10px; border-radius: 6px; font-weight: 700; font-size: 12px; }
.exm-pass-green { background: color-mix(in srgb, #22c55e 14%, var(--card)); color: #16a34a; }
.exm-pass-amber { background: color-mix(in srgb, #f59e0b 14%, var(--card)); color: #f59e0b; }
.exm-pass-red   { background: color-mix(in srgb, #ef4444 14%, var(--card)); color: #ef4444; }

.exm-dist { display: grid; grid-template-columns: repeat(9, 1fr); gap: 8px; height: 220px; align-items: end; padding: 10px 4px; }
.exm-dist-col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.exm-dist-bar { width: 100%; background: linear-gradient(180deg, #a020f0 0%, #6c3aff 100%); border-radius: 6px 6px 0 0; position: relative; min-height: 6%; transition: height .8s cubic-bezier(.25,.5,.25,1); animation: exmDistGrow .8s ease-out both; }
@keyframes exmDistGrow { from { transform: scaleY(0); transform-origin: bottom; } to { transform: scaleY(1); } }
.exm-dist-val { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 700; color: var(--text); }
.exm-dist-lbl { font-size: 10px; color: var(--text-muted); white-space: nowrap; }

.exm-topics { display: flex; flex-direction: column; gap: 14px; padding: 10px 0; }
.exm-topic-row { display: grid; grid-template-columns: 1fr 200px 80px; gap: 12px; align-items: center; }
.exm-topic-name { font-size: 13px; font-weight: 600; }
.exm-topic-bar { position: relative; height: 24px; border-radius: 999px; background: color-mix(in srgb, var(--text) 6%, var(--card)); overflow: hidden; }
.exm-topic-fill { height: 100%; border-radius: 999px; transition: width .8s ease; }
.exm-topic-red   { background: linear-gradient(90deg, #ef4444, #dc2626); }
.exm-topic-amber { background: linear-gradient(90deg, #f59e0b, #d97706); }
.exm-topic-green { background: linear-gradient(90deg, #22c55e, #16a34a); }
.exm-topic-score { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.exm-topic-meta { font-size: 11px; color: var(--text-muted); }

.exm-ai-spark { display: inline-block; color: #a020f0; animation: exmSparkRot 3s ease-in-out infinite; }
@keyframes exmSparkRot { 0%, 100% { transform: rotate(0) scale(1); } 50% { transform: rotate(180deg) scale(1.2); } }
.exm-ai-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.exm-ai-card { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); border-inline-start: 4px solid #a020f0; }
.exm-ai-risk { border-inline-start-color: #ef4444; background: color-mix(in srgb, #ef4444 4%, var(--card)); }
.exm-ai-opportunity { border-inline-start-color: #22c55e; background: color-mix(in srgb, #22c55e 4%, var(--card)); }
.exm-ai-trend { border-inline-start-color: #38bdf8; background: color-mix(in srgb, #38bdf8 4%, var(--card)); }
.exm-ai-title { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.exm-ai-text { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-bottom: 10px; }
.exm-ai-action { padding: 6px 14px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--text); font-weight: 600; font-size: 12px; cursor: pointer; transition: all .15s; }
.exm-ai-action:hover { background: color-mix(in srgb, #a020f0 12%, var(--card)); border-color: #a020f0; }

@media (max-width: 1100px) { .exm-kpi-grid { grid-template-columns: repeat(3, 1fr); } .exm-band { grid-template-columns: 1fr; } .exm-ai-grid { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .exm-hero { grid-template-columns: 1fr; } .exm-hero-right { display: none; } .exm-kpi-grid { grid-template-columns: repeat(2, 1fr); } .exm-topic-row { grid-template-columns: 1fr; } }

/* ============================================================ */
/* CERTIFICATES (مجوزها و تاییدیه‌ها) — namespace crt-*           */
/* ============================================================ */
.crt-hero {
  position: relative; padding: 24px 28px; border-radius: 24px; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, #f59e0b 14%, var(--card)) 0%, color-mix(in srgb, #a020f0 10%, var(--card)) 100%);
  border: 1px solid color-mix(in srgb, #f59e0b 18%, transparent);
  display: grid; grid-template-columns: 1fr 180px; gap: 24px; align-items: center;
  margin-bottom: 18px; animation: exmHeroPop .6s cubic-bezier(.25,.5,.25,1) both;
}
.crt-hero-bg { position: absolute; inset: 0; background: radial-gradient(circle at 85% 15%, color-mix(in srgb, #f59e0b 24%, transparent) 0%, transparent 50%); pointer-events: none; }
.crt-hero-left { position: relative; z-index: 1; }
.crt-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: color-mix(in srgb, #f59e0b 14%, var(--card)); border: 1px solid color-mix(in srgb, #f59e0b 28%, transparent); font-size: 12px; font-weight: 600; margin-bottom: 14px; }
.crt-chip-dot { width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 0 4px color-mix(in srgb, #f59e0b 24%, transparent); animation: exmDotPulse 1.8s ease-in-out infinite; }
.crt-hero-title { font-size: 26px; font-weight: 800; margin: 0 0 6px; }
.crt-hero-sub { color: var(--text-muted); font-size: 13px; margin: 0 0 16px; }
.crt-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.crt-btn-primary { padding: 8px 18px; border-radius: 10px; border: 0; background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; font-weight: 700; cursor: pointer; box-shadow: 0 6px 18px color-mix(in srgb, #f59e0b 28%, transparent); transition: transform .15s; }
.crt-btn-primary:hover { transform: translateY(-2px); }
.crt-btn-ghost { padding: 8px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-weight: 600; cursor: pointer; transition: all .15s; }
.crt-btn-ghost:hover { border-color: color-mix(in srgb, #f59e0b 32%, var(--border)); background: color-mix(in srgb, #f59e0b 8%, var(--card)); }
.crt-btn-sm { padding: 4px 10px; font-size: 12px; }
.crt-medal svg { width: 160px; height: 160px; color: var(--text); animation: exmOrbSpin 28s linear infinite reverse; }

.crt-kpi-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 18px; }
.crt-kpi { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); transition: all .2s; animation: exmKpiRise .5s ease-out both; }
.crt-kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 24px color-mix(in srgb, #f59e0b 12%, transparent); }
.crt-kpi-icn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: color-mix(in srgb, #f59e0b 14%, var(--card)); color: #f59e0b; }
.crt-kpi-mint .crt-kpi-icn { background: color-mix(in srgb, #22c55e 16%, var(--card)); color: #16a34a; }
.crt-kpi-sky .crt-kpi-icn { background: color-mix(in srgb, #38bdf8 16%, var(--card)); color: #0ea5e9; }
.crt-kpi-purple .crt-kpi-icn { background: color-mix(in srgb, #a020f0 16%, var(--card)); color: #a020f0; }
.crt-kpi-peach .crt-kpi-icn { background: color-mix(in srgb, #fb923c 16%, var(--card)); color: #f97316; }
.crt-kpi-lilac .crt-kpi-icn { background: color-mix(in srgb, #c084fc 16%, var(--card)); color: #a855f7; }
.crt-kpi-val { font-size: 20px; font-weight: 800; }
.crt-kpi-lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.crt-kpi-delta { font-size: 11px; color: #22c55e; font-weight: 600; margin-top: 2px; }

.crt-band { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px; margin-bottom: 18px; }
.crt-pipe { display: flex; align-items: center; gap: 4px; padding: 16px 8px; flex-wrap: wrap; }
.crt-pipe-stage { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); position: relative; min-width: 0; }
.crt-pipe-sky    { border-color: color-mix(in srgb, #38bdf8 30%, var(--border)); background: color-mix(in srgb, #38bdf8 6%, var(--card)); }
.crt-pipe-mint   { border-color: color-mix(in srgb, #22c55e 30%, var(--border)); background: color-mix(in srgb, #22c55e 6%, var(--card)); }
.crt-pipe-amber  { border-color: color-mix(in srgb, #f59e0b 30%, var(--border)); background: color-mix(in srgb, #f59e0b 6%, var(--card)); }
.crt-pipe-purple { border-color: color-mix(in srgb, #a020f0 30%, var(--border)); background: color-mix(in srgb, #a020f0 6%, var(--card)); }
.crt-pipe-num { font-size: 24px; font-weight: 800; }
.crt-pipe-lbl { font-size: 11px; color: var(--text-muted); text-align: center; line-height: 1.4; }
.crt-pipe-arrow { position: absolute; left: -10px; top: 50%; transform: translateY(-50%); font-size: 18px; color: var(--text-muted); }

.crt-tpl-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 8px 0; }
.crt-tpl-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--card); transition: all .2s; }
.crt-tpl-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px color-mix(in srgb, var(--ct) 22%, transparent); border-color: var(--ct); }
.crt-tpl-prev { height: 96px; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: linear-gradient(135deg, color-mix(in srgb, var(--ct) 14%, var(--card)) 0%, color-mix(in srgb, var(--ct) 4%, var(--card)) 100%); border-bottom: 3px solid var(--ct); }
.crt-tpl-medal { font-size: 22px; }
.crt-tpl-line { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--ct) 22%, var(--card)); width: 80%; }
.crt-tpl-line.w-50 { width: 50%; }
.crt-tpl-body { padding: 10px 12px; }
.crt-tpl-name { font-weight: 700; font-size: 12px; margin-bottom: 4px; }
.crt-tpl-meta { font-size: 10px; color: var(--text-muted); }

.crt-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.crt-tab { padding: 6px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s; }
.crt-tab:hover { border-color: color-mix(in srgb, #f59e0b 32%, var(--border)); }
.crt-tab.is-active { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; border-color: transparent; }
.crt-table-wrap { overflow-x: auto; }
.crt-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.crt-table thead th { padding: 10px 12px; text-align: right; font-size: 11px; color: var(--text-muted); font-weight: 600; border-bottom: 2px solid var(--border); background: color-mix(in srgb, var(--text) 4%, var(--card)); }
.crt-table tbody td { padding: 12px; border-bottom: 1px solid var(--border); }
.crt-table tbody tr:hover { background: color-mix(in srgb, #f59e0b 4%, transparent); }
.crt-code { font-family: 'Courier New', monospace; font-size: 11px; padding: 2px 8px; border-radius: 6px; background: color-mix(in srgb, #a020f0 10%, var(--card)); color: #a020f0; direction: ltr; display: inline-block; }
.crt-qr-chip { font-size: 11px; color: var(--text-muted); }

.crt-verify-list { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.crt-verify-row { display: grid; grid-template-columns: 32px 1fr; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); align-items: center; }
.crt-verify-icn { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, #22c55e 14%, var(--card)); }
.crt-verify-top { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.crt-verify-meta { font-size: 11px; color: var(--text-muted); }

.crt-trend-bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; height: 200px; align-items: end; padding: 10px 4px; }
.crt-trend-col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.crt-trend-bar { width: 100%; background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%); border-radius: 6px 6px 0 0; position: relative; min-height: 6%; animation: exmDistGrow .8s ease-out both; }
.crt-trend-val { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 9px; font-weight: 700; color: var(--text); }
.crt-trend-lbl { font-size: 10px; color: var(--text-muted); white-space: nowrap; }

@media (max-width: 1100px) { .crt-kpi-grid { grid-template-columns: repeat(3, 1fr); } .crt-band { grid-template-columns: 1fr; } .crt-tpl-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .crt-hero { grid-template-columns: 1fr; } .crt-hero-right { display: none; } .crt-kpi-grid { grid-template-columns: repeat(2, 1fr); } }

/* ============================================================ */
/* GRADUATES (شبکه همکاران سابق) — namespace grd-*           */
/* ============================================================ */
.grd-hero {
  position: relative; padding: 24px 28px; border-radius: 24px; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, #2c7be5 14%, var(--card)) 0%, color-mix(in srgb, #22c55e 10%, var(--card)) 100%);
  border: 1px solid color-mix(in srgb, #2c7be5 18%, transparent);
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
  margin-bottom: 18px; animation: exmHeroPop .6s cubic-bezier(.25,.5,.25,1) both;
}
.grd-hero-bg { position: absolute; inset: 0; background: radial-gradient(circle at 85% 25%, color-mix(in srgb, #2c7be5 22%, transparent) 0%, transparent 50%), radial-gradient(circle at 20% 80%, color-mix(in srgb, #22c55e 14%, transparent) 0%, transparent 50%); pointer-events: none; }
.grd-hero-left { position: relative; z-index: 1; }
.grd-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: color-mix(in srgb, #2c7be5 14%, var(--card)); border: 1px solid color-mix(in srgb, #2c7be5 28%, transparent); font-size: 12px; font-weight: 600; margin-bottom: 14px; }
.grd-chip-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px color-mix(in srgb, #22c55e 24%, transparent); animation: exmDotPulse 1.8s ease-in-out infinite; }
.grd-hero-title { font-size: 26px; font-weight: 800; margin: 0 0 6px; }
.grd-hero-sub { color: var(--text-muted); font-size: 13px; margin: 0 0 16px; }
.grd-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.grd-btn-primary { padding: 8px 18px; border-radius: 10px; border: 0; background: linear-gradient(135deg, #2c7be5, #1e40af); color: #fff; font-weight: 700; cursor: pointer; box-shadow: 0 6px 18px color-mix(in srgb, #2c7be5 28%, transparent); transition: transform .15s; }
.grd-btn-primary:hover { transform: translateY(-2px); }
.grd-btn-ghost { padding: 8px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-weight: 600; cursor: pointer; transition: all .15s; }
.grd-btn-ghost:hover { border-color: color-mix(in srgb, #2c7be5 32%, var(--border)); background: color-mix(in srgb, #2c7be5 8%, var(--card)); }
.grd-hero-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; min-width: 280px; position: relative; z-index: 1; }
.grd-hstat { padding: 12px 16px; border-radius: 12px; background: color-mix(in srgb, var(--card) 86%, transparent); border: 1px solid var(--border); backdrop-filter: blur(6px); }
.grd-hstat b { display: block; font-size: 20px; font-weight: 800; color: #2c7be5; }
.grd-hstat span { font-size: 11px; color: var(--text-muted); margin-top: 2px; display: block; }

.grd-band { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.grd-band.grd-band-solo { grid-template-columns: 1fr; }
.grd-card-filter { grid-column: 1 / -1; }
.grd-filter-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; padding: 8px 0; }
.grd-fld { display: flex; flex-direction: column; gap: 4px; }
.grd-fld span { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.grd-fld select, .grd-fld input { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 13px; font-family: inherit; }
.grd-fld select:focus, .grd-fld input:focus { outline: 0; border-color: #2c7be5; box-shadow: 0 0 0 3px color-mix(in srgb, #2c7be5 18%, transparent); }
.grd-fld-search { grid-column: span 1; }

.grd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.grd-empty { padding: 40px; text-align: center; color: var(--text-muted); grid-column: 1 / -1; }
.grd-card { padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--card); transition: all .2s; animation: exmKpiRise .4s ease-out both; }
.grd-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px color-mix(in srgb, #2c7be5 12%, transparent); border-color: color-mix(in srgb, #2c7be5 24%, var(--border)); }
.grd-card-head { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; margin-bottom: 12px; }
.grd-avatar { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #fff; background: var(--ga); }
.grd-name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 4px; }
.grd-star { color: #f59e0b; }
.grd-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.grd-card-body { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 10px; border-radius: 10px; background: color-mix(in srgb, var(--text) 3%, var(--card)); margin-bottom: 10px; }
.grd-fact span { font-size: 10px; color: var(--text-muted); }
.grd-fact b { font-size: 12px; font-weight: 700; display: block; margin-top: 2px; }
.grd-card-foot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.grd-foot-chip { padding: 3px 8px; border-radius: 6px; background: color-mix(in srgb, var(--text) 6%, var(--card)); font-size: 10px; color: var(--text-muted); font-weight: 600; }
.grd-foot-refer { background: color-mix(in srgb, #22c55e 14%, var(--card)); color: #16a34a; }
.grd-foot-btn { margin-inline-start: auto; padding: 4px 10px; border-radius: 6px; border: 0; background: transparent; color: #2c7be5; font-weight: 600; font-size: 11px; cursor: pointer; }
.grd-foot-btn:hover { background: color-mix(in srgb, #2c7be5 10%, var(--card)); }

.grd-stories { display: flex; flex-direction: column; gap: 10px; padding: 6px 0; }
.grd-story { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); border-inline-start: 4px solid var(--gs); }
.grd-story-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.grd-story-tag { padding: 2px 8px; border-radius: 6px; background: color-mix(in srgb, var(--gs) 14%, var(--card)); color: var(--gs); font-size: 10px; font-weight: 700; }
.grd-story-year { font-size: 11px; color: var(--text-muted); }
.grd-story-name { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.grd-story-text { font-size: 12px; color: var(--text-muted); line-height: 1.6; }

.grd-employers { display: flex; flex-direction: column; gap: 6px; padding: 6px 0; }
.grd-emp-row { display: grid; grid-template-columns: 28px 36px 1fr 80px; gap: 10px; padding: 8px 10px; border-radius: 8px; align-items: center; transition: background .15s; }
.grd-emp-row:hover { background: color-mix(in srgb, var(--text) 4%, var(--card)); }
.grd-emp-rank { font-weight: 800; color: var(--text-muted); text-align: center; }
.grd-emp-logo { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; font-size: 18px; background: color-mix(in srgb, var(--text) 6%, var(--card)); }
.grd-emp-name { font-weight: 700; font-size: 12px; display: flex; gap: 6px; align-items: center; }
.grd-emp-partner { padding: 1px 6px; border-radius: 4px; background: color-mix(in srgb, #f59e0b 14%, var(--card)); color: #f59e0b; font-size: 9px; font-weight: 700; }
.grd-emp-meta { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.grd-emp-hires { text-align: center; }
.grd-emp-hires b { display: block; font-size: 18px; font-weight: 800; color: #2c7be5; }
.grd-emp-hires span { font-size: 9px; color: var(--text-muted); }

.grd-referral { display: flex; flex-direction: column; gap: 12px; padding: 6px 0; }
.grd-ref-row { padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--gr) 4%, var(--card)); border: 1px solid color-mix(in srgb, var(--gr) 16%, var(--border)); }
.grd-ref-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.grd-ref-name { font-weight: 700; font-size: 12px; }
.grd-ref-bonus { font-size: 11px; color: var(--text-muted); }
.grd-ref-bonus b { color: #22c55e; }
.grd-ref-bar { height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--text) 8%, var(--card)); overflow: hidden; margin-bottom: 6px; }
.grd-ref-fill { height: 100%; border-radius: 999px; background: var(--gr); transition: width .6s ease; }
.grd-ref-foot { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-muted); }

.grd-events { display: flex; flex-direction: column; gap: 10px; padding: 6px 0; }
.grd-ev-row { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); }
.grd-ev-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.grd-ev-title { font-weight: 700; font-size: 13px; }
.grd-ev-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.grd-ev-bar { height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--text) 8%, var(--card)); overflow: hidden; margin-bottom: 6px; }
.grd-ev-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2c7be5, #22c55e); transition: width .6s ease; }
.grd-ev-foot { font-size: 11px; color: var(--text-muted); }

@media (max-width: 1100px) { .grd-grid { grid-template-columns: repeat(2, 1fr); } .grd-band { grid-template-columns: 1fr; } .grd-filter-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px) { .grd-hero { grid-template-columns: 1fr; } .grd-hero-stats { grid-template-columns: repeat(2, 1fr); min-width: 0; } .grd-grid { grid-template-columns: 1fr; } .grd-filter-grid { grid-template-columns: repeat(2, 1fr); } .grd-card-head { grid-template-columns: 40px 1fr; } .grd-card-head .chip { grid-column: span 2; justify-self: flex-start; } }

/* Dark theme overrides */
[data-theme="dark"] .exm-table thead th,
[data-theme="dark"] .crt-table thead th { background: color-mix(in srgb, var(--text) 8%, var(--card)); }
[data-theme="dark"] .crt-code { background: color-mix(in srgb, #a020f0 22%, var(--card)); color: #c47fff; }
[data-theme="dark"] .grd-hstat { background: color-mix(in srgb, var(--card) 75%, transparent); }


/* === Enterprise UI polish: brand and notification dropdown === */
.brand {
  gap: 12px;
  padding: 16px 14px 14px;
}

/* Logo container: transparent — logo image has its own art, no box needed */
.brand-logo {
  width: 44px; height: 44px;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
.brand-logo img {
  padding: 0;
  border-radius: 0;
  filter: none;
}
[data-theme="dark"] .brand-logo {
  background: transparent;
  box-shadow: none;
}

/* Online pip — top corner of logo (GitHub-style), replaces old .brand-dot */
.brand-logo-pip {
  position: absolute;
  top: -2px;
  inset-inline-end: -2px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #6ee7b7 0%, #10b981 55%, #059669 100%);
  border: 2px solid var(--sidebar-bg, var(--card));
  box-shadow: 0 0 0 2px rgba(16, 185, 129, .18);
  animation: brandLogoPip 2.2s ease-in-out infinite;
  pointer-events: none;
}
[data-theme="dark"] .brand-logo-pip {
  border-color: var(--sidebar-bg, var(--card));
}
@keyframes brandLogoPip {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, .22), 0 0 6px rgba(16, 185, 129, .30);
  }
  50% {
    transform: scale(1.14);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, .10), 0 0 10px rgba(16, 185, 129, .18);
  }
}

/* Old .brand-dot removed from DOM; hide any lingering references */
.brand-dot { display: none !important; }

.brand-text {
  flex: 1 1 auto;
  min-width: 0;
  max-width: calc(100% - 56px);
}

.brand-title {
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  white-space: normal;
  line-height: 1.55;
  max-width: 100%;
  overflow: hidden;
  display: block;                       /* no inline-flex + dot alignment */
}

.notif-popup {
  width: min(340px, calc(100vw - 32px));
  top: calc(100% + 8px);
  z-index: 120;
}

.notif-popup-body {
  max-height: 150px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.notif-popup-head {
  padding-block: 12px;
}

.notif-popup-foot {
  padding-block: 10px;
}


/* Enterprise-wide Persian font normalization */
:root {
  --font-persian: 'Vazirmatn', 'Segoe UI', Tahoma, Arial, sans-serif;
  --font-number: 'Vazirmatn', 'Segoe UI', Tahoma, Arial, sans-serif;
}

html, body,
button, input, textarea, select,
.app-shell, .sidebar, .topbar, .content,
.card, .kpi, .chip, .btn,
.pm-page, .wb-page, .st-page, .bc-page,
#rp-root {
  font-family: var(--font-persian) !important;
}

canvas {
  display: block;
  width: 100%;
  min-height: 160px;
}

.donut-wrap canvas,
.ai-donut-wrap canvas {
  min-height: 190px;
}


/* Chart layout polish: keep KPI text and chart drawings separated */
.kpi > .kpi-icon,
.kpi > .kpi-label,
.kpi > .kpi-value,
.kpi > .kpi-delta {
  position: relative;
  z-index: 2;
}

.kpi {
  min-height:0;
  padding-bottom: 44px;
}

.kpi-spark {
  min-height: 34px !important;
  height: 34px !important;
  max-height: 34px !important;
  opacity: .38;
  z-index: 1;
}

.card canvas:not(.kpi-spark) {
  min-height: 210px;
}

.donut-wrap canvas,
.ai-donut-wrap canvas {
  min-height: 220px !important;
}


/* Full chart readability pass */
.card:has(> canvas),
.card:has(.donut-wrap) {
  min-height: 360px;
}

.card > canvas:not(.kpi-spark),
.card canvas:not(.kpi-spark) {
  height: 260px !important;
  max-height: 300px !important;
}

.card canvas#chart-progress,
.card canvas#chart-skills,
.card canvas#chart-segments,
.card canvas#chart-customer-radar {
  height: 280px !important;
  max-height: 320px !important;
}

.donut-wrap {
  min-height: 280px;
  display: grid;
  place-items: center;
}


/* Finance chart legend uses real DOM text so Persian font rendering stays crisp. */
.finance-chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  padding: 4px 12px 0;
  color: var(--text-muted);
  font-family: var(--font-persian);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.8;
}

.finance-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.finance-chart-legend i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  display: inline-block;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 6%, transparent);
}


/* Channels live feed height fix */
.ch-live-grid {
  align-items: start;
}

.ch-live-card,
.ch-ai-card {
  align-self: start;
}

.ch-live-card {
  height: auto;
  min-height: 0;
}

.ch-live-card::after,
.ch-ai-card::after {
  display: none;
}


/* Team ranking chart readability fix */
#chart-team-bar {
  min-height: 720px !important;
  height: 760px !important;
  max-height: none !important;
}


/* Menu v2: 14-section public Diaco IA */
.nav-group-count { min-width: 22px; text-align: center; }
.nav-subitem .nav-label { line-height: 1.45; }
.nav-badge[hidden] { display: none !important; }


/* Seasonal forecast chart: keep mixed bar/line chart contained and readable */
.seasonal-forecast-card {
  min-height: auto !important;
}
.seasonal-forecast-card .card-head {
  margin-bottom: 8px;
}
.seasonal-chart-wrap {
  position: relative;
  height: 320px;
  max-height: 320px;
  overflow: hidden;
}
.seasonal-chart-wrap canvas#chart-seasonal {
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
}


/* Dashboard KPIs dedicated page */
.dash-kpi-page {
  display: grid;
  gap: 22px;
  direction: rtl;
}

.dash-kpi-hero,
.dash-kpi-panel,
.dash-kpi-card,
.dash-kpi-health,
.dash-kpi-decision {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 88%, transparent), color-mix(in srgb, var(--surface-2) 82%, transparent)),
    radial-gradient(circle at 18% 18%, color-mix(in srgb, var(--pastel-sky) 28%, transparent), transparent 34%),
    radial-gradient(circle at 88% 0%, color-mix(in srgb, var(--pastel-peach) 24%, transparent), transparent 30%);
  border: 1px solid color-mix(in srgb, var(--border) 78%, white 18%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.dash-kpi-hero {
  min-height: 420px;
  border-radius: 24px;
  padding: clamp(22px, 4vw, 40px);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
  align-items: center;
  gap: 28px;
  overflow: hidden;
  position: relative;
}

.dash-kpi-hero::before,
.dash-kpi-radar::before {
  content: "";
  position: absolute;
  inset: 24px;
  border: 1px solid color-mix(in srgb, var(--brand-500) 18%, transparent);
  border-radius: 50%;
  opacity: .35;
  pointer-events: none;
}

.dash-kpi-hero-copy {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.dash-kpi-eyebrow,
.dash-kpi-section-head span,
.dash-kpi-panel-head span,
.dash-kpi-automation-copy > span {
  color: var(--brand-600);
  font-size: 12px;
  font-weight: 800;
}

.dash-kpi-hero h1 {
  margin: 10px 0 8px;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.18;
  letter-spacing: 0;
}

.dash-kpi-hero p,
.dash-kpi-panel-head p {
  margin: 0;
  color: var(--text-muted);
  font-weight: 600;
}

.dash-kpi-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.dash-kpi-mini {
  min-height: 118px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  display: grid;
  gap: 4px;
}

.dash-kpi-mini span,
.dash-kpi-card p,
.dash-kpi-health p,
.dash-kpi-risk-row span,
.dash-kpi-auto-stats span,
.dash-kpi-decision p {
  color: var(--text-muted);
}

.dash-kpi-mini strong {
  font-size: 24px;
}

.dash-kpi-mini em {
  color: var(--text-muted);
  font-style: normal;
  font-weight: 700;
}

.dash-kpi-mini-mint { background: color-mix(in srgb, var(--pastel-mint) 34%, var(--surface)); }
.dash-kpi-mini-sky { background: color-mix(in srgb, var(--pastel-sky) 36%, var(--surface)); }
.dash-kpi-mini-rose { background: color-mix(in srgb, var(--pastel-rose) 34%, var(--surface)); }

.dash-kpi-radar {
  position: relative;
  min-height: 340px;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.dash-kpi-radar::after {
  content: "";
  position: absolute;
  width: 310px;
  height: 310px;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, transparent 0 38px, color-mix(in srgb, var(--brand-500) 16%, transparent) 39px 40px),
    conic-gradient(from 210deg, color-mix(in srgb, var(--pastel-mint) 48%, transparent), color-mix(in srgb, var(--pastel-sky) 52%, transparent), color-mix(in srgb, var(--pastel-lilac) 48%, transparent), color-mix(in srgb, var(--pastel-mint) 48%, transparent));
  filter: blur(.2px);
  opacity: .88;
  z-index: -1;
  animation: spinSlow 24s linear infinite;
}

.dash-kpi-ring {
  width: 230px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 26px;
  text-align: center;
  background:
    radial-gradient(circle, var(--surface) 0 55%, transparent 56%),
    conic-gradient(var(--green-500) calc(var(--score) * 1%), color-mix(in srgb, var(--border) 65%, transparent) 0);
  box-shadow: inset 0 0 0 1px var(--border), 0 22px 56px rgba(44, 120, 115, .18);
}

.dash-kpi-ring span {
  font-size: 54px;
  font-weight: 900;
  line-height: 1;
}

.dash-kpi-ring small,
.dash-kpi-ring b {
  color: var(--text-muted);
  font-weight: 800;
}

.dash-kpi-radar > .dash-kpi-sparkline {
  position: absolute;
  bottom: 28px;
  width: 74%;
  height: 42px;
}

.dash-kpi-section,
.dash-kpi-decisions {
  display: grid;
  gap: 14px;
}

.dash-kpi-section-head,
.dash-kpi-panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.dash-kpi-section-head h2,
.dash-kpi-panel-head h3,
.dash-kpi-automation h2 {
  margin: 3px 0 0;
  line-height: 1.35;
  letter-spacing: 0;
}

.dash-kpi-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pastel-lilac) 38%, var(--surface));
  color: var(--brand-700);
  font-weight: 800;
  white-space: nowrap;
}

.dash-kpi-snapshot,
.dash-kpi-health-grid,
.dash-kpi-decision-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.dash-kpi-card,
.dash-kpi-health,
.dash-kpi-panel,
.dash-kpi-decision {
  border-radius: 18px;
}

.dash-kpi-card {
  padding: 17px;
  min-height: 278px;
  display: grid;
  gap: 10px;
  animation: slideUp .45s ease both;
  animation-delay: calc(var(--i, 0) * 45ms);
  transition: transform .18s ease, box-shadow .18s ease;
}

.dash-kpi-card:hover,
.dash-kpi-health:hover,
.dash-kpi-decision:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.dash-kpi-card-top,
.dash-kpi-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dash-kpi-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: color-mix(in srgb, var(--pastel-sky) 42%, var(--surface));
  font-size: 22px;
}

.dash-kpi-status {
  padding: 5px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pastel-mint) 36%, var(--surface));
  font-size: 12px;
  font-weight: 900;
}

.dash-kpi-card h3,
.dash-kpi-health h3,
.dash-kpi-decision h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
}

.dash-kpi-value {
  font-size: 28px;
  font-weight: 900;
}

.dash-kpi-meta {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}

.dash-kpi-tone-green .dash-kpi-status,
.dash-kpi-tone-green .dash-kpi-health-ring { background: color-mix(in srgb, var(--pastel-mint) 42%, var(--surface)); }
.dash-kpi-tone-amber .dash-kpi-status,
.dash-kpi-tone-amber .dash-kpi-health-ring { background: color-mix(in srgb, var(--pastel-peach) 48%, var(--surface)); }
.dash-kpi-tone-red .dash-kpi-status { background: color-mix(in srgb, var(--pastel-rose) 48%, var(--surface)); }

.dash-kpi-sparkline {
  width: 100%;
  height: 42px;
}

.dash-kpi-sparkline path {
  fill: none;
  stroke: var(--brand-500);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 4px 6px rgba(44, 120, 115, .18));
}

.dash-kpi-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr);
  gap: 16px;
}

.dash-kpi-chart-grid-balanced {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dash-kpi-panel {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.dash-kpi-chart-wrap {
  position: relative;
  height: 330px;
  min-height: 280px;
}

.dash-kpi-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.dash-kpi-funnel {
  display: grid;
  gap: 11px;
}

.dash-kpi-funnel-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px 12px;
  align-items: center;
  font-weight: 800;
}

.dash-kpi-funnel-row i {
  grid-column: 1 / -1;
  height: 12px;
  width: var(--w);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-500), var(--pastel-sky));
  box-shadow: 0 5px 14px color-mix(in srgb, var(--brand-500) 18%, transparent);
}

.dash-kpi-insight {
  padding: 13px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--pastel-lemon) 40%, var(--surface));
  color: var(--text-muted);
  font-weight: 750;
}

.dash-kpi-health-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dash-kpi-health {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
}

.dash-kpi-health-ring {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle, var(--surface) 0 57%, transparent 58%),
    conic-gradient(var(--green-500) calc(var(--p) * 1%), color-mix(in srgb, var(--border) 62%, transparent) 0);
  font-weight: 900;
}

.dash-kpi-heatmap {
  display: grid;
  grid-template-columns: 96px repeat(7, 1fr);
  gap: 8px;
  align-items: center;
}

.dash-kpi-heatmap b,
.dash-kpi-heatmap strong {
  color: var(--text-muted);
  font-size: 12px;
}

.dash-kpi-heatmap span {
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.dash-kpi-sla-green { background: color-mix(in srgb, var(--pastel-mint) 72%, var(--surface)); }
.dash-kpi-sla-amber { background: color-mix(in srgb, var(--pastel-peach) 76%, var(--surface)); }
.dash-kpi-sla-red { background: color-mix(in srgb, var(--pastel-rose) 74%, var(--surface)); }

.dash-kpi-risk-list {
  display: grid;
  gap: 10px;
}

.dash-kpi-risk-row {
  display: grid;
  grid-template-columns: 1.15fr .65fr .65fr .7fr 1fr .9fr 1.25fr;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2) 62%, transparent);
  border: 1px solid var(--border);
}

.dash-kpi-risk-row div {
  display: grid;
  gap: 2px;
}

.dash-kpi-risk-row strong {
  line-height: 1.5;
}

.dash-kpi-automation {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 210px minmax(180px, .6fr);
  align-items: center;
  gap: 18px;
  padding: 22px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--pastel-lilac) 32%, var(--surface)), color-mix(in srgb, var(--pastel-mint) 22%, var(--surface))),
    var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.dash-kpi-auto-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.dash-kpi-auto-stats div {
  padding: 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  display: grid;
  gap: 3px;
}

.dash-kpi-auto-stats strong {
  font-size: 22px;
}

.dash-kpi-donut {
  width: 190px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle, var(--surface) 0 47%, transparent 48%),
    conic-gradient(var(--brand-500) 0 var(--a), var(--green-500) var(--a) var(--b), var(--amber-500) var(--b) var(--c), var(--accent-500) var(--c) 360deg);
  box-shadow: inset 0 0 0 1px var(--border);
}

.dash-kpi-donut span {
  font-size: 30px;
  font-weight: 900;
}

.dash-kpi-donut-legend {
  display: grid;
  gap: 8px;
  color: var(--text-muted);
  font-weight: 800;
}

.dash-kpi-donut-legend span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-kpi-donut-legend i {
  width: 10px;
  height: 10px;
  border-radius: 4px;
  background: var(--brand-500);
}

.dash-kpi-donut-legend span:nth-child(2) i { background: var(--green-500); }
.dash-kpi-donut-legend span:nth-child(3) i { background: var(--amber-500); }
.dash-kpi-donut-legend span:nth-child(4) i { background: var(--accent-500); }

.dash-kpi-decision-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dash-kpi-decision {
  padding: 18px;
  display: grid;
  gap: 10px;
}

.dash-kpi-decision-num {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--pastel-sky) 44%, var(--surface));
  font-weight: 900;
}

.dash-kpi-decision > strong {
  color: var(--brand-700);
}

.dash-kpi-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.dash-kpi-actions button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

/* ---------- KPI page · v2 upgrades (movers, filter bar, trends, goals, spotlight, segments) ---------- */

.dash-kpi-hero-movers {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.dash-kpi-mover-pill {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  min-height: 44px;
}

.dash-kpi-mover-pill span {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: .2px;
}

.dash-kpi-mover-pill strong { font-weight: 900; font-size: 14px; }
.dash-kpi-mover-pill em {
  font-style: normal;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.dash-kpi-mover-up   { background: color-mix(in srgb, var(--pastel-mint) 40%, var(--surface)); }
.dash-kpi-mover-up em { background: var(--green-500); color: #0d3b23; }
.dash-kpi-mover-down { background: color-mix(in srgb, var(--pastel-rose) 40%, var(--surface)); }
.dash-kpi-mover-down em { background: var(--red-500); color: #fff; }

/* Filter bar */
.dash-kpi-filterbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.dash-kpi-catchip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.dash-kpi-catchip:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.dash-kpi-catchip i { font-style: normal; font-size: 14px; }
.dash-kpi-catchip em {
  font-style: normal;
  font-size: 11px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 60%, transparent);
  color: var(--text-muted);
}

.dash-kpi-catchip.is-active {
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 18px -8px rgba(44,120,115,.35);
}
.dash-kpi-catchip.is-active em { background: rgba(255,255,255,.28); color: #fff; }

.dash-kpi-cat-brand.is-active { background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); }
.dash-kpi-cat-sky.is-active   { background: linear-gradient(135deg, #4c86d9, #021c1e); }
.dash-kpi-cat-lilac.is-active { background: linear-gradient(135deg, #6fb98f, #7c3aed); }
.dash-kpi-cat-mint.is-active  { background: linear-gradient(135deg, #6dbf8f, #2f8a5e); }
.dash-kpi-cat-peach.is-active { background: linear-gradient(135deg, var(--accent-500), var(--accent-600)); }
.dash-kpi-cat-rose.is-active  { background: linear-gradient(135deg, #e8788c, #b83656); }
.dash-kpi-cat-lemon.is-active { background: linear-gradient(135deg, #f0b86e, #d18a2a); }

/* Category badge on KPI cards */
.dash-kpi-catbadge {
  justify-self: start;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  color: var(--brand-700);
  background: color-mix(in srgb, var(--pastel-sky) 46%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--brand-500) 12%, transparent);
}

/* Category-specific card accents */
.dash-kpi-card.dash-kpi-cat-finance  { --catAccent: var(--green-500);  --catSoft: var(--pastel-mint); }
.dash-kpi-card.dash-kpi-cat-sales    { --catAccent: var(--brand-500);  --catSoft: var(--pastel-sky); }
.dash-kpi-card.dash-kpi-cat-mkt      { --catAccent: #6fb98f;           --catSoft: var(--pastel-lilac); }
.dash-kpi-card.dash-kpi-cat-ops      { --catAccent: var(--accent-500); --catSoft: var(--pastel-peach); }
.dash-kpi-card.dash-kpi-cat-customer { --catAccent: var(--red-500);    --catSoft: var(--pastel-rose); }
.dash-kpi-card.dash-kpi-cat-team     { --catAccent: var(--amber-500);  --catSoft: var(--pastel-lemon); }
.dash-kpi-card.dash-kpi-cat-ai       { --catAccent: #6fb98f;           --catSoft: var(--pastel-lilac); }

.dash-kpi-card[data-cat] {
  border-inline-start: 3px solid var(--catAccent, var(--brand-500));
}
.dash-kpi-card[data-cat] .dash-kpi-icon {
  background: color-mix(in srgb, var(--catSoft, var(--pastel-sky)) 60%, var(--surface));
}
.dash-kpi-card[data-cat] .dash-kpi-catbadge {
  background: color-mix(in srgb, var(--catSoft, var(--pastel-sky)) 62%, var(--surface));
  color: var(--text);
}

/* Filter behaviour · v2 (HIDE not dim + sticky bar + status pill + flash) */
.dash-kpi-page .is-hidden { display: none !important; }

.dash-kpi-page .dash-kpi-card,
.dash-kpi-page .dash-kpi-trend,
.dash-kpi-page .dash-kpi-goal,
.dash-kpi-page .dash-kpi-movers li,
.dash-kpi-page .dash-kpi-spotlight { transition: opacity .28s ease, transform .28s cubic-bezier(.22,.7,.16,1), box-shadow .18s ease; }

/* When a filter yields zero items for a whole section, hide the section entirely */
.dash-kpi-page .dash-kpi-section.is-empty,
.dash-kpi-page .dash-kpi-movers.is-empty { display: none; }

/* Sticky filter wrapper (contains filterbar + optional status pill) */
.dash-kpi-page .dash-kpi-filter-wrap {
  position: sticky;
  top: 64px;
  z-index: 30;
  display: grid;
  gap: 8px;
}
.dash-kpi-page .dash-kpi-filter-wrap .dash-kpi-filterbar {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  box-shadow: 0 6px 22px rgba(15,23,42,.06);
  transition: box-shadow .3s ease, border-color .3s ease;
}
.dash-kpi-page .dash-kpi-filter-wrap.is-filtered .dash-kpi-filterbar {
  border-color: rgba(111,185,143,0.35);
  box-shadow: 0 6px 26px rgba(111,185,143,.18);
}

/* Active-filter status pill */
.dash-kpi-page .dash-kpi-filter-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 8% 0%, rgba(111,185,143,0.18), transparent 42%),
    radial-gradient(circle at 92% 100%, rgba(34,211,238,0.14), transparent 46%),
    color-mix(in srgb, var(--surface) 90%, transparent);
  border: 1px solid rgba(111,185,143,0.32);
  backdrop-filter: blur(10px);
  animation: kpiFilterSlideIn .3s cubic-bezier(.22,.7,.16,1) both;
}
.dash-kpi-page .dash-kpi-filter-status[hidden] { display: none; }
.dash-kpi-page .dash-kpi-filter-status-lbl { font-size: 12px; color: var(--text-muted); font-weight: 700; }
.dash-kpi-page .dash-kpi-filter-status strong {
  font-size: 13px;
  font-weight: 900;
  padding: 3px 11px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(111,185,143,0.22), rgba(34,211,238,0.16));
  color: var(--brand-700);
}
.dash-kpi-page .dash-kpi-filter-status em {
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
}
.dash-kpi-page .dash-kpi-filter-reset {
  margin-inline-start: auto;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.dash-kpi-page .dash-kpi-filter-reset:hover {
  background: rgba(232,120,140,.10);
  border-color: rgba(232,120,140,.32);
  color: #b14458;
}

/* Snapshot flash — quick outline pulse when filter changes */
.dash-kpi-page .dash-kpi-snapshot.is-flash {
  animation: kpiSnapFlash .7s cubic-bezier(.25,.1,.25,1) both;
  border-radius: 16px;
}
@keyframes kpiSnapFlash {
  0%   { box-shadow: 0 0 0 0    rgba(111,185,143,0); }
  30%  { box-shadow: 0 0 0 10px rgba(111,185,143,.18); }
  100% { box-shadow: 0 0 0 0    rgba(111,185,143,0); }
}
@keyframes kpiFilterSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Chip alt (softer look) */
.dash-kpi-chip-alt {
  background: color-mix(in srgb, var(--pastel-mint) 40%, var(--surface));
  color: var(--text);
}

/* Funnel conversion badge */
.dash-kpi-funnel-conv {
  justify-self: end;
  font-size: 11px;
  font-weight: 900;
  color: var(--brand-700);
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pastel-lilac) 50%, var(--surface));
}

/* Trend comparison grid */
.dash-kpi-trend-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.dash-kpi-trend {
  padding: 16px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 10px;
  animation: slideUp .45s ease both;
  animation-delay: calc(var(--i, 0) * 40ms);
  position: relative;
  overflow: hidden;
}

.dash-kpi-trend::before {
  content: '';
  position: absolute;
  top: 0; inset-inline-start: 0;
  width: 4px; height: 100%;
  background: var(--trendAccent, var(--brand-500));
}

.dash-kpi-trend-mint  { --trendAccent: var(--green-500); }
.dash-kpi-trend-sky   { --trendAccent: var(--brand-500); }
.dash-kpi-trend-lilac { --trendAccent: #6fb98f; }
.dash-kpi-trend-peach { --trendAccent: var(--accent-500); }
.dash-kpi-trend-rose  { --trendAccent: var(--red-500); }
.dash-kpi-trend-lemon { --trendAccent: var(--amber-500); }

.dash-kpi-trend-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.dash-kpi-trend-head h3 { margin: 0; font-size: 15px; }
.dash-kpi-trend-cat {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 80%, transparent);
}

.dash-kpi-trend-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}
.dash-kpi-trend-main strong { font-size: 26px; font-weight: 900; }
.dash-kpi-trend-deltas { display: flex; gap: 6px; flex-wrap: wrap; }
.dash-kpi-trend-deltas em {
  font-style: normal;
  font-weight: 900;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pastel-mint) 46%, var(--surface));
  color: #0d3b23;
}

.dash-kpi-trend-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}
.dash-kpi-trend-compare span { font-size: 11px; color: var(--text-muted); font-weight: 700; }
.dash-kpi-trend-compare b    { display: block; font-weight: 900; margin-top: 2px; }

/* Goal tracker */
.dash-kpi-goals-section { margin-top: 2px; }

.dash-kpi-goal-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.dash-kpi-goal {
  padding: 16px 18px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 10px;
  animation: slideUp .45s ease both;
  animation-delay: calc(var(--i, 0) * 40ms);
  position: relative;
  overflow: hidden;
}

.dash-kpi-goal::before {
  content: '';
  position: absolute;
  top: 0; inset-inline-start: 0;
  width: 4px; height: 100%;
  background: var(--goalAccent, var(--brand-500));
}

.dash-kpi-goal-mint  { --goalAccent: var(--green-500);  --goalSoft: var(--pastel-mint); }
.dash-kpi-goal-sky   { --goalAccent: var(--brand-500);  --goalSoft: var(--pastel-sky); }
.dash-kpi-goal-lilac { --goalAccent: #6fb98f;           --goalSoft: var(--pastel-lilac); }
.dash-kpi-goal-peach { --goalAccent: var(--accent-500); --goalSoft: var(--pastel-peach); }
.dash-kpi-goal-rose  { --goalAccent: var(--red-500);    --goalSoft: var(--pastel-rose); }
.dash-kpi-goal-lemon { --goalAccent: var(--amber-500);  --goalSoft: var(--pastel-lemon); }

.dash-kpi-goal-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}
.dash-kpi-goal-head h3 { margin: 6px 0 0; font-size: 15px; }
.dash-kpi-goal-head b {
  font-size: 22px;
  font-weight: 900;
  color: var(--goalAccent);
}

.dash-kpi-goal .dash-kpi-catbadge {
  background: color-mix(in srgb, var(--goalSoft) 60%, var(--surface));
  color: var(--text);
}

.dash-kpi-goal-bar {
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--goalSoft) 46%, var(--surface-2));
  overflow: hidden;
  position: relative;
}
.dash-kpi-goal-bar i {
  display: block;
  height: 100%;
  width: calc(var(--p, 0) * 1%);
  background: linear-gradient(90deg, var(--goalAccent), color-mix(in srgb, var(--goalAccent) 60%, var(--pastel-lilac)));
  border-radius: 999px;
  transition: width .6s cubic-bezier(.25,.1,.25,1);
}

.dash-kpi-goal-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
}
.dash-kpi-goal-meta b { font-weight: 900; color: var(--text); margin-inline-start: 4px; }

/* Movers · Top & Bottom */
.dash-kpi-movers-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.dash-kpi-movers ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.dash-kpi-movers li {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2) 62%, transparent);
  border: 1px solid var(--border);
}
.dash-kpi-movers li b {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--brand-500) 12%, transparent);
  color: var(--brand-700);
  font-weight: 900;
  font-size: 12px;
}
.dash-kpi-movers li strong { display: block; font-weight: 900; font-size: 14px; }
.dash-kpi-movers li span:not(.dash-kpi-mover-delta) { color: var(--text-muted); font-size: 11px; font-weight: 700; }
.dash-kpi-movers li em {
  font-style: normal;
  font-weight: 900;
  color: var(--text);
  font-size: 13px;
}
.dash-kpi-mover-delta {
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}
.dash-kpi-mover-delta.up   { background: color-mix(in srgb, var(--pastel-mint) 60%, var(--surface)); color: #0d3b23; }
.dash-kpi-mover-delta.down { background: color-mix(in srgb, var(--pastel-rose) 60%, var(--surface)); color: #6b1f2f; }

.dash-kpi-movers-up   { border-top: 3px solid var(--green-500); }
.dash-kpi-movers-down { border-top: 3px solid var(--red-500); }

/* Spotlight — KPI of the week */
.dash-kpi-spotlight {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: 22px;
  padding: 26px;
  border-radius: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--pastel-lilac) 42%, var(--surface)), color-mix(in srgb, var(--pastel-sky) 30%, var(--surface))),
    var(--surface);
}

.dash-kpi-spot-mint  { background: linear-gradient(135deg, color-mix(in srgb, var(--pastel-mint) 46%, var(--surface)), color-mix(in srgb, var(--pastel-sky) 30%, var(--surface))); }
.dash-kpi-spot-sky   { background: linear-gradient(135deg, color-mix(in srgb, var(--pastel-sky) 46%, var(--surface)), color-mix(in srgb, var(--pastel-lilac) 30%, var(--surface))); }
.dash-kpi-spot-lilac { background: linear-gradient(135deg, color-mix(in srgb, var(--pastel-lilac) 46%, var(--surface)), color-mix(in srgb, var(--pastel-sky) 30%, var(--surface))); }
.dash-kpi-spot-peach { background: linear-gradient(135deg, color-mix(in srgb, var(--pastel-peach) 46%, var(--surface)), color-mix(in srgb, var(--pastel-lemon) 30%, var(--surface))); }
.dash-kpi-spot-rose  { background: linear-gradient(135deg, color-mix(in srgb, var(--pastel-rose) 46%, var(--surface)), color-mix(in srgb, var(--pastel-peach) 30%, var(--surface))); }

.dash-kpi-spot-copy { display: grid; gap: 10px; align-content: start; }
.dash-kpi-spot-copy > span {
  color: var(--brand-700);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.dash-kpi-spot-copy h2 { margin: 0; font-size: 28px; }
.dash-kpi-spot-copy p  { margin: 0; color: var(--text); font-weight: 600; line-height: 1.8; }

.dash-kpi-spot-main {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.dash-kpi-spot-main strong { font-size: 42px; font-weight: 900; line-height: 1; }
.dash-kpi-spot-main em {
  font-style: normal;
  font-weight: 900;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--green-500);
  color: #0d3b23;
  font-size: 14px;
}

.dash-kpi-spot-action {
  padding: 14px 16px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border: 1px dashed color-mix(in srgb, var(--brand-500) 26%, transparent);
  display: grid;
  gap: 6px;
}
.dash-kpi-spot-action b { color: var(--brand-700); font-weight: 900; font-size: 13px; }
.dash-kpi-spot-action span { color: var(--text); font-weight: 600; }

.dash-kpi-spot-contrib {
  padding: 18px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border: 1px solid var(--border);
  display: grid;
  gap: 10px;
  align-content: start;
}
.dash-kpi-spot-contrib > span {
  font-size: 12px;
  font-weight: 900;
  color: var(--brand-700);
  letter-spacing: .2px;
}
.dash-kpi-spot-contrib ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.dash-kpi-spot-contrib li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}
.dash-kpi-spot-contrib strong { font-weight: 800; font-size: 13px; }
.dash-kpi-spot-contrib em { font-style: normal; font-weight: 900; color: var(--brand-700); font-size: 12px; }

/* Segment split cards */
.dash-kpi-segment-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.dash-kpi-segment {
  padding: 16px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 8px;
  animation: slideUp .45s ease both;
  animation-delay: calc(var(--i, 0) * 40ms);
}

.dash-kpi-seg-mint  { --segAccent: var(--green-500);  --segSoft: var(--pastel-mint); }
.dash-kpi-seg-sky   { --segAccent: var(--brand-500);  --segSoft: var(--pastel-sky); }
.dash-kpi-seg-lilac { --segAccent: #6fb98f;           --segSoft: var(--pastel-lilac); }
.dash-kpi-seg-lemon { --segAccent: var(--amber-500);  --segSoft: var(--pastel-lemon); }
.dash-kpi-seg-peach { --segAccent: var(--accent-500); --segSoft: var(--pastel-peach); }

.dash-kpi-seg-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.dash-kpi-seg-head h3 { margin: 0; font-size: 14px; }
.dash-kpi-seg-head b {
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--segSoft) 62%, var(--surface));
  color: var(--text);
  font-size: 12px;
}
.dash-kpi-segment > strong { font-size: 24px; font-weight: 900; color: var(--segAccent); }
.dash-kpi-seg-count {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
}
.dash-kpi-seg-bar {
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--segSoft) 46%, var(--surface-2));
  overflow: hidden;
}
.dash-kpi-seg-bar i {
  display: block;
  height: 100%;
  width: calc(var(--p, 0) * 1%);
  background: linear-gradient(90deg, var(--segAccent), color-mix(in srgb, var(--segAccent) 60%, var(--pastel-lilac)));
  border-radius: 999px;
}
.dash-kpi-segment p { margin: 4px 0 0; color: var(--text-muted); font-weight: 700; font-size: 12px; }

/* Responsive tweaks */
@media (max-width: 1200px) {
  .dash-kpi-trend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-kpi-segment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-kpi-snapshot { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-kpi-health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .dash-kpi-trend-grid,
  .dash-kpi-segment-grid,
  .dash-kpi-goal-list,
  .dash-kpi-movers-grid,
  .dash-kpi-snapshot,
  .dash-kpi-decision-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-kpi-spotlight { grid-template-columns: minmax(0, 1fr); }
  .dash-kpi-goal-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =========================================================================
   KPI page · Mission-Control alignment (2026-07-12)
   Match today's-business-view (.dash-mc-*) typography, spacing, tints
   ========================================================================= */

/* ---- HERO — compact, radial purple+cyan like .dash-mc-hero ---- */
.dash-kpi-page .dash-kpi-hero {
  min-height: 0;
  padding: 18px 22px;
  border-radius: 18px;
  gap: 20px;
  grid-template-columns: minmax(0, 1.25fr) minmax(240px, .75fr);
  background:
    radial-gradient(circle at 8% 0%, rgba(111,185,143,0.16), transparent 42%),
    radial-gradient(circle at 92% 100%, rgba(34,211,238,0.13), transparent 46%),
    linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  backdrop-filter: none;
}
.dash-kpi-page .dash-kpi-hero::before {
  inset: 18px;
  border-color: rgba(111,185,143,0.16);
  opacity: .5;
}

.dash-kpi-page .dash-kpi-eyebrow {
  color: var(--brand-600);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.dash-kpi-page .dash-kpi-hero h1 {
  margin: 6px 0 4px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.3px;
  line-height: 1.35;
}
.dash-kpi-page .dash-kpi-hero p {
  font-size: 13px;
  line-height: 1.6;
  font-weight: 500;
  color: var(--text-muted);
}

/* Hero movers pills — chip-like, tight */
.dash-kpi-page .dash-kpi-hero-movers { margin-top: 12px; gap: 8px; }
.dash-kpi-page .dash-kpi-mover-pill {
  padding: 8px 12px;
  min-height: 0;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  border-radius: 14px;
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--border);
  backdrop-filter: blur(6px);
}
.dash-kpi-page .dash-kpi-mover-pill span {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .1px;
  text-transform: none;
}
.dash-kpi-page .dash-kpi-mover-pill strong { font-size: 13px; font-weight: 800; letter-spacing: -.2px; }
.dash-kpi-page .dash-kpi-mover-pill em {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
}
.dash-kpi-page .dash-kpi-mover-up   { background: rgba(52,211,153,0.14); border-color: rgba(52,211,153,0.28); }
.dash-kpi-page .dash-kpi-mover-up em { background: var(--green-50); color: #2f8a5e; }
.dash-kpi-page .dash-kpi-mover-down { background: rgba(232,120,140,0.14); border-color: rgba(232,120,140,0.28); }
.dash-kpi-page .dash-kpi-mover-down em { background: var(--red-50); color: #b14458; }

/* Hero mini stats — mc-pill style */
.dash-kpi-page .dash-kpi-hero-stats { margin-top: 14px; gap: 10px; }
.dash-kpi-page .dash-kpi-mini {
  min-height: 0;
  padding: 10px 12px;
  border-radius: 12px;
  gap: 2px;
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--border);
}
.dash-kpi-page .dash-kpi-mini span { font-size: 10.5px; font-weight: 600; }
.dash-kpi-page .dash-kpi-mini strong { font-size: 18px; font-weight: 800; letter-spacing: -.4px; line-height: 1.2; }
.dash-kpi-page .dash-kpi-mini em { font-size: 10.5px; font-weight: 600; }
.dash-kpi-page .dash-kpi-mini-mint { background: linear-gradient(135deg, rgba(255,255,255,0.7), rgba(184,230,211,.35)); }
.dash-kpi-page .dash-kpi-mini-sky  { background: linear-gradient(135deg, rgba(255,255,255,0.7), rgba(184,212,241,.35)); }
.dash-kpi-page .dash-kpi-mini-lilac{ background: linear-gradient(135deg, rgba(255,255,255,0.7), rgba(221,214,254,.40)); }
.dash-kpi-page .dash-kpi-mini-rose { background: linear-gradient(135deg, rgba(255,255,255,0.7), rgba(245,194,199,.35)); }

/* ---- Health Orb — redesigned (SVG rings + pulse + gradient) ---- */
.dash-kpi-page .dash-kpi-radar {
  position: relative;
  min-height: 240px;
  display: grid;
  place-items: center;
  isolation: isolate;
}
/* Kill old conic halo and any lingering sparkline */
.dash-kpi-page .dash-kpi-radar::after { display: none; }
.dash-kpi-page .dash-kpi-radar > .dash-kpi-sparkline { display: none !important; }

.dash-kpi-page .dash-kpi-radar::before {
  content: '';
  position: absolute;
  width: 240px; height: 240px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(111,185,143,0.14), transparent 60%),
    radial-gradient(circle at 30% 30%, rgba(34,211,238,0.10), transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(52,211,153,0.10), transparent 55%);
  filter: blur(4px);
  z-index: -2;
  inset: auto;
  border: none;
  opacity: 1;
  pointer-events: none;
}

.dash-kpi-page .dash-kpi-orb-svg {
  position: absolute;
  width: 210px;
  height: 210px;
  z-index: 0;
  filter: drop-shadow(0 8px 24px rgba(111,185,143,.28));
}
.dash-kpi-page .dash-kpi-orb-track { stroke: rgba(15,23,42,0.08); }
.dash-kpi-page .dash-kpi-orb-track-2 {
  stroke: rgba(111,185,143,0.22);
  stroke-dasharray: 2 4;
  animation: kpiOrbSpin 40s linear infinite;
  transform-origin: 60px 60px;
}
.dash-kpi-page .dash-kpi-orb-arc {
  stroke-dasharray: var(--c);
  stroke-dashoffset: calc(var(--c) - var(--c) * var(--p) / 100);
  animation: kpiOrbDraw 2.4s cubic-bezier(.25,.1,.25,1) both;
}
.dash-kpi-page .dash-kpi-orb-dots circle {
  transform-origin: 60px 60px;
  animation: kpiOrbSpin 20s linear infinite;
  filter: drop-shadow(0 0 5px currentColor);
  opacity: .9;
}
.dash-kpi-page .dash-kpi-orb-dots circle:nth-child(2) { animation-duration: 24s; animation-direction: reverse; }
.dash-kpi-page .dash-kpi-orb-dots circle:nth-child(3) { animation-duration: 28s; }
.dash-kpi-page .dash-kpi-orb-dots circle:nth-child(4) { animation-duration: 32s; animation-direction: reverse; }

.dash-kpi-page .dash-kpi-orb-pulse {
  position: absolute;
  width: 210px; height: 210px;
  border-radius: 50%;
  border: 2px solid rgba(111,185,143,0.32);
  animation: kpiOrbPulse 2.8s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes kpiOrbDraw { from { stroke-dashoffset: var(--c); } }
@keyframes kpiOrbSpin { to { transform: rotate(360deg); } }
@keyframes kpiOrbPulse {
  0%, 100% { transform: scale(1);    opacity: 0; }
  50%      { transform: scale(1.08); opacity: 1; }
}

/* Inner text centered inside the SVG ring */
.dash-kpi-page .dash-kpi-ring {
  width: 148px;
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 20px 16px;
  gap: 4px;
  background: transparent;
  box-shadow: none;
  z-index: 1;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
}
.dash-kpi-page .dash-kpi-ring span {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -1.5px;
  line-height: 1;
  background: linear-gradient(135deg, #6fb98f, #22d3ee 55%, #34d399);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
}
.dash-kpi-page .dash-kpi-ring span em {
  font-style: normal;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
  background: linear-gradient(135deg, #6fb98f, #22d3ee);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}
.dash-kpi-page .dash-kpi-ring small {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text);
  margin-top: 2px;
}
.dash-kpi-page .dash-kpi-ring b {
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 130px;
}

/* ---- Filter chip bar — match .chip-btn / .dash-mc-tab ---- */
.dash-kpi-page .dash-kpi-filterbar {
  padding: 6px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.04);
  backdrop-filter: blur(12px) saturate(140%);
}
.dash-kpi-page .dash-kpi-catchip {
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  gap: 6px;
}
.dash-kpi-page .dash-kpi-catchip:hover { background: rgba(127,127,127,0.06); color: var(--text); box-shadow: none; }
.dash-kpi-page .dash-kpi-catchip i { font-size: 13px; }
.dash-kpi-page .dash-kpi-catchip em { font-size: 10px; padding: 2px 7px; }
.dash-kpi-page .dash-kpi-catchip.is-active {
  color: var(--text);
  font-weight: 800;
  background: linear-gradient(135deg, rgba(111,185,143,0.16), rgba(34,211,238,0.12));
  border-color: rgba(111,185,143,0.32);
  box-shadow: none;
}
.dash-kpi-page .dash-kpi-catchip.is-active em { background: rgba(111,185,143,0.24); color: var(--brand-700); }

/* ---- Section heads & chips — smaller ---- */
.dash-kpi-page .dash-kpi-section,
.dash-kpi-page .dash-kpi-decisions { gap: 12px; }
.dash-kpi-page .dash-kpi-section-head span,
.dash-kpi-page .dash-kpi-panel-head span,
.dash-kpi-page .dash-kpi-automation-copy > span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.dash-kpi-page .dash-kpi-section-head h2,
.dash-kpi-page .dash-kpi-panel-head h3,
.dash-kpi-page .dash-kpi-automation h2 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.2px;
  margin-top: 4px;
}
.dash-kpi-page .dash-kpi-chip {
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 700;
  background: var(--pastel-lilac);
  color: #6d50d4;
}
.dash-kpi-page .dash-kpi-chip-alt { background: var(--pastel-mint); color: #2f8a5e; }

/* ---- KPI Snapshot cards — .kpi-style compact with pastel blob ---- */
.dash-kpi-page .dash-kpi-snapshot { gap: 14px; }
.dash-kpi-page .dash-kpi-card {
  padding: 14px 16px 16px;
  min-height: 0;
  border-radius: 16px;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  isolation: isolate;
}
.dash-kpi-page .dash-kpi-card::before {
  content: '';
  position: absolute;
  top: -30px;
  inset-inline-end: -30px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: var(--catSoft, var(--pastel-sky));
  filter: blur(38px);
  opacity: .5;
  pointer-events: none;
  z-index: -1;
  transition: opacity .3s ease, transform .4s cubic-bezier(.22,.7,.16,1);
}
.dash-kpi-page .dash-kpi-card:hover::before { opacity: .8; transform: scale(1.15); }
.dash-kpi-page .dash-kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px -8px rgba(15,23,42,.12), 0 3px 10px rgba(15,23,42,.04);
}
.dash-kpi-page .dash-kpi-card[data-cat] { border-inline-start: 3px solid var(--catAccent, var(--brand-500)); }
.dash-kpi-page .dash-kpi-card-top { gap: 8px; }
.dash-kpi-page .dash-kpi-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  font-size: 17px;
  background: color-mix(in srgb, var(--catSoft, var(--pastel-sky)) 72%, var(--surface));
}
.dash-kpi-page .dash-kpi-status {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  background: var(--pastel-mint);
  color: #2f8a5e;
}
.dash-kpi-page .dash-kpi-tone-amber .dash-kpi-status { background: var(--pastel-peach); color: #c46920; }
.dash-kpi-page .dash-kpi-tone-red .dash-kpi-status   { background: var(--pastel-rose);  color: #b14458; }
.dash-kpi-page .dash-kpi-catbadge {
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  background: color-mix(in srgb, var(--catSoft, var(--pastel-sky)) 60%, var(--surface));
  color: var(--text);
  border: none;
}
.dash-kpi-page .dash-kpi-card h3 { font-size: 12.5px; font-weight: 700; line-height: 1.4; color: var(--text-muted); }
.dash-kpi-page .dash-kpi-value { font-size: 22px; font-weight: 700; letter-spacing: -.5px; line-height: 1.15; }
.dash-kpi-page .dash-kpi-meta {
  font-size: 11px;
  font-weight: 600;
  padding-top: 2px;
}
.dash-kpi-page .dash-kpi-meta strong {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--green-50);
  color: #2f8a5e;
  font-size: 10.5px;
}
.dash-kpi-page .dash-kpi-tone-amber .dash-kpi-meta strong { background: var(--amber-50); color: #b27512; }
.dash-kpi-page .dash-kpi-tone-red .dash-kpi-meta strong   { background: var(--red-50);   color: #b14458; }
.dash-kpi-page .dash-kpi-sparkline { height: 32px; opacity: .7; }
.dash-kpi-page .dash-kpi-sparkline path { stroke-width: 2; }
.dash-kpi-page .dash-kpi-card p { font-size: 11.5px; color: var(--text-muted); font-weight: 500; line-height: 1.5; margin: 0; }

/* ---- Trend Comparison cards ---- */
.dash-kpi-page .dash-kpi-trend-grid { gap: 12px; }
.dash-kpi-page .dash-kpi-trend {
  padding: 14px 16px;
  border-radius: 16px;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.dash-kpi-page .dash-kpi-trend::before { width: 3px; }
.dash-kpi-page .dash-kpi-trend-head h3 { font-size: 13px; font-weight: 700; }
.dash-kpi-page .dash-kpi-trend-cat {
  font-size: 10px;
  padding: 2px 8px;
  background: var(--pastel-sky);
  color: #3b5998;
  font-weight: 700;
}
.dash-kpi-page .dash-kpi-trend-main strong { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.dash-kpi-page .dash-kpi-trend-deltas em {
  font-size: 10px;
  padding: 2px 8px;
  background: var(--green-50);
  color: #2f8a5e;
  font-weight: 700;
}
.dash-kpi-page .dash-kpi-trend-compare {
  padding: 8px 10px;
  border-radius: 10px;
  gap: 8px;
  background: var(--surface-2);
}
.dash-kpi-page .dash-kpi-trend-compare span { font-size: 10.5px; font-weight: 600; }
.dash-kpi-page .dash-kpi-trend-compare b    { font-size: 13px; font-weight: 800; letter-spacing: -.3px; }

/* Trend accent colors softer */
.dash-kpi-page .dash-kpi-trend-mint  { --trendAccent: #10b981; }
.dash-kpi-page .dash-kpi-trend-sky   { --trendAccent: var(--brand-500); }
.dash-kpi-page .dash-kpi-trend-lilac { --trendAccent: #6fb98f; }
.dash-kpi-page .dash-kpi-trend-peach { --trendAccent: #f59e0b; }
.dash-kpi-page .dash-kpi-trend-rose  { --trendAccent: #ef4444; }
.dash-kpi-page .dash-kpi-trend-lemon { --trendAccent: #f0b86e; }

/* ---- Charts panel — compact ---- */
.dash-kpi-page .dash-kpi-chart-grid { gap: 14px; }
.dash-kpi-page .dash-kpi-panel {
  padding: 16px 18px;
  border-radius: 16px;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  backdrop-filter: none;
}
.dash-kpi-page .dash-kpi-chart-wrap { height: 260px; min-height: 220px; }
.dash-kpi-page .dash-kpi-panel-head p { font-size: 11.5px; }
.dash-kpi-page .dash-kpi-funnel-row { font-size: 12px; }
.dash-kpi-page .dash-kpi-funnel-row strong { font-size: 14px; font-weight: 800; }
.dash-kpi-page .dash-kpi-funnel-conv {
  font-size: 10.5px;
  padding: 2px 8px;
  background: var(--pastel-lilac);
  color: #6d50d4;
  font-weight: 700;
}
.dash-kpi-page .dash-kpi-funnel-row i { height: 8px; }
.dash-kpi-page .dash-kpi-insight {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.6;
  background: linear-gradient(180deg, rgba(245,158,11,.09), var(--surface-2));
  box-shadow: inset -3px 0 0 #f59e0b;
  color: var(--text);
}

/* ---- Domain health matrix — mc-style ---- */
.dash-kpi-page .dash-kpi-health-grid { gap: 12px; }
.dash-kpi-page .dash-kpi-health {
  padding: 12px 14px;
  gap: 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.dash-kpi-page .dash-kpi-health-ring { width: 52px; height: 52px; font-size: 13px; }
.dash-kpi-page .dash-kpi-health h3 { font-size: 13px; font-weight: 700; }
.dash-kpi-page .dash-kpi-health p  { font-size: 11px; font-weight: 500; }

/* ---- Goal tracker ---- */
.dash-kpi-page .dash-kpi-goal-list { gap: 12px; }
.dash-kpi-page .dash-kpi-goal {
  padding: 14px 16px;
  border-radius: 14px;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.dash-kpi-page .dash-kpi-goal::before { width: 3px; }
.dash-kpi-page .dash-kpi-goal-head h3 { font-size: 13px; font-weight: 700; line-height: 1.5; margin-top: 4px; }
.dash-kpi-page .dash-kpi-goal-head b { font-size: 18px; font-weight: 800; letter-spacing: -.4px; }
.dash-kpi-page .dash-kpi-goal .dash-kpi-catbadge {
  font-size: 10px;
  padding: 2px 8px;
  background: var(--pastel-sky);
  color: #3b5998;
}
.dash-kpi-page .dash-kpi-goal-mint  .dash-kpi-catbadge { background: var(--pastel-mint);  color: #2f8a5e; }
.dash-kpi-page .dash-kpi-goal-lilac .dash-kpi-catbadge { background: var(--pastel-lilac); color: #6d50d4; }
.dash-kpi-page .dash-kpi-goal-peach .dash-kpi-catbadge { background: var(--pastel-peach); color: #c46920; }
.dash-kpi-page .dash-kpi-goal-rose  .dash-kpi-catbadge { background: var(--pastel-rose);  color: #b14458; }
.dash-kpi-page .dash-kpi-goal-lemon .dash-kpi-catbadge { background: var(--pastel-lemon); color: #a37919; }
.dash-kpi-page .dash-kpi-goal-bar { height: 6px; }
.dash-kpi-page .dash-kpi-goal-meta { font-size: 10.5px; gap: 6px; }
.dash-kpi-page .dash-kpi-goal-meta b { font-size: 11.5px; }

/* Goal accent softer */
.dash-kpi-page .dash-kpi-goal-mint  { --goalAccent: #10b981; }
.dash-kpi-page .dash-kpi-goal-sky   { --goalAccent: var(--brand-500); }
.dash-kpi-page .dash-kpi-goal-lilac { --goalAccent: #6fb98f; }
.dash-kpi-page .dash-kpi-goal-peach { --goalAccent: #f59e0b; }
.dash-kpi-page .dash-kpi-goal-rose  { --goalAccent: #ef4444; }
.dash-kpi-page .dash-kpi-goal-lemon { --goalAccent: #f0b86e; }

/* ---- Movers list ---- */
.dash-kpi-page .dash-kpi-movers-grid { gap: 14px; }
.dash-kpi-page .dash-kpi-movers { padding: 16px 18px; }
.dash-kpi-page .dash-kpi-movers ul { gap: 6px; }
.dash-kpi-page .dash-kpi-movers li {
  padding: 10px 12px;
  border-radius: 12px;
  gap: 10px;
  background: var(--surface-2);
  border: none;
  grid-template-columns: 24px 1fr auto auto;
}
.dash-kpi-page .dash-kpi-movers li:hover { background: var(--surface-3); }
.dash-kpi-page .dash-kpi-movers li b {
  width: 22px; height: 22px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(111,185,143,0.14);
  color: var(--brand-700);
}
.dash-kpi-page .dash-kpi-movers li strong { font-size: 12.5px; font-weight: 700; line-height: 1.3; }
.dash-kpi-page .dash-kpi-movers li span:not(.dash-kpi-mover-delta) { font-size: 10.5px; font-weight: 500; }
.dash-kpi-page .dash-kpi-movers li em { font-size: 12px; font-weight: 800; letter-spacing: -.3px; }
.dash-kpi-page .dash-kpi-mover-delta {
  font-size: 10.5px;
  padding: 3px 9px;
  font-weight: 800;
  border-radius: 999px;
}
.dash-kpi-page .dash-kpi-mover-delta.up   { background: var(--green-50); color: #2f8a5e; }
.dash-kpi-page .dash-kpi-mover-delta.down { background: var(--red-50);   color: #b14458; }
.dash-kpi-page .dash-kpi-movers-up   { border-top: 2px solid #10b981; }
.dash-kpi-page .dash-kpi-movers-down { border-top: 2px solid #ef4444; }

/* ---- Spotlight — compact hero banner ---- */
.dash-kpi-page .dash-kpi-spotlight {
  padding: 20px 22px;
  border-radius: 18px;
  gap: 20px;
  background:
    radial-gradient(circle at 8% 0%, rgba(111,185,143,0.18), transparent 42%),
    radial-gradient(circle at 92% 100%, rgba(34,211,238,0.14), transparent 46%),
    linear-gradient(135deg, var(--surface), var(--surface-2)) !important;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.dash-kpi-page .dash-kpi-spot-copy > span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--brand-700);
}
.dash-kpi-page .dash-kpi-spot-copy h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.3px;
  margin: 4px 0 0;
}
.dash-kpi-page .dash-kpi-spot-copy p { font-size: 12.5px; line-height: 1.75; font-weight: 500; color: var(--text-muted); }
.dash-kpi-page .dash-kpi-spot-main { gap: 10px; }
.dash-kpi-page .dash-kpi-spot-main strong { font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.dash-kpi-page .dash-kpi-spot-main em {
  font-size: 11.5px;
  padding: 4px 10px;
  background: var(--green-50);
  color: #2f8a5e;
  font-weight: 800;
}
.dash-kpi-page .dash-kpi-spot-action {
  padding: 12px 14px;
  border-radius: 12px;
  gap: 4px;
  background: rgba(255,255,255,0.55);
  border: 1px dashed rgba(111,185,143,0.32);
}
.dash-kpi-page .dash-kpi-spot-action b { font-size: 11.5px; }
.dash-kpi-page .dash-kpi-spot-action span { font-size: 12px; font-weight: 500; line-height: 1.6; }
.dash-kpi-page .dash-kpi-spot-contrib {
  padding: 14px;
  border-radius: 14px;
  gap: 8px;
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--border);
}
.dash-kpi-page .dash-kpi-spot-contrib > span { font-size: 11px; }
.dash-kpi-page .dash-kpi-spot-contrib li {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
}
.dash-kpi-page .dash-kpi-spot-contrib strong { font-size: 12px; font-weight: 700; }
.dash-kpi-page .dash-kpi-spot-contrib em { font-size: 11px; font-weight: 800; }

/* ---- Segment split cards ---- */
.dash-kpi-page .dash-kpi-segment-grid { gap: 12px; }
.dash-kpi-page .dash-kpi-segment {
  padding: 14px 16px;
  border-radius: 14px;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.dash-kpi-page .dash-kpi-segment::before {
  content: '';
  position: absolute;
  top: -30px;
  inset-inline-end: -30px;
  width: 130px; height: 130px;
  border-radius: 50%;
  background: var(--segSoft, var(--pastel-sky));
  filter: blur(36px);
  opacity: .5;
  pointer-events: none;
  z-index: -1;
}
.dash-kpi-page .dash-kpi-seg-head h3 { font-size: 13px; font-weight: 700; }
.dash-kpi-page .dash-kpi-seg-head b {
  padding: 2px 9px;
  font-size: 11px;
  background: color-mix(in srgb, var(--segSoft) 62%, var(--surface));
  font-weight: 700;
}
.dash-kpi-page .dash-kpi-segment > strong { font-size: 20px; font-weight: 800; letter-spacing: -.5px; }
.dash-kpi-page .dash-kpi-seg-count { font-size: 11px; font-weight: 600; }
.dash-kpi-page .dash-kpi-seg-bar { height: 5px; margin-top: 2px; }
.dash-kpi-page .dash-kpi-segment p { font-size: 11px; line-height: 1.55; font-weight: 500; }

/* Segment accent softer */
.dash-kpi-page .dash-kpi-seg-mint  { --segAccent: #10b981; }
.dash-kpi-page .dash-kpi-seg-sky   { --segAccent: var(--brand-500); }
.dash-kpi-page .dash-kpi-seg-lilac { --segAccent: #6fb98f; }
.dash-kpi-page .dash-kpi-seg-lemon { --segAccent: #f0b86e; }
.dash-kpi-page .dash-kpi-seg-peach { --segAccent: #f59e0b; }

/* ---- SLA heatmap tighter ---- */
.dash-kpi-page .dash-kpi-heatmap { gap: 6px; grid-template-columns: 84px repeat(7, 1fr); }
.dash-kpi-page .dash-kpi-heatmap b,
.dash-kpi-page .dash-kpi-heatmap strong { font-size: 11px; font-weight: 700; }
.dash-kpi-page .dash-kpi-heatmap span { height: 28px; border-radius: 8px; }

/* ---- Risk table ---- */
.dash-kpi-page .dash-kpi-risk-list { gap: 8px; }
.dash-kpi-page .dash-kpi-risk-row {
  padding: 10px 12px;
  gap: 8px;
  border-radius: 12px;
  background: var(--surface-2);
  border: none;
}
.dash-kpi-page .dash-kpi-risk-row span { font-size: 10.5px; font-weight: 600; }
.dash-kpi-page .dash-kpi-risk-row strong { font-size: 12px; font-weight: 700; line-height: 1.5; }

/* ---- Automation impact ---- */
.dash-kpi-page .dash-kpi-automation {
  padding: 18px 20px;
  border-radius: 18px;
  gap: 16px;
  background:
    linear-gradient(135deg, rgba(221,214,254,.35), rgba(184,230,211,.20)),
    var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.dash-kpi-page .dash-kpi-auto-stats { gap: 8px; margin-top: 12px; }
.dash-kpi-page .dash-kpi-auto-stats div {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.6);
}
.dash-kpi-page .dash-kpi-auto-stats strong { font-size: 17px; font-weight: 800; letter-spacing: -.4px; }
.dash-kpi-page .dash-kpi-auto-stats span { font-size: 10.5px; font-weight: 600; }
.dash-kpi-page .dash-kpi-donut { width: 160px; }
.dash-kpi-page .dash-kpi-donut span { font-size: 22px; font-weight: 800; }
.dash-kpi-page .dash-kpi-donut-legend { font-size: 11.5px; font-weight: 600; gap: 6px; }
.dash-kpi-page .dash-kpi-donut-legend span { gap: 6px; }
.dash-kpi-page .dash-kpi-donut-legend i { width: 8px; height: 8px; }

/* ---- AI Decision cards ---- */
.dash-kpi-page .dash-kpi-decision-grid { gap: 14px; }
.dash-kpi-page .dash-kpi-decision {
  padding: 14px 16px;
  border-radius: 14px;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.dash-kpi-page .dash-kpi-decision-num {
  width: 30px; height: 30px;
  border-radius: 10px;
  font-size: 13px;
  background: rgba(111,185,143,0.14);
  color: var(--brand-700);
}
.dash-kpi-page .dash-kpi-decision h3 { font-size: 13.5px; font-weight: 700; line-height: 1.5; }
.dash-kpi-page .dash-kpi-decision p  { font-size: 11.5px; font-weight: 500; line-height: 1.6; }
.dash-kpi-page .dash-kpi-decision > strong { font-size: 12px; font-weight: 800; }
.dash-kpi-page .dash-kpi-actions { gap: 6px; margin-top: 4px; }
.dash-kpi-page .dash-kpi-actions button {
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.dash-kpi-page .dash-kpi-actions button:hover {
  background: rgba(111,185,143,0.10);
  border-color: rgba(111,185,143,0.28);
  color: var(--text);
}

/* KPI page typography aligned with Mission-Control dashboard */
.dash-kpi-page,
.dash-kpi-page button {
  font-family: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
  letter-spacing: 0;
}

.dash-kpi-eyebrow,
.dash-kpi-section-head span,
.dash-kpi-panel-head span,
.dash-kpi-automation-copy > span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.dash-kpi-hero h1 {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.45;
  color: var(--text);
}

.dash-kpi-hero p,
.dash-kpi-panel-head p {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.9;
  color: var(--text-muted);
}

.dash-kpi-mini span,
.dash-kpi-mini em,
.dash-kpi-card p,
.dash-kpi-health p,
.dash-kpi-risk-row span,
.dash-kpi-auto-stats span,
.dash-kpi-decision p,
.dash-kpi-insight,
.dash-kpi-donut-legend {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.8;
  color: var(--text-muted);
}

.dash-kpi-mini strong,
.dash-kpi-value,
.dash-kpi-auto-stats strong {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
}

.dash-kpi-section-head h2,
.dash-kpi-panel-head h3,
.dash-kpi-automation h2 {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.55;
}

.dash-kpi-card h3,
.dash-kpi-health h3,
.dash-kpi-decision h3 {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.65;
}

.dash-kpi-meta,
.dash-kpi-status,
.dash-kpi-chip,
.dash-kpi-funnel-row,
.dash-kpi-heatmap b,
.dash-kpi-heatmap strong,
.dash-kpi-risk-row strong,
.dash-kpi-decision > strong,
.dash-kpi-actions button {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

.dash-kpi-meta,
.dash-kpi-status,
.dash-kpi-chip {
  color: var(--text-muted);
}

.dash-kpi-ring span {
  color: var(--text);
  font-size: 36px;
  font-weight: 800;
}

.dash-kpi-ring small,
.dash-kpi-ring b {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.65;
}

.dash-kpi-donut span {
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
}

[data-theme="dark"] .dash-kpi-eyebrow,
[data-theme="dark"] .dash-kpi-section-head span,
[data-theme="dark"] .dash-kpi-panel-head span,
[data-theme="dark"] .dash-kpi-automation-copy > span,
[data-theme="dark"] .dash-kpi-decision > strong {
  color: var(--pastel-sky);
}

@media (max-width: 1180px) {
  .dash-kpi-snapshot,
  .dash-kpi-health-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dash-kpi-risk-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .dash-kpi-hero,
  .dash-kpi-chart-grid,
  .dash-kpi-chart-grid-balanced,
  .dash-kpi-automation,
  .dash-kpi-decision-grid {
    grid-template-columns: 1fr;
  }
  .dash-kpi-hero-stats,
  .dash-kpi-auto-stats {
    grid-template-columns: 1fr;
  }
  .dash-kpi-radar {
    min-height: 300px;
  }
  .dash-kpi-donut {
    margin-inline: auto;
  }
}

@media (max-width: 640px) {
  .dash-kpi-page {
    gap: 16px;
  }
  .dash-kpi-hero,
  .dash-kpi-panel,
  .dash-kpi-automation {
    border-radius: 18px;
    padding: 16px;
  }
  .dash-kpi-snapshot,
  .dash-kpi-health-grid {
    grid-template-columns: 1fr;
  }
  .dash-kpi-section-head,
  .dash-kpi-panel-head {
    align-items: start;
    flex-direction: column;
  }
  .dash-kpi-chip {
    white-space: normal;
  }
  .dash-kpi-chart-wrap {
    height: 280px;
  }
  .dash-kpi-heatmap {
    grid-template-columns: 76px repeat(7, minmax(18px, 1fr));
    gap: 6px;
  }
  .dash-kpi-heatmap span {
    height: 28px;
    border-radius: 8px;
  }
  .dash-kpi-risk-row {
    grid-template-columns: 1fr;
  }
}


/* Dashboard alerts & opportunities page */
.dash-alerts-page {
  display: grid;
  gap: 18px;
  direction: rtl;
  font-family: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
}

.dash-alerts-hero,
.dash-alerts-panel,
.dash-alerts-summary,
.dash-alerts-decision-card,
.dash-alerts-opportunity,
.dash-alerts-ai-card,
.dash-alerts-filterbar {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 88%, transparent), color-mix(in srgb, var(--surface-2) 78%, transparent)),
    radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--pastel-lilac) 26%, transparent), transparent 34%),
    radial-gradient(circle at 94% 96%, color-mix(in srgb, var(--pastel-mint) 22%, transparent), transparent 32%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.dash-alerts-hero {
  min-height: 360px;
  border-radius: 20px;
  padding: 22px;
  display: grid;
  grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr);
  gap: 22px;
  align-items: center;
  overflow: hidden;
}

.dash-alerts-radar {
  min-height: 300px;
  display: grid;
  place-items: center;
  position: relative;
  isolation: isolate;
}

.dash-alerts-radar::before {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, transparent 0 38px, color-mix(in srgb, var(--brand-500) 14%, transparent) 39px 40px),
    conic-gradient(from 120deg, color-mix(in srgb, var(--pastel-rose) 34%, transparent), color-mix(in srgb, var(--pastel-sky) 36%, transparent), color-mix(in srgb, var(--pastel-mint) 38%, transparent), color-mix(in srgb, var(--pastel-rose) 34%, transparent));
  animation: spinSlow 28s linear infinite;
  z-index: -1;
}

.dash-alerts-orb {
  width: 178px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  text-align: center;
  background:
    radial-gradient(circle, var(--surface) 0 55%, transparent 56%),
    conic-gradient(var(--brand-500) calc(var(--score) * 1%), color-mix(in srgb, var(--border) 65%, transparent) 0);
  box-shadow: inset 0 0 0 1px var(--border), 0 18px 42px rgba(44, 120, 115, .16);
}

.dash-alerts-orb strong {
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
}

.dash-alerts-orb span,
.dash-alerts-wave {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.dash-alerts-wave {
  position: absolute;
  padding: 6px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 76%, transparent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.dash-alerts-wave.wave-1 { top: 38px; right: 36px; }
.dash-alerts-wave.wave-2 { bottom: 52px; right: 18px; }
.dash-alerts-wave.wave-3 { left: 24px; top: 118px; }

.dash-alerts-radar > .dash-alerts-sparkline {
  position: absolute;
  bottom: 22px;
  width: 70%;
  height: 38px;
}

.dash-alerts-hero-copy h1,
.dash-alerts-head h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.45;
}

.dash-alerts-hero-copy p,
.dash-alerts-summary p,
.dash-alerts-decision-card p,
.dash-alerts-opportunity p,
.dash-alerts-opportunity em,
.dash-alerts-ai-card p,
.dash-alerts-timeline p,
.dash-alerts-reason-list p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.85;
}

.dash-alerts-status-pill,
.dash-alerts-soft-chip,
.dash-alerts-head span,
.dash-alerts-card-head span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.dash-alerts-status-pill,
.dash-alerts-soft-chip {
  display: inline-flex;
  width: fit-content;
  padding: 7px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pastel-lilac) 38%, var(--surface));
  border: 1px solid var(--border);
}

.dash-alerts-hero-cards,
.dash-alerts-summary-grid,
.dash-alerts-opportunity-grid,
.dash-alerts-decision-grid {
  display: grid;
  gap: 12px;
}

.dash-alerts-hero-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 20px;
}

.dash-alerts-mini {
  min-height: 104px;
  padding: 13px;
  border-radius: 15px;
  border: 1px solid var(--border);
  display: grid;
  gap: 3px;
}

.dash-alerts-mini span,
.dash-alerts-mini em,
.dash-alerts-metrics span,
.dash-alerts-op-meta span,
.dash-alerts-reason span,
.dash-alerts-actionline span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  font-style: normal;
}

.dash-alerts-mini strong,
.dash-alerts-summary > strong,
.dash-alerts-metrics strong,
.dash-alerts-op-meta strong,
.dash-alerts-ai-card strong {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
}

.dash-alerts-mini-rose { background: color-mix(in srgb, var(--pastel-rose) 34%, var(--surface)); }
.dash-alerts-mini-mint { background: color-mix(in srgb, var(--pastel-mint) 36%, var(--surface)); }
.dash-alerts-mini-peach { background: color-mix(in srgb, var(--pastel-peach) 42%, var(--surface)); }
.dash-alerts-mini-sky { background: color-mix(in srgb, var(--pastel-sky) 36%, var(--surface)); }

.dash-alerts-section,
.dash-alerts-decisions {
  display: grid;
  gap: 12px;
}

.dash-alerts-head,
.dash-alerts-card-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.dash-alerts-summary-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.dash-alerts-summary {
  border-radius: 17px;
  padding: 15px;
  display: grid;
  gap: 8px;
  min-height: 214px;
  animation: slideUp .4s ease both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.dash-alerts-summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-alerts-summary-top i {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--pastel-sky) 42%, var(--surface));
  font-style: normal;
  font-weight: 800;
}

.dash-alerts-summary-top b,
.dash-alerts-card-head b,
.dash-alerts-timeline b,
.dash-alerts-ai-card > b {
  padding: 5px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pastel-peach) 42%, var(--surface));
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
}

.dash-alerts-good .dash-alerts-summary-top b,
.dash-alerts-opportunity .dash-alerts-card-head b {
  background: color-mix(in srgb, var(--pastel-mint) 44%, var(--surface));
}

.dash-alerts-summary h3,
.dash-alerts-card-head h3,
.dash-alerts-ai-card h3,
.dash-alerts-timeline h3 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.65;
}

.dash-alerts-sparkline {
  width: 100%;
  height: 38px;
}

.dash-alerts-sparkline path {
  fill: none;
  stroke: var(--brand-500);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dash-alerts-filterbar {
  border-radius: 16px;
  padding: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.dash-alerts-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dash-alerts-filters button,
.dash-alerts-actions button,
.dash-alerts-sort select {
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.dash-alerts-filters button.active {
  background: color-mix(in srgb, var(--brand-500) 16%, var(--surface));
  border-color: color-mix(in srgb, var(--brand-500) 34%, var(--border));
}

.dash-alerts-sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.dash-alerts-alert-list {
  display: grid;
  gap: 12px;
}

.dash-alerts-decision-card,
.dash-alerts-opportunity,
.dash-alerts-ai-card,
.dash-alerts-panel {
  border-radius: 17px;
  padding: 16px;
  display: grid;
  gap: 12px;
  animation: slideUp .42s ease both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.dash-alerts-decision-card {
  border-inline-start: 4px solid color-mix(in srgb, var(--pastel-rose) 88%, var(--red-500));
}

.dash-alerts-sev-medium {
  border-inline-start-color: color-mix(in srgb, var(--pastel-peach) 80%, var(--amber-500));
}

.dash-alerts-metrics,
.dash-alerts-op-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.dash-alerts-metrics div,
.dash-alerts-op-meta div,
.dash-alerts-reason,
.dash-alerts-actionline {
  padding: 10px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface-2) 62%, transparent);
  display: grid;
  gap: 2px;
}

.dash-alerts-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dash-alerts-actions button:hover,
.dash-alerts-filters button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.dash-alerts-opportunity-grid {
  grid-template-columns: repeat(3, minmax(260px, 1fr));
}

.dash-alerts-opportunity {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--pastel-mint) 24%, var(--surface)), color-mix(in srgb, var(--pastel-sky) 18%, var(--surface)));
}

.dash-alerts-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.dash-alerts-chart-wrap {
  height: 330px;
  position: relative;
}

.dash-alerts-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.dash-alerts-matrix {
  min-height: 330px;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background:
    linear-gradient(90deg, transparent 49.7%, var(--border) 50%, transparent 50.3%),
    linear-gradient(0deg, transparent 49.7%, var(--border) 50%, transparent 50.3%),
    linear-gradient(135deg, color-mix(in srgb, var(--pastel-rose) 16%, var(--surface)), color-mix(in srgb, var(--pastel-mint) 18%, var(--surface)));
  border: 1px solid var(--border);
}

.matrix-zone,
.matrix-label {
  position: absolute;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
}

.z1 { top: 12px; right: 14px; }
.z2 { top: 12px; left: 14px; }
.z3 { bottom: 12px; right: 14px; }
.z4 { bottom: 12px; left: 14px; }
.label-top { top: 50%; right: 8px; transform: rotate(-90deg) translateX(50%); transform-origin: right center; }
.label-bottom { bottom: 8px; right: 50%; transform: translateX(50%); }

.dash-alerts-bubble {
  position: absolute;
  right: calc(var(--x) - 22px);
  top: calc(var(--y) - 22px);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--pastel-rose) 62%, var(--surface));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--brand-500) 12%, transparent);
}

.dash-alerts-bubble-opportunity {
  background: color-mix(in srgb, var(--pastel-mint) 68%, var(--surface));
}

.dash-alerts-bubble span {
  position: absolute;
  right: 50%;
  top: calc(100% + 4px);
  transform: translateX(50%);
  width: 112px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
}

.dash-alerts-timeline {
  display: grid;
  gap: 10px;
}

.dash-alerts-timeline article {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2) 62%, transparent);
}

.dash-alerts-timeline time {
  color: var(--brand-600);
  font-weight: 800;
}

.dash-alerts-reason-list {
  display: grid;
  gap: 10px;
}

.dash-alerts-reason-list div {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--pastel-lilac) 22%, var(--surface));
}

.dash-alerts-reason-list span,
.dash-alerts-ai-num {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--brand-500) 16%, var(--surface));
  color: var(--text);
  font-weight: 800;
}

.dash-alerts-decision-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dash-alerts-ai-card {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--pastel-lilac) 30%, var(--surface)), color-mix(in srgb, var(--surface) 80%, transparent)),
    radial-gradient(circle at 0 0, color-mix(in srgb, var(--brand-500) 12%, transparent), transparent 38%);
}

[data-theme="dark"] .dash-alerts-status-pill,
[data-theme="dark"] .dash-alerts-soft-chip {
  color: var(--pastel-sky);
}

@media (max-width: 1180px) {
  .dash-alerts-summary-grid,
  .dash-alerts-opportunity-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .dash-alerts-hero,
  .dash-alerts-grid-2,
  .dash-alerts-decision-grid {
    grid-template-columns: 1fr;
  }
  .dash-alerts-hero-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dash-alerts-metrics,
  .dash-alerts-op-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .dash-alerts-page {
    gap: 14px;
  }
  .dash-alerts-hero,
  .dash-alerts-panel,
  .dash-alerts-decision-card,
  .dash-alerts-opportunity,
  .dash-alerts-ai-card,
  .dash-alerts-filterbar {
    padding: 14px;
    border-radius: 16px;
  }
  .dash-alerts-summary-grid,
  .dash-alerts-opportunity-grid,
  .dash-alerts-hero-cards,
  .dash-alerts-metrics,
  .dash-alerts-op-meta {
    grid-template-columns: 1fr;
  }
  .dash-alerts-filterbar,
  .dash-alerts-head,
  .dash-alerts-card-head {
    align-items: start;
    flex-direction: column;
  }
  .dash-alerts-radar {
    min-height: 270px;
  }
  .dash-alerts-timeline article {
    grid-template-columns: 1fr;
  }
}

/* Alerts page: align typography and color system with Mission-Control overview */
.dash-alerts-page,
.dash-alerts-page button,
.dash-alerts-page select {
  font-family: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
  letter-spacing: 0;
}

.dash-alerts-hero,
.dash-alerts-panel,
.dash-alerts-summary,
.dash-alerts-decision-card,
.dash-alerts-opportunity,
.dash-alerts-ai-card,
.dash-alerts-filterbar {
  background:
    radial-gradient(circle at 8% 0%, rgba(111,185,143,.11), transparent 42%),
    radial-gradient(circle at 92% 100%, rgba(34,211,238,.08), transparent 46%),
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 92%, transparent), color-mix(in srgb, var(--surface-2) 76%, transparent));
  border-color: var(--border);
  box-shadow: var(--shadow);
}

.dash-alerts-hero {
  min-height: 300px;
  padding: 18px 22px;
  border-radius: 18px;
  grid-template-columns: 220px 1fr;
}

.dash-alerts-radar {
  min-height: 230px;
}

.dash-alerts-radar::before {
  width: 220px;
  height: 220px;
  background:
    repeating-radial-gradient(circle, transparent 0 31px, rgba(44,120,115,.13) 32px 33px),
    conic-gradient(from 120deg, rgba(232,120,140,.10), rgba(44,120,115,.14), rgba(109,191,143,.12), rgba(232,120,140,.10));
}

.dash-alerts-orb {
  width: 142px;
  background:
    radial-gradient(circle, var(--surface) 0 56%, transparent 57%),
    conic-gradient(var(--brand-500) calc(var(--score) * 1%), color-mix(in srgb, var(--border) 68%, transparent) 0);
}

.dash-alerts-orb strong {
  font-size: 24px;
  font-weight: 800;
}

.dash-alerts-orb span,
.dash-alerts-wave,
.dash-alerts-status-pill,
.dash-alerts-soft-chip,
.dash-alerts-head span,
.dash-alerts-card-head span,
.dash-alerts-mini span,
.dash-alerts-mini em,
.dash-alerts-metrics span,
.dash-alerts-op-meta span,
.dash-alerts-reason span,
.dash-alerts-actionline span,
.dash-alerts-timeline p,
.dash-alerts-reason-list p,
.dash-alerts-summary p,
.dash-alerts-decision-card p,
.dash-alerts-opportunity p,
.dash-alerts-opportunity em,
.dash-alerts-ai-card p {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.75;
}

.dash-alerts-wave {
  background: rgba(255,255,255,.52);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}

[data-theme="dark"] .dash-alerts-wave {
  background: rgba(15,29,63,.68);
}

.dash-alerts-wave.wave-1 { top: 28px; right: 18px; }
.dash-alerts-wave.wave-2 { bottom: 38px; right: 10px; }
.dash-alerts-wave.wave-3 { left: 8px; top: 96px; }

.dash-alerts-radar > .dash-alerts-sparkline {
  bottom: 16px;
  height: 34px;
}

.dash-alerts-hero-copy h1 {
  margin: 6px 0 2px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.55;
  color: var(--text);
}

.dash-alerts-hero-copy p {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.8;
}

.dash-alerts-head h2 {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.55;
  color: var(--text);
}

.dash-alerts-status-pill,
.dash-alerts-soft-chip {
  background: rgba(255,255,255,.52);
  color: var(--text-muted);
  border-color: var(--border);
}

[data-theme="dark"] .dash-alerts-status-pill,
[data-theme="dark"] .dash-alerts-soft-chip {
  background: rgba(15,29,63,.68);
  color: var(--text-muted);
}

.dash-alerts-hero-cards {
  gap: 8px;
  margin-top: 14px;
}

.dash-alerts-mini {
  min-height: 88px;
  padding: 11px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.48);
}

[data-theme="dark"] .dash-alerts-mini {
  background: rgba(15,29,63,.62);
}

.dash-alerts-mini-rose,
.dash-alerts-sev-urgent,
.dash-alerts-sev-high {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--pastel-rose) 18%, var(--surface)), color-mix(in srgb, var(--surface) 86%, transparent));
}

.dash-alerts-mini-peach,
.dash-alerts-sev-medium {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--pastel-peach) 22%, var(--surface)), color-mix(in srgb, var(--surface) 86%, transparent));
}

.dash-alerts-mini-mint,
.dash-alerts-opportunity {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--pastel-mint) 18%, var(--surface)), color-mix(in srgb, var(--surface) 88%, transparent));
  align-content: start;
}

.dash-alerts-opportunity .dash-alerts-card-head {
  align-items: start;
}

.dash-alerts-opportunity .dash-alerts-card-head h3 {
  max-width: 100%;
}

.dash-alerts-opportunity .dash-alerts-card-head b {
  flex: 0 0 auto;
}

.dash-alerts-opportunity .dash-alerts-op-meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dash-alerts-opportunity .dash-alerts-op-meta div {
  min-width: 0;
  align-content: start;
  padding: 9px 10px;
}

.dash-alerts-opportunity .dash-alerts-op-meta span {
  white-space: normal;
}

.dash-alerts-opportunity .dash-alerts-op-meta strong {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  font-size: 14px;
  line-height: 1.65;
}

.dash-alerts-mini-sky {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--pastel-sky) 18%, var(--surface)), color-mix(in srgb, var(--surface) 88%, transparent));
}

.dash-alerts-mini strong,
.dash-alerts-summary > strong,
.dash-alerts-metrics strong,
.dash-alerts-op-meta strong,
.dash-alerts-ai-card strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.4;
}

.dash-alerts-summary-grid {
  gap: 10px;
}

.dash-alerts-summary {
  min-height: 188px;
  padding: 13px;
  border-radius: 14px;
}

.dash-alerts-summary h3,
.dash-alerts-card-head h3,
.dash-alerts-ai-card h3,
.dash-alerts-timeline h3 {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.65;
}

.dash-alerts-summary-top i {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(44,120,115,.10);
  color: var(--text);
  font-size: 12px;
}

.dash-alerts-summary-top b,
.dash-alerts-card-head b,
.dash-alerts-timeline b,
.dash-alerts-ai-card > b {
  background: rgba(240,184,110,.16);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
}

.dash-alerts-good .dash-alerts-summary-top b,
.dash-alerts-opportunity .dash-alerts-card-head b {
  background: rgba(109,191,143,.16);
}

.dash-alerts-sparkline {
  height: 34px;
}

.dash-alerts-sparkline path {
  stroke: var(--brand-500);
  stroke-width: 2.4;
  opacity: .86;
}

.dash-alerts-filterbar {
  padding: 10px;
  border-radius: 14px;
}

.dash-alerts-filters button,
.dash-alerts-actions button,
.dash-alerts-sort select {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.dash-alerts-actions button {
  background: var(--surface);
  color: var(--text);
}

.dash-alerts-filters button.active {
  color: var(--text);
  background: rgba(44,120,115,.12);
  border-color: rgba(44,120,115,.24);
}

.dash-alerts-decision-card,
.dash-alerts-opportunity,
.dash-alerts-ai-card,
.dash-alerts-panel {
  padding: 14px;
  border-radius: 14px;
}

.dash-alerts-decision-card {
  border-inline-start-width: 3px;
  border-inline-start-color: rgba(232,120,140,.48);
}

.dash-alerts-sev-medium {
  border-inline-start-color: rgba(240,184,110,.55);
}

.dash-alerts-metrics,
.dash-alerts-op-meta {
  gap: 8px;
}

.dash-alerts-metrics div,
.dash-alerts-op-meta div,
.dash-alerts-reason,
.dash-alerts-actionline,
.dash-alerts-timeline article,
.dash-alerts-reason-list div {
  background: color-mix(in srgb, var(--surface-2) 54%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  border-radius: 12px;
}

.dash-alerts-matrix {
  background:
    linear-gradient(90deg, transparent 49.7%, var(--border) 50%, transparent 50.3%),
    linear-gradient(0deg, transparent 49.7%, var(--border) 50%, transparent 50.3%),
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 82%, transparent), color-mix(in srgb, var(--surface-2) 74%, transparent));
}

.dash-alerts-bubble {
  background: rgba(232,120,140,.28);
  border-color: rgba(232,120,140,.26);
}

.dash-alerts-bubble-opportunity {
  background: rgba(109,191,143,.30);
  border-color: rgba(109,191,143,.28);
}

.dash-alerts-chart-wrap {
  height: 310px;
}

.dash-alerts-ai-card {
  background:
    radial-gradient(circle at 0 0, rgba(44,120,115,.10), transparent 38%),
    linear-gradient(135deg, color-mix(in srgb, var(--pastel-lilac) 16%, var(--surface)), color-mix(in srgb, var(--surface) 88%, transparent));
}

.dash-alerts-ai-num,
.dash-alerts-reason-list span {
  background: rgba(44,120,115,.12);
  color: var(--text);
  font-size: 12px;
}

@media (max-width: 900px) {
  .dash-alerts-hero {
    grid-template-columns: 1fr;
  }
}

/* Alerts summary cards should mirror the KPI card language */
.dash-alerts-summary-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.dash-alerts-summary {
  min-height: 250px;
  padding: 17px;
  border-radius: 18px;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 90%, transparent), color-mix(in srgb, var(--surface-2) 82%, transparent)),
    radial-gradient(circle at 18% 18%, color-mix(in srgb, var(--pastel-lilac) 18%, transparent), transparent 34%),
    radial-gradient(circle at 92% 100%, color-mix(in srgb, var(--pastel-sky) 18%, transparent), transparent 34%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.dash-alerts-summary:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.dash-alerts-summary-top {
  align-items: start;
}

.dash-alerts-summary-top i {
  order: 2;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--pastel-sky) 34%, var(--surface));
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.dash-alerts-summary-top b {
  order: 1;
  min-width: 44px;
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pastel-peach) 40%, var(--surface));
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}

.dash-alerts-good .dash-alerts-summary-top b {
  background: color-mix(in srgb, var(--pastel-mint) 40%, var(--surface));
}

.dash-alerts-summary h3 {
  margin-top: 4px;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.55;
}

.dash-alerts-summary > strong {
  color: var(--text);
  font-size: 24px;
  font-weight: 900;
  line-height: 1.25;
}

.dash-alerts-summary p {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.8;
}

.dash-alerts-summary .dash-alerts-sparkline {
  align-self: end;
  height: 42px;
}

.dash-alerts-summary .dash-alerts-sparkline path {
  stroke: var(--brand-500);
  stroke-width: 3;
  opacity: .86;
  filter: drop-shadow(0 4px 6px rgba(44, 120, 115, .14));
}

.dash-alerts-summary .dash-alerts-sparkline {
  display: none;
}

@media (max-width: 1180px) {
  .dash-alerts-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .dash-alerts-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .dash-alerts-summary-grid {
    grid-template-columns: 1fr;
  }
}

/* Alerts radar readability fix */
.dash-alerts-radar {
  padding: 18px 24px 48px;
  overflow: visible;
}

.dash-alerts-orb {
  position: relative;
  z-index: 2;
}

.dash-alerts-orb span {
  width: 92px;
  line-height: 1.45;
  text-align: center;
  display: block;
}

.dash-alerts-wave {
  z-index: 3;
  white-space: nowrap;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.4;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .06);
}

.dash-alerts-wave.wave-1 { top: 18px; right: 4px; }
.dash-alerts-wave.wave-2 { bottom: 22px; right: 12px; }
.dash-alerts-wave.wave-3 { left: 0; top: 88px; }

.dash-alerts-radar > .dash-alerts-sparkline {
  bottom: 4px;
  width: 62%;
  height: 32px;
  z-index: 1;
  opacity: .78;
}

@media (max-width: 640px) {
  .dash-alerts-wave.wave-1 { top: 14px; right: 2px; }
  .dash-alerts-wave.wave-2 { bottom: 18px; right: 8px; }
  .dash-alerts-wave.wave-3 { left: 0; top: 92px; }
}

/* Alerts buttons: match Mission-Control hover behavior */
.dash-alerts-filters button,
.dash-alerts-actions button,
.dash-alerts-sort select {
  transition: color .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
  background: var(--surface);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  box-shadow: var(--shadow-xs);
}

.dash-alerts-filters button:hover,
.dash-alerts-actions button:hover {
  color: var(--text);
  background: var(--surface);
  border-color: color-mix(in srgb, var(--border) 70%, var(--text-muted) 12%);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.dash-alerts-filters button:active,
.dash-alerts-actions button:active {
  transform: translateY(0) scale(.98);
  box-shadow: var(--shadow-xs);
}

.dash-alerts-filters button.active {
  color: var(--text);
  font-weight: 800;
  background: var(--surface);
  border-color: color-mix(in srgb, var(--border) 62%, var(--text-muted) 16%);
  box-shadow: var(--shadow-sm);
}

.dash-alerts-filters button.active:hover {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--border) 58%, var(--text-muted) 18%);
}

/* Reuse overview smart-alert button language on both new dashboard pages */
.dash-alerts-actions button,
.dash-kpi-actions button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  min-height: 32px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
  transition: all .2s ease;
  transform: none;
}

.dash-alerts-actions button:hover,
.dash-kpi-actions button:hover {
  background: var(--brand-500);
  color: #fff;
  border-color: var(--brand-500);
  box-shadow: none;
  transform: none;
}

.dash-alerts-actions button:active,
.dash-kpi-actions button:active {
  transform: scale(.98);
}

/* Alerts semantic color tuning */
.dash-alerts-summary {
  position: relative;
  overflow: hidden;
  text-align: center;
  align-items: center;
  justify-items: center;
  grid-template-rows: auto auto auto 1fr auto;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface-2) 74%, transparent));
  border: 1px solid var(--border);
  border-inline-end: 4px solid var(--green-500);
}

.dash-alerts-summary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--pastel-mint) 30%, transparent), transparent 58%);
  opacity: .42;
  pointer-events: none;
}

.dash-alerts-warning {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface-2) 74%, transparent));
  border-inline-end-color: var(--amber-500);
}

.dash-alerts-good {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface-2) 74%, transparent));
  border-inline-end-color: var(--green-500);
}

.dash-alerts-warning::before {
  background: linear-gradient(180deg, color-mix(in srgb, var(--pastel-peach) 38%, transparent), transparent 58%);
}

.dash-alerts-good::before {
  background: linear-gradient(180deg, color-mix(in srgb, var(--pastel-mint) 34%, transparent), transparent 58%);
}

.dash-alerts-summary > * {
  position: relative;
  z-index: 1;
}

.dash-alerts-warning .dash-alerts-summary-top i {
  background: color-mix(in srgb, var(--pastel-peach) 62%, var(--surface));
}

.dash-alerts-good .dash-alerts-summary-top i {
  background: color-mix(in srgb, var(--pastel-mint) 58%, var(--surface));
}

.dash-alerts-warning .dash-alerts-sparkline path {
  stroke: var(--amber-500);
}

.dash-alerts-good .dash-alerts-sparkline path {
  stroke: var(--green-500);
}

.dash-alerts-summary-top {
  width: 100%;
  justify-content: center;
  gap: 16px;
}

.dash-alerts-summary-top i {
  order: 1;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 16px;
  display: grid;
}

.dash-alerts-summary-top b {
  order: 2;
  min-width: 48px;
  min-height: 36px;
  padding: 7px 12px;
}

.dash-alerts-summary h3 {
  margin-top: 6px;
  text-align: center;
  font-size: 15px;
  line-height: 1.55;
}

.dash-alerts-summary > strong {
  text-align: center;
  font-size: 26px;
  line-height: 1.2;
}

.dash-alerts-summary p {
  text-align: center;
  font-size: 13px;
  line-height: 1.75;
  max-width: 150px;
}

/* Compact executive brief cards: closer to the business overview density */
.dash-alerts-summary-grid {
  gap: 12px;
}

.dash-alerts-summary {
  min-height: 172px;
  padding: 14px 13px;
  gap: 7px;
  grid-template-rows: auto auto auto 1fr;
  border-radius: 16px;
}

.dash-alerts-summary-top {
  justify-content: center;
  gap: 0;
}

.dash-alerts-summary-top i {
  display: none;
}

.dash-alerts-summary-top b {
  min-width: 40px;
  min-height: 28px;
  padding: 4px 10px;
  font-size: 10.5px;
}

.dash-alerts-summary h3 {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.45;
}

.dash-alerts-summary > strong {
  font-size: 22px;
  line-height: 1.15;
}

.dash-alerts-summary p {
  font-size: 11.5px;
  line-height: 1.65;
  max-width: 132px;
}

.dash-alerts-sev-urgent {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--pastel-rose) 30%, var(--surface)), color-mix(in srgb, var(--surface) 86%, transparent));
  border-inline-start-color: color-mix(in srgb, var(--red-500) 58%, var(--pastel-rose));
}

/* =========================================================================
   QUICK MANAGER REPORT — Executive Daily Brief (dash-report-* namespace)
   Aligned with Mission-Control dashboard theme: soft indigo + pastels,
   16px radius, 22px padding, --brand-500 primary, matches .card / .kpi vibe.
   ========================================================================= */
.dash-report-page {
  display: grid;
  gap: 16px;
  color: var(--text);
}

/* Every panel/card in the report shares the .card baseline */
.dash-report-hero,
.dash-report-summary-card,
.dash-report-brief-card,
.dash-report-stat-card,
.dash-report-timeline,
.dash-report-channel-card,
.dash-report-chart-card,
.dash-report-ai-note,
.dash-report-action-card,
.dash-report-domain-card,
.dash-report-team-card,
.dash-report-finance-card,
.dash-report-links-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: transform .25s cubic-bezier(.22,.7,.16,1), box-shadow .25s ease, border-color .2s ease;
}

/* ---------- Hero (mirrors .dash-mc-hero — compact, soft lilac→cyan glow) ---------- */
.dash-report-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, .85fr);
  gap: 22px;
  padding: 22px 24px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 8% 0%, rgba(111,185,143,.16), transparent 42%),
    radial-gradient(circle at 92% 100%, rgba(34,211,238,.12), transparent 46%),
    linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--surface) 92%, var(--pastel-lilac) 8%));
  animation: slideUp .5s ease both;
}

.dash-report-hero::before {
  content: "";
  position: absolute;
  inset: auto -60px -100px auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(44,120,115,.10), transparent 68%);
  pointer-events: none;
}

.dash-report-hero-copy,
.dash-report-hero-mark {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.dash-report-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.dash-report-eyebrow span {
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pastel-lilac) 55%, var(--surface));
  color: var(--brand-700);
  font-weight: 800;
}

.dash-report-eyebrow b {
  color: var(--text-muted);
  font-weight: 700;
}

.dash-report-hero h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.35;
  font-weight: 800;
  letter-spacing: -.3px;
  color: var(--text);
}

.dash-report-hero p {
  max-width: 620px;
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.8;
}

.dash-report-actions,
.dash-report-periods {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dash-report-actions { margin-top: 16px; }
.dash-report-periods { margin-top: 12px; }

.dash-report-btn,
.dash-report-periods button,
.dash-report-action-card button {
  min-height: 32px;
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s, background .2s, border-color .2s, transform .2s;
}

.dash-report-btn:hover,
.dash-report-periods button:hover,
.dash-report-action-card button:hover {
  color: var(--brand-700);
  border-color: var(--brand-300);
  background: color-mix(in srgb, var(--surface) 88%, var(--pastel-lilac) 12%);
}

.dash-report-btn-primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff;
  border-color: var(--brand-600);
  font-weight: 700;
  box-shadow: 0 6px 18px -8px rgba(44,120,115,.45);
}

.dash-report-btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  color: #fff;
  border-color: var(--brand-700);
}

.dash-report-periods button { min-width: 68px; border-radius: 999px; padding: 5px 12px; }
.dash-report-periods .active {
  background: color-mix(in srgb, var(--surface) 82%, var(--pastel-sky) 18%);
  color: var(--brand-700);
  border-color: var(--brand-300);
  font-weight: 800;
}

.dash-report-hero-mark {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 14px;
  align-items: center;
}

.dash-report-hero-icon {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background:
    radial-gradient(circle at 30% 20%, rgba(111,185,143,.25), transparent 60%),
    linear-gradient(135deg, var(--brand-500), var(--purple-500));
  box-shadow: 0 12px 28px -14px rgba(44,120,115,.55);
  color: #fff;
  font-size: 34px;
  animation: float 4s ease-in-out infinite;
}

.dash-report-status-strip {
  display: grid;
  gap: 8px;
}

.dash-report-status-strip span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 62%, var(--pastel-sky) 12%);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.dash-report-status-strip b {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.dash-report-status-strip span.dash-report-tone-mint  { background: color-mix(in srgb, var(--surface) 55%, var(--pastel-mint) 18%); }
.dash-report-status-strip span.dash-report-tone-rose  { background: color-mix(in srgb, var(--surface) 55%, var(--pastel-rose) 20%); }
.dash-report-status-strip span.dash-report-tone-cyan  { background: color-mix(in srgb, var(--surface) 55%, var(--pastel-sky) 20%); }
.dash-report-status-strip span.dash-report-tone-lilac { background: color-mix(in srgb, var(--surface) 55%, var(--pastel-lilac) 20%); }
.dash-report-status-strip span.dash-report-tone-peach { background: color-mix(in srgb, var(--surface) 55%, var(--pastel-peach) 22%); }
.dash-report-status-strip span.dash-report-tone-blue  { background: color-mix(in srgb, var(--surface) 55%, var(--pastel-sky) 18%); }

/* ---------- Section head (mirrors .card-head) ---------- */
.dash-report-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.dash-report-section-head span,
.dash-report-ai-note > div:first-child span {
  display: block;
  color: var(--brand-500);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
}

.dash-report-section-head h2,
.dash-report-ai-note h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.015em;
  line-height: 1.4;
}

.dash-report-section-head > b {
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pastel-lilac) 55%, var(--surface));
  color: var(--brand-700);
  font-size: 11px;
  font-weight: 800;
}

/* ---------- Domain traffic lights (8 domains, fluid grid) ---------- */
.dash-report-domain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.dash-report-domain-card {
  --dash-report-tone-bg: var(--pastel-sky);
  --dash-report-tone-fg: var(--brand-500);
  display: grid;
  gap: 8px;
  padding: 14px 15px 14px;
  overflow: hidden;
  position: relative;
  animation: popIn .5s cubic-bezier(.34, 1.56, .64, 1) both;
  animation-delay: calc(var(--i, 0) * 55ms);
  text-decoration: none;
}

.dash-report-domain-card::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: var(--dash-report-tone-fg);
  border-radius: 3px 0 0 3px;
  opacity: .55;
}

.dash-report-domain-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--dash-report-tone-fg) 30%, transparent);
}

.dash-report-domain-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-report-domain-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--dash-report-tone-bg) 65%, var(--surface));
  font-size: 17px;
}

.dash-report-domain-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.015em;
}

.dash-report-domain-head em {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: var(--dash-report-tone-fg);
}

.dash-report-domain-score {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.dash-report-domain-score strong {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--text);
}

.dash-report-domain-score span {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.dash-report-domain-bar {
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
  overflow: hidden;
}

.dash-report-domain-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--dash-report-tone-fg), color-mix(in srgb, var(--dash-report-tone-fg) 70%, #fff));
}

.dash-report-domain-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.5;
}

/* ---------- Summary cards (6 cards) — mirrors .kpi tint style ---------- */
.dash-report-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.dash-report-summary-card {
  --dash-report-tone-bg: var(--pastel-sky);
  --dash-report-tone-fg: var(--brand-500);
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 8px;
  min-height: 200px;
  padding: 14px 16px 16px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--surface) 60%, color-mix(in srgb, var(--dash-report-tone-bg) 40%, var(--surface)) 100%);
  animation: popIn .55s cubic-bezier(.34, 1.56, .64, 1) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}

.dash-report-summary-card::before {
  content: '';
  position: absolute;
  top: -30px; inset-inline-end: -30px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: var(--dash-report-tone-bg);
  filter: blur(40px);
  opacity: .5;
  pointer-events: none;
  transition: opacity .3s ease, transform .4s cubic-bezier(.22,.7,.16,1);
  z-index: 0;
}

.dash-report-summary-card > * { position: relative; z-index: 1; }

.dash-report-summary-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: 0 18px 36px -10px color-mix(in srgb, var(--dash-report-tone-fg) 25%, transparent);
}

.dash-report-summary-card:hover::before {
  opacity: .8;
  transform: scale(1.15);
}

.dash-report-summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dash-report-summary-top span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--dash-report-tone-bg) 55%, var(--surface));
  font-size: 20px;
}

.dash-report-summary-top b,
.dash-report-channel-card b,
.dash-report-timeline-item em {
  padding: 4px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--dash-report-tone-bg) 45%, var(--surface));
  color: var(--dash-report-tone-fg);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.5;
}

.dash-report-summary-card h3,
.dash-report-channel-card span,
.dash-report-action-card h3 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}

.dash-report-summary-card > strong {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.5px;
  line-height: 1.15;
  color: var(--text);
}

.dash-report-summary-card p,
.dash-report-channel-card p,
.dash-report-action-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.65;
}

.dash-report-spark { width: 100%; height: 30px; }

.dash-report-spark path {
  fill: none;
  stroke: var(--dash-report-tone-fg);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .82;
}

/* ---------- Tone map — uses panel pastel vars (not raw hex) ---------- */
.dash-report-tone-blue  { --dash-report-tone-bg: var(--pastel-sky);   --dash-report-tone-fg: var(--brand-500); }
.dash-report-tone-cyan  { --dash-report-tone-bg: #d1eef5;             --dash-report-tone-fg: #4b93a8; }
.dash-report-tone-mint  { --dash-report-tone-bg: var(--pastel-mint);  --dash-report-tone-fg: var(--green-500); }
.dash-report-tone-peach { --dash-report-tone-bg: var(--pastel-peach); --dash-report-tone-fg: var(--accent-600); }
.dash-report-tone-rose  { --dash-report-tone-bg: var(--pastel-rose);  --dash-report-tone-fg: var(--red-500); }
.dash-report-tone-lilac { --dash-report-tone-bg: var(--pastel-lilac); --dash-report-tone-fg: var(--purple-500); }
.dash-report-tone-lemon { --dash-report-tone-bg: var(--pastel-lemon); --dash-report-tone-fg: #a37919; }

/* ---------- Brief (prose + quick stats) ---------- */
.dash-report-brief-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}

.dash-report-brief-card,
.dash-report-stat-card,
.dash-report-timeline,
.dash-report-chart-card,
.dash-report-ai-note,
.dash-report-team-card,
.dash-report-finance-card,
.dash-report-links-section {
  padding: 20px 22px;
}

.dash-report-prose {
  display: grid;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 2;
}

.dash-report-prose h3 {
  margin: 6px 0 -2px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.dash-report-prose p { margin: 0; }

.dash-report-prose mark {
  border-radius: 6px;
  padding: 1px 6px;
  color: inherit;
  font-weight: 600;
}

.dash-report-prose mark.blue { background: color-mix(in srgb, var(--pastel-sky) 55%, var(--surface));   color: var(--brand-700); }
.dash-report-prose mark.mint { background: color-mix(in srgb, var(--pastel-mint) 55%, var(--surface));  color: #2f8a5e; }
.dash-report-prose mark.cyan { background: color-mix(in srgb, #d1eef5 55%, var(--surface));             color: #3f7f92; }
.dash-report-prose mark.rose { background: color-mix(in srgb, var(--pastel-rose) 55%, var(--surface));  color: #b14458; }

.dash-report-stat-list {
  display: grid;
  gap: 8px;
}

.dash-report-stat-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background .2s, border-color .2s;
}

.dash-report-stat-list div:hover {
  background: color-mix(in srgb, var(--surface-2) 85%, var(--pastel-lilac) 15%);
  border-color: var(--brand-200);
}

.dash-report-stat-list span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.dash-report-stat-list strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -.3px;
}

/* ---------- Team + Finance row (2-column) ---------- */
.dash-report-team-finance {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.dash-report-team-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.dash-report-team-person,
.dash-report-team-sentiment {
  --dash-report-tone-bg: var(--pastel-sky);
  --dash-report-tone-fg: var(--brand-500);
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--surface) 55%, color-mix(in srgb, var(--dash-report-tone-bg) 40%, var(--surface)) 100%);
  border: 1px solid var(--border);
  animation: slideUp .45s ease both;
  animation-delay: calc(var(--i, 0) * 60ms);
}

.dash-report-team-badge {
  display: inline-block;
  align-self: start;
  padding: 3px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--dash-report-tone-bg) 50%, var(--surface));
  color: var(--dash-report-tone-fg);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: -.1px;
}

.dash-report-team-body {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-report-team-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--dash-report-tone-bg) 55%, var(--surface));
  color: var(--dash-report-tone-fg);
  font-size: 18px;
  font-weight: 800;
}

.dash-report-team-body h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}

.dash-report-team-body span {
  display: block;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
  margin-top: 2px;
}

.dash-report-team-metric {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-2) 85%, transparent);
}

.dash-report-team-metric strong {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.015em;
}

.dash-report-team-metric em {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: var(--dash-report-tone-fg);
}

.dash-report-team-sentiment {
  align-content: start;
}

.dash-report-team-sentiment strong {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.5px;
}

.dash-report-team-sentiment p {
  margin: 0;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.6;
}

.dash-report-team-coach {
  padding: 11px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 78%, var(--pastel-lilac) 12%);
  border: 1px dashed var(--brand-200);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.75;
}

.dash-report-team-coach b {
  color: var(--brand-700);
  font-weight: 800;
  margin-inline-end: 4px;
}

/* Finance card */
.dash-report-finance-progress {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.dash-report-fin-progress-item {
  --dash-report-tone-bg: var(--pastel-sky);
  --dash-report-tone-fg: var(--brand-500);
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 60%, color-mix(in srgb, var(--dash-report-tone-bg) 40%, var(--surface)) 40%);
  border: 1px solid var(--border);
}

.dash-report-fin-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dash-report-fin-progress-head span {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}

.dash-report-fin-progress-head b {
  font-size: 15px;
  font-weight: 800;
  color: var(--dash-report-tone-fg);
  letter-spacing: -.3px;
}

.dash-report-fin-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.dash-report-fin-progress-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--dash-report-tone-fg), color-mix(in srgb, var(--dash-report-tone-fg) 65%, #fff));
}

.dash-report-fin-progress-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
}

.dash-report-fin-progress-foot em {
  font-style: normal;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -.1px;
}

.dash-report-fin-progress-foot span {
  color: var(--text-muted);
  font-weight: 500;
}

.dash-report-finance-cells {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.dash-report-fin-cell {
  --dash-report-tone-bg: var(--pastel-sky);
  --dash-report-tone-fg: var(--brand-500);
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 62%, color-mix(in srgb, var(--dash-report-tone-bg) 40%, var(--surface)) 38%);
  border: 1px solid var(--border);
}

.dash-report-fin-cell span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

.dash-report-fin-cell strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.3px;
}

/* ---------- Timeline ---------- */
.dash-report-timeline-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.dash-report-timeline-item {
  --dash-report-tone-bg: var(--pastel-sky);
  --dash-report-tone-fg: var(--brand-500);
  position: relative;
  display: grid;
  gap: 6px;
  min-height: 128px;
  padding: 13px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--dash-report-tone-bg) 32%, var(--surface)));
  border: 1px solid var(--border);
  animation: scaleIn .45s cubic-bezier(.22,.7,.16,1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.dash-report-timeline-item::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--dash-report-tone-fg);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--dash-report-tone-fg) 14%, transparent);
}

.dash-report-timeline-item > b {
  color: var(--dash-report-tone-fg);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.3px;
}

.dash-report-timeline-item h3 {
  margin: 0 0 3px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.55;
}

.dash-report-timeline-item span {
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 500;
}

/* ---------- Channel performance ---------- */
.dash-report-channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.dash-report-channel-card {
  --dash-report-tone-bg: var(--pastel-sky);
  --dash-report-tone-fg: var(--brand-500);
  display: grid;
  gap: 9px;
  min-height: 168px;
  padding: 14px 15px;
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--dash-report-tone-bg) 30%, var(--surface)));
  animation: popIn .5s cubic-bezier(.34, 1.56, .64, 1) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}

.dash-report-channel-card > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dash-report-channel-card > strong {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.4px;
  color: var(--text);
}

.dash-report-channel-share {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.dash-report-channel-share i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--dash-report-tone-fg), color-mix(in srgb, var(--dash-report-tone-fg) 65%, #fff));
}

.dash-report-channel-share em {
  position: absolute;
  inset: -22px 0 auto auto;
  color: var(--dash-report-tone-fg);
  font-size: 10.5px;
  font-style: normal;
  font-weight: 800;
}

.dash-report-channel-card:hover,
.dash-report-summary-card:hover,
.dash-report-action-card:hover {
  transform: translateY(-2px);
}

/* ---------- Charts ---------- */
.dash-report-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.dash-report-chart-wide { grid-column: 1 / -1; }

.dash-report-chart {
  position: relative;
  height: 260px;
}

.dash-report-chart canvas {
  width: 100% !important;
  height: 100% !important;
  max-height: 260px !important;
}

/* ---------- AI note + actions ---------- */
.dash-report-ai-note {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  background:
    radial-gradient(circle at 8% 15%, rgba(111,185,143,.12), transparent 42%),
    linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--surface) 92%, var(--pastel-lilac) 8%));
}

.dash-report-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.dash-report-action-card {
  --dash-report-tone-bg: var(--pastel-sky);
  --dash-report-tone-fg: var(--brand-500);
  display: grid;
  gap: 6px;
  padding: 14px 15px;
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--dash-report-tone-bg) 28%, var(--surface)));
  animation: slideUp .45s ease both;
  animation-delay: calc(var(--i, 0) * 55ms);
}

.dash-report-action-card strong {
  color: var(--dash-report-tone-fg);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: -.15px;
}

.dash-report-action-card button {
  justify-self: start;
  margin-top: 4px;
}

/* ---------- Related reports (deep-links) ---------- */
.dash-report-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.dash-report-link {
  --dash-report-tone-bg: var(--pastel-sky);
  --dash-report-tone-fg: var(--brand-500);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 70%, color-mix(in srgb, var(--dash-report-tone-bg) 40%, var(--surface)) 30%);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}

.dash-report-link i {
  color: var(--dash-report-tone-fg);
  font-size: 15px;
  font-style: normal;
  font-weight: 800;
  transition: transform .2s;
}

.dash-report-link:hover {
  transform: translateY(-2px);
  border-color: var(--dash-report-tone-fg);
  box-shadow: 0 12px 24px -14px color-mix(in srgb, var(--dash-report-tone-fg) 40%, transparent);
}

.dash-report-link:hover i { transform: translateX(-4px); }

/* ---------- Responsive ----------
   NOTE: auto-fit grids handle most sizing automatically.
   Media queries here only handle 2-col layouts (brief/team-finance/ai-note/hero)
   which need explicit stacking below certain widths. Uses viewport width, so
   thresholds account for a ~256px open sidebar (real content = viewport - 256).
*/
@media (max-width: 1400px) {
  .dash-report-team-finance { grid-template-columns: 1fr; }
}

@media (max-width: 1200px) {
  .dash-report-brief-wrap { grid-template-columns: 1fr; }
  .dash-report-ai-note { grid-template-columns: 1fr; }
  .dash-report-chart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .dash-report-hero { grid-template-columns: 1fr; }
  .dash-report-hero-mark { grid-template-columns: 74px 1fr; }
  .dash-report-hero-icon { width: 72px; height: 72px; border-radius: 18px; font-size: 30px; }
  .dash-report-team-grid { grid-template-columns: 1fr; }
  .dash-report-finance-cells { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .dash-report-hero,
  .dash-report-brief-card,
  .dash-report-stat-card,
  .dash-report-timeline,
  .dash-report-chart-card,
  .dash-report-ai-note,
  .dash-report-team-card,
  .dash-report-finance-card,
  .dash-report-links-section {
    border-radius: 14px;
    padding: 16px 18px;
  }
  .dash-report-hero h1 { font-size: 20px; }
  .dash-report-hero-mark,
  .dash-report-status-strip span,
  .dash-report-section-head { display: grid; grid-template-columns: 1fr; }
  .dash-report-summary-grid,
  .dash-report-channel-grid,
  .dash-report-timeline-list,
  .dash-report-domain-grid,
  .dash-report-action-grid,
  .dash-report-links-grid,
  .dash-report-finance-cells { grid-template-columns: 1fr; }
  .dash-report-summary-card { min-height: 0; }
}

/* ---------- Dark theme overrides ---------- */
[data-theme="dark"] .dash-report-hero {
  background:
    radial-gradient(circle at 8% 0%, rgba(111,185,143,.24), transparent 42%),
    radial-gradient(circle at 92% 100%, rgba(34,211,238,.18), transparent 46%),
    linear-gradient(135deg, var(--surface-2), var(--surface));
}

[data-theme="dark"] .dash-report-hero-icon {
  background:
    radial-gradient(circle at 30% 20%, rgba(111,185,143,.4), transparent 60%),
    linear-gradient(135deg, var(--brand-500), var(--purple-500));
}

[data-theme="dark"] .dash-report-status-strip span {
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  border-color: var(--border);
}

[data-theme="dark"] .dash-report-eyebrow span {
  background: rgba(111,185,143,.18);
  color: #ddd6fe;
}

[data-theme="dark"] .dash-report-summary-card,
[data-theme="dark"] .dash-report-channel-card,
[data-theme="dark"] .dash-report-action-card,
[data-theme="dark"] .dash-report-timeline-item,
[data-theme="dark"] .dash-report-team-person,
[data-theme="dark"] .dash-report-team-sentiment,
[data-theme="dark"] .dash-report-fin-progress-item,
[data-theme="dark"] .dash-report-fin-cell,
[data-theme="dark"] .dash-report-link {
  background: color-mix(in srgb, var(--surface) 82%, var(--dash-report-tone-bg, var(--pastel-sky)) 18%);
}

[data-theme="dark"] .dash-report-stat-list div,
[data-theme="dark"] .dash-report-team-metric {
  background: color-mix(in srgb, var(--surface-2) 78%, transparent);
  border-color: var(--border);
}

[data-theme="dark"] .dash-report-team-coach {
  background: color-mix(in srgb, var(--surface-2) 78%, rgba(111,185,143,.10));
  border-color: rgba(111,185,143,.28);
  color: var(--text-muted);
}

/* Compact SWOT section inside Quick Manager Report */
.dash-report-swot-section {
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

.dash-report-swot-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.dash-report-swot-cell {
  --dash-report-tone-bg: var(--pastel-sky);
  --dash-report-tone-fg: var(--brand-500);
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--dash-report-tone-bg) 25%, var(--surface)));
  border: 1px solid var(--border);
  position: relative;
}

.dash-report-swot-cell::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: var(--dash-report-tone-fg);
  opacity: .55;
  border-radius: 3px 0 0 3px;
}

.dash-report-swot-cell-head {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

.dash-report-swot-cell-head span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--dash-report-tone-fg);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.dash-report-swot-cell-head b {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.1px;
}

.dash-report-swot-cell-head em {
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--dash-report-tone-bg) 55%, var(--surface));
  color: var(--dash-report-tone-fg);
  font-size: 10.5px;
  font-weight: 800;
  font-style: normal;
}

.dash-report-swot-list {
  display: grid;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.dash-report-swot-list li {
  display: grid;
  gap: 2px;
}

.dash-report-swot-list li strong {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.05px;
  line-height: 1.45;
}

.dash-report-swot-list li span {
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 500;
}

.dash-report-swot-conclusion {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 78%, var(--pastel-lilac) 12%);
  border: 1px dashed var(--brand-200);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.85;
}

.dash-report-swot-conclusion b {
  color: var(--brand-700);
  font-weight: 800;
  margin-inline-end: 4px;
}

.dash-report-swot-conclusion mark {
  background: color-mix(in srgb, var(--pastel-lilac) 55%, var(--surface));
  color: var(--brand-700);
  border-radius: 6px;
  padding: 1px 6px;
  font-weight: 700;
}

@media (max-width: 1200px) {
  .dash-report-swot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .dash-report-swot-grid { grid-template-columns: 1fr; }
}

/* =========================================================================
   SWOT MATRIX PAGE — organizational + 9 domains (swot-* namespace)
   Aligned with .dash-mc-* theme: soft indigo + pastels, 16px radius, 22px pad.
   ========================================================================= */
.swot-page {
  display: grid;
  gap: 16px;
  color: var(--text);
}

.swot-hero,
.swot-active-head,
.swot-quadrant,
.swot-conclusion {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: transform .25s cubic-bezier(.22,.7,.16,1), box-shadow .25s ease, border-color .2s ease;
}

/* ---------- Hero ---------- */
.swot-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, .9fr);
  gap: 22px;
  padding: 22px 24px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 8% 0%, rgba(111,185,143,.16), transparent 42%),
    radial-gradient(circle at 92% 100%, rgba(34,211,238,.12), transparent 46%),
    linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--surface) 92%, var(--pastel-lilac) 8%));
  animation: slideUp .5s ease both;
}

.swot-hero::before {
  content: "";
  position: absolute;
  inset: auto -60px -100px auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(44,120,115,.10), transparent 68%);
  pointer-events: none;
}

.swot-hero-copy,
.swot-hero-mode {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.swot-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.swot-eyebrow span {
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pastel-lilac) 55%, var(--surface));
  color: var(--brand-700);
  font-weight: 800;
}

.swot-eyebrow b { color: var(--text-muted); font-weight: 700; }

.swot-hero h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.35;
  font-weight: 800;
  letter-spacing: -.3px;
}

.swot-hero p {
  max-width: 620px;
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.8;
}

.swot-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.swot-btn {
  min-height: 32px;
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s, background .2s, border-color .2s;
}

.swot-btn:hover {
  color: var(--brand-700);
  border-color: var(--brand-300);
  background: color-mix(in srgb, var(--surface) 88%, var(--pastel-lilac) 12%);
}

.swot-btn-primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff;
  border-color: var(--brand-600);
  font-weight: 700;
  box-shadow: 0 6px 18px -8px rgba(44,120,115,.45);
}

.swot-btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  color: #fff;
}

.swot-hero-mode {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 55%, var(--pastel-sky) 18%);
  border: 1px solid var(--border);
}

.swot-mode-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-500), var(--purple-500));
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}

.swot-mode-copy b {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.2px;
}

.swot-mode-copy p {
  margin: 4px 0 8px;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.65;
  font-weight: 500;
}

.swot-mode-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.swot-mode-toggle button {
  padding: 4px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: color .2s, background .2s;
}

.swot-mode-toggle button.active {
  background: color-mix(in srgb, var(--surface) 82%, var(--pastel-lilac) 18%);
  color: var(--brand-700);
  font-weight: 800;
}

/* ---------- Tab bar (10 tabs) ---------- */
.swot-tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  overflow-x: auto;
  scrollbar-width: none;
}

.swot-tabs::-webkit-scrollbar { display: none; }

.swot-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s, background .2s, transform .2s;
  text-decoration: none;
}

.swot-tab-icon { font-size: 15px; display: flex; align-items: center; }
.swot-tab-svg { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; }
.swot-tab-label { letter-spacing: -.15px; }

.swot-tab:hover {
  color: var(--text);
  background: rgba(127,127,127,.05);
}

.swot-tab.active {
  color: var(--brand-700);
  font-weight: 800;
  background: color-mix(in srgb, var(--surface) 78%, var(--pastel-lilac) 22%);
  border: 1px solid var(--brand-200);
}

/* ---------- Active head (current domain title + tally) ---------- */
.swot-active-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  flex-wrap: wrap;
}

.swot-active-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.2px;
}

.swot-active-head p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.6;
}

.swot-active-tally {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.swot-active-tally > div {
  display: grid;
  gap: 2px;
  padding: 8px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 60%, var(--dash-report-tone-bg, var(--pastel-sky)) 40%);
  border: 1px solid var(--border);
  text-align: center;
  min-width: 72px;
}

.swot-active-tally b {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.3px;
  line-height: 1.1;
}

.swot-active-tally span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

/* ---------- 2×2 matrix ---------- */
.swot-matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.swot-quadrant {
  --dash-report-tone-bg: var(--pastel-sky);
  --dash-report-tone-fg: var(--brand-500);
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--dash-report-tone-bg) 22%, var(--surface)));
  animation: slideUp .5s ease both;
}

.swot-quadrant::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--dash-report-tone-fg);
  opacity: .55;
}

.swot-q-s { animation-delay: .05s; }
.swot-q-w { animation-delay: .12s; }
.swot-q-o { animation-delay: .19s; }
.swot-q-t { animation-delay: .26s; }

.swot-quadrant-head {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}

.swot-quadrant-badge {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--dash-report-tone-bg) 60%, var(--surface));
  color: var(--dash-report-tone-fg);
  font-size: 20px;
  font-weight: 800;
}

.swot-quadrant-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.15px;
}

.swot-quadrant-count {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--dash-report-tone-bg) 55%, var(--surface));
  color: var(--dash-report-tone-fg);
  font-size: 11px;
  font-weight: 800;
}

.swot-quadrant-head em {
  font-style: normal;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  display: block;
  margin-top: 2px;
}

.swot-quadrant-letter {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--dash-report-tone-fg);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.5px;
}

.swot-quadrant-list {
  display: grid;
  gap: 10px;
}

/* Item card */
.swot-item {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  animation: popIn .4s cubic-bezier(.34, 1.56, .64, 1) both;
  animation-delay: calc(var(--i, 0) * 60ms);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}

.swot-item:hover {
  transform: translateY(-2px);
  border-color: var(--dash-report-tone-fg);
  box-shadow: 0 10px 20px -12px color-mix(in srgb, var(--dash-report-tone-fg) 35%, transparent);
}

.swot-item-head {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: center;
}

.swot-item-rank {
  width: 30px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--dash-report-tone-bg) 55%, var(--surface));
  color: var(--dash-report-tone-fg);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: -.2px;
}

.swot-item-head h3 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.1px;
  line-height: 1.4;
}

.swot-impact {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
}

.swot-impact.swot-tone-peach { background: color-mix(in srgb, var(--pastel-peach) 55%, var(--surface)); color: var(--accent-600); }
.swot-impact.swot-tone-lilac { background: color-mix(in srgb, var(--pastel-lilac) 55%, var(--surface)); color: var(--purple-500); }
.swot-impact.swot-tone-sky   { background: color-mix(in srgb, var(--pastel-sky) 55%, var(--surface)); color: var(--brand-700); }

.swot-item-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.65;
}

.swot-item-foot {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.swot-item-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 500;
}

.swot-item-source {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
}

.swot-item-conf { align-self: center; }

.swot-item-score {
  display: grid;
  gap: 4px;
  justify-items: end;
  min-width: 90px;
}

.swot-item-score-bar {
  width: 90px;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.swot-item-score-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--dash-report-tone-fg), color-mix(in srgb, var(--dash-report-tone-fg) 60%, #fff));
}

.swot-item-score b {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--dash-report-tone-fg);
  letter-spacing: -.3px;
}

/* Quadrant tone map — reuses same variables as dash-report-tone-* */
.swot-tone-mint  { --dash-report-tone-bg: var(--pastel-mint);  --dash-report-tone-fg: var(--green-500); }
.swot-tone-rose  { --dash-report-tone-bg: var(--pastel-rose);  --dash-report-tone-fg: var(--red-500); }
.swot-tone-sky   { --dash-report-tone-bg: var(--pastel-sky);   --dash-report-tone-fg: var(--brand-500); }
.swot-tone-peach { --dash-report-tone-bg: var(--pastel-peach); --dash-report-tone-fg: var(--accent-600); }
.swot-tone-lilac { --dash-report-tone-bg: var(--pastel-lilac); --dash-report-tone-fg: var(--purple-500); }
.swot-tone-blue  { --dash-report-tone-bg: var(--pastel-sky);   --dash-report-tone-fg: var(--brand-500); }
.swot-tone-cyan  { --dash-report-tone-bg: #d1eef5;             --dash-report-tone-fg: #4b93a8; }
.swot-tone-lemon { --dash-report-tone-bg: var(--pastel-lemon); --dash-report-tone-fg: #a37919; }

/* ---------- Conclusion card ---------- */
.swot-conclusion {
  padding: 22px 24px;
  background:
    radial-gradient(circle at 8% 15%, rgba(111,185,143,.14), transparent 42%),
    linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--surface) 90%, var(--pastel-lilac) 10%));
}

.swot-conclusion-head {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.swot-conclusion-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-500), var(--purple-500));
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.4px;
}

.swot-conclusion-head span {
  display: block;
  color: var(--brand-500);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
}

.swot-conclusion-head h2 {
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.2px;
}

.swot-conclusion-grid {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.swot-conclusion-summary,
.swot-conclusion-strategy,
.swot-conclusion-risk {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.swot-conclusion-summary  { border-inline-start: 3px solid var(--brand-500); }
.swot-conclusion-strategy { border-inline-start: 3px solid var(--green-500); }
.swot-conclusion-risk     { border-inline-start: 3px solid var(--red-500); }

.swot-conclusion-grid b {
  display: block;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.1px;
  margin-bottom: 6px;
}

.swot-conclusion-grid p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.85;
}

.swot-conclusion-grid mark {
  background: color-mix(in srgb, var(--pastel-lilac) 55%, var(--surface));
  color: var(--brand-700);
  border-radius: 6px;
  padding: 1px 6px;
  font-weight: 700;
}

/* Priorities */
.swot-priorities-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.swot-priorities-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.15px;
}

.swot-priorities-head span {
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
}

.swot-priorities-list {
  display: grid;
  gap: 10px;
}

.swot-priority {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  animation: popIn .45s cubic-bezier(.34, 1.56, .64, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms);
  transition: border-color .2s, box-shadow .2s;
}

.swot-priority:hover {
  border-color: var(--brand-300);
  box-shadow: 0 10px 22px -14px rgba(44,120,115,.35);
}

.swot-priority-num {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-500), var(--purple-500));
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.swot-priority h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.15px;
}

.swot-priority-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

.swot-priority-meta b {
  color: var(--text);
  font-weight: 700;
  margin-inline-start: 3px;
}

.swot-priority button {
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s, background .2s, border-color .2s;
}

.swot-priority button:hover {
  color: var(--brand-700);
  border-color: var(--brand-300);
  background: color-mix(in srgb, var(--surface) 88%, var(--pastel-lilac) 12%);
}

/* ---------- Responsive ---------- */
@media (max-width: 1400px) {
  .swot-conclusion-grid { grid-template-columns: 1fr 1fr; }
  .swot-conclusion-risk { grid-column: 1 / -1; }
}

@media (max-width: 1100px) {
  .swot-hero,
  .swot-matrix { grid-template-columns: 1fr; }
  .swot-active-head { align-items: flex-start; flex-direction: column; }
  .swot-conclusion-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .swot-hero, .swot-conclusion { padding: 16px 18px; border-radius: 14px; }
  .swot-hero h1 { font-size: 20px; }
  .swot-priority { grid-template-columns: 32px 1fr; }
  .swot-priority button { grid-column: 1 / -1; justify-self: start; }
  .swot-hero-mode { grid-template-columns: 48px 1fr; }
  .swot-mode-icon { width: 48px; height: 48px; font-size: 18px; }
}

/* ---------- Dark theme overrides ---------- */
[data-theme="dark"] .swot-hero {
  background:
    radial-gradient(circle at 8% 0%, rgba(111,185,143,.24), transparent 42%),
    radial-gradient(circle at 92% 100%, rgba(34,211,238,.18), transparent 46%),
    linear-gradient(135deg, var(--surface-2), var(--surface));
}

[data-theme="dark"] .swot-mode-icon,
[data-theme="dark"] .swot-conclusion-mark,
[data-theme="dark"] .swot-priority-num {
  background: linear-gradient(135deg, var(--brand-500), var(--purple-500));
}

[data-theme="dark"] .swot-quadrant,
[data-theme="dark"] .swot-item,
[data-theme="dark"] .swot-priority,
[data-theme="dark"] .swot-conclusion-summary,
[data-theme="dark"] .swot-conclusion-strategy,
[data-theme="dark"] .swot-conclusion-risk,
[data-theme="dark"] .swot-active-tally > div {
  background: color-mix(in srgb, var(--surface) 84%, var(--dash-report-tone-bg, var(--pastel-sky)) 16%);
}

.dash-alerts-sev-high {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--pastel-peach) 30%, var(--surface)), color-mix(in srgb, var(--surface) 86%, transparent));
  border-inline-start-color: color-mix(in srgb, var(--amber-500) 62%, var(--pastel-peach));
}

.dash-alerts-sev-medium {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--pastel-lemon) 32%, var(--surface)), color-mix(in srgb, var(--surface) 88%, transparent));
  border-inline-start-color: color-mix(in srgb, var(--amber-500) 46%, var(--pastel-lemon));
}

.dash-alerts-sev-urgent .dash-alerts-card-head b {
  background: color-mix(in srgb, var(--pastel-rose) 52%, var(--surface));
  color: color-mix(in srgb, var(--red-500) 70%, var(--text));
}

.dash-alerts-sev-high .dash-alerts-card-head b,
.dash-alerts-sev-medium .dash-alerts-card-head b {
  background: color-mix(in srgb, var(--pastel-peach) 52%, var(--surface));
  color: color-mix(in srgb, var(--amber-500) 62%, var(--text));
}

.dash-alerts-decision-card .dash-alerts-metrics div,
.dash-alerts-decision-card .dash-alerts-reason,
.dash-alerts-decision-card .dash-alerts-actionline {
  background: color-mix(in srgb, var(--surface) 64%, var(--pastel-peach) 16%);
}

.dash-alerts-sev-urgent .dash-alerts-metrics div,
.dash-alerts-sev-urgent .dash-alerts-reason,
.dash-alerts-sev-urgent .dash-alerts-actionline {
  background: color-mix(in srgb, var(--surface) 64%, var(--pastel-rose) 18%);
}

.dash-alerts-opportunity {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--pastel-mint) 28%, var(--surface)), color-mix(in srgb, var(--pastel-sky) 12%, var(--surface)));
  border-color: color-mix(in srgb, var(--green-500) 18%, var(--border));
}

.dash-alerts-opportunity .dash-alerts-card-head b {
  background: color-mix(in srgb, var(--pastel-mint) 54%, var(--surface));
  color: color-mix(in srgb, var(--green-500) 70%, var(--text));
}

.dash-alerts-opportunity .dash-alerts-op-meta div {
  background: color-mix(in srgb, var(--surface) 62%, var(--pastel-mint) 18%);
}

.dash-alerts-ai-card {
  background:
    radial-gradient(circle at 0 0, color-mix(in srgb, var(--brand-500) 12%, transparent), transparent 38%),
    linear-gradient(135deg, color-mix(in srgb, var(--pastel-lilac) 30%, var(--surface)), color-mix(in srgb, var(--surface) 88%, transparent));
  border-color: color-mix(in srgb, var(--brand-500) 20%, var(--border));
}

.dash-alerts-ai-card > b,
.dash-alerts-ai-num {
  background: color-mix(in srgb, var(--pastel-lilac) 54%, var(--surface));
  color: color-mix(in srgb, var(--brand-700) 70%, var(--text));
}

.dash-alerts-why {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--pastel-lilac) 20%, var(--surface)), color-mix(in srgb, var(--surface) 88%, transparent));
}

.dash-alerts-timeline article:nth-child(1),
.dash-alerts-timeline article:nth-child(2),
.dash-alerts-timeline article:nth-child(3) {
  background: color-mix(in srgb, var(--surface) 66%, var(--pastel-peach) 16%);
}

.dash-alerts-timeline article:nth-child(n+4) {
  background: color-mix(in srgb, var(--surface) 66%, var(--pastel-sky) 14%);
}

.dash-alerts-filterbar {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 88%, transparent), color-mix(in srgb, var(--pastel-sky) 10%, var(--surface)));
}

/* =========================================================================
   ALERTS PAGE — Today-View Alignment (2026-07-12)
   نگاشت زبان طراحی صفحه «نمای امروز کسب‌وکار» روی صفحه هشدارها و فرصت‌ها
   ========================================================================= */
.dash-alerts-page {
  --alerts-red:    #ef4444;
  --alerts-amber:  #f59e0b;
  --alerts-green:  #10b981;
  --alerts-blue:   #3b82f6;
  --alerts-purple: #8b5cf6;
  --alerts-value-red:    #b14458;
  --alerts-value-amber:  #b27512;
  --alerts-value-green:  #0e8a5e;
  --alerts-value-blue:   #3b5998;
  --alerts-value-purple: #6d47c0;

  gap: 16px;
}

/* Base cards: mirror today-view surface language — lighter, softer, single tone */
.dash-alerts-hero,
.dash-alerts-panel,
.dash-alerts-summary,
.dash-alerts-decision-card,
.dash-alerts-opportunity,
.dash-alerts-ai-card,
.dash-alerts-filterbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: none;
}

/* Section head — smaller, tighter like today-view section titles */
.dash-alerts-head h2 {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: -.15px;
  color: var(--text);
  margin: 4px 0 0;
}

.dash-alerts-head span,
.dash-alerts-card-head span,
.dash-alerts-status-pill,
.dash-alerts-soft-chip {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1px;
}

.dash-alerts-status-pill,
.dash-alerts-soft-chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

/* Hero — softer indigo pastel, smaller radius, subtler shadow */
.dash-alerts-hero {
  padding: 16px 18px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(44,120,115,.06), var(--surface)),
    linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--pastel-sky) 10%, var(--surface)));
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.dash-alerts-hero-copy h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.2px;
  line-height: 1.5;
  margin: 6px 0 2px;
}
.dash-alerts-hero-copy p {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.75;
  font-weight: 500;
}

.dash-alerts-orb strong {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.4px;
  color: var(--text);
}
.dash-alerts-orb span {
  font-size: 11px;
  color: var(--text-muted);
}

/* Hero mini-cards — tinted side-bar like pulse-cell */
.dash-alerts-hero-cards {
  gap: 10px;
  margin-top: 12px;
}
.dash-alerts-mini {
  min-height: 82px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  gap: 4px;
  transition: transform .2s ease, background .2s ease;
}
.dash-alerts-mini:hover { transform: translateY(-2px); }
.dash-alerts-mini span { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.dash-alerts-mini strong { font-size: 19px; font-weight: 800; letter-spacing: -.4px; line-height: 1.15; }
.dash-alerts-mini em { font-size: 10.5px; color: var(--text-muted); font-style: normal; line-height: 1.55; }

.dash-alerts-mini-rose  { background: linear-gradient(180deg, rgba(239, 68, 68, .07), var(--surface-2)); box-shadow: inset -3px 0 0 var(--alerts-red); }
.dash-alerts-mini-rose  strong { color: var(--alerts-value-red); }
.dash-alerts-mini-peach { background: linear-gradient(180deg, rgba(245, 158, 11, .07), var(--surface-2)); box-shadow: inset -3px 0 0 var(--alerts-amber); }
.dash-alerts-mini-peach strong { color: var(--alerts-value-amber); }
.dash-alerts-mini-mint  { background: linear-gradient(180deg, rgba(16, 185, 129, .07), var(--surface-2)); box-shadow: inset -3px 0 0 var(--alerts-green); }
.dash-alerts-mini-mint  strong { color: var(--alerts-value-green); }
.dash-alerts-mini-sky   { background: linear-gradient(180deg, rgba(59, 130, 246, .07), var(--surface-2)); box-shadow: inset -3px 0 0 var(--alerts-blue); }
.dash-alerts-mini-sky   strong { color: var(--alerts-value-blue); }

/* Executive summary — match today-view compact card size + level tint */
.dash-alerts-summary-grid { gap: 12px; }
.dash-alerts-summary {
  min-height: 158px;
  padding: 14px 12px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: none;
  text-align: center;
  align-items: center;
  gap: 6px;
}
.dash-alerts-summary::before { display: none; }
.dash-alerts-summary.dash-alerts-warning {
  background: linear-gradient(180deg, rgba(245, 158, 11, .07), var(--surface-2));
  box-shadow: inset -3px 0 0 var(--alerts-amber);
}
.dash-alerts-summary.dash-alerts-good {
  background: linear-gradient(180deg, rgba(16, 185, 129, .07), var(--surface-2));
  box-shadow: inset -3px 0 0 var(--alerts-green);
}
.dash-alerts-summary h3 {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -.05px;
  line-height: 1.5;
  color: var(--text);
  margin-top: 2px;
}
.dash-alerts-summary > strong {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.4px;
  line-height: 1.2;
  color: var(--text);
}
.dash-alerts-summary.dash-alerts-warning > strong { color: var(--alerts-value-amber); }
.dash-alerts-summary.dash-alerts-good > strong    { color: var(--alerts-value-green); }
.dash-alerts-summary p {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.7;
  color: var(--text-muted);
  max-width: 140px;
}
.dash-alerts-summary-top { justify-content: center; gap: 0; }
.dash-alerts-summary-top i { display: none; }
.dash-alerts-summary-top b {
  order: 2;
  min-width: 36px;
  min-height: 24px;
  padding: 3px 9px;
  font-size: 10.5px;
  font-weight: 800;
  border-radius: 999px;
  background: rgba(245, 158, 11, .14);
  color: var(--alerts-value-amber);
}
.dash-alerts-good .dash-alerts-summary-top b {
  background: rgba(16, 185, 129, .14);
  color: var(--alerts-value-green);
}

/* ---------- Triage Console (NEW) ---------- */
.dash-alerts-triage-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 1180px) { .dash-alerts-triage-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px)  { .dash-alerts-triage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.dash-alerts-tile {
  padding: 14px 12px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  grid-template-columns: 36px 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 10px;
  row-gap: 3px;
  align-items: center;
  transition: transform .2s ease, background .2s ease;
  animation: scaleIn .45s cubic-bezier(.22,.7,.16,1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.dash-alerts-tile:hover { transform: translateY(-2px); background: var(--surface-3); }
.dash-alerts-tile-icon {
  grid-row: 1 / span 3;
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--surface);
  font-size: 16px;
}
.dash-alerts-tile-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.4;
}
.dash-alerts-tile-value {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.4px;
  line-height: 1.15;
  color: var(--text);
}
.dash-alerts-tile-delta {
  font-size: 10.5px;
  color: var(--text-muted);
  font-style: normal;
  font-weight: 600;
  line-height: 1.5;
}
.dash-alerts-tile-rose  { background: linear-gradient(180deg, rgba(239, 68, 68, .07), var(--surface-2));  box-shadow: inset -3px 0 0 var(--alerts-red); }
.dash-alerts-tile-rose  .dash-alerts-tile-value { color: var(--alerts-value-red); }
.dash-alerts-tile-rose  .dash-alerts-tile-icon  { background: rgba(239, 68, 68, .15); }
.dash-alerts-tile-peach { background: linear-gradient(180deg, rgba(245, 158, 11, .07), var(--surface-2)); box-shadow: inset -3px 0 0 var(--alerts-amber); }
.dash-alerts-tile-peach .dash-alerts-tile-value { color: var(--alerts-value-amber); }
.dash-alerts-tile-peach .dash-alerts-tile-icon  { background: rgba(245, 158, 11, .15); }
.dash-alerts-tile-mint  { background: linear-gradient(180deg, rgba(16, 185, 129, .07), var(--surface-2)); box-shadow: inset -3px 0 0 var(--alerts-green); }
.dash-alerts-tile-mint  .dash-alerts-tile-value { color: var(--alerts-value-green); }
.dash-alerts-tile-mint  .dash-alerts-tile-icon  { background: rgba(16, 185, 129, .15); }
.dash-alerts-tile-sky   { background: linear-gradient(180deg, rgba(59, 130, 246, .07), var(--surface-2)); box-shadow: inset -3px 0 0 var(--alerts-blue); }
.dash-alerts-tile-sky   .dash-alerts-tile-value { color: var(--alerts-value-blue); }
.dash-alerts-tile-sky   .dash-alerts-tile-icon  { background: rgba(59, 130, 246, .15); }
.dash-alerts-tile-lilac { background: linear-gradient(180deg, rgba(139, 92, 246, .07), var(--surface-2)); box-shadow: inset -3px 0 0 var(--alerts-purple); }
.dash-alerts-tile-lilac .dash-alerts-tile-value { color: var(--alerts-value-purple); }
.dash-alerts-tile-lilac .dash-alerts-tile-icon  { background: rgba(139, 92, 246, .15); }

/* ---------- Filter bar ---------- */
.dash-alerts-filterbar {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.dash-alerts-filters button {
  min-height: 30px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  box-shadow: none;
}
.dash-alerts-filters button:hover {
  background: var(--surface-3);
  color: var(--text);
  transform: none;
  box-shadow: none;
}
.dash-alerts-filters button.active {
  background: rgba(44,120,115,.14);
  color: var(--brand-700);
  border-color: color-mix(in srgb, var(--brand-500) 34%, transparent);
  box-shadow: none;
}
.dash-alerts-sort {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}
.dash-alerts-sort select {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

/* ---------- Alerts list — decision cards ---------- */
.dash-alerts-decision-card,
.dash-alerts-opportunity,
.dash-alerts-ai-card,
.dash-alerts-panel {
  padding: 14px;
  border-radius: 14px;
  gap: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.dash-alerts-card-head h3 {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.55;
  margin: 4px 0 0;
}

/* Severity side-bar accents (mirroring pulse-cell level-* pattern) */
.dash-alerts-decision-card { border-inline-start: none; }
.dash-alerts-sev-urgent {
  background: linear-gradient(180deg, rgba(239, 68, 68, .07), var(--surface));
  box-shadow: inset -3px 0 0 var(--alerts-red), var(--shadow-sm);
  border-color: color-mix(in srgb, var(--alerts-red) 22%, var(--border));
}
.dash-alerts-sev-high {
  background: linear-gradient(180deg, rgba(245, 158, 11, .07), var(--surface));
  box-shadow: inset -3px 0 0 var(--alerts-amber), var(--shadow-sm);
  border-color: color-mix(in srgb, var(--alerts-amber) 22%, var(--border));
}
.dash-alerts-sev-medium {
  background: linear-gradient(180deg, rgba(139, 92, 246, .07), var(--surface));
  box-shadow: inset -3px 0 0 var(--alerts-purple), var(--shadow-sm);
  border-color: color-mix(in srgb, var(--alerts-purple) 22%, var(--border));
}
.dash-alerts-sev-low {
  background: linear-gradient(180deg, rgba(16, 185, 129, .07), var(--surface));
  box-shadow: inset -3px 0 0 var(--alerts-green), var(--shadow-sm);
  border-color: color-mix(in srgb, var(--alerts-green) 22%, var(--border));
}

/* Severity pill (top-right badge) */
.dash-alerts-sev-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .1px;
  background: rgba(239, 68, 68, .14);
  color: var(--alerts-value-red);
  border: 1px solid transparent;
}
.dash-alerts-sev-pill-urgent { background: rgba(239, 68, 68, .14);   color: var(--alerts-value-red); }
.dash-alerts-sev-pill-high   { background: rgba(245, 158, 11, .14);  color: var(--alerts-value-amber); }
.dash-alerts-sev-pill-medium { background: rgba(139, 92, 246, .14);  color: var(--alerts-value-purple); }
.dash-alerts-sev-pill-low    { background: rgba(16, 185, 129, .14);  color: var(--alerts-value-green); }

/* Domain chip (small tinted pill for area labels) */
.dash-alerts-domain-chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-bottom: 4px;
}
.dash-alerts-domain-rose  { background: var(--pastel-rose);  color: var(--alerts-value-red); }
.dash-alerts-domain-peach { background: var(--pastel-peach); color: var(--alerts-value-amber); }
.dash-alerts-domain-mint  { background: var(--pastel-mint);  color: var(--alerts-value-green); }
.dash-alerts-domain-sky   { background: var(--pastel-sky);   color: var(--alerts-value-blue); }
.dash-alerts-domain-lilac { background: var(--pastel-lilac); color: var(--alerts-value-purple); }
.dash-alerts-domain-lemon { background: var(--pastel-lemon); color: #8a6d1f; }

/* Metrics/meta cells — match today-view neutral surface-2 tiles */
.dash-alerts-metrics,
.dash-alerts-op-meta { gap: 8px; }
.dash-alerts-metrics div,
.dash-alerts-op-meta div,
.dash-alerts-reason,
.dash-alerts-actionline {
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  gap: 2px;
}
.dash-alerts-metrics span,
.dash-alerts-op-meta span,
.dash-alerts-reason span,
.dash-alerts-actionline span,
.dash-alerts-mini span,
.dash-alerts-mini em {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.dash-alerts-metrics strong,
.dash-alerts-op-meta strong {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.15px;
  line-height: 1.45;
}
.dash-alerts-reason p,
.dash-alerts-actionline p {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.75;
}

/* Tag row on alerts/opportunities */
.dash-alerts-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dash-alerts-tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(44,120,115,.10);
  color: var(--brand-700);
  border: 1px solid color-mix(in srgb, var(--brand-500) 20%, transparent);
}
.dash-alerts-tag-op {
  background: rgba(16, 185, 129, .10);
  color: var(--alerts-value-green);
  border-color: color-mix(in srgb, var(--alerts-green) 25%, transparent);
}

/* Opportunity cards — mint side-bar accent */
.dash-alerts-opportunity {
  background: linear-gradient(180deg, rgba(16, 185, 129, .06), var(--surface));
  box-shadow: inset -3px 0 0 var(--alerts-green), var(--shadow-sm);
  border-color: color-mix(in srgb, var(--alerts-green) 20%, var(--border));
}
.dash-alerts-opportunity .dash-alerts-card-head b {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, .14);
  color: var(--alerts-value-green);
  font-size: 10.5px;
  font-weight: 800;
}

/* Action buttons — softer, today-view style */
.dash-alerts-actions button {
  min-height: 30px;
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: none;
}
.dash-alerts-actions button:hover {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
  transform: none;
  box-shadow: none;
}

/* Matrix / bubble tune */
.dash-alerts-matrix {
  border-radius: 12px;
  background:
    linear-gradient(90deg, transparent 49.7%, var(--border) 50%, transparent 50.3%),
    linear-gradient(0deg,  transparent 49.7%, var(--border) 50%, transparent 50.3%),
    var(--surface-2);
  border: 1px solid var(--border);
}
.dash-alerts-bubble {
  width: 40px; height: 40px;
  right: calc(var(--x) - 20px);
  top:   calc(var(--y) - 20px);
  background: rgba(239, 68, 68, .32);
  border: 1px solid color-mix(in srgb, var(--alerts-red) 35%, transparent);
  box-shadow: 0 8px 18px rgba(239, 68, 68, .16);
}
.dash-alerts-bubble-opportunity {
  background: rgba(16, 185, 129, .34);
  border-color: color-mix(in srgb, var(--alerts-green) 38%, transparent);
  box-shadow: 0 8px 18px rgba(16, 185, 129, .16);
}
.dash-alerts-bubble span {
  font-size: 10px;
  color: var(--text);
  font-weight: 700;
}

/* ---------- Trends section ---------- */
.dash-alerts-trends { display: grid; gap: 10px; }
.dash-alerts-trends-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr;
  gap: 14px;
}
@media (max-width: 1180px) { .dash-alerts-trends-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px)  { .dash-alerts-trends-grid { grid-template-columns: 1fr; } }
.dash-alerts-trend-cell { display: grid; gap: 10px; }
.dash-alerts-trend-cell .dash-alerts-chart-wrap { height: 260px; }
.dash-alerts-donut-wrap {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  max-width: 260px;
  margin-inline: auto;
  width: 100%;
}
.dash-alerts-donut-wrap canvas { width: 100% !important; height: 100% !important; }

/* ---------- Timeline (existing but re-tuned) ---------- */
.dash-alerts-timeline article {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  gap: 10px;
}
.dash-alerts-timeline time {
  color: var(--brand-700);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -.1px;
}
.dash-alerts-timeline h3 {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.55;
  color: var(--text);
}
.dash-alerts-timeline p {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.55;
}
.dash-alerts-timeline b {
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(44,120,115,.14);
  color: var(--brand-700);
}
.dash-alerts-timeline article:nth-child(1),
.dash-alerts-timeline article:nth-child(2),
.dash-alerts-timeline article:nth-child(3) {
  background: linear-gradient(180deg, rgba(245, 158, 11, .07), var(--surface-2));
  box-shadow: inset -3px 0 0 var(--alerts-amber);
}
.dash-alerts-timeline article:nth-child(1) b,
.dash-alerts-timeline article:nth-child(2) b,
.dash-alerts-timeline article:nth-child(3) b {
  background: rgba(245, 158, 11, .16);
  color: var(--alerts-value-amber);
}
.dash-alerts-timeline article:nth-child(n+4) {
  background: linear-gradient(180deg, rgba(59, 130, 246, .06), var(--surface-2));
  box-shadow: inset -3px 0 0 var(--alerts-blue);
}
.dash-alerts-timeline article:nth-child(n+4) b {
  background: rgba(59, 130, 246, .14);
  color: var(--alerts-value-blue);
}

/* ---------- Diaco why list ---------- */
.dash-alerts-why {
  background: linear-gradient(180deg, rgba(139, 92, 246, .05), var(--surface));
}
.dash-alerts-reason-list div {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.dash-alerts-reason-list span {
  background: rgba(139, 92, 246, .14);
  color: var(--alerts-value-purple);
  font-size: 12px;
  font-weight: 800;
}
.dash-alerts-reason-list p {
  font-size: 12px;
  color: var(--text);
  line-height: 1.75;
  font-weight: 500;
}

/* ---------- Live Alert Stream (NEW) ---------- */
.dash-alerts-stream {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 900px) { .dash-alerts-stream { grid-template-columns: 1fr; } }

.dash-alerts-stream-item {
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 10px;
  align-items: start;
  animation: slideUp .4s ease both;
  animation-delay: calc(var(--i, 0) * 40ms);
  position: relative;
}
.dash-alerts-stream-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-top: 6px;
  background: var(--brand-500);
}
.dash-alerts-stream-rose  { box-shadow: inset -3px 0 0 var(--alerts-red);    background: linear-gradient(180deg, rgba(239, 68, 68, .06), var(--surface-2)); }
.dash-alerts-stream-rose  .dash-alerts-stream-dot { background: var(--alerts-red); animation: pulseGlow 2s infinite; }
.dash-alerts-stream-peach { box-shadow: inset -3px 0 0 var(--alerts-amber);  background: linear-gradient(180deg, rgba(245, 158, 11, .06), var(--surface-2)); }
.dash-alerts-stream-peach .dash-alerts-stream-dot { background: var(--alerts-amber); }
.dash-alerts-stream-mint  { box-shadow: inset -3px 0 0 var(--alerts-green);  background: linear-gradient(180deg, rgba(16, 185, 129, .06), var(--surface-2)); }
.dash-alerts-stream-mint  .dash-alerts-stream-dot { background: var(--alerts-green); }
.dash-alerts-stream-sky   { box-shadow: inset -3px 0 0 var(--alerts-blue);   background: linear-gradient(180deg, rgba(59, 130, 246, .06), var(--surface-2)); }
.dash-alerts-stream-sky   .dash-alerts-stream-dot { background: var(--alerts-blue); }
.dash-alerts-stream-lilac { box-shadow: inset -3px 0 0 var(--alerts-purple); background: linear-gradient(180deg, rgba(139, 92, 246, .06), var(--surface-2)); }
.dash-alerts-stream-lilac .dash-alerts-stream-dot { background: var(--alerts-purple); }

.dash-alerts-stream-body { display: grid; gap: 4px; min-width: 0; }
.dash-alerts-stream-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.dash-alerts-stream-head time {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 600;
}
.dash-alerts-stream-badge {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  background: rgba(44,120,115,.14);
  color: var(--brand-700);
}
.dash-alerts-stream-badge-rose  { background: rgba(239, 68, 68, .14);   color: var(--alerts-value-red); }
.dash-alerts-stream-badge-peach { background: rgba(245, 158, 11, .14);  color: var(--alerts-value-amber); }
.dash-alerts-stream-badge-mint  { background: rgba(16, 185, 129, .14);  color: var(--alerts-value-green); }
.dash-alerts-stream-badge-sky   { background: rgba(59, 130, 246, .14);  color: var(--alerts-value-blue); }
.dash-alerts-stream-badge-lilac { background: rgba(139, 92, 246, .14);  color: var(--alerts-value-purple); }
.dash-alerts-stream-item h3 {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.55;
  margin: 0;
}
.dash-alerts-stream-item p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
  font-weight: 500;
}

/* ---------- AI Decision cards ---------- */
.dash-alerts-decision-grid { gap: 12px; }
.dash-alerts-ai-card {
  background: linear-gradient(180deg, rgba(44,120,115,.06), var(--surface));
  box-shadow: inset -3px 0 0 var(--brand-500), var(--shadow-sm);
  border-color: color-mix(in srgb, var(--brand-500) 20%, var(--border));
}
.dash-alerts-ai-card h3 {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.55;
}
.dash-alerts-ai-card p {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.75;
  font-weight: 500;
}
.dash-alerts-ai-card strong {
  font-size: 12.5px;
  color: var(--brand-700);
  font-weight: 800;
}
.dash-alerts-ai-card > b {
  background: rgba(44,120,115,.14);
  color: var(--brand-700);
  font-size: 10.5px;
  padding: 3px 10px;
  border-radius: 999px;
}
.dash-alerts-ai-num {
  width: 30px; height: 30px;
  border-radius: 10px;
  background: rgba(44,120,115,.14);
  color: var(--brand-700);
  font-size: 13px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

/* ---------- Escalation Playbooks (NEW) ---------- */
.dash-alerts-playbook-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 1180px) { .dash-alerts-playbook-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px)  { .dash-alerts-playbook-grid { grid-template-columns: 1fr; } }

.dash-alerts-playbook {
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  gap: 12px;
  animation: slideUp .45s ease both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.dash-alerts-playbook-head {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: start;
}
.dash-alerts-playbook-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 18px;
}
.dash-alerts-playbook h3 {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.55;
  margin: 2px 0 4px;
}
.dash-alerts-playbook p {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.75;
  font-weight: 500;
  margin: 0;
}
.dash-alerts-playbook-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.dash-alerts-playbook-meta div {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  gap: 2px;
}
.dash-alerts-playbook-meta span {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 600;
}
.dash-alerts-playbook-meta strong {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.1px;
}
.dash-alerts-playbook-rose  { background: linear-gradient(180deg, rgba(239, 68, 68, .07), var(--surface-2));  box-shadow: inset -3px 0 0 var(--alerts-red); }
.dash-alerts-playbook-rose  .dash-alerts-playbook-icon { background: rgba(239, 68, 68, .15); }
.dash-alerts-playbook-peach { background: linear-gradient(180deg, rgba(245, 158, 11, .07), var(--surface-2)); box-shadow: inset -3px 0 0 var(--alerts-amber); }
.dash-alerts-playbook-peach .dash-alerts-playbook-icon { background: rgba(245, 158, 11, .15); }
.dash-alerts-playbook-mint  { background: linear-gradient(180deg, rgba(16, 185, 129, .07), var(--surface-2)); box-shadow: inset -3px 0 0 var(--alerts-green); }
.dash-alerts-playbook-mint  .dash-alerts-playbook-icon { background: rgba(16, 185, 129, .15); }
.dash-alerts-playbook-sky   { background: linear-gradient(180deg, rgba(59, 130, 246, .07), var(--surface-2)); box-shadow: inset -3px 0 0 var(--alerts-blue); }
.dash-alerts-playbook-sky   .dash-alerts-playbook-icon { background: rgba(59, 130, 246, .15); }
.dash-alerts-playbook-lilac { background: linear-gradient(180deg, rgba(139, 92, 246, .07), var(--surface-2)); box-shadow: inset -3px 0 0 var(--alerts-purple); }
.dash-alerts-playbook-lilac .dash-alerts-playbook-icon { background: rgba(139, 92, 246, .15); }

/* Dark theme adjustments */
[data-theme="dark"] .dash-alerts-page {
  --alerts-value-red:    #ff9db1;
  --alerts-value-amber:  #ffca7a;
  --alerts-value-green:  #7de3b0;
  --alerts-value-blue:   #94b7ff;
  --alerts-value-purple: #c4b0ff;
}
[data-theme="dark"] .dash-alerts-mini,
[data-theme="dark"] .dash-alerts-tile,
[data-theme="dark"] .dash-alerts-timeline article,
[data-theme="dark"] .dash-alerts-reason-list div,
[data-theme="dark"] .dash-alerts-stream-item,
[data-theme="dark"] .dash-alerts-playbook,
[data-theme="dark"] .dash-alerts-metrics div,
[data-theme="dark"] .dash-alerts-op-meta div,
[data-theme="dark"] .dash-alerts-reason,
[data-theme="dark"] .dash-alerts-actionline {
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
  border-color: var(--border);
}

/* =========================================================================
   ALERTS HERO — Polished KPI-style Orb & Movers (2026-07-12)
   الگو از `.dash-kpi-page .dash-kpi-hero` — گرادیان بنفش/آبی/سبز + SVG orb + pulse
   ========================================================================= */
.dash-alerts-page .dash-alerts-hero {
  padding: 18px 22px;
  border-radius: 18px;
  gap: 20px;
  grid-template-columns: minmax(0, 1.25fr) minmax(240px, .75fr);
  min-height: 0;
  background:
    radial-gradient(circle at 8% 0%,  rgba(111,185,143,0.16), transparent 42%),
    radial-gradient(circle at 92% 100%, rgba(34,211,238,0.13), transparent 46%),
    linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.dash-alerts-eyebrow {
  color: var(--brand-600);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.dash-alerts-page .dash-alerts-hero-copy h1 {
  margin: 6px 0 4px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.3px;
  line-height: 1.35;
  color: var(--text);
}
.dash-alerts-page .dash-alerts-hero-copy p {
  font-size: 13px;
  line-height: 1.65;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0;
}

/* Mover pills — top opportunity (up) + top alert (down) */
.dash-alerts-hero-movers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.dash-alerts-mover-pill {
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(6px);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: center;
}
.dash-alerts-mover-pill span {
  grid-column: 1 / -1;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .1px;
}
.dash-alerts-mover-pill strong {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.2px;
  color: var(--text);
  line-height: 1.45;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-alerts-mover-pill em {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  font-style: normal;
  white-space: nowrap;
}
.dash-alerts-mover-up   { background: rgba(52,211,153,0.14); border-color: rgba(52,211,153,0.28); }
.dash-alerts-mover-up   em { background: var(--green-50); color: #2f8a5e; }
.dash-alerts-mover-down { background: rgba(232,120,140,0.14); border-color: rgba(232,120,140,0.28); }
.dash-alerts-mover-down em { background: var(--red-50); color: #b14458; }

[data-theme="dark"] .dash-alerts-mover-pill {
  background: rgba(15,29,63,0.55);
}

/* Hero mini stats — mc-pill flavor */
.dash-alerts-page .dash-alerts-hero-cards {
  margin-top: 14px;
  gap: 10px;
}
.dash-alerts-page .dash-alerts-mini {
  min-height: 0;
  padding: 10px 12px;
  border-radius: 12px;
  gap: 2px;
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--border);
  box-shadow: none;
}
.dash-alerts-page .dash-alerts-mini span    { font-size: 10.5px; font-weight: 700; color: var(--text-muted); }
.dash-alerts-page .dash-alerts-mini strong  { font-size: 20px;   font-weight: 800; letter-spacing: -.4px; line-height: 1.2; }
.dash-alerts-page .dash-alerts-mini em      { font-size: 10.5px; font-weight: 600; color: var(--text-muted); font-style: normal; }
.dash-alerts-page .dash-alerts-mini-rose  { background: linear-gradient(135deg, rgba(255,255,255,0.7), rgba(245,194,199,.35)); }
.dash-alerts-page .dash-alerts-mini-mint  { background: linear-gradient(135deg, rgba(255,255,255,0.7), rgba(184,230,211,.35)); }
.dash-alerts-page .dash-alerts-mini-peach { background: linear-gradient(135deg, rgba(255,255,255,0.7), rgba(255,228,204,.42)); }
.dash-alerts-page .dash-alerts-mini-sky   { background: linear-gradient(135deg, rgba(255,255,255,0.7), rgba(184,212,241,.35)); }
.dash-alerts-page .dash-alerts-mini-lilac { background: linear-gradient(135deg, rgba(255,255,255,0.7), rgba(221,214,254,.40)); }
.dash-alerts-page .dash-alerts-mini-rose  strong { color: var(--alerts-value-red); }
.dash-alerts-page .dash-alerts-mini-mint  strong { color: var(--alerts-value-green); }
.dash-alerts-page .dash-alerts-mini-peach strong { color: var(--alerts-value-amber); }
.dash-alerts-page .dash-alerts-mini-sky   strong { color: var(--alerts-value-blue); }
.dash-alerts-page .dash-alerts-mini-lilac strong { color: var(--alerts-value-purple); }
/* Kill inset side-bar on hero mini (replaced by soft tint) */
.dash-alerts-page .dash-alerts-mini { box-shadow: none; }

[data-theme="dark"] .dash-alerts-page .dash-alerts-mini {
  background: rgba(15,29,63,0.55);
}

/* ---- Health Orb — SVG rings + pulse + gradient text ---- */
.dash-alerts-page .dash-alerts-radar {
  position: relative;
  min-height: 240px;
  display: grid;
  place-items: center;
  isolation: isolate;
  padding: 0;
  overflow: visible;
}
/* Kill old conic halo, waves, sparkline */
.dash-alerts-page .dash-alerts-radar::before,
.dash-alerts-page .dash-alerts-radar::after { display: none; }
.dash-alerts-page .dash-alerts-radar > .dash-alerts-sparkline,
.dash-alerts-page .dash-alerts-radar > .dash-alerts-wave,
.dash-alerts-page .dash-alerts-radar > .dash-alerts-orb { display: none !important; }

.dash-alerts-page .dash-alerts-radar {
  background:
    radial-gradient(circle, rgba(111,185,143,0.14), transparent 60%),
    radial-gradient(circle at 30% 30%, rgba(34,211,238,0.10), transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(52,211,153,0.10), transparent 55%);
  border-radius: 50%;
}

.dash-alerts-orb-svg {
  position: absolute;
  width: 210px;
  height: 210px;
  z-index: 0;
  filter: drop-shadow(0 8px 24px rgba(111,185,143,.28));
}
.dash-alerts-orb-track { stroke: rgba(15,23,42,0.08); }
.dash-alerts-orb-track-2 {
  stroke: rgba(111,185,143,0.22);
  stroke-dasharray: 2 4;
  animation: alertsOrbSpin 40s linear infinite;
  transform-origin: 60px 60px;
}
.dash-alerts-orb-arc {
  stroke-dasharray: var(--c);
  stroke-dashoffset: calc(var(--c) - var(--c) * var(--p) / 100);
  animation: alertsOrbDraw 2.4s cubic-bezier(.25,.1,.25,1) both;
}
.dash-alerts-orb-dots circle {
  transform-origin: 60px 60px;
  animation: alertsOrbSpin 20s linear infinite;
  filter: drop-shadow(0 0 5px currentColor);
  opacity: .9;
}
.dash-alerts-orb-dots circle:nth-child(2) { animation-duration: 24s; animation-direction: reverse; }
.dash-alerts-orb-dots circle:nth-child(3) { animation-duration: 28s; }
.dash-alerts-orb-dots circle:nth-child(4) { animation-duration: 32s; animation-direction: reverse; }

.dash-alerts-orb-pulse {
  position: absolute;
  width: 210px; height: 210px;
  border-radius: 50%;
  border: 2px solid rgba(111,185,143,0.32);
  animation: alertsOrbPulse 2.8s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes alertsOrbDraw { from { stroke-dashoffset: var(--c); } }
@keyframes alertsOrbSpin { to { transform: rotate(360deg); } }
@keyframes alertsOrbPulse {
  0%, 100% { transform: scale(1);    opacity: 0; }
  50%      { transform: scale(1.08); opacity: 1; }
}

/* Inner ring text (gradient number + subtitle) */
.dash-alerts-ring {
  width: 148px;
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 20px 16px;
  gap: 4px;
  background: transparent;
  box-shadow: none;
  z-index: 1;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
}
.dash-alerts-ring > span {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -1.5px;
  line-height: 1;
  background: linear-gradient(135deg, #6fb98f, #22d3ee 55%, #34d399);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
}
.dash-alerts-ring > span em {
  font-style: normal;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
  background: linear-gradient(135deg, #6fb98f, #22d3ee);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}
.dash-alerts-ring small {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text);
  margin-top: 2px;
  white-space: nowrap;
}
.dash-alerts-ring b {
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 130px;
}

/* Responsive hero collapse */
@media (max-width: 900px) {
  .dash-alerts-page .dash-alerts-hero {
    grid-template-columns: 1fr;
  }
  .dash-alerts-hero-movers {
    grid-template-columns: 1fr;
  }
  .dash-alerts-page .dash-alerts-radar {
    min-height: 220px;
  }
}

/* Empty-state + soft-chip group + toast (interactive UX bits) */
.dash-alerts-empty {
  padding: 22px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px dashed color-mix(in srgb, var(--border-strong) 60%, transparent);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  line-height: 1.85;
}
.dash-alerts-soft-chip-group {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}
.dash-alerts-toast-host {
  position: fixed;
  bottom: 20px;
  inset-inline-start: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.dash-alerts-toast {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--brand-700);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease;
  max-width: 320px;
  direction: rtl;
  font-family: 'Vazirmatn', system-ui, sans-serif;
}
.dash-alerts-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Radar orb tune */
.dash-alerts-radar { min-height: 220px; padding: 14px 20px 40px; }
.dash-alerts-radar::before {
  width: 200px; height: 200px;
  background:
    repeating-radial-gradient(circle, transparent 0 28px, rgba(44,120,115,.12) 29px 30px),
    conic-gradient(from 120deg, rgba(239, 68, 68, .08), rgba(59, 130, 246, .10), rgba(16, 185, 129, .10), rgba(239, 68, 68, .08));
}
.dash-alerts-orb { width: 128px; }
.dash-alerts-orb strong { font-size: 22px; }
.dash-alerts-wave {
  font-size: 10.5px;
  font-weight: 700;
  padding: 5px 9px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* ─────────────────────────────────────────────────────────────────────────
 * DiacoEmptyState (assets/js/empty-state.js) — TRFC-0013 / ARFC-0006 §6.3.
 * Namespace `es-*`. Shared "no-data / no-results / error" placeholder,
 * also the render target for the backend's 409 PREREQUISITE_MISSING contract.
 * ───────────────────────────────────────────────────────────────────────── */
.es-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 40px 24px;
  border-radius: var(--radius, 16px);
  border: 1px dashed var(--border);
  background: var(--surface);
  font-family: 'Vazirmatn', system-ui, sans-serif;
  animation: esFadeIn .25s ease;
}
@keyframes esFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.es-icon {
  font-size: 34px;
  line-height: 1;
  margin-bottom: 2px;
  filter: grayscale(.15);
}
.es-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text);
}
.es-message {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 420px;
  line-height: 1.9;
}
.es-actions {
  margin-top: 6px;
}
.es-cta {
  border: none;
  border-radius: var(--radius-sm, 8px);
  padding: 9px 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.es-cta:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.es-cta:active { transform: translateY(0); }

/* variant accents on the icon chip background */
.es-variant-no-results .es-icon,
.es-variant-error .es-icon {
  padding: 6px;
  border-radius: 50%;
}
.es-variant-error .es-title { color: #b91c1c; }
.es-variant-error .es-cta { background: linear-gradient(135deg, #ef4444, #b91c1c); }

/* Owner-approved 2026-11-04: expose the existing catalog error appearance.
   The default state and every existing consumer retain their original style. */
.es-wrap.es-presentation-catalog {
  width: 100%;
  border: none;
  background: transparent;
  padding: 24px 12px 20px;
  box-shadow: none;
}
.es-presentation-catalog .es-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 28px;
  margin-bottom: 4px;
  filter: none;
  background: color-mix(in srgb, var(--pastel-rose) 55%, var(--surface));
  box-shadow: 0 8px 20px -8px rgba(225, 29, 72, .25);
}

.es-stage {
  position: relative;
  isolation: isolate;
  min-block-size: 430px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
}
.es-preview {
  display: grid;
  gap: 22px;
  min-block-size: 430px;
  padding: 34px;
  filter: blur(11px);
  opacity: .72;
  pointer-events: none;
  user-select: none;
}
.es-stage > .es-preview { filter: blur(11px); opacity: .72; }
.es-preview__tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.es-preview__tiles i {
  min-block-size: 96px;
  border-radius: 22px;
  background: linear-gradient(135deg, #b8e6d3, #effbf6);
}
.es-preview__tiles i:nth-child(2) { background: linear-gradient(135deg, #b8d4f1, #eff7ff); }
.es-preview__tiles i:nth-child(3) { background: linear-gradient(135deg, #ffe4cc, #fff8ef); }
.es-preview__tiles i:nth-child(4) { background: linear-gradient(135deg, #ddd6fe, #f7f4ff); }
.es-preview__body {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 20px;
}
.es-preview__bars {
  display: flex;
  align-items: end;
  gap: 12px;
  min-block-size: 210px;
  padding: 24px;
  border-radius: 24px;
  background: #f1f7fb;
}
.es-preview__bars i { flex: 1; min-inline-size: 0; border-radius: 12px 12px 5px 5px; background: #6b9fd4; }
.es-preview__bars i:nth-child(1) { block-size: 42%; background: #6dbf8f; }
.es-preview__bars i:nth-child(2) { block-size: 76%; background: #8b6fdc; }
.es-preview__bars i:nth-child(3) { block-size: 58%; background: #e8a76b; }
.es-preview__bars i:nth-child(4) { block-size: 88%; background: #e8788c; }
.es-preview__bars i:nth-child(5) { block-size: 66%; background: #48a6b8; }
.es-preview__lines { display: grid; align-content: center; gap: 16px; padding: 28px; border-radius: 24px; background: #f8fafc; }
.es-preview__lines i { display: block; block-size: 16px; border-radius: 999px; background: linear-gradient(90deg, #b8d4f1 0 68%, #e9eff3 68%); }
.es-preview__lines i:nth-child(2) { background: linear-gradient(90deg, #b8e6d3 0 46%, #e9eff3 46%); }
.es-preview__lines i:nth-child(3) { background: linear-gradient(90deg, #ddd6fe 0 82%, #e9eff3 82%); }
.es-preview__lines i:nth-child(4) { background: linear-gradient(90deg, #f5c2c7 0 57%, #e9eff3 57%); }
.es-stage__message {
  position: absolute;
  z-index: 2;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  inline-size: min(440px, calc(100% - 40px));
  filter: none !important;
  opacity: 1 !important;
  pointer-events: auto;
}
.es-stage__message .es-wrap {
  padding: 28px 24px;
  border-style: solid;
  border-color: rgba(255, 255, 255, .9);
  border-radius: 24px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 18px 50px rgba(31, 55, 70, .13);
  backdrop-filter: blur(14px);
}
@media (max-width: 760px) {
  .es-preview { padding: 22px; }
  .es-preview__tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .es-preview__body { grid-template-columns: minmax(0, 1fr); }
  .es-preview__lines { display: none; }
}
/* ======================================================================
   ERP menu display mode — D-048 gam-e sheshom (erp-menu-mode.js)
   ====================================================================== */

/* Distributed ERP item hidden by the "consolidated, don't keep" mode.
   A dedicated attribute+class (not the `hidden` HTML attribute) so it can't
   collide with any other visibility mechanism already touching nav items. */
.nav-item[data-erp-hidden="true"] {
  display: none !important;
}

/* Small "ERP" tag on distributed items so operators know they're
   ERP-backed even while scattered across topical nav groups. */
.nav-erp-badge {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--brand-700, #4c3f9e);
  background: color-mix(in srgb, var(--brand-500, #2c7873) 16%, transparent);
  border-radius: 999px;
  padding: 1px 6px;
  margin-inline-start: auto;
  white-space: nowrap;
}
.nav-subitem:hover .nav-erp-badge,
.nav-subitem.active .nav-erp-badge {
  background: color-mix(in srgb, var(--brand-500, #2c7873) 28%, transparent);
}

/* [erp-menu-dual-views] The ERP-suite pillar is now a real 3-level tree
   (Founder: «توی منو بخش مجموعه ای ار پی خودش میشه منوی اول، زنجیره تامین و
   تولید میشه لول دوم، موارد زیر مجموعه‌اش لول سوم»):
     L1 = the "مجموعهٔ ERP" pillar itself (menu-restructure.js, .mn2-pillar).
     L2 = one real collapsible .nav-group per origin topical section, built
          by erp-menu-mode.js's buildLevel2Group() — was a plain static
          <div class="nav-erp-suite-subhead"> heading before this change.
     L3 = the actual cloned route links (unchanged).
   The shell `.nav-group[data-erp-suite-group]` (erp-menu-mode.js's
   `[data-erp-suite-body]` host) sits BETWEEN L1 and L2 only because
   menu-restructure.js's pillar-wrapping mechanism needs a single member
   `.nav-group` to move into the pillar — its own header would otherwise
   repeat the pillar's "مجموعهٔ ERP (یکپارچه)" title one row down (the exact
   duplicate-title bug fixed for platform-admin below). So it's forced
   into a headless, always-expanded pass-through: L1 opens straight into
   the L2 list, no redundant middle row. */
.nav-group[data-erp-suite-group] > .nav-group-head {
  display: none;
}
.nav-group[data-erp-suite-group] > .nav-group-body {
  max-height: none !important;
  opacity: 1 !important;
  overflow: visible !important;
}

/* L2 — one real collapsible group per origin section inside the ERP suite.
   Reuses .nav-group/-head/-body verbatim (same click/caret/localStorage-
   persist wiring as every other sidebar group, app.js's initNavGroups()) —
   only trimmed a notch since it now nests one level deeper than a normal
   top-level group. */
.nav-erp-suite-subgroup {
  margin: 1px 0;
}
.nav-erp-suite-subgroup > .nav-group-head {
  padding-inline-start: 6px;
  font-size: 10.5px;
  opacity: .85;
}
.nav-erp-suite-subgroup > .nav-group-head:hover,
.nav-erp-suite-subgroup.has-active > .nav-group-head {
  opacity: 1;
}
.nav-erp-suite-subgroup > .nav-group-body {
  margin-inline-start: 4px;
}
.nav-erp-suite-subgroup > .nav-group-body .nav-subitem {
  margin-inline-start: 10px;
}

/* Small inline note on a topical group that is only PARTIALLY consolidated
   away (some items also live in the ERP suite, some don't/aren't ERP-backed
   yet) — Founder asked the two listings not to read as coincidentally-
   same-titled unrelated menus. A fully-consolidated group instead hides
   entirely (see erp-menu-mode.js's updateOriginGroupVisibility()), so this
   note only ever appears on a group that still legitimately has content of
   its own here. */
.nav-erp-partial-note {
  flex: none;
  font-size: 10px;
  color: var(--brand-600, #5a4fc0);
  opacity: .8;
  margin-inline-start: 4px;
}

/* ---------------------------------------------------------------------
   Settings page — #settings-erp-menu (emm-* namespace)
   --------------------------------------------------------------------- */
.emm-page {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 920px;
}
.emm-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.emm-eyebrow {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-600, #5a4fc0);
}
.emm-title {
  font-size: 22px;
  font-weight: 800;
  margin: 0;
}
.emm-sub {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.9;
  margin: 0;
}
.emm-modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.emm-mode-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.emm-mode-card input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--brand-500, #2c7873);
}
.emm-mode-card__icon {
  font-size: 22px;
  line-height: 1;
}
.emm-mode-card__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}
.emm-mode-card__body b {
  font-size: 14px;
}
.emm-mode-card__body span {
  color: var(--muted);
  line-height: 1.7;
}
.emm-mode-card:hover {
  border-color: var(--brand-400, #8a97d6);
}
.emm-mode-card--active {
  border-color: var(--brand-500, #2c7873);
  background: color-mix(in srgb, var(--brand-500, #2c7873) 7%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500, #2c7873) 12%, transparent);
}
.emm-subopts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface-soft, var(--surface-2, var(--surface)));
  border: 1px solid var(--border);
  transition: opacity .18s ease;
}
.emm-subopts--irrelevant {
  opacity: .5;
}
.emm-toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  cursor: pointer;
}
.emm-toggle-row input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--brand-500, #2c7873);
}
.emm-preview {
  padding: 16px;
  border-radius: 14px;
  border: 1px dashed var(--border);
}
.emm-preview-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 12px;
}
.emm-preview-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.emm-preview-group b {
  font-size: 12.5px;
  color: var(--brand-600, #5a4fc0);
  display: block;
  margin-bottom: 6px;
}
.emm-preview-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.emm-preview-group li {
  font-size: 12.5px;
  color: var(--text);
  padding-inline-start: 12px;
  position: relative;
}
.emm-preview-group li::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border);
}
.rich-rate-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  line-height: 1.9;
}

.rich-rate-summary span,
.rich-rate-summary b {
  white-space: nowrap;
}

/* ── [crm-multi-pipeline-ui-seed] dynamic pipeline menu groups 2026-08-02 ── */
.nav-group.crm-pl-dynamic {
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.nav-group.crm-pl-dynamic .nav-group-head {
  padding-inline-start: 1rem;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.nav-group.crm-pl-dynamic .nav-group-head:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}
.crm-pl-count {
  margin-inline-start: auto;
  background: var(--primary-tint, #e8f4ff);
  color: var(--primary, #1a73e8);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 0.72rem;
  font-weight: 600;
}
.crm-pl-pipeline-label {
  font-size: 0.68rem;
  color: var(--text-tertiary, #aaa);
  padding: 4px 1.2rem 2px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.afc-pl-loading {
  pointer-events: none;
  min-height: 38px;
  display: flex;
  align-items: center;
  padding-inline: 1rem;
}
.afc-pl-loading__line {
  display: block;
  width: var(--afc-pl-loading-width, 68%);
  height: 11px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--surface-2) 20%, var(--border) 45%, var(--surface-2) 70%);
  background-size: 220% 100%;
  animation: afc-pl-loading-shimmer 1.2s ease-in-out infinite;
}
.afc-pl-loading:nth-child(2) .afc-pl-loading__line { --afc-pl-loading-width: 52%; }
.afc-pl-loading:nth-child(3) .afc-pl-loading__line { --afc-pl-loading-width: 61%; }
@keyframes afc-pl-loading-shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .afc-pl-loading__line { animation: none; }
}
/* CRM review: the organization-tree shortcut is intentionally removed from the global header. */
html body[data-tbv-wot="1"] #wot-toggle.wot-toggle,
body[data-tbv-wot] #wot-toggle { display: none !important; }
/* CRM reports: shared design-system composition and semantic pastel themes. */
.crm-report-page { --crm-report-accent:#0f766e; --crm-report-soft:#ecfdf5; display:grid; gap:20px; }
.crm-report-page--advisors { --crm-report-accent:#6366f1; --crm-report-soft:#eef2ff; }
.crm-report-page--sources { --crm-report-accent:#0f766e; --crm-report-soft:#ecfdf5; }
.crm-report-page--loss { --crm-report-accent:#e11d48; --crm-report-soft:#fff1f2; }
.crm-report-page--followups { --crm-report-accent:#7c3aed; --crm-report-soft:#f5f3ff; }
.crm-report-page > .page-head { margin:0; padding:24px 28px; min-height:126px; border:1px solid color-mix(in srgb,var(--crm-report-accent) 18%,var(--border)); border-radius:22px; background:linear-gradient(115deg,var(--crm-report-soft),var(--surface) 68%); box-shadow:var(--shadow-sm); display:flex; align-items:center; }
.crm-report-page > .page-head .page-title { color:var(--text); margin:0 0 8px; }
.crm-report-page > .rich-statband { margin:0; }
.crm-report-page > .card { border-radius:20px; border-color:color-mix(in srgb,var(--crm-report-accent) 12%,var(--border)); box-shadow:var(--shadow-sm); padding:22px; overflow:hidden; }
.crm-report-page .card-head { padding-block-end:16px; margin-block-end:12px; border-block-end:1px solid var(--border); }
.crm-report-page .rich-bars { display:grid; gap:13px; padding:12px 4px 18px; }
.crm-report-page .rich-bar { grid-template-columns:minmax(130px,190px) minmax(220px,1fr) minmax(210px,auto); min-height:34px; padding:5px 8px; border-radius:10px; }
.crm-report-page .rich-bar:hover { background:var(--crm-report-soft); }
.crm-report-page .rich-bar-t { height:10px; background:var(--surface-2); border-radius:999px; overflow:hidden; }
.crm-report-page .rich-bar-t i { display:block; height:100%; min-width:4px; border-radius:999px; background:var(--tc); }
.crm-report-page .rp-table { border:1px solid var(--border); border-radius:14px; overflow:hidden; background:var(--surface); }
.crm-report-page .rp-table tbody tr { transition:background-color .15s ease; }
.crm-report-page .rp-table tbody tr:hover { background:var(--crm-report-soft)!important; }
.crm-report-page--advisors>[data-cra-kpis] .kpi-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.crm-report-page--advisors>[data-cra-kpis] .kpi{min-height:0;padding:12px 14px;border-color:color-mix(in srgb,var(--crm-report-accent) 15%,var(--border));box-shadow:var(--shadow-xs)}
.cra-head-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.cra-head-actions .btn{display:inline-flex;align-items:center;gap:6px}
.crm-report-page--advisors>.page-head{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap}
.crm-report-page--advisors>.card{margin:0;min-width:0}
.cra-ds-grid{margin:0}.cra-row{cursor:pointer}.cra-row:focus-visible{outline:2px solid var(--crm-report-accent);outline-offset:-2px}
.cra-person{display:flex;align-items:center;gap:10px;min-width:0}.cra-person__text{display:grid;gap:2px;min-width:0}.cra-person__text strong{font-weight:650;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cra-person__text small{font-size:11.5px;color:var(--text-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cra-zero{color:var(--text-faint,#9aa3b0)}
.cra-detail-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;align-items:start}
.cra-detail-card{margin:0;min-width:0;border-radius:20px;border-color:color-mix(in srgb,var(--crm-report-accent) 12%,var(--border));box-shadow:var(--shadow-sm);padding:22px;overflow:hidden}
.cra-detail-list{display:grid;gap:8px;max-height:460px;overflow:auto;padding:2px 2px 6px}.cra-detail-more{font-size:11.5px;color:var(--text-muted);margin-inline-end:auto}.cra-detail-foot{display:flex;align-items:center;justify-content:flex-end;gap:10px;padding-block-start:12px;margin-block-start:10px;border-block-start:1px solid var(--border)}
.crm-report-page--sources>[data-crs-kpis] .kpi-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.crm-report-page--sources>[data-crs-kpis] .kpi{min-height:0;padding:12px 14px;border-color:color-mix(in srgb,var(--crm-report-accent) 15%,var(--border));box-shadow:var(--shadow-xs)}
.crs-report-layout{display:grid;grid-template-columns:minmax(340px,.8fr) minmax(600px,1.2fr);gap:18px;align-items:start}
.crs-report-layout>.card{margin:0;min-width:0;border-radius:20px;border-color:color-mix(in srgb,var(--crm-report-accent) 12%,var(--border));box-shadow:var(--shadow-sm);padding:22px;overflow:hidden}
.crs-chart-card .rich-bars{max-height:680px;overflow:auto;padding-inline-end:6px}.crs-chart-card .rich-bar{grid-template-columns:minmax(120px,180px) minmax(150px,1fr);align-items:center}.crs-chart-card .rich-bar-v{grid-column:1/-1;color:var(--text-muted);font-size:11px}
.crs-ds-grid{margin:0}.crs-ds-grid .ds-grid__matrix{min-width:680px}.crs-grid-row{grid-template-columns:minmax(220px,1.5fr) repeat(2,minmax(74px,.55fr)) minmax(120px,.8fr) minmax(105px,.65fr)}
.crs-grid-row>.ds-grid__cell:not(:first-child){justify-content:center;text-align:center}.crs-source-name{display:flex;align-items:center;gap:9px}.crs-source-name b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.crs-success{color:var(--success-700,#177245);font-weight:700}
.crm-report-page--loss>[data-crl-kpis] .kpi-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.crm-report-page--loss>[data-crl-kpis] .kpi{min-height:0;padding:12px 14px;border-color:color-mix(in srgb,var(--crm-report-accent) 14%,var(--border));box-shadow:var(--shadow-xs)}
.crl-report-layout{display:grid;grid-template-columns:minmax(340px,.8fr) minmax(580px,1.2fr);gap:18px;align-items:start}.crl-report-layout>.card{margin:0;min-width:0;border-radius:20px;border-color:color-mix(in srgb,var(--crm-report-accent) 10%,var(--border));box-shadow:var(--shadow-sm);padding:22px;overflow:hidden}
.crl-chart-card .rich-bars{max-height:620px;overflow:auto;padding-inline-end:6px}.crl-chart-card .rich-bar{grid-template-columns:minmax(140px,200px) minmax(150px,1fr);align-items:center}.crl-chart-card .rich-bar-v{grid-column:1/-1;color:var(--text-muted);font-size:11px}
.crl-ds-grid{margin:0}.crl-ds-grid .ds-grid__matrix{min-width:650px}.crl-grid-row{grid-template-columns:minmax(280px,1.7fr) minmax(80px,.5fr) minmax(150px,.85fr) minmax(90px,.55fr)}.crl-grid-row>.ds-grid__cell:not(:first-child){justify-content:center;text-align:center}.crl-reason-name{display:flex;align-items:center;gap:9px}.crl-reason-name b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media(max-width:1280px){.crm-report-page--advisors>[data-cra-kpis] .kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:1100px){.cra-detail-grid{grid-template-columns:1fr}}
@media(max-width:1280px){.crs-report-layout{grid-template-columns:1fr}}
@media(max-width:1280px){.crl-report-layout{grid-template-columns:1fr}}
@media (max-width:900px){.crm-report-page .rich-bar{grid-template-columns:110px 1fr}.crm-report-page .rich-bar-v{grid-column:1/-1}.crm-report-page > .page-head{padding:18px;min-height:auto}}
@media(max-width:600px){.crm-report-page--advisors>[data-cra-kpis] .kpi-grid{grid-template-columns:1fr}.cra-detail-card{padding:16px}}
@media(max-width:760px){.crm-report-page--sources>[data-crs-kpis] .kpi-grid{grid-template-columns:1fr}.crs-report-layout>.card{padding:16px}}
@media(max-width:760px){.crm-report-page--loss>[data-crl-kpis] .kpi-grid{grid-template-columns:1fr}.crl-report-layout>.card{padding:16px}}
.crm-report-page--followups>[data-crf-kpis] .kpi-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.crm-report-page--followups>[data-crf-kpis] .kpi{min-height:0;padding:12px 14px;border-color:color-mix(in srgb,var(--crm-report-accent) 14%,var(--border));box-shadow:var(--shadow-xs)}
.crf-report-layout{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;align-items:start}.crf-report-layout>.card{margin:0;min-width:0;border-radius:20px;border-color:color-mix(in srgb,var(--crm-report-accent) 11%,var(--border));box-shadow:var(--shadow-sm);padding:22px;overflow:hidden}.crf-chart-card .rich-bars{max-height:620px;overflow:auto;padding-inline-end:6px}.crf-chart-card .rich-bar{grid-template-columns:minmax(140px,190px) minmax(150px,1fr);align-items:center}.crf-chart-card .rich-bar-v{grid-column:1/-1;color:var(--text-muted);font-size:11px}
@media(max-width:1180px){.crf-report-layout{grid-template-columns:1fr}.crm-report-page--followups>[data-crf-kpis] .kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){.crm-report-page--followups>[data-crf-kpis] .kpi-grid{grid-template-columns:1fr}.crf-report-layout>.card{padding:16px}}
.crm-data-quality-page{--cdq-accent:#0f766e;--cdq-soft:#ecfdf5;display:grid;gap:20px}.cdq-page-head{margin:0;padding:24px 28px;min-height:132px;border:1px solid color-mix(in srgb,var(--cdq-accent) 18%,var(--border));border-radius:22px;background:linear-gradient(115deg,var(--cdq-soft),var(--surface) 68%);box-shadow:var(--shadow-sm);display:flex;align-items:center;justify-content:space-between;gap:24px}.cdq-page-head .page-title{margin:0 0 8px}.cdq-health{display:flex;align-items:center;gap:10px;padding:12px 16px;min-width:210px;border:1px solid var(--border);border-radius:14px;background:var(--surface);box-shadow:var(--shadow-xs)}.cdq-health>span:last-child{display:grid;gap:2px}.cdq-health b{font-size:13px;color:var(--text)}.cdq-health small{font-size:11px;color:var(--text-muted)}.cdq-health .status-dot{width:10px;height:10px;border-radius:50%;flex:0 0 auto;box-shadow:0 0 0 5px color-mix(in srgb,currentColor 12%,transparent)}.cdq-health .status-dot--warning{color:var(--warning-600,#d97706);background:currentColor}.cdq-health .status-dot--success{color:var(--success-600,#19946b);background:currentColor}.crm-data-quality-page>[data-cdq-kpis] .kpi-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.crm-data-quality-page>[data-cdq-kpis] .kpi{min-height:0;padding:12px 14px;border-color:color-mix(in srgb,var(--cdq-accent) 14%,var(--border));box-shadow:var(--shadow-xs)}.cdq-queue-card{margin:0;padding:22px;border-radius:20px;border-color:color-mix(in srgb,var(--cdq-accent) 12%,var(--border));box-shadow:var(--shadow-sm);overflow:hidden}.cdq-queue-card .card-head{padding-block-end:16px;margin-block-end:12px;border-block-end:1px solid var(--border)}.cdq-grid{margin:0}.cdq-grid .ds-grid__matrix{min-width:900px}.cdq-grid-row{grid-template-columns:56px minmax(110px,.6fr) minmax(180px,1fr) minmax(260px,1.5fr) minmax(130px,.7fr) minmax(140px,.7fr)}.cdq-issues{display:flex;flex-wrap:wrap;gap:6px}.cdq-grid .ds-grid__row--head{background:var(--surface-2)}.cdq-grid .ds-grid__body .ds-grid__row:hover{background:var(--cdq-soft)}
@media(max-width:1050px){.crm-data-quality-page>[data-cdq-kpis] .kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.cdq-page-head{align-items:flex-start;flex-direction:column}.cdq-health{width:100%}}
@media(max-width:600px){.crm-data-quality-page>[data-cdq-kpis] .kpi-grid{grid-template-columns:1fr}.cdq-page-head,.cdq-queue-card{padding:16px}.cdq-page-head{min-height:auto}}
/* «دسترسی بخش‌ها» (section-access-page.js): only the placement of the shared patterns on the page. */
[data-sa-root]{display:grid;gap:14px}
[data-sa-root] form.ds-form{display:grid;gap:12px;margin-top:14px}
[data-sa-root] [data-sa-row][hidden],[data-sa-root] [data-part-module][hidden],[data-sa-root] [data-sa-why][hidden]{display:none}

/* The Diaco Financial menu as the sidebar (menu-renderer.js «is-diaco-menu»): exactly that menu, no panel shortcut above it. */
.nav.is-diaco-menu > .nav-toplevel { display: none !important; }


/* /portal/ds/css/ui-kit.css */
/*
 * DiacoUI kit — shared component styles for new pages (Tier 3+).
 * Namespace: rui-*  · built on the design tokens in main.css · theme-aware (data-theme) · RTL.
 * Per-tone color via --rui-accent / --rui-tint / --rui-ink set on .rui-tone-* classes.
 */

/* Shared button interaction contract. Visual variants remain owned by
   .btn/.rui-btn; this baseline keeps typography, keyboard focus, disabled
   state and Material-icon sizing consistent across product pages. */
:where(#content, .ds-modal, .ds-drawer) button {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
:where(#content, .ds-modal, .ds-drawer) button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand-500) 30%, transparent);
  outline-offset: 2px;
}
:where(#content, .ds-modal, .ds-drawer) button:disabled,
:where(#content, .ds-modal, .ds-drawer) button[aria-disabled="true"] {
  cursor: not-allowed !important;
  opacity: .52;
  box-shadow: none !important;
  transform: none !important;
}
.btn {
  justify-content: center;
  min-inline-size: 40px;
  line-height: 1;
  cursor: pointer;
  isolation: isolate;
}
.btn > :where(.ds-ico, [data-ds-icon]) {
  inline-size: 18px;
  block-size: 18px;
  flex: 0 0 auto;
}
/* Literal catalog ghost-button contract (design-system.css, body.ds-shell .btn.ghost). */
.btn.ghost {
  background: color-mix(in srgb, var(--pastel-mint) 45%, var(--surface));
  border-color: color-mix(in srgb, var(--pastel-mint) 80%, var(--border));
  color: var(--brand-600);
}
.btn.ghost:hover {
  background: color-mix(in srgb, var(--pastel-mint) 65%, var(--surface));
  border-color: color-mix(in srgb, var(--brand-500) 25%, var(--border));
}
.btn.danger { background: color-mix(in srgb, var(--pastel-rose) 34%, var(--surface)); }
.btn.danger:hover {
  background: color-mix(in srgb, var(--pastel-rose) 58%, var(--surface));
  border-color: color-mix(in srgb, var(--red-500) 65%, var(--border));
}
.btn.sm {
  min-block-size: 32px;
  block-size: 32px;
  padding-inline: 12px;
  border-radius: 10px;
  font-size: 12px;
}

/* ---------- tone map ---------- */
.rui-tone-neutral { --rui-accent:#2c7873; --rui-tint:rgba(44,120,115,.10); --rui-ink:#3f4a78; }
.rui-tone-mint    { --rui-accent:#2fb98a; --rui-tint:rgba(184,230,211,.35); --rui-ink:#1c6f53; }
.rui-tone-sky     { --rui-accent:#3b82c4; --rui-tint:rgba(184,212,241,.35); --rui-ink:#255a86; }
.rui-tone-peach   { --rui-accent:#e8955f; --rui-tint:rgba(255,228,204,.40); --rui-ink:#9a5a2b; }
.rui-tone-lilac   { --rui-accent:#8b74e0; --rui-tint:rgba(221,214,254,.40); --rui-ink:#5a45a8; }
.rui-tone-rose    { --rui-accent:#e0607a; --rui-tint:rgba(245,194,199,.35); --rui-ink:#a83a52; }
.rui-tone-lemon   { --rui-accent:#d9a23b; --rui-tint:rgba(254,243,199,.45); --rui-ink:#8a6410; }
.rui-tone-red     { --rui-accent:#e05353; --rui-tint:rgba(224,83,83,.10);   --rui-ink:#a83232; }
.rui-tone-amber   { --rui-accent:#d99321; --rui-tint:rgba(217,147,33,.12);  --rui-ink:#8a5e10; }
.rui-tone-green   { --rui-accent:#2fb98a; --rui-tint:rgba(47,185,138,.12);  --rui-ink:#1c6f53; }
.rui-tone-blue    { --rui-accent:#3b82c4; --rui-tint:rgba(59,130,196,.12);  --rui-ink:#255a86; }
.rui-tone-purple  { --rui-accent:#8b74e0; --rui-tint:rgba(139,116,224,.12); --rui-ink:#5a45a8; }

[data-theme="dark"] [class*="rui-tone-"] { --rui-ink: color-mix(in srgb, var(--rui-accent) 78%, #fff); }

/* ---------- section head ---------- */
.rui-sechead { display:flex; align-items:flex-end; justify-content:space-between; gap:12px; margin:18px 0 12px; }
.rui-sechead__sub { display:block; font-size:11px; font-weight:600; color:var(--muted, #8a90a6); letter-spacing:.2px; }
.rui-sechead__title { font-size:15px; font-weight:800; margin:2px 0 0; color:var(--text, #23283b); }
.rui-sechead__actions { display:flex; gap:8px; }

/* ---------- card ---------- */
.rui-card {
  --rui-accent-edge: var(--rui-accent, var(--brand-500));
  --rui-accent-edge-w: 4px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e9ebf3);
  border-inline-start: var(--rui-accent-edge-w) solid var(--rui-accent-edge);
  border-radius: var(--radius, 16px);
  padding: 16px;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 1px 3px rgba(20, 25, 50, .04),
    0 12px 32px -14px color-mix(in srgb, var(--rui-accent-edge) 32%, transparent);
  transition: transform .25s cubic-bezier(.22, .7, .16, 1), box-shadow .25s ease, border-color .25s ease;
}
.rui-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 16px 36px -12px color-mix(in srgb, var(--rui-accent-edge) 42%, transparent),
    0 4px 14px rgba(15, 23, 42, .06);
}
.rui-card__head { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:12px; }
.rui-card__eyebrow { display:block; font-size:10.5px; font-weight:700; color:var(--rui-ink); letter-spacing:.3px; }
.rui-card__title { font-size:14px; font-weight:800; margin:2px 0 0; color:var(--text, #23283b); }
.rui-card__actions { display:flex; gap:6px; flex:0 0 auto; }

/* ---------- KPI tile ---------- */
.rui-kpi { background:var(--surface, #fff); border:1px solid var(--border, #e9ebf3); border-radius:var(--radius, 16px);
  padding:14px 16px; display:flex; flex-direction:column; gap:7px; }
.rui-kpi__label { font-size:11.5px; font-weight:500; color:var(--muted, #8a90a6); }
.rui-kpi__row { display:flex; align-items:baseline; gap:8px; }
/* Macro (value) vs. micro (label) contrast, matching the .kpi-value pass in
   main.css — this tile is reused by 37 page modules via UI.kpiTile(). */
.rui-kpi__value { font-size:23px; font-weight:800; letter-spacing:-.5px; color:var(--rui-ink); }
.rui-kpi__delta { font-size:10.5px; font-weight:600; padding:2px 7px; border-radius:999px;
  color:var(--rui-ink); background:var(--rui-tint); }
.rui-kpi__spark { margin-top:2px; }

/* ---------- chip / badge ---------- */
.rui-chip { display:inline-flex; align-items:center; font-size:11px; font-weight:700; padding:3px 10px;
  border-radius:999px; color:var(--rui-ink); background:var(--rui-tint); }
.rui-badge { display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:700; padding:3px 9px;
  border-radius:999px; color:var(--rui-ink); background:var(--rui-tint); }
.rui-badge__dot { width:6px; height:6px; border-radius:50%; background:var(--rui-accent); }
.rui-badge.is-pulse .rui-badge__dot { animation:rui-pulse 1.4s ease-in-out infinite; }
@keyframes rui-pulse { 0%,100%{ box-shadow:0 0 0 0 var(--rui-tint); } 50%{ box-shadow:0 0 0 5px transparent; } }

/* ---------- button ---------- */
.rui-btn { display:inline-flex; align-items:center; gap:6px; font-family:inherit; font-size:12.5px; font-weight:700;
  padding:8px 14px; border-radius:12px; border:1px solid var(--rui-accent); cursor:pointer;
  color:#fff; background:var(--rui-accent); transition:transform .08s ease, filter .15s ease; }
.rui-btn:hover { filter:brightness(1.05); }
.rui-btn:active { transform:translateY(1px); }
.rui-btn--ghost { background:transparent; color:var(--rui-ink); border-color:var(--border, #e9ebf3); }
.rui-btn--soft { background:var(--rui-tint); color:var(--rui-ink); border-color:transparent; }
.rui-btn__icon { display:inline-flex; }

/* ---------- table ---------- */
.rui-table-wrap { overflow-x:auto; border:1px solid var(--border, #e9ebf3); border-radius:var(--radius, 16px); }
.rui-table { width:100%; border-collapse:collapse; font-size:12.5px; }
.rui-table th { text-align:right; font-weight:700; font-size:11.5px; color:var(--muted, #8a90a6);
  padding:11px 14px; background:var(--surface-2, #f7f8fc); border-bottom:1px solid var(--border, #e9ebf3); white-space:nowrap; }
.rui-table td { padding:11px 14px; border-bottom:1px solid var(--border, #eef0f6); color:var(--text, #23283b); }
.rui-table tbody tr:last-child td { border-bottom:none; }
.rui-table tbody tr:hover td { background:var(--rui-tint); }
.rui-table__empty { text-align:center; color:var(--muted, #8a90a6); padding:24px !important; }

/* ---------- empty state ---------- */
.rui-empty { text-align:center; padding:36px 16px; color:var(--muted, #8a90a6); }
.rui-empty__icon { font-size:26px; opacity:.85; margin-bottom:8px; color:#3b5998; }
.rui-empty__icon .ds-ico { color:inherit; }
.rui-empty__title { font-size:13px; font-weight:700; color:var(--text, #23283b); }
.rui-empty__msg { font-size:12px; margin-top:4px; }

/* ---------- status tracker ---------- */
.rui-track { display:flex; align-items:center; gap:0; flex-wrap:wrap; }
.rui-track__step { display:flex; align-items:center; gap:7px; font-size:12px; font-weight:600; color:var(--muted, #8a90a6); }
.rui-track__dot { width:12px; height:12px; border-radius:50%; border:2px solid var(--border, #d7dae6); background:var(--surface, #fff); }
.rui-track__line { flex:1; min-width:20px; height:2px; background:var(--border, #e2e5ef); margin:0 8px; }
.rui-track__step.is-done { color:var(--rui-ink); }
.rui-track__step.is-done .rui-track__dot { background:var(--rui-accent); border-color:var(--rui-accent); }
.rui-track__step.is-current { color:var(--rui-ink); }
.rui-track__step.is-current .rui-track__dot { border-color:var(--rui-accent); box-shadow:0 0 0 4px var(--rui-tint); }

/* ---------- sparkline ---------- */
.rui-spark polyline { stroke:var(--rui-accent); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }

/* ---------- toast ----------
   Physical LEFT edge (matches Diaco Pilot FAB side). Uses `left`/`right`
   instead of `inset-inline-*` so the anchor is stable regardless of the
   surrounding RTL/LTR direction. Newest toast appears at the bottom;
   older ones sit above (column-reverse). */
.rui-toast-host { position:fixed; bottom:96px; left:20px; right:auto; z-index:9999;
  display:flex; flex-direction:column-reverse; gap:8px; pointer-events:none;
  max-width:min(360px, calc(100vw - 40px)); }
.rui-toast { position:relative; background:var(--surface, #fff); border:1px solid var(--border, #e9ebf3);
  border-radius:12px; padding:11px 40px 11px 19px; font-size:12.5px; font-weight:600; color:var(--text, #23283b);
  box-shadow:0 6px 24px rgba(20,25,50,.14); animation:rui-toast-in .22s ease both;
  max-width:340px; pointer-events:auto; cursor:pointer;
  display:flex; align-items:center; gap:8px; overflow:hidden; isolation:isolate; }
.rui-toast__msg { line-height:1.8; text-shadow:none; }
.rui-toast::before {
  content:""; position:absolute; inset-inline-start:0; top:0; bottom:0; width:4px;
  background:var(--rui-accent, #2c7873); border-radius:0 3px 3px 0;
}
html[dir="ltr"] .rui-toast::before, [dir="ltr"] .rui-toast::before { border-radius:3px 0 0 3px; }
.rui-toast__msg { flex:1; min-width:0; word-break:break-word; }
.rui-toast__count { display:inline-flex; align-items:center; justify-content:center;
  min-width:22px; height:20px; padding:0 6px; border-radius:999px;
  background:rgba(20,25,50,.08); color:var(--text, #23283b); font-size:11px; font-weight:700; }
/* Undo/action button (helpdesk-ticketing-p1) — inline flex item, never
   overlaps the absolutely-positioned close button in the corner. */
.rui-toast__action { flex:none; background:var(--rui-accent); color:#fff; border:0; border-radius:8px;
  padding:4px 12px; font-size:12px; font-weight:800; cursor:pointer; white-space:nowrap; }
.rui-toast__action:hover { filter:brightness(1.08); }
.rui-toast__action--cancel { background:transparent; color:var(--rui-ink, var(--text, #23283b));
  border:1px solid color-mix(in srgb, var(--rui-accent) 42%, transparent); }
.rui-toast__action--cancel:hover { background:color-mix(in srgb, var(--rui-accent) 12%, transparent); }
.rui-toast__close { position:absolute; top:6px; right:8px; width:22px; height:22px;
  display:inline-flex; align-items:center; justify-content:center; border:0; background:transparent;
  border-radius:50%; color:var(--muted, #7a8098); font-size:16px; line-height:1; cursor:pointer;
  transition:background .15s ease, color .15s ease; }
.rui-toast__close:hover { background:rgba(20,25,50,.08); color:var(--text, #23283b); }
.rui-toast.is-out { opacity:0; transform:translateX(-16px); transition:opacity .26s ease, transform .26s ease; }
/* Semantic toast tones — tinted surface + accent stripe (success/error/warning) */
.rui-toast.rui-tone-green {
  background:#ecfdf5;
  border-color:color-mix(in srgb, var(--rui-accent) 34%, var(--border, #e9ebf3));
  color:#065f46;
}
.rui-toast.rui-tone-green::before { background:#2fb98a; }
.rui-toast.rui-tone-red {
  background:#fff1f2;
  border-color:color-mix(in srgb, var(--rui-accent) 34%, var(--border, #e9ebf3));
  color:#9f1239;
}
.rui-toast.rui-tone-red::before { background:#e05353; }
.rui-toast.rui-tone-lemon,
.rui-toast.rui-tone-amber {
  background:#fffbeb;
  border-color:color-mix(in srgb, var(--rui-accent) 36%, var(--border, #e9ebf3));
  color:#92400e;
}
.rui-toast.rui-tone-lemon::before,
.rui-toast.rui-tone-amber::before { background:#d9a23b; }
.rui-toast.rui-tone-neutral::before { background:#2c7873; }
.rui-toast:is(.rui-tone-green, .rui-tone-red, .rui-tone-lemon, .rui-tone-amber) .rui-toast__close { color:var(--rui-ink); }
.rui-toast:is(.rui-tone-green, .rui-tone-red, .rui-tone-lemon, .rui-tone-amber) .rui-toast__close:hover {
  background:color-mix(in srgb, var(--rui-accent) 16%, transparent);
  color:var(--rui-ink);
}
@keyframes rui-toast-in { from{ opacity:0; transform:translateX(-16px); } to{ opacity:1; transform:translateX(0); } }

/* ---------- drawer ---------- */
.rui-drawer-back { position:fixed; inset:0; z-index:9998; background:rgba(18,22,40,.34);
  opacity:0; transition:opacity .24s ease; }
.rui-drawer-back.is-open { opacity:1; }
/* A data form or confirmation opened from a drawer stacks above it (0.529, GEX-302); dropdown and date pop-ups (10050+) stay above both. */
body:has(> .rui-drawer-back) .rlx-backdrop { z-index: 9999; }
/* A data form opened from an open modal (9999) stacks above it, e.g. «ساخت قرارداد از قالب» inside a customer's contracts. */
body:has(> .ds-modal-back.is-open) .rlx-backdrop { z-index: 10000; }
/* Drawer anchored to the physical RIGHT edge so it slides in from the right
   in RTL (the natural direction). Uses physical `right`/`left` instead of
   `inset-inline-*` because `translateX` is physical and mixing the two
   caused the drawer to reveal from the LEFT edge in RTL. */
.rui-drawer { position:absolute; inset-block:0; right:0; left:auto; width:min(720px, 96vw);
  background:var(--surface, #fff); box-shadow:0 0 40px rgba(20,25,50,.22); transform:translateX(100%);
  transition:transform .28s cubic-bezier(.3,.8,.3,1); display:flex; flex-direction:column; }
.rui-drawer-back.is-open .rui-drawer { transform:translateX(0); }
/* Explicit left-edge drawer (physical left) — e.g. complaint detail actions. */
.rui-drawer.rui-drawer--left {
  right:auto; left:0; transform:translateX(-100%);
}
.rui-drawer-back.is-open .rui-drawer.rui-drawer--left { transform:translateX(0); }
.rui-drawer-back.is-closing { opacity:0; pointer-events:none; transition:opacity .2s ease; }
.rui-drawer-back.is-closing .rui-drawer { transform:translateX(105%); transition-duration:.22s; }
html[dir="ltr"] .rui-drawer-back.is-closing .rui-drawer:not(.rui-drawer--left),
[dir="ltr"] .rui-drawer-back.is-closing .rui-drawer:not(.rui-drawer--left) { transform:translateX(-105%); }
.rui-drawer-back.is-closing .rui-drawer.rui-drawer--left { transform:translateX(-105%); }
.rui-drawer.rui-drawer--left .rui-drawer__close { left:auto; right:16px; }
/* When the ambient direction is LTR, mirror to the left edge so LTR
   admin/tools still get a natural slide-in from the physical left. */
html[dir="ltr"] .rui-drawer:not(.rui-drawer--left), [dir="ltr"] .rui-drawer:not(.rui-drawer--left) {
  right:auto; left:0; transform:translateX(-100%);
}
html[dir="ltr"] .rui-drawer-back.is-open .rui-drawer:not(.rui-drawer--left),
[dir="ltr"] .rui-drawer-back.is-open .rui-drawer:not(.rui-drawer--left) { transform:translateX(0); }
/* Rich header: gradient band (accent → darker) + soft decorative orbs +
   glass icon badge + eyebrow label + status tag. Shared by every rui-drawer
   consumer — this is the one template for all popups going forward. */
.rui-drawer__head {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; gap: 14px;
  padding: 28px 22px 22px;
  background: linear-gradient(155deg, var(--rui-accent) 0%, color-mix(in srgb, var(--rui-accent) 55%, #10162c) 115%);
  color: #fff;
}
.rui-drawer__orb { position: absolute; border-radius: 50%; background: #fff; filter: blur(28px); pointer-events: none; z-index: -1; }
.rui-drawer__orb-a { width: 160px; height: 160px; top: -70px; inset-inline-start: -45px; opacity: .16; }
.rui-drawer__orb-b { width: 110px; height: 110px; bottom: -50px; inset-inline-end: 10px; opacity: .12; }
.rui-drawer__head-row { display: flex; align-items: center; gap: 13px; }
.rui-drawer__ic {
  width: 50px; height: 50px; border-radius: 16px; flex: none; font-size: 24px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.2); backdrop-filter: blur(6px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.32), 0 8px 18px -8px rgba(0,0,0,.3);
}
.rui-drawer__eyebrow { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; opacity: .82; margin-bottom: 3px; }
.rui-drawer__head h3 { font-size: 16.5px; font-weight: 800; margin: 0; color: #fff; line-height: 1.35; }
.rui-drawer__tag {
  align-self: flex-start; font-size: 11px; font-weight: 700; padding: 5px 12px; border-radius: 999px;
  background: rgba(255,255,255,.2); backdrop-filter: blur(4px); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.26);
}
.rui-drawer__close {
  position: absolute; top: 16px; left: 16px; z-index: 2; border: none; font-size: 14px; line-height: 1; cursor: pointer;
  color: #fff; background: rgba(255,255,255,.2); backdrop-filter: blur(6px);
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.3);
  transition: background .15s, transform .2s;
}
html[dir="ltr"] .rui-drawer__close, [dir="ltr"] .rui-drawer__close { left: auto; right: 16px; }
.rui-drawer__close:hover { background: rgba(255,255,255,.34); transform: rotate(90deg); }
.rui-drawer__body { padding: 20px 22px 24px; overflow-y: auto; flex: 1; }

/* ---------- reusable content utilities (drawers, cards, anywhere) ---------- */
.rui-list-check, .rui-list-steps { margin: 0; padding: 0; list-style: none; font-size: 13px; line-height: 1.7; color: var(--text, #23283b); }
.rui-list-check li, .rui-list-steps li { position: relative; padding-inline-start: 26px; margin-bottom: 9px; }
.rui-list-check li::before {
  content: '✓'; position: absolute; inset-inline-start: 0; top: 0;
  width: 17px; height: 17px; border-radius: 50%; background: var(--rui-tint); color: var(--rui-ink);
  font-size: 9.5px; font-weight: 900; display: grid; place-items: center;
}
.rui-list-steps { counter-reset: rui-step; position: relative; }
.rui-list-steps li { counter-increment: rui-step; }
.rui-list-steps li::before {
  content: counter(rui-step); position: absolute; inset-inline-start: 0; top: 0; z-index: 1;
  width: 17px; height: 17px; border-radius: 50%; background: var(--rui-accent); color: #fff;
  font-size: 9.5px; font-weight: 800; display: grid; place-items: center;
}
.rui-list-steps li:not(:last-child)::after {
  content: ''; position: absolute; inset-inline-start: 8px; top: 19px; bottom: -9px; width: 1.5px; background: var(--rui-tint);
}

.rui-keybox { border: 1px solid var(--border, #e9ebf3); border-radius: 14px; padding: 13px 14px;
  background: linear-gradient(160deg, var(--rui-tint), transparent 140%); }
.rui-keybox__label { display: block; font-size: 11px; color: var(--muted, #8a90a6); margin-bottom: 7px; }
.rui-keybox__row { display: flex; align-items: center; gap: 8px; }
.rui-keybox__value { flex: 1; font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 12.5px;
  background: var(--surface, #fff); border: 1px solid var(--border, #e9ebf3); border-radius: 9px; padding: 7px 10px;
  overflow-x: auto; white-space: nowrap; color: var(--text, #23283b); }
.rui-keybox__copy { flex: none; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--border, #e9ebf3);
  background: var(--surface, #fff); cursor: pointer; font-size: 13px; transition: background .15s, transform .12s; }
.rui-keybox__copy:hover { background: var(--rui-tint); transform: scale(1.06); }
.rui-keybox__copy.is-done { background: rgba(47,185,138,.28); border-color: transparent; }
.rui-keybox__note { font-size: 12px; color: var(--muted, #8a90a6); line-height: 1.75; }

/* ---------- dark theme surface fallbacks ---------- */
[data-theme="dark"] .rui-card,
[data-theme="dark"] .rui-kpi,
[data-theme="dark"] .rui-table-wrap,
[data-theme="dark"] .rui-toast,
[data-theme="dark"] .rui-drawer { background:var(--surface, #1b1f2e); border-color:var(--border, #2a3042); }
[data-theme="dark"] .rui-toast:is(.rui-tone-green, .rui-tone-red, .rui-tone-lemon, .rui-tone-amber) {
  background:linear-gradient(160deg, color-mix(in srgb, var(--rui-tint) 55%, var(--surface, #1b1f2e)) 0%, var(--surface, #1b1f2e) 100%);
  border-color:color-mix(in srgb, var(--rui-accent) 28%, var(--border, #2a3042));
}
[data-theme="dark"] .rui-table th { background:var(--surface-2, #232838); }

/* Side-accent cards — stripe follows corner radius + per-tone tinted shadow */
:where(.erp-card, .w3-card, .il2-pcard, .tr-lccard) {
  --rui-accent-edge: var(--rui-accent, var(--brand-500));
  box-shadow:
    0 1px 3px rgba(20, 25, 50, .04),
    0 12px 32px -14px color-mix(in srgb, var(--rui-accent-edge) 32%, transparent);
  transition: transform .25s cubic-bezier(.22, .7, .16, 1), box-shadow .25s ease;
}
:where(.erp-card, .w3-card, .il2-pcard, .tr-lccard):hover {
  transform: translateY(-2px);
  box-shadow:
    0 16px 36px -12px color-mix(in srgb, var(--rui-accent-edge) 42%, transparent),
    0 4px 14px rgba(15, 23, 42, .06);
}
:where(.fleet-vcard, .dist-card, .mnt-acard) {
  --rui-accent-edge: var(--rui-tone, var(--brand-500));
  border-inline-start: 4px solid var(--rui-accent-edge);
  box-shadow:
    0 1px 3px rgba(20, 25, 50, .04),
    0 12px 32px -14px color-mix(in srgb, var(--rui-accent-edge) 32%, transparent);
  transition: transform .25s cubic-bezier(.22, .7, .16, 1), box-shadow .25s ease;
}
:where(.fleet-vcard, .dist-card, .mnt-acard):hover {
  transform: translateY(-2px);
  box-shadow:
    0 16px 36px -12px color-mix(in srgb, var(--rui-accent-edge) 42%, transparent),
    0 4px 14px rgba(15, 23, 42, .06);
}
:where(.fleet-vcard, .dist-card, .mnt-acard)::before { display: none; }
/* Interactive form controls: the cursor must communicate clickability globally. */
input[type="checkbox"]:not(:disabled),
input[type="radio"]:not(:disabled),
label:has(input[type="checkbox"]:not(:disabled)),
label:has(input[type="radio"]:not(:disabled)) {
  cursor: pointer;
}
input[type="checkbox"]:disabled,
input[type="radio"]:disabled,
label:has(input[type="checkbox"]:disabled),
label:has(input[type="radio"]:disabled) {
  cursor: not-allowed;
}

/* ---------- L17 — shared vertical center for mixed rows (panel + sample) ---------- */
.ds-inline-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.ds-inline-row > * {
  align-self: center;
  margin-block: 0;
}

/* Shared motion contract: lightweight CSS/DOM primitives used by the existing
   panel components. These are intentionally framework-free and respect reduced
   motion preferences. */
.ds-motion-reveal { opacity: 0; transform: translateY(8px); }
.ds-motion-reveal.is-visible { opacity: 1; transform: none; transition: opacity .28s ease, transform .34s cubic-bezier(.22,.7,.16,1); }
.ds-motion-stagger > * { opacity: 0; transform: translateY(6px); }
.ds-motion-stagger.is-visible > * { animation: dsMotionStaggerIn .32s cubic-bezier(.22,.7,.16,1) both; animation-delay: calc(var(--ds-motion-index, 0) * 45ms); }
.ds-motion-skeleton { border-radius: 8px; background: linear-gradient(90deg, var(--surface-2, #f1f3f7) 25%, var(--surface-3, #e7ebf1) 50%, var(--surface-2, #f1f3f7) 75%); background-size: 220% 100%; animation: dsMotionShimmer 1.35s ease-in-out infinite; }
.ds-motion-progress { position: relative; overflow: hidden; }
.ds-motion-progress::after { content: ""; position: absolute; inset-block: 0; inset-inline-start: -35%; width: 35%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: dsMotionProgressSweep 1.25s ease-in-out infinite; }
.ds-motion-number { font-variant-numeric: tabular-nums; }
.ds-motion-page-in { animation: dsMotionPageIn .24s ease both; }
.ds-motion-card-in { animation: dsMotionCardIn .32s cubic-bezier(.22,.7,.16,1) both; }
.ds-motion-row-in { animation: dsMotionRowIn .24s ease both; }
.ds-motion-chart-in { animation: dsMotionChartIn .45s ease both; transform-origin: center bottom; }
.ds-motion-control { transition: transform .18s cubic-bezier(.22,.7,.16,1), box-shadow .18s ease, background-color .18s ease, border-color .18s ease; }
.ds-motion-control:active { transform: scale(.98); }
.ds-motion-tab { transition: color .18s ease, background-color .18s ease, border-color .18s ease, transform .18s ease; }
.ds-motion-tab.is-active, .ds-motion-tab[aria-selected="true"] { animation: dsMotionTabIn .22s ease both; }
.ds-motion-kanban-card { transition: transform .2s cubic-bezier(.22,.7,.16,1), box-shadow .2s ease; }
.ds-motion-kanban-card.is-dragging { transform: scale(1.025) rotate(.4deg); box-shadow: 0 16px 34px rgba(24,34,62,.2); z-index: 4; }
.ds-motion-drop-target { outline: 2px dashed color-mix(in srgb, var(--brand-500, #2c7873) 70%, transparent); outline-offset: 4px; background: color-mix(in srgb, var(--brand-500, #2c7873) 6%, transparent); transition: background .18s ease, outline-color .18s ease; }
.ds-magic-card { --ds-glare-x: 50%; --ds-glare-y: 50%; position: relative; overflow: hidden; }
.ds-magic-card::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0; opacity: 0; background: radial-gradient(260px circle at var(--ds-glare-x) var(--ds-glare-y), color-mix(in srgb, var(--ds-beam-color, #54c7b0) 13%, transparent), transparent 62%); transition: opacity .24s ease; }
.ds-magic-card:hover::before, .ds-magic-card:focus-within::before { opacity: 1; }
.ds-magic-card > * { position: relative; z-index: 1; }
.ds-shine-border { position: relative; isolation: isolate; }
.ds-shine-border::before { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; border-radius: inherit; padding: 1px; background: linear-gradient(110deg, transparent 20%, color-mix(in srgb, var(--ds-shine-color, #54c7b0) 72%, transparent), transparent 80%); background-size: 240% 100%; -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude; animation: dsShineBorder 4.8s ease-in-out infinite; }
.ds-shine-border > * { position: relative; z-index: 1; }
.ds-loop-ambient { animation: dsAmbientBreath 5.5s ease-in-out infinite; }
.ds-animated-list > * { animation: dsAnimatedListIn .3s cubic-bezier(.22,.7,.16,1) both; }
.ds-animated-list > *:nth-child(2) { animation-delay: 35ms; }.ds-animated-list > *:nth-child(3) { animation-delay: 70ms; }.ds-animated-list > *:nth-child(4) { animation-delay: 105ms; }.ds-animated-list > *:nth-child(5) { animation-delay: 140ms; }
.ds-blur-fade { animation: dsBlurFadeIn .38s ease both; }
.ds-view-swap { animation: dsViewSwap .28s cubic-bezier(.22,.7,.16,1) both; }
.ds-tab-panel-swap { animation: dsTabPanelSwap .24s ease both; }
.ds-accordion-content { overflow: hidden; transition: grid-template-rows .24s ease, opacity .2s ease, transform .24s ease; }
details.ds-accordion-motion:not([open]) > *:not(summary) { opacity: 0; transform: translateY(-4px); }
details.ds-accordion-motion[open] > *:not(summary) { animation: dsAccordionIn .24s ease both; }
[draggable="true"] { transition: transform .2s cubic-bezier(.22,.7,.16,1), box-shadow .2s ease, opacity .2s ease; }
[draggable="true"].ds-drag-spring-active { transform: scale(1.025) rotate(.35deg); opacity: .92; box-shadow: 0 14px 30px rgba(24,34,62,.18); z-index: 5; }
.ds-operation-progress { position: relative; overflow: hidden; }
.ds-operation-progress::after { content: ""; position: absolute; inset-inline-start: -30%; inset-block: 0; width: 30%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent); animation: dsOperationSweep 1.15s ease-in-out infinite; pointer-events: none; }
.ds-chart-entry { animation: dsChartEntry .42s cubic-bezier(.22,.7,.16,1) both; }
@keyframes dsShineBorder { 0%,100% { background-position: 140% 0; } 50% { background-position: -40% 0; } }
@keyframes dsAmbientBreath { 0%,100% { box-shadow: 0 8px 28px rgba(44,120,115,.07); } 50% { box-shadow: 0 12px 34px rgba(44,120,115,.15); } }
@keyframes dsAnimatedListIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes dsBlurFadeIn { from { opacity: 0; filter: blur(5px); transform: translateY(4px); } to { opacity: 1; filter: blur(0); transform: none; } }
@keyframes dsViewSwap { from { opacity: .35; transform: translateY(5px) scale(.995); } to { opacity: 1; transform: none; } }
@keyframes dsTabPanelSwap { from { opacity: .35; transform: translateX(8px); } to { opacity: 1; transform: none; } }
@keyframes dsAccordionIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
@keyframes dsOperationSweep { to { transform: translateX(430%); } }
@keyframes dsChartEntry { from { opacity: 0; transform: scaleY(.9); transform-origin: bottom; } to { opacity: 1; transform: none; } }
@keyframes dsMotionPageIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes dsMotionCardIn { from { opacity: 0; transform: translateY(7px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes dsMotionRowIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@keyframes dsMotionChartIn { from { opacity: 0; transform: scaleY(.94); } to { opacity: 1; transform: none; } }
@keyframes dsMotionTabIn { from { opacity: .7; transform: translateY(2px); } to { opacity: 1; transform: none; } }
@keyframes dsMotionStaggerIn { to { opacity: 1; transform: none; } }
@keyframes dsMotionShimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes dsMotionProgressSweep { 0% { transform: translateX(0); } 100% { transform: translateX(390%); } }
@media (prefers-reduced-motion: reduce) {
  .ds-motion-reveal, .ds-motion-stagger > * { opacity: 1; transform: none; }
  .ds-motion-reveal.is-visible { transition: none; }
  .ds-motion-stagger.is-visible > *, .ds-motion-skeleton, .ds-motion-progress::after,
  .ds-motion-page-in, .ds-motion-card-in, .ds-motion-row-in, .ds-motion-chart-in,
  .ds-motion-tab.is-active, .ds-motion-tab[aria-selected="true"] { animation: none !important; }
  .ds-motion-control, .ds-motion-kanban-card { transition: none !important; }
  .ds-border-beam::after { animation: none !important; opacity: .45; }
  .ds-shine-border::before, .ds-animated-list > *, .ds-blur-fade { animation: none !important; }
  .ds-view-swap, .ds-tab-panel-swap, details.ds-accordion-motion[open] > *:not(summary), .ds-chart-entry { animation: none !important; }
  [draggable="true"], [draggable="true"].ds-drag-spring-active { transition: none !important; transform: none !important; box-shadow: none !important; }
  .ds-operation-progress::after { animation: none !important; }
}
.ds-inline-row__label {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--text-muted, #8a90a6);
  font-size: 13px;
  font-weight: 700;
}
/* Meter / progress rows (label | track | value) — same L17 center line */
.ds-inline-row.ds-meter-row,
.ds-inline-row.rich-bar {
  flex-wrap: nowrap;
  width: 100%;
  gap: 12px;
  min-height: 28px;
}
.ds-meter-row__track {
  flex: 1 1 auto;
  min-width: 48px;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2, #eef1f6);
  overflow: hidden;
}
.ds-meter-row__track > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--brand-500, #2c7873);
}

/* Entity avatar — one shared contract for people and companies. */
.ds-entity-avatar {
  width: var(--ds-avatar-size, 36px);
  height: var(--ds-avatar-size, 36px);
  min-width: var(--ds-avatar-size, 36px);
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  flex: 0 0 var(--ds-avatar-size, 36px);
  overflow: hidden;
  color: #fff !important;
  background: var(--ds-avatar-color, #4f46e5) !important;
}
.ds-entity-avatar .ds-ico,
.ds-entity-avatar .ds-entity-avatar__glyph {
  display: block;
  width: 58%;
  height: 58%;
  margin: 0;
  align-self: center;
  justify-self: center;
  vertical-align: 0;
  color: #fff !important;
  fill: currentColor;
}
.ds-entity-avatar .ds-ico path,
.ds-entity-avatar .ds-entity-avatar__glyph path { fill: currentColor; }
.ds-entity-avatar--photo,.ds-entity-avatar--generated,.ds-employee-avatar-host{border:1px solid color-mix(in srgb,var(--border) 76%,transparent);background-color:var(--surface-2)!important;box-shadow:0 1px 3px color-mix(in srgb,var(--text) 10%,transparent);overflow:hidden;color:transparent!important}
.ds-entity-avatar--photo>img,.ds-employee-avatar-host>img{display:block;width:100%;height:100%;object-fit:cover}
.ds-entity-avatar--generated{background-image:var(--ds-avatar-sheet)!important;background-size:400% 400%!important;background-position:var(--ds-avatar-x) var(--ds-avatar-y)!important;background-repeat:no-repeat!important}
/* A found picture (ds-avatar.js, data-ds-found-avatar): laid over the initials or icon once it has loaded. A portrait
   fills the circle like .ds-entity-avatar--photo; a company logo (.is-logo) is shown whole on the surface colour. */
.has-found-picture{position:relative;overflow:hidden;color:transparent!important;border:1px solid color-mix(in srgb,var(--border) 76%,transparent);box-shadow:0 1px 3px color-mix(in srgb,var(--text) 10%,transparent)}
.has-found-picture>:not(.ds-found-avatar__img){visibility:hidden}
.has-found-picture>.ds-found-avatar__img{position:absolute;inset:0;box-sizing:border-box;display:block;width:100%;height:100%;border-radius:inherit;object-fit:cover;background:var(--surface-2)}
.has-found-picture.is-logo>.ds-found-avatar__img{object-fit:contain;padding:14%;background:var(--surface)}
/* The person's own avatar picker (ds-avatar.js openSelfPicker): both sets, four tiles a row on a phone. */
.ds-avatar-picker{display:grid;gap:16px}
.ds-avatar-picker__head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;color:var(--text-muted);font-size:12.5px;line-height:1.8}
.ds-avatar-picker__head span{flex:1 1 240px;min-width:0}
.ds-avatar-picker__note{margin:0;padding:10px 12px;border-radius:12px;background:color-mix(in srgb,var(--pastel-sky,#e8f1ff) 55%,transparent);color:var(--text-2,var(--text));font-size:12.5px;line-height:1.8}
.ds-avatar-picker__title{margin:0 0 8px;font-size:13px;font-weight:800;color:var(--text)}
.ds-avatar-picker__grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(68px,1fr));gap:10px}
.ds-avatar-picker__item{position:relative;display:grid;place-items:center;padding:6px;border:2px solid transparent;border-radius:16px;background:var(--surface-2);cursor:pointer;transition:border-color .15s,box-shadow .15s,transform .15s}
.ds-avatar-picker__item:hover{transform:translateY(-1px);border-color:color-mix(in srgb,var(--brand-500) 35%,transparent)}
.ds-avatar-picker__item:focus-visible{outline:2px solid var(--brand-500);outline-offset:2px}
.ds-avatar-picker__item.is-selected{border-color:var(--brand-500);box-shadow:0 6px 16px -10px color-mix(in srgb,var(--brand-500) 70%,transparent)}
.ds-avatar-picker__badge{position:absolute;inset-inline:4px;bottom:-8px;padding:1px 6px;border-radius:999px;background:var(--surface);border:1px solid var(--border);font-size:10px;font-weight:700;color:var(--text-muted);text-align:center}
@media(max-width:520px){.ds-avatar-picker__grid{grid-template-columns:repeat(4,minmax(0,1fr))}}
/* «تصویر پروفایل» (DsAvatar.mountSelfEditor): current avatar, the three ways, then the chosen way's work area. */
.ds-avatar-editor{display:grid;gap:16px;min-width:0}
.ds-avatar-editor__current{display:flex;align-items:center;gap:14px;min-width:0}
.ds-avatar-editor__copy{display:grid;gap:4px;min-width:0}
.ds-avatar-editor__copy strong{font-size:13.5px;font-weight:800;color:var(--text)}
.ds-avatar-editor__copy small{color:var(--text-muted);font-size:12px;line-height:1.8}
.ds-avatar-editor__modes .ds-settings-card{min-height:68px}
.ds-avatar-editor__modes .ds-settings-card.is-selected{border-color:var(--ds-settings-tone);box-shadow:0 0 0 2px color-mix(in srgb,var(--ds-settings-tone) 28%,transparent)}
.ds-avatar-editor__work{min-width:0}
.ds-avatar-editor__error{margin-top:10px}
.ds-avatar-editor__crop-actions{display:flex;justify-content:flex-start;margin-top:12px}
/* DsImageCrop: the picture under a round frame; it always covers the frame. */
.ds-image-crop{display:flex;flex-wrap:wrap;align-items:center;gap:18px 24px;min-width:0}
.ds-image-crop__stage{position:relative;flex:0 0 auto;width:min(260px,100%);aspect-ratio:1;overflow:hidden;border-radius:18px;background:var(--surface-2);cursor:grab;touch-action:none;user-select:none}
.ds-image-crop__stage.is-dragging{cursor:grabbing}
.ds-image-crop__stage:focus-visible{outline:2px solid var(--brand-500);outline-offset:3px}
.ds-image-crop__image{position:absolute;left:50%;top:50%;max-width:none;max-height:none;pointer-events:none;user-select:none}
.ds-image-crop__frame{position:absolute;inset:0;border-radius:50%;box-shadow:0 0 0 999px color-mix(in srgb,var(--text) 42%,transparent);outline:2px solid color-mix(in srgb,var(--surface) 85%,transparent);outline-offset:-2px;pointer-events:none}
.ds-image-crop__side{display:grid;gap:12px;flex:1 1 220px;min-width:0}
.ds-image-crop__caption{font-size:12.5px;font-weight:800;color:var(--text-muted)}
.ds-image-crop__previews{display:flex;align-items:center;gap:14px}
/* main.css gives every canvas a chart's 100% width and 160px minimum height; a preview is a circle of its own size. */
.ds-image-crop canvas.ds-image-crop__preview{flex:0 0 auto;width:var(--ds-crop-preview);height:var(--ds-crop-preview);min-height:0;border-radius:50%;border:1px solid var(--border);background:var(--surface-2)}
.ds-image-crop__zoom{display:flex;align-items:flex-end;gap:8px;min-width:0}
.ds-image-crop__slider{flex:1 1 auto;min-width:0}
/* Range slider of the catalog form fields (moved here from the catalog page so product pages get it too). Two classes,
   so the base .ds-field__input height of a later stylesheet never stretches it. */
.ds-field__input.ds-field__input--range{-webkit-appearance:none;appearance:none;height:8px;min-height:8px;padding:0;border:none;border-radius:999px;background:var(--surface-2);cursor:pointer}
.ds-field__input.ds-field__input--range:focus{outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--brand-500) 20%,transparent)}
.ds-field__input--range::-webkit-slider-runnable-track{height:8px;border-radius:999px;background:linear-gradient(to left,var(--brand-500) 0%,var(--brand-500) var(--range-pct,70%),var(--surface-2) var(--range-pct,70%),var(--surface-2) 100%)}
.ds-field__input--range::-webkit-slider-thumb{-webkit-appearance:none;width:18px;height:18px;margin-top:-5px;border-radius:50%;background:#fff;border:2px solid var(--brand-500);box-shadow:0 2px 8px -2px rgba(44,120,115,.45);cursor:pointer}
.ds-field__input--range::-moz-range-track{height:8px;border-radius:999px;background:var(--surface-2)}
.ds-field__input--range::-moz-range-progress{height:8px;border-radius:999px;background:var(--brand-500)}
.ds-field__input--range::-moz-range-thumb{width:18px;height:18px;border-radius:50%;background:#fff;border:2px solid var(--brand-500);box-shadow:0 2px 8px -2px rgba(44,120,115,.45);cursor:pointer}
.ds-field__label-extra{font-size:11px;font-weight:800;color:var(--brand-600);margin-inline-start:auto}

/* Canonical compact checkbox/radio choice used by DS forms and modals. */
.ds-choice-group { display:flex; flex-wrap:wrap; gap:8px; }
.ds-choice {
  display:inline-flex; align-items:center; gap:8px; min-width:0; padding:9px 12px;
  border:1px solid var(--border); border-radius:12px; background:var(--surface);
  color:var(--text-muted); font-size:12.5px; font-weight:600; cursor:pointer;
  transition:border-color .22s ease,background .22s ease,color .22s ease,box-shadow .22s ease;
  user-select:none;
}
.ds-choice:hover { border-color:color-mix(in srgb,var(--brand-500) 35%,var(--border)); background:color-mix(in srgb,var(--brand-500) 4%,var(--surface)); color:var(--text); }
.ds-choice input { width:16px; height:16px; flex:0 0 auto; margin:0; accent-color:var(--brand-500); cursor:pointer; }
.ds-choice:has(input:checked) { border-color:color-mix(in srgb,var(--brand-500) 55%,var(--border)); background:color-mix(in srgb,var(--pastel-mint) 45%,var(--surface)); color:var(--brand-700,var(--brand-600)); box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--brand-500) 12%,transparent); }
.ds-choice:has(input:disabled) { opacity:.55; cursor:not-allowed; }
.ds-choice[hidden] { display:none !important; }
/* Status ambience — 10-second, reusable lifecycle mood for record heroes. */
[data-ds-state-ambience]{position:relative;isolation:isolate;overflow:hidden}
[data-ds-state-ambience]>*:not(.ds-state-ambience){position:relative;z-index:1}
.ds-state-ambience{position:absolute;inset:0;z-index:0;pointer-events:none;overflow:hidden;opacity:.78}
.ds-state-ambience>i{position:absolute;display:block;width:10px;height:10px;border-radius:999px;background:var(--ds-ambience-color,#60a5fa);opacity:0;animation-duration:10s;animation-timing-function:cubic-bezier(.4,0,.2,1);animation-fill-mode:both}
.ds-state-ambience.is-looping>i{animation-iteration-count:infinite}
.ds-state-ambience>i:nth-child(1){--i:0;inset-inline-start:6%;animation-delay:0s}.ds-state-ambience>i:nth-child(2){--i:1;inset-inline-start:18%;animation-delay:-1.25s}.ds-state-ambience>i:nth-child(3){--i:2;inset-inline-start:32%;animation-delay:-2.5s}.ds-state-ambience>i:nth-child(4){--i:3;inset-inline-start:49%;animation-delay:-3.75s}.ds-state-ambience>i:nth-child(5){--i:4;inset-inline-start:64%;animation-delay:-5s}.ds-state-ambience>i:nth-child(6){--i:5;inset-inline-start:78%;animation-delay:-6.25s}.ds-state-ambience>i:nth-child(7){--i:6;inset-inline-start:88%;animation-delay:-7.5s}.ds-state-ambience>i:nth-child(8){--i:7;inset-inline-start:95%;animation-delay:-8.75s}
.ds-state-ambience--won{--ds-ambience-color:#22c55e;background:radial-gradient(circle at 12% 18%,rgba(74,222,128,.2),transparent 28%),radial-gradient(circle at 88% 14%,rgba(250,204,21,.16),transparent 24%)}
.ds-state-ambience--won>i{bottom:-18px;border-radius:2px;animation-name:dsAmbienceCelebrate;transform:rotate(calc(var(--i) * 23deg));box-shadow:18px -8px 0 rgba(250,204,21,.8),-14px 8px 0 rgba(56,189,248,.65)}
.ds-state-ambience--lost{--ds-ambience-color:#fb7185;background:radial-gradient(circle at 50% 0,rgba(244,63,94,.12),transparent 44%),linear-gradient(180deg,rgba(255,255,255,.08),rgba(190,24,93,.05))}
.ds-state-ambience--lost>i{top:-15px;width:3px;height:18px;border-radius:99px;animation-name:dsAmbienceRain;transform:rotate(12deg);box-shadow:12px 24px 0 rgba(251,113,133,.4)}
.ds-state-ambience--open{--ds-ambience-color:#38bdf8;background:radial-gradient(circle at 20% 50%,rgba(56,189,248,.16),transparent 30%),radial-gradient(circle at 82% 35%,rgba(139,92,246,.12),transparent 28%)}
.ds-state-ambience--open>i{top:50%;border:2px solid rgba(56,189,248,.7);background:transparent;animation-name:dsAmbienceWaiting;box-shadow:0 0 18px rgba(56,189,248,.35)}
.ds-state-message{display:inline-flex;align-items:center;gap:7px;margin-top:8px;padding:6px 10px;border:1px solid color-mix(in srgb,var(--ds-state-message-color,#3b82f6) 22%,transparent);border-radius:999px;background:color-mix(in srgb,var(--ds-state-message-color,#3b82f6) 8%,var(--surface));color:color-mix(in srgb,var(--ds-state-message-color,#3b82f6) 74%,#172033);font-size:11px;font-weight:750;line-height:1.7}
.ds-state-message::before{content:"";width:7px;height:7px;flex:0 0 7px;border-radius:50%;background:var(--ds-state-message-color,#3b82f6);box-shadow:0 0 0 5px color-mix(in srgb,var(--ds-state-message-color,#3b82f6) 14%,transparent);animation:dsStateMessagePulse 10s ease-in-out infinite}
.ds-state-message--won{--ds-state-message-color:#16a34a}.ds-state-message--lost{--ds-state-message-color:#e11d48}.ds-state-message--open{--ds-state-message-color:#0284c7}
@keyframes dsAmbienceCelebrate{0%{opacity:0;transform:translateY(0) rotate(0) scale(.5)}12%{opacity:.9}55%{opacity:.7}82%,100%{opacity:0;transform:translateY(-230px) rotate(480deg) scale(1.1)}}
@keyframes dsAmbienceRain{0%{opacity:0;transform:translateY(-20px) translateX(0) rotate(12deg)}18%{opacity:.7}72%{opacity:.45}100%{opacity:0;transform:translateY(230px) translateX(-34px) rotate(12deg)}}
@keyframes dsAmbienceWaiting{0%,100%{opacity:0;transform:translate(-12px,-50%) scale(.3)}18%{opacity:.65}48%{opacity:.25;transform:translate(18px,-80%) scale(1.7)}72%{opacity:.55;transform:translate(40px,-20%) scale(.8)}}
@keyframes dsStateMessagePulse{0%,70%,100%{transform:scale(1);opacity:.8}78%{transform:scale(1.45);opacity:1}88%{transform:scale(1);opacity:.8}}
@media (prefers-reduced-motion:reduce){.ds-state-ambience>i,.ds-state-message::before{animation:none!important}.ds-state-ambience>i{opacity:.18!important}}
/* Loading button (catalog «دکمه · .btn», moved from design-system.css 1405/07/17 so the panel and the
   extension get it too) and the download button state of DsDownload (assets/js/ds-download.js). */
.btn.is-loading { gap: 8px; opacity: .85; }
.ds-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ds-spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes ds-spin { to { transform: rotate(360deg); } }
/* Inside a button the spinner takes the button's own text colour, so a ghost or plain loading button
   shows it too (on primary and danger the text is white, as before). */
.btn .ds-spinner { border-color: color-mix(in srgb, currentColor 35%, transparent); border-top-color: currentColor; }
.btn[data-ds-download][aria-busy="true"] { pointer-events: none; cursor: progress; }
.btn[data-ds-download].is-done, .btn[data-ds-download].is-failed { gap: 8px; }
@media (prefers-reduced-motion: reduce) { .ds-spinner { animation-duration: 1.6s; } }

/* ── Smart layout («قانون چیدمان هوشمند», docs/DESIGN_SYSTEM.md) ───────────
   A short control (text box, dropdown, date, number, switch) never owns a
   whole row on a wide container. Fields flow into as many columns as the
   container can hold; only narrative or wide content spans the full row.
   .ds-auto-grid picks the column count from the available width, so the same
   markup is one column on a phone and four or five on a desktop. */
.ds-auto-grid {
  --ds-auto-min: 220px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--ds-auto-min)), 1fr));
  gap: 14px 16px;
  align-items: end;
  min-width: 0;
}
.ds-auto-grid--compact { --ds-auto-min: 168px; }
.ds-auto-grid--roomy { --ds-auto-min: 300px; }
.ds-auto-grid > * { min-width: 0; }
.ds-auto-grid > .ds-field { margin: 0; }
.ds-auto-grid .ds-dropdown { width: 100%; min-width: 0; }
.ds-auto-grid > :is(.ds-auto-grid__full, .ds-form-grid__full),
.ds-auto-grid > :has(> textarea, > table, > .rui-table-wrap, > .ds-heatmap, > .ds-chart-wrap) {
  grid-column: 1 / -1;
}
@media (min-width: 720px) {
  .ds-auto-grid > .ds-auto-grid__wide { grid-column: span 2; }
}
/* A dropdown inside an inline row is an inline control: it keeps a readable
   width beside its label instead of stretching to the whole row. */
.ds-inline-row > .ds-dropdown:not(.ds-dropdown--block) {
  width: auto;
  flex: 0 1 240px;
  min-width: 148px;
}


/* /portal/ds/css/ds-catalog-buttons.css */
/* Literal catalog button contract; opt-in scope keeps other pages unchanged. */
.ds-catalog-buttons .btn {
  border-radius: 12px;
  font-weight: 600;
  box-shadow: none;
  transition: background .22s ease, border-color .22s ease, color .22s ease, transform .15s ease, box-shadow .22s ease;
}
.ds-catalog-buttons .btn::before { display: none; }
.ds-catalog-buttons .btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15, 23, 42, .06); }

.ds-catalog-buttons .btn.primary {
  background: color-mix(in srgb, var(--brand-500) 88%, #fff);
  color: #fff;
  border: 1px solid color-mix(in srgb, var(--brand-500) 70%, transparent);
  box-shadow: 0 2px 8px rgba(44, 120, 115, .18);
}
.ds-catalog-buttons .btn.primary:hover {
  background: var(--brand-500);
  box-shadow: 0 4px 14px rgba(44, 120, 115, .24);
}

.ds-catalog-buttons .btn.ghost {
  background: color-mix(in srgb, var(--pastel-mint) 45%, var(--surface));
  border-color: color-mix(in srgb, var(--pastel-mint) 80%, var(--border));
  color: var(--brand-600);
}
.ds-catalog-buttons .btn.ghost:hover {
  background: color-mix(in srgb, var(--pastel-mint) 65%, var(--surface));
  border-color: color-mix(in srgb, var(--brand-500) 25%, var(--border));
}

.ds-catalog-buttons .btn:not(:disabled){cursor:pointer;-webkit-tap-highlight-color:rgba(44,120,115,.18)}
.ds-catalog-buttons .btn:disabled{cursor:not-allowed}
.ds-catalog-buttons .btn:not(:disabled):active{transform:translateY(1px) scale(0.98);transition-duration:.08s}


/* /portal/ds/css/ds-form.css */
.ds-field{display:flex;flex-direction:column;gap:6px;margin:0 0 12px}.ds-field__label{font-size:12.5px;font-weight:600;color:var(--text)}.ds-field__req{color:#e11d48;margin-inline-start:3px}.ds-field__hint{font-size:11.5px;color:var(--text-muted)}
.ds-required-marker,.ds-field__req,.ds-field__required,.rdnf-required,.vf-req,.ar-required,.rp-req,.rb-req,.req{color:#e11d48!important;font-weight:800!important;margin-inline-start:3px}
.ds-field__input{inline-size:100%;min-block-size:42px;padding:9px 12px;border:1px solid var(--border);border-radius:var(--radius-lg,12px);background:var(--surface);color:var(--text);font:inherit;font-size:13.5px;transition:border-color .15s ease,box-shadow .15s ease}.ds-field__input::placeholder{color:var(--text-faint)}.ds-field__input:hover:not(:disabled):not(:focus){border-color:var(--border-strong)}.ds-field__input:focus{outline:0;border-color:var(--brand-500);box-shadow:0 0 0 3px color-mix(in srgb,var(--brand-500) 16%,transparent)}.ds-field__input:disabled{opacity:.58;cursor:not-allowed;background:var(--surface-2)}
/* Owner-approved technical multiline variant: the catalog's existing LTR
   input typography, without changing the textarea's dimensions or palette. */
textarea.ds-field__input.ds-input-ltr{direction:ltr;text-align:left;unicode-bidi:isolate;font-variant-numeric:tabular-nums;letter-spacing:.02em}
.ds-field__control{position:relative;display:flex;align-items:stretch;width:100%;min-width:0}
.ds-field__control .ds-field__input{flex:1;min-width:0}
.ds-field__prefix+.ds-field__input{border-start-start-radius:0;border-end-start-radius:0}
.ds-field__prefix{display:flex;align-items:center;flex-shrink:0;padding-inline:12px;border:1px solid var(--border);border-inline-end:none;border-start-start-radius:12px;border-end-start-radius:12px;background:var(--surface-2);color:var(--text-faint);font-size:12px;font-weight:700;white-space:nowrap}
.ds-field__prefix-btn{cursor:pointer;border:none;font:inherit;transition:background .2s ease,color .2s ease}
.ds-field__prefix-btn:hover{background:color-mix(in srgb,var(--brand-500) 8%,var(--surface-2));color:var(--brand-600)}
.ds-field__prefix-btn:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var(--brand-400)}
.ds-field__suffix-btn{position:absolute;inset-inline-end:6px;top:50%;transform:translateY(-50%);width:32px;height:32px;display:grid;place-items:center;border:none;border-radius:8px;background:transparent;color:var(--text-faint);cursor:pointer;padding:0;transition:background .2s ease,color .2s ease}
.ds-field__suffix-btn:hover{background:color-mix(in srgb,var(--brand-500) 10%,var(--surface-2));color:var(--brand-600)}
/* Password reveal (catalog «رمز عبور» field): one eye icon at a time; .is-revealed swaps them. Shared so every product surface, including the browser extension side panel, gets the catalog state. */
.ds-field__suffix-btn .ds-eye-icon{display:block}.ds-field__suffix-btn .ds-eye-icon--closed{display:none}.ds-field__suffix-btn.is-revealed .ds-eye-icon--open{display:none}.ds-field__suffix-btn.is-revealed .ds-eye-icon--closed{display:block}
/* Password: room for the eye button so typed dots never run under it (an LTR input in an RTL page keeps the button on its left). */
.ds-field__control--password .ds-field__input{padding-inline-end:44px}
html[dir="rtl"] .ds-field__control--password .ds-field__input[dir="ltr"],html[dir="rtl"] .ds-field__control--password .ds-field__input.ds-input-ltr{padding-inline-end:14px;padding-inline-start:44px}
/* Copy field — mirrors design-system.css «Copy field»; behaviour in ds-form-governance.js [data-ds-copy]. */
.ds-field__control--copy .ds-field__input{padding-inline-end:44px;background:var(--surface-2);cursor:text}
html[dir="rtl"] .ds-field__control--copy .ds-field__input[dir="ltr"],html[dir="rtl"] .ds-field__control--copy .ds-field__input.ds-input-ltr{padding-inline-end:14px;padding-inline-start:44px}
.ds-field__suffix-btn .ds-copy-icon{display:block}.ds-field__suffix-btn .ds-copy-icon--done{display:none}.ds-field__suffix-btn.is-copied{color:var(--brand-600)}.ds-field__suffix-btn.is-copied .ds-copy-icon--idle{display:none}.ds-field__suffix-btn.is-copied .ds-copy-icon--done{display:block}
/* Displayed-value copy — a click on a read-only field row copies its value (ds-form-governance.js copyDisplayedValue); .is-copied briefly tints the value. */
.ds-field-display,[data-ds-copy-row]{cursor:copy}.ds-field-display :is(a,button,.btn),[data-ds-copy-row] :is(a,button,.btn){cursor:pointer}
.ds-field-display dd.is-copied,[data-ds-copy-value].is-copied{color:var(--brand-600);transition:color .2s ease}
.ds-field__control:focus-within{border-radius:var(--radius-lg,12px);box-shadow:0 0 0 3px color-mix(in srgb,var(--brand-500) 20%,transparent)}
.ds-field__control:focus-within .ds-field__prefix{border-color:var(--brand-500);background:color-mix(in srgb,var(--brand-500) 6%,var(--surface-2))}
.ds-field__control:focus-within .ds-field__input{box-shadow:none}
.ds-field__control--search{overflow:hidden;border:1px solid var(--border);border-radius:var(--radius-lg,12px);background:var(--surface);transition:border-color .15s ease,box-shadow .15s ease}
.ds-field__control--search:hover{border-color:var(--border-strong)}
.ds-field__control--search:focus-within{border-color:var(--brand-500);box-shadow:0 0 0 3px color-mix(in srgb,var(--brand-500) 20%,transparent)}
.ds-field__control--search .ds-field__input,.ds-field__control--search .ds-field__prefix{border:0;border-radius:0}
.ds-field__control--search .ds-field__input:focus{border-color:transparent;box-shadow:none}
.ds-switch{display:flex;align-items:center;gap:10px;min-height:42px;padding:8px 12px;border:1px solid var(--border);border-radius:12px;background:var(--surface);cursor:pointer;transition:border-color .22s ease,background .22s ease}
.ds-switch:hover{border-color:color-mix(in srgb,var(--brand-500) 35%,var(--border));background:color-mix(in srgb,var(--brand-500) 4%,var(--surface))}
.ds-switch input{position:absolute;opacity:0;width:0;height:0;pointer-events:none}
.ds-switch__track{position:relative;width:40px;height:22px;flex-shrink:0;border-radius:999px;background:var(--surface-2);border:1px solid var(--border);transition:background .25s ease,border-color .25s ease}
.ds-switch__thumb{position:absolute;top:2px;inset-inline-start:2px;width:16px;height:16px;border-radius:50%;background:#fff;box-shadow:0 1px 4px rgba(0,0,0,.15);transition:transform .25s cubic-bezier(.3,.8,.3,1)}
.ds-switch input:checked+.ds-switch__track{background:var(--brand-500);border-color:var(--brand-500)}
.ds-switch input:checked+.ds-switch__track .ds-switch__thumb{transform:translateX(-16px)}
[dir="ltr"] .ds-switch input:checked+.ds-switch__track .ds-switch__thumb{transform:translateX(16px)}
.ds-switch input:disabled+.ds-switch__track{opacity:.45}
.ds-switch input:disabled~.ds-switch__label{opacity:.55}
.ds-switch__label{font-size:12.5px;font-weight:600;color:var(--text-muted)}
/* The panel's `.content *{min-width:0}` let a narrow cell squeeze the label below its own word, so «غیرفعال» ran under the track; the label may wrap between words, never inside one. */
.ds-switch .ds-switch__label{min-width:min-content}
:where(.rlx-modal,.ds-modal,.ds-governed-dialog) .ds-field__input{background:color-mix(in srgb,var(--surface-2,#f8fafc) 78%,var(--surface,#fff))}
.ds-field__input--area{min-block-size:112px;resize:vertical;line-height:1.8}.ds-field__input--numeric{direction:ltr;text-align:end;font-variant-numeric:tabular-nums}.ds-field--check{display:flex;width:100%;max-width:100%;box-sizing:border-box;align-items:center;justify-self:stretch;gap:8px;padding:10px 12px;border:1px solid var(--border);border-radius:var(--radius-lg,12px);background:var(--surface);direction:rtl}.ds-field--check .ds-field__label,.ds-field--check>span,.ds-field--check>label{flex:1 1 auto;min-width:0;margin:0}.ds-field--check input[type=checkbox]{position:static;order:2;align-self:center;margin:0;transform:none;flex-shrink:0}.ds-form-note{padding:10px 12px;margin-block-end:12px;border-radius:var(--radius-lg,12px);color:var(--text-muted);background:var(--surface-2);font-size:12px;line-height:1.8}.ds-form-actions{display:flex;gap:8px;margin-block-start:14px}.ds-form-actions .btn{flex:1}@media(max-width:520px){.ds-form-actions{flex-direction:column-reverse}.ds-form-actions .btn{inline-size:100%;flex:0 0 auto}}

/* One panel-wide action contract: cancel is physically left, commit is right. */
.ds-modal-actions--standard{display:grid!important;grid-template-columns:auto minmax(0,1fr) auto!important;align-items:center;gap:10px;inline-size:100%;direction:ltr}
.ds-modal-actions--standard>.ds-modal-action--cancel{grid-column:1;justify-self:start;direction:rtl}
.ds-modal-actions--standard>.ds-modal-action--commit{grid-column:3;justify-self:end;direction:rtl}
/* Confirm footers: the flex spacer is no grid cell, and «خیر» stands beside commit instead of pushing it to a second row. */
.ds-modal-actions--standard>.ds-confirm__foot-spacer{display:none}
.ds-confirm__foot.ds-modal-actions--standard>:is(.ds-modal-action--cancel,.ds-modal-action--commit){grid-row:1}
.ds-confirm__foot.ds-modal-actions--standard>[data-ds-modal-action="no"]:not(.ds-modal-action--cancel){grid-column:2;grid-row:1;justify-self:end;direction:rtl}
@media(max-width:520px){.ds-confirm__foot.ds-modal-actions--standard>.ds-modal-action--cancel{grid-row:auto}.ds-confirm__foot.ds-modal-actions--standard>[data-ds-modal-action="no"]:not(.ds-modal-action--cancel){grid-column:1;grid-row:2;inline-size:100%;justify-self:stretch}}
@media(max-width:520px){.ds-modal-actions--standard{grid-template-columns:1fr!important}.ds-modal-actions--standard>.ds-modal-action--cancel,.ds-modal-actions--standard>.ds-modal-action--commit{grid-column:1;inline-size:100%;justify-self:stretch}.ds-modal-actions--standard>.ds-modal-action--commit{grid-row:1}.ds-modal-actions--standard>.ds-modal-action--cancel{grid-row:2}}

/* Legacy dialogs receive the same visual chassis without forking page CSS. */
.ds-governed-dialog{border:1px solid var(--border)!important;border-radius:var(--radius-xl,18px)!important;background:var(--surface)!important;box-shadow:0 24px 70px color-mix(in srgb,var(--text) 18%,transparent)!important;overflow:hidden}
.ds-governed-dialog__head{border-block-end:1px solid var(--border);background:color-mix(in srgb,var(--pastel-lilac) 22%,var(--surface))}
.ds-governed-dialog__body{background:var(--surface)}
.ds-governed-dialog__foot{border-block-start:1px solid var(--border);background:var(--surface);padding:14px 18px}

/* Modal surface hierarchy: controls stay visibly distinct from the white
   dialog canvas while remaining inside the neutral design-system palette. */
.rlx-modal .rlx-form .ds-field__input,
.rlx-modal .rlx-form .ds-dropdown__trigger,
.rlx-modal .rlx-form .cbx-input,
.rlx-modal .rlx-form .rlx-color-trigger,
.ds-modal .ds-field__input,
.ds-modal .ds-dropdown__trigger,
.ds-modal .cbx-input {
  background: color-mix(in srgb, var(--surface-2, #f1f5f9) 88%, var(--surface, #fff));
  border-color: color-mix(in srgb, var(--border-strong, #cbd5e1) 72%, var(--border, #e2e8f0));
}
.rlx-modal .rlx-form .ds-field__input:hover:not(:disabled):not(:focus),
.rlx-modal .rlx-form .ds-dropdown__trigger:hover,
.rlx-modal .rlx-form .cbx-input:hover:not(:disabled):not(:focus),
.rlx-modal .rlx-form .rlx-color-trigger:hover {
  background: color-mix(in srgb, var(--surface-2, #f1f5f9) 76%, var(--pastel-mint, #d8f3e8));
}
.rlx-modal .ds-form-actions .btn.ghost,
.ds-modal .ds-form-actions .btn.ghost {
  background: color-mix(in srgb, var(--surface-2, #f1f5f9) 90%, var(--border, #e2e8f0));
  border: 1px solid var(--border-strong, #cbd5e1);
  color: var(--text, #0f172a);
}
.rlx-modal .ds-form-actions .btn.ghost:hover,
.ds-modal .ds-form-actions .btn.ghost:hover {
  background: color-mix(in srgb, var(--surface-2, #f1f5f9) 72%, var(--border, #e2e8f0));
  border-color: color-mix(in srgb, var(--brand-500, #2c7873) 28%, var(--border-strong, #cbd5e1));
}

/* Dynamic custom-field long text owns a complete form row. */
.rlx-modal .ds-modal__form-grid,
.ds-modal .ds-modal__form-grid,
.ds-governed-dialog .ds-modal__form-grid {
  align-items: end;
}

.ds-modal__form-grid > .rdnf-field--long-text,
.rlx-form.ds-modal__form-grid > .rdnf-field--long-text {
  grid-column: 1 / -1 !important;
  inline-size: 100%;
  min-inline-size: 0;
  justify-self: stretch;
}
.rdnf-field--long-text .rdnf-long-text {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  min-height: calc(3 * 1.8em + 22px);
  resize: none;
}

/* A boolean has no separate caption row. Align its control body with the
   neighbouring input instead of the neighbour's caption. */
.ds-modal__form-grid > .rdnf-field--boolean {
  align-self: end;
}
.ds-modal__form-grid > .rdnf-related-pair,
.rlx-form.ds-modal__form-grid > .rdnf-related-pair {
  display: grid;
  gap: 0;
  align-self: start;
  min-inline-size: 0;
}

/* Customer profile editor consumes the governed modal/form contracts. */
.cef-modal { inline-size: min(1120px, calc(100vw - 32px)); }
.cef-modal .ds-modal__body { background: var(--surface); }
.cef-modal .ds-form-section {
  padding: 16px;
  margin-block-end: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl, 18px);
  background: color-mix(in srgb, var(--surface-2) 52%, var(--surface));
}
.cef-modal .ds-form-section__title { margin-block-end: 14px; }
.cef-modal .cef-customer-section { display:grid; grid-template-columns:minmax(190px,.55fr) minmax(360px,1.45fr); align-items:end; gap:20px; }
.cef-modal .cef-customer-section .ds-form-section__title { margin:0; }
.cef-modal .cef-customer-picker { min-inline-size:0; }
.cef-modal .cef-customer-picker .ds-field { margin:0; }
.cef-modal .cef-grid--three { grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
.cef-modal .cef-span-2 { grid-column:span 2; }
.cef-modal .cef-span-full { grid-column:1 / -1; }
.cef-modal .cef-identity-head { display:flex; align-items:center; gap:10px; }
.cef-modal .cef-identity-copy { min-inline-size:0; }
.cef-modal .cef-legal-toggle { margin-inline-start:auto; display:flex; align-items:center; gap:12px; min-inline-size:210px; padding:9px 12px; border:1px solid color-mix(in srgb,var(--ds-modal-accent-deep,#7c3aed) 24%,var(--border)); border-radius:14px; background:color-mix(in srgb,var(--ds-modal-accent,#ddd6fe) 32%,var(--surface)); cursor:pointer; transition:border-color .2s ease,background .2s ease,box-shadow .2s ease; }
.cef-modal .cef-legal-toggle:hover { border-color:color-mix(in srgb,var(--ds-modal-accent-deep,#7c3aed) 48%,var(--border)); box-shadow:0 6px 16px color-mix(in srgb,var(--ds-modal-accent-deep,#7c3aed) 14%,transparent); }
.cef-modal .cef-legal-toggle__copy { display:grid; gap:1px; flex:1; }
.cef-modal .cef-legal-toggle__copy b { font-size:12px; color:var(--text); }
.cef-modal .cef-legal-toggle__copy small { font-size:10.5px; color:var(--text-muted); }
.cef-modal .cef-legal-toggle > input { position:absolute; inline-size:1px; block-size:1px; opacity:0; }
.cef-modal .cef-switch { direction:ltr; display:flex; align-items:center; inline-size:44px; block-size:24px; padding:3px; border-radius:999px; background:var(--border-strong,#cbd5e1); transition:background .2s ease; }
.cef-modal .cef-switch i { inline-size:18px; block-size:18px; border-radius:50%; background:#fff; box-shadow:0 2px 6px rgba(15,23,42,.22); transform:translateX(0); transition:transform .2s ease; }
.cef-modal .cef-legal-toggle > input:checked + .cef-switch { background:var(--ds-modal-accent-deep,#7c3aed); }
.cef-modal .cef-legal-toggle > input:checked + .cef-switch i { transform:translateX(20px); }
.cef-modal .cef-legal-toggle > input:focus-visible + .cef-switch { outline:3px solid color-mix(in srgb,var(--ds-modal-accent-deep,#7c3aed) 28%,transparent); outline-offset:2px; }
.cef-modal .ds-smart-field > input:not([type="checkbox"]),
.cef-modal .ds-smart-field > textarea { background: var(--surface); }
.cef-modal .ds-modal__feedback:empty { display: none; }
.cef-modal .cef-submit {
  border-color: var(--ds-modal-accent-deep, #7c3aed);
  background: linear-gradient(135deg, #8b5cf6, var(--ds-modal-accent-deep, #7c3aed));
  color: #fff;
  box-shadow: 0 9px 22px color-mix(in srgb, var(--ds-modal-accent-deep, #7c3aed) 28%, transparent);
}
.cef-modal .cef-submit [data-ds-icon],
.cef-modal .cef-submit .ds-icon { color: #fff !important; }
.cef-modal .cef-submit:hover:not(:disabled) {
  border-color: #6d28d9;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  box-shadow: 0 12px 26px color-mix(in srgb, #7c3aed 36%, transparent);
}
.cef-modal .cef-submit:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ds-modal-accent-deep, #7c3aed) 30%, transparent);
  outline-offset: 3px;
}
.cef-modal .cef-submit:disabled { box-shadow: none; }
/* Identity variants and dynamic fields all participate in one grid. Keeping
   the variant wrappers out of layout prevents nested grids from producing
   half-width fields and unmatched rows. */
.cef-modal [data-cef-individual-fields]:not([hidden]),
.cef-modal [data-cef-company-fields]:not([hidden]),
.cef-modal [data-cef-individual-fields] > .ds-modal__form-grid,
.cef-modal [data-cef-company-fields] > .ds-modal__form-grid { display: contents; }
.cef-modal [data-cef-fields-mount] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cef-modal .ds-smart-field,
.cef-modal [data-cef-fields-mount] > * { min-inline-size: 0; }
.cef-modal [data-cef-fields-mount] > .rdnf-field--boolean {
  align-self: end;
  margin-block-start: var(--space-2, 8px);
}

/* Crm customer identity is one logical pair. Keep name and mobile
   on the same two-column row even when the form also contains hidden cache
   inputs and the browser's auto-placement would otherwise split them.
   The pin applies only while the shared form is two-column (the rlx-form
   mobile rule collapses it at 700px); an explicit `grid-column: 2` on a
   one-column grid creates an implicit track and shrinks every full-width
   field to the narrow explicit column. */
@media (min-width: 701px) {
  .rlx-form.ds-modal__form-grid:has(#rlx-f-customer_name_search) > .rlx-field:has(#rlx-f-customer_name_search),
  .rlx-form.ds-modal__form-grid:has(#rlx-f-customer_phone_search) > .rlx-field:has(#rlx-f-customer_phone_search) {
    grid-row: 1;
  }
  .rlx-form.ds-modal__form-grid:has(#rlx-f-customer_name_search) > .rlx-field:has(#rlx-f-customer_name_search) { grid-column: 1; }
  .rlx-form.ds-modal__form-grid:has(#rlx-f-customer_phone_search) > .rlx-field:has(#rlx-f-customer_phone_search) { grid-column: 2; }
}
.rlx-form .cbx.is-readonly .cbx-input,
.rlx-form .cbx-input.is-readonly { background: color-mix(in srgb, var(--border, #d7dde6) 28%, var(--surface, #fff)); color: var(--text-muted, #7b8494); cursor: not-allowed; }

/* Section headings with a title and explanatory line must not collapse into
   one continuous sentence in RTL modals. */
.ds-form-section__title:has(> div) {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ds-form-section__title > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.ds-form-section__title > div > strong,
.ds-form-section__title > div > small {
  display: block;
  margin: 0;
}
.ds-form-section__title > div > small {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.7;
  color: var(--text-muted, #667085);
}

/* Contact-tag editor: keep the name and color controls on one shared
   baseline instead of letting their different internal markup offset them. */
.rlx-form.ds-modal__form-grid.rlx-contact-tag-form {
  align-items: start;
}
.rlx-contact-tag-form > .rlx-field {
  align-self: start;
}
.rlx-contact-tag-form .ds-field__input,
.rlx-contact-tag-form .rlx-color-trigger {
  min-block-size: 46px;
}

/* Contact-group editor: the identity controls form one right-hand column
   while the narrative field owns the facing left-hand column. */
.rlx-form.ds-modal__form-grid.rlx-contact-group-form {
  align-items: start;
}
.rlx-contact-group-form > .rlx-field:has(#rlx-f-name) {
  grid-column: 1;
  grid-row: 1;
}
.rlx-contact-group-form > .rlx-field:has(#rlx-f-color) {
  grid-column: 1;
  grid-row: 2;
}
.rlx-contact-group-form > .rlx-field:has(#rlx-f-description) {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: stretch;
}
.rlx-contact-group-form > .rlx-field:has(#rlx-f-description) textarea {
  min-block-size: 100%;
  resize: none;
}
@media (max-width: 700px) {
  .rlx-contact-group-form > .rlx-field:has(#rlx-f-name),
  .rlx-contact-group-form > .rlx-field:has(#rlx-f-color),
  .rlx-contact-group-form > .rlx-field:has(#rlx-f-description) {
    grid-column: 1;
    grid-row: auto;
  }
  .rlx-contact-group-form > .rlx-field:has(#rlx-f-description) textarea {
    min-block-size: 132px;
    resize: vertical;
  }
}
.rlx-form .ds-field__label[data-tooltip] { position: relative; cursor: help; }
.rlx-form .ds-field__label[data-tooltip]::after {
  content: attr(data-tooltip); position: absolute; z-index: 20; right: 0;
  bottom: calc(100% + 8px); width: max-content; max-width: min(32rem, 80vw);
  padding: 8px 10px; border: 1px solid color-mix(in srgb, var(--border, #d7dde6) 80%, #2c7873 20%);
  border-radius: 8px; background: var(--surface, #fff); color: var(--text, #172033);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .14); font-size: 11px; font-weight: 500;
  line-height: 1.7; opacity: 0; pointer-events: none; transform: translateY(3px);
  transition: opacity .15s ease, transform .15s ease;
}
.rlx-form .ds-field__label[data-tooltip]:hover::after,
.rlx-form .ds-field__label[data-tooltip]:focus-visible::after { opacity: 1; transform: translateY(0); }
.ds-field__tip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-inline: 3px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font-family: Arial, sans-serif;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  vertical-align: -1px;
}

@media (max-width: 640px) {
  .cef-modal { inline-size: min(100%, calc(100vw - 16px)); max-height: calc(100vh - 16px); }
  .cef-modal .ds-form-section { padding: 12px; }
  .cef-modal [data-cef-fields-mount] { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .cef-modal .cef-customer-section { grid-template-columns:1fr; align-items:stretch; }
  .cef-modal .cef-grid--three { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .cef-modal .cef-span-2 { grid-column:1 / -1; }
}

@media (max-width: 640px) {
  .cef-modal .cef-grid--three { grid-template-columns:1fr; }
  .cef-modal .cef-span-2 { grid-column:auto; }
  .cef-modal .cef-identity-head { align-items:flex-start; flex-wrap:wrap; }
  .cef-modal .cef-legal-toggle { margin-inline-start:0; inline-size:100%; box-sizing:border-box; }
}


/* Inline validation for every governed static or dynamically mounted form. */
.ds-field--invalid .ds-field__input,
.ds-field--invalid input:not([type="checkbox"]):not([type="radio"]),
.ds-field--invalid select,
.ds-field--invalid textarea,
.is-invalid.ds-field__input,
input.is-invalid,
select.is-invalid,
textarea.is-invalid {
  border-color: var(--red-500, #e05252) !important;
  background: color-mix(in srgb, var(--red-500, #e05252) 5%, var(--surface, #fff)) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red-500, #e05252) 16%, transparent) !important;
}
.ds-governance-field-error {
  display: block;
  margin-block-start: 5px;
  color: var(--red-600, #bd3349);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.65;
  animation: dsValidationMessageIn .16s ease-out;
}
.ds-field__money-words {
  display: block;
  min-block-size: 1.55em;
  margin-block-start: 3px;
  color: var(--text-muted, #64748b);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.55;
}
.ds-field__money-words[hidden] { display: none; }
@keyframes dsValidationMessageIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .ds-governance-field-error { animation: none; }
}

/* Canonical dependent fields: explanatory text occupies a full row; the vehicle
   group and model follow it as one two-column pair. */
.ds-modal__form-grid > .ds-form-note {
  grid-column: 1 / -1 !important;
  inline-size: 100%;
  min-inline-size: 0;
  justify-self: stretch;
}

/* Rating field (data-ds-rating): integer 1..max picked with stars; behaviour
   in ds-form-governance.js. Same rules in design-system.css and ds-form.css. */
.ds-rating { display: inline-flex; align-items: center; gap: 2px; min-block-size: 42px; }
.ds-rating__star { inline-size: 34px; block-size: 34px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text-faint); cursor: pointer; transition: color .15s ease, transform .15s ease, background .15s ease; }
.ds-rating__star svg, .ds-rating__star [data-ds-icon] { inline-size: 24px; block-size: 24px; color: inherit; }
.ds-rating__star.is-on, .ds-rating__star.is-preview { color: var(--amber-500); }
/* DsIcons gives «star» the amber concept tone with !important; the rating colour follows the button state instead. */
.ds-rating__star .ds-ico[data-tone], .ds-rating__star [data-ds-icon-tone] { color: inherit !important; }
.ds-rating__star:hover { transform: scale(1.12); }
.ds-rating__star:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 20%, transparent); }
.ds-rating__clear { margin-inline-start: 6px; inline-size: 28px; block-size: 28px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text-faint); cursor: pointer; }
.ds-rating__clear:hover { background: color-mix(in srgb, var(--brand-500) 10%, var(--surface-2)); color: var(--brand-600); }
.ds-rating__clear[hidden] { display: none; }
.ds-rating[aria-disabled="true"] { opacity: .58; pointer-events: none; }

/* Iranian vehicle plate (data-ds-plate): «12-ب-345-67» entered in four
   segments; read order is left to right like the physical plate. */
.ds-plate { display: inline-grid; inline-size: max-content; max-inline-size: 100%; justify-self: start; grid-template-columns: 34px 46px 64px 58px 66px; align-items: stretch; direction: ltr; min-block-size: 42px; border: 1px solid var(--border-strong); border-radius: var(--radius-lg, 12px); background: var(--surface); overflow: hidden; }
.ds-plate:focus-within { border-color: var(--brand-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 16%, transparent); }
.ds-plate__band { display: grid; place-items: center; padding: 2px; background: var(--brand-600); color: #fff; font-size: 8px; font-weight: 700; line-height: 1.15; text-align: center; letter-spacing: .02em; }
.ds-plate__part { inline-size: 100%; min-inline-size: 0; border: 0; border-inline-end: 1px solid var(--border); background: transparent; color: var(--text); font: inherit; font-size: 16px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; outline: 0; }
.ds-plate__letter { display: flex; align-items: stretch; border-inline-end: 1px solid var(--border); }
.ds-plate__letter .ds-dropdown { inline-size: 100%; }
.ds-plate__letter .ds-dropdown__trigger { block-size: 100%; border: 0; border-radius: 0; background: transparent; box-shadow: none; justify-content: center; font-size: 15px; font-weight: 700; padding-inline: 6px; }
.ds-plate__region { display: grid; grid-template-rows: auto 1fr; background: var(--surface-2); }
.ds-plate__region small { padding-block-start: 3px; color: var(--text-muted); font-size: 9px; text-align: center; line-height: 1; }
.ds-plate__region .ds-plate__part { border: 0; font-size: 15px; }
.ds-plate[aria-invalid="true"] { border-color: var(--red-500); }

/* Location field (data-ds-geo): latitude / longitude, «my position» and a
   Neshan map link; behaviour in ds-form-governance.js. Same rules in
   design-system.css and ds-form.css. */
.ds-geo { display: grid; gap: 8px; min-inline-size: 0; }
.ds-geo__inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ds-geo__part { text-align: center; font-variant-numeric: tabular-nums; }
.ds-geo__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ds-geo__actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.ds-geo__actions .btn svg { inline-size: 16px; block-size: 16px; }
.ds-geo__actions [hidden] { display: none; }
.ds-geo__status { color: var(--text-muted); font-size: 11.5px; line-height: 1.6; }
.ds-geo__status:empty { display: none; }
.ds-geo[aria-invalid="true"] .ds-geo__part { border-color: var(--red-500); }

/* File attachment field (data-ds-attach): uploaded files as the catalog
   upload tile plus «افزودن فایل»; behaviour in ds-form-governance.js. Same
   rules in design-system.css and ds-form.css. */
.ds-attach { display: grid; gap: 8px; justify-items: start; min-inline-size: 0; }
.ds-attach__list { inline-size: 100%; margin: 0; padding: 0; list-style: none; }
.ds-attach__list:empty { display: none; }
.ds-attach .ds-pattern-upload__file button { display: grid; place-items: center; }
.ds-attach .ds-pattern-upload__file button svg { inline-size: 16px; block-size: 16px; }
.ds-attach__add { display: inline-flex; align-items: center; gap: 6px; }
.ds-attach__add svg { inline-size: 16px; block-size: 16px; }
.ds-attach__status { color: var(--text-muted); font-size: 11.5px; line-height: 1.6; }
.ds-attach__status:empty { display: none; }
.ds-attach[aria-disabled="true"] .ds-pattern-upload__file button { display: none; }

/* Colour field (catalog «رنگ برند», design-system.css): promoted unchanged so product pages can use it. */
.ds-field__control--color {
  display: flex;
  align-items: stretch;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .22s ease, box-shadow .22s ease;
}
.ds-field__control--color:hover,
.ds-field__control--color:focus-within {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 18%, transparent);
}
.ds-color-picker__swatch {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 42px;
  cursor: pointer;
}
.ds-field__input--color {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}
.ds-field__input--color::-webkit-color-swatch-wrapper {
  padding: 0;
}
.ds-field__input--color::-webkit-color-swatch {
  border: none;
  border-radius: 0;
}
.ds-field__input--color::-moz-color-swatch {
  border: none;
}
.ds-field__color-val {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  background: var(--surface);
  border-inline-start: 1px solid var(--border);
  cursor: pointer;
  user-select: all;
}

/* Existing popup viewport/density contract, shared by product and catalog.
   Moved verbatim from compact-monitor.css; no new visual values. */
@media (min-width: 901px) and (max-width: 1440px) {
  .ds-modal-back { padding: 10px; }
  .ds-modal { max-width: calc(100vw - 20px); max-height: calc(100dvh - 20px); }
  .ds-modal__body { overflow: auto; }
}
@media (min-width: 901px) and (max-height: 800px) {
  .ds-modal__head { padding-block: 13px 11px; }
  .ds-modal__body { padding-block: 14px; }
  .ds-modal__foot { padding-block: 11px; }
}

/* ---------------------------------------------------------------------------
   Step form (DsStepForm, ds-step-form.js) — a long form split into steps.
   The tracker is the shared .ds-pattern-wizard; only one panel is shown.
   Catalog: design-system/index.html#ds-step-form. Owner approval 1405/08/20.
   ------------------------------------------------------------------------ */
.ds-step-form { display:flex; flex-direction:column; gap:var(--space-4, 16px); min-width:0; }
.ds-step-form__tracker { margin:0; }
.ds-step-form__tracker .ds-pattern-wizard__step.is-reachable { cursor:pointer; }
.ds-step-form__tracker .ds-pattern-wizard__step:focus-visible { outline:2px solid var(--brand-500); outline-offset:2px; }
.ds-step-form__panel { display:flex; flex-direction:column; gap:var(--space-3, 12px); min-width:0; }
.ds-step-form__panel[hidden] { display:none !important; }
.ds-step-form__intro { margin:0; color:var(--text-muted); font-size:13px; line-height:1.9; }
.ds-step-form__counter { color:var(--text-faint); font-size:12px; margin-inline-end:auto; align-self:center; }
.ds-step-form__actions [hidden] { display:none !important; }

/* ---------------------------------------------------------------------------
   Option rows (DsOptionRows, ds-option-rows.js) — one choice per row with
   reorder and remove. Catalog: design-system/index.html#ds-option-rows.
   ------------------------------------------------------------------------ */
.ds-option-rows { display:flex; flex-direction:column; gap:8px; min-width:0; }
.ds-option-rows__list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:6px; max-height:320px; overflow-y:auto; overflow-x:hidden; }
.ds-option-rows__row { display:grid; grid-template-columns:28px minmax(0,1fr) auto; align-items:center; gap:8px; min-width:0; }
.ds-option-rows__index { color:var(--text-faint); font-size:12px; text-align:center; font-variant-numeric:tabular-nums; }
.ds-option-rows__input { min-width:0; }
.ds-option-rows__tools { display:inline-flex; gap:4px; }
.ds-option-rows__tools .icon-btn { width:32px; height:32px; border-radius:10px; }
.ds-option-rows__tools .icon-btn [data-ds-icon] { width:18px; height:18px; }
.ds-option-rows__tools .icon-btn:disabled { opacity:.4; cursor:not-allowed; transform:none; box-shadow:none; }
.ds-option-rows__footer { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; }
.ds-option-rows__footer .btn [data-ds-icon] { width:16px; height:16px; margin-inline-end:4px; vertical-align:-3px; }
@media (max-width: 560px) {
  .ds-option-rows__row { grid-template-columns:22px minmax(0,1fr); }
  .ds-option-rows__tools { grid-column:2; justify-content:flex-end; }
}


/* /portal/ds/css/ds-dropdown.css */
/* DS custom dropdown — panel extract (design-system/design-system.css) */
.ds-dropdown { position: relative; width: 100%; }
.ds-dropdown--compact { flex: 0 0 auto; min-width: 148px; }
.ds-dropdown--narrow { min-width: 128px; }

/* Pager footer — fixed width (overridden further in ds-grid.css) */
.ds-dropdown--pager.ds-dropdown--compact,
.ds-dropdown--pager.ds-dropdown--narrow,
.ds-dropdown--pager {
  flex: 0 0 68px;
  width: 68px;
  min-width: 68px;
  max-width: 68px;
}

.ds-dropdown__trigger {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: start;
  transition: border-color .25s ease, box-shadow .25s ease, background .25s ease;
}
.ds-dropdown__trigger:hover {
  border-color: color-mix(in srgb, var(--brand-500) 30%, var(--border));
  background: color-mix(in srgb, var(--pastel-mint) 35%, var(--surface));
}

.ds-dropdown.is-open { z-index: 40; }
.ds-dropdown.is-open .ds-dropdown__trigger {
  border-color: var(--brand-500);
  box-shadow: none;
  border-end-end-radius: 0;
  border-end-start-radius: 0;
}
.ds-dropdown.is-open:not(.ds-dropdown--dropup) .ds-dropdown__trigger {
  border-bottom: none;
}

.ds-dropdown__chev {
  display: flex;
  align-items: center;
  color: var(--text-faint);
  transition: transform .25s ease, color .25s ease;
  flex-shrink: 0;
}
.ds-dropdown.is-open .ds-dropdown__chev {
  transform: rotate(180deg);
  color: var(--brand-500);
}

/* Drop-up variant (pager footer) */
.ds-dropdown--dropup.is-open .ds-dropdown__trigger {
  border-start-start-radius: 0;
  border-start-end-radius: 0;
  border-end-start-radius: 12px;
  border-end-end-radius: 12px;
  border-top: none;
}
.ds-dropdown--dropup .ds-dropdown__menu {
  top: auto;
  bottom: 100%;
  border-top: 1px solid var(--brand-500);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  animation-name: dsDropUpIn;
}
@keyframes dsDropUpIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ds-dropdown__menu {
  position: absolute;
  top: 100%;
  inset-inline: 0;
  z-index: 30;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--brand-500);
  border-top: none;
  border-radius: 0 0 12px 12px;
  box-shadow: none;
  max-height: 240px;
  box-sizing: border-box;
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  overflow: hidden auto;
  clip-path: inset(0 round 0 0 12px 12px);
  scrollbar-color: color-mix(in srgb, var(--brand-500) 42%, transparent) transparent;
  scrollbar-width: thin;
  animation: dsDropIn .22s ease both;
}
.ds-dropdown__menu::-webkit-scrollbar { width: 7px; }
.ds-dropdown__menu::-webkit-scrollbar-track { margin-block: 7px; background: transparent; }
.ds-dropdown__menu::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 999px; background: color-mix(in srgb, var(--brand-500) 42%, transparent); background-clip: padding-box; }
.ds-dropdown__menu::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.ds-dropdown--dropup .ds-dropdown__menu { clip-path: inset(0 round 12px 12px 0 0); }
/* Author rule must beat animation/fill-mode so closed menus never stay visible */
.ds-dropdown__menu[hidden] {
  display: none !important;
  visibility: hidden;
  pointer-events: none;
  animation: none;
}
.ds-dropdown.is-open .ds-dropdown__menu {
  box-shadow: 0 14px 32px -8px rgba(15, 23, 42, .2);
}
.ds-dropdown[data-ds-portal-active="1"].is-open .ds-dropdown__trigger {
  border: 1px solid var(--brand-500);
  border-radius: 12px;
  background: color-mix(in srgb, var(--pastel-mint) 22%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 12%, transparent);
}
.ds-dropdown__menu--portal {
  box-sizing: border-box;
  border: 1px solid color-mix(in srgb, var(--brand-500) 72%, var(--border));
  border-radius: 12px;
  box-shadow: 0 18px 42px -12px rgba(15, 23, 42, .28);
  scrollbar-color: color-mix(in srgb, var(--brand-500) 42%, transparent) transparent;
  scrollbar-width: thin;
  clip-path: inset(0 round 12px);
}
.ds-dropdown__menu--portal[data-placement="bottom"] {
  border-radius: 12px;
}
.ds-dropdown__menu--portal[data-placement="top"] {
  border-radius: 12px;
}
.ds-dropdown__menu--portal::-webkit-scrollbar { width: 7px; }
.ds-dropdown__menu--portal::-webkit-scrollbar-track { margin-block: 7px; background: transparent; }
.ds-dropdown__menu--portal::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 999px; background: color-mix(in srgb, var(--brand-500) 42%, transparent); background-clip: padding-box; }
.ds-dropdown__menu--portal[data-placement="top"] { animation-name: dsDropUpIn; }
@keyframes dsDropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ds-dropdown__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.ds-dropdown__option:hover {
  background: color-mix(in srgb, var(--pastel-mint) 55%, var(--surface));
  color: var(--brand-600);
}
.ds-dropdown__option.is-keyboard-active {
  outline: 2px solid color-mix(in srgb, var(--brand-500) 48%, transparent);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--pastel-mint) 55%, var(--surface));
  color: var(--brand-700);
}
.ds-dropdown__option.is-selected {
  background: color-mix(in srgb, var(--pastel-mint) 70%, var(--surface));
  color: var(--brand-600);
  font-weight: 700;
}
.ds-dropdown__option.is-selected::after {
  content: "✓";
  color: var(--brand-500);
  font-size: 12px;
}

.ds-dropdown__menu--action .ds-dropdown__option {
  justify-content: flex-start;
  min-height: 48px;
  padding: 8px 10px;
}
.ds-dropdown__menu--action .ds-dropdown__option.is-selected {
  color: var(--text);
  background: transparent;
  font-weight: 500;
}
.ds-dropdown__menu--action .ds-dropdown__option.is-selected::after { content: none; }
.ds-dropdown__menu--action .ds-dropdown__option:hover {
  color: var(--brand-700);
  background: color-mix(in srgb, var(--pastel-mint) 52%, var(--surface));
}
.ds-action-menu__icon {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  color: var(--brand-700);
  background: color-mix(in srgb, var(--pastel-mint) 65%, var(--surface));
}
.ds-action-menu__icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.9; }
.ds-action-menu__copy { display: grid; gap: 2px; min-width: 0; }
.ds-action-menu__copy strong { font-size: 11px; }
.ds-action-menu__copy small { overflow: hidden; color: var(--text-muted); font-size: 8px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.ds-dropdown[data-ds-portal-active="1"].ds-dropdown--action.is-open .ds-dropdown__trigger {
  border: 1px solid var(--brand-500);
  border-radius: 12px;
}
/* Icon action menu («⋮», catalog «منوی اقدام سریع», DsDropdown.renderDsActionMenu):
   the inbox «•••» trigger as a standalone 32px icon button (row-action size). */
.ds-dropdown--icon,
.ds-dropdown--icon.ds-dropdown--compact { flex: 0 0 32px; width: 32px; min-width: 32px; max-width: 32px; }
.ds-dropdown--icon .ds-dropdown__trigger {
  display: grid;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  place-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--brand-500) 18%, var(--border));
  border-radius: 10px;
  color: var(--text-muted);
  background: var(--surface);
}
.ds-dropdown--icon .ds-dropdown__trigger:hover { color: var(--brand-700); background: color-mix(in srgb, var(--pastel-mint) 45%, var(--surface)); }
.ds-dropdown--icon .ds-dropdown__trigger:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.ds-dropdown--icon .ds-dropdown__value { display: grid; width: 18px; height: 18px; place-items: center; line-height: 0; }
.ds-dropdown--icon .ds-dropdown__value svg { width: 18px; height: 18px; fill: currentColor; }
.ds-dropdown--icon.is-open .ds-dropdown__trigger,
.ds-dropdown[data-ds-portal-active="1"].ds-dropdown--icon.is-open .ds-dropdown__trigger { border: 1px solid var(--brand-500); border-radius: 10px; color: var(--brand-700); }
/* Its options are short commands, so they read at the regular option size. */
.ds-dropdown__menu--quick .ds-action-menu__copy strong { font-size: 13px; }
.ds-dropdown__menu--quick .ds-action-menu__copy small { font-size: 11px; }
.ds-dropdown__menu--quick .ds-dropdown__option { min-height: 40px; }
.ds-dropdown__menu--portal.ds-dropdown__menu--action {
  border: 1px solid color-mix(in srgb, var(--brand-500) 58%, var(--border));
  border-radius: 13px;
  box-shadow: 0 20px 44px -12px rgba(15, 23, 42, .3);
}

/* Multi-select column picker */
.ds-dropdown--multi .ds-dropdown__option.is-selected::after {
  content: '✓';
  color: var(--brand-500);
  font-weight: 700;
}
.ds-dropdown__multi-foot {
  list-style: none;
  margin: 4px 0 0;
  padding: 8px 6px 4px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

/* Legacy compatibility: native selects remain as data/event adapters only. */
.ds-native-select-adapter {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.ds-native-select-host {
  display: inline-flex;
  min-width: 0;
  vertical-align: middle;
}
.ds-native-select-host > .ds-dropdown { width: 100%; }


/* /portal/ds/css/ds-patterns.css */
/* Shared enterprise interaction patterns. Prefix: ds-pattern-* */
.ds-pattern-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.ds-pattern { min-width:0; padding:18px; border:1px solid var(--border); border-radius:var(--radius); background:var(--surface); }
.ds-pattern--wide { grid-column:1/-1; }
.ds-pattern__head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:14px; }
.ds-pattern__head h3 { margin:0; font-size:15px; }
.ds-pattern__head code { color:var(--text-muted); font-size:11px; }

.ds-pattern-tabs__list {
  --ds-tab-x: 4px;
  --ds-tab-w: 0px;
  position: relative;
  display: flex;
  gap: 6px;
  padding: 4px;
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2) 88%, var(--pastel-mint));
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .035);
}
.ds-pattern-tabs__list::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 4px;
  bottom: 4px;
  left: var(--ds-tab-x);
  width: var(--ds-tab-w);
  border: 1px solid color-mix(in srgb, var(--brand-500) 13%, var(--border));
  border-radius: 10px;
  background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--pastel-mint) 24%, var(--surface)));
  box-shadow: 0 7px 18px -9px rgba(15, 23, 42, .28), 0 2px 6px rgba(44, 120, 115, .07);
  transition: left .32s cubic-bezier(.22,.8,.2,1), width .32s cubic-bezier(.22,.8,.2,1);
  pointer-events: none;
}
.ds-pattern-tabs__tab {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  padding: 9px 15px;
  border: 0;
  border-radius: 10px;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  transition: color .22s ease, transform .22s ease;
}
.ds-pattern-tabs__tab:hover {
  color: var(--brand-600);
  transform: translateY(-1px);
}
.ds-pattern-tabs__tab:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: -2px;
}
.ds-pattern-tabs__tab[aria-selected="true"] {
  color: var(--brand-700);
  background: transparent;
  box-shadow: none;
  font-weight: 800;
}
.ds-pattern-tabs__panel {
  padding: 17px 6px 2px;
  color: var(--text-muted);
  line-height: 1.8;
}
/* A panel holding complete sections, not a line of text: the sections keep the
   text colour and line height of a standalone ds-pattern. Opt-in, catalog #enterprise-patterns. */
.ds-pattern-tabs__panel--sections {
  color: var(--text);
  line-height: inherit;
}
.ds-pattern-tabs__panel.is-entering {
  animation: dsTabPanelIn .3s cubic-bezier(.22,.8,.2,1) both;
}
@keyframes dsTabPanelIn {
  from { opacity: 0; transform: translateY(7px); filter: blur(1.5px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}
@media (prefers-reduced-motion: reduce) {
  .ds-pattern-tabs__list::before,
  .ds-pattern-tabs__tab { transition: none; }
  .ds-pattern-tabs__panel.is-entering { animation: none; }
}

.ds-pattern-accordion { display:grid; gap:9px; }
.ds-pattern-accordion__item {
  overflow:hidden;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--surface);
  transition:border-color .22s ease, box-shadow .22s ease;
}
.ds-pattern-accordion__item:has(.ds-pattern-accordion__trigger[aria-expanded="true"]) {
  border-color:color-mix(in srgb,var(--brand-500) 28%,var(--border));
  box-shadow:0 9px 24px -16px rgba(15,23,42,.3);
}
.ds-pattern-accordion__trigger {
  display:flex;
  width:100%;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:13px 14px;
  border:0;
  color:var(--text);
  background:var(--surface-2);
  cursor:pointer;
  font:inherit;
  font-weight:750;
  text-align:start;
  transition:color .22s ease,background .22s ease;
}
.ds-pattern-accordion__trigger:hover {
  color:var(--brand-700);
  background:color-mix(in srgb,var(--pastel-mint) 38%,var(--surface));
}
.ds-pattern-accordion__trigger[aria-expanded="true"] {
  color:var(--brand-700);
  background:color-mix(in srgb,var(--pastel-mint) 58%,var(--surface));
}
.ds-pattern-accordion__trigger::after {
  content:"";
  flex:0 0 8px;
  width:8px;
  height:8px;
  margin:0 4px;
  border-inline-end:2px solid currentColor;
  border-bottom:2px solid currentColor;
  transform:translateY(-2px) rotate(45deg);
  transition:transform .28s cubic-bezier(.22,.8,.2,1);
}
.ds-pattern-accordion__trigger[aria-expanded="true"]::after {
  transform:translateY(2px) rotate(225deg);
}
.ds-pattern-accordion__trigger:focus-visible {
  outline:2px solid var(--brand-500);
  outline-offset:-3px;
  border-radius:10px;
}
.ds-pattern-accordion__summary {
  display:grid;
  grid-template-columns:minmax(0, 1fr) 10px 5.25rem;
  align-items:baseline;
  width:15rem;
  max-width:100%;
  color:var(--text-muted);
  font-size:.78rem;
  font-weight:700;
  line-height:1.6;
  white-space:nowrap;
}
.ds-pattern-accordion__summary-label {
  min-width:0;
  overflow:hidden;
  text-align:start;
  text-overflow:ellipsis;
}
/* The «·» glyph looks like the Persian zero «۰»: next to a count it read «۱ سایت» as
   «۱۰ سایت». The separator is drawn as a thin rule instead; the glyph stays in the
   markup (aria-hidden) but is not painted. */
.ds-pattern-accordion__summary-separator {
  position:relative;
  align-self:center;
  height:.75rem;
  font-size:0;
  color:transparent;
  text-align:center;
}
.ds-pattern-accordion__summary-separator::before {
  content:"";
  position:absolute;
  inset-block:0;
  inset-inline-start:50%;
  width:1px;
  background:var(--text-muted);
  opacity:.45;
}
.ds-pattern-accordion__summary-value {
  direction:rtl;
  text-align:start;
  font-variant-numeric:tabular-nums;
}
.ds-pattern-accordion__trigger--team {
  display:grid;
  grid-template-columns:minmax(0, 1fr) 8rem 10px 5.25rem 8px;
  column-gap:12px;
}
.ds-pattern-accordion__trigger--team > span:first-child {
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.ds-pattern-accordion__trigger--team .ds-pattern-accordion__summary {
  display:contents;
}
.ds-pattern-accordion__panel {
  padding:13px 15px 15px;
  border-top:1px solid color-mix(in srgb,var(--brand-500) 12%,var(--border));
  color:var(--text-muted);
  background:color-mix(in srgb,var(--pastel-mint) 10%,var(--surface));
  line-height:1.9;
}
.ds-pattern-accordion__panel.is-entering {
  animation:dsAccordionPanelIn .28s cubic-bezier(.22,.8,.2,1) both;
}
@keyframes dsAccordionPanelIn {
  from { opacity:0; transform:translateY(-7px); }
  to { opacity:1; transform:translateY(0); }
}
@media (prefers-reduced-motion:reduce) {
  .ds-pattern-accordion__item,
  .ds-pattern-accordion__trigger,
  .ds-pattern-accordion__trigger::after { transition:none; }
  .ds-pattern-accordion__panel.is-entering { animation:none; }
}
@media (max-width:640px) {
  .ds-pattern-accordion__summary {
    width:12.5rem;
    grid-template-columns:minmax(0, 1fr) 10px 4.75rem;
  }
  .ds-pattern-accordion__trigger--team {
    grid-template-columns:minmax(0, 1fr) 5rem 8px 4.5rem 8px;
    column-gap:6px;
  }
}

.ds-pattern-breadcrumb { display:flex; flex-wrap:wrap; align-items:center; gap:7px; color:var(--text-muted); font-size:12px; }
.ds-pattern-breadcrumb a { color:var(--brand-600); text-decoration:none; }
.ds-pattern-breadcrumb span[aria-current="page"] { color:var(--text); font-weight:700; }

.ds-pattern-tree, .ds-pattern-tree ul { margin:0; padding-inline-start:18px; list-style:none; }
.ds-pattern-tree > li { padding-inline-start:0; }
.ds-pattern-tree ul {
  overflow:hidden;
  transform-origin:top;
  transition:height .32s cubic-bezier(.22,.8,.2,1),opacity .24s ease,transform .32s cubic-bezier(.22,.8,.2,1);
  will-change:height,opacity,transform;
}
.ds-pattern-tree ul.is-tree-collapsing,
.ds-pattern-tree ul[hidden] {
  opacity:0;
  transform:translateY(-5px) scaleY(.97);
}
.ds-pattern-tree__toggle {
  display:flex;
  align-items:center;
  gap:9px;
  width:100%;
  padding:8px 5px;
  border:0;
  border-radius:9px;
  color:var(--text);
  background:transparent;
  cursor:pointer;
  font:inherit;
  font-weight:650;
  text-align:start;
  transition:color .2s ease,background .2s ease;
}
.ds-pattern-tree__toggle:hover {
  color:var(--brand-700);
  background:color-mix(in srgb,var(--pastel-mint) 28%,transparent);
}
.ds-pattern-tree__toggle::before {
  content:"";
  width:7px;
  height:7px;
  border-inline-end:2px solid currentColor;
  border-bottom:2px solid currentColor;
  color:var(--text-muted);
  transform:rotate(45deg);
  transition:transform .3s cubic-bezier(.22,.8,.2,1),color .2s ease;
}
.ds-pattern-tree__toggle[aria-expanded="true"]::before {
  color:var(--brand-500);
  transform:rotate(225deg);
}
@media (prefers-reduced-motion:reduce) {
  .ds-pattern-tree ul,
  .ds-pattern-tree__toggle,
  .ds-pattern-tree__toggle::before { transition:none; }
}

.ds-pattern-kanban { display:grid; grid-template-columns:repeat(3,minmax(180px,1fr)); gap:12px; overflow:auto; }
.ds-pattern-kanban__column { min-width:180px; padding:10px; border-radius:12px; background:var(--surface-2); }
.ds-pattern-kanban__head { display:flex; justify-content:space-between; gap:8px; margin-bottom:9px; font-size:12px; font-weight:800; }
.ds-pattern-kanban__column[style*="--stage-c"] .ds-pattern-kanban__head,
.ds-pattern-kanban__column[data-stage-c] .ds-pattern-kanban__head {
  margin: -10px -10px 9px;
  padding: 10px 12px;
  border-radius: 12px 12px 0 0;
  border-top: 3px solid var(--stage-c, var(--brand-500));
  border-bottom: 1px solid color-mix(in srgb, var(--stage-c, var(--brand-500)) 28%, var(--border));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--stage-c, var(--brand-500)) 18%, transparent), transparent 90%),
    color-mix(in srgb, var(--surface) 88%, var(--stage-c, var(--brand-500)) 12%);
}
.ds-pattern-kanban__column[style*="--stage-c"] .ds-pattern-kanban__count,
.ds-pattern-kanban__column[data-stage-c] .ds-pattern-kanban__count {
  background: var(--stage-c, var(--brand-500));
  color: #fff;
}
.ds-pattern-kanban__count {
  display:inline-grid;
  min-width:25px;
  height:25px;
  place-items:center;
  padding-inline:6px;
  border-radius:999px;
  color:var(--brand-700);
  background:color-mix(in srgb,var(--pastel-mint) 68%,var(--surface));
  border:1px solid color-mix(in srgb,var(--brand-500) 16%,var(--border));
  font-variant-numeric:tabular-nums;
}
.ds-pattern-kanban__count.is-count-updated {
  animation:dsKanbanCountPop .32s cubic-bezier(.34,1.56,.64,1);
}
@keyframes dsKanbanCountPop {
  50% { transform:scale(1.18); box-shadow:0 0 0 5px color-mix(in srgb,var(--pastel-mint) 36%,transparent); }
}
.ds-pattern-kanban__card { padding:10px; border:1px solid var(--border); border-radius:10px; background:var(--surface); box-shadow:var(--shadow-xs); cursor:grab; }
.ds-pattern-kanban__card + .ds-pattern-kanban__card { margin-top:8px; }
.ds-pattern-kanban__card.is-dragging { opacity:.5; }
.ds-pattern-kanban__column.is-drop-target { outline:2px dashed var(--brand-300); outline-offset:-3px; }
@media (prefers-reduced-motion:reduce) {
  .ds-pattern-kanban__count.is-count-updated { animation:none; }
}

/* DsKanban mount API — modifiers on top of the base pattern (TRFC-0068 §5) */
.ds-pattern-kanban--cozy { gap:9px; }
.ds-pattern-kanban--cozy .ds-pattern-kanban__column { padding:7px; }
.ds-pattern-kanban--cozy .ds-pattern-kanban__card { padding:7px; font-size:12.5px; }
.ds-pattern-kanban--cozy .ds-pattern-kanban__card + .ds-pattern-kanban__card { margin-top:6px; }
.ds-pattern-kanban--compact { gap:7px; }
.ds-pattern-kanban--compact .ds-pattern-kanban__column { padding:5px; }
.ds-pattern-kanban--compact .ds-pattern-kanban__card { padding:5px 7px; font-size:11.5px; }
.ds-pattern-kanban--compact .ds-pattern-kanban__card + .ds-pattern-kanban__card { margin-top:4px; }

.ds-pattern-kanban__card[tabindex] { cursor:grab; }
.ds-pattern-kanban__card.is-kbd-grabbed {
  outline:2px solid var(--brand-500);
  outline-offset:2px;
  box-shadow:0 0 0 4px color-mix(in srgb,var(--brand-500) 18%,transparent);
}
.ds-pattern-kanban__column.is-kbd-target { outline:2px dashed var(--brand-500); outline-offset:-3px; background:color-mix(in srgb,var(--pastel-mint) 22%,var(--surface-2)); }
.ds-pattern-kanban__card[aria-disabled="true"] { cursor:not-allowed; opacity:.55; }
.ds-pattern-kanban__card.is-move-pending { opacity:.72; }

.ds-pattern-kanban__column--empty { display:flex; align-items:center; justify-content:center; min-height:64px; }
.ds-pattern-kanban__empty { color:var(--text-muted); font-size:12px; text-align:center; padding:8px; }
.ds-pattern-kanban__sr {
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

.ds-pattern-timeline { position:relative; margin:0; padding:0 24px 0 0; list-style:none; }
.ds-pattern-timeline::before { content:""; position:absolute; inset-block:7px; inset-inline-start:7px; width:2px; background:var(--border); }
.ds-pattern-timeline__item { position:relative; padding:0 0 16px; }
.ds-pattern-timeline__item::before { content:""; position:absolute; inset-inline-start:-21px; inset-block-start:5px; width:10px; height:10px; border:3px solid var(--surface); border-radius:50%; background:var(--brand-500); box-shadow:0 0 0 1px var(--border); }
.ds-pattern-timeline__item time { display:block; color:var(--text-muted); font-size:11px; }
/* The journey ledger can contain long public URLs/campaign identifiers.
   Keep the complete business value readable inside the shared component. */
[data-ds-web-journey] a,
[data-ds-web-journey] bdi { overflow-wrap:anywhere; word-break:break-word; }

.ds-pattern-wizard {
  /* [crm-modular-system] diaco-ux-reviewer/diaco-qa fix (2026-07-31) —
     hardcoded to 4 columns; any wizard with >4 steps silently wrapped into
     multiple rows with the single ::before connector line below only ever
     spanning row 1 (confirmed live, Attach Mode's 8-step wizard). Callers
     with more steps than fit on one line should set
     `style="--ds-wizard-cols: <n>"` on this element so every step stays on
     one row (columns just narrow) instead of wrapping — the connector line
     spans the full row exactly as it did before for ≤4-step callers, which
     keep the default and are unaffected. */
  position:relative;
  display:grid;
  grid-template-columns:repeat(var(--ds-wizard-cols, 4), 1fr);
  gap:0;
  counter-reset:step;
  padding:8px 2px 2px;
}
.ds-pattern-wizard::before {
  content:"";
  position:absolute;
  z-index:0;
  inset-inline:12%;
  top:23px;
  height:2px;
  border-radius:999px;
  background:linear-gradient(to left,
    var(--brand-400) 0 50%,
    var(--border) 50% 100%);
}
.ds-pattern-wizard__step {
  position:relative;
  z-index:1;
  min-width:0;
  padding:0 5px 4px;
  border:0;
  border-radius:0;
  color:var(--text-muted);
  background:transparent;
  box-shadow:none;
  text-align:center;
  font-size:11px;
  font-weight:650;
  transition:color .2s ease;
}
.ds-pattern-wizard__step:hover {
  color:var(--brand-700);
}
.ds-pattern-wizard__step::before {
  counter-increment:step;
  /* Visible digits are Persian (absolute Persian locale gate). */
  content:counter(step, persian);
  display:grid;
  width:28px;
  height:28px;
  place-items:center;
  margin:0 auto 7px;
  border:3px solid var(--surface);
  border-radius:50%;
  color:var(--text-muted);
  background:var(--surface-3);
  box-shadow:0 0 0 1px var(--border);
  font-size:10px;
  font-weight:800;
}
.ds-pattern-wizard__step.is-complete {
  color:var(--brand-700);
  font-weight:800;
}
.ds-pattern-wizard__step.is-complete::before {
  content:"✓";
  color:white;
  background:var(--brand-500);
  box-shadow:0 0 0 1px var(--brand-500);
}
.ds-pattern-wizard__step[aria-current="step"] {
  color:var(--brand-700);
  font-weight:850;
}
.ds-pattern-wizard__step[aria-current="step"]::before {
  color:white;
  background:#8065c8;
  box-shadow:0 0 0 4px color-mix(in srgb,var(--pastel-lilac) 55%,transparent);
  animation:none;
}
@media (prefers-reduced-motion:reduce) {
  .ds-pattern-wizard__step { transition:none; }
}

.ds-pattern-access { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.ds-pattern-access__state { padding:12px; border:1px solid var(--border); border-radius:11px; background:var(--surface-2); }
.ds-pattern-access__state strong { display:block; margin-bottom:5px; }
.ds-pattern-access__state span { color:var(--text-muted); font-size:11px; line-height:1.7; }

/* Canonical one-line settings strip: title, persisted switch and row action. */
.ds-settings-strip { display:flex; flex-wrap:nowrap; gap:12px; width:100%; overflow-x:auto; padding:2px 2px 8px; scrollbar-gutter:stable; }
/* Wrapping variant for a long list of cards: three equal columns that flow down, never a horizontal scroll. */
.ds-settings-strip--grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); overflow-x:visible; padding:2px; scrollbar-gutter:auto; }
@media (max-width:1100px) { .ds-settings-strip--grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:680px) { .ds-settings-strip--grid { grid-template-columns:minmax(0,1fr); } }
.ds-settings-card { --ds-settings-tone:var(--brand-500); --ds-settings-soft:var(--pastel-mint); display:grid; flex:1 0 min(360px,100%); min-width:0; grid-template-columns:auto minmax(110px,1fr) auto; align-items:center; gap:12px; min-height:82px; padding:14px 16px; border:1px solid color-mix(in srgb,var(--ds-settings-tone) 28%,var(--border)); border-radius:16px; background:linear-gradient(135deg,color-mix(in srgb,var(--ds-settings-soft) 72%,var(--surface)),var(--surface)); box-shadow:0 10px 26px -22px color-mix(in srgb,var(--ds-settings-tone) 68%,transparent); transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease; }
.ds-settings-card:hover { border-color:color-mix(in srgb,var(--ds-settings-tone) 48%,var(--border)); box-shadow:0 14px 30px -20px color-mix(in srgb,var(--ds-settings-tone) 72%,transparent); transform:translateY(-1px); }
.ds-settings-card[data-tone="sky"] { --ds-settings-tone:var(--sky-600,#347cac); --ds-settings-soft:var(--pastel-sky); }
.ds-settings-card[data-tone="lilac"] { --ds-settings-tone:var(--lilac-600,#8065c8); --ds-settings-soft:var(--pastel-lilac); }
.ds-settings-card[data-tone="amber"] { --ds-settings-tone:var(--amber-600,#b7791f); --ds-settings-soft:var(--pastel-lemon); }
.ds-settings-card[data-tone="rose"] { --ds-settings-tone:var(--rose-600,#c45168); --ds-settings-soft:var(--pastel-rose); }
.ds-settings-card__icon { display:grid; width:42px; height:42px; place-items:center; border-radius:13px; color:var(--ds-settings-tone); background:color-mix(in srgb,var(--ds-settings-soft) 78%,var(--surface)); box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--ds-settings-tone) 16%,transparent); }
.ds-settings-card__title { min-width:0; overflow:hidden; color:var(--text); font-size:14px; font-weight:850; text-overflow:ellipsis; white-space:nowrap; }
.ds-settings-card__actions { display:flex; align-items:center; gap:8px; white-space:nowrap; }
.ds-settings-card .ds-switch { min-height:40px; margin:0; border-color:color-mix(in srgb,var(--ds-settings-tone) 18%,var(--border)); background:color-mix(in srgb,var(--surface) 90%,transparent); }
.ds-settings-card .ds-switch input:checked+.ds-switch__track { border-color:var(--ds-settings-tone); background:var(--ds-settings-tone); }
.ds-settings-card .ds-grid__row-btn { border-color:color-mix(in srgb,var(--ds-settings-tone) 24%,var(--border)); color:var(--ds-settings-tone); background:color-mix(in srgb,var(--surface) 88%,transparent); }
@media (prefers-reduced-motion:reduce) { .ds-settings-card { transition:none; } }
/* Phones: the title gives way (it already ellipsizes) so the switch label and row action stay whole. */
@media (max-width:520px) { .ds-settings-card { grid-template-columns:auto minmax(0,1fr) auto; } }
/* Grid cells are a fraction of the row, so the title gives way there too instead of pushing the switch label out of the card. */
.ds-settings-strip--grid .ds-settings-card { grid-template-columns:auto minmax(0,1fr) auto; }
/* Phones, a card with two switches or more (one per device in «اعلان‌های من»): giving way left the title one letter wide, so the title keeps the first row and the switches take a row of their own under it (owner report 1405/08/24). */
@media (max-width:520px) { .ds-settings-card:has(.ds-settings-card__actions .ds-switch ~ .ds-switch) { grid-template-columns:auto minmax(0,1fr); row-gap:10px; } .ds-settings-card:has(.ds-settings-card__actions .ds-switch ~ .ds-switch) .ds-settings-card__actions { grid-column:1 / -1; flex-wrap:wrap; } }

.ds-command-backdrop { position:fixed; inset:0; z-index:1100; display:grid; place-items:start center; padding-top:min(18vh,150px); background:rgba(2,28,30,.35); backdrop-filter:blur(5px); }
.ds-command-backdrop[hidden] { display:none; }
.ds-command { width:min(620px,calc(100vw - 32px)); overflow:hidden; border:1px solid var(--border); border-radius:16px; background:var(--surface); box-shadow:var(--shadow-lg); }
.ds-command__search { width:100%; padding:16px 18px; border:0; border-bottom:1px solid var(--border); color:var(--text); background:transparent; outline:0; font:inherit; }
.ds-command__list { max-height:300px; margin:0; padding:8px; overflow:auto; list-style:none; }
.ds-command__item { display:flex; justify-content:space-between; gap:12px; padding:10px; border-radius:9px; cursor:pointer; }
.ds-command__item:hover, .ds-command__item.is-active { background:var(--brand-50); color:var(--brand-600); }

/* Operational patterns: list/detail, expandable rows, upload, approval, import and jobs. */
.ds-pattern__head p { margin:5px 0 0; color:var(--text-muted); font-size:11px; line-height:1.7; }
.ds-pattern-avatar { display:grid; flex:0 0 38px; width:38px; height:38px; place-items:center; border-radius:12px; color:var(--brand-700); background:var(--pastel-mint); font-size:11px; font-weight:850; }
.ds-pattern-avatar--sky { color:#285b80; background:var(--pastel-sky); }
.ds-pattern-avatar--rose { color:#9c3f50; background:var(--pastel-rose); }
.ds-pattern-avatar--lg { width:48px; height:48px; border-radius:15px; font-size:13px; }
.ds-pattern-status { display:inline-flex; width:max-content; align-items:center; justify-content:center; padding:5px 9px; border-radius:999px; font-size:10px; font-style:normal; font-weight:800; white-space:nowrap; }
.ds-pattern-status--amber { color:#9a5a10; background:var(--pastel-peach); }
.ds-pattern-status--mint { color:#187457; background:var(--pastel-mint); }
.ds-pattern-status--rose { color:#a64052; background:var(--pastel-rose); }
.ds-pattern-status--sky { color:#296484; background:var(--pastel-sky); }

.ds-pattern-master-detail { display:grid; grid-template-columns:minmax(280px,.9fr) minmax(340px,1.1fr); min-height:330px; overflow:hidden; border:1px solid var(--border); border-radius:16px; background:var(--surface-2); }
.ds-pattern-master-detail__list { display:grid; align-content:start; gap:6px; padding:9px; border-inline-end:1px solid var(--border); }
.ds-pattern-master-detail__item { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:10px; width:100%; padding:11px; border:1px solid transparent; border-radius:12px; color:var(--text); background:transparent; cursor:pointer; font:inherit; text-align:start; transition:.22s ease; }
.ds-pattern-master-detail__item:hover { background:var(--surface); transform:translateX(-2px); }
.ds-pattern-master-detail__item.is-active { border-color:color-mix(in srgb,var(--brand-500) 25%,var(--border)); background:linear-gradient(135deg,color-mix(in srgb,var(--pastel-mint) 48%,var(--surface)),var(--surface)); box-shadow:0 10px 25px -20px rgba(15,23,42,.45); }
.ds-pattern-master-detail__item strong,.ds-pattern-master-detail__item small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ds-pattern-master-detail__item strong { font-size:12px; }
.ds-pattern-master-detail__item small { margin-top:4px; color:var(--text-muted); font-size:10px; }
.ds-pattern-master-detail__detail { padding:22px; background:linear-gradient(145deg,var(--surface),color-mix(in srgb,var(--pastel-sky) 20%,var(--surface))); }
.ds-pattern-master-detail__detail.is-changing { animation:dsDetailChange .3s cubic-bezier(.22,.8,.2,1); }
@keyframes dsDetailChange { from { opacity:.35; transform:translateY(7px); } }
.ds-pattern-master-detail__hero { display:flex; align-items:center; gap:12px; padding-bottom:18px; border-bottom:1px solid var(--border); }
.ds-pattern-master-detail__hero div { flex:1; min-width:0; }
.ds-pattern-master-detail__hero small { color:var(--text-muted); font-size:10px; }
.ds-pattern-master-detail__hero h4 { margin:3px 0 0; font-size:16px; }
.ds-pattern-detail-facts { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin:18px 0; }
.ds-pattern-detail-facts div { padding:11px; border:1px solid color-mix(in srgb,var(--border) 75%,transparent); border-radius:11px; background:color-mix(in srgb,var(--surface) 80%,transparent); }
.ds-pattern-detail-facts dt { color:var(--text-muted); font-size:9px; }
.ds-pattern-detail-facts dd { margin:5px 0 0; font-size:11px; font-weight:800; }
.ds-pattern-detail-note { display:flex; flex-direction:column; gap:5px; padding:13px; border:1px solid color-mix(in srgb,var(--brand-500) 15%,var(--border)); border-radius:12px; color:var(--brand-700); background:color-mix(in srgb,var(--pastel-mint) 35%,var(--surface)); font-size:11px; }

.ds-pattern-expandable { overflow:hidden; border:1px solid var(--border); border-radius:13px; }
.ds-pattern-expandable__row { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:10px; width:100%; min-height:68px; padding:10px 13px; border:0; border-bottom:1px solid var(--border); color:var(--text); background:var(--surface); cursor:pointer; font:inherit; text-align:start; }
.ds-pattern-expandable__row:hover,.ds-pattern-expandable__row[aria-expanded="true"] { background:color-mix(in srgb,var(--pastel-sky) 28%,var(--surface)); }
.ds-pattern-expandable__row strong,.ds-pattern-expandable__row small { display:block; }
.ds-pattern-expandable__row strong { font-size:11px; }
.ds-pattern-expandable__row small { margin-top:4px; color:var(--text-muted); font-size:9px; }
.ds-pattern-expandable__row b { font-size:10px; white-space:nowrap; }
.ds-pattern-expandable__chevron {
  display:block;
  width:18px;
  height:22px;
  color:var(--text-muted);
  line-height:1;
  transform-origin:center;
  transition:color .2s ease,transform .3s cubic-bezier(.22,.8,.2,1);
}
.ds-pattern-expandable__chevron::before {
  content:"›";
  display:block;
  font-family:Arial,sans-serif;
  font-size:25px;
  font-weight:700;
  line-height:20px;
}
[aria-expanded="true"] > .ds-pattern-expandable__chevron {
  color:var(--brand-700);
  transform:rotate(-90deg);
}
[aria-expanded="true"] > .ds-pattern-expandable__chevron::before {
  content:"›";
}
.ds-pattern-expandable__panel {
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:7px;
  height:auto;
  padding:11px 30px 13px;
  overflow:hidden;
  opacity:1;
  background:var(--surface-2);
  transform:translateY(0);
  transform-origin:top;
  transition:height .32s cubic-bezier(.22,.8,.2,1),padding .32s cubic-bezier(.22,.8,.2,1),opacity .22s ease,transform .32s cubic-bezier(.22,.8,.2,1);
}
.ds-pattern-expandable__panel[hidden] { display:none; }
.ds-pattern-expandable__panel.is-collapsing {
  padding-block:0;
  opacity:0;
  transform:translateY(-6px);
}
.ds-pattern-expandable__panel div { min-width:0; }
.ds-pattern-expandable__panel small,.ds-pattern-expandable__panel strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ds-pattern-expandable__panel small { color:var(--text-muted); font-size:9px; }
.ds-pattern-expandable__panel strong { margin-top:3px; font-size:10px; }
.ds-clamp { display:grid; justify-items:start; gap:6px; min-width:0; }
.ds-clamp__text { width:100%; min-width:0; overflow:hidden; white-space:pre-line; overflow-wrap:anywhere; line-height:1.9; transition:max-height .34s cubic-bezier(.22,.8,.2,1); }
.ds-clamp__toggle { display:inline-flex; align-items:center; gap:4px; }
.ds-clamp__toggle[hidden] { display:none; }
.ds-clamp__toggle [data-ds-icon] { width:16px; height:16px; transition:transform .3s cubic-bezier(.22,.8,.2,1); }
.ds-clamp__toggle[aria-expanded="true"] [data-ds-icon] { transform:rotate(180deg); }

.ds-pattern-upload__drop { display:grid; width:100%; place-items:center; padding:19px 12px; border:1.5px dashed color-mix(in srgb,var(--brand-500) 40%,var(--border)); border-radius:14px; color:var(--text); background:linear-gradient(145deg,color-mix(in srgb,var(--pastel-mint) 30%,var(--surface)),color-mix(in srgb,var(--pastel-sky) 22%,var(--surface))); cursor:pointer; font:inherit; transition:.22s ease; }
.ds-pattern-upload__drop:hover,.ds-pattern-upload__drop.is-dragover { border-color:var(--brand-500); transform:translateY(-2px); box-shadow:0 13px 28px -22px var(--brand-600); }
.ds-pattern-upload__drop small { margin-top:5px; color:var(--text-muted); font-size:9px; }
.ds-pattern-upload__drop:disabled,.ds-pattern-upload__file button:disabled { cursor:not-allowed; transform:none; box-shadow:none; }
.ds-pattern-upload__icon { display:grid; width:34px; height:34px; place-items:center; margin-bottom:8px; border-radius:11px; color:white; background:linear-gradient(145deg,var(--brand-400),var(--brand-600)); font-size:18px; font-weight:800; }
.ds-pattern-upload__files { display:grid; gap:7px; margin-top:9px; }
.ds-pattern-upload__file { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:9px; padding:9px; border:1px solid var(--border); border-radius:11px; background:var(--surface); animation:dsUploadIn .25s ease both; }
@keyframes dsUploadIn { from { opacity:0; transform:scale(.97); } }
.ds-pattern-upload__file strong,.ds-pattern-upload__file small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ds-pattern-upload__file strong { font-size:10px; }
.ds-pattern-upload__file small { margin-top:3px; color:var(--text-muted); font-size:9px; }
.ds-pattern-upload__file button { border:0; color:var(--text-muted); background:transparent; cursor:pointer; font-size:18px; }
.ds-pattern-file-icon { display:grid; width:36px; height:36px; place-items:center; border-radius:10px; color:#a64052; background:var(--pastel-rose); font-size:8px; font-weight:900; }

.ds-pattern-approval { overflow:hidden; border:1px solid var(--border); border-radius:16px; background:var(--surface-2); }
.ds-pattern-approval__track { display:grid; grid-template-columns:1fr 45px 1fr 45px 1fr; align-items:center; padding:17px; background:linear-gradient(135deg,color-mix(in srgb,var(--pastel-mint) 30%,var(--surface)),color-mix(in srgb,var(--pastel-lilac) 22%,var(--surface))); }
.ds-pattern-approval__step { display:grid; justify-items:center; color:var(--text-muted); text-align:center; }
.ds-pattern-approval__step > span { display:grid; width:30px; height:30px; place-items:center; margin-bottom:6px; border:3px solid var(--surface); border-radius:50%; background:var(--surface-3); box-shadow:0 0 0 1px var(--border); font-size:10px; font-weight:850; }
.ds-pattern-approval__step strong { font-size:10px; }
.ds-pattern-approval__step small { margin-top:3px; font-size:8px; }
.ds-pattern-approval__step.is-done > span { color:white; background:var(--brand-500); }
.ds-pattern-approval__step.is-current { color:var(--brand-700); }
.ds-pattern-approval__step.is-current > span { color:white; background:#8065c8; box-shadow:0 0 0 5px color-mix(in srgb,var(--pastel-lilac) 55%,transparent); }
.ds-pattern-approval__line { height:3px; border-radius:9px; background:var(--border); }
.ds-pattern-approval__line.is-done { background:var(--brand-400); }
.ds-pattern-approval__body { display:grid; grid-template-columns:minmax(190px,1fr) minmax(220px,1fr) auto; align-items:end; gap:13px; padding:15px; }
.ds-pattern-approval__summary { display:flex; flex-direction:column; align-items:flex-start; gap:6px; }
.ds-pattern-approval__summary strong { font-size:11px; }
.ds-pattern-approval__summary small { color:var(--text-muted); font-size:9px; }
.ds-pattern-approval__body label span { display:block; margin-bottom:5px; color:var(--text-muted); font-size:9px; font-weight:750; }
.ds-pattern-approval__body textarea { width:100%; resize:vertical; border:1px solid var(--border); border-radius:10px; padding:9px; color:var(--text); background:var(--surface); font:inherit; font-size:10px; }
.ds-pattern-approval__actions { display:flex; gap:7px; }
.ds-pattern-approval__actions .btn { white-space:nowrap; }
.ds-pattern-approval__body textarea { display:block; }
.ds-modal .ds-pattern-approval__body textarea { min-height:64px; border-color:var(--border); background:var(--surface); font-size:12.5px; }
.ds-modal .ds-pattern-approval__body { align-items:center; gap:16px; padding:18px; }
.ds-modal .ds-pattern-approval__step strong { font-size:12.5px; }
.ds-modal .ds-pattern-approval__step small { font-size:11px; }
.ds-modal .ds-pattern-approval__summary strong { font-size:13px; }
.ds-modal .ds-pattern-approval__summary small { font-size:11px; line-height:1.6; }
.ds-modal .ds-pattern-approval__body label span { font-size:11.5px; }
.ds-modal .ds-pattern-approval__audit { padding:12px 18px; font-size:11.5px; }
.ds-pattern-approval__actions .btn [data-ds-icon], .ds-pattern-approval__actions .btn .ds-ico { width:18px; height:18px; color:inherit !important; }
.ds-pattern-approval__actions .btn { display:inline-flex; align-items:center; gap:6px; }
.ds-pattern-approval__audit { display:flex; justify-content:space-between; gap:15px; padding:10px 15px; border-top:1px solid var(--border); color:var(--text-muted); background:var(--surface); font-size:9px; }
.ds-pattern-approval__audit.is-updated { animation:dsAuditFlash .55s ease; }
@keyframes dsAuditFlash { 50% { background:var(--pastel-mint); } }

.ds-pattern-import { overflow:hidden; border:1px solid var(--border); border-radius:15px; }
.ds-pattern-import__steps { display:grid; grid-template-columns:repeat(4,1fr); background:var(--surface-2); }
.ds-pattern-import__steps span { padding:11px; color:var(--text-muted); border-bottom:3px solid transparent; text-align:center; font-size:10px; font-weight:750; }
.ds-pattern-import__steps .is-done { color:var(--brand-600); background:color-mix(in srgb,var(--pastel-mint) 30%,transparent); }
.ds-pattern-import__steps .is-active { color:#6a4bb1; border-color:#8065c8; background:color-mix(in srgb,var(--pastel-lilac) 38%,transparent); }
.ds-pattern-import__mapping { display:grid; }
.ds-pattern-import__head,.ds-pattern-import__row { display:grid; grid-template-columns:1fr 1.2fr 1fr 45px; align-items:center; gap:9px; padding:10px 13px; border-bottom:1px solid var(--border); font-size:10px; }
.ds-pattern-import__head { color:var(--text-muted); background:var(--surface-2); font-size:9px; font-weight:800; }
.ds-pattern-import__row > span { overflow:hidden; color:var(--text-muted); text-overflow:ellipsis; white-space:nowrap; }
.ds-pattern-import__row button { padding:7px 9px; border:1px solid var(--border); border-radius:9px; color:var(--brand-700); background:var(--surface); cursor:pointer; font:inherit; font-size:9px; direction:ltr; }
.ds-pattern-import__row i { display:grid; width:24px; height:24px; place-items:center; border-radius:50%; font-style:normal; }
.ds-pattern-import__row i.is-ok { color:#187457; background:var(--pastel-mint); }
.ds-pattern-import__row i.is-warn { color:#a64052; background:var(--pastel-rose); }
.ds-pattern-import__foot { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px; color:var(--text-muted); background:var(--surface-2); font-size:10px; }

.ds-pattern-job { --job-progress:68; --job-progress-percent:68%; display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:18px; padding:16px; border:1px solid var(--border); border-radius:16px; background:linear-gradient(145deg,color-mix(in srgb,var(--pastel-sky) 28%,var(--surface)),var(--surface)); }
.ds-pattern-job__visual { position:relative; display:grid; width:88px; height:88px; place-items:center; }
.ds-pattern-job__visual span { position:absolute; z-index:1; font-size:15px; font-weight:900; }
.ds-pattern-job__visual svg { width:88px; height:88px; transform:rotate(-90deg); }
.ds-pattern-job__visual circle { fill:none; stroke:var(--surface-3); stroke-width:4; }
.ds-pattern-job__visual .ds-pattern-job__meter { stroke:var(--brand-500); stroke-linecap:round; stroke-dasharray:var(--job-progress) 100; transition:stroke-dasharray .5s ease; }
.ds-pattern-job__content { min-width:0; }
.ds-pattern-job__content > div:first-child { display:grid; grid-template-columns:auto 1fr; align-items:center; gap:6px 9px; }
.ds-pattern-job__content strong { font-size:12px; }
.ds-pattern-job__content small { grid-column:1/-1; color:var(--text-muted); font-size:9px; }
.ds-pattern-job__bar { height:8px; margin-top:12px; overflow:hidden; border-radius:999px; background:var(--surface-3); box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--border) 70%,transparent); }
.ds-pattern-job__bar span {
  position:relative;
  display:block;
  width:68%;
  min-width:7px;
  height:100%;
  overflow:hidden;
  border-radius:inherit;
  background:linear-gradient(90deg,var(--brand-300),var(--brand-500),var(--brand-600));
  box-shadow:0 0 10px color-mix(in srgb,var(--brand-500) 35%,transparent);
  transition:width .5s ease,background .3s ease;
}
.ds-pattern-job__bar span::after {
  content:"";
  position:absolute;
  inset-block:0;
  width:35%;
  background:linear-gradient(90deg,transparent,rgba(255,255,255,.65),transparent);
  animation:dsJobShimmer 1.35s ease-in-out infinite;
}
@keyframes dsJobShimmer {
  from { inset-inline-start:-40%; }
  to { inset-inline-start:110%; }
}
.ds-pattern-job.is-paused .ds-pattern-job__bar span::after,
.ds-pattern-job.is-complete .ds-pattern-job__bar span::after { animation-play-state:paused; opacity:0; }
.ds-pattern-job.is-complete .ds-pattern-job__bar span { background:linear-gradient(90deg,#55b98a,var(--brand-500)); }
.ds-pattern-job__content p { margin:8px 0 0; color:var(--text-muted); font-size:9px; }

.ds-pattern-lines { overflow:hidden; border:1px solid var(--border); border-radius:15px; background:var(--surface); }
.ds-pattern-lines__meta { display:grid; grid-template-columns:150px 150px 1fr; gap:10px; padding:12px; background:var(--surface-2); }
.ds-pattern-lines__meta label span { display:block; margin-bottom:4px; color:var(--text-muted); font-size:9px; }
.ds-pattern-lines__meta input { width:100%; padding:8px 9px; border:1px solid var(--border); border-radius:9px; color:var(--text); background:var(--surface); font:inherit; font-size:10px; }
.ds-pattern-lines__table { min-width:720px; overflow:auto; }
.ds-pattern-lines__head,.ds-pattern-lines__row { display:grid; grid-template-columns:35px 1.1fr 1.4fr 1fr 1fr 35px; align-items:center; gap:7px; padding:8px 11px; border-bottom:1px solid var(--border); }
.ds-pattern-lines__head { color:var(--text-muted); background:var(--surface-2); font-size:9px; font-weight:800; }
.ds-pattern-lines__row > input,.ds-pattern-lines__row > button[data-ds-account] { min-width:0; padding:8px; border:1px solid transparent; border-radius:8px; color:var(--text); background:transparent; font:inherit; font-size:10px; text-align:start; }
.ds-pattern-lines__row > input:hover,.ds-pattern-lines__row > input:focus,.ds-pattern-lines__row > button[data-ds-account]:hover { border-color:var(--border); background:var(--surface-2); outline:0; }
.ds-pattern-lines__account { width:100%; min-width:0; }
.ds-pattern-lines__account .cbx-input { width:100%; min-width:0; box-sizing:border-box; padding:9px 10px; padding-inline-end:30px; overflow:hidden; border:1px solid transparent; border-radius:8px; color:var(--text); background:transparent; outline:0; text-overflow:ellipsis; font:inherit; font-size:9px; }
.ds-pattern-lines__account .cbx-input:hover,.ds-pattern-lines__account .cbx-input:focus { border-color:var(--border); background:var(--surface-2); box-shadow:0 0 0 3px color-mix(in srgb,var(--pastel-mint) 45%,transparent); }
.ds-pattern-lines__account .ds-dropdown__trigger { width:100%; min-width:0; justify-content:space-between; border-color:transparent; background:transparent; box-shadow:none; }
.ds-pattern-lines__account .ds-dropdown__trigger:hover,.ds-pattern-lines__account.is-open .ds-dropdown__trigger { border-color:var(--border); background:var(--surface-2); }
.ds-pattern-lines__account .ds-dropdown__value { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:9px; }
.ds-pattern-lines__row > input[inputmode="numeric"] { direction:ltr; text-align:end; font-variant-numeric:tabular-nums; }
.ds-pattern-lines__row > button[data-ds-line-remove] { border:0; color:var(--text-muted); background:transparent; cursor:pointer; font-size:17px; }
.ds-pattern-lines__foot { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:11px; background:var(--surface-2); }
.ds-pattern-lines__totals { display:flex; flex-wrap:wrap; align-items:center; gap:12px; color:var(--text-muted); font-size:9px; }
.ds-pattern-lines__totals b { margin-inline-start:4px; color:var(--text); font-size:10px; }
.ds-pattern-lines__totals [data-ds-balance] { padding:5px 8px; border-radius:999px; font-weight:800; }
.ds-pattern-lines__totals .is-balanced { color:#187457; background:var(--pastel-mint); }
.ds-pattern-lines__totals .is-unbalanced { color:#a64052; background:var(--pastel-rose); }

.ds-pattern-report { display:grid; grid-template-columns:165px minmax(300px,1fr) 170px; min-height:310px; overflow:hidden; border:1px solid var(--border); border-radius:15px; }
.ds-pattern-report__fields,.ds-pattern-report__config { display:flex; flex-direction:column; gap:7px; padding:13px; background:var(--surface-2); }
.ds-pattern-report__fields { border-inline-end:1px solid var(--border); }
.ds-pattern-report__config { border-inline-start:1px solid var(--border); }
.ds-pattern-report__fields > strong,.ds-pattern-report__config > strong { margin-bottom:5px; font-size:10px; }
.ds-pattern-report__fields label { display:flex; align-items:center; gap:7px; padding:7px; border-radius:8px; color:var(--text-muted); font-size:9px; cursor:pointer; }
.ds-pattern-report__fields label:has(input:checked) { color:var(--brand-700); background:color-mix(in srgb,var(--pastel-mint) 45%,var(--surface)); font-weight:750; }
.ds-pattern-report__fields input { accent-color:var(--brand-500); }
.ds-pattern-report__canvas { min-width:0; padding:13px; }
.ds-pattern-report__toolbar { display:flex; align-items:center; justify-content:space-between; gap:10px; padding-bottom:10px; border-bottom:1px solid var(--border); }
.ds-pattern-report__toolbar small,.ds-pattern-report__toolbar strong { display:block; }
.ds-pattern-report__toolbar small { color:var(--text-muted); font-size:8px; }
.ds-pattern-report__toolbar strong { margin-top:3px; font-size:11px; }
.ds-pattern-report__chips { display:flex; flex-wrap:wrap; gap:5px; min-height:36px; padding-block:9px; }
.ds-pattern-report__chips span { padding:5px 8px; border-radius:999px; color:var(--brand-700); background:var(--pastel-mint); font-size:8px; font-weight:750; animation:dsUploadIn .2s ease; }
.ds-pattern-report__preview { display:grid; gap:10px; }
.ds-pattern-report__preview div { display:grid; grid-template-columns:1fr auto; gap:5px 10px; }
.ds-pattern-report__preview small { color:var(--text-muted); font-size:9px; }
.ds-pattern-report__preview strong { font-size:10px; }
.ds-pattern-report__preview span { grid-column:1/-1; width:var(--report-w); height:7px; border-radius:999px; background:linear-gradient(90deg,var(--brand-300),var(--brand-500)); transform-origin:right; animation:dsReportBar .45s ease both; }
@keyframes dsReportBar { from { transform:scaleX(0); } }
.ds-pattern-report__config label { display:grid; gap:4px; margin-top:3px; }
.ds-pattern-report__config label span { color:var(--text-muted); font-size:8px; }
.ds-pattern-report__config .ds-dropdown { width:100%; min-width:0; }
.ds-pattern-report__config .ds-dropdown__trigger { width:100%; min-width:0; justify-content:space-between; padding:8px; border:1px solid var(--border); border-radius:8px; color:var(--text); background:var(--surface); box-shadow:none; font-size:9px; text-align:start; }
.ds-pattern-report__config .ds-dropdown__value { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.ds-pattern-inbox { display:grid; grid-template-columns:240px minmax(320px,1fr); min-height:390px; overflow:hidden; border:1px solid color-mix(in srgb,var(--brand-500) 12%,var(--border)); border-radius:18px; background:var(--surface); box-shadow:0 18px 44px color-mix(in srgb,var(--pastel-lilac) 24%,transparent); }
.ds-pattern-inbox__list { padding:9px; border-inline-end:1px solid var(--border); background:linear-gradient(165deg,color-mix(in srgb,var(--pastel-lilac) 25%,var(--surface-2)),color-mix(in srgb,var(--pastel-sky) 16%,var(--surface-2))); }
.ds-pattern-inbox__search { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:7px; margin-bottom:7px; padding:0 10px; border:1px solid var(--border); border-radius:12px; color:var(--text-muted); background:var(--surface); box-shadow:0 5px 14px color-mix(in srgb,var(--pastel-lilac) 18%,transparent); transition:border-color .18s ease,box-shadow .18s ease; }
.ds-pattern-inbox__search:focus-within { border-color:color-mix(in srgb,var(--brand-500) 55%,var(--border)); box-shadow:0 0 0 3px color-mix(in srgb,var(--pastel-mint) 42%,transparent); }
.ds-pattern-inbox__search svg { width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:1.8; }
.ds-pattern-inbox__search input { width:100%; min-width:0; height:42px; padding:0; border:0; color:var(--text); background:transparent; outline:0; font:inherit; font-size:9px; }
.ds-pattern-inbox__search button { width:24px; height:24px; padding:0; border:0; border-radius:7px; color:var(--text-muted); background:var(--surface-2); cursor:pointer; font:inherit; line-height:1; }
.ds-pattern-inbox__empty { margin:14px 5px; padding:16px 8px; border:1px dashed var(--border); border-radius:11px; color:var(--text-muted); background:color-mix(in srgb,var(--surface) 78%,var(--pastel-lilac)); font-size:8px; text-align:center; }
.ds-pattern-inbox__list > button { display:grid; grid-template-columns:auto minmax(0,1fr) 34px; align-items:center; gap:8px; width:100%; padding:9px; border:1px solid transparent; border-radius:11px; color:var(--text); background:transparent; cursor:pointer; font:inherit; text-align:start; }
.ds-pattern-inbox__list > button { transition:transform .2s ease,box-shadow .2s ease,background-color .2s ease; }
.ds-pattern-inbox__list > button:hover,.ds-pattern-inbox__list > button.is-active { border-color:color-mix(in srgb,var(--brand-500) 20%,var(--border)); background:var(--surface); box-shadow:0 8px 20px color-mix(in srgb,var(--pastel-sky) 32%,transparent); transform:translateY(-1px); }
.ds-pattern-inbox__list strong,.ds-pattern-inbox__list small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ds-pattern-inbox__list strong { font-size:10px; }
.ds-pattern-inbox__list small,.ds-pattern-inbox__list time { margin-top:3px; color:var(--text-muted); font-size:8px; }
.ds-pattern-inbox__thread-meta { display:grid; justify-items:center; align-self:stretch; gap:2px; padding-inline-start:7px; border-inline-start:1px solid color-mix(in srgb,var(--border) 75%,transparent); }
.ds-pattern-inbox__thread-meta time { align-self:end; margin:0; font-size:7px; line-height:1; white-space:nowrap; }
.ds-pattern-inbox__conversation { display:grid; grid-template-rows:auto 1fr auto; min-width:0; }
.ds-pattern-inbox__conversation > header { position:relative; z-index:2; display:flex; min-height:70px; align-items:center; gap:10px; padding:10px 13px; border-bottom:1px solid color-mix(in srgb,var(--inbox-channel-accent,var(--brand-500)) 18%,var(--border)); background:linear-gradient(135deg,var(--surface),color-mix(in srgb,var(--inbox-channel-pastel,var(--pastel-mint)) 42%,var(--surface))); box-shadow:0 8px 22px color-mix(in srgb,var(--inbox-channel-pastel,var(--pastel-sky)) 32%,transparent); transition:background .28s ease,border-color .28s ease,box-shadow .28s ease; }
.ds-pattern-inbox__conversation > header > div:not(.ds-dropdown) { flex:1; }
.ds-pattern-inbox__conversation > header strong,.ds-pattern-inbox__conversation > header small { display:block; }
.ds-pattern-inbox__conversation > header strong { font-size:11px; line-height:1.4; }
.ds-pattern-inbox__identity { min-width:0; }
.ds-pattern-inbox__conversation > header small { display:inline-flex; width:max-content; max-width:100%; align-items:center; gap:5px; margin-top:5px; padding:3px 7px 3px 4px; border:1px solid color-mix(in srgb,var(--inbox-channel-accent,var(--brand-500)) 16%,var(--border)); border-radius:999px; color:var(--text-muted); background:color-mix(in srgb,var(--surface) 70%,var(--inbox-channel-pastel,var(--pastel-mint))); font-size:8px; line-height:1; transition:background .28s ease,border-color .28s ease; }
.ds-pattern-inbox__conversation > header small span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ds-pattern-channel { display:inline-grid; flex:0 0 auto; width:20px; height:20px; place-items:center; border-radius:7px; color:#fff; font-style:normal; box-shadow:0 4px 9px color-mix(in srgb,currentColor 22%,transparent); vertical-align:middle; }
.ds-pattern-channel svg { width:13px; height:13px; fill:none; stroke:#fff !important; color:#fff; stroke-linecap:round; stroke-linejoin:round; stroke-width:2.15; }
.ds-pattern-channel svg [fill="currentColor"] { fill:#fff !important; stroke:none !important; }
.ds-pattern-inbox__conversation > header .ds-pattern-channel { width:19px; height:19px; border-radius:6px; box-shadow:none; }
.ds-pattern-inbox__conversation > header .ds-pattern-channel svg { width:12px; height:12px; }
.ds-pattern-channel--whatsapp { background:#45b987; }
.ds-pattern-channel--email { background:#6fa9e8; }
.ds-pattern-channel--instagram { background:linear-gradient(135deg,#d889d8,#f39b9b); }
.ds-pattern-inbox[data-channel-theme="whatsapp"] { --inbox-channel-accent:#45b987; --inbox-channel-pastel:var(--pastel-mint); }
.ds-pattern-inbox[data-channel-theme="email"] { --inbox-channel-accent:#6fa9e8; --inbox-channel-pastel:var(--pastel-sky); }
.ds-pattern-inbox[data-channel-theme="instagram"] { --inbox-channel-accent:#d889d8; --inbox-channel-pastel:var(--pastel-rose); }
.ds-pattern-inbox__messages { display:flex; flex-direction:column; gap:12px; padding:18px; background:linear-gradient(145deg,color-mix(in srgb,var(--pastel-sky) 25%,var(--surface)),color-mix(in srgb,var(--pastel-lilac) 13%,var(--surface))); }
.ds-pattern-inbox__messages p { position:relative; max-width:72%; margin:0; padding:24px 13px 10px; border:1px solid color-mix(in srgb,var(--border) 76%,transparent); border-radius:14px; font-size:var(--ds-inbox-message-size,10px); line-height:1.7; box-shadow:0 9px 22px color-mix(in srgb,var(--text) 7%,transparent); animation:dsUploadIn .24s ease both; transition:font-size .18s ease,max-width .18s ease; }
.ds-pattern-inbox__messages p::before { position:absolute; inset-block-start:7px; inset-inline-start:12px; content:attr(data-author); color:var(--text-muted); font-size:7px; font-weight:800; }
.ds-pattern-inbox__messages .is-incoming { align-self:flex-end; border-end-start-radius:4px; background:linear-gradient(135deg,var(--surface),color-mix(in srgb,var(--pastel-lilac) 18%,var(--surface))); }
.ds-pattern-inbox__messages .is-outgoing { align-self:flex-start; border-end-end-radius:4px; border-color:color-mix(in srgb,var(--brand-500) 18%,var(--border)); color:var(--brand-700); background:linear-gradient(135deg,var(--pastel-mint),color-mix(in srgb,var(--pastel-sky) 28%,var(--pastel-mint))); }
.ds-pattern-inbox__messages time { display:block; margin-top:4px; color:var(--text-muted); font-size:7px; }
.ds-pattern-inbox__composer { display:grid; grid-template-columns:auto 1fr auto; gap:7px; padding:10px; border-top:1px solid var(--border); background:var(--surface); box-shadow:0 -7px 20px color-mix(in srgb,var(--pastel-sky) 14%,transparent); }
.ds-pattern-inbox__composer input { min-width:0; border:0; color:var(--text); background:transparent; outline:0; font:inherit; font-size:10px; }
.ds-pattern-inbox__composer > button { padding:7px 13px; border:0; border-radius:10px; color:var(--brand-700); background:var(--pastel-mint); cursor:pointer; font:inherit; font-size:9px; font-weight:800; box-shadow:0 6px 14px color-mix(in srgb,var(--pastel-mint) 58%,transparent); }
.ds-pattern-inbox .ds-pattern-inbox__more,.ds-pattern-inbox .ds-pattern-inbox__attach { flex:0 0 38px !important; width:38px; min-width:38px; max-width:38px; }
.ds-pattern-inbox .ds-pattern-inbox__more { align-self:center; justify-self:center; margin-inline-start:auto; }
.ds-pattern-inbox__composer .ds-pattern-inbox__attach { align-self:center; justify-self:center; margin:auto; }
.ds-pattern-inbox__text-size { display:flex !important; flex:0 0 auto !important; align-items:center; gap:2px; padding:3px; border:1px solid var(--border); border-radius:10px; background:color-mix(in srgb,var(--surface) 88%,var(--pastel-sky)); }
.ds-pattern-inbox__text-size button { display:grid; width:27px; height:27px; padding:0; place-items:center; border:0; border-radius:7px; color:var(--brand-700); background:transparent; cursor:pointer; font:inherit; font-size:15px; font-weight:800; transition:background-color .16s ease,color .16s ease; }
.ds-pattern-inbox__text-size button:hover:not(:disabled) { background:var(--pastel-mint); }
.ds-pattern-inbox__text-size button:disabled { color:var(--text-muted); cursor:not-allowed; opacity:.38; }
.ds-pattern-inbox__text-size output { min-width:32px; color:var(--text-muted); font-size:7px; font-weight:800; text-align:center; }
.ds-pattern-inbox__more .ds-dropdown__trigger,.ds-pattern-inbox__attach .ds-dropdown__trigger { display:grid; width:38px; min-width:38px; height:38px; padding:0; place-items:center; justify-content:center; border:1px solid var(--border); border-radius:11px; color:var(--brand-700); background:color-mix(in srgb,var(--inbox-channel-pastel,var(--pastel-mint)) 55%,var(--surface)); box-shadow:0 5px 13px color-mix(in srgb,var(--inbox-channel-pastel,var(--pastel-mint)) 40%,transparent); transition:transform .18s ease,box-shadow .18s ease,background .28s ease; }
.ds-pattern-inbox__more .ds-dropdown__trigger:hover,.ds-pattern-inbox__attach .ds-dropdown__trigger:hover { transform:translateY(-1px); box-shadow:0 8px 18px color-mix(in srgb,var(--pastel-mint) 58%,transparent); }
.ds-pattern-inbox__more .ds-dropdown__value,.ds-pattern-inbox__attach .ds-dropdown__value { display:grid; width:20px; height:20px; margin:0; padding:0; place-items:center; justify-self:center; line-height:0; text-align:center; }
.ds-pattern-inbox__more .ds-dropdown__value svg,.ds-pattern-inbox__attach .ds-dropdown__value svg { display:block; width:18px; height:18px; margin:auto; fill:none; stroke:currentColor; stroke-linecap:round; stroke-linejoin:round; stroke-width:2; }
.ds-pattern-inbox__attach-menu .ds-action-menu__copy small { display:none; }
.ds-pattern-inbox__attach-menu.ds-dropdown__menu--action .ds-dropdown__option { min-height:42px; }
.ds-pattern-inbox__action-status { padding:5px 8px; border-radius:999px; color:var(--brand-700); background:var(--pastel-lemon); font-size:7px; font-weight:800; animation:dsUploadIn .2s ease both; }

.ds-async-demo { margin-top:18px; overflow:hidden; padding:0; }
.ds-async-demo__head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; padding:16px 18px; border-bottom:1px solid var(--border); }
.ds-async-demo__head h3,.ds-async-demo__head p { margin:0; }
.ds-async-demo__head h3 { font-size:14px; }
.ds-async-demo__head p { margin-top:5px; color:var(--text-muted); font-size:10px; }
.ds-async-demo__head code { color:var(--text-muted); font-size:9px; direction:ltr; }
.ds-async-demo__scenarios { display:flex; flex-wrap:wrap; gap:7px; padding:12px 18px; border-bottom:1px solid var(--border); background:var(--surface-2); }
.ds-async-demo__scenarios button { padding:7px 11px; border:1px solid var(--border); border-radius:999px; color:var(--text-muted); background:var(--surface); cursor:pointer; font:inherit; font-size:9px; font-weight:700; transition:transform .16s ease,border-color .16s ease,background .16s ease,color .16s ease; }
.ds-async-demo__scenarios button:hover,.ds-async-demo__scenarios button.is-active { border-color:color-mix(in srgb,var(--brand-500) 42%,var(--border)); color:var(--brand-700); background:var(--pastel-mint); transform:translateY(-1px); }
.ds-async-state { min-height:250px; padding:22px; background:linear-gradient(145deg,var(--surface),color-mix(in srgb,var(--pastel-sky) 15%,var(--surface))); }
.ds-async-state__center { display:grid; min-height:205px; place-items:center; text-align:center; }
.ds-async-state__content { max-width:460px; }
.ds-async-state__icon { display:grid; width:58px; height:58px; margin:0 auto 12px; place-items:center; border-radius:18px; color:var(--brand-700); background:var(--async-tone,var(--pastel-mint)); box-shadow:0 12px 28px color-mix(in srgb,var(--async-tone,var(--pastel-mint)) 70%,transparent); font-size:25px; }
.ds-async-state__content h4,.ds-async-state__content p { margin:0; }
.ds-async-state__content h4 { font-size:15px; }
.ds-async-state__content p { margin-top:7px; color:var(--text-muted); font-size:10px; line-height:1.8; }
.ds-async-state__actions { display:flex; flex-wrap:wrap; justify-content:center; gap:8px; margin-top:14px; }
.ds-async-state__actions button { min-height:38px; padding:8px 15px; border:1px solid color-mix(in srgb,var(--brand-500) 35%,var(--border)); border-radius:10px; color:var(--brand-700); background:color-mix(in srgb,var(--async-tone,var(--pastel-mint)) 72%,var(--surface)); cursor:pointer; font:inherit; font-size:9px; font-weight:800; }
.ds-async-state__skeleton { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.ds-async-state__skeleton article { min-height:170px; padding:15px; border:1px solid var(--border); border-radius:14px; background:var(--surface); }
.ds-async-state__shimmer { position:relative; overflow:hidden; border-radius:7px; background:var(--surface-2); }
.ds-async-state__shimmer::after { position:absolute; inset:0; content:""; background:linear-gradient(100deg,transparent 25%,rgba(255,255,255,.85) 50%,transparent 75%); transform:translateX(-100%); animation:dsAsyncShimmer 1.25s infinite; }
.ds-async-state__shimmer.is-title { width:56%; height:14px; }
.ds-async-state__shimmer.is-line { height:9px; margin-top:12px; }
.ds-async-state__shimmer.is-line:last-child { width:72%; }
.ds-loading-skeleton { display:grid; gap:18px; min-height:460px; }
.ds-loading-skeleton--report { align-content:start; padding-block:8px; }
.ds-loading-skeleton__hero { display:grid; align-content:center; gap:13px; min-height:165px; padding:28px 32px; border:1px solid var(--border); border-radius:24px; background:linear-gradient(135deg,color-mix(in srgb,var(--pastel-mint) 26%,var(--surface)),color-mix(in srgb,var(--pastel-sky) 25%,var(--surface))); }
.ds-loading-skeleton__hero .is-kicker { width:18%; min-width:92px; height:11px; }
.ds-loading-skeleton__hero .is-heading { width:min(430px,72%); height:28px; }
.ds-loading-skeleton__hero .is-copy { width:min(650px,88%); height:12px; }
.ds-loading-skeleton__kpis { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.ds-loading-skeleton__kpis article { min-height:132px; }
.ds-loading-skeleton__panels { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.ds-loading-skeleton__panels article { min-height:220px; }
.ds-loading-skeleton__kpis article,.ds-loading-skeleton__panels article { padding:18px; border:1px solid var(--border); border-radius:18px; background:var(--surface); }
.ds-loading-skeleton--kanban { align-content:start; min-width:0; }
.ds-loading-skeleton__kanban { display:grid; grid-template-columns:repeat(4,minmax(230px,1fr)); gap:14px; overflow:hidden; }
.ds-loading-skeleton__kanban-column { display:grid; align-content:start; gap:12px; min-height:390px; padding:16px; border:1px solid var(--border); border-radius:18px; background:var(--surface-2); }
.ds-loading-skeleton__kanban-column > .is-title { width:48%; margin-block:4px 6px; }
.ds-loading-skeleton__kanban-column > article { min-height:92px; padding:14px; border:1px solid var(--border); border-radius:14px; background:var(--surface); }
.ds-loading-skeleton--table { align-content:start; }
.ds-loading-skeleton__toolbar { display:grid; grid-template-columns:minmax(220px,1fr) repeat(3,minmax(86px,130px)); gap:10px; align-items:center; padding:14px 16px; border:1px solid var(--border); border-radius:16px 16px 0 0; background:var(--surface); }
.ds-loading-skeleton__toolbar>.is-line { width:100%; height:38px; border-radius:10px; }
.ds-loading-skeleton__table { display:grid; overflow:hidden; border:1px solid var(--border); border-top:0; border-radius:0 0 16px 16px; background:var(--surface); }
.ds-loading-skeleton__table-row { display:grid; grid-template-columns:70px 1.35fr 1fr 1fr .9fr 110px; gap:16px; align-items:center; min-height:58px; padding:10px 16px; border-top:1px solid var(--border-soft,var(--border)); }
.ds-loading-skeleton__table-row>.is-line { width:100%; height:11px; margin:0; }
@media (max-width:960px) { .ds-loading-skeleton__kpis { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:960px) { .ds-loading-skeleton__kanban { grid-template-columns:repeat(2,minmax(230px,1fr)); } }
@media (max-width:640px) { .ds-loading-skeleton__hero { min-height:140px; padding:22px; } .ds-loading-skeleton__kpis,.ds-loading-skeleton__panels,.ds-loading-skeleton__kanban { grid-template-columns:1fr; } }
@media (max-width:760px) { .ds-loading-skeleton__toolbar { grid-template-columns:1fr 90px; } .ds-loading-skeleton__toolbar>:nth-child(n+3) { display:none; } .ds-loading-skeleton__table-row { grid-template-columns:52px 1.4fr 1fr; } .ds-loading-skeleton__table-row>:nth-child(n+4) { display:none; } }
@media (prefers-reduced-motion:reduce) { .ds-async-state__shimmer::after { animation:none; } }
.ds-async-state__partial { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.ds-async-state__partial article { padding:15px; border:1px solid var(--border); border-radius:14px; background:var(--surface); box-shadow:0 8px 20px color-mix(in srgb,var(--pastel-sky) 18%,transparent); }
.ds-async-state__partial strong,.ds-async-state__partial small { display:block; }
.ds-async-state__partial strong { margin-top:8px; font-size:18px; }
.ds-async-state__partial small { color:var(--text-muted); font-size:9px; }
.ds-async-state__notice { grid-column:1/-1; padding:10px 12px; border:1px solid color-mix(in srgb,#d8a33a 35%,var(--border)); border-radius:10px; color:#7b5b18; background:var(--pastel-lemon); font-size:9px; }
.ds-async-state__notice button { margin-inline-start:8px; border:0; color:inherit; background:transparent; cursor:pointer; font:inherit; font-weight:900; text-decoration:underline; }
@keyframes dsAsyncShimmer { to { transform:translateX(100%); } }

.ds-smart-form { position:relative; padding:18px; border:1px solid var(--border); border-radius:15px; background:linear-gradient(145deg,var(--surface),color-mix(in srgb,var(--pastel-mint) 12%,var(--surface))); }
.ds-smart-form__notice { display:flex; align-items:center; gap:9px; margin:15px 0 0; padding:11px 13px; border:1px solid color-mix(in srgb,var(--brand-500) 22%,var(--border)); border-radius:11px; color:var(--brand-700); background:var(--pastel-mint); box-shadow:0 8px 24px color-mix(in srgb,var(--brand-500) 10%,transparent); font-size:13px; line-height:1.7; font-weight:800; animation:dsFormNoticeIn .2s ease-out; }
.ds-smart-form__notice[hidden] { display:none; }
.ds-smart-form__notice::before { display:grid; flex:0 0 24px; width:24px; height:24px; place-items:center; border-radius:50%; color:#fff; background:var(--brand-500); content:"✓"; font-size:13px; line-height:1; }
.ds-smart-form__notice.is-error { color:#96384b; background:var(--pastel-rose); }
.ds-smart-form__notice.is-error::before { background:#c64d65; content:"!"; }
.ds-smart-form__notice.is-warning { color:#745412; background:var(--pastel-lemon); }
.ds-smart-form__notice.is-warning::before { color:#694c0e; background:#f0c35d; content:"!"; }
.ds-smart-form__grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:13px 16px; }
.ds-smart-field { display:grid; align-content:start; gap:7px; color:var(--text-muted); font-size:13px; line-height:1.6; font-weight:700; }
.ds-smart-field--wide { grid-column:1/-1; }
.ds-smart-field > span { display:flex; align-items:center; gap:7px; }
.ds-smart-field b,.ds-smart-field i { padding:3px 7px; border-radius:999px; font-size:11px; line-height:1.4; font-style:normal; }
.ds-smart-field b { color:#96384b; background:var(--pastel-rose); }
.ds-smart-field i { color:var(--text-muted); background:var(--surface-2); }
.ds-smart-field input,.ds-smart-field textarea { width:100%; min-height:48px; box-sizing:border-box; padding:10px 12px; border:1px solid var(--border); border-radius:11px; color:var(--text); background:var(--surface); outline:0; resize:vertical; font-family:inherit; font-size:14px; font-weight:500; line-height:1.7; transition:border-color .18s ease,box-shadow .18s ease,background .18s ease; }
.ds-smart-field textarea { min-height:76px; line-height:1.8; }
.ds-smart-field input:focus,.ds-smart-field textarea:focus { border-color:var(--brand-500); box-shadow:0 0 0 3px color-mix(in srgb,var(--pastel-mint) 62%,transparent); }
.ds-smart-field input[readonly] { color:var(--text-muted); background:color-mix(in srgb,var(--pastel-sky) 18%,var(--surface-2)); cursor:default; }
.ds-smart-field input:disabled { color:var(--text-muted); background:var(--surface-2); cursor:not-allowed; opacity:.65; }
.ds-smart-field.is-invalid input,.ds-smart-field.is-invalid textarea { border-color:#df7585; background:color-mix(in srgb,var(--pastel-rose) 24%,var(--surface)); box-shadow:0 0 0 3px color-mix(in srgb,var(--pastel-rose) 42%,transparent); }
.ds-smart-field [data-ds-field-error] { min-height:18px; color:#a33c50; font-size:12px; line-height:1.6; }
.ds-smart-field > small:not([data-ds-field-error]) { color:var(--text-muted); font-size:12px; line-height:1.6; font-weight:500; }
.ds-smart-form__footer { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:16px; padding-top:13px; border-top:1px solid var(--border); }
.ds-smart-form__footer > div { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:7px; }
.ds-smart-form__footer .btn { min-height:42px; font-size:13px; }
.ds-smart-form__dirty { color:#8a6318; font-size:12px; font-weight:900; white-space:nowrap; }
.ds-smart-form.is-submitting { pointer-events:none; opacity:.78; }
.ds-smart-form.is-submitting [data-ds-form-submit="success"]::before { display:inline-block; width:11px; height:11px; margin-inline-end:6px; border:2px solid currentColor; border-top-color:transparent; border-radius:50%; content:""; vertical-align:-2px; animation:dsFormSpin .7s linear infinite; }
.ds-smart-form__confirm { width:min(440px,calc(100vw - 32px)); padding:20px; border:1px solid var(--border); border-radius:16px; color:var(--text); background:var(--surface); box-shadow:0 24px 70px color-mix(in srgb,var(--text) 25%,transparent); text-align:start; }
.ds-smart-form__confirm::backdrop { background:rgba(24,31,43,.32); backdrop-filter:blur(3px); }
.ds-smart-form__confirm strong { font-size:14px; }
.ds-smart-form__confirm p { margin:8px 0 16px; color:var(--text-muted); font-size:13px; line-height:1.8; }
.ds-smart-form__confirm div { display:flex; justify-content:flex-end; gap:8px; }
.ds-sensitive-action { display:grid; gap:14px; padding:18px; border:1px solid var(--border); border-radius:15px; background:color-mix(in srgb,var(--pastel-rose) 8%,var(--surface)); }
.ds-sensitive-action__record { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:11px; padding:13px; border:1px solid var(--border); border-radius:12px; background:var(--surface); }
.ds-sensitive-action__record span:nth-child(2) { display:grid; gap:3px; }
.ds-sensitive-action__record strong { color:var(--text); font-size:14px; }
.ds-sensitive-action__record small { color:var(--text-muted); font-size:12px; }
.ds-sensitive-action__guidance { display:flex; align-items:center; gap:9px; padding:10px 12px; border-radius:10px; color:#705416; background:var(--pastel-lemon); font-size:12px; line-height:1.7; }
.ds-sensitive-action__guidance strong { white-space:nowrap; }
.ds-sensitive-action__buttons { display:flex; flex-wrap:wrap; gap:8px; }
.ds-sensitive-action__buttons [hidden] { display:none; }
.ds-sensitive-action__api-error { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:12px; padding:12px 14px; border:1px solid #f3b7bd; border-radius:16px; color:#8f3340; background:#fff1f2; }
.ds-sensitive-action__api-error[hidden] { display:none; }
.ds-sensitive-action__api-error > span { display:grid; width:32px; height:32px; place-items:center; border-radius:50%; color:#fff; background:#d85f70; font-weight:800; }
.ds-sensitive-action__api-error div { display:grid; gap:3px; }
.ds-sensitive-action__api-error small { color:#8c5d64; }
.ds-sensitive-action__audit { overflow:hidden; border:1px solid var(--border); border-radius:14px; background:var(--surface); }
.ds-sensitive-action__audit > header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 14px; border-bottom:1px solid var(--border); }
.ds-sensitive-action__audit > header small { color:var(--text-muted); }
.ds-sensitive-action__audit ol { display:grid; gap:0; margin:0; padding:0; list-style:none; }
.ds-sensitive-action__audit li { display:flex; align-items:center; gap:10px; padding:11px 14px; border-bottom:1px solid var(--border); }
.ds-sensitive-action__audit li:last-child { border-bottom:0; }
.ds-sensitive-action__audit li div { display:grid; gap:2px; }
.ds-sensitive-action__audit li small { color:var(--text-muted); }
.ds-sensitive-action__audit-icon { display:grid; width:28px; height:28px; place-items:center; flex:0 0 auto; border-radius:50%; color:#176b62; background:var(--pastel-mint); font-weight:800; }
.ds-page-header { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:24px; align-items:end; padding:20px; border:1px solid var(--border); border-radius:18px; background:linear-gradient(135deg,color-mix(in srgb,var(--pastel-sky) 22%,var(--surface)),color-mix(in srgb,var(--pastel-mint) 16%,var(--surface))); box-shadow:0 16px 38px -30px rgba(15,23,42,.35); }
.ds-page-header__main { display:grid; gap:14px; min-width:0; }
.ds-page-header__breadcrumb { display:flex; flex-wrap:wrap; gap:7px; align-items:center; color:var(--text-muted); font-size:12px; }
.ds-page-header__breadcrumb a { color:var(--brand-600); text-decoration:none; }
.ds-page-header__title { display:flex; align-items:center; gap:12px; min-width:0; }
.ds-page-header__title > div { display:grid; gap:4px; min-width:0; }
.ds-page-header__title > div > div { display:flex; flex-wrap:wrap; align-items:center; gap:9px; }
.ds-page-header__title h4 { margin:0; color:var(--text); font-size:21px; line-height:1.4; }
.ds-page-header__title p { margin:0; color:var(--text-muted); font-size:12px; }
.ds-page-header__meta { display:flex; flex-wrap:wrap; gap:8px 24px; margin:0; }
.ds-page-header__meta div { display:grid; gap:2px; }
.ds-page-header__meta dt { color:var(--text-muted); font-size:11px; }
.ds-page-header__meta dd { margin:0; color:var(--text); font-size:12px; font-weight:700; }
.ds-page-header__actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; }
.ds-page-header__actions .ds-dropdown { min-width:150px; }
.ds-sensitive-action.is-removed .ds-sensitive-action__record { opacity:.55; filter:grayscale(.25); }
.ds-sensitive-modal { display:grid; gap:14px; }
.ds-sensitive-modal__warning { display:flex; gap:10px; padding:12px; border:1px solid color-mix(in srgb,#d4576d 28%,var(--border)); border-radius:11px; color:#873548; background:color-mix(in srgb,var(--pastel-rose) 45%,var(--surface)); font-size:12px; line-height:1.8; }
.ds-sensitive-modal__warning b { font-size:18px; }
.ds-sensitive-modal label { display:grid; gap:7px; color:var(--text-muted); font-size:12px; font-weight:800; }
.ds-sensitive-modal textarea { min-height:86px; padding:11px 12px; border:1px solid var(--border); border-radius:11px; color:var(--text); background:var(--surface); font:inherit; font-size:13px; resize:vertical; outline:0; }
.ds-sensitive-modal textarea:focus { border-color:var(--brand-500); box-shadow:0 0 0 3px color-mix(in srgb,var(--pastel-mint) 55%,transparent); }
.ds-sensitive-modal__check { display:flex !important; grid-template-columns:none; align-items:center; gap:8px !important; color:var(--text) !important; cursor:pointer; }
.ds-sensitive-modal__check input { width:18px; height:18px; cursor:pointer; accent-color:var(--brand-500); }
.ds-sensitive-modal__error { color:#a33c50; font-size:12px; font-weight:800; }
.ds-sensitive-modal__error[hidden] { display:none; }

@media (max-width:620px) {
  .ds-smart-form__grid { grid-template-columns:1fr; }
  .ds-smart-field--wide { grid-column:auto; }
  .ds-smart-form__footer { align-items:stretch; flex-direction:column; }
  .ds-smart-form__footer > div { justify-content:stretch; }
  .ds-smart-form__footer .btn { flex:1; }
  .ds-sensitive-action__record { grid-template-columns:auto minmax(0,1fr); }
  .ds-sensitive-action__record > :last-child { grid-column:2; justify-self:start; }
  .ds-sensitive-action__guidance { align-items:flex-start; flex-direction:column; }
  .ds-sensitive-action__api-error { grid-template-columns:auto minmax(0,1fr); }
  .ds-sensitive-action__api-error .btn { grid-column:1 / -1; }
  .ds-page-header { grid-template-columns:1fr; align-items:stretch; }
  .ds-page-header__actions { justify-content:stretch; }
  .ds-page-header__actions > * { flex:1 1 150px; }
}

@media (prefers-reduced-motion:reduce) {
  .ds-smart-form__notice { animation:none; }
  .ds-smart-form.is-submitting [data-ds-form-submit="success"]::before { animation:none; }
}
@keyframes dsFormSpin { to { transform:rotate(360deg); } }
@keyframes dsFormNoticeIn { from { opacity:0; transform:translateY(5px); } }

.ds-pattern-schedule { overflow:hidden; border:1px solid var(--border); border-radius:17px; background:var(--surface); box-shadow:0 14px 35px color-mix(in srgb,var(--pastel-sky) 20%,transparent); }
.ds-pattern-schedule > header { display:flex; align-items:center; justify-content:center; gap:16px; padding:11px; border-bottom:1px solid var(--border); background:var(--surface-2); text-align:center; }
.ds-pattern-schedule > header button { display:grid; width:30px; height:30px; place-items:center; border:1px solid var(--border); border-radius:9px; color:var(--text); background:var(--surface); cursor:pointer; font-size:18px; }
.ds-pattern-schedule > header strong,.ds-pattern-schedule > header small { display:block; }
.ds-pattern-schedule > header strong { font-size:11px; }
.ds-pattern-schedule > header small { margin-top:3px; color:var(--text-muted); font-size:8px; }
.ds-pattern-schedule__grid { display:grid; grid-template-columns:64px repeat(7,minmax(120px,1fr)); min-width:960px; height:620px; overflow:auto; scrollbar-gutter:stable; }
.ds-pattern-schedule__time { position:sticky; inset-inline-start:0; z-index:4; display:grid; grid-template-rows:44px repeat(19,46px); min-height:918px; color:var(--text-muted); background:color-mix(in srgb,var(--pastel-sky) 18%,var(--surface-2)); font-size:9px; text-align:center; box-shadow:-5px 0 12px color-mix(in srgb,var(--text) 5%,transparent); }
.ds-pattern-schedule__time strong,.ds-pattern-schedule__time span { display:flex; align-items:flex-start; justify-content:center; padding-top:6px; border-bottom:1px solid color-mix(in srgb,var(--border) 72%,transparent); }
.ds-pattern-schedule__time strong { align-items:center; padding-top:0; color:var(--text); font-size:8px; }
.ds-pattern-schedule__day { position:relative; min-height:918px; border-inline-start:1px solid var(--border); background:repeating-linear-gradient(to bottom,var(--surface) 0,var(--surface) 45px,color-mix(in srgb,var(--border) 82%,transparent) 46px); background-position:0 44px; }
.ds-pattern-schedule__day > strong { position:sticky; inset-block-start:0; z-index:3; display:flex; height:44px; align-items:center; justify-content:center; gap:5px; border-bottom:1px solid var(--border); background:color-mix(in srgb,var(--pastel-lilac) 14%,var(--surface-2)); font-size:10px; box-shadow:0 5px 12px color-mix(in srgb,var(--text) 4%,transparent); }
.ds-pattern-schedule__day > strong i { color:var(--text-muted); font-style:normal; }
.ds-pattern-schedule__day > button { position:absolute; z-index:1; inset-inline:7px; top:calc(44px + var(--event-top,0px)); min-height:34px; height:var(--event-height,46px); overflow:hidden; padding:8px 9px; border:1px solid transparent; border-inline-start-width:4px; border-radius:10px; color:var(--text); cursor:pointer; font:inherit; font-size:9px; font-weight:900; line-height:1.45; text-align:start; box-shadow:0 7px 16px color-mix(in srgb,var(--text) 7%,transparent); transition:transform .18s ease,box-shadow .18s ease; }
.ds-pattern-schedule__day > button:hover { z-index:5; overflow:visible; transform:translateY(-2px); box-shadow:0 12px 24px color-mix(in srgb,var(--text) 12%,transparent); }
.ds-pattern-schedule__day > button small,.ds-pattern-schedule__day > button em { display:block; margin-top:2px; font-size:7px; font-style:normal; font-weight:600; }
.ds-pattern-schedule__day > button em { opacity:.72; }
/* Day variant (approved 1405/07/10): the same grid with one day column, for a single-day view. */
.ds-pattern-schedule--day .ds-pattern-schedule__grid { grid-template-columns:64px minmax(0,1fr); min-width:0; }
/* Drag to move and resize (approved 1405/07/10, DsScheduleDrag). Only blocks marked
   data-ds-schedule-drag are movable; the bottom handle changes the duration. */
.ds-pattern-schedule__day > button[data-ds-schedule-drag] { cursor:grab; touch-action:none; }
.ds-pattern-schedule__day > button[data-ds-schedule-drag]:focus-visible { outline:2px solid var(--brand-500); outline-offset:2px; }
.ds-pattern-schedule__day > button.is-dragging { z-index:6; cursor:grabbing; opacity:.92; transform:none; box-shadow:0 14px 28px color-mix(in srgb,var(--text) 18%,transparent); }
.ds-pattern-schedule__day > button.is-saving { opacity:.6; pointer-events:none; }
.ds-pattern-schedule__resize { position:absolute; inset-inline:8px; inset-block-end:0; height:8px; border-radius:0 0 8px 8px; cursor:ns-resize; touch-action:none; }
.ds-pattern-schedule__resize::after { content:''; position:absolute; inset-inline:35%; inset-block-end:2px; height:3px; border-radius:999px; background:color-mix(in srgb,var(--text) 28%,transparent); }
.ds-pattern-schedule__day.is-drop-target { background-color:color-mix(in srgb,var(--pastel-mint) 22%,var(--surface)); }
.ds-pattern-schedule__drag-label { position:absolute; inset-inline-end:6px; inset-block-start:-22px; padding:2px 7px; border-radius:7px; color:var(--surface); background:var(--text); font-size:9px; font-weight:800; white-space:nowrap; pointer-events:none; }
.ds-pattern-schedule__day > button.is-mint { background:var(--pastel-mint); }
.ds-pattern-schedule__day > button.is-sky { background:var(--pastel-sky); }
.ds-pattern-schedule__day > button.is-rose { background:var(--pastel-rose); }
.ds-pattern-schedule__day > button.is-lilac { background:var(--pastel-lilac); }
.ds-pattern-schedule__day > button.is-conflict { z-index:2; inset-inline-start:34%; border-color:#e87888; color:#96384b; background:color-mix(in srgb,var(--pastel-rose) 88%,var(--surface)); box-shadow:0 7px 15px -10px #a64052; }
.ds-pattern-schedule__empty { position:absolute; inset-block-start:62px; inset-inline:10px; padding:14px 8px; border:1px dashed var(--border); border-radius:10px; color:var(--text-muted); background:color-mix(in srgb,var(--surface-2) 70%,transparent); font-size:8px; text-align:center; }
.ds-pattern-schedule > footer { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 12px; border-top:1px solid var(--border); color:var(--text-muted); background:var(--surface-2); font-size:9px; }
.ds-pattern-schedule__legend { display:flex; flex-wrap:wrap; align-items:center; gap:7px 13px; }
.ds-pattern-schedule__legend span { display:inline-flex; align-items:center; gap:5px; white-space:nowrap; }
.ds-pattern-schedule__legend i { width:9px; height:9px; border-radius:3px; }
.ds-pattern-schedule__legend i.is-mint { background:var(--pastel-mint); }
.ds-pattern-schedule__legend i.is-sky { background:var(--pastel-sky); }
.ds-pattern-schedule__legend i.is-lilac { background:var(--pastel-lilac); }
.ds-pattern-schedule__legend i.is-rose { background:var(--pastel-rose); }
.is-conflict-dot { display:inline-block; width:7px; height:7px; margin-inline-end:4px; border-radius:50%; background:#e87888; }
.ds-pattern-schedule__dialog { width:min(920px,calc(100vw - 40px)); max-width:none; padding:0; overflow:visible; border:1px solid var(--border); border-radius:20px; color:var(--text); background:var(--surface); box-shadow:0 28px 75px color-mix(in srgb,var(--text) 22%,transparent); }
.ds-pattern-schedule__dialog::backdrop { background:color-mix(in srgb,#172033 38%,transparent); backdrop-filter:blur(3px); }
.ds-pattern-schedule__dialog form { padding:20px 22px; overflow:visible; border-radius:inherit; }
.ds-pattern-schedule__dialog header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:16px; }
.ds-pattern-schedule__dialog header strong,.ds-pattern-schedule__dialog header small { display:block; }
.ds-pattern-schedule__dialog header strong { font-size:15px; }
.ds-pattern-schedule__dialog header small { margin-top:4px; color:var(--text-muted); font-size:9px; }
.ds-pattern-schedule__dialog header button { display:grid; width:34px; height:34px; padding:0; place-items:center; border:1px solid var(--border); border-radius:10px; background:var(--surface-2); cursor:pointer; font-size:20px; }
.ds-pattern-schedule__dialog label { display:grid; gap:6px; color:var(--text-muted); font-size:9px; font-weight:700; }
.ds-pattern-schedule__dialog [hidden] { display:none !important; }
.ds-pattern-schedule__fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 16px; }
.ds-pattern-schedule__dialog input,.ds-pattern-schedule__dialog textarea { width:100%; min-height:44px; box-sizing:border-box; padding:9px 11px; border:1px solid var(--border); border-radius:11px; color:var(--text); background:var(--surface-2); outline:0; resize:vertical; font:inherit; }
.ds-pattern-schedule__dialog input[name="date"] { padding-left:42px; font-variant-numeric:tabular-nums; }
.ds-pattern-schedule__dialog textarea { min-height:76px; line-height:1.8; }
.ds-pattern-schedule__dialog input:focus,.ds-pattern-schedule__dialog textarea:focus { border-color:var(--brand-500); box-shadow:0 0 0 3px color-mix(in srgb,var(--pastel-mint) 65%,transparent); }
.ds-pattern-schedule__time-select .ds-dropdown__trigger { min-height:44px; padding:9px 11px; border-radius:11px; background:var(--surface-2); font-size:11px; font-variant-numeric:tabular-nums; }
.ds-pattern-schedule__time-select .ds-dropdown__value { display:flex; align-items:center; gap:7px; direction:ltr; font-weight:800; }
.ds-pattern-schedule__time-select .ds-dropdown__value::before { content:"◷"; color:var(--brand-500); font-size:17px; font-weight:400; }
.ds-pattern-schedule__time-select .ds-dropdown__option { justify-content:center; direction:ltr; font-variant-numeric:tabular-nums; }
.ds-pattern-schedule__form-row { display:grid; grid-column:1/-1; grid-template-columns:1.5fr 1fr 1fr; gap:10px; }
.ds-pattern-schedule__form-row--meta { grid-template-columns:1fr 1.5fr; }
.ds-pattern-schedule__form-row--meta .ds-dropdown__trigger { min-height:44px; border-radius:11px; background:var(--surface-2); }
.ds-pattern-schedule__attendees .ds-dropdown__value { max-width:230px; }
.ds-pattern-people { position:relative; }
.ds-pattern-people__control { display:flex; min-height:44px; align-items:center; gap:6px; padding:5px 8px; border:1px solid var(--border); border-radius:11px; background:var(--surface-2); transition:border-color .18s ease,box-shadow .18s ease; }
.ds-pattern-people__control:focus-within { border-color:var(--brand-500); box-shadow:0 0 0 3px color-mix(in srgb,var(--pastel-mint) 65%,transparent); }
.ds-pattern-people__chips { display:flex; flex-wrap:wrap; gap:4px; }
.ds-pattern-people__chip { display:inline-flex; align-items:center; gap:5px; padding:4px 7px; border:0; border-radius:999px; color:var(--brand-700); background:var(--pastel-mint); cursor:pointer; font:inherit; font-size:8px; font-weight:800; }
.ds-pattern-people__chip::after { content:"×"; color:var(--text-muted); font-size:11px; }
.ds-pattern-schedule__dialog .ds-pattern-people__search { flex:1; min-width:100px; min-height:30px; padding:2px 4px; border:0; border-radius:0; background:transparent; box-shadow:none; }
.ds-pattern-people__menu { position:absolute; z-index:10070; inset:calc(100% + 6px) 0 auto; display:grid; gap:4px; padding:7px; border:1px solid color-mix(in srgb,var(--brand-500) 45%,var(--border)); border-radius:12px; background:var(--surface); box-shadow:0 18px 42px color-mix(in srgb,var(--text) 18%,transparent); }
.ds-pattern-people__option { display:flex; min-height:38px; align-items:center; justify-content:space-between; gap:8px; padding:7px 9px; border:0; border-radius:9px; color:var(--text); background:transparent; cursor:pointer; font:inherit; font-size:9px; font-weight:700; text-align:start; }
.ds-pattern-people__option:hover,.ds-pattern-people__option.is-selected { color:var(--brand-700); background:var(--pastel-mint); }
.ds-pattern-people__option i { display:grid; width:20px; height:20px; place-items:center; border-radius:6px; color:var(--surface); background:var(--brand-500); font-style:normal; font-size:8px; }
.ds-pattern-people__empty { padding:12px; color:var(--text-muted); font-size:8px; text-align:center; }
.ds-pattern-schedule__mode { display:flex; align-items:center; gap:7px; margin:0; padding:0; border:0; }
.ds-pattern-schedule__mode legend { margin-inline-end:5px; color:var(--text-muted); font-size:9px; font-weight:800; }
.ds-pattern-schedule__mode label { position:relative; display:block; cursor:pointer; }
.ds-pattern-schedule__mode input { position:absolute; width:1px; min-height:1px; opacity:0; }
.ds-pattern-schedule__mode span { display:block; min-width:78px; padding:9px 14px; border:1px solid var(--border); border-radius:999px; color:var(--text-muted); background:var(--surface-2); text-align:center; transition:border-color .18s ease,background .18s ease,color .18s ease,transform .18s ease; }
.ds-pattern-schedule__mode input:checked + span { border-color:color-mix(in srgb,var(--brand-500) 55%,var(--border)); color:var(--brand-700); background:color-mix(in srgb,var(--pastel-mint) 72%,var(--surface)); transform:translateY(-1px); }
.ds-pattern-schedule__mode input:focus-visible + span { box-shadow:0 0 0 3px color-mix(in srgb,var(--pastel-mint) 65%,transparent); }
.ds-pattern-schedule__error { margin:10px 0 0; padding:8px 10px; border-radius:9px; color:#96384b; background:var(--pastel-rose); font-size:9px; }
.ds-pattern-schedule__dialog form > footer { display:flex; justify-content:flex-end; gap:8px; margin-top:18px; }

@media (max-height:680px) and (min-width:721px) {
  .ds-pattern-schedule__dialog form { max-height:calc(100vh - 36px); overflow:auto; }
}

@media (max-width:900px) {
  /* minmax(0,…) like the desktop columns: a wide child (a settings strip, a
     long line) must not stretch the column past the screen. */
  .ds-pattern-grid { grid-template-columns:minmax(0,1fr); }
  .ds-pattern--wide { grid-column:auto; }
  .ds-pattern-access { grid-template-columns:1fr; }
  .ds-pattern-master-detail { grid-template-columns:1fr; }
  .ds-pattern-master-detail__list { border-inline-end:0; border-bottom:1px solid var(--border); }
  .ds-pattern-approval__body { grid-template-columns:1fr; }
  .ds-pattern-approval__actions { justify-content:flex-end; }
  .ds-pattern-job { grid-template-columns:auto 1fr; }
  .ds-pattern-job > .btn { grid-column:1/-1; }
  .ds-pattern-report { grid-template-columns:145px minmax(300px,1fr); overflow:auto; }
  .ds-pattern-report__config { grid-column:1/-1; flex-direction:row; border-top:1px solid var(--border); border-inline-start:0; }
  .ds-pattern-report__config > strong { display:none; }
  .ds-pattern-report__config label { flex:1; }
  .ds-pattern-inbox { grid-template-columns:210px minmax(320px,1fr); overflow:auto; }
}
@media (max-width:620px) {
  .ds-async-demo__head { display:block; }
  .ds-async-demo__head code { display:block; margin-top:8px; }
  .ds-async-state__skeleton,.ds-async-state__partial { grid-template-columns:1fr; }
  .ds-pattern-master-detail__detail { padding:15px; }
  .ds-pattern-detail-facts { grid-template-columns:1fr; }
  .ds-pattern-approval__track { grid-template-columns:1fr; gap:7px; }
  .ds-pattern-approval__line { width:3px; height:16px; margin:auto; }
  .ds-pattern-import { overflow:auto; }
  .ds-pattern-import__steps,.ds-pattern-import__mapping,.ds-pattern-import__foot { min-width:560px; }
  .ds-pattern-job { grid-template-columns:1fr; justify-items:center; text-align:center; }
  .ds-pattern-job__content > div:first-child { justify-content:center; }
  .ds-pattern-lines { overflow:auto; }
  .ds-pattern-lines__meta { grid-template-columns:1fr; min-width:560px; }
  .ds-pattern-lines__foot { min-width:700px; }
  .ds-pattern-report,.ds-pattern-inbox { min-width:680px; }
  .ds-pattern-schedule__dialog { width:min(560px,calc(100vw - 18px)); }
  .ds-pattern-schedule__dialog form { max-height:calc(100vh - 24px); padding:15px; overflow:auto; }
  .ds-pattern-schedule__fields { grid-template-columns:1fr; }
  .ds-pattern-schedule__form-row,.ds-pattern-schedule__form-row--meta { grid-column:auto; grid-template-columns:1fr; }
}
@media (prefers-reduced-motion:reduce) {
  .ds-async-state__shimmer::after { animation:none; }
  .ds-clamp__text,.ds-clamp__toggle [data-ds-icon],.ds-pattern-master-detail__item,.ds-pattern-expandable__chevron,.ds-pattern-expandable__panel,.ds-pattern-upload__drop,.ds-pattern-job__visual .ds-pattern-job__meter,.ds-pattern-job__bar span { transition:none; }
  .ds-pattern-job__bar span::after { animation:none; }
  .ds-pattern-report__preview span { animation:none; }
  .ds-pattern-master-detail__detail.is-changing,.ds-pattern-upload__file,.ds-pattern-approval__audit.is-updated { animation:none; }
}
.rich-page > [hidden],
.crp-page > [hidden],
.crm-report-page > [hidden],
.crm-data-quality-page > [hidden],
[data-behavior-report] > [hidden],
[data-section][hidden] {
  display: none !important;
}
.ds-pattern-inbox{grid-template-columns:minmax(280px,330px) minmax(420px,1fr);min-height:520px}
.ds-pattern-inbox__search input{height:46px;font-size:15px}
.ds-pattern-inbox__empty{padding:18px 10px;font-size:14px;line-height:1.7}
.ds-pattern-inbox__list strong{font-size:15px;line-height:1.55}
.ds-pattern-inbox__list small,.ds-pattern-inbox__list time{font-size:13px;line-height:1.55}
.ds-pattern-inbox__thread-meta time{font-size:11px;line-height:1.35}
.ds-pattern-inbox__conversation>header strong{font-size:16px;line-height:1.5}
.ds-pattern-inbox__conversation>header small{padding:4px 8px;font-size:12px;line-height:1.2}
.ds-pattern-inbox__messages{gap:14px;padding:22px}
.ds-pattern-inbox__messages p{box-sizing:border-box;width:fit-content;min-width:min(320px,calc(100% - 16px));max-width:min(76%,760px);padding:34px 20px 15px;font-size:var(--ds-inbox-message-size,16px);line-height:1.9}
.ds-pattern-inbox__messages p::before{inset-block-start:10px;inset-inline-start:18px;font-size:12px}
.ds-pattern-inbox__messages time{margin-top:7px;font-size:11px}
.ds-pattern-inbox__composer input{font-size:16px}
.ds-pattern-inbox__composer>button{padding:9px 16px;font-size:15px}
.ds-pattern-inbox__text-size output{min-width:44px;font-size:11px}
@media(max-width:800px){.ds-pattern-inbox{grid-template-columns:1fr;min-height:0}.ds-pattern-inbox__messages p{max-width:88%}}
@media(max-width:520px){.ds-pattern-inbox__messages{padding:14px}.ds-pattern-inbox__messages p{min-width:min(240px,calc(100% - 8px));max-width:94%;padding:32px 16px 13px}}
.ds-pattern-inbox__send-feedback{position:relative;display:inline-grid!important;grid-template-areas:"state";min-width:72px;width:72px;height:52px;padding:0!important;place-items:center;overflow:hidden;border-radius:12px!important;transition:width .28s ease,min-width .28s ease,border-radius .28s ease,background-color .28s ease,color .28s ease,transform .2s ease,box-shadow .28s ease!important}
.ds-pattern-inbox__send-feedback>[data-send-label],.ds-pattern-inbox__send-feedback>[data-send-spinner],.ds-pattern-inbox__send-feedback>[data-send-success],.ds-pattern-inbox__send-feedback>[data-send-error]{grid-area:state;transition:opacity .18s ease,transform .24s ease}
.ds-pattern-inbox__send-feedback>[data-send-spinner],.ds-pattern-inbox__send-feedback>[data-send-success],.ds-pattern-inbox__send-feedback>[data-send-error]{opacity:0;transform:scale(.55);pointer-events:none}
.ds-pattern-inbox__send-feedback>[data-send-success],.ds-pattern-inbox__send-feedback>[data-send-error]{display:grid;place-items:center}
.ds-pattern-inbox__send-feedback>[data-send-success] [data-ds-icon],.ds-pattern-inbox__send-feedback>[data-send-error] [data-ds-icon]{width:24px;height:24px;color:#fff;stroke:#fff}
.ds-pattern-inbox__send-feedback.is-sending,.ds-pattern-inbox__send-feedback.is-success,.ds-pattern-inbox__send-feedback.is-error{width:52px;min-width:52px;color:#fff!important;opacity:1!important}
.ds-pattern-inbox__send-feedback.is-sending{border-radius:50%!important;cursor:wait!important}
.ds-pattern-inbox__send-feedback:is(.is-success,.is-error){border-radius:12px!important}
.ds-pattern-inbox__send-feedback.is-sending{background:var(--stage-solid-blue,#3b82f6)!important;box-shadow:0 8px 20px color-mix(in srgb,var(--stage-solid-blue,#3b82f6) 38%,transparent)!important}
.ds-pattern-inbox__send-feedback.is-success{background:var(--stage-solid-green,#22c55e)!important;box-shadow:0 8px 20px color-mix(in srgb,var(--stage-solid-green,#22c55e) 38%,transparent)!important}
.ds-pattern-inbox__send-feedback.is-error{background:var(--stage-solid-red,#ef4444)!important;box-shadow:0 8px 20px color-mix(in srgb,var(--stage-solid-red,#ef4444) 34%,transparent)!important}
.ds-pattern-inbox__send-feedback.is-sending>[data-send-label],.ds-pattern-inbox__send-feedback.is-success>[data-send-label],.ds-pattern-inbox__send-feedback.is-error>[data-send-label]{opacity:0;transform:scale(.55)}
.ds-pattern-inbox__send-feedback.is-sending>[data-send-spinner],.ds-pattern-inbox__send-feedback.is-success>[data-send-success],.ds-pattern-inbox__send-feedback.is-error>[data-send-error]{opacity:1;transform:scale(1)}
.ds-pattern-inbox__send-feedback.is-sending>[data-send-spinner]{width:22px;height:22px;border:3px solid rgba(255,255,255,.4);border-top-color:#fff;border-radius:50%;animation:dsInboxSendSpin .75s linear infinite;will-change:transform}
.ds-pattern-inbox__send-feedback>[data-send-success] svg,.ds-pattern-inbox__send-feedback>[data-send-error] svg{width:24px;height:24px;color:#fff!important;stroke:#fff!important}
@keyframes dsInboxSendSpin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.ds-pattern-inbox__send-feedback,.ds-pattern-inbox__send-feedback>*{transition:none!important}.ds-pattern-inbox__send-feedback.is-sending>[data-send-spinner]{animation-duration:1.5s}}
.ds-pattern-inbox__media{display:block;width:min(260px,100%);margin:0 0 10px;padding:0;overflow:hidden;border:1px solid color-mix(in srgb,var(--brand-500) 18%,var(--border));border-radius:14px;background:var(--surface-2);cursor:pointer}.ds-pattern-inbox__media img{display:block;width:100%;height:150px;object-fit:cover}.ds-pattern-inbox__media-fallback{display:none;min-height:110px;place-items:center;gap:8px;color:var(--text-muted)}.ds-pattern-inbox__media.is-missing img{display:none}.ds-pattern-inbox__media.is-missing .ds-pattern-inbox__media-fallback{display:grid}.ds-pattern-inbox__media-fallback [data-ds-icon]{width:30px;height:30px}.ds-pattern-inbox__media-modal{display:grid;min-height:240px;place-items:center}.ds-pattern-inbox__media-modal img{display:block;max-width:100%;max-height:var(--ds-media-max-h,min(70vh,calc(100dvh - 220px)));object-fit:contain}.ds-pattern-inbox__media-modal.is-missing img{display:none}.ds-pattern-inbox__media-modal.is-missing .ds-pattern-inbox__media-fallback{display:grid;min-height:240px}
/* Shared attachment preview: zoomed image scrolls inside the modal; PDF and plain text fill the same frame. */
.ds-pattern-inbox__media-modal.is-zoomed{place-items:start;max-height:var(--ds-media-max-h,min(70vh,calc(100dvh - 220px)));overflow:auto}.ds-pattern-inbox__media-modal.is-zoomed img{max-width:none;max-height:none}.ds-pattern-inbox__media-doc{display:block;width:100%;height:var(--ds-media-max-h,min(70vh,calc(100dvh - 220px)));border:0;border-radius:12px;background:var(--surface-2)}.ds-pattern-inbox__media-text{width:100%;max-height:var(--ds-media-max-h,min(70vh,calc(100dvh - 220px)));margin:0;padding:14px;overflow:auto;box-sizing:border-box;border-radius:12px;background:var(--surface-2);color:var(--text);font:13px/1.8 Consolas,ui-monospace,monospace;white-space:pre-wrap;overflow-wrap:anywhere;text-align:start}.ds-pattern-inbox__media-modal.is-missing :is(.ds-pattern-inbox__media-doc,.ds-pattern-inbox__media-text){display:none}.ds-pattern-inbox__media-zoom{display:inline-flex;align-items:center;gap:6px;margin-inline-end:auto}.ds-pattern-inbox__media-zoom [data-ds-inbox-media-zoom-value]{min-width:44px;text-align:center;font-weight:700}
.ds-pattern-inbox__media-modal--pdf{place-items:start center;max-height:var(--ds-media-max-h,min(70vh,calc(100dvh - 220px)));overflow:auto}.ds-pattern-inbox__media-pages{display:grid;gap:12px;width:100%;justify-items:center;min-height:200px;align-content:start}.ds-pattern-inbox__media-pages>.ds-spinner{margin-block:80px}.ds-pattern-inbox__media-page{display:block;width:100%;height:auto;border-radius:8px;background:var(--surface);box-shadow:var(--shadow-xs)}

/* Inbox / Conversation v2 — compact Persian messenger experience. */
.ds-pattern-inbox{grid-template-columns:minmax(292px,340px) minmax(0,1fr);min-height:560px;border-radius:22px;box-shadow:0 22px 54px color-mix(in srgb,var(--text) 9%,transparent)}
.ds-pattern-inbox__list{min-width:0;padding:12px;border-inline-end:1px solid var(--border);background:var(--surface)}
.ds-pattern-inbox__search{margin-bottom:10px;border-color:transparent;border-radius:15px;background:var(--surface-2);box-shadow:none}
.ds-pattern-inbox__search input{height:44px;font-size:14px}
.ds-pattern-inbox__thread{position:relative;grid-template-columns:50px minmax(0,1fr) auto!important;min-height:72px;padding:10px!important;border:0!important;border-radius:14px!important}
.ds-pattern-inbox__thread:hover{background:color-mix(in srgb,var(--pastel-sky) 32%,var(--surface-2))!important;box-shadow:none!important;transform:none!important}
.ds-pattern-inbox__thread.is-active{color:var(--text);background:color-mix(in srgb,var(--inbox-channel-pastel,var(--pastel-mint)) 72%,var(--surface))!important;box-shadow:none!important;transform:none!important}
.ds-pattern-inbox__thread .ds-pattern-avatar{width:50px;height:50px;border-radius:50%;font-size:16px;box-shadow:none}
.ds-pattern-inbox__thread-copy{min-width:0}.ds-pattern-inbox__thread-copy strong{font-size:14px;line-height:1.55}.ds-pattern-inbox__thread-copy small{font-size:12px;line-height:1.55}
.ds-pattern-inbox__thread-meta{align-self:center;gap:6px;padding:0;border:0}.ds-pattern-inbox__thread-meta time{font-size:10px}
.ds-pattern-inbox__conversation{background:var(--surface-2)}
.ds-pattern-inbox__conversation>header{min-height:64px;padding:8px 14px;border-bottom:1px solid var(--border);background:color-mix(in srgb,var(--surface) 94%,var(--inbox-channel-pastel,var(--pastel-mint)));box-shadow:0 4px 16px color-mix(in srgb,var(--text) 5%,transparent)}
.ds-pattern-inbox__conversation>header strong{font-size:15px}.ds-pattern-inbox__conversation>header small{margin-top:2px;padding:0;border:0;background:transparent;font-size:11px}
.ds-pattern-inbox__messages{gap:5px;padding:22px 7%;overflow:auto;background:radial-gradient(circle at 18px 18px,color-mix(in srgb,var(--brand-500) 7%,transparent) 1.5px,transparent 1.6px) 0 0/36px 36px,color-mix(in srgb,var(--pastel-sky) 20%,var(--surface-2))}
.ds-pattern-inbox__messages p{min-width:min(180px,calc(100% - 24px));max-width:min(72%,640px);padding:9px 12px 7px;border:0;border-radius:16px;color:var(--text);font-size:var(--ds-inbox-message-size,15px);line-height:1.75;box-shadow:0 1px 2px color-mix(in srgb,var(--text) 12%,transparent);animation:dsUploadIn .18s ease both}
.ds-pattern-inbox__messages p[data-author]{padding-block-start:25px}.ds-pattern-inbox__messages p::before{inset-block-start:7px;inset-inline-start:12px;color:var(--brand-700);font-size:11px}
.ds-pattern-inbox__messages .is-incoming{align-self:flex-end;border-end-start-radius:5px;background:var(--surface)}
.ds-pattern-inbox__messages .is-outgoing{align-self:flex-start;border-end-end-radius:5px;background:color-mix(in srgb,var(--pastel-mint) 82%,var(--surface))}
.ds-pattern-inbox__messages time{display:flex;align-items:center;justify-content:flex-end;gap:3px;margin-top:2px;color:var(--text-muted);font-size:10px;line-height:1.3}
.ds-pattern-inbox__receipt{display:inline-grid;flex:0 0 16px;width:16px;height:16px;place-items:center;color:currentColor;line-height:0}.ds-pattern-inbox__receipt [data-ds-icon],.ds-pattern-inbox__receipt svg{display:block;width:16px;height:16px}
.ds-pattern-inbox__day{position:sticky;z-index:3;inset-block-start:8px;align-self:center!important;margin:10px 0!important;padding:5px 12px!important;border:1px solid color-mix(in srgb,var(--border) 70%,transparent)!important;border-radius:999px!important;color:var(--text-muted)!important;background:color-mix(in srgb,var(--surface) 92%,transparent)!important;box-shadow:0 2px 8px color-mix(in srgb,var(--text) 8%,transparent)!important;backdrop-filter:blur(8px);font-size:11px!important;font-weight:800!important}
.ds-pattern-inbox__history-hint{align-self:center;margin:2px 0 6px;color:var(--text-muted);font-size:11px}
.ds-pattern-inbox__file{display:grid;grid-template-columns:44px minmax(0,1fr) auto;align-items:center;gap:10px;min-width:min(300px,100%);margin-bottom:6px;padding:8px;border-radius:13px;color:inherit;background:color-mix(in srgb,var(--surface) 54%,transparent);text-decoration:none}
.ds-pattern-inbox__file-icon{display:grid;width:44px;height:44px;place-items:center;border-radius:50%;color:var(--brand-700);background:var(--surface)}.ds-pattern-inbox__file-icon [data-ds-icon]{width:22px;height:22px}
.ds-pattern-inbox__file-copy{display:grid;min-width:0}.ds-pattern-inbox__file-copy strong,.ds-pattern-inbox__file-copy small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ds-pattern-inbox__file-copy strong{font-size:12px}.ds-pattern-inbox__file-copy small{color:var(--text-muted);font-size:10px}
.ds-pattern-inbox__file>[data-ds-icon]{width:18px;height:18px;color:var(--text-muted)}
.ds-pattern-inbox__media{width:min(320px,100%);margin:-3px -6px 6px;border:0;border-radius:13px}.ds-pattern-inbox__media img{height:auto;max-height:280px;aspect-ratio:4/3}
.ds-pattern-inbox__composer{position:relative;grid-template-columns:auto minmax(0,1fr) auto;align-items:end;gap:8px;padding:9px 12px;border-top:1px solid var(--border);background:var(--surface);box-shadow:0 -4px 16px color-mix(in srgb,var(--text) 5%,transparent)}
.ds-pattern-inbox__composer textarea{box-sizing:border-box;width:100%;min-height:44px;max-height:92px;padding:10px 12px;resize:none;overflow-y:hidden;border:0!important;border-radius:12px!important;outline:0;color:var(--text);background:var(--surface)!important;box-shadow:none!important;font:inherit;font-size:16px;line-height:1.5}
.ds-pattern-inbox__composer>button[type="submit"]{width:48px;min-width:48px;height:48px;padding:0;border-radius:12px;color:var(--surface);background:var(--brand-500);box-shadow:0 8px 20px color-mix(in srgb,var(--brand-500) 30%,transparent)}
.ds-pattern-inbox__composer .ds-pattern-inbox__attach{width:48px!important;min-width:48px!important;max-width:48px!important}.ds-pattern-inbox__composer .ds-pattern-inbox__attach .ds-dropdown__trigger{width:48px;min-width:48px;height:48px;border:0;border-radius:12px;background:transparent;box-shadow:none}
.ds-pattern-inbox__composer>.ds-pattern-inbox__send-feedback.is-sending{border-radius:50%!important}
.ds-pattern-inbox__composer>.ds-pattern-inbox__send-feedback:is(.is-success,.is-error){border-radius:12px!important}
.ds-pattern-inbox__mobile-back{display:none;width:38px;height:38px;padding:0;place-items:center;border:0;border-radius:50%;color:var(--brand-700);background:transparent}.ds-pattern-inbox__mobile-back [data-ds-icon]{width:22px;height:22px}
@media(max-width:800px){.ds-pattern-inbox{display:block;min-height:520px}.ds-pattern-inbox__list{border:0}.ds-pattern-inbox__conversation{display:none;min-height:520px}.ds-pattern-inbox.is-chat-open>.ds-pattern-inbox__list{display:none}.ds-pattern-inbox.is-chat-open>.ds-pattern-inbox__conversation{display:grid}.ds-pattern-inbox__mobile-back{display:grid}.ds-pattern-inbox__messages{padding-inline:14px}.ds-pattern-inbox__messages p{max-width:86%}}
@media(max-width:520px){.ds-pattern-inbox{border:0;border-radius:0;box-shadow:none}.ds-pattern-inbox__conversation>header{padding-inline:8px}.ds-pattern-inbox__text-size{display:none!important}.ds-pattern-inbox__messages p{max-width:92%;font-size:var(--ds-inbox-message-size,14px)}.ds-pattern-inbox__file{min-width:min(240px,100%)}}

/* ds-workload-row — person capacity row (avatar | name + state | pressure meter | stats).
   Tones: --high (over capacity) · --medium (near capacity) · --low (free capacity).
   Catalog: design-system/index.html «ds-workload-row — ردیف ظرفیت کاری افراد». */
.ds-workload-row { display:grid; grid-template-columns:36px minmax(110px,.9fr) minmax(90px,1fr) auto; align-items:center; gap:12px; min-width:0; padding:10px 12px; border:1px solid var(--border); border-inline-start:3px solid var(--green-500); border-radius:12px; background:var(--surface); color:var(--text); }
.ds-workload-row--low { border-inline-start-color:var(--green-500); }
.ds-workload-row--medium { border-inline-start-color:var(--amber-500); }
.ds-workload-row--high { border-inline-start-color:var(--red-500); }
.ds-workload-row__avatar { display:inline-grid; place-items:center; inline-size:34px; block-size:34px; border-radius:11px; background:var(--pastel-mint); color:var(--brand-600); font-size:12px; font-weight:800; }
.ds-workload-row--medium .ds-workload-row__avatar { background:var(--pastel-peach); }
.ds-workload-row--high .ds-workload-row__avatar { background:var(--pastel-rose); }
.ds-workload-row__person { display:flex; flex-direction:column; gap:2px; min-width:0; }
.ds-workload-row__person strong { font-size:13px; line-height:1.6; overflow-wrap:anywhere; }
.ds-workload-row__person small { color:var(--text-muted); font-size:12px; line-height:1.6; }
.ds-workload-row__meter { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:8px; min-width:0; }
.ds-workload-row__meter > span { block-size:8px; overflow:hidden; border-radius:999px; background:color-mix(in srgb,var(--border) 72%,transparent); }
.ds-workload-row__meter i { display:block; block-size:100%; max-inline-size:100%; border-radius:inherit; background:var(--green-500); }
.ds-workload-row--medium .ds-workload-row__meter i { background:var(--amber-500); }
.ds-workload-row--high .ds-workload-row__meter i { background:var(--red-500); }
.ds-workload-row__meter b { font-size:12px; font-variant-numeric:tabular-nums; text-align:end; }
.ds-workload-row__stats { display:flex; flex-wrap:wrap; gap:4px; min-width:0; }
.ds-workload-row__stats em { display:flex; flex:1 1 auto; align-items:baseline; justify-content:center; gap:3px; padding:4px 8px; border-radius:8px; background:var(--surface-2); color:var(--text-muted); font-size:12px; font-style:normal; white-space:nowrap; }
.ds-workload-row__stats em b { color:var(--text); font-size:12px; }
@media (max-width:760px) {
  .ds-workload-row { grid-template-columns:36px minmax(0,1fr) minmax(100px,.9fr); }
  .ds-workload-row__stats { grid-column:2 / -1; }
}

/* ds-form-page — multi-section page form (catalog #form-page). Each
   ds-form-section is a card with a tinted head; the footer stays in view.
   `section`/`div` in the selectors outrank design-system.css's
   `.ds-form-section:first-of-type`, which is loaded after this file. */
.ds-form-page { display:grid; gap:16px; min-width:0; }
.ds-form-page > section.ds-form-section,
.ds-form-page > div.ds-form-section { min-width:0; padding:0; border:1px solid var(--border); border-radius:15px; background:var(--surface); box-shadow:0 8px 20px color-mix(in srgb,var(--pastel-sky) 18%,transparent); }
.ds-form-page .ds-form-section__head { display:flex; align-items:center; gap:10px; min-width:0; padding:12px 18px; border-bottom:1px solid var(--border); border-radius:15px 15px 0 0; background:linear-gradient(135deg,color-mix(in srgb,var(--pastel-sky) 22%,var(--surface)),color-mix(in srgb,var(--pastel-mint) 16%,var(--surface))); }
.ds-form-page .ds-form-section__icon { display:grid; flex:0 0 auto; width:32px; height:32px; place-items:center; border-radius:10px; color:var(--brand-700); background:var(--pastel-mint); }
.ds-form-page .ds-form-section__title { min-width:0; padding:0; color:var(--text); font-size:14px; line-height:1.6; font-weight:800; letter-spacing:0; text-transform:none; }
.ds-form-page .ds-form-section__body { min-width:0; padding:16px 18px; }
.ds-form-page-footer { position:sticky; bottom:12px; z-index:2; display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px; padding:12px 18px; border:1px solid var(--border); border-radius:15px; background:color-mix(in srgb,var(--surface) 94%,transparent); box-shadow:0 8px 20px color-mix(in srgb,var(--pastel-sky) 18%,transparent); backdrop-filter:blur(8px); }
.ds-form-page-footer__right { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:8px; }
.ds-group-hint { display:flex; align-items:center; gap:9px; margin-top:13px; padding:10px 12px; border:1px solid color-mix(in srgb,var(--brand-500) 22%,var(--border)); border-radius:11px; color:var(--brand-700); background:var(--pastel-mint); font-size:12px; line-height:1.7; font-weight:700; animation:dsGroupHintIn .2s ease-out; }
.ds-group-hint__icon { display:grid; flex:0 0 auto; place-items:center; }
@keyframes dsGroupHintIn { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:none; } }
@media (prefers-reduced-motion:reduce) { .ds-group-hint { animation:none; } }
@media (max-width:620px) {
  .ds-form-page { gap:12px; }
  .ds-form-page .ds-form-section__head { padding:11px 14px; }
  .ds-form-page .ds-form-section__body { padding:14px; }
  .ds-form-page-footer { padding:11px 14px; }
  .ds-form-page-footer__right { justify-content:stretch; }
}
/* Group editor («ساخت گروه کاربری»): one list of people. The tick makes a
   person a member, the star makes them the leader. One scroll area only. */
.att-team-form{display:grid;gap:18px}
.att-team-form__basics{grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}
.att-people{display:grid;gap:12px;min-width:0;padding:14px;border:1px solid var(--border,#e2e8f0);border-radius:var(--radius-lg,16px);background:var(--surface,#fff)}
.att-people--invalid{border-color:var(--danger-500,#e5484d)}
.att-people__head{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:4px 16px}
.att-people__head b{font-size:13.5px;font-weight:800;color:var(--text,#0f172a)}
.att-people__head>span{font-size:12px;color:var(--text-muted,#64748b)}
.att-people__selected{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:8px 12px;min-block-size:44px;padding:8px 12px;border-radius:var(--radius-md,12px);background:var(--surface-2,#f8fafc)}
.att-people__leader{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;white-space:nowrap}
.att-people__leader b{font-weight:800}
.att-people__leader.is-empty{color:var(--text-muted,#64748b)}
.att-people__members{display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-width:0}
.att-people__hint{font-size:12px;color:var(--text-muted,#64748b)}
.att-people__count{font-size:12px;font-weight:800;color:var(--text-muted,#64748b);white-space:nowrap}
.att-people__tools{display:grid;grid-template-columns:minmax(0,1fr) minmax(170px,220px) auto;align-items:center;gap:10px}
.att-people__tools .ds-field{margin:0}
.att-people__only{white-space:nowrap}
.att-people__list{display:grid;gap:4px;max-block-size:min(34vh,330px);overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:6px;border:1px solid var(--border,#e2e8f0);border-radius:var(--radius-md,12px)}
.att-people__group{position:sticky;top:-6px;z-index:1;padding:6px 8px 4px;font-size:11.5px;font-weight:800;color:var(--text-muted,#64748b);background:var(--surface,#fff)}
.att-person{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:8px;padding-inline-end:4px;border-radius:var(--radius-md,12px)}
.att-person[hidden],.att-people__group[hidden],.att-people__list[hidden]{display:none}
.att-people[data-rlx-multi] .att-people__tools{grid-template-columns:minmax(0,1fr) auto}
.att-people[data-rlx-multi] .att-person{grid-template-columns:minmax(0,1fr)}
.att-people[data-rlx-multi] .att-people__selected{display:block;overflow-wrap:anywhere}
@media(max-width:760px){.att-people[data-rlx-multi] .att-people__tools{grid-template-columns:1fr}}
.att-person:hover{background:var(--surface-2,#f8fafc)}
.att-person--leader{background:color-mix(in srgb,var(--pastel-lemon,#fef3c7) 55%,transparent)}
.att-person--leader .att-person__pick{opacity:1}
.att-people .att-person__pick{width:100%;box-sizing:border-box;min-block-size:0;padding:5px 10px}
.att-choice__text{display:grid;gap:1px;min-width:0}
.att-choice__text b{font-weight:700}
.att-choice__text small{color:var(--text-muted,#64748b);font-size:11.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.att-choice__tag{padding:1px 8px;border-radius:999px;font-size:11px;font-weight:800;color:#9a5a10;background:var(--pastel-peach,#ffedd5);white-space:nowrap}
.att-people__empty{display:grid;justify-items:center;gap:8px;padding:28px 12px;border:1px dashed var(--border,#e2e8f0);border-radius:var(--radius-md,12px);color:var(--text-muted,#64748b);font-size:12.5px;text-align:center}
.att-people__empty[hidden]{display:none}
.att-people__foot{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;font-size:12px;color:var(--text-muted,#64748b)}
.att-people__bulk{display:inline-flex;flex-wrap:wrap;gap:6px}
.att-chip{display:inline-flex;align-items:center;gap:4px}
.att-chip__remove{border:0;background:transparent;color:inherit;font-size:15px;line-height:1;cursor:pointer;padding:0 2px}
@media(max-width:760px){.att-team-form__basics{grid-template-columns:1fr}.att-people{padding:10px}.att-people__selected{grid-template-columns:1fr}.att-people__tools{grid-template-columns:1fr}.att-people__only{justify-self:start}.att-people__list{max-block-size:300px}}

/* Sortable List — «فهرست قابل مرتب‌سازی» (ds-sortable.js, DsSortable.bind/cell).
   Owner approval 1405/07/28: rows reorder by a drag handle, the up/down row buttons or Alt+↑/↓. */
.ds-sort{display:inline-flex;align-items:center;gap:4px}
.ds-sort__rank{min-width:22px;color:var(--text);font-size:13px;font-weight:700;text-align:center;font-variant-numeric:tabular-nums}
.ds-sort .ds-sort__handle{cursor:grab;touch-action:none}
.ds-sort.is-locked .ds-sort__handle{display:inline-block;width:28px}
.ds-sort .ds-sort__move:disabled{opacity:.35;cursor:default}
.ds-sortable.is-sorting,.ds-sortable.is-sorting .ds-sort__handle{cursor:grabbing;user-select:none}
.ds-sortable [data-ds-sort-item].is-sorting{position:relative;z-index:1;background:var(--surface);box-shadow:var(--shadow-sm,0 6px 16px rgba(15,23,42,.12));outline:2px dashed var(--brand-300);outline-offset:-3px}
.ds-sort-list{display:grid;border:1px solid var(--border);border-radius:12px;background:var(--surface);overflow:hidden}
.ds-sort-list__row{display:flex;align-items:center;gap:12px;padding:8px 12px;border-bottom:1px solid var(--border-soft,var(--border))}
.ds-sort-list__row:last-of-type{border-bottom:0}
.ds-sort-list__row b{color:var(--text);font-size:13px}
.ds-sort-list__row small{margin-inline-start:auto;color:var(--text-muted);font-size:12px}
.ds-sort__sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* «تقویم ماهانه» PL-14 (owner approval 1405/08/17): a Jalali month grid, Saturday first, with the
   events of each day; on a phone only the days that have events, one per row. Runtime:
   DsPatterns.mountMonthCalendar (ds-patterns.js). Catalog: design-system #month-calendar. */
.ds-pattern-calendar { display:grid; gap:12px; }
.ds-pattern-calendar__head { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.ds-pattern-calendar__title { flex:1 1 auto; margin:0; color:var(--text); font-size:16px; font-weight:800; }
.ds-pattern-calendar__grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:6px; }
.ds-pattern-calendar__weekday { padding:4px 0; color:var(--text-muted); font-size:11px; font-weight:700; text-align:center; }
.ds-pattern-calendar__day { display:flex; min-width:0; min-height:96px; flex-direction:column; gap:4px; padding:6px; border:1px solid var(--border); border-radius:12px; background:var(--surface); }
.ds-pattern-calendar__day.is-outside { background:transparent; opacity:.45; }
.ds-pattern-calendar__day.is-today { border-color:var(--brand-500); box-shadow:inset 0 0 0 1px var(--brand-500); }
.ds-pattern-calendar__num { color:var(--text-muted); font-size:12px; font-weight:800; }
.ds-pattern-calendar__day.is-today .ds-pattern-calendar__num { color:var(--brand-500); }
.ds-pattern-calendar__wd { display:none; font-weight:700; }
.ds-pattern-calendar__event { display:block; overflow:hidden; padding:3px 6px; border-radius:8px; color:#296484; background:var(--pastel-sky); font-size:11px; font-weight:700; line-height:1.5; text-decoration:none; text-overflow:ellipsis; white-space:nowrap; }
.ds-pattern-calendar__event:focus-visible { outline:2px solid var(--brand-500); outline-offset:1px; }
.ds-pattern-calendar__event--mint { color:#187457; background:var(--pastel-mint); }
.ds-pattern-calendar__event--amber { color:#9a5a10; background:var(--pastel-peach); }
.ds-pattern-calendar__event--rose { color:#a64052; background:var(--pastel-rose); text-decoration:line-through; }
/* An event with its own colour (a content platform): tinted chip, darker text, a side bar in the colour. */
.ds-pattern-calendar__event--accent { color:color-mix(in srgb, var(--ds-cal-accent) 62%, #10202b); background:color-mix(in srgb, var(--ds-cal-accent) 13%, var(--surface)); box-shadow:inset -3px 0 0 var(--ds-cal-accent); }
[dir="ltr"] .ds-pattern-calendar__event--accent { box-shadow:inset 3px 0 0 var(--ds-cal-accent); }
.ds-pattern-calendar__event--wide { flex:1 1 auto; min-width:0; padding:6px 10px; font-size:12px; }
.ds-pattern-calendar__more { align-self:stretch; display:flex; align-items:center; justify-content:center; gap:4px; min-height:24px; padding:2px 6px; border:1px dashed var(--border); border-radius:8px; color:var(--brand-500); background:transparent; font:inherit; font-size:11px; font-weight:800; cursor:pointer; }
.ds-pattern-calendar__more:is(:hover, :focus-visible) { border-color:var(--brand-500); background:color-mix(in srgb, var(--brand-500) 8%, transparent); }
.ds-pattern-calendar__more:focus-visible { outline:2px solid var(--brand-500); outline-offset:1px; }
.ds-pattern-calendar__more-count { color:var(--text-muted); font-weight:700; }
/* Head like the work calendar (owner request 1405/08/23): «امروز» at the start, month and year between
   round arrows in the middle, the neighbouring month names faded beside them. */
.ds-pattern-calendar .ds-pattern-calendar__head { display:grid; grid-template-columns:1fr auto 1fr; align-items:center; gap:8px; }
.ds-pattern-calendar__today { justify-self:start; min-height:38px; padding:0 16px; border:1px solid color-mix(in srgb,var(--brand-500) 32%,#fff); border-radius:12px; background:color-mix(in srgb,var(--brand-500) 10%,#fff); color:var(--brand-500); font:inherit; font-size:13px; font-weight:800; cursor:pointer; }
.ds-pattern-calendar__today:is(:hover, :focus-visible) { background:var(--brand-500); color:#fff; }
.ds-pattern-calendar__nav { grid-column:2; display:flex; align-items:center; gap:10px; }
.ds-pattern-calendar__step { display:inline-grid; place-items:center; width:40px; height:40px; padding:0; border:1px solid var(--border); border-radius:12px; background:var(--surface); color:var(--text); cursor:pointer; }
.ds-pattern-calendar__step:is(:hover, :focus-visible) { border-color:color-mix(in srgb,var(--brand-500) 32%,#fff); background:color-mix(in srgb,var(--brand-500) 10%,#fff); color:var(--brand-500); }
/* The arrow keeps its size on pages without ds-grid.css (the customer portal showed empty buttons). */
.ds-pattern-calendar__step [data-ds-icon] { display:inline-flex; line-height:0; }
.ds-pattern-calendar__step .ds-ico { width:20px; height:20px; }
.ds-pattern-calendar__step:focus-visible, .ds-pattern-calendar__today:focus-visible { outline:2px solid var(--brand-500); outline-offset:2px; }
.ds-pattern-calendar .ds-pattern-calendar__title { flex:none; min-width:150px; text-align:center; font-size:20px; white-space:nowrap; }
.ds-pattern-calendar__title-year { color:var(--text-muted); font-weight:700; }
.ds-pattern-calendar__adjacent { min-width:56px; color:#B6C2CE; font-size:13px; font-weight:700; text-align:center; }
/* Holidays like the work calendar: Friday red, an official holiday tinted with its badge, occasions as a quiet line. */
.ds-pattern-calendar__weekday:nth-child(7) { color:#C0463E; }
.ds-pattern-calendar__day.is-friday { background:#FFFCFB; }
.ds-pattern-calendar__day.is-friday .ds-pattern-calendar__num, .ds-pattern-calendar__day.is-holiday .ds-pattern-calendar__num { color:#C0463E; }
.ds-pattern-calendar__day.is-holiday { border-color:#F3D3CF; background:#FFF7F6; box-shadow:inset 0 3px 0 #E7A9A4; }
.ds-pattern-calendar__day.is-today { border-color:var(--brand-500); box-shadow:inset 0 0 0 1px var(--brand-500); }
.ds-pattern-calendar__num { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.ds-pattern-calendar__badge { padding:1px 7px; border-radius:999px; font-size:10px; font-weight:800; line-height:1.6; }
.ds-pattern-calendar__badge.is-today { color:#fff; background:var(--brand-500); }
.ds-pattern-calendar__badge.is-holiday { color:#C0463E; background:#FDEEEC; }
.ds-pattern-calendar .ds-pattern-calendar__day > .ds-pattern-calendar__occasion { margin-top:auto; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; color:#7D8B9A; font-size:10.5px; font-weight:600; line-height:1.6; }
.ds-pattern-calendar__occasion::before { content:""; display:inline-block; width:5px; height:5px; margin-inline-end:5px; border-radius:50%; background:#C3CFDB; vertical-align:middle; }
.ds-pattern-calendar .ds-pattern-calendar__day > .ds-pattern-calendar__occasion.is-official { color:#C0463E; }
.ds-pattern-calendar__occasion.is-official::before { background:#E7A9A4; }
@media (max-width:640px) {
  .ds-pattern-calendar .ds-pattern-calendar__head { grid-template-columns:1fr; justify-items:center; }
  .ds-pattern-calendar__today { justify-self:center; }
  .ds-pattern-calendar__nav { grid-column:auto; }
  .ds-pattern-calendar__adjacent { display:none; }
}
/* Compact month (options.compact): shorter days for a calendar beside lists, e.g. the portal's meetings.
   A day that options.onDayOpen accepts shows it can be opened (double click). */
.ds-pattern-calendar--compact .ds-pattern-calendar__day { min-height:64px; padding:5px; border-radius:10px; }
.ds-pattern-calendar--compact .ds-pattern-calendar__grid { gap:5px; }
.ds-pattern-calendar--compact .ds-pattern-calendar__event { padding:2px 5px; font-size:10.5px; }
.ds-pattern-calendar.is-day-openable .ds-pattern-calendar__day:not(.is-outside) { cursor:pointer; transition:border-color .15s ease, background-color .15s ease; }
.ds-pattern-calendar.is-day-openable .ds-pattern-calendar__day:not(.is-outside):hover { border-color:color-mix(in srgb,var(--brand-500) 45%,var(--border)); background:color-mix(in srgb,var(--brand-500) 5%,var(--surface)); }
.ds-pattern-calendar__legend-row { display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; }
.ds-pattern-calendar__legend-toggle { min-height:30px; padding:4px 10px; border:1px solid var(--border); border-radius:999px; background:var(--surface); font:inherit; font-size:11.5px; font-weight:700; color:var(--text); cursor:pointer; transition:opacity .15s, background .15s, border-color .15s; }
.ds-pattern-calendar__legend-toggle:is(:hover, :focus-visible) { border-color:var(--ds-cal-accent, var(--brand-500)); }
.ds-pattern-calendar__legend-toggle:focus-visible { outline:2px solid var(--brand-500); outline-offset:1px; }
.ds-pattern-calendar__legend-toggle.is-off { color:var(--text-muted); background:transparent; border-style:dashed; opacity:.6; text-decoration:line-through; }
.ds-pattern-calendar__legend-toggle.is-off::before { background:transparent; box-shadow:inset 0 0 0 2px var(--ds-cal-accent, var(--text-muted)); }
.ds-pattern-calendar__legend { display:flex; flex-wrap:wrap; gap:6px 14px; margin:0; padding:0; list-style:none; }
.ds-pattern-calendar__legend-item { display:inline-flex; align-items:center; gap:6px; color:var(--text-muted); font-size:11.5px; font-weight:700; }
.ds-pattern-calendar__legend-item::before { content:""; width:10px; height:10px; border-radius:3px; background:var(--ds-cal-accent, var(--text-muted)); }
.ds-pattern-calendar__day-sub { margin:0 0 10px; color:var(--text-muted); font-size:12px; }
.ds-pattern-calendar__day-list { display:grid; gap:8px; margin:0; padding:0; list-style:none; }
.ds-pattern-calendar__day-item { display:flex; align-items:center; gap:8px; min-width:0; }
.ds-pattern-calendar__day-group { flex:0 0 104px; overflow:hidden; color:var(--text-muted); font-size:11px; font-weight:800; text-overflow:ellipsis; white-space:nowrap; }
.ds-pattern-calendar__day-group::before { content:""; display:inline-block; width:8px; height:8px; margin-inline-end:6px; border-radius:50%; background:var(--ds-cal-accent, var(--text-muted)); vertical-align:middle; }
.ds-pattern-calendar__empty { grid-column:1/-1; display:none; padding:16px; color:var(--text-muted); font-size:12px; text-align:center; }
@media (max-width:640px) {
  .ds-pattern-calendar__grid { grid-template-columns:1fr; }
  .ds-pattern-calendar__weekday, .ds-pattern-calendar__day:not(.has-events), .ds-pattern-calendar__day.is-outside { display:none; }
  .ds-pattern-calendar__day { min-height:0; }
  .ds-pattern-calendar__wd { display:inline; }
  .ds-pattern-calendar__grid:not(:has(.ds-pattern-calendar__day.has-events:not(.is-outside))) .ds-pattern-calendar__empty { display:block; }
}


/* /portal/ds/css/ds-inbox-messenger.css */
/* Inbox «messenger» variant (owner-approved additive extension, 1405/07/17).
 * A Telegram-like organizational chat on top of the canonical
 * «Inbox و Conversation» pattern (ds-patterns.css). Every rule here is scoped
 * to .ds-pattern-inbox--messenger or uses a class that exists only in this
 * file, so pages using the plain pattern (for example «گفت‌وگوهای بله») never
 * change. Colours, radii and shadows come from the existing tokens only.
 * Catalog example: design-system/index.html#inbox-messenger. */

/* ── Layout: list | conversation | (info aside), full height ─────────── */
.ds-pattern-inbox--messenger { position:relative; grid-template-columns:minmax(290px,350px) minmax(0,1fr); height:var(--ds-inbox-height,calc(100vh - 150px)); min-height:480px; }
.ds-pattern-inbox--messenger.is-aside-open { grid-template-columns:minmax(290px,350px) minmax(0,1fr) minmax(280px,330px); }
.ds-pattern-inbox--messenger > .ds-pattern-inbox__list { display:flex; flex-direction:column; min-height:0; overflow:hidden; padding:10px 10px 0; }
.ds-pattern-inbox--messenger > .ds-pattern-inbox__conversation { position:relative; grid-template-columns:minmax(0,1fr); grid-template-rows:auto auto auto minmax(0,1fr) auto; min-height:0; overflow:hidden; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__conversation > header { grid-row:1; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__conversation > .ds-pattern-inbox__security { grid-row:2; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__pinned { grid-row:3; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages { grid-row:4; min-height:0; overscroll-behavior:contain; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer { grid-row:5; }

/* ── Security strip (owner request 1405/07/24) ─────────────────────────
 * One fixed line under the header (and under the list head) saying what
 * protects the conversation. DsInboxMessenger.renderSecurity writes the
 * state and its fixed text; colours are the existing tokens. */
.ds-pattern-inbox__security { display:flex; align-items:flex-start; gap:8px; padding:7px 14px; border-bottom:1px solid var(--border); color:var(--text); background:var(--surface); font-size:12px; line-height:1.75; }
.ds-pattern-inbox__security[hidden] { display:none; }
.ds-pattern-inbox__security > [data-ds-icon] { display:inline-grid; flex:0 0 18px; width:18px; height:18px; margin-top:2px; place-items:center; }
.ds-pattern-inbox__security > [data-ds-icon] svg { width:18px; height:18px; }
.ds-pattern-inbox__security-text { flex:1; min-width:0; overflow-wrap:anywhere; }
.ds-pattern-inbox__security-action { flex:0 0 auto; align-self:center; min-height:30px; padding:0 12px; border:1px solid color-mix(in srgb,var(--brand-500) 35%,var(--border)); border-radius:999px; color:var(--brand-700); background:var(--surface); cursor:pointer; font:inherit; font-size:12px; font-weight:700; white-space:nowrap; transition:background-color .16s ease,border-color .16s ease; }
.ds-pattern-inbox__security-action:hover { border-color:var(--brand-500); background:color-mix(in srgb,var(--pastel-mint) 45%,var(--surface)); }
.ds-pattern-inbox__security-action:focus-visible { outline:2px solid var(--brand-500); outline-offset:2px; }
.ds-pattern-inbox__security.is-secure { background:color-mix(in srgb,var(--green-50) 70%,var(--surface)); }
.ds-pattern-inbox__security.is-secure .ds-pattern-inbox__security-text { color:color-mix(in srgb,var(--green-500) 55%,var(--text)); }
.ds-pattern-inbox__security.is-insecure,.ds-pattern-inbox__security.is-warning { background:color-mix(in srgb,var(--pastel-lemon) 60%,var(--surface)); }
.ds-pattern-inbox__security.is-business { background:color-mix(in srgb,var(--pastel-sky) 45%,var(--surface)); }
.ds-pattern-inbox__security.is-pending { color:var(--text-muted); background:var(--surface-2); }
.ds-pattern-inbox__list > .ds-pattern-inbox__security.is-list { margin:0 -10px 8px; border-top:1px solid var(--border); }

/* ── Locked chat (chat passcode, 1405/07/24) ───────────────────────────
 * While the chat is locked only the list head and the lock card show; the
 * card is the messages area's empty state with the catalog password field. */
.ds-pattern-inbox--messenger.is-locked .ds-pattern-inbox__search,
.ds-pattern-inbox--messenger.is-locked .ds-pattern-inbox__folders,
.ds-pattern-inbox--messenger.is-locked .ds-pattern-inbox__threads,
.ds-pattern-inbox--messenger.is-locked .ds-pattern-inbox__header-actions,
.ds-pattern-inbox--messenger.is-locked .ds-pattern-inbox__pinned,
.ds-pattern-inbox--messenger.is-locked .ds-pattern-inbox__security,
.ds-pattern-inbox--messenger.is-locked .ds-pattern-inbox__composer,
.ds-pattern-inbox--messenger.is-locked .ds-pattern-inbox__jump,
.ds-pattern-inbox--messenger.is-locked .ds-pattern-inbox__aside,
.ds-pattern-inbox--messenger.is-locked .ds-pattern-inbox__mobile-back,
.ds-pattern-inbox--messenger.is-locked .ds-pattern-inbox__list-head > :not(strong):not([data-chat-vault-menu]) { display:none!important; }
.ds-pattern-inbox__lock { width:min(100%,380px); gap:10px; padding:30px 28px 26px; border:1px solid var(--border); border-radius:22px; background:var(--surface); box-shadow:0 22px 48px -30px color-mix(in srgb,var(--brand-700) 55%,transparent); }
.ds-pattern-inbox__messages-empty.ds-pattern-inbox__lock > [data-ds-icon] { display:grid; width:60px; height:60px; margin-bottom:4px; padding:0; box-sizing:border-box; place-items:center; border-radius:50%; background:var(--pastel-mint); }
.ds-pattern-inbox__messages-empty.ds-pattern-inbox__lock > [data-ds-icon] svg { width:28px; height:28px; }
.ds-pattern-inbox__lock > strong { font-size:17px; }
.ds-pattern-inbox__lock > span:not([data-ds-icon]) { line-height:1.8; }
.ds-pattern-inbox__lock-form { display:grid; gap:12px; width:100%; margin-top:10px; text-align:start; }
.ds-pattern-inbox__lock-form .ds-field__error:not([hidden]) { margin-top:-4px; font-size:12px; }
.ds-pattern-inbox__lock-form .btn { width:100%; justify-content:center; }
/* The password field keeps the catalog's own icon size inside the empty state's large-icon rule. */
.ds-pattern-inbox__lock-form .ds-field__suffix-btn [data-ds-icon],.ds-pattern-inbox__lock-form .ds-field__suffix-btn svg { width:20px; height:20px; color:inherit; }
.ds-pattern-inbox__lock-note { color:#7b5b18; font-size:12px; line-height:1.7; }
.ds-pattern-inbox__lock-actions { display:flex; flex-wrap:wrap; gap:8px; }
/* ── Screen guard (CHAT_PRIVACY_AND_ROADMAP §7) ────────────────────────
 * The viewer's name and time faintly over the conversation, the messages
 * blurred while the window is not in front, a secret chat readable only while
 * a message is held, and nothing of the chat in print. */
.ds-pattern-inbox--messenger .ds-pattern-inbox__watermark { position:absolute; inset:0; z-index:2; background-repeat:repeat; pointer-events:none; }
.ds-pattern-inbox--messenger.is-guarded .ds-pattern-inbox__messages { transition:filter .12s ease; }
.ds-pattern-inbox--messenger.is-guarded.is-shielded .ds-pattern-inbox__messages { filter:blur(14px); }
.ds-pattern-inbox--messenger.is-guarded.is-shielded .ds-pattern-inbox__threads { filter:blur(8px); }
/* Who the conversation is with goes too (owner report 1405/07/26): the header's face, name and
   subtitle, and the info panel's hero and members. */
.ds-pattern-inbox--messenger.is-guarded.is-shielded [data-chat-head-avatar],
.ds-pattern-inbox--messenger.is-guarded.is-shielded [data-chat-head-title],
.ds-pattern-inbox--messenger.is-guarded.is-shielded [data-chat-head-sub],
.ds-pattern-inbox--messenger.is-guarded.is-shielded [data-chat-aside-hero],
.ds-pattern-inbox--messenger.is-guarded.is-shielded [data-chat-aside-mini],
.ds-pattern-inbox--messenger.is-guarded.is-shielded .ds-pattern-inbox__member { filter:blur(8px); }
.ds-pattern-inbox--messenger.is-secret .ds-pattern-inbox__messages { user-select:none; }
.ds-pattern-inbox--messenger.is-secret [data-ds-message]:not(.is-revealed) > :not(time):not(.ds-pattern-inbox__bubble-more) { filter:blur(6px); transition:filter .12s ease; }
@media print { .ds-pattern-inbox--messenger { display:none!important; } }
/* A sealed message whose key has not reached this person yet. */
.ds-pattern-inbox__sealed { display:inline-flex; align-items:center; gap:6px; color:var(--text-muted); font-style:italic; }
.ds-pattern-inbox__sealed [data-ds-icon],.ds-pattern-inbox__sealed svg { width:16px; height:16px; flex:0 0 16px; }
.ds-pattern-inbox--messenger.is-embedded { grid-template-columns:minmax(0,1fr); height:var(--ds-inbox-height,620px); }
.ds-pattern-inbox--messenger.is-embedded.is-aside-open { grid-template-columns:minmax(0,1fr) minmax(260px,320px); }
.ds-pattern-inbox--messenger.is-embedded > .ds-pattern-inbox__list { display:none; }
/* Embedded in a page or drawer, the wheel goes on to the page once the messages cannot scroll further (or have nothing to scroll); contain trapped it. */
.ds-pattern-inbox--messenger.is-embedded .ds-pattern-inbox__messages { overscroll-behavior:auto; }

/* The hidden attribute always wins inside the variant (grid/flex parts included). */
.ds-pattern-inbox--messenger [hidden],.ds-pattern-inbox__menu[hidden] { display:none!important; }

/* ── Icon buttons (list head, header, composer, aside) ─────────────────── */
.ds-pattern-inbox__icon-btn { display:inline-grid; flex:0 0 40px; width:40px; height:40px; padding:0; place-items:center; border:0; border-radius:50%; color:var(--text-muted); background:transparent; cursor:pointer; font:inherit; transition:background-color .16s ease,color .16s ease; }
.ds-pattern-inbox__icon-btn:hover:not(:disabled) { color:var(--brand-700); background:color-mix(in srgb,var(--pastel-sky) 45%,var(--surface-2)); }
.ds-pattern-inbox__icon-btn:focus-visible { outline:2px solid var(--brand-500); outline-offset:2px; }
.ds-pattern-inbox__icon-btn:disabled { cursor:not-allowed; opacity:.4; }
.ds-pattern-inbox__icon-btn.is-primary { color:var(--surface); background:var(--brand-500); box-shadow:0 6px 16px color-mix(in srgb,var(--brand-500) 30%,transparent); }
.ds-pattern-inbox__icon-btn.is-primary:hover { color:var(--surface); background:var(--brand-600); }
.ds-pattern-inbox__icon-btn.is-on { color:var(--brand-700); background:var(--pastel-mint); }
.ds-pattern-inbox__icon-btn [data-ds-icon],.ds-pattern-inbox__icon-btn svg { width:22px; height:22px; }

/* ── List head, folders, threads ───────────────────────────────────────── */
.ds-pattern-inbox__list-head { display:flex; align-items:center; gap:4px; min-height:44px; margin-bottom:8px; padding-inline:4px; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__list-head > strong { flex:1; overflow:hidden; font-size:16px; line-height:1.5; text-overflow:ellipsis; white-space:nowrap; }
.ds-pattern-inbox__folders { display:flex; gap:2px; margin:0 -4px 6px; padding:0 4px 5px; overflow-x:auto; overflow-y:hidden; border-bottom:1px solid var(--border); scrollbar-width:thin; scrollbar-color:color-mix(in srgb,var(--text-muted) 45%,transparent) transparent; overscroll-behavior-inline:contain; }
.ds-pattern-inbox__folders::-webkit-scrollbar { height:5px; }
.ds-pattern-inbox__folders::-webkit-scrollbar-track { background:transparent; }
.ds-pattern-inbox__folders::-webkit-scrollbar-thumb { border-radius:999px; background:color-mix(in srgb,var(--text-muted) 45%,transparent); }
.ds-pattern-inbox__folder { position:relative; display:inline-flex; flex:0 0 auto; align-items:center; gap:6px; min-height:40px; padding:0 12px; border:0; border-radius:10px 10px 0 0; color:var(--text-muted); background:transparent; cursor:pointer; font:inherit; font-size:13px; font-weight:700; white-space:nowrap; transition:color .16s ease,background-color .16s ease; }
.ds-pattern-inbox__folder:hover { color:var(--text); background:color-mix(in srgb,var(--pastel-sky) 26%,transparent); }
.ds-pattern-inbox__folder[aria-selected="true"] { color:var(--brand-700); }
.ds-pattern-inbox__folder[aria-selected="true"]::after { position:absolute; inset-inline:10px; inset-block-end:-1px; height:3px; border-radius:3px 3px 0 0; background:var(--brand-500); content:""; }
.ds-pattern-inbox__folder:focus-visible { outline:2px solid var(--brand-500); outline-offset:-2px; }
.ds-pattern-inbox__folder-count { display:inline-grid; min-width:20px; height:20px; padding:0 6px; place-items:center; border-radius:999px; color:var(--surface); background:color-mix(in srgb,var(--text-muted) 70%,var(--surface)); font-size:11px; font-weight:800; line-height:1; }
.ds-pattern-inbox__folder[aria-selected="true"] .ds-pattern-inbox__folder-count { background:var(--brand-500); }
.ds-pattern-inbox__threads { flex:1; min-height:0; margin-inline:-4px; padding:0 4px 10px; overflow-y:auto; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__thread { display:grid; align-items:center; gap:10px; width:100%; color:var(--text); background:transparent; cursor:pointer; font:inherit; text-align:start; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__thread:focus-visible { outline:2px solid var(--brand-500); outline-offset:-2px; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__thread-copy strong { display:flex; align-items:center; gap:4px; }
.ds-pattern-inbox__thread-title { overflow:hidden; min-width:0; text-overflow:ellipsis; white-space:nowrap; }
.ds-pattern-inbox__thread-flag { flex:0 0 16px; width:16px; height:16px; color:var(--text-muted); }
.ds-pattern-inbox__thread-flag svg { width:16px; height:16px; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__thread-copy small { display:block; overflow:hidden; color:var(--text-muted); text-overflow:ellipsis; white-space:nowrap; }
.ds-pattern-inbox__thread-author { color:var(--brand-700); font-weight:700; }
.ds-pattern-inbox__draft { color:var(--stage-solid-red,#ef4444); font-weight:700; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__thread-meta { display:grid; justify-items:end; align-content:center; gap:6px; min-width:36px; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__thread-meta time { display:inline-flex; align-items:center; gap:2px; margin:0; color:var(--text-muted); white-space:nowrap; }
.ds-pattern-inbox__unread { display:inline-grid; min-width:22px; height:22px; padding:0 7px; place-items:center; border-radius:999px; color:var(--surface); background:var(--brand-500); font-size:12px; font-weight:800; line-height:1; }
.ds-pattern-inbox__unread.is-muted { background:color-mix(in srgb,var(--text-muted) 62%,var(--surface)); }
.ds-pattern-inbox__unread.is-mention { min-width:22px; padding:0; }
.ds-pattern-inbox__unread.is-bump { animation:dsInboxBump .32s ease; }
.ds-pattern-inbox__pin-mark { width:16px; height:16px; color:var(--text-muted); }
.ds-pattern-inbox__pin-mark svg { width:16px; height:16px; }
.ds-pattern-inbox__list-section { margin:10px 6px 4px; color:var(--text-muted); font-size:12px; font-weight:800; }

/* Avatars: round, with an online dot; more tones from the pastel tokens. */
/* .ds-pattern-inbox__member also stands outside the messenger, in the «اطلاعات پیام» modal. */
.ds-pattern-inbox--messenger .ds-pattern-avatar, .ds-pattern-inbox__member .ds-pattern-avatar { position:relative; overflow:visible; }
/* A colleague's portrait (DsAvatar, EMPLOYEE_AVATAR_CONTRACT) fills the slot; the online dot stays on top. */
.ds-pattern-inbox--messenger .ds-pattern-avatar.has-portrait, .ds-pattern-inbox__member .ds-pattern-avatar.has-portrait { padding:0; background:none; border-radius:50%; }
.ds-pattern-inbox--messenger .ds-pattern-avatar.has-portrait > .ds-entity-avatar, .ds-pattern-inbox__member .ds-pattern-avatar.has-portrait > .ds-entity-avatar { width:100%; height:100%; min-width:0; flex:none; }
.ds-pattern-avatar--lilac { color:var(--brand-700); background:var(--pastel-lilac); }
.ds-pattern-avatar--peach { color:var(--brand-700); background:var(--pastel-peach); }
.ds-pattern-avatar--lemon { color:var(--brand-700); background:var(--pastel-lemon); }
.ds-pattern-inbox__presence { position:absolute; inset-block-end:1px; inset-inline-end:1px; width:12px; height:12px; border:2px solid var(--surface); border-radius:50%; background:var(--stage-solid-green,#22c55e); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__thread.is-active .ds-pattern-inbox__presence { border-color:color-mix(in srgb,var(--pastel-mint) 72%,var(--surface)); }
/* Presence status (1405/07/30): the same dot in the status colour; «مزاحم نشوید» carries a bar. */
.ds-pattern-inbox__presence.is-dnd { background:var(--stage-solid-red,#ef4444); }
.ds-pattern-inbox__presence.is-dnd::after { content:""; position:absolute; inset-inline:1px; inset-block-start:50%; height:2px; margin-block-start:-1px; border-radius:1px; background:var(--surface); }
.ds-pattern-inbox__presence.is-off_hours { background:var(--stage-solid-amber,#f59e0b); }
.ds-pattern-inbox__presence.is-leave { background:var(--stage-solid-slate,#64748b); }
/* «در انتظار پاسخ» beside a conversation's name. */
.ds-pattern-inbox__thread-flag.is-awaiting { color:var(--stage-solid-amber,#f59e0b); }

/* Personal messengers (owner decision 1405/08/01, «پیام‌رسان‌ها» folder): each
   platform keeps its own brand colour and official logo so it is known at a
   glance. The brand colour marks only the messenger's identity (logo, the
   row's edge stripe and its tag); the panel's colours stay as they are. The
   tag's text is a darker mix of the brand colour so it stays readable. */
.ds-pattern-inbox--messenger, .ds-pattern-inbox__guide-steps { --ds-messenger-bale:#00B894; --ds-messenger-rubika:#803888; --ds-messenger-eitaa:#F7712F; }
:where(.ds-pattern-inbox__thread.is-messenger, .ds-pattern-inbox__messenger-tag, .ds-pattern-avatar--messenger, .ds-pattern-inbox__guide-step, .ds-pattern-inbox__guide-picture) { --ds-messenger-tone:var(--brand-700); }
.is-messenger-bale { --ds-messenger-tone:var(--ds-messenger-bale); }
.is-messenger-rubika { --ds-messenger-tone:var(--ds-messenger-rubika); }
.is-messenger-eitaa { --ds-messenger-tone:var(--ds-messenger-eitaa); }
.ds-pattern-inbox--messenger .ds-pattern-avatar.ds-pattern-avatar--messenger { padding:0; background:var(--surface); border-radius:50%; box-shadow:0 0 0 1px color-mix(in srgb,var(--ds-messenger-tone) 28%,transparent); }
.ds-pattern-avatar--messenger > img { display:block; width:100%; height:100%; border-radius:50%; object-fit:cover; }
/* A bot conversation: the person's initials with the messenger's logo as a small badge. */
.ds-pattern-avatar__messenger-badge { position:absolute; inset-block-end:-2px; inset-inline-end:-2px; width:18px; height:18px; border:2px solid var(--surface); border-radius:50%; background:var(--surface); overflow:hidden; }
.ds-pattern-avatar__messenger-badge > img { display:block; width:100%; height:100%; object-fit:cover; }
.ds-pattern-inbox__thread.is-messenger { box-shadow:inset -3px 0 0 var(--ds-messenger-tone); }
.ds-pattern-inbox__messenger-tag { display:inline-flex; flex:0 0 auto; align-items:center; min-height:18px; padding:0 7px; border-radius:999px; color:color-mix(in srgb,var(--ds-messenger-tone) 72%,#000); background:color-mix(in srgb,var(--ds-messenger-tone) 13%,var(--surface)); font-size:11px; font-weight:800; line-height:1; white-space:nowrap; }
[data-theme="dark"] .ds-pattern-inbox__messenger-tag { color:color-mix(in srgb,var(--ds-messenger-tone) 55%,#fff); background:color-mix(in srgb,var(--ds-messenger-tone) 22%,var(--surface)); }
.ds-pattern-inbox__thread.is-messenger .ds-pattern-inbox__thread-flag.is-launch { color:var(--text-muted); }
/* The illustrated connection guide (chat-messengers.js guide()): one step per row, the drawn phone beside its text. */
.ds-pattern-inbox__guide-steps { display:grid; gap:14px; margin:14px 0 0; padding:0; list-style:none; }
.ds-pattern-inbox__guide-step { display:grid; grid-template-columns:minmax(150px,200px) minmax(0,1fr); gap:16px; align-items:center; padding:12px; border:1px solid var(--border,#e2e8f0); border-radius:16px; background:var(--surface); }
.ds-pattern-inbox__guide-picture { display:block; width:100%; height:auto; }
.ds-pattern-inbox__guide-copy strong { display:flex; align-items:center; gap:8px; color:var(--text); font-size:14px; font-weight:800; }
.ds-pattern-inbox__guide-copy p { margin:6px 0 0; color:var(--text-muted); font-size:13px; line-height:1.9; }
.ds-pattern-inbox__guide-num { display:inline-grid; place-items:center; flex:0 0 26px; width:26px; height:26px; border-radius:50%; color:#fff; background:var(--ds-messenger-tone); font-size:12px; font-weight:800; }
@media (max-width:560px) { .ds-pattern-inbox__guide-step { grid-template-columns:1fr; } .ds-pattern-inbox__guide-picture { max-width:220px; margin-inline:auto; } }

/* ── Conversation header ───────────────────────────────────────────────── */
.ds-pattern-inbox--messenger .ds-pattern-inbox__conversation > header { min-height:60px; gap:8px; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__conversation > header > .ds-pattern-inbox__header-actions { display:flex; flex:0 0 auto; align-items:center; gap:2px; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__conversation > header > .ds-pattern-inbox__identity { flex:1; min-width:0; cursor:pointer; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__identity strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__identity small a { color:var(--brand-700); font-weight:700; text-decoration:none; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__conversation > header .ds-pattern-avatar { width:42px; height:42px; font-size:14px; }
.ds-pattern-inbox__typing { display:inline-flex; align-items:center; gap:4px; color:var(--brand-700); }
.ds-pattern-inbox__typing-dots { display:inline-flex; gap:2px; }
.ds-pattern-inbox__typing-dots i { width:4px; height:4px; border-radius:50%; background:currentColor; animation:dsInboxTyping 1.2s infinite ease-in-out; }
.ds-pattern-inbox__typing-dots i:nth-child(2) { animation-delay:.15s; }
.ds-pattern-inbox__typing-dots i:nth-child(3) { animation-delay:.3s; }

/* ── Pinned message bar ────────────────────────────────────────────────── */
.ds-pattern-inbox__pinned { position:relative; z-index:1; display:flex; align-items:center; gap:10px; min-height:48px; padding:6px 14px; border-bottom:1px solid var(--border); background:var(--surface); cursor:pointer; }
.ds-pattern-inbox__pinned[hidden] { display:none; }
.ds-pattern-inbox__pinned-copy { display:grid; flex:1; min-width:0; padding-inline-start:10px; border-inline-start:3px solid var(--brand-500); }
.ds-pattern-inbox__pinned-copy strong { color:var(--brand-700); font-size:12px; }
.ds-pattern-inbox__pinned-copy span { overflow:hidden; color:var(--text); font-size:13px; text-overflow:ellipsis; white-space:nowrap; }

/* ── Messages ──────────────────────────────────────────────────────────── */
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages { padding-inline:max(5%,36px); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p { position:relative; overflow-wrap:anywhere; }
.ds-pattern-inbox--messenger.is-protected .ds-pattern-inbox__messages { -webkit-user-select:none; user-select:none; }
/* Ordinary messages opt out of the panel's non-selectable surface. Keep this
   at the same specificity as the protected opt-in so author locks win below. */
.ds-pattern-inbox--messenger:where(:not(.is-protected):not(.is-secret)) .ds-pattern-inbox__messages .ds-pattern-inbox__text,
/* The organization allows copying text (chat settings): message text is selectable again, controls are not. */
.ds-pattern-inbox--messenger.is-protected.is-copyable .ds-pattern-inbox__messages .ds-pattern-inbox__text { -webkit-user-select:text; user-select:text; cursor:text; }
/* The author closed copying of their text («تنظیمات چت من», copy lock): that message's text is not selectable for anyone else. */
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-copy-locked .ds-pattern-inbox__text,
.ds-pattern-inbox--messenger.is-protected.is-copyable .ds-pattern-inbox__messages > p.is-copy-locked .ds-pattern-inbox__text { -webkit-user-select:none; user-select:none; cursor:default; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p + p.is-continued { margin-block-start:-2px; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-mentioned { background:color-mix(in srgb,var(--pastel-lemon) 70%,var(--surface)); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-deleted { color:var(--text-muted); font-style:italic; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-flash { animation:dsInboxFlash 1.4s ease; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-selected { outline:2px solid var(--brand-500); outline-offset:2px; }
/* The conversation whose list menu is open (right-click, long-press). */
.ds-pattern-inbox--messenger .ds-pattern-inbox__thread.is-menu-open { outline:2px solid var(--brand-500); outline-offset:-2px; }
.ds-pattern-inbox__text { white-space:pre-wrap; }
.ds-pattern-inbox__mention { color:var(--brand-700); font-weight:700; }
.ds-pattern-inbox__mention.is-me { padding:0 3px; border-radius:5px; background:var(--pastel-lemon); }
/* A web address in the message text (DsInboxMessenger.linkifyHtml): opens in a new tab, and is clickable even where text is not selectable. */
.ds-pattern-inbox__link { color:var(--brand-700); text-decoration:underline; text-underline-offset:2px; overflow-wrap:anywhere; unicode-bidi:isolate; cursor:pointer; }
.ds-pattern-inbox__link:hover { color:var(--brand-500); }
.ds-pattern-inbox__link:focus-visible { outline:2px solid var(--brand-500); outline-offset:1px; border-radius:3px; }
/* Formatted message text (DsMessageMarkdown, owner request 1405/08/20). Blocks
   are spans inside the bubble's <p>; a text without blocks keeps pre-wrap. */
.ds-pattern-inbox--messenger .ds-pattern-inbox__text strong { font-weight:800; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__text del { color:var(--text-muted); }
.ds-pattern-inbox__md { display:grid; gap:8px; min-width:0; white-space:normal; }
.ds-pattern-inbox__md .ds-pattern-inbox__md-para,
.ds-pattern-inbox__md .ds-pattern-inbox__md-item-body { white-space:pre-wrap; }
.ds-pattern-inbox__md-para,.ds-pattern-inbox__md-heading,.ds-pattern-inbox__md-quote,.ds-pattern-inbox__md-list,.ds-pattern-inbox__md-rule,.ds-pattern-inbox__md-code-block,.ds-pattern-inbox__md-table-wrap { display:block; min-width:0; }
.ds-pattern-inbox__md-heading { font-weight:800; line-height:1.6; }
.ds-pattern-inbox__md-heading.is-h1 { font-size:1.2em; }
.ds-pattern-inbox__md-heading.is-h2 { font-size:1.12em; }
.ds-pattern-inbox__md-heading.is-h3 { font-size:1.05em; }
.ds-pattern-inbox__md-quote { display:grid; gap:6px; padding:4px 10px; border-inline-start:3px solid var(--brand-500); border-radius:6px; color:var(--text-muted); background:color-mix(in srgb,var(--pastel-sky) 30%,transparent); }
.ds-pattern-inbox__md-list { display:grid; gap:4px; }
.ds-pattern-inbox__md-item { display:grid; grid-template-columns:auto minmax(0,1fr); gap:6px; align-items:baseline; }
.ds-pattern-inbox__md-item-body { display:grid; gap:4px; min-width:0; }
.ds-pattern-inbox__md-marker { min-width:1.1em; color:var(--brand-700); font-weight:700; text-align:center; }
.ds-pattern-inbox__md-rule { height:0; border-block-start:1px solid var(--border); }
.ds-pattern-inbox__md-code { padding:1px 5px; border-radius:5px; background:color-mix(in srgb,var(--surface-2) 85%,var(--text) 6%); font-family:ui-monospace,'SF Mono',Menlo,Consolas,'Vazirmatn',monospace; font-size:.88em; unicode-bidi:isolate; }
.ds-pattern-inbox__md-code-block { overflow-x:auto; padding:10px 12px; border-radius:8px; background:color-mix(in srgb,var(--surface-2) 85%,var(--text) 6%); font-family:ui-monospace,'SF Mono',Menlo,Consolas,'Vazirmatn',monospace; font-size:12.5px; line-height:1.6; text-align:left; white-space:pre; }
.ds-pattern-inbox__md-table-wrap { overflow-x:auto; border:1px solid var(--border); border-radius:8px; }
.ds-pattern-inbox__md-table-wrap:focus-visible { outline:2px solid var(--brand-500); outline-offset:1px; }
.ds-pattern-inbox__md-table { display:table; width:100%; border-collapse:collapse; font-size:.92em; line-height:1.6; }
.ds-pattern-inbox__md-row { display:table-row; }
.ds-pattern-inbox__md-row + .ds-pattern-inbox__md-row > .ds-pattern-inbox__md-cell { border-block-start:1px solid var(--border); }
.ds-pattern-inbox__md-row.is-head { font-weight:800; background:color-mix(in srgb,var(--surface-2) 80%,transparent); }
.ds-pattern-inbox__md-cell { display:table-cell; padding:6px 10px; text-align:start; vertical-align:top; overflow-wrap:normal; word-break:normal; }
.ds-pattern-inbox__md-cell + .ds-pattern-inbox__md-cell { border-inline-start:1px solid var(--border); }
.ds-pattern-inbox__md-cell.is-center { text-align:center; }
.ds-pattern-inbox__md-cell.is-end { text-align:end; }
/* code is selectable everywhere (main.css): a closed message keeps its code closed too. */
.ds-pattern-inbox--messenger.is-protected:not(.is-copyable) .ds-pattern-inbox__text code,
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-copy-locked .ds-pattern-inbox__text code { -webkit-user-select:none; user-select:none; }
.ds-pattern-inbox__forwarded { display:flex; align-items:center; gap:4px; margin-bottom:4px; color:var(--brand-700); font-size:12px; font-weight:700; }
.ds-pattern-inbox__forwarded [data-ds-icon],.ds-pattern-inbox__forwarded svg { width:15px; height:15px; }
.ds-pattern-inbox__reply { display:grid; margin:0 0 6px; padding:4px 9px; border-inline-start:3px solid var(--brand-500); border-radius:6px; background:color-mix(in srgb,var(--pastel-sky) 30%,transparent); cursor:pointer; }
.ds-pattern-inbox__reply strong { color:var(--brand-700); font-size:12px; }
.ds-pattern-inbox__reply span { overflow:hidden; color:var(--text-muted); font-size:12px; text-overflow:ellipsis; white-space:nowrap; }
.ds-pattern-inbox__meta-tag { color:var(--text-muted); font-size:10px; }
.ds-pattern-inbox__receipt.is-read { color:var(--brand-500); }
.ds-pattern-inbox__receipt.is-pending { opacity:.6; }
.ds-pattern-inbox__reactions { display:flex; flex-wrap:wrap; gap:4px; margin-top:6px; }
.ds-pattern-inbox__reaction { display:inline-flex; align-items:center; gap:4px; min-height:28px; padding:0 9px; border:1px solid transparent; border-radius:999px; color:var(--brand-700); background:color-mix(in srgb,var(--pastel-sky) 42%,var(--surface)); cursor:pointer; font:inherit; font-size:13px; font-weight:700; }
.ds-pattern-inbox__reaction.is-mine { border-color:var(--brand-500); background:var(--pastel-mint); }
.ds-pattern-inbox__reaction:focus-visible { outline:2px solid var(--brand-500); outline-offset:1px; }
.ds-pattern-inbox__chips { display:flex; flex-wrap:wrap; gap:4px; margin-top:6px; }
.ds-pattern-inbox__chip { display:inline-flex; align-items:center; gap:4px; min-height:26px; padding:0 9px; border-radius:999px; color:var(--brand-700); background:color-mix(in srgb,var(--pastel-mint) 70%,var(--surface)); font-size:12px; font-weight:700; text-decoration:none; }
.ds-pattern-inbox__chip svg { width:14px; height:14px; }
/* A chip that is a button (the «نیازمند پاسخ» actions) looks like the link chip. */
button.ds-pattern-inbox__chip { border:0; font-family:inherit; cursor:pointer; }
button.ds-pattern-inbox__chip:focus-visible { outline:2px solid var(--brand-500); outline-offset:1px; }
.ds-pattern-inbox__bubble-more { position:absolute; inset-block-start:4px; inset-inline-end:-36px; display:grid; width:30px; height:30px; padding:0; place-items:center; border:0; border-radius:50%; color:var(--text-muted); background:var(--surface); box-shadow:0 2px 6px color-mix(in srgb,var(--text) 14%,transparent); cursor:pointer; opacity:0; transition:opacity .14s ease; }
.ds-pattern-inbox__messages > p.is-outgoing .ds-pattern-inbox__bubble-more { inset-inline-end:auto; inset-inline-start:-36px; }
.ds-pattern-inbox__messages > p:hover .ds-pattern-inbox__bubble-more,.ds-pattern-inbox__bubble-more:focus-visible { opacity:1; }
.ds-pattern-inbox__bubble-more svg { width:18px; height:18px; }
.ds-pattern-inbox__unread-divider { align-self:stretch; margin:8px -5.6%; padding:5px; color:var(--brand-700); background:color-mix(in srgb,var(--surface) 86%,var(--pastel-sky)); font-size:12px; font-weight:800; text-align:center; }
.ds-pattern-inbox__system { align-self:center; padding:4px 12px; border-radius:999px; color:var(--text-muted); background:color-mix(in srgb,var(--surface) 80%,transparent); font-size:12px; }
.ds-pattern-inbox__messages-empty { display:grid; align-self:center; justify-items:center; gap:8px; margin:auto; padding:18px 22px; border-radius:16px; color:var(--text-muted); background:color-mix(in srgb,var(--surface) 85%,transparent); font-size:14px; text-align:center; }
.ds-pattern-inbox__messages-empty [data-ds-icon],.ds-pattern-inbox__messages-empty svg { width:40px; height:40px; color:var(--brand-500); }
.ds-pattern-inbox__messages-empty strong { color:var(--text); font-size:15px; }

/* Audio inside a bubble: play, progress, duration. */
.ds-pattern-inbox__audio { display:grid; grid-template-columns:44px minmax(0,1fr); align-items:center; gap:10px; min-width:min(260px,100%); margin-bottom:6px; }
.ds-pattern-inbox__audio-play { display:grid; width:44px; height:44px; padding:0; place-items:center; border:0; border-radius:50%; color:var(--surface); background:var(--brand-500); cursor:pointer; }
.ds-pattern-inbox__audio-play svg { width:24px; height:24px; }
.ds-pattern-inbox__audio-play:focus-visible { outline:2px solid var(--brand-700); outline-offset:2px; }
.ds-pattern-inbox__audio-copy { display:grid; gap:4px; min-width:0; }
.ds-pattern-inbox__audio-copy strong { overflow:hidden; font-size:12px; text-overflow:ellipsis; white-space:nowrap; }
.ds-pattern-inbox__audio-copy small { color:var(--text-muted); font-size:11px; }
.ds-pattern-inbox__audio-track { position:relative; display:block; height:4px; overflow:hidden; border-radius:4px; background:color-mix(in srgb,var(--brand-500) 22%,transparent); cursor:pointer; }
.ds-pattern-inbox__audio-track > i { position:absolute; inset-block:0; inset-inline-start:0; width:var(--progress,0%); border-radius:4px; background:var(--brand-500); }
.ds-pattern-inbox__audio.is-missing .ds-pattern-inbox__audio-play { background:var(--text-muted); cursor:not-allowed; }

/* Video inside a bubble: a tile with a play button; plays in the viewer. */
.ds-pattern-inbox__video { position:relative; display:grid; width:min(300px,100%); aspect-ratio:16/10; margin:-3px -6px 6px; padding:0; place-items:center; overflow:hidden; border:0; border-radius:13px; color:var(--surface); background:color-mix(in srgb,var(--text) 82%,var(--brand-700)); cursor:pointer; }
.ds-pattern-inbox__video-play { display:grid; width:52px; height:52px; place-items:center; border-radius:50%; background:color-mix(in srgb,var(--text) 55%,transparent); }
.ds-pattern-inbox__video-play svg { width:30px; height:30px; }
.ds-pattern-inbox__video-meta { position:absolute; inset-block-start:8px; inset-inline-start:8px; padding:2px 8px; border-radius:999px; background:color-mix(in srgb,var(--text) 55%,transparent); font-size:11px; }
.ds-pattern-inbox__video-modal { display:grid; place-items:center; background:var(--text); }
.ds-pattern-inbox__video-modal video { display:block; width:100%; max-height:70vh; }

/* Picture and video previews (owner request 1405/08/20): the tile takes the
   file's real proportion at once (--ds-media-ratio, --ds-media-w from the
   sender's preview), the tiny picture shows blurred behind it and the real
   picture fades in over it. Without a preview: the canonical loading surface
   (.ds-async-state__shimmer) at the default 4:3. */
.ds-pattern-inbox--messenger .ds-pattern-inbox__media { position:relative; width:var(--ds-media-w,320px); max-width:100%; isolation:isolate; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__media img { position:relative; z-index:1; aspect-ratio:var(--ds-media-ratio,4/3); opacity:0; transition:opacity .35s ease,transform .25s cubic-bezier(.2,.8,.2,1); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__media.is-loaded img,.ds-pattern-inbox--messenger .ds-pattern-inbox__media:not(.is-arriving):not(.is-missing) img { opacity:1; }
.ds-pattern-inbox__media-thumb { position:absolute; z-index:0; inset:0; display:block; border-radius:inherit; background-position:center; background-size:cover; background-repeat:no-repeat; }
.ds-pattern-inbox__media.has-thumb .ds-pattern-inbox__media-thumb,.ds-pattern-inbox__video.has-thumb .ds-pattern-inbox__media-thumb,.ds-pattern-inbox__gallery-item .ds-pattern-inbox__media-thumb { inset:-12px; filter:blur(12px) saturate(1.1); }
/* A picture sent before previews: the loading surface, tinted so it reads on a bubble of any colour, with a picture glyph in the middle (owner report 1405/08/21: a bare white box looked empty). */
.ds-pattern-inbox__media-thumb.ds-async-state__shimmer { position:absolute; display:grid; place-items:center; border-radius:inherit; color:color-mix(in srgb,var(--text) 38%,transparent); background:color-mix(in srgb,var(--text) 9%,var(--surface-2)); }
.ds-pattern-inbox__media-thumb.ds-async-state__shimmer > [data-ds-icon],.ds-pattern-inbox__media-thumb.ds-async-state__shimmer svg { display:grid; width:48px; height:48px; place-items:center; }
.ds-pattern-inbox__media-thumb.ds-async-state__shimmer :is([data-ds-icon],.ds-ico,.material-symbols-rounded) { color:inherit !important; }
.ds-pattern-inbox__media.is-loaded .ds-pattern-inbox__media-thumb { opacity:0; transition:opacity .35s ease .1s; }
.ds-pattern-inbox__media.is-missing .ds-pattern-inbox__media-thumb { display:none; }
/* A video: the frame holds the play tile and, beside it, the download button
   (owner request 1405/08/20: play in the middle, download with the size
   before anything is fetched). */
.ds-pattern-inbox__video-frame { position:relative; display:block; width:var(--ds-media-w,300px); max-width:100%; margin:-3px -6px 6px; }
.ds-pattern-inbox__video-frame > .ds-pattern-inbox__video { width:100%; margin:0; aspect-ratio:var(--ds-media-ratio,16/10); isolation:isolate; }
.ds-pattern-inbox__video-frame .ds-pattern-inbox__video-meta { inset-block-start:auto; inset-block-end:8px; inset-inline-start:auto; inset-inline-end:8px; }
.ds-pattern-inbox__video.is-fetching .ds-pattern-inbox__video-meta { display:none; }
.ds-pattern-inbox__video-download { position:absolute; z-index:4; inset-block-start:8px; inset-inline-start:8px; display:inline-flex; align-items:center; gap:4px; min-height:30px; padding:3px 10px 3px 8px; border:0; border-radius:999px; color:var(--surface); background:color-mix(in srgb,var(--text) 55%,transparent); font:inherit; font-size:11px; line-height:1.4; cursor:pointer; transition:background .2s ease; }
.ds-pattern-inbox__video-download:hover { background:color-mix(in srgb,var(--text) 72%,transparent); }
.ds-pattern-inbox__video-download:focus-visible { outline:2px solid var(--surface); outline-offset:2px; }
.ds-pattern-inbox__video-download > [data-ds-icon],.ds-pattern-inbox__video-download svg { display:grid; width:18px; height:18px; place-items:center; }
.ds-pattern-inbox__video-download[disabled] { cursor:progress; opacity:.75; }
.ds-pattern-inbox__video-download :is([data-ds-icon],.ds-ico,.material-symbols-rounded) { color:inherit !important; }
.ds-pattern-inbox__video > .ds-pattern-inbox__video-play,.ds-pattern-inbox__video > .ds-pattern-inbox__video-meta { z-index:2; }
.ds-pattern-inbox__media-progress { position:absolute; z-index:3; inset-inline:10px; inset-block-end:10px; display:none; gap:4px; padding:6px 10px 7px; border-radius:10px; color:var(--surface); background:color-mix(in srgb,var(--text) 62%,transparent); font-size:11px; line-height:1.4; text-align:start; }
.is-fetching > .ds-pattern-inbox__media-progress { display:grid; }
.ds-pattern-inbox__media-track { position:relative; display:block; height:4px; overflow:hidden; border-radius:4px; background:color-mix(in srgb,var(--surface) 30%,transparent); }
.ds-pattern-inbox__media-track > i { position:absolute; inset-block:0; inset-inline-start:0; display:block; border-radius:4px; background:var(--surface); transition:width .2s ease; }
.ds-pattern-inbox__media-progress.is-indeterminate .ds-pattern-inbox__media-track > i { animation:dsInboxMediaSweep 1.2s ease-in-out infinite; }
@keyframes dsInboxMediaSweep { 0% { inset-inline-start:-30%; } 100% { inset-inline-start:100%; } }
.ds-pattern-inbox__gallery-item .ds-pattern-inbox__media-thumb { z-index:0; }
.ds-pattern-inbox__gallery-item > img:not([src]) { visibility:hidden; }
.ds-pattern-inbox__gallery-item > img,.ds-pattern-inbox__gallery-item > [data-ds-icon],.ds-pattern-inbox__gallery-item > svg { position:relative; z-index:1; }
@media (prefers-reduced-motion:reduce) {
  .ds-pattern-inbox--messenger .ds-pattern-inbox__media img,.ds-pattern-inbox__media.is-loaded .ds-pattern-inbox__media-thumb { transition:none; }
  .ds-pattern-inbox__media-progress.is-indeterminate .ds-pattern-inbox__media-track > i { animation:none; inset-inline-start:0; }
}

/* File card icons by kind (the card itself is .ds-pattern-inbox__file). */
.ds-pattern-inbox--messenger .ds-pattern-inbox__file { cursor:pointer; }
.ds-pattern-inbox__file.is-document .ds-pattern-inbox__file-icon { color:#285b80; background:var(--pastel-sky); }
.ds-pattern-inbox__file.is-archive .ds-pattern-inbox__file-icon { color:var(--brand-700); background:var(--pastel-lemon); }
.ds-pattern-inbox__file.is-pdf .ds-pattern-inbox__file-icon { color:#9c3f50; background:var(--pastel-rose); }

/* Jump to the newest message. */
.ds-pattern-inbox__jump { position:absolute; z-index:4; inset-block-end:86px; inset-inline-start:18px; display:grid; width:46px; height:46px; padding:0; place-items:center; border:0; border-radius:50%; color:var(--text-muted); background:var(--surface); box-shadow:0 4px 14px color-mix(in srgb,var(--text) 18%,transparent); cursor:pointer; }
.ds-pattern-inbox__jump[hidden] { display:none; }
.ds-pattern-inbox__jump svg { width:24px; height:24px; }
.ds-pattern-inbox__jump-count { position:absolute; inset-block-start:-6px; inset-inline-end:-4px; display:grid; min-width:22px; height:22px; padding:0 6px; place-items:center; border-radius:999px; color:var(--surface); background:var(--brand-500); font-size:11px; font-weight:800; }
.ds-pattern-inbox__jump-count:empty { display:none; }

/* ── Message menu (right-click, long-press or the ⋯ button) ─────────────── */
/* Compact menu as in Telegram (owner request 1405/08/10): small rows, plain icons, a scrollable reaction strip. */
.ds-pattern-inbox__menu { position:fixed; z-index:1200; width:216px; max-width:calc(100vw - 16px); padding:4px; border:1px solid color-mix(in srgb,var(--border) 70%,transparent); border-radius:14px; background:color-mix(in srgb,var(--surface) 94%,transparent); -webkit-backdrop-filter:blur(14px) saturate(1.4); backdrop-filter:blur(14px) saturate(1.4); box-shadow:0 10px 30px color-mix(in srgb,var(--text) 16%,transparent),0 1px 3px color-mix(in srgb,var(--text) 8%,transparent); animation:dsUploadIn .14s ease; }
.ds-pattern-inbox__menu[hidden] { display:none; }
.ds-pattern-inbox__menu-reactions { display:flex; gap:1px; margin:0 0 4px; padding:3px; overflow-x:auto; overflow-y:hidden; overscroll-behavior:contain; scrollbar-width:none; border-radius:999px; background:var(--surface-2); }
.ds-pattern-inbox__menu-reactions::-webkit-scrollbar { display:none; }
/* A soft fade on the side that still has more emoji. */
.ds-pattern-inbox__menu-reactions.is-fade-left { -webkit-mask-image:linear-gradient(to right,transparent 0,#000 22px); mask-image:linear-gradient(to right,transparent 0,#000 22px); }
.ds-pattern-inbox__menu-reactions.is-fade-right { -webkit-mask-image:linear-gradient(to left,transparent 0,#000 22px); mask-image:linear-gradient(to left,transparent 0,#000 22px); }
.ds-pattern-inbox__menu-reactions.is-fade-left.is-fade-right { -webkit-mask-image:linear-gradient(to right,transparent 0,#000 22px,#000 calc(100% - 22px),transparent 100%); mask-image:linear-gradient(to right,transparent 0,#000 22px,#000 calc(100% - 22px),transparent 100%); }
.ds-pattern-inbox__menu-reactions button { display:grid; flex:0 0 30px; width:30px; height:30px; padding:0; place-items:center; border:0; border-radius:50%; background:transparent; cursor:pointer; font-size:18px; line-height:1; transition:transform .12s ease,background-color .12s ease; }
.ds-pattern-inbox__menu-reactions button:hover,.ds-pattern-inbox__menu-reactions button:focus-visible { background:var(--surface); transform:scale(1.12); outline:0; }
.ds-pattern-inbox__menu-reactions button { position:relative; }
.ds-pattern-inbox__menu-reactions button > .ds-pattern-inbox__emoji-lottie { display:none; position:absolute; inset:3px; width:auto; height:auto; pointer-events:none; }
.ds-pattern-inbox__menu-reactions button.is-lottie > .ds-pattern-inbox__emoji-lottie { display:block; }
.ds-pattern-inbox__menu-reactions button.is-lottie > .ds-pattern-inbox__emoji-glyph { visibility:hidden; }
.ds-pattern-inbox__menu-reactions button[data-active="false"] { background:color-mix(in srgb,var(--pastel-mint) 80%,var(--surface)); box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--brand-700) 30%,transparent); }
/* Everyday actions in one row of small icon tiles. */
.ds-pattern-inbox__menu-quick-row { display:flex; gap:2px; margin:0 0 4px; padding:0 0 4px; border-bottom:1px solid var(--border); }
.ds-pattern-inbox__menu-quick { display:flex; flex:1 1 auto; min-width:0; flex-direction:column; align-items:center; gap:2px; padding:5px 2px 4px; border:0; border-radius:10px; color:var(--text-muted); background:transparent; cursor:pointer; font:inherit; font-size:10.5px; line-height:1.3; white-space:nowrap; transition:background-color .12s ease,color .12s ease; }
.ds-pattern-inbox__menu-quick > span:last-child { max-width:100%; overflow:hidden; text-overflow:ellipsis; }
.ds-pattern-inbox__menu-quick [data-ds-icon],.ds-pattern-inbox__menu-quick svg { width:18px; height:18px; color:var(--brand-700); }
.ds-pattern-inbox__menu-quick:hover,.ds-pattern-inbox__menu-quick:focus-visible { color:var(--text); background:color-mix(in srgb,var(--pastel-sky) 45%,var(--surface)); outline:0; }
.ds-pattern-inbox__menu-item { display:flex; align-items:center; gap:10px; width:100%; min-height:30px; padding:0 8px; border:0; border-radius:8px; color:var(--text); background:transparent; cursor:pointer; font:inherit; font-size:13px; text-align:start; white-space:nowrap; }
.ds-pattern-inbox__menu-item:hover,.ds-pattern-inbox__menu-item:focus-visible { background:var(--surface-2); outline:0; }
.ds-pattern-inbox__menu-item svg { width:18px; height:18px; color:var(--text-muted); }
.ds-pattern-inbox__menu-item.is-danger { color:var(--stage-solid-red,#ef4444); }
.ds-pattern-inbox__menu-item.is-danger svg { color:currentColor; }
.ds-pattern-inbox__menu-sep { height:1px; margin:3px 8px; background:var(--border); }

/* ── Composer additions ────────────────────────────────────────────────── */
/* Four tracks: attach, text, emoji, send. «مهم» and «منتظر پاسخ» are ticked in the ＋ menu
 * (1405/08/03): while one is on, a fifth track beside the text box holds its marks. */
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer { grid-template-columns:auto minmax(0,1fr) auto auto; align-items:end; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer.has-flags { grid-template-columns:auto minmax(0,1fr) auto auto auto; }
/* A text-only answer (a personal bot conversation, 1405/08/01): the text box and «ارسال». */
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer.is-text-only { grid-template-columns:minmax(0,1fr) auto; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer > .ds-pattern-inbox__compose-context,
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer > .ds-pattern-inbox__attachments,
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer > .ds-pattern-inbox__compose-note { grid-column:1/-1; }
.ds-pattern-inbox__composer--icon-send > :is(.ds-pattern-inbox__attachments,.ds-pattern-inbox__compose-context) { grid-column:1/-1; }
/* Text-only composer (no attachments): textarea, emoji, send — e.g. the external guest page. */
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer--plain { grid-template-columns:minmax(0,1fr) auto auto; }
.ds-pattern-inbox__compose-context { display:flex; align-items:center; gap:10px; padding:4px 6px 6px; border-bottom:1px solid var(--border); }
.ds-pattern-inbox__compose-context[hidden],.ds-pattern-inbox__attachments[hidden],.ds-pattern-inbox__suggest[hidden],.ds-pattern-inbox__compose-note[hidden] { display:none; }
.ds-pattern-inbox__compose-context > [data-ds-icon],.ds-pattern-inbox__compose-context > svg { width:22px; height:22px; color:var(--brand-500); }
.ds-pattern-inbox__compose-copy { display:grid; flex:1; min-width:0; padding-inline-start:10px; border-inline-start:3px solid var(--brand-500); }
.ds-pattern-inbox__compose-copy strong { color:var(--brand-700); font-size:12px; }
.ds-pattern-inbox__compose-copy small { overflow:hidden; color:var(--text-muted); font-size:12px; text-overflow:ellipsis; white-space:nowrap; }
.ds-pattern-inbox__attachments { display:flex; flex-wrap:wrap; gap:6px; padding:2px 2px 6px; }
.ds-pattern-inbox__attachment { display:inline-flex; align-items:center; gap:8px; max-width:100%; min-height:36px; padding:0 4px 0 10px; border-radius:10px; background:var(--surface-2); font-size:12px; }
.ds-pattern-inbox__attachment strong { overflow:hidden; max-width:200px; direction:ltr; text-overflow:ellipsis; white-space:nowrap; }
.ds-pattern-inbox__attachment small { color:var(--text-muted); }
.ds-pattern-inbox__attachment > [data-ds-icon] { display:inline-flex; flex:0 0 18px; width:18px; height:18px; color:var(--brand-700); }
.ds-pattern-inbox__attachment > [data-ds-icon] svg { width:18px; height:18px; }
.ds-pattern-inbox__attachment.is-uploading small { color:var(--brand-700); }
.ds-pattern-inbox__attachment.is-error { background:color-mix(in srgb,var(--pastel-rose) 55%,var(--surface-2)); }
.ds-pattern-inbox__attachment.is-error small,.ds-pattern-inbox__attachment.is-error > [data-ds-icon] { color:var(--stage-solid-red,#ef4444); }
.ds-pattern-inbox__attachment.is-error small { white-space:normal; }
.ds-pattern-inbox__attachment .ds-pattern-inbox__icon-btn { flex-basis:28px; width:28px; height:28px; }
.ds-pattern-inbox__attachment .ds-pattern-inbox__icon-btn svg { width:16px; height:16px; }
/* Attachment review: owner-approved shared Telegram-like send sheet. */
.ds-pattern-inbox__review { display:grid; gap:var(--space-4,16px); min-width:0; }
.ds-pattern-inbox__review-list { display:grid; gap:var(--space-3,12px); }
.ds-pattern-inbox__review-item { overflow:hidden; min-width:0; border:1px solid var(--border); border-radius:var(--radius-lg,16px); background:var(--surface); }
.ds-pattern-inbox__review-image { display:block; width:100%; height:240px; object-fit:contain; background:var(--surface-2); }
.ds-pattern-inbox__review-file { display:grid; grid-template-columns:46px minmax(0,1fr) auto auto; align-items:center; gap:12px; min-width:0; padding:12px; }
.ds-pattern-inbox__review-file .ds-pattern-inbox__file-ext { flex:0 0 46px; }
.ds-pattern-inbox__review-file .ds-pattern-inbox__file-copy { flex:1; min-width:0; display:grid; gap:4px; }
.ds-pattern-inbox__review-file strong { font-size:13px; overflow-wrap:anywhere; white-space:normal; text-align:start; }
.ds-pattern-inbox__review-item.is-pdf .ds-pattern-inbox__file-ext { color:var(--stage-solid-red); background:var(--pastel-rose); }
.ds-pattern-inbox__review-item.is-archive .ds-pattern-inbox__file-ext { background:var(--pastel-lemon); }
.ds-pattern-inbox__review-file small { font-size:11px; color:var(--text-muted); overflow-wrap:anywhere; white-space:normal; overflow:visible; }
.ds-pattern-inbox__review-file .ds-pattern-inbox__icon-btn { flex:0 0 40px; width:40px; height:40px; }
.ds-pattern-inbox__review-item.is-error [data-ds-attachment-status] { color:var(--stage-solid-red); }
.ds-pattern-inbox__review-progress { display:block; width:100%; height:4px; border:0; border-radius:0; accent-color:var(--brand-600); background:var(--surface-2); }
.ds-pattern-inbox__review-progress[hidden] { display:none; }
.ds-pattern-inbox__review-progress::-webkit-progress-bar { background:var(--surface-2); }
.ds-pattern-inbox__review-progress::-webkit-progress-value { background:var(--brand-600); }
.ds-pattern-inbox__review-caption { resize:vertical; min-height:80px; }
/* The sender's own choices for one send (o.switches), e.g. «ذخیره در Google Drive». */
.ds-pattern-inbox__review-switches { display:grid; gap:var(--space-2,8px); }
.ds-modal.is-file-dragging { outline:3px dashed var(--brand-500); outline-offset:-4px; }
.ds-pattern-inbox__drop-overlay { position:absolute; inset:8px; z-index:12; display:grid; place-items:center; padding:16px; pointer-events:none; background:color-mix(in srgb,var(--surface) 88%,transparent); }
.ds-pattern-inbox__drop-overlay[hidden] { display:none; }
.ds-pattern-inbox__drop-overlay > .ds-pattern-upload__drop { max-width:420px; }
@media (max-width:600px) {
  .ds-pattern-inbox__review-image { height:180px; }
  .ds-pattern-inbox__review-file { gap:8px; padding:10px; }
}
.ds-pattern-inbox__compose-note { padding:4px 8px; color:var(--text-muted); font-size:12px; }
.ds-pattern-inbox__compose-note.is-warning { color:#7b5b18; }
.ds-pattern-inbox__composer > .ds-pattern-inbox__icon-btn { align-self:end; margin-block-end:4px; }
/* «مهم» and «منتظر پاسخ» of the message being written: a mark for each beside the text box
 * (its click removes the choice) and the text box in the colour of the choice. «مهم» uses the
 * amber of an important message, «منتظر پاسخ» the violet of the reply folder. */
.ds-pattern-inbox__compose-flags { display:flex; align-items:center; gap:4px; align-self:center; }
.ds-pattern-inbox__compose-flags[hidden] { display:none; }
.ds-pattern-inbox__compose-flag { display:inline-grid; flex:0 0 28px; width:28px; height:28px; padding:0; place-items:center; border:0; border-radius:50%; cursor:pointer; animation:dsInboxPop .24s cubic-bezier(.3,1.6,.5,1); }
.ds-pattern-inbox__compose-flag [data-ds-icon],.ds-pattern-inbox__compose-flag svg { width:16px; height:16px; }
.ds-pattern-inbox__compose-flag.is-important { color:#7b5b18; background:var(--pastel-lemon); box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--stage-solid-amber,#f59e0b) 45%,transparent); }
.ds-pattern-inbox__compose-flag.is-awaits { color:var(--brand-700); background:var(--pastel-lilac); box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--stage-solid-violet,#8b5cf6) 40%,transparent); }
.ds-pattern-inbox__compose-flag:hover,.ds-pattern-inbox__compose-flag:focus-visible { outline:0; box-shadow:0 0 0 2px var(--surface),0 0 0 4px color-mix(in srgb,var(--text) 22%,transparent); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer.is-flag-important textarea,
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer.is-flag-important textarea:focus { border-color:var(--stage-solid-amber,#f59e0b)!important; background:color-mix(in srgb,var(--pastel-lemon) 40%,var(--surface))!important; box-shadow:0 0 0 3px color-mix(in srgb,var(--pastel-lemon) 80%,transparent)!important; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer.is-flag-awaits textarea,
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer.is-flag-awaits textarea:focus { border-color:var(--stage-solid-violet,#8b5cf6)!important; background:color-mix(in srgb,var(--pastel-lilac) 35%,var(--surface))!important; box-shadow:0 0 0 3px color-mix(in srgb,var(--pastel-lilac) 80%,transparent)!important; }
/* Both: the amber frame of «مهم» and a violet ring of «منتظر پاسخ» around it. */
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer.is-flag-important.is-flag-awaits textarea,
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer.is-flag-important.is-flag-awaits textarea:focus { border-color:var(--stage-solid-amber,#f59e0b)!important; background:color-mix(in srgb,var(--pastel-lemon) 40%,var(--surface))!important; box-shadow:0 0 0 2px var(--surface),0 0 0 4px var(--stage-solid-violet,#8b5cf6)!important; }
/* A ＋ menu row ticked for the message being written. */
.ds-pattern-inbox__menu-check { display:none; margin-inline-start:auto; color:var(--brand-700); }
.ds-pattern-inbox__menu-item[aria-checked="true"] .ds-pattern-inbox__menu-check { display:inline-grid; }
.ds-pattern-inbox__menu-check [data-ds-icon],.ds-pattern-inbox__menu-item .ds-pattern-inbox__menu-check svg { width:18px; height:18px; color:currentColor; }
.ds-pattern-inbox__menu-item[aria-checked="true"] { font-weight:800; }
.ds-pattern-inbox__menu-item.is-important[aria-checked="true"] > [data-ds-icon] { color:#7b5b18; background:var(--pastel-lemon); }
.ds-pattern-inbox__menu-item.is-awaits[aria-checked="true"] > [data-ds-icon] { background:var(--pastel-lilac); }
.ds-pattern-inbox__suggest { position:absolute; z-index:5; inset-inline:12px; inset-block-end:calc(100% + 6px); max-height:260px; overflow-y:auto; padding:6px; border:1px solid var(--border); border-radius:14px; background:var(--surface); box-shadow:0 14px 34px color-mix(in srgb,var(--text) 14%,transparent); }
.ds-pattern-inbox__suggest-item { display:flex; align-items:center; gap:10px; width:100%; min-height:42px; padding:0 8px; border:0; border-radius:9px; color:var(--text); background:transparent; cursor:pointer; font:inherit; font-size:14px; text-align:start; }
.ds-pattern-inbox__suggest-item:hover,.ds-pattern-inbox__suggest-item:focus-visible,.ds-pattern-inbox__suggest-item.is-active { background:var(--surface-2); outline:0; }
.ds-pattern-inbox__suggest-item .ds-pattern-avatar { width:32px; height:32px; font-size:12px; }
.ds-pattern-inbox__suggest-empty { padding:10px; color:var(--text-muted); font-size:13px; }
.ds-pattern-inbox__emoji-group + .ds-pattern-inbox__emoji-group { margin-top:6px; }
.ds-pattern-inbox__emoji-label { padding:2px 6px; color:var(--text-muted); font-size:11px; font-weight:800; }
.ds-pattern-inbox__emoji-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(36px,1fr)); }
.ds-pattern-inbox__emoji-grid button { display:grid; height:36px; padding:0; place-items:center; border:0; border-radius:8px; background:transparent; cursor:pointer; font-size:21px; line-height:1; }
.ds-pattern-inbox__emoji-grid button:hover,.ds-pattern-inbox__emoji-grid button:focus-visible { background:var(--surface-2); outline:0; }

/* ── Info aside: members, media, files, audio ──────────────────────────── */
.ds-pattern-inbox__aside { display:none; flex-direction:column; min-width:0; min-height:0; overflow:hidden; border-inline-start:1px solid var(--border); background:var(--surface); }
.ds-pattern-inbox--messenger.is-aside-open > .ds-pattern-inbox__aside { display:flex; }
.ds-pattern-inbox__aside > header { display:flex; align-items:center; gap:6px; min-height:60px; padding:0 8px 0 14px; border-bottom:1px solid var(--border); }
.ds-pattern-inbox__aside > header strong { flex:1; min-width:0; font-size:15px; }
/* One scroll for the whole info aside (owner request 1405/08/03, like Telegram):
   the hero goes up until the tabs reach the top, the tabs stay there and only
   the list under them moves. The hero picture shrinks on the way and comes back
   small in the header («is-hero-collapsed»), the actions sit in the ⋮ menu. */
.ds-pattern-inbox__aside-more:empty { display:none; }
.ds-pattern-inbox__aside-mini { display:none; align-items:center; justify-content:flex-end; gap:8px; min-width:0; }
.ds-pattern-inbox__aside > header .ds-pattern-inbox__aside-mini strong { flex:0 1 auto; overflow:hidden; font-size:14px; text-overflow:ellipsis; white-space:nowrap; }
.ds-pattern-inbox__aside-mini .ds-pattern-avatar { flex:0 0 auto; width:32px; height:32px; font-size:12px; }
.ds-pattern-inbox__aside.is-hero-collapsed > header [data-chat-aside-title] { display:none; }
.ds-pattern-inbox__aside.is-hero-collapsed .ds-pattern-inbox__aside-mini { display:flex; flex:1; animation:dsInboxSwitch .2s ease; }
.ds-pattern-inbox__aside-scroll { position:relative; flex:1; min-height:0; overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; }
.ds-pattern-inbox__aside-hero { --chat-aside-progress:0; display:grid; justify-items:center; gap:4px; padding:18px 14px 12px; text-align:center; }
.ds-pattern-inbox__aside-hero .ds-pattern-avatar { width:72px; height:72px; font-size:22px; transform:translate(calc(var(--chat-aside-progress) * -40%),calc(var(--chat-aside-progress) * 30%)) scale(calc(1 - var(--chat-aside-progress) * .45)); opacity:calc(1 - var(--chat-aside-progress) * .7); transform-origin:center; }
.ds-pattern-inbox__aside-hero strong { font-size:16px; }
.ds-pattern-inbox__aside-hero small { color:var(--text-muted); font-size:12px; }
.ds-pattern-inbox__aside-hero p { margin:4px 0 0; color:var(--text-muted); font-size:13px; line-height:1.7; }
.ds-pattern-inbox__aside .ds-pattern-inbox__folders { position:sticky; z-index:5; top:0; margin:0; padding-inline:8px; background:var(--surface); scrollbar-width:none; }
.ds-pattern-inbox__aside .ds-pattern-inbox__folders::-webkit-scrollbar { display:none; }
.ds-pattern-inbox__aside .ds-pattern-inbox__folder { flex:0 0 auto; }
.ds-pattern-inbox__aside-body { padding:8px; }
.ds-pattern-inbox__aside.is-hero-collapsed .ds-pattern-inbox__aside-body { min-height:var(--chat-aside-fill, 0); }
.ds-pattern-inbox__aside-actions:empty,.ds-pattern-inbox__aside-actions[hidden] { display:none; }
@media (prefers-reduced-motion: reduce) { .ds-pattern-inbox__aside-hero .ds-pattern-avatar { transform:none; } }
.ds-pattern-inbox__aside-actions { display:grid; gap:2px; padding:4px 8px 8px; }
.ds-pattern-inbox__members { display:grid; gap:2px; margin:0; padding:0; list-style:none; }
.ds-pattern-inbox__member { display:flex; align-items:center; gap:10px; min-height:52px; padding:4px 6px; border-radius:10px; }
.ds-pattern-inbox__member:hover { background:var(--surface-2); }
.ds-pattern-inbox__member .ds-pattern-avatar { width:40px; height:40px; font-size:13px; }
.ds-pattern-inbox__member-copy { display:grid; flex:1; min-width:0; }
.ds-pattern-inbox__member-copy strong { overflow:hidden; font-size:14px; text-overflow:ellipsis; white-space:nowrap; }
.ds-pattern-inbox__member-copy small { color:var(--text-muted); font-size:12px; }
/* Multi-line row (owner approval 1405/07/30): a sentence (an agenda topic, a
   decision) wraps instead of being cut with «…»; names keep one line. */
.ds-pattern-inbox__member-copy.is-multiline strong { overflow:visible; line-height:1.6; text-overflow:clip; white-space:normal; overflow-wrap:anywhere; }
.ds-pattern-inbox__member-copy small.is-online { color:var(--brand-700); }
.ds-pattern-inbox__member .ds-pattern-inbox__icon-btn { flex-basis:32px; width:32px; height:32px; }
.ds-pattern-inbox__member .ds-pattern-inbox__icon-btn svg { width:18px; height:18px; }
.ds-pattern-inbox__gallery { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:3px; }
.ds-pattern-inbox__gallery-item { position:relative; display:grid; aspect-ratio:1; padding:0; place-items:center; overflow:hidden; border:0; border-radius:6px; color:var(--text-muted); background:var(--surface-2); cursor:pointer; }
.ds-pattern-inbox__gallery-item img { width:100%; height:100%; object-fit:cover; }
.ds-pattern-inbox__gallery-item.is-video { color:var(--surface); background:color-mix(in srgb,var(--text) 82%,var(--brand-700)); }
.ds-pattern-inbox__gallery-item svg { width:28px; height:28px; }
.ds-pattern-inbox__aside-empty { padding:24px 10px; color:var(--text-muted); font-size:13px; text-align:center; }
.ds-pattern-inbox__aside-body .ds-pattern-inbox__file { min-width:0; background:var(--surface-2); }
.ds-pattern-inbox__aside-body .ds-pattern-inbox__audio { margin-bottom:8px; padding:6px; border-radius:12px; background:var(--surface-2); }
.ds-pattern-inbox__readers-head { margin:6px 0 2px; color:var(--text-muted); font-size:12px; font-weight:800; }

/* Skeleton rows while the list loads (shimmer from ds-async-state). */
.ds-pattern-inbox__skeleton-row { display:grid; grid-template-columns:50px minmax(0,1fr); align-items:center; gap:10px; min-height:72px; padding:10px; }
.ds-pattern-inbox__skeleton-row .is-avatar { width:50px; height:50px; border-radius:50%; }
.ds-pattern-inbox__skeleton-row .is-title { width:60%; height:12px; }
.ds-pattern-inbox__skeleton-row .is-line { width:85%; height:10px; margin-top:8px; }

/* ── Mirrored arrows in RTL (reply, forward) ────────────────────────────── */
[dir="rtl"] .ds-pattern-inbox--messenger [data-ds-icon="reply"] svg,[dir="rtl"] .ds-pattern-inbox--messenger [data-ds-icon="shortcut"] svg,
[dir="rtl"] .ds-pattern-inbox__menu [data-ds-icon="reply"] svg,[dir="rtl"] .ds-pattern-inbox__menu [data-ds-icon="shortcut"] svg { transform:scaleX(-1); }

/* ── Finish: softer surfaces and bubble tails ──────────────────────────── */
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p { box-shadow:0 1px 1px color-mix(in srgb,var(--text) 8%,transparent),0 2px 8px color-mix(in srgb,var(--text) 5%,transparent); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-outgoing { background:linear-gradient(160deg,color-mix(in srgb,var(--pastel-mint) 90%,var(--surface)),color-mix(in srgb,var(--pastel-mint) 70%,var(--pastel-sky))); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p:not(.is-continued)::after { position:absolute; inset-block-end:0; width:10px; height:12px; content:""; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-incoming:not(.is-continued)::after { inset-inline-end:-6px; background:radial-gradient(circle at 100% 0,transparent 9px,var(--surface) 9.5px); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-outgoing:not(.is-continued)::after { inset-inline-start:-6px; background:radial-gradient(circle at 0 0,transparent 9px,color-mix(in srgb,var(--pastel-mint) 72%,var(--pastel-sky)) 9.5px); }
[dir="rtl"] .ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-incoming:not(.is-continued)::after { background:radial-gradient(circle at 0 0,transparent 9px,var(--surface) 9.5px); }
[dir="rtl"] .ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-outgoing:not(.is-continued)::after { background:radial-gradient(circle at 100% 0,transparent 9px,color-mix(in srgb,var(--pastel-mint) 72%,var(--pastel-sky)) 9.5px); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-deleted::after { display:none; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__thread { transition:background-color .2s ease,transform .2s cubic-bezier(.2,.8,.2,1),box-shadow .2s ease; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__thread:active { transform:scale(.985); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__thread.is-active { box-shadow:inset 3px 0 0 var(--brand-500)!important; }
[dir="rtl"] .ds-pattern-inbox--messenger .ds-pattern-inbox__thread.is-active { box-shadow:inset -3px 0 0 var(--brand-500)!important; }
.ds-pattern-inbox--messenger .ds-pattern-avatar { transition:transform .25s cubic-bezier(.2,.8,.2,1); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__thread:hover .ds-pattern-avatar { transform:scale(1.05); }
.ds-pattern-inbox__presence { animation:dsInboxPresence .4s cubic-bezier(.3,1.5,.6,1); }
.ds-pattern-inbox__icon-btn { transition:background-color .16s ease,color .16s ease,transform .16s cubic-bezier(.2,.8,.2,1); }
.ds-pattern-inbox__icon-btn:active:not(:disabled) { transform:scale(.9); }
.ds-pattern-inbox__reaction { transition:transform .16s cubic-bezier(.3,1.5,.6,1),background-color .16s ease,border-color .16s ease; }
.ds-pattern-inbox__reaction:hover { transform:translateY(-1px); }
.ds-pattern-inbox__reaction:active { transform:scale(.92); }

/* ── Pastel finish (owner feedback 1405/07/17): spaced bubbles, centred
 * icons, soft pastel buttons and badges. ───────────────────────────────── */
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages { gap:10px; padding-block:18px 26px; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-continued { margin-block-start:-6px; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p { padding:10px 14px 7px; border-radius:18px; line-height:1.85; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p[data-author] { padding-block-start:28px; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-incoming { border:1px solid color-mix(in srgb,var(--pastel-lilac) 55%,var(--border)); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-outgoing { border:1px solid color-mix(in srgb,var(--pastel-mint) 80%,var(--border)); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages time { margin-top:4px; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__day { margin:14px 0 6px!important; background:color-mix(in srgb,var(--pastel-sky) 55%,var(--surface))!important; color:var(--brand-700)!important; font-weight:700; }
/* Day labels all stick to the same place: only the newest stuck one shows (ds-inbox-messenger.js syncDayLabels). */
.ds-pattern-inbox__day.is-covered { visibility:hidden; }
/* Every icon sits in the exact centre of its button (sized here so pages without the panel's icon rules match). */
.ds-pattern-inbox--messenger .ds-pattern-avatar > [data-ds-icon],.ds-pattern-inbox--messenger .ds-pattern-avatar > [data-ds-icon] svg { width:22px; height:22px; }
.ds-pattern-inbox--messenger [data-ds-icon] > svg { max-width:100%; max-height:100%; }
.ds-pattern-inbox--messenger [data-ds-icon],.ds-pattern-inbox__menu [data-ds-icon] { display:inline-grid; place-items:center; line-height:0; }
.ds-pattern-inbox__icon-btn > [data-ds-icon],.ds-pattern-inbox__audio-play > [data-ds-icon],.ds-pattern-inbox__jump > [data-ds-icon],.ds-pattern-inbox__video-play > [data-ds-icon] { display:grid; width:22px; height:22px; margin:auto; place-items:center; }
.ds-pattern-inbox__icon-btn svg,.ds-pattern-inbox__audio-play svg,.ds-pattern-inbox__jump svg,.ds-pattern-inbox__video-play svg { display:block; margin:auto; }
/* Pastel buttons. */
.ds-pattern-inbox--messenger .ds-pattern-inbox__icon-btn,.ds-pattern-inbox__aside .ds-pattern-inbox__icon-btn { border-radius:14px; color:var(--brand-700); background:color-mix(in srgb,var(--pastel-sky) 38%,var(--surface)); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__icon-btn:hover:not(:disabled) { background:var(--pastel-sky); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__icon-btn.is-primary { color:var(--brand-700); background:var(--pastel-mint); box-shadow:0 6px 16px color-mix(in srgb,var(--pastel-mint) 70%,transparent); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__icon-btn.is-primary:hover { color:var(--brand-700); background:color-mix(in srgb,var(--pastel-mint) 80%,var(--brand-500)); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__icon-btn.is-on { background:var(--pastel-mint); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer > .ds-pattern-inbox__icon-btn { width:44px; height:44px; flex-basis:44px; margin-block-end:0; padding:0!important; background:color-mix(in srgb,var(--pastel-lilac) 45%,var(--surface)); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer > .ds-pattern-inbox__icon-btn:hover:not(:disabled) { background:var(--pastel-lilac); }
/* Attach, text box, emoji and send share one bottom line, also when the text box grows. */
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer { align-items:end; gap:8px; padding:10px 14px; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer textarea { min-height:44px; border:1px solid color-mix(in srgb,var(--pastel-sky) 70%,var(--border))!important; border-radius:16px!important; background:color-mix(in srgb,var(--pastel-sky) 14%,var(--surface))!important; transition:border-color .18s ease,box-shadow .18s ease; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer textarea:focus { border-color:var(--brand-500)!important; box-shadow:0 0 0 3px color-mix(in srgb,var(--pastel-mint) 70%,transparent)!important; }
/* Send: a round pastel button with the send icon (DsInboxSendFeedback keeps its states). */
/* Ticket composers (support desk, customer portal) reuse the same send button with ds-pattern-inbox__composer--icon-send, as a rounded square (owner request). */
:is(.ds-pattern-inbox--messenger .ds-pattern-inbox__composer,.ds-pattern-inbox__composer--icon-send) > button[type="submit"] { width:44px!important; min-width:44px!important; height:44px!important; border-radius:50%!important; color:var(--brand-700)!important; background:var(--pastel-mint)!important; box-shadow:0 6px 16px color-mix(in srgb,var(--pastel-mint) 80%,transparent)!important; }
:is(.ds-pattern-inbox--messenger .ds-pattern-inbox__composer,.ds-pattern-inbox__composer--icon-send) > button[type="submit"]:hover:not(:disabled) { background:color-mix(in srgb,var(--pastel-mint) 78%,var(--brand-500))!important; transform:scale(1.05); }
:is(.ds-pattern-inbox--messenger .ds-pattern-inbox__composer,.ds-pattern-inbox__composer--icon-send) > button[type="submit"] [data-send-label] { display:grid; width:22px; height:22px; place-items:center; }
:is(.ds-pattern-inbox--messenger .ds-pattern-inbox__composer,.ds-pattern-inbox__composer--icon-send) > button[type="submit"] [data-send-label] svg { width:22px; height:22px; }
[dir="rtl"] :is(.ds-pattern-inbox--messenger .ds-pattern-inbox__composer,.ds-pattern-inbox__composer--icon-send) > button[type="submit"] [data-send-label] svg { transform:scaleX(-1); }
.ds-pattern-inbox .ds-pattern-inbox__composer.ds-pattern-inbox__composer--icon-send > button[type="submit"] { border-radius:12px!important; }
.ds-pattern-inbox .ds-pattern-inbox__composer.ds-pattern-inbox__composer--icon-send > button[type="submit"]:not(.is-sending):not(.is-success):not(.is-error) { color:#fff!important; background:var(--brand-500)!important; box-shadow:0 6px 16px color-mix(in srgb,var(--brand-500) 32%,transparent)!important; }
.ds-pattern-inbox .ds-pattern-inbox__composer.ds-pattern-inbox__composer--icon-send > button[type="submit"]:not(.is-sending):not(.is-success):not(.is-error):hover:not(:disabled) { background:var(--brand-600)!important; }
/* «send» has a default tone in the icon set: on the solid button it stays white, centred in the square. */
.ds-pattern-inbox .ds-pattern-inbox__composer.ds-pattern-inbox__composer--icon-send > button[type="submit"] { display:grid!important; place-items:center; padding:0!important; }
.ds-pattern-inbox .ds-pattern-inbox__composer.ds-pattern-inbox__composer--icon-send > button[type="submit"] [data-send-label] :is(.ds-ico,.material-symbols-rounded,svg,svg *) { color:#fff!important; fill:#fff!important; }
.ds-pattern-inbox__composer--icon-send .ds-pattern-inbox__icon-btn[data-reply-attach],.ds-pattern-inbox__composer--icon-send .ds-pattern-inbox__icon-btn[data-sd-pick] { width:44px; height:44px; flex-basis:44px; border-radius:12px; color:var(--brand-600); background:color-mix(in srgb,var(--pastel-mint) 45%,var(--surface)); }
.ds-pattern-inbox__composer--icon-send .ds-pattern-inbox__icon-btn[data-reply-attach]:hover,.ds-pattern-inbox__composer--icon-send .ds-pattern-inbox__icon-btn[data-sd-pick]:hover { color:var(--brand-700); background:var(--pastel-mint); }
/* Ticket conversations: the sender's name is a lighter accent above darker text, as in Telegram. */
.ds-pattern-inbox--ticket .ds-pattern-inbox__messages > p::before { color:color-mix(in srgb,var(--brand-500) 80%,var(--text-muted)); font-weight:700; }
.ds-pattern-inbox--ticket .ds-pattern-inbox__messages > p.is-incoming::before { color:var(--stage-solid-blue,#3b82f6); }
.ds-pattern-inbox--ticket .ds-pattern-inbox__messages > p[data-message-id],.ds-pattern-inbox--ticket .ds-pattern-inbox__messages > p[data-sd-message-id] { position:relative; }
.ds-pattern-inbox--ticket .ds-pattern-inbox__messages > p.is-deleted { color:var(--text-muted); font-style:italic; }
@media (hover:none) { .ds-pattern-inbox--ticket .ds-pattern-inbox__bubble-more { opacity:1; } }
:is(.ds-pattern-inbox--messenger .ds-pattern-inbox__composer,.ds-pattern-inbox__composer--icon-send) > button[type="submit"].is-sending { color:#fff!important; background:var(--stage-solid-blue,#3b82f6)!important; }
:is(.ds-pattern-inbox--messenger .ds-pattern-inbox__composer,.ds-pattern-inbox__composer--icon-send) > button[type="submit"].is-success { color:#fff!important; background:var(--stage-solid-green,#22c55e)!important; }
:is(.ds-pattern-inbox--messenger .ds-pattern-inbox__composer,.ds-pattern-inbox__composer--icon-send) > button[type="submit"].is-error { color:#fff!important; background:var(--stage-solid-red,#ef4444)!important; }
/* Pastel badges, chips and the jump button. */
.ds-pattern-inbox__unread { color:var(--brand-700); background:var(--pastel-mint); box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--brand-500) 25%,transparent); }
.ds-pattern-inbox__unread.is-muted { color:var(--text-muted); background:var(--surface-2); box-shadow:inset 0 0 0 1px var(--border); }
.ds-pattern-inbox__unread.is-mention { color:#7b5b18; background:var(--pastel-lemon); box-shadow:inset 0 0 0 1px color-mix(in srgb,#f0c35d 45%,transparent); }
.ds-pattern-inbox__folder-count { color:var(--brand-700); background:var(--pastel-sky); }
.ds-pattern-inbox__folder[aria-selected="true"] .ds-pattern-inbox__folder-count { color:var(--brand-700); background:var(--pastel-mint); }
.ds-pattern-inbox__folder[aria-selected="true"] { background:color-mix(in srgb,var(--pastel-mint) 45%,transparent); }
.ds-pattern-inbox__jump { color:var(--brand-700); background:var(--pastel-sky); }
.ds-pattern-inbox__jump-count { color:var(--brand-700); background:var(--pastel-mint); box-shadow:0 0 0 2px var(--surface); }
.ds-pattern-inbox__audio-play { color:var(--brand-700); background:var(--pastel-mint); }
.ds-pattern-inbox__reply { background:color-mix(in srgb,var(--pastel-lilac) 40%,transparent); }
.ds-pattern-inbox__menu-item:hover,.ds-pattern-inbox__menu-item:focus-visible { background:color-mix(in srgb,var(--pastel-sky) 45%,var(--surface)); }
.ds-pattern-inbox__menu-item > [data-ds-icon] { display:grid; width:22px; height:22px; flex:0 0 22px; place-items:center; border-radius:6px; color:var(--brand-700); background:transparent; }
.ds-pattern-inbox__menu-item.is-danger > [data-ds-icon] { color:#9c3f50; }
.ds-pattern-inbox__menu-item > [data-ds-icon] svg { width:18px; height:18px; }

/* «مهم»: a soft lemon frame and a pastel tag instead of an amber bar (owner feedback). */
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-important { border-color:color-mix(in srgb,#f0c35d 55%,var(--pastel-lemon)); box-shadow:0 0 0 3px color-mix(in srgb,var(--pastel-lemon) 75%,transparent),0 2px 8px color-mix(in srgb,var(--text) 5%,transparent); }
.ds-pattern-inbox__meta-tag.is-important { display:inline-flex; align-items:center; padding:1px 8px; border-radius:999px; color:#7b5b18; background:var(--pastel-lemon); font-weight:800; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-mentioned { background:color-mix(in srgb,var(--pastel-lilac) 45%,var(--surface)); border-color:color-mix(in srgb,var(--pastel-lilac) 90%,var(--brand-500)); }

/* The page may keep a floating button over the bottom corner: the composer
 * leaves room for it through --ds-inbox-composer-end (set by the consumer). */
.ds-pattern-inbox--messenger .ds-pattern-inbox__composer { padding-inline-end:calc(14px + var(--ds-inbox-composer-end,0px)); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__jump { inset-inline-start:calc(18px + var(--ds-inbox-composer-end,0px)); }
/* The «مهم» switch keeps its own size inside the note row. */
.ds-pattern-inbox__compose-note { display:flex; flex-wrap:wrap; align-items:center; gap:6px 14px; padding:0 6px 2px; }
.ds-pattern-inbox__compose-note > .ds-switch { flex:0 0 auto; width:auto; }
/* The narrow-screen min-width of the plain pattern never applies to the messenger. */
.ds-pattern-inbox--messenger { min-width:0; }

/* ── Design pass 2 (owner feedback 1405/07/17): clean, light bubbles like
 * Telegram's day theme, a clear file badge, calm reply quotes. ───────────── */
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages { background:radial-gradient(circle at 18px 18px,color-mix(in srgb,var(--brand-500) 6%,transparent) 1.2px,transparent 1.4px) 0 0/30px 30px,linear-gradient(165deg,color-mix(in srgb,var(--pastel-sky) 30%,var(--surface)),color-mix(in srgb,var(--pastel-mint) 22%,var(--surface)) 55%,color-mix(in srgb,var(--pastel-lilac) 22%,var(--surface))); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p { border:0; color:var(--text); box-shadow:0 1px 1.5px color-mix(in srgb,var(--text) 10%,transparent); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-incoming,.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-outgoing { border:0; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-incoming { background:var(--surface); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-outgoing { background:color-mix(in srgb,var(--pastel-mint) 48%,var(--surface)); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-incoming:not(.is-continued)::after { background:radial-gradient(circle at 100% 0,transparent 9px,var(--surface) 9.5px); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-outgoing:not(.is-continued)::after { background:radial-gradient(circle at 0 0,transparent 9px,color-mix(in srgb,var(--pastel-mint) 48%,var(--surface)) 9.5px); }
[dir="rtl"] .ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-incoming:not(.is-continued)::after { background:radial-gradient(circle at 0 0,transparent 9px,var(--surface) 9.5px); }
[dir="rtl"] .ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-outgoing:not(.is-continued)::after { background:radial-gradient(circle at 100% 0,transparent 9px,color-mix(in srgb,var(--pastel-mint) 48%,var(--surface)) 9.5px); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-mentioned { background:color-mix(in srgb,var(--pastel-lilac) 40%,var(--surface)); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p::before { color:var(--brand-600); font-weight:800; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages time { color:color-mix(in srgb,var(--text-muted) 85%,var(--brand-500)); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__receipt.is-read { color:var(--brand-500); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__reply { padding:5px 10px; border-inline-start:3px solid var(--brand-500); border-radius:8px; background:color-mix(in srgb,var(--brand-500) 7%,transparent); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__reply strong { color:var(--brand-600); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__forwarded { color:var(--brand-600); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__reaction { border:1px solid color-mix(in srgb,var(--brand-500) 18%,transparent); background:color-mix(in srgb,var(--surface) 70%,var(--pastel-sky)); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__reaction.is-mine { border-color:var(--brand-500); background:color-mix(in srgb,var(--pastel-mint) 70%,var(--surface)); }
/* File card: a light card with a clear, centred badge of the file's type. */
.ds-pattern-inbox--messenger .ds-pattern-inbox__file { grid-template-columns:46px minmax(0,1fr) 32px; gap:10px; min-width:min(260px,100%); margin:0 0 6px; padding:8px 10px 8px 8px; border:1px solid color-mix(in srgb,var(--border) 70%,transparent); border-radius:14px; background:color-mix(in srgb,var(--surface) 88%,transparent); }
.ds-pattern-inbox__file-ext { display:grid; width:46px; height:46px; place-items:center; border-radius:13px; color:#285b80; background:var(--pastel-sky); font-size:11px; font-weight:900; letter-spacing:.3px; line-height:1; direction:ltr; }
.ds-pattern-inbox__file.is-pdf .ds-pattern-inbox__file-ext { color:#9c3f50; background:var(--pastel-rose); }
.ds-pattern-inbox__file.is-archive .ds-pattern-inbox__file-ext { color:#7b5b18; background:var(--pastel-lemon); }
.ds-pattern-inbox__file.is-document .ds-pattern-inbox__file-ext { color:#285b80; background:var(--pastel-sky); }
/* A Google Drive link (chat-drive.js): the same card, its own tile colour, its actions under it. */
.ds-pattern-inbox__drive { display:grid; gap:4px; margin:0 0 6px; min-width:0; }
.ds-pattern-inbox__drive > .ds-pattern-inbox__file { margin:0; }
.ds-pattern-inbox__file.is-drive .ds-pattern-inbox__file-ext { color:var(--brand-700); background:var(--pastel-mint); }
.ds-pattern-inbox__file-download { display:grid; width:32px; height:32px; place-items:center; border-radius:50%; color:var(--brand-700); background:color-mix(in srgb,var(--pastel-mint) 60%,var(--surface)); }
.ds-pattern-inbox__file-download > [data-ds-icon],.ds-pattern-inbox__file-download svg { display:block; width:18px; height:18px; margin:auto; }
.ds-pattern-inbox__file.is-fetching .ds-pattern-inbox__file-download { position:relative; background:conic-gradient(var(--brand-500) var(--ds-file-progress,0deg),color-mix(in srgb,var(--brand-500) 18%,var(--surface)) 0); }
.ds-pattern-inbox__file.is-fetching .ds-pattern-inbox__file-download::before { position:absolute; inset:4px; border-radius:50%; background:var(--surface); content:""; }
.ds-pattern-inbox__file.is-fetching .ds-pattern-inbox__file-download > [data-ds-icon] { position:relative; z-index:1; width:14px; height:14px; }
.ds-pattern-inbox__file.is-fetching .ds-pattern-inbox__file-download.is-indeterminate { animation:dsInboxFileProgress 1s linear infinite; }
@keyframes dsInboxFileProgress { to { transform:rotate(1turn); } }
@media (prefers-reduced-motion:reduce) { .ds-pattern-inbox__file.is-fetching .ds-pattern-inbox__file-download.is-indeterminate { animation:none; } }
.ds-pattern-inbox--messenger .ds-pattern-inbox__file-copy strong { font-size:13px; }
/* Image and video tiles sit flush in the bubble with rounded corners. */
.ds-pattern-inbox--messenger .ds-pattern-inbox__media { margin:-4px -8px 6px; border-radius:14px; box-shadow:none; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__audio { padding:4px 2px; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__audio-play { width:42px; height:42px; color:var(--surface); background:var(--brand-500); box-shadow:0 4px 10px color-mix(in srgb,var(--brand-500) 30%,transparent); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__audio-track { height:5px; background:color-mix(in srgb,var(--brand-500) 18%,transparent); }
/* Header and list: lighter and calmer. */
.ds-pattern-inbox--messenger .ds-pattern-inbox__conversation > header { background:var(--surface); box-shadow:0 1px 0 var(--border); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__pinned { background:color-mix(in srgb,var(--surface) 92%,var(--pastel-mint)); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__thread.is-active { background:color-mix(in srgb,var(--pastel-mint) 55%,var(--surface))!important; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__thread:hover:not(.is-active) { background:color-mix(in srgb,var(--pastel-sky) 25%,var(--surface))!important; }

/* ── Chosen look «سفید ساده» (owner choice E, 1405/07/17): a plain light
 * background, very light outgoing bubbles and a hairline ring on every bubble. */
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages { background:var(--surface-2); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p { box-shadow:0 0 0 1px color-mix(in srgb,var(--border) 80%,transparent); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-outgoing { background:color-mix(in srgb,var(--pastel-mint) 35%,var(--surface)); }
[dir="rtl"] .ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-outgoing:not(.is-continued)::after { background:radial-gradient(circle at 100% 0,transparent 9px,color-mix(in srgb,var(--pastel-mint) 35%,var(--surface)) 9.5px); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-outgoing:not(.is-continued)::after { background:radial-gradient(circle at 0 0,transparent 9px,color-mix(in srgb,var(--pastel-mint) 35%,var(--surface)) 9.5px); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-important { box-shadow:0 0 0 1px color-mix(in srgb,#f0c35d 55%,var(--pastel-lemon)),0 0 0 4px color-mix(in srgb,var(--pastel-lemon) 70%,transparent); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__thread.is-active { background:var(--surface-2)!important; }

/* ── Motion: every move is short, eased and only on things that change ──── */
/* New bubbles rise in from their own side; the first paint of a conversation fades in once. */
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-new { animation:dsInboxBubbleIn .32s cubic-bezier(.2,.9,.25,1.1); transform-origin:bottom right; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-new.is-outgoing { transform-origin:bottom left; }
[dir="rtl"] .ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-new { transform-origin:bottom left; }
[dir="rtl"] .ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-new.is-outgoing { transform-origin:bottom right; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p:not(.is-new) { animation:none; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages.is-switching { animation:dsInboxSwitch .28s ease; }
.ds-pattern-inbox__reactions .ds-pattern-inbox__reaction.is-new { animation:dsInboxPop .34s cubic-bezier(.3,1.6,.5,1); }
.ds-pattern-inbox__unread { animation:dsInboxPop .3s cubic-bezier(.3,1.6,.5,1); }
.ds-pattern-inbox__menu { transform-origin:top right; animation:dsInboxMenuIn .18s cubic-bezier(.2,.9,.3,1.15); }
[dir="rtl"] .ds-pattern-inbox__menu { transform-origin:top left; }
.ds-pattern-inbox__menu-reactions button { animation:dsInboxPop .3s cubic-bezier(.3,1.6,.5,1); }
.ds-pattern-inbox__menu-reactions button:nth-child(2) { animation-delay:.02s; } .ds-pattern-inbox__menu-reactions button:nth-child(3) { animation-delay:.04s; }
.ds-pattern-inbox__menu-reactions button:nth-child(4) { animation-delay:.06s; } .ds-pattern-inbox__menu-reactions button:nth-child(5) { animation-delay:.08s; }
.ds-pattern-inbox__menu-reactions button:nth-child(6) { animation-delay:.1s; } .ds-pattern-inbox__menu-reactions button:nth-child(7) { animation-delay:.12s; }
.ds-pattern-inbox__jump:not([hidden]) { animation:dsInboxPop .26s cubic-bezier(.3,1.5,.6,1); }
.ds-pattern-inbox__jump { transition:transform .16s ease,box-shadow .16s ease; }
.ds-pattern-inbox__jump:hover { transform:translateY(-2px); box-shadow:0 8px 20px color-mix(in srgb,var(--text) 20%,transparent); }
.ds-pattern-inbox__pinned:not([hidden]),.ds-pattern-inbox__compose-context:not([hidden]),.ds-pattern-inbox__attachments:not([hidden]),.ds-pattern-inbox__compose-note:not([hidden]) { animation:dsInboxSlideDown .22s cubic-bezier(.2,.8,.2,1); }
.ds-pattern-inbox__suggest:not([hidden]) { transform-origin:bottom center; animation:dsInboxMenuIn .18s cubic-bezier(.2,.9,.3,1.15); }
.ds-pattern-inbox__attachment { animation:dsInboxPop .26s cubic-bezier(.3,1.5,.6,1); }
.ds-pattern-inbox__attachment.is-uploading { background:linear-gradient(90deg,var(--surface-2) 0%,color-mix(in srgb,var(--pastel-sky) 50%,var(--surface-2)) 50%,var(--surface-2) 100%) 0 0/200% 100%; animation:dsInboxPop .26s cubic-bezier(.3,1.5,.6,1),dsInboxShimmer 1.4s linear infinite; }
.ds-pattern-inbox--messenger.is-aside-open > .ds-pattern-inbox__aside { animation:dsInboxAsideIn .28s cubic-bezier(.2,.8,.2,1); }
.ds-pattern-inbox__aside-body > * { animation:dsInboxSwitch .24s ease; }
.ds-pattern-inbox__gallery-item { transition:transform .2s cubic-bezier(.2,.8,.2,1),filter .2s ease; }
.ds-pattern-inbox__gallery-item:hover { transform:scale(1.03); filter:brightness(1.05); }
.ds-pattern-inbox--messenger .ds-pattern-inbox__media img,.ds-pattern-inbox__video { transition:transform .25s cubic-bezier(.2,.8,.2,1),filter .25s ease; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__media:hover img { transform:scale(1.03); }
.ds-pattern-inbox__video:hover .ds-pattern-inbox__video-play { transform:scale(1.1); }
.ds-pattern-inbox__video-play { transition:transform .2s cubic-bezier(.3,1.5,.6,1); }
.ds-pattern-inbox__audio-track > i { transition:width .2s linear; }
.ds-pattern-inbox__audio-play { transition:transform .16s cubic-bezier(.3,1.5,.6,1); }
.ds-pattern-inbox__audio-play:active { transform:scale(.9); }
.ds-pattern-inbox__folder::after { transition:inset .25s cubic-bezier(.2,.8,.2,1); }
.ds-pattern-inbox__folder[aria-selected="true"]::after { animation:dsInboxTabIn .25s cubic-bezier(.2,.8,.2,1); }
/* Rows animate only when they are new or changed (DsInboxMessenger.reconcileList), never on a plain refresh. */
.ds-pattern-inbox__threads > .ds-pattern-inbox__thread.is-entering { animation:dsInboxSwitch .22s ease; }
.ds-pattern-inbox__threads > .ds-pattern-inbox__thread.is-changed:not(.is-active) { animation:dsInboxRowChanged .9s ease; }
@media (max-width:800px) {
  .ds-pattern-inbox--messenger.is-chat-open > .ds-pattern-inbox__conversation { animation:dsInboxPushIn .28s cubic-bezier(.2,.8,.2,1); }
  .ds-pattern-inbox--messenger:not(.is-chat-open) > .ds-pattern-inbox__list { animation:dsInboxSwitch .24s ease; }
}
@keyframes dsInboxTyping { 0%,60%,100% { opacity:.3; transform:translateY(0); } 30% { opacity:1; transform:translateY(-2px); } }
@keyframes dsInboxBump { 50% { transform:scale(1.2); } }
@keyframes dsInboxFlash { 0%,100% { box-shadow:0 1px 2px color-mix(in srgb,var(--text) 12%,transparent); } 25%,60% { box-shadow:0 0 0 3px color-mix(in srgb,var(--brand-500) 45%,transparent); } }
@keyframes dsInboxBubbleIn { from { opacity:0; transform:translateY(10px) scale(.94); } to { opacity:1; transform:none; } }
@keyframes dsInboxRowChanged { from { background-color:color-mix(in srgb,var(--pastel-sky) 45%,var(--surface)); } to { background-color:transparent; } }
@keyframes dsInboxSwitch { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:none; } }
@keyframes dsInboxPop { from { opacity:0; transform:scale(.6); } to { opacity:1; transform:none; } }
@keyframes dsInboxMenuIn { from { opacity:0; transform:scale(.88); } to { opacity:1; transform:none; } }
@keyframes dsInboxSlideDown { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
@keyframes dsInboxAsideIn { from { opacity:0; transform:translateX(-16px); } to { opacity:1; transform:none; } }
@keyframes dsInboxPushIn { from { opacity:.4; transform:translateX(-24px); } to { opacity:1; transform:none; } }
@keyframes dsInboxTabIn { from { transform:scaleX(.3); opacity:0; } to { transform:none; opacity:1; } }
@keyframes dsInboxShimmer { to { background-position:-200% 0; } }
@keyframes dsInboxPresence { from { transform:scale(0); } to { transform:none; } }
/* ── Animated emoji (owner request 1405/07/25): one to three emoji alone are
 * shown large with no bubble and keep moving, each in its own way (Telegram).
 * Built by DsInboxMessenger.bigEmojiHtml(); a click plays it once more. */
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-emoji { min-width:0; padding:2px 4px 0; border:0; background:transparent; box-shadow:none; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-emoji::after { display:none; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-emoji[data-author] { padding-block-start:26px; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-emoji[data-author]::before { inset-block-start:2px; inset-inline-start:4px; padding:1px 8px; border-radius:999px; background:color-mix(in srgb,var(--surface) 88%,transparent); box-shadow:0 0 0 1px color-mix(in srgb,var(--border) 80%,transparent); white-space:nowrap; }
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p.is-emoji > time { width:fit-content; margin-inline-start:auto; padding:1px 8px; border-radius:999px; background:color-mix(in srgb,var(--surface) 88%,transparent); box-shadow:0 0 0 1px color-mix(in srgb,var(--border) 80%,transparent); }
.ds-pattern-inbox__big-emoji { display:flex; gap:4px; align-items:flex-end; padding:4px 2px 2px; font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif; line-height:1.15; user-select:text; }
.ds-pattern-inbox__big-emoji.is-count-1 { font-size:68px; }
.ds-pattern-inbox__big-emoji.is-count-2 { font-size:52px; }
.ds-pattern-inbox__big-emoji.is-count-3 { font-size:44px; }
.ds-pattern-inbox__emoji-anim { display:inline-block; cursor:pointer; transform-origin:50% 85%; filter:drop-shadow(0 4px 6px color-mix(in srgb,var(--text) 14%,transparent)); animation:2.8s cubic-bezier(.4,0,.3,1) var(--ds-emoji-delay,0s) infinite both; will-change:transform; }
.ds-pattern-inbox__emoji-anim.is-bounce { animation-name:dsEmojiBounce; }
.ds-pattern-inbox__emoji-anim.is-beat { animation-name:dsEmojiBeat; }
.ds-pattern-inbox__emoji-anim.is-wave { animation-name:dsEmojiWave; transform-origin:75% 90%; }
.ds-pattern-inbox__emoji-anim.is-laugh { animation-name:dsEmojiLaugh; }
.ds-pattern-inbox__emoji-anim.is-pop { animation-name:dsEmojiPop; }
.ds-pattern-inbox__emoji-anim.is-flicker { animation-name:dsEmojiFlicker; animation-duration:1.6s; transform-origin:50% 100%; }
.ds-pattern-inbox__emoji-anim.is-fly { animation-name:dsEmojiFly; animation-duration:3.2s; }
.ds-pattern-inbox__emoji-anim.is-twinkle { animation-name:dsEmojiTwinkle; transform-origin:50% 50%; }
.ds-pattern-inbox__emoji-anim.is-nod { animation-name:dsEmojiNod; }
.ds-pattern-inbox__emoji-anim.is-shake { animation-name:dsEmojiShake; }
.ds-pattern-inbox__emoji-anim.is-sad { animation-name:dsEmojiSad; animation-duration:3.2s; }
.ds-pattern-inbox__emoji-anim.is-spin { animation-name:dsEmojiSpin; transform-origin:50% 50%; }
.ds-pattern-inbox__emoji-anim.is-clap { animation-name:dsEmojiClap; }
.ds-pattern-inbox__emoji-anim.is-pray { animation-name:dsEmojiPray; }
.ds-pattern-inbox__emoji-anim.is-look { animation-name:dsEmojiLook; }
.ds-pattern-inbox__emoji-anim.is-sway { animation-name:dsEmojiSway; transform-origin:50% 100%; }
.ds-pattern-inbox__emoji-anim.is-burst { animation:dsEmojiBurst .75s cubic-bezier(.3,1.6,.5,1) 1; }
/* The real animation (Noto Lottie) replaces the glyph and its CSS motion once loaded. */
.ds-pattern-inbox__emoji-glyph { display:inline-block; }
.ds-pattern-inbox__emoji-lottie { display:none; width:1.2em; height:1.2em; }
.ds-pattern-inbox__emoji-lottie > svg { display:block; }
.ds-pattern-inbox__emoji-anim.is-lottie { filter:none; }
.ds-pattern-inbox__emoji-anim.is-lottie:not(.is-burst) { animation:none; }
.ds-pattern-inbox__emoji-anim.is-lottie > .ds-pattern-inbox__emoji-glyph { display:none; }
.ds-pattern-inbox__emoji-anim.is-lottie > .ds-pattern-inbox__emoji-lottie { display:block; }
@keyframes dsEmojiBounce { 0%,48%,100% { transform:none; } 12% { transform:translateY(-16%) scale(1.04,.96); } 24% { transform:translateY(0) scale(1.08,.9); } 34% { transform:translateY(-6%); } }
@keyframes dsEmojiBeat { 0%,56%,100% { transform:none; } 10% { transform:scale(1.22); } 20% { transform:scale(.96); } 30% { transform:scale(1.16); } 42% { transform:scale(1); } }
@keyframes dsEmojiWave { 0%,62%,100% { transform:none; } 8% { transform:rotate(18deg); } 18% { transform:rotate(-10deg); } 28% { transform:rotate(16deg); } 38% { transform:rotate(-6deg); } 48% { transform:rotate(10deg); } }
@keyframes dsEmojiLaugh { 0%,58%,100% { transform:none; } 8%,24%,40% { transform:translateY(-6%) rotate(-8deg) scale(1.06); } 16%,32%,48% { transform:translateY(0) rotate(8deg) scale(1.02); } }
@keyframes dsEmojiPop { 0%,60%,100% { transform:none; } 10% { transform:scale(.8) rotate(-10deg); } 22% { transform:scale(1.28) rotate(12deg); } 34% { transform:scale(.96) rotate(-4deg); } 46% { transform:scale(1.04); } }
@keyframes dsEmojiFlicker { 0%,100% { transform:none; } 20% { transform:scale(1.04,1.1) skewX(-3deg); } 40% { transform:scale(.98,.94) skewX(2deg); } 60% { transform:scale(1.03,1.08) skewX(3deg); } 80% { transform:scale(1,.97) skewX(-1deg); } }
@keyframes dsEmojiFly { 0%,70%,100% { transform:none; opacity:1; } 10% { transform:translate(-4%,6%) rotate(-6deg); } 30% { transform:translate(60%,-90%) rotate(8deg) scale(.7); opacity:0; } 31% { transform:translate(-60%,90%) scale(.7); opacity:0; } 50% { transform:translate(-6%,8%); opacity:1; } }
@keyframes dsEmojiTwinkle { 0%,56%,100% { transform:none; opacity:1; } 14% { transform:rotate(-18deg) scale(1.2); opacity:.85; } 28% { transform:rotate(14deg) scale(.94); opacity:1; } 42% { transform:rotate(-4deg) scale(1.06); } }
@keyframes dsEmojiNod { 0%,56%,100% { transform:none; } 12% { transform:translateY(-12%) rotate(-12deg); } 24% { transform:translateY(2%) rotate(4deg); } 36% { transform:translateY(-8%) rotate(-8deg); } 46% { transform:none; } }
@keyframes dsEmojiShake { 0%,52%,100% { transform:none; } 6%,18%,30% { transform:translateX(-7%) rotate(-5deg); } 12%,24%,36% { transform:translateX(7%) rotate(5deg); } 44% { transform:translateX(-2%); } }
@keyframes dsEmojiSad { 0%,64%,100% { transform:none; } 20% { transform:translateY(5%) scale(1.02,.96) rotate(-4deg); } 40% { transform:translateY(5%) scale(1.02,.96) rotate(4deg); } }
@keyframes dsEmojiSpin { 0%,40% { transform:none; } 60%,100% { transform:rotate(180deg); } }
@keyframes dsEmojiClap { 0%,56%,100% { transform:none; } 8%,24%,40% { transform:scale(.84,1.04); } 16%,32%,48% { transform:scale(1.08,.98); } }
@keyframes dsEmojiPray { 0%,60%,100% { transform:none; } 15% { transform:translateY(-8%) scale(1.06); } 30% { transform:translateY(0) scale(.98); } 45% { transform:translateY(-5%) scale(1.03); } }
@keyframes dsEmojiLook { 0%,10%,90%,100% { transform:none; } 25%,40% { transform:translateX(-8%) rotate(-4deg); } 55%,70% { transform:translateX(8%) rotate(4deg); } }
@keyframes dsEmojiSway { 0%,100% { transform:rotate(-7deg); } 50% { transform:rotate(7deg); } }
@keyframes dsEmojiBurst { 0% { transform:none; } 35% { transform:scale(1.45) rotate(-8deg); } 65% { transform:scale(.92) rotate(5deg); } 100% { transform:none; } }
/* ── Reply connector (owner request 1405/07/25): a line from the selected reply
 * to the message it answers, in the gutter on the reply's side, with a light
 * travelling from the reply to the original. DsInboxMessenger.bindReplyLinks(). */
.ds-pattern-inbox--messenger .ds-pattern-inbox__messages { position:relative; }
.ds-pattern-inbox__reply-link { position:absolute; top:0; left:0; z-index:2; overflow:visible; pointer-events:none; }
.ds-pattern-inbox__reply-link path { fill:none; stroke-linecap:round; stroke-linejoin:round; }
/* A neon tube in the side colour (brand for own replies, violet for others): a bright core and a wide glow. */
.ds-pattern-inbox__reply-link { --ds-reply-led:var(--brand-500); }
.ds-pattern-inbox__reply-link.is-start { --ds-reply-led:var(--stage-solid-violet,#8b5cf6); }
.ds-pattern-inbox__reply-link-line { stroke:color-mix(in srgb,var(--ds-reply-led) 35%,var(--surface)); stroke-width:2.5; filter:drop-shadow(0 0 1.5px var(--ds-reply-led)) drop-shadow(0 0 4px var(--ds-reply-led)) drop-shadow(0 0 10px color-mix(in srgb,var(--ds-reply-led) 70%,transparent)); }
.ds-pattern-inbox__reply-link.is-open .ds-pattern-inbox__reply-link-line { stroke-dasharray:4 5; }
/* The travelling flare: a wide halo, a glow and a white-hot core. */
.ds-pattern-inbox__reply-link-light.is-halo { stroke:color-mix(in srgb,var(--ds-reply-led) 55%,transparent); stroke-width:14; filter:blur(4px); }
.ds-pattern-inbox__reply-link-light.is-glow { stroke:color-mix(in srgb,var(--ds-reply-led) 30%,var(--surface)); stroke-width:6; filter:blur(1.5px); }
.ds-pattern-inbox__reply-link-light.is-core { stroke:var(--surface); stroke-width:3; }
.ds-pattern-inbox__reply-link-dot { fill:var(--surface); stroke:var(--ds-reply-led); stroke-width:2.5; pointer-events:auto; cursor:pointer; }
.ds-pattern-inbox__reply-nav { position:absolute; z-index:5; left:50%; display:flex; gap:6px; transform:translateX(-50%); animation:dsInboxPop .22s cubic-bezier(.3,1.5,.6,1); }
.ds-pattern-inbox__reply-nav[hidden],.ds-pattern-inbox__reply-nav > [hidden] { display:none; }
.ds-pattern-inbox__reply-nav > button { display:inline-flex; gap:6px; align-items:center; height:32px; padding:0 12px; border:0; border-radius:999px; color:var(--brand-700); background:var(--surface); box-shadow:0 4px 14px color-mix(in srgb,var(--text) 16%,transparent); font:inherit; font-size:12px; font-weight:700; cursor:pointer; }
.ds-pattern-inbox__reply-nav > button:hover,.ds-pattern-inbox__reply-nav > button:focus-visible { background:var(--pastel-sky); outline:0; }
.ds-pattern-inbox__reply-nav > button [data-ds-icon] { width:16px; height:16px; }
@media (prefers-reduced-motion:reduce) {
  .ds-pattern-inbox__emoji-anim { animation:none!important; }
  .ds-pattern-inbox__reply-link-light { animation:none!important; }
  .ds-pattern-inbox--messenger *,.ds-pattern-inbox__menu,.ds-pattern-inbox__menu * { animation:none!important; transition:none!important; }
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width:1180px) {
  .ds-pattern-inbox--messenger.is-aside-open { grid-template-columns:minmax(270px,320px) minmax(0,1fr); }
  .ds-pattern-inbox--messenger.is-aside-open > .ds-pattern-inbox__aside { position:absolute; z-index:6; inset-block:0; inset-inline-end:0; width:min(340px,100%); box-shadow:0 0 40px color-mix(in srgb,var(--text) 18%,transparent); }
}
@media (max-width:800px) {
  .ds-pattern-inbox--messenger { display:block; height:var(--ds-inbox-height,calc(100vh - 120px)); }
  .ds-pattern-inbox--messenger > .ds-pattern-inbox__list,.ds-pattern-inbox--messenger.is-chat-open > .ds-pattern-inbox__conversation { height:100%; }
  .ds-pattern-inbox--messenger > .ds-pattern-inbox__conversation { min-height:0; }
  .ds-pattern-inbox--messenger.is-embedded > .ds-pattern-inbox__conversation { display:grid; height:100%; }
  .ds-pattern-inbox--messenger .ds-pattern-inbox__messages { padding-inline:10px; }
  .ds-pattern-inbox--messenger .ds-pattern-inbox__messages > p { max-width:86%; }
  .ds-pattern-inbox__bubble-more { display:none; }
  .ds-pattern-inbox__jump { inset-block-end:80px; inset-inline-start:12px; }
  .ds-pattern-inbox__unread-divider { margin-inline:-10px; }
}
/* A record chat embedded in a narrow side panel (a meeting, a drawer) on a wide
 * screen: the panel width, not the viewport, decides. The «مهم» and «منتظر پاسخ»
 * switches take their own row under the text box, and nothing scrolls sideways. */
.ds-pattern-inbox--messenger.is-embedded { container-type:inline-size; }
@container (max-width:560px) {
  .ds-pattern-inbox--messenger .ds-pattern-inbox__messages { overflow-x:hidden; }
  .ds-pattern-inbox--messenger .ds-pattern-inbox__composer { gap:6px; padding-inline:8px calc(8px + var(--ds-inbox-composer-end,0px)); }
  .ds-pattern-inbox--messenger .ds-pattern-inbox__composer textarea { min-width:0; }
}
@media (max-width:520px) {
  .ds-pattern-inbox--messenger .ds-pattern-inbox__header-actions .ds-pattern-inbox__icon-btn { flex-basis:36px; width:36px; height:36px; }
  .ds-pattern-inbox--messenger .ds-pattern-inbox__composer { gap:4px; padding-inline:6px calc(6px + var(--ds-inbox-composer-end,0px)); }
  .ds-pattern-inbox--messenger .ds-pattern-inbox__composer textarea { min-width:0; }
  .ds-pattern-inbox--messenger .ds-pattern-inbox__composer > .ds-pattern-inbox__icon-btn { flex-basis:36px; width:36px; height:36px; }
}

/* ── «تنظیمات چت من» window ───────────────────────────────────────────── */
/* Placement only: the catalog's settings cards, choice pills, switches and form note keep their own look. */
.chat-my-settings .chat-my-panel:not([hidden]) { display:grid; gap:18px; padding-block-start:6px; }
.chat-my-settings .chat-my-section { display:grid; gap:10px; min-width:0; }
.chat-my-settings .chat-my-section + .chat-my-section { padding-block-start:16px; border-block-start:1px solid var(--border); }
.chat-my-settings .ds-settings-strip--grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.chat-my-settings .chat-my-apply { display:flex; justify-content:flex-end; }
.chat-my-settings .chat-my-apply .btn { display:inline-flex; align-items:center; gap:6px; }
.chat-my-settings .chat-my-note { display:flex; align-items:flex-start; gap:8px; margin:0; }
.chat-my-settings .chat-my-confirm { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px; margin:0; }
.chat-my-settings .chat-my-confirm[hidden] { display:none; }
.chat-my-settings .chat-my-confirm__actions { display:flex; gap:8px; }
@media (max-width:680px) { .chat-my-settings .ds-settings-strip--grid { grid-template-columns:minmax(0,1fr); } }
/* Poll inside a message (chat message tools, 1405/07/30): a head with the
   question, options to tap (one choice votes at once, several are ticked and
   sent), and after voting a live share bar per option. Only shared tokens. */
.ds-pattern-inbox__poll { display:grid; gap:8px; min-width:min(290px,100%); margin:0 0 4px; }
.ds-pattern-inbox__poll-head { display:grid; grid-template-columns:36px minmax(0,1fr); align-items:center; gap:10px; }
.ds-pattern-inbox__poll-icon { display:grid; width:36px; height:36px; place-items:center; border-radius:12px; color:var(--brand-700); background:color-mix(in srgb,var(--pastel-lilac) 75%,var(--surface)); }
.ds-pattern-inbox__poll-icon > [data-ds-icon],.ds-pattern-inbox__poll-icon svg { display:block; width:20px; height:20px; }
.ds-pattern-inbox__poll-copy { display:grid; gap:2px; min-width:0; }
.ds-pattern-inbox__poll-copy strong { color:var(--text); font-size:14px; font-weight:800; line-height:1.6; overflow-wrap:anywhere; }
.ds-pattern-inbox__poll-copy small { color:var(--text-muted); font-size:11px; }
.ds-pattern-inbox__poll-options { display:grid; gap:6px; }
.ds-pattern-inbox__poll-option { position:relative; display:grid; grid-template-columns:18px minmax(0,1fr) auto; align-items:center; gap:9px; min-height:40px; box-sizing:border-box; padding:8px 12px; overflow:hidden; border:1px solid color-mix(in srgb,var(--border) 80%,transparent); border-radius:12px; color:var(--text); background:color-mix(in srgb,var(--surface) 92%,transparent); font:inherit; font-size:13px; text-align:start; cursor:pointer; transition:border-color .18s ease,background-color .18s ease; }
.ds-pattern-inbox__poll-option:hover { border-color:color-mix(in srgb,var(--brand-500) 45%,var(--border)); background:color-mix(in srgb,var(--pastel-mint) 30%,var(--surface)); }
.ds-pattern-inbox__poll-option:focus-visible,.ds-pattern-inbox__poll-option:has(input:focus-visible) { outline:2px solid var(--brand-500); outline-offset:2px; }
.ds-pattern-inbox__poll-option:has(input:checked) { border-color:var(--brand-500); background:color-mix(in srgb,var(--pastel-mint) 45%,var(--surface)); }
.ds-pattern-inbox__poll-mark { display:block; width:16px; height:16px; box-sizing:border-box; border:2px solid color-mix(in srgb,var(--text-muted) 60%,transparent); border-radius:50%; }
.ds-pattern-inbox__poll-option.is-multiple .ds-pattern-inbox__poll-mark { border-radius:5px; }
.ds-pattern-inbox__poll-option input { position:absolute; width:1px; height:1px; margin:0; opacity:0; }
.ds-pattern-inbox__poll-option:has(input:checked) .ds-pattern-inbox__poll-mark { border-color:var(--brand-500); background:var(--brand-500); box-shadow:inset 0 0 0 3px var(--surface); }
.ds-pattern-inbox__poll-label { position:relative; z-index:1; min-width:0; overflow-wrap:anywhere; line-height:1.6; }
/* Results: the share fills the option from its start edge. */
.ds-pattern-inbox__poll-option.is-result { cursor:default; }
.ds-pattern-inbox__poll-option.is-result::before { position:absolute; inset-block:0; inset-inline-start:0; width:var(--share,0%); content:""; background:color-mix(in srgb,var(--pastel-sky) 70%,transparent); transition:width .45s ease; }
.ds-pattern-inbox__poll-option.is-result.is-top::before { background:color-mix(in srgb,var(--pastel-mint) 95%,transparent); }
.ds-pattern-inbox__poll-option.is-result.is-mine { border-color:var(--brand-500); }
.ds-pattern-inbox__poll-option.is-result .ds-pattern-inbox__poll-mark { position:relative; z-index:1; border:0; }
.ds-pattern-inbox__poll-option.is-result.is-mine .ds-pattern-inbox__poll-mark { display:grid; place-items:center; color:var(--brand-700); }
.ds-pattern-inbox__poll-option.is-result.is-mine .ds-pattern-inbox__poll-mark > [data-ds-icon],.ds-pattern-inbox__poll-option.is-result.is-mine .ds-pattern-inbox__poll-mark svg { width:16px; height:16px; }
.ds-pattern-inbox__poll-share { position:relative; z-index:1; color:var(--text); font-size:12px; font-weight:800; white-space:nowrap; font-variant-numeric:tabular-nums; }
.ds-pattern-inbox__poll-foot { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; }
.ds-pattern-inbox__poll-foot > small { color:var(--text-muted); font-size:11px; }
.ds-pattern-inbox__poll-actions { display:flex; flex-wrap:wrap; gap:6px; }
@media (prefers-reduced-motion:reduce) { .ds-pattern-inbox__poll-option,.ds-pattern-inbox__poll-option.is-result::before { transition:none; } }

/* «کارت اقدام» in a message: the poll's own frame and head, with the buttons of its kind. */
.ds-pattern-inbox__action-card-text { display:block; color:var(--text); font-size:13px; line-height:1.9; white-space:pre-line; overflow-wrap:anywhere; }
.ds-pattern-inbox__action-card-buttons { display:flex; flex-wrap:wrap; gap:6px; }
.ds-pattern-inbox__action-card:not(.is-pending) .ds-pattern-inbox__poll-icon { color:var(--text-muted); background:color-mix(in srgb,var(--text-muted) 12%,var(--surface)); }


/* /portal/ds/css/ds-page-hero.css */
/* Shared page-hero (from design-system) — panel + DS sample both load this. */
.ds-page-hero-stack { display: flex; flex-direction: column; gap: 22px; }
.ds-page-hero {
  --ds-hero-tc: #6ba8e5;
  --ds-hero-tc50: color-mix(in srgb, var(--ds-hero-tc) 16%, var(--surface));
  display: grid;
  /* minmax(0,…): the copy column may shrink below a long one-line title
     (e.g. the guide title row), so the text wraps instead of overflowing. */
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  /* Minimum-height hero: tight padding and compact visuals. */
  padding: 14px 20px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 88% 12%, color-mix(in srgb, var(--ds-hero-tc) 22%, transparent) 0%, transparent 42%),
    linear-gradient(135deg, var(--surface) 0%, var(--ds-hero-tc50) 130%);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.ds-page-hero--recipe {
  padding: 14px 20px;
}
.ds-page-hero--recipe .ds-page-hero__title { font-size: 22px; }
.ds-page-hero--sky { --ds-hero-tc: #6ba8e5; }
.ds-page-hero--green { --ds-hero-tc: #5bb89a; }
.ds-page-hero--amber { --ds-hero-tc: #e0a35b; }
.ds-page-hero--lilac { --ds-hero-tc: #9b8fd8; }
.ds-page-hero--plum { --ds-hero-tc: #a23b8c; }
.ds-page-hero--mint { --ds-hero-tc: #6dbf8f; }
.ds-page-hero__copy { min-width: 0; display: flex; flex-direction: column; gap: 0; }
.ds-page-hero__eyebrow {
  font-size: 12px; font-weight: 700; color: var(--ds-hero-tc); letter-spacing: .04em;
}
.ds-page-hero__title {
  margin: 4px 0 0; font-size: 21px; font-weight: 800; color: var(--text); line-height: 1.25;
  letter-spacing: -.015em;
}
.ds-page-hero__sub {
  margin: 4px 0 0; font-size: 13px; color: var(--text-muted); max-width: 60ch; line-height: 1.55;
}
.ds-page-hero__movers {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px;
}
.ds-page-hero__mover {
  display: flex; align-items: center; gap: 8px; padding: 5px 11px; border-radius: 999px;
  font-size: 12.5px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs);
}
.ds-page-hero__mover span { color: var(--text-muted); }
.ds-page-hero__mover strong { color: var(--text); font-weight: 700; }
.ds-page-hero__mover em {
  font-style: normal; font-weight: 800; padding: 2px 8px; border-radius: 999px;
  color: #2f8a5e; background: var(--green-50, rgba(109, 191, 143, .2));
}
.ds-page-hero__chips {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.ds-page-hero__chip {
  font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); color: var(--text-muted);
}
.ds-page-hero__chip b { color: var(--ds-hero-tc); font-weight: 800; }
.ds-page-hero__visual { flex: 0 0 auto; }

/* Copy-side M–S */
.ds-page-hero-stack__label {
  margin: 18px 0 0;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 11.5px; font-weight: 800; color: var(--text-muted);
  letter-spacing: .06em; text-transform: none;
}
.ds-page-hero-stack__label:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.ds-page-hero-stack__hint {
  margin: -6px 0 4px; font-size: 12.5px; color: var(--text-muted); line-height: 1.6; max-width: 62ch;
}
.ds-page-hero__live-row {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px;
}
.ds-page-hero__live-row .ds-page-hero__live { margin-top: 0; }
.ds-page-hero__actions {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center;
}
.ds-page-hero__actions .btn { min-height: 34px; padding-inline: 16px; font-size: 13px; font-weight: 700; }

.ds-page-hero__live {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 10px; border-radius: 999px; font-size: 12.5px; color: var(--text);
  background: color-mix(in srgb, var(--ds-hero-tc) 6%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--ds-hero-tc) 16%, var(--border));
}
.ds-page-hero__live b { font-weight: 800; color: var(--ds-hero-tc); }
.ds-page-hero__live-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent);
}
.ds-page-hero__live-dot.is-ok { color: #2f8a5e; background: #2f8a5e; animation: ds-ph-pulse 1.8s ease-in-out infinite; }
.ds-page-hero__live-dot.is-warn { color: #c4892a; background: #e0a35b; animation: ds-ph-pulse 1.8s ease-in-out infinite; }
.ds-page-hero__live--warn {
  color: var(--text-muted);
  background: color-mix(in srgb, #e0a35b 8%, var(--surface));
  border-color: color-mix(in srgb, #e0a35b 22%, var(--border));
}
@keyframes ds-ph-pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
  50% { box-shadow: 0 0 0 5px color-mix(in srgb, currentColor 8%, transparent); }
}

.ds-page-hero__crumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 0 0 2px; font-size: 12px; color: var(--text-muted);
}
.ds-page-hero__crumb a {
  color: var(--text-muted); text-decoration: none; font-weight: 600;
}
.ds-page-hero__crumb a:hover { color: var(--ds-hero-tc); }
.ds-page-hero__crumb strong { color: var(--text); font-weight: 800; }

.ds-page-hero__alert {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 8px; padding: 6px 10px; border-radius: 12px;
  font-size: 12.5px; color: var(--text); line-height: 1.5;
  background: color-mix(in srgb, #e8788c 12%, var(--surface));
  border: 1px solid color-mix(in srgb, #e8788c 28%, var(--border));
}
.ds-page-hero__alert b { font-weight: 800; color: #c45a6e; }
.ds-page-hero__alert-ic {
  width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  background: color-mix(in srgb, #e8788c 18%, #fff); color: #c45a6e; flex-shrink: 0;
}
.ds-page-hero__alert-ic .material-symbols-rounded { font-size: 18px; }
.ds-page-hero__alert > span:nth-child(2) { flex: 1 1 160px; }
.ds-page-hero__alert-go {
  margin-inline-start: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit; font-size: 12px; font-weight: 700;
  color: var(--text); cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow-xs);
}
.ds-page-hero__alert-go:hover {
  border-color: color-mix(in srgb, #e8788c 40%, var(--border));
  color: #c45a6e;
}

.ds-page-hero__owner {
  display: flex; align-items: center; gap: 10px; margin-top: 8px;
  padding: 0; max-width: 380px;
  background: transparent; border: 0; box-shadow: none;
}
.ds-page-hero__owner .avatar {
  width: 34px; height: 34px; font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.ds-page-hero__owner-meta {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.ds-page-hero__owner-meta strong {
  font-size: 13.5px; font-weight: 800; color: var(--text); line-height: 1.3;
}
.ds-page-hero__owner-meta span {
  font-size: 11.5px; color: var(--text-muted);
}
.ds-page-hero__owner-badge {
  margin-inline-start: auto; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; color: #2f8a5e;
  background: color-mix(in srgb, #6dbf8f 22%, transparent);
}

.ds-page-hero__head-row {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: 12px 16px;
}
/* Period sits with the metric box it controls — above the visual, not beside the title */
.ds-page-hero__visual-stack {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
}
.ds-page-hero__visual-stack .ds-page-hero__period {
  align-self: center;
}
.ds-page-hero__period {
  position: relative;
  display: inline-flex; padding: 3px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs);
  isolation: isolate;
}
.ds-page-hero__period-thumb {
  position: absolute;
  top: 3px; bottom: 3px; left: 0;
  width: 0;
  border-radius: 999px;
  background: var(--ds-hero-tc);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--ds-hero-tc) 35%, transparent);
  transform: translateX(0);
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), width .22s cubic-bezier(.2, .8, .2, 1);
  pointer-events: none;
  z-index: 0;
}
.ds-page-hero__period button {
  position: relative; z-index: 1;
  border: 0; background: transparent; color: var(--text-muted);
  font: inherit; font-size: 12px; font-weight: 700;
  padding: 5px 12px; border-radius: 999px; cursor: pointer; line-height: 1;
  transition: color .18s ease;
}
.ds-page-hero__period button:hover { color: var(--text); }
.ds-page-hero__period button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--ds-hero-tc) 55%, transparent);
  outline-offset: 2px;
}
.ds-page-hero__period button.is-active {
  color: #fff; background: transparent; box-shadow: none;
}
.ds-page-hero__period button:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

.ds-page-hero__goal {
  margin-top: 8px; max-width: 400px;
  padding: 0; border: 0; background: transparent; box-shadow: none;
}
.ds-page-hero__goal-meta {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px;
}
.ds-page-hero__goal-meta b {
  font-size: 18px; font-weight: 800; color: var(--text); line-height: 1;
}
.ds-page-hero__goal-track {
  height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--ds-hero-tc) 12%, var(--surface-2, #eef1f5)); overflow: hidden;
}
.ds-page-hero__goal-fill {
  height: 100%; border-radius: inherit;
  background: var(--ds-hero-tc);
}
.ds-page-hero__goal-foot {
  display: flex; justify-content: space-between; gap: 10px; margin-top: 6px;
  font-size: 11.5px; color: var(--text-muted);
}
.ds-page-hero__goal-foot em { font-style: normal; font-weight: 700; color: var(--text); }

/* Visual A — orb */
.ds-ph-orb {
  position: relative; width: 104px; height: 104px; display: grid; place-items: center;
}
.ds-ph-orb svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ds-ph-orb__center { text-align: center; z-index: 1; }
.ds-ph-orb__center b { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1; }
.ds-ph-orb__center b em { font-size: 12px; font-style: normal; color: var(--text-muted); }
.ds-ph-orb__center small {
  display: block; margin-top: 2px; font-size: 10px; color: var(--text-muted); max-width: 80px;
}

/* Visual B — gauge */
.ds-ph-gauge { width: 132px; text-align: center; }
.ds-ph-gauge svg { width: 100%; height: auto; overflow: visible; }
.ds-ph-gauge__cap { margin-top: -18px; }
.ds-ph-gauge__cap b { font-size: 22px; font-weight: 800; color: var(--text); }
.ds-ph-gauge__cap b em { font-size: 12px; font-style: normal; color: var(--text-muted); }
.ds-ph-gauge__cap small {
  display: block; font-size: 10.5px; color: var(--text-muted); max-width: 140px; margin: 1px auto 0;
}

/* Visual C — bigstat */
.ds-ph-bigstat {
  width: 232px; padding: 10px 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--ds-hero-tc); display: flex; flex-direction: column; gap: 2px;
}
.ds-ph-bigstat__lbl {
  font-size: 12.5px; color: var(--text-muted); font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.ds-ph-bigstat__ic {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 8px;
  background: var(--ds-hero-tc50); color: var(--ds-hero-tc); flex-shrink: 0;
}
.ds-ph-bigstat__ic .ds-ico { width: 16px; height: 16px; display: block; color: inherit; }
.ds-ph-bigstat__num {
  font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.1; margin: 4px 0 2px;
}
.ds-ph-bigstat__foot { font-size: 11.5px; color: var(--text-faint); min-height: 0; }
.ds-ph-bigstat__spark { margin: 4px 0 2px; height: 26px; }
.ds-ph-bigstat__spark svg { width: 100%; height: 100%; display: block; }
.ds-ph-bigstat__pill {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 4px; padding: 4px 10px; border-radius: 10px; background: var(--ds-hero-tc50); font-size: 12px;
}
.ds-ph-bigstat__pill span { color: var(--text-muted); }
.ds-ph-bigstat__pill b { color: var(--ds-hero-tc); font-weight: 800; font-size: 13px; }

/* Visual D — spark trio */
.ds-ph-trio { width: 256px; display: flex; flex-direction: column; gap: 4px; }
.ds-ph-trio__head {
  padding: 4px 12px; border-radius: 12px; background: var(--ds-hero-tc50);
  display: flex; flex-direction: row-reverse; justify-content: space-between; align-items: baseline; gap: 8px;
}
.ds-ph-trio__head b { font-size: 18px; font-weight: 800; color: var(--ds-hero-tc); }
.ds-ph-trio__head small { font-size: 11px; color: var(--text-muted); }
.ds-ph-trio__row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: 8px;
  padding: 4px 10px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-xs); border-inline-start: 3px solid var(--ds-hero-tc);
}
.ds-ph-trio__row span { font-size: 11.5px; color: var(--text-muted); }
.ds-ph-trio__row strong { grid-column: 3; font-size: 13px; font-weight: 800; color: var(--text); }
.ds-ph-trio__spark { grid-column: 2; grid-row: 1; height: 18px; margin: 0; min-width: 0; }
.ds-ph-trio__spark svg { width: 100%; height: 100%; display: block; }

/* Visual E — bars card */
.ds-ph-bars {
  width: 244px; padding: 10px 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.ds-ph-bars__title {
  font-size: 12.5px; font-weight: 700; color: var(--text); margin: 0 0 6px;
  display: flex; align-items: center; gap: 8px;
}
.ds-ph-bars__title .ds-ph-bigstat__ic { width: 22px; height: 22px; }
.ds-ph-bars__row { display: grid; grid-template-columns: 72px 1fr 36px; gap: 8px; align-items: center; margin-bottom: 4px; }
.ds-ph-bars__row:last-child { margin-bottom: 0; }
.ds-ph-bars__row span { font-size: 11px; color: var(--text-muted); }
.ds-ph-bars__row b { font-size: 11px; font-weight: 800; color: var(--text); text-align: end; }
.ds-ph-bars__track {
  height: 6px; border-radius: 999px; background: var(--surface-2, #eef2f6); overflow: hidden;
}
.ds-ph-bars__fill { height: 100%; border-radius: inherit; background: var(--ds-hero-tc); }

/* Visual F — donut + legend */
.ds-ph-donut {
  width: 240px; padding: 10px 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: center;
}
.ds-ph-donut__chart { position: relative; width: 76px; height: 76px; }
.ds-ph-donut__chart svg { width: 100%; height: 100%; }
.ds-ph-donut__center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; text-align: center; pointer-events: none;
  /* Keep label stack inside the hole — do not stretch to ring edges */
}
.ds-ph-donut__center b {
  font-size: 14px; font-weight: 800; color: var(--text); line-height: 1; display: block;
}
.ds-ph-donut__center small {
  font-size: 10px; color: var(--text-muted); line-height: 1; display: block;
}
.ds-ph-donut__legend { display: flex; flex-direction: column; gap: 4px; }
.ds-ph-donut__item {
  display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--text-muted);
}
.ds-ph-donut__item i {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; font-style: normal;
}
.ds-ph-donut__item b { margin-inline-start: auto; color: var(--text); font-weight: 800; }

/* Visual G — 2×2 mosaic */
.ds-ph-mosaic {
  width: 248px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.ds-ph-mosaic__cell {
  padding: 6px 10px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-xs);
  display: flex; flex-direction: column; gap: 1px; min-height: 0;
}
.ds-ph-mosaic__cell span { line-height: 1.4; font-size: 11px; color: var(--text-muted); font-weight: 600; }
.ds-ph-mosaic__cell strong { line-height: 1.25; font-size: 16px; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.ds-ph-mosaic__cell em {
  font-style: normal; font-size: 10.5px; font-weight: 700; color: #2f8a5e;
}
.ds-ph-mosaic__cell em.is-down { color: #b14458; }
.ds-ph-mosaic__cell:nth-child(1) { border-top: 3px solid var(--ds-hero-tc); }
.ds-ph-mosaic__cell:nth-child(2) { border-top: 3px solid #5bb89a; }
.ds-ph-mosaic__cell:nth-child(3) { border-top: 3px solid #e0a35b; }
.ds-ph-mosaic__cell:nth-child(4) { border-top: 3px solid #9b8fd8; }

/* Visual H — week heat */
.ds-ph-heat {
  width: 220px; padding: 10px 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.ds-ph-heat__title {
  font-size: 12.5px; font-weight: 700; color: var(--text); margin: 0 0 6px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.ds-ph-heat__title small { font-weight: 600; color: var(--text-muted); font-size: 11px; }
.ds-ph-heat__grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.ds-ph-heat__cell {
  aspect-ratio: 1; border-radius: 6px;
  background: color-mix(in srgb, var(--ds-hero-tc) calc(var(--lvl, 1) * 18%), var(--surface-2, #eef2f6));
}
.ds-ph-heat__days {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 3px;
}
.ds-ph-heat__days span {
  font-size: 9.5px; color: var(--text-faint); text-align: center; font-weight: 600;
}

/* Visual I — compare A/B */
.ds-ph-compare {
  width: 240px; padding: 8px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch;
}
.ds-ph-compare__side {
  padding: 6px 10px; border-radius: 12px; text-align: center;
  background: var(--ds-hero-tc50);
}
.ds-ph-compare__side.is-b {
  background: color-mix(in srgb, #5bb89a 16%, var(--surface));
}
.ds-ph-compare__side small { display: block; font-size: 11px; color: var(--text-muted); font-weight: 600; }
.ds-ph-compare__side strong {
  display: block; margin-top: 2px; font-size: 18px; font-weight: 800; color: var(--text);
}
.ds-ph-compare__side em {
  display: inline-block; margin-top: 2px; font-style: normal; font-size: 10.5px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px; color: #2f8a5e; background: rgba(109, 191, 143, .22);
}
.ds-ph-compare__vs {
  align-self: center; font-size: 11px; font-weight: 800; color: var(--text-faint);
}

/* Visual J — timeline */
.ds-ph-timeline {
  width: 260px; padding: 10px 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.ds-ph-timeline__title {
  font-size: 12.5px; font-weight: 700; color: var(--text); margin: 0 0 6px;
}
.ds-ph-timeline__list { display: flex; flex-direction: column; gap: 0; margin: 0; padding: 0; list-style: none; }
.ds-ph-timeline__item {
  display: grid; grid-template-columns: 14px 1fr; gap: 10px; position: relative;
  padding-bottom: 6px;
}
.ds-ph-timeline__item:last-child { padding-bottom: 0; }
.ds-ph-timeline__item::before {
  content: ''; position: absolute; top: 10px; bottom: 0; inset-inline-start: 5px;
  width: 2px; background: var(--border);
}
.ds-ph-timeline__item:last-child::before { display: none; }
.ds-ph-timeline__dot {
  width: 12px; height: 12px; border-radius: 50%; margin-top: 3px;
  background: var(--ds-hero-tc); box-shadow: 0 0 0 3px var(--ds-hero-tc50); position: relative; z-index: 1;
}
.ds-ph-timeline__item strong { display: block; line-height: 1.35; font-size: 12px; font-weight: 700; color: var(--text); }
.ds-ph-timeline__item span { line-height: 1.35; font-size: 11px; color: var(--text-muted); }

/* Visual K — ring cluster */
.ds-ph-rings {
  width: 232px; padding: 10px 12px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  display: flex; justify-content: space-between; gap: 6px;
}
.ds-ph-rings__item { flex: 1; text-align: center; }
.ds-ph-rings__chart {
  position: relative; width: 52px; height: 52px; margin: 0 auto 4px;
}
.ds-ph-rings__chart svg { width: 100%; height: 100%; }
.ds-ph-rings__chart b {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: var(--text);
}
.ds-ph-rings__item small { font-size: 10.5px; color: var(--text-muted); font-weight: 600; }

/* Visual L — colored badge cluster */
.ds-ph-badges {
  width: 260px; padding: 10px 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.ds-ph-badges__title {
  font-size: 12.5px; font-weight: 700; color: var(--text); margin: 0 0 6px;
}
.ds-ph-badges__cloud {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.ds-ph-badges__cloud .chip {
  margin: 0; font-size: 12px; font-weight: 700; padding: 3px 10px;
}
.ds-ph-badges__foot {
  margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 11px; color: var(--text-muted);
}
.ds-ph-badges__foot b { color: var(--ds-hero-tc); font-weight: 800; }

.ds-page-hero--rose { --ds-hero-tc: #e8788c; }
.ds-page-hero--peach { --ds-hero-tc: #f4a261; }
.ds-page-hero--slate { --ds-hero-tc: #7a8799; }

.ds-page-hero__variant-tag {
  position: absolute; top: 6px; inset-inline-end: 14px;
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  color: var(--text-muted); z-index: 2; backdrop-filter: blur(6px);
}
/* Catalog samples only: keep the visual clear of the variant tag above it. */
@media (min-width: 901px) {
  .ds-page-hero:has(> .ds-page-hero__variant-tag) > .ds-page-hero__visual { margin-top: 18px; }
}
.ds-page-hero--recipe .ds-page-hero__variant-tag {
  color: var(--ds-hero-tc);
  border-color: color-mix(in srgb, var(--ds-hero-tc) 28%, var(--border));
}

@media (max-width: 900px) {
  .ds-hero--split,
  .ds-page-hero { grid-template-columns: minmax(0, 1fr); }
  .ds-hero__aside,
  .ds-page-hero__visual { justify-self: start; }
}

/* Compact hero (smart layout rule): a hero that carries only eyebrow, title
   and description has nothing to show on its far side, so the description
   moves there, facing the title, and the hero takes about half the height.
   Tablets keep this layout; only a phone stacks the description under the title. */
@media (min-width: 601px) {
  .ds-page-hero:not(:has(> :not(.ds-page-hero__copy))):not(:has(> .ds-page-hero__copy > :not(.ds-page-hero__eyebrow, .ds-page-hero__title, .gex-title-row, .ds-page-hero__sub))) {
    padding-block: 14px;
  }
  .ds-page-hero:not(:has(> :not(.ds-page-hero__copy))):not(:has(> .ds-page-hero__copy > :not(.ds-page-hero__eyebrow, .ds-page-hero__title, .gex-title-row, .ds-page-hero__sub))) > .ds-page-hero__copy {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 32px;
    align-items: center;
  }
  .ds-page-hero:not(:has(> :not(.ds-page-hero__copy))):not(:has(> .ds-page-hero__copy > :not(.ds-page-hero__eyebrow, .ds-page-hero__title, .gex-title-row, .ds-page-hero__sub))) > .ds-page-hero__copy > :is(.ds-page-hero__eyebrow, .ds-page-hero__title, .gex-title-row) {
    grid-column: 1;
  }
  .ds-page-hero:not(:has(> :not(.ds-page-hero__copy))):not(:has(> .ds-page-hero__copy > :not(.ds-page-hero__eyebrow, .ds-page-hero__title, .gex-title-row, .ds-page-hero__sub))) > .ds-page-hero__copy > :is(.ds-page-hero__title, .gex-title-row) {
    margin-block-start: 2px;
  }
  .ds-page-hero:not(:has(> :not(.ds-page-hero__copy))):not(:has(> .ds-page-hero__copy > :not(.ds-page-hero__eyebrow, .ds-page-hero__title, .gex-title-row, .ds-page-hero__sub))) > .ds-page-hero__copy > .ds-page-hero__sub {
    /* Same row as the title, one line while it fits, otherwise two even lines. */
    grid-column: 2;
    grid-row: 2;
    align-self: center;
    justify-self: end;
    margin: 0;
    max-width: none;
    text-align: left;
    text-wrap: balance;
  }
  .ds-page-hero:not(:has(> :not(.ds-page-hero__copy))):not(:has(> .ds-page-hero__copy > :not(.ds-page-hero__eyebrow, .ds-page-hero__title, .gex-title-row, .ds-page-hero__sub))) > .ds-page-hero__copy:not(:has(> .ds-page-hero__eyebrow)) > .ds-page-hero__sub {
    grid-row: 1;
  }
}

/* Compact hero for every header family (ds-hero-compact.js marks a header that
   has only eyebrow, title and description). Same result as the rule above. */
@media (min-width: 601px) {
  [data-ds-hero-compact] { padding-block: 14px !important; min-height: 0 !important; }
  [data-ds-hero-compact] [data-ds-hero-copy],
  [data-ds-hero-compact][data-ds-hero-copy] {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 32px;
    row-gap: 2px;
    align-items: center;
  }
  [data-ds-hero-compact] [data-ds-hero-copy] {
    flex: 1 1 auto;
    grid-column: 1 / -1;
    inline-size: 100%;
    max-inline-size: none;
    min-inline-size: 0;
  }
  [data-ds-hero-compact] [data-ds-hero-copy] > *,
  [data-ds-hero-compact][data-ds-hero-copy] > * { grid-column: 1; }
  [data-ds-hero-compact] [data-ds-hero-copy] > [data-ds-hero-sub],
  [data-ds-hero-compact][data-ds-hero-copy] > [data-ds-hero-sub] {
    grid-column: 2;
    align-self: center;
    justify-self: end;
    margin: 0 !important;
    max-width: none !important;
    text-align: left;
    text-wrap: balance;
  }
}

/* Minimum-height hero with buttons, chips or a folded picture (catalog
   #page-hero-compact-row; ds-hero-compact.js marks data-ds-hero-compact="row").
   One row: eyebrow and title on the near side, the description facing them,
   then each group of buttons/chips in its own column at the far (left) end.
   A picture beside the title is folded into a chip; decoration is hidden. */
[data-ds-hero-compact="row"] [data-ds-hero-folded] { display: none !important; }
@media (min-width: 601px) {
  [data-ds-hero-compact="row"] {
    display: grid !important;
    /* The description keeps at least about a third of the row; button and chip
       groups take the rest and wrap inside their own column when it is short. */
    grid-template-columns: var(--ds-hero-cols, auto minmax(min(26rem, 36%), 1fr)) !important;
    grid-auto-columns: auto;
    column-gap: 24px;
    row-gap: 2px;
    align-items: center;
    padding-block: 12px !important;
    min-height: 0 !important;
  }
  [data-ds-hero-compact="row"] [data-ds-hero-copy],
  [data-ds-hero-compact="row"] [data-ds-hero-flat] { display: contents !important; }
  /* Columns come from the runtime: short eyebrows, the title, the description, then the groups. */
  [data-ds-hero-compact="row"] [data-ds-hero-head] { grid-column: var(--ds-hero-col, 1) !important; margin-block-end: 0 !important; }
  [data-ds-hero-compact="row"] [data-ds-hero-head="eyebrow"] { grid-row: var(--ds-hero-row, 1) !important; margin-block-start: 0 !important; }
  [data-ds-hero-compact="row"] [data-ds-hero-head="title"] { grid-row: var(--ds-hero-row, var(--ds-hero-head-rows, 2)) !important; }
  /* The menu trail (ds-menu-trail.js): its own line under the eyebrow pill and the title. */
  [data-ds-hero-compact="row"] [data-ds-hero-head="trail"] { grid-row: var(--ds-hero-row, 3) !important; margin-block-start: 0 !important; }
  [data-ds-hero-compact="row"] :is([data-ds-hero-head="title"], [data-ds-hero-head="title"] h1) { margin-block-start: 0 !important; }
  [data-ds-hero-compact="row"] [data-ds-hero-sub] {
    grid-column: var(--ds-hero-col, 2) !important;
    grid-row: 1 / span var(--ds-hero-head-rows, 2) !important;
    align-self: center;
    justify-self: end;
    margin: 0 !important;
    max-width: none !important;
    text-align: left;
    text-wrap: balance;
  }
  [data-ds-hero-compact="row"] [data-ds-hero-tail] {
    grid-column: var(--ds-hero-col, 3);
    grid-row: 1 / span var(--ds-hero-head-rows, 2);
    align-self: center;
    justify-self: end;
    justify-content: flex-end;
    /* A group stacked in a column or a grid (page-local) would make the row tall again. */
    flex-direction: row !important;
    align-items: center !important;
    margin: 0 !important;
    max-inline-size: none;
  }
}
@media (min-width: 601px) {
  /* Groups that do not fit beside the description go under it, at the far end. */
  [data-ds-hero-compact="row"][data-ds-hero-wrap] { grid-template-columns: var(--ds-hero-wrap-cols, auto minmax(0, 1fr)) !important; row-gap: 6px; }
  [data-ds-hero-compact="row"][data-ds-hero-wrap] [data-ds-hero-tail] {
    grid-column: 1 / -1;
    grid-row: auto;
    flex-wrap: wrap !important;
  }
  /* A group takes the whole row: one line when it has room, items kept at the far end. */
  /* One line beside the description; data-ds-hero-wrap lets it wrap under it. */
  [data-ds-hero-compact="row"] [data-ds-hero-tail=""] { display: flex !important; flex-wrap: nowrap !important; }
  [data-ds-hero-compact="row"][data-ds-hero-wrap] [data-ds-hero-tail=""] {
    justify-self: stretch;
    inline-size: auto;
  }
  /* Lowest wrap (1405/08/23): the groups share lines under the title row, side by
     side at the far end, instead of one line each. */
  [data-ds-hero-compact="row"][data-ds-hero-wrap] {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    text-align: start;
    column-gap: 16px;
    row-gap: 6px;
  }
  [data-ds-hero-compact="row"][data-ds-hero-wrap] [data-ds-hero-head] { flex: 0 1 auto; min-inline-size: 0; }
  [data-ds-hero-compact="row"][data-ds-hero-wrap]:not(:has([data-ds-hero-sub])) [data-ds-hero-head="title"] { flex-grow: 1; }
  /* The trail takes its own line; the title keeps the near side of the line above it. */
  [data-ds-hero-compact="row"][data-ds-hero-wrap] [data-ds-hero-head="trail"] { flex: 1 0 100%; }
  [data-ds-hero-compact="row"][data-ds-hero-wrap]:has([data-ds-hero-head="trail"]) [data-ds-hero-head="title"] { flex-grow: 1; }
  [data-ds-hero-compact="row"][data-ds-hero-wrap] [data-ds-hero-sub] { flex: 1 1 18rem; min-inline-size: 0; }
  [data-ds-hero-compact="row"][data-ds-hero-wrap] [data-ds-hero-tail][data-ds-hero-tail] {
    flex: 0 1 auto;
    min-inline-size: 0;
    max-inline-size: 100%;
    flex-wrap: wrap !important;
  }
}
@media (max-width: 600px) {
  [data-ds-hero-compact="row"] {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding-block: 12px !important;
    min-height: 0 !important;
  }
  [data-ds-hero-compact="row"] [data-ds-hero-copy],
  [data-ds-hero-compact="row"] [data-ds-hero-flat] { display: contents !important; }
  [data-ds-hero-compact="row"] :is([data-ds-hero-head], [data-ds-hero-sub], [data-ds-hero-tail]) { margin: 0 !important; }
  [data-ds-hero-compact="row"] [data-ds-hero-tail] { justify-content: flex-start; align-self: flex-start; }
}
/* Counter tiles a guide step points at stay in place, drawn as .ds-page-hero__chip. */
[data-ds-hero-compact="row"] [data-ds-hero-tiles] {
  display: flex !important;
  flex-wrap: wrap;
  gap: 6px !important;
  min-width: 0 !important;
  width: auto !important;
  grid-template-columns: none !important;
}
[data-ds-hero-compact="row"] [data-ds-hero-tile] {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: baseline;
  gap: 4px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  padding: 3px 10px !important;
  border-radius: 999px !important;
  border: 1px solid var(--border) !important;
  background: var(--surface) !important;
  box-shadow: none !important;
  font-size: 12px;
  color: var(--text-muted);
}
[data-ds-hero-compact="row"] [data-ds-hero-tile]::before,
[data-ds-hero-compact="row"] [data-ds-hero-tile]::after { display: none !important; }
[data-ds-hero-compact="row"] [data-ds-hero-tile] * {
  font-size: 12px !important;
  line-height: 1.5 !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
}
[data-ds-hero-compact="row"] [data-ds-hero-tile] :is(b, strong) { color: var(--ds-hero-tc, var(--text)); font-weight: 800; }
[data-ds-hero-compact="row"] [data-ds-hero-tile] :is(svg, [data-ds-icon]) { width: 14px !important; height: 14px !important; }
[data-ds-hero-compact="row"] [data-ds-hero-unwrap] { display: contents !important; }

/* Lowest header, in its own colour (owner request 1405/08/23, catalog
   #page-hero-compact-row). Every marked header is one row: a short eyebrow is a
   tone pill before the title, the title is 18px, the description 12.5px, header
   buttons 32px and chips 22px, padding 8px. Colour comes only from the header's
   own tone (--ds-hero-tc of .ds-page-hero--sky/green/amber/lilac/plum/mint);
   other header families use the brand token of the active theme. */
[data-ds-hero-compact="row"] {
  --ds-hero-tone: var(--ds-hero-tc, var(--brand-500));
  border-color: color-mix(in srgb, var(--ds-hero-tone) 26%, var(--border)) !important;
}
[data-ds-hero-compact="row"] [data-ds-hero-head="title"],
[data-ds-hero-compact="row"] [data-ds-hero-head="title"] h1,
[data-ds-hero-compact="row"] h1[data-ds-hero-head="title"] {
  font-size: 18px !important;
  line-height: 1.3 !important;
}
[data-ds-hero-compact="row"] [data-ds-hero-head="eyebrow"] {
  display: inline-flex !important;
  align-items: center;
  justify-self: start;
  align-self: flex-start;
  inline-size: fit-content;
  max-inline-size: 100%;
  padding: 1px 9px !important;
  border-radius: 999px;
  font-size: 11.5px !important;
  font-weight: 800;
  line-height: 1.6 !important;
  letter-spacing: 0;
  color: color-mix(in srgb, var(--ds-hero-tone) 72%, var(--text)) !important;
  background: color-mix(in srgb, var(--ds-hero-tone) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--ds-hero-tone) 28%, transparent);
}
/* The guide button beside the title matches the 32px header buttons. */
[data-ds-hero-compact="row"] [data-ds-hero-head="title"] .gex-launcher {
  width: 32px !important; height: 32px !important; min-width: 32px !important; min-height: 32px !important;
  border-radius: 10px !important;
}
[data-ds-hero-compact="row"] .gex-title-row { gap: 8px !important; }
[data-ds-hero-compact="row"] [data-ds-hero-sub] {
  font-size: 12.5px !important;
  line-height: 1.5 !important;
}
[data-ds-hero-compact="row"] [data-ds-hero-tail] .btn {
  height: 32px !important;
  min-height: 32px !important;
  padding-inline: 14px !important;
  border-radius: 10px;
}
/* Chips stay chips here even where a page stylesheet draws them as tall boxes. */
[data-ds-hero-compact="row"] .ds-page-hero__chips:not([data-ds-hero-folded]) {
  display: flex !important;
  flex-wrap: wrap;
  margin: 0 !important;
  gap: 6px !important;
}
[data-ds-hero-compact="row"] .ds-page-hero__chip {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: baseline !important;
  gap: 4px !important;
  min-height: 0 !important;
  padding: 2px 10px !important;
  border-radius: 999px !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
  color: var(--text) !important;
  background: color-mix(in srgb, var(--ds-hero-tone) 9%, var(--surface)) !important;
  border-color: color-mix(in srgb, var(--ds-hero-tone) 26%, var(--border)) !important;
  box-shadow: none !important;
}
[data-ds-hero-compact="row"] .ds-page-hero__chip b {
  font-size: 12px !important;
  line-height: 1.5 !important;
  color: color-mix(in srgb, var(--ds-hero-tone) 80%, var(--text)) !important;
}
[data-ds-hero-compact="row"] [data-ds-hero-tile] {
  background: color-mix(in srgb, var(--ds-hero-tone) 9%, var(--surface)) !important;
  border-color: color-mix(in srgb, var(--ds-hero-tone) 26%, var(--border)) !important;
}
@media (min-width: 601px) {
  [data-ds-hero-compact="row"] { padding-block: 8px !important; }
  [data-ds-hero-compact="row"] [data-ds-hero-head="eyebrow"] { align-self: center; }
}
@media (max-width: 600px) {
  [data-ds-hero-compact="row"] { padding-block: 10px !important; gap: 4px; }
}
/* A page stylesheet may give its header a fixed min-height or padding with
   !important (crm-fs-hero 150px): the compact row wins over it. */
[data-ds-hero-compact="row"][data-ds-hero-compact] { min-height: 0 !important; }
@media (min-width: 601px) {
  [data-ds-hero-compact="row"][data-ds-hero-compact] { padding-block: 8px !important; }
}
/* A chip is one line: a group that does not fit moves under the description
   (data-ds-hero-wrap) instead of breaking its chips over two or three lines. */
[data-ds-hero-compact="row"] :is(.ds-page-hero__chip, [data-ds-hero-tile]) { white-space: nowrap !important; }
/* Same gaps and side padding on every page: a page stylesheet's own gap (34px on
   the deal lists) or zero padding (the workbench pads an inner box that the row
   lays flat) would otherwise open or close the row. Buttons keep their label on one line. */
[data-ds-hero-compact="row"][data-ds-hero-compact] { padding-inline: 20px !important; }
@media (min-width: 601px) {
  [data-ds-hero-compact="row"][data-ds-hero-compact] { column-gap: 20px !important; row-gap: 6px !important; }
}
@media (max-width: 600px) {
  [data-ds-hero-compact="row"][data-ds-hero-compact] { padding-inline: 14px !important; gap: 6px !important; }
}
[data-ds-hero-compact="row"] [data-ds-hero-tail] .btn { white-space: nowrap !important; }


/* /portal/ds/css/ds-modal.css */
/* Diaco DS Modal — design-system extract (FE9) */

.ds-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ds-field__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.ds-field__hint {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.4;
  margin-top: -2px;
}

.ds-field__input {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.5;
  box-sizing: border-box;
  transition: border-color .28s ease, box-shadow .28s ease, background-color .28s ease;
}

.ds-field__input::placeholder { color: var(--text-faint); font-weight: 400; }

.ds-field__input:hover:not(:disabled):not(:focus) {
  border-color: color-mix(in srgb, var(--brand-500) 32%, var(--border));
  background: color-mix(in srgb, var(--brand-500) 4%, var(--surface));
}

.ds-field__input:focus {
  outline: none;
  border-color: var(--brand-500);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 20%, transparent);
}

textarea.ds-field__input {
  min-height: 96px;
  resize: vertical;
}

.ds-modal-back {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: linear-gradient(135deg, rgba(15, 23, 42, .46), rgba(13, 92, 92, .34));
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  opacity: 0;
  transition: opacity .28s ease;
  pointer-events: none;
}

.ds-modal-back[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.ds-modal-back.is-open {
  opacity: 1;
  pointer-events: auto;
}

.ds-modal {
  --ds-modal-accent: var(--pastel-mint, #a7f3d0);
  --ds-modal-accent-deep: var(--brand-600, #0d9488);
  --ds-modal-surface: color-mix(in srgb, var(--ds-modal-accent) 10%, var(--surface, #fff));
  --ds-modal-shadow: color-mix(in srgb, var(--ds-modal-accent) 32%, transparent);

  display: flex;
  flex-direction: column;
  width: fit-content;
  min-width: min(280px, 100%);
  max-width: 90vw;
  max-height: 90vh;
  max-height: min(90vh, calc(100dvh - 24px));
  min-height: 0;
  background: var(--ds-modal-surface);
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--ds-modal-accent) 28%, var(--border, #e2e8f0));
  box-shadow:
    0 28px 72px -16px var(--ds-modal-shadow),
    0 12px 32px -12px rgba(15, 23, 42, .14),
    inset 0 1px 0 rgba(255, 255, 255, .72);
  transform: scale(.94) translateY(14px);
  opacity: 0;
  transition:
    transform .34s cubic-bezier(.34, 1.4, .64, 1),
    opacity .28s ease,
    box-shadow .28s ease;
  overflow: hidden;
}

.ds-modal-back.is-open .ds-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.ds-modal--glass {
  background:
    linear-gradient(135deg, rgba(255,255,255,.84), rgba(238,248,255,.72)),
    var(--ds-modal-surface);
  border-color: rgba(255,255,255,.78);
  box-shadow:
    0 30px 80px -18px rgba(5,25,38,.46),
    inset 0 1px 0 rgba(255,255,255,.92);
  backdrop-filter: blur(22px) saturate(1.22);
  -webkit-backdrop-filter: blur(22px) saturate(1.22);
}

.ds-modal--glass .ds-modal__head,
.ds-modal--glass .ds-modal__foot {
  background: rgba(255,255,255,.28);
}

.ds-modal--glass .ds-modal__body :is(.ds-form-grid,.ds-modal__form-grid) {
  align-items: start;
  row-gap: 6px;
}

.ds-modal--sm  { width: min(420px, 90vw); }
.ds-modal--md  { width: min(560px, 90vw); }
.ds-modal--lg  { width: min(720px, 90vw); }
.ds-modal--xl  { width: min(1080px, 90vw); }

.ds-modal--mint  { --ds-modal-accent: #a7f3d0; --ds-modal-accent-deep: #0d9488; }
.ds-modal--sky   { --ds-modal-accent: #bae6fd; --ds-modal-accent-deep: #0284c7; }
.ds-modal--rose  { --ds-modal-accent: #fecdd3; --ds-modal-accent-deep: #e11d48; }
.ds-modal--lilac { --ds-modal-accent: #ddd6fe; --ds-modal-accent-deep: #7c3aed; }
.ds-modal--peach { --ds-modal-accent: #fed7aa; --ds-modal-accent-deep: #ea580c; }

.ds-modal__head {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px 16px;
  background: color-mix(in srgb, var(--ds-modal-accent) 14%, var(--surface, #fff));
  border-bottom: 1px solid color-mix(in srgb, var(--ds-modal-accent) 22%, var(--border, #e2e8f0));
}

.ds-modal__head-accent {
  position: absolute;
  inset-inline: 20px;
  top: 0;
  height: 3px;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--ds-modal-accent-deep) 20%,
    var(--ds-modal-accent) 50%,
    var(--ds-modal-accent-deep) 80%,
    transparent
  );
  opacity: .85;
}

.ds-modal__head-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: var(--ds-modal-accent-deep);
  background: var(--surface, #fff);
  border: 1px solid color-mix(in srgb, var(--ds-modal-accent) 35%, var(--border, #e2e8f0));
  box-shadow: 0 4px 12px color-mix(in srgb, var(--ds-modal-accent) 22%, transparent);
}

.ds-modal__head-icon[hidden] { display: none; }
.ds-modal__head-icon .ds-ico { width: 24px; height: 24px; color: inherit; }

.ds-modal__head-main {
  flex: 1;
  min-width: 0;
  padding-inline-end: 8px;
}

.ds-modal__eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  color: color-mix(in srgb, var(--ds-modal-accent-deep) 72%, var(--text-muted, #64748b));
  margin-bottom: 4px;
}

.ds-modal__eyebrow[hidden] { display: none !important; }

.ds-modal__title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text, #0f172a);
}

.ds-modal__close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-top: 2px;
  border: none;
  border-radius: 11px;
  background: color-mix(in srgb, var(--ds-modal-accent) 38%, var(--surface, #fff));
  color: var(--ds-modal-accent-deep);
  cursor: pointer;
  box-shadow: 0 4px 14px -4px var(--ds-modal-shadow);
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}

.ds-modal__close:hover {
  transform: scale(1.06);
  background: color-mix(in srgb, var(--ds-modal-accent) 55%, var(--surface, #fff));
}

.ds-modal__close:focus-visible {
  outline: 2px solid var(--ds-modal-accent-deep);
  outline-offset: 2px;
}

.ds-modal__body {
  padding: 18px 20px 20px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text, #334155);
}

.ds-modal__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px 18px;
  background: color-mix(in srgb, var(--ds-modal-accent) 8%, var(--surface, #fff));
  border-top: 1px solid color-mix(in srgb, var(--ds-modal-accent) 20%, var(--border, #e2e8f0));
}

.ds-modal__foot[hidden] { display: none !important; }

.ds-modal:not(.ds-modal--sticky-head):not(.ds-modal--sticky-foot) {
  overflow: auto;
  overscroll-behavior: contain;
}

.ds-modal--sticky-head .ds-modal__head,
.ds-modal--sticky-foot .ds-modal__foot {
  flex-shrink: 0;
}

.ds-modal--sticky-head .ds-modal__body,
.ds-modal--sticky-foot .ds-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.ds-modal--sticky-head .ds-modal__head {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 6px 18px -10px var(--ds-modal-shadow);
}

.ds-modal--sticky-foot .ds-modal__foot {
  position: sticky;
  bottom: 0;
  z-index: 2;
  box-shadow: 0 -6px 18px -10px var(--ds-modal-shadow);
}

.ds-modal__para {
  margin: 0 0 12px;
}

.ds-modal__para:last-child { margin-bottom: 0; }

.ds-modal__chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.ds-modal__chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: color-mix(in srgb, var(--ds-modal-accent) 42%, var(--surface, #fff));
  color: var(--ds-modal-accent-deep);
  border: 1px solid color-mix(in srgb, var(--ds-modal-accent) 55%, transparent);
}

.ds-modal__detail-sheet {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 0;
}

.ds-modal__detail-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ds-modal__detail-row--full {
  grid-column: 1 / -1;
}

.ds-modal__detail-row dt {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted, #718096);
}

.ds-modal__detail-row dd {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
  word-break: break-word;
}

.ds-modal__detail-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}

.ds-modal__detail-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.ds-modal__detail-section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text-muted, #718096);
}

.ds-modal__detail-body {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2, #f8fafc) 88%, var(--surface, #fff));
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  font: inherit;
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
}

.ds-modal__para--muted {
  color: var(--text-muted, #718096);
  font-size: 12px;
}

/* Fact cards: a detail sheet whose rows carry an icon. */
.ds-modal__detail-section-title > [data-ds-icon] { width: 18px; height: 18px; }
.ds-modal__detail-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); column-gap: 28px; }
.ds-modal__detail-columns { margin-top: 16px; padding-top: 14px; border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent); row-gap: 16px; }
.ds-modal__detail-columns > .ds-modal__detail-section { min-width: 0; margin-top: 0; padding-top: 0; border-top: 0; }
.ds-modal__detail-sheet--cards { gap: 10px; }
.ds-modal__detail-sheet--cards .ds-modal__detail-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2, #f8fafc) 70%, var(--surface, #fff));
}
.ds-modal__detail-row-icon {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--surface, #fff);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}
.ds-modal__detail-row-icon .ds-ico { width: 20px; height: 20px; }

@media (min-width: 641px) {
  .ds-modal--xl .ds-modal__detail-sheet { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .ds-modal__detail-sheet { grid-template-columns: 1fr; }
}

.ds-modal__form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
  align-items: start;
}

.ds-modal__form-grid > .ds-field,
.ds-modal__form-grid > .rlx-field {
  min-width: 0;
  margin: 0;
}

.ds-modal__form-grid .ds-field--full {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .ds-modal__form-grid { grid-template-columns: 1fr; }
  .ds-modal__head,
  .ds-modal__body,
  .ds-modal__foot { padding-inline: 16px; }
}

html.ds-overlay-lock,
html.ds-overlay-lock body,
body.ds-modal-open {
  overflow: hidden !important;
  overscroll-behavior: none;
}
html.ds-overlay-lock body {
  position: fixed;
  inset-inline: 0;
  width: 100%;
}
html.ds-overlay-lock .main,
html.ds-overlay-lock .content,
html.ds-overlay-lock #content {
  overscroll-behavior: none;
}

/* ---------- form controls in modal ---------- */
.ds-field__control { min-width: 0; }
.ds-field__control--dropdown .ds-dropdown,
.ds-field__control--dropdown .ds-dropdown--field { width: 100%; }
.ds-field__control--dropdown .ds-dropdown__trigger {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  justify-content: space-between;
  transition: border-color .28s ease, box-shadow .28s ease, background-color .28s ease;
}
.ds-field__control--dropdown .ds-dropdown__trigger:hover {
  border-color: color-mix(in srgb, var(--brand-500) 32%, var(--border));
  background: color-mix(in srgb, var(--brand-500) 4%, var(--surface));
}
.ds-field__control--dropdown .ds-dropdown.is-open .ds-dropdown__trigger {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 20%, transparent);
}
.ds-field__control--combo .cbx { width: 100%; }
.ds-field__control--combo .cbx-input {
  min-height: 42px;
  padding-inline-end: 34px;
}

/* themed file picker */
.ds-file-picker { display: flex; flex-direction: column; gap: 6px; }
.ds-file-picker__zone {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px dashed color-mix(in srgb, var(--brand-500) 38%, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--brand-500) 5%, var(--surface));
  cursor: pointer;
  transition: border-color .22s ease, background .22s ease, box-shadow .22s ease;
}
.ds-file-picker__zone:hover,
.ds-file-picker__zone:focus-visible {
  outline: none;
  border-color: var(--brand-500);
  background: color-mix(in srgb, var(--brand-500) 9%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 16%, transparent);
}
.ds-file-picker.has-file .ds-file-picker__zone {
  border-style: solid;
  border-color: color-mix(in srgb, var(--brand-500) 45%, var(--border));
  background: color-mix(in srgb, var(--t-green-50, #ecfdf5) 55%, var(--surface));
}
.ds-file-picker__icon { font-size: 22px; line-height: 1; flex-shrink: 0; }
.ds-file-picker__copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ds-file-picker__title { font-size: 13px; font-weight: 800; color: var(--text); }
.ds-file-picker__name {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ds-file-picker.has-file .ds-file-picker__name { color: var(--brand-600, #0d9488); font-weight: 600; }
.ds-file-picker__btn { flex-shrink: 0; pointer-events: none; }

/* combobox popup is appended to body — must sit above modal backdrop */
body.ds-modal-open .cbx-pop,
body.ds-overlay-lock .cbx-pop,
.rlx-backdrop ~ .cbx-pop {
  z-index: 10050 !important;
  position: fixed !important;
}
.rlx-backdrop .cbx-input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 20%, transparent);
}
body.ds-modal-open .jdp-pop { z-index: 10060 !important; }

/* dropdown inside upload modal — dropup + scroll menu only, not whole modal */
.ds-modal .ds-field__control--dropdown .ds-dropdown--dropup .ds-dropdown__menu {
  max-height: min(180px, 40vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ds-modal .ds-field__control--dropdown {
  position: relative;
  overflow: visible;
}

.ds-modal__form-grid {
  overflow: visible;
}

.ds-modal__form-grid--upload {
  gap: 14px;
}

.ds-modal__form-row--2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  grid-column: 1 / -1;
}

@media (max-width: 560px) {
  .ds-modal__form-row--2col { grid-template-columns: 1fr; }
}

.ds-field--half { min-width: 0; }

.ds-field__required {
  color: #e11d48;
  font-weight: 800;
  margin-inline-start: 2px;
}

.ds-field--error .ds-field__input,
.ds-field--error .ds-field__control,
.ds-field--error .ds-file-picker__zone {
  border-color: var(--danger, #e11d48) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger, #e11d48) 18%, transparent);
}

.ds-field__error {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--danger, #e11d48);
  margin-top: 4px;
  min-height: 0;
}

.ds-field__error:empty,
.ds-field__error[hidden] {
  display: none;
}

/* dropdown menu portaled above modal */
body.ds-modal-open .ds-dropdown__menu.ds-dropdown__menu--portal {
  z-index: 10055 !important;
  border-radius: 12px;
  box-shadow: 0 16px 40px -10px rgba(15, 23, 42, .28);
}

/* open dropdown in modal — unified shadow on trigger+menu */
.ds-modal .ds-dropdown.is-open {
  overflow: visible;
}

.ds-modal .ds-dropdown--field.is-open .ds-dropdown__trigger {
  box-shadow: 0 -4px 20px -6px rgba(15, 23, 42, .12);
}

.ds-modal .ds-dropdown--field.ds-dropdown--dropup.is-open .ds-dropdown__trigger {
  box-shadow: 0 4px 20px -6px rgba(15, 23, 42, .12);
}

/* Jalali date + time row (inbox due_at, etc.) */
.ds-jalali-dt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
  align-items: end;
}

.ds-jalali-dt-date .jdp,
.ds-jalali-dt-date .ds-field__input {
  width: 100%;
}

.ds-jalali-dt-time {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ds-jalali-dt-time-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
}

.ds-field__input--time {
  text-align: center;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 520px) {
  .ds-jalali-dt-row {
    grid-template-columns: 1fr;
  }
}

/* ── Semantic confirm Q&A (DsModal.confirm / DsConfirm) ── */
.ds-modal--confirm {
  width: min(440px, 90vw);
}

.ds-confirm {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.ds-confirm__icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--ds-modal-accent) 42%, var(--surface, #fff));
  color: var(--ds-modal-accent-deep);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ds-modal-accent) 55%, transparent);
}

.ds-confirm__icon .ds-ico,
.ds-confirm__icon-glyph {
  width: 26px;
  height: 26px;
}

.ds-confirm__copy {
  flex: 1;
  min-width: 0;
}

.ds-confirm__message {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.65;
  color: var(--text, #0f172a);
}

.ds-confirm__detail {
  margin: 8px 0 0;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--text-muted, #64748b);
}

.ds-modal__foot.ds-confirm__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ds-confirm__foot-spacer {
  flex: 1 1 8px;
  min-width: 8px;
}

.ds-confirm__yes--danger,
.ds-modal--rose .ds-confirm__foot .btn.primary {
  background: linear-gradient(135deg, #e11d48, #be123c);
  border-color: #be123c;
  color: #fff;
  box-shadow: 0 8px 20px -6px color-mix(in srgb, #e11d48 55%, transparent);
}

.ds-confirm__yes--danger:hover,
.ds-modal--rose .ds-confirm__foot .btn.primary:hover {
  filter: brightness(1.04);
}

.ds-modal--peach .ds-confirm__foot .btn.primary {
  background: linear-gradient(135deg, #ea580c, #c2410c);
  border-color: #c2410c;
  color: #fff;
  box-shadow: 0 8px 20px -6px color-mix(in srgb, #ea580c 50%, transparent);
}

.ds-confirm__yes--success,
.ds-modal--mint .ds-confirm__foot .btn.primary {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #059669;
  color: #fff;
  box-shadow: 0 8px 20px -6px color-mix(in srgb, #10b981 52%, transparent);
}

.ds-confirm__yes--success:hover,
.ds-modal--mint .ds-confirm__foot .btn.primary:hover {
  filter: brightness(1.04);
}

.ds-modal--sky .ds-confirm__foot .btn.primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border-color: #0369a1;
  color: #fff;
  box-shadow: 0 8px 20px -6px color-mix(in srgb, #0284c7 48%, transparent);
}
/* Pipeline stage form: two three-control rows. The first reallocates the
   two compact controls' freed width to the title (1.9:.7:.4); the second
   remains three equal columns. */
.rlx-modal--stage-form {
  width: min(760px, calc(100vw - 32px));
}
.rlx-stage-form-grid {
  grid-template-columns: repeat(30, minmax(0, 1fr));
  column-gap: 12px;
  row-gap: 12px;
}
/* The column spans apply only where the 30-column grid exists; below 700px
   the form is a single column (the id-based selectors would otherwise outrank
   the mobile rule and squeeze every full-width field). */
@media (min-width: 701px) {
  .rlx-stage-form-grid > .rlx-field:has(#rlx-f-label_fa) {
    grid-column: span 19;
    margin-inline: 0;
  }
  .rlx-stage-form-grid > .rlx-field:has(#rlx-f-terminal_outcome) { grid-column: span 7; }
  .rlx-stage-form-grid > .rlx-field:has(#rlx-f-sort_order) { grid-column: span 4; }
  .rlx-stage-form-grid > .rlx-field:has(#rlx-f-default_probability_pct),
  .rlx-stage-form-grid > .rlx-field:has(#rlx-f-sla_hours),
  .rlx-stage-form-grid > .rlx-field:has(#rlx-f-color) { grid-column: span 10; }
  /* Terminal-stage reopen policy: sized like «مهلت اقدام» and the «فعال» switch. */
  .rlx-stage-form-grid > .rlx-field:has(#rlx-f-reopen_within_days) { grid-column: span 10; }
  .rlx-stage-form-grid > .rlx-field:has(#rlx-f-reopen_reason_required) { grid-column: span 10; align-self: end; min-width: 0; }
  /* Branching pipeline: the default route takes two of the three columns, the
     start-stage switch the third, like the reopen policy row above. */
  .rlx-stage-form-grid > .rlx-field:has(#rlx-f-route_default) { grid-column: span 20; }
  .rlx-stage-form-grid > .rlx-field:has(#rlx-f-route_is_start) { grid-column: span 10; align-self: end; min-width: 0; }
  /* A new stage of a branching pipeline: its way in and its way out. */
  .rlx-stage-form-grid > .rlx-field:has(#rlx-f-route_from_rule),
  .rlx-stage-form-grid > .rlx-field:has(#rlx-f-route_to_rule) { grid-column: 1 / -1; min-width: 0; }
}
.rlx-stage-form-grid > .rlx-field > label:first-child {
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  opacity: 1;
}
.rlx-stage-form-grid > .rlx-checkbox-row {
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(190px, 220px));
  justify-content: start;
  align-self: end;
  margin: 0;
}
.rlx-stage-form-grid .rlx-check-cell {
  min-height: 46px;
}
@media (max-width: 700px) {
  .rlx-stage-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rlx-stage-form-grid > .rlx-field:nth-child(n),
  .rlx-stage-form-grid > .rlx-checkbox-row { grid-column: 1 / -1; }
}


/* /portal/ds/css/ds-tooltip.css */
/* Diaco DS Tooltip — design-system extract (FE9) */

.ds-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.ds-tip--inline { display: inline-flex; }

/* A tooltip wrapper inside the canonical route-tabs row is itself the flex
   item. It must keep the intrinsic width of its tab; otherwise the wrapper
   shrinks while the non-shrinking anchor overflows and overlaps its neighbor. */
.ds-pattern-tabs__list > .ds-tip {
  flex: 0 0 auto;
}

[data-ds-tip] { cursor: default !important; }
.ds-tip * { cursor: default !important; }
.ds-tip button,
.ds-tip a,
.ds-tip [role="button"],
.ds-tip button *,
.ds-tip a *,
.ds-tip [role="button"] * { cursor: pointer !important; }

.ds-tip--compact[data-ds-tip]::after {
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  max-width: none;
  white-space: nowrap;
  border-radius: 8px;
}

.ds-grid__row-actions .ds-tip {
  display: inline-flex;
  position: relative;
  z-index: 12;
}

.ds-grid__row-actions .ds-tip:hover,
.ds-grid__row-actions .ds-tip:focus-within,
.ds-grid__td-actions .ds-tip:hover,
.ds-grid__td-actions .ds-tip:focus-within {
  z-index: 300;
}

.ds-grid__td-actions .ds-tip {
  display: inline-flex;
  position: relative;
  z-index: 12;
}

.ds-grid__row-actions [data-ds-tip]::after,
.ds-grid__row-actions [data-ds-tip]::before,
.ds-grid__td-actions [data-ds-tip]::after,
.ds-grid__td-actions [data-ds-tip]::before {
  z-index: 301;
}

.ds-grid__row-actions [data-ds-tip]:not(:hover)::after,
.ds-grid__row-actions [data-ds-tip]:not(:hover)::before,
.ds-grid__td-actions [data-ds-tip]:not(:hover)::after,
.ds-grid__td-actions [data-ds-tip]:not(:hover)::before {
  content: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

.ds-grid__row-actions [data-ds-tip]:focus-within:not(:hover)::after,
.ds-grid__row-actions [data-ds-tip]:focus-within:not(:hover)::before,
.ds-grid__td-actions [data-ds-tip]:focus-within:not(:hover)::after,
.ds-grid__td-actions [data-ds-tip]:focus-within:not(:hover)::before {
  content: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

/* Grid float tip — fixed layer; pseudo tooltips disabled for row actions */
[data-ds-float-tip]::after,
[data-ds-float-tip]::before {
  content: none !important;
  display: none !important;
}

.ds-grid-float-tip {
  position: fixed;
  z-index: 2147483000;
  width: max-content;
  max-width: min(360px, calc(100vw - 16px));
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: start;
  direction: rtl;
  color: var(--text);
  background: color-mix(in srgb, var(--pastel-mint) 28%, var(--surface));
  background-color: var(--surface, #fff) !important;
  border: 1px solid color-mix(in srgb, var(--brand-500) 22%, var(--border));
  box-shadow: 0 10px 28px -8px rgba(15, 23, 42, .16), 0 2px 8px rgba(44, 120, 115, .08);
  pointer-events: none;
}

.ds-grid-float-tip::after { content: none; }

.ds-grid-float-tip--mint  { background: color-mix(in srgb, var(--pastel-mint) 45%, var(--surface)); }
.ds-grid-float-tip--sky   { background: color-mix(in srgb, var(--pastel-sky) 45%, var(--surface)); }
.ds-grid-float-tip--rose  { background: color-mix(in srgb, var(--pastel-rose) 45%, var(--surface)); }
.ds-grid-float-tip--amber { background: color-mix(in srgb, var(--pastel-peach) 50%, var(--surface)); }
.ds-grid-float-tip--peach { background: color-mix(in srgb, var(--pastel-peach) 50%, var(--surface)); }
.ds-grid-float-tip--lilac { background: color-mix(in srgb, var(--pastel-lilac) 48%, var(--surface)); }
.ds-grid-float-tip--slate { background: color-mix(in srgb, var(--muted) 10%, var(--surface)); }

/* Grid actions: start — RTL right (design-system sample) fallback when float tip off */
.ds-grid__row-actions [data-ds-tip][data-ds-tip-pos="bottom-end"]::after,
.ds-grid__row-actions [data-ds-tip][data-ds-tip-pos="bottom-end"]:hover::after,
.ds-grid__row-actions [data-ds-tip][data-ds-tip-pos="bottom-end"]:focus-within::after,
.ds-grid__td-actions [data-ds-tip][data-ds-tip-pos="bottom-end"]::after,
.ds-grid__td-actions [data-ds-tip][data-ds-tip-pos="bottom-end"]:hover::after,
.ds-grid__td-actions [data-ds-tip][data-ds-tip-pos="bottom-end"]:focus-within::after {
  top: calc(100% + 8px);
  bottom: auto;
  inset-inline-end: 0;
  inset-inline-start: auto;
  left: auto;
  right: auto;
  transform: translateY(-4px);
  max-width: min(280px, 72vw);
}

.ds-grid__row-actions [data-ds-tip][data-ds-tip-pos="bottom-end"]::before,
.ds-grid__td-actions [data-ds-tip][data-ds-tip-pos="bottom-end"]::before {
  top: calc(100% + 3px);
  bottom: auto;
  inset-inline-end: 10px;
  inset-inline-start: auto;
  left: auto;
  right: auto;
  margin: 0;
  border-bottom: none;
  border-inline-start: none;
  transform: rotate(45deg);
}

.ds-grid__row-actions [data-ds-tip][data-ds-tip-pos="bottom-end"]:hover::after,
.ds-grid__row-actions [data-ds-tip][data-ds-tip-pos="bottom-end"]:focus-within::after,
.ds-grid__td-actions [data-ds-tip][data-ds-tip-pos="bottom-end"]:hover::after,
.ds-grid__td-actions [data-ds-tip][data-ds-tip-pos="bottom-end"]:focus-within::after {
  transform: translateY(0);
}

/* Grid actions: tooltip to the RIGHT of btn — left edge of tip at right edge of btn */
.ds-grid__row-actions [data-ds-tip][data-ds-tip-pos="left-start"]::after,
.ds-grid__row-actions [data-ds-tip][data-ds-tip-pos="left-start"]:hover::after,
.ds-grid__row-actions [data-ds-tip][data-ds-tip-pos="left-start"]:focus-within::after,
.ds-grid__td-actions [data-ds-tip][data-ds-tip-pos="left-start"]::after,
.ds-grid__td-actions [data-ds-tip][data-ds-tip-pos="left-start"]:hover::after,
.ds-grid__td-actions [data-ds-tip][data-ds-tip-pos="left-start"]:focus-within::after {
  top: 50%;
  bottom: auto;
  left: calc(100% + 8px);
  right: auto;
  inset-inline-start: auto;
  inset-inline-end: auto;
  transform: translateY(-50%) translateX(-4px);
  max-width: min(240px, 60vw);
}

.ds-grid__row-actions [data-ds-tip][data-ds-tip-pos="left-start"]::before,
.ds-grid__td-actions [data-ds-tip][data-ds-tip-pos="left-start"]::before {
  top: 50%;
  bottom: auto;
  left: calc(100% + 2px);
  right: auto;
  inset-inline-start: auto;
  inset-inline-end: auto;
  margin: 0;
  transform: translateY(-50%) rotate(45deg);
  border-bottom: none;
  border-inline-end: none;
}

.ds-grid__row-actions [data-ds-tip][data-ds-tip-pos="left-start"]:hover::after,
.ds-grid__row-actions [data-ds-tip][data-ds-tip-pos="left-start"]:focus-within::after,
.ds-grid__td-actions [data-ds-tip][data-ds-tip-pos="left-start"]:hover::after,
.ds-grid__td-actions [data-ds-tip][data-ds-tip-pos="left-start"]:focus-within::after {
  transform: translateY(-50%) translateX(0);
}

/* Grid actions: tooltip inline-end of btn — RTL right edges align, body grows left */
.ds-grid__row-actions [data-ds-tip][data-ds-tip-pos="right-start"]::after,
.ds-grid__row-actions [data-ds-tip][data-ds-tip-pos="right-start"]:hover::after,
.ds-grid__row-actions [data-ds-tip][data-ds-tip-pos="right-start"]:focus-within::after,
.ds-grid__td-actions [data-ds-tip][data-ds-tip-pos="right-start"]::after,
.ds-grid__td-actions [data-ds-tip][data-ds-tip-pos="right-start"]:hover::after,
.ds-grid__td-actions [data-ds-tip][data-ds-tip-pos="right-start"]:focus-within::after {
  top: 50%;
  bottom: auto;
  inset-inline-start: auto;
  inset-inline-end: 100%;
  margin-inline-end: 8px;
  left: auto;
  right: auto;
  transform: translateY(-50%) translateX(4px);
  max-width: min(240px, 60vw);
}

.ds-grid__row-actions [data-ds-tip][data-ds-tip-pos="right-start"]::before,
.ds-grid__td-actions [data-ds-tip][data-ds-tip-pos="right-start"]::before {
  top: 50%;
  bottom: auto;
  inset-inline-start: auto;
  inset-inline-end: calc(100% - 2px);
  margin-inline-end: 8px;
  left: auto;
  right: auto;
  margin-top: 0;
  transform: translateY(-50%) rotate(45deg);
  border-bottom: none;
  border-inline-start: none;
}

.ds-grid__row-actions [data-ds-tip][data-ds-tip-pos="right-start"]:hover::after,
.ds-grid__row-actions [data-ds-tip][data-ds-tip-pos="right-start"]:focus-within::after,
.ds-grid__td-actions [data-ds-tip][data-ds-tip-pos="right-start"]:hover::after,
.ds-grid__td-actions [data-ds-tip][data-ds-tip-pos="right-start"]:focus-within::after {
  transform: translateY(-50%) translateX(0);
}

.ds-grid__row-actions .ds-grid__row-btn:focus-visible,
.ds-grid__td-actions .ds-grid__row-btn:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

[data-ds-tip] {
  cursor: default !important;
  --ds-tip-bg: color-mix(in srgb, var(--pastel-mint) 28%, var(--surface));
  --ds-tip-border: color-mix(in srgb, var(--brand-500) 22%, var(--border));
}

/* Tooltip metadata must never hide the affordance of an interactive host. */
:is(
  a[href], button:not(:disabled), summary,
  [role="button"]:not([aria-disabled="true"]),
  [role="link"]:not([aria-disabled="true"]),
  [role="tab"]:not([aria-disabled="true"]),
  [data-route], [data-action], [data-page], [data-href], [data-nav], [data-clickable]
)[data-ds-tip],
:is(
  a[href], button:not(:disabled), summary,
  [role="button"]:not([aria-disabled="true"]),
  [role="link"]:not([aria-disabled="true"]),
  [role="tab"]:not([aria-disabled="true"]),
  [data-route], [data-action], [data-page], [data-href], [data-nav], [data-clickable]
)[data-ds-tip] * {
  cursor: pointer !important;
}

[data-ds-tip]::after {
  content: attr(data-ds-tip);
  position: absolute;
  z-index: 60;
  /* max-content avoids shrink-to-fit against a narrow host (KPI cells, etc.) */
  width: max-content;
  max-width: min(280px, 82vw);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.55;
  text-align: start;
  white-space: normal;
  color: var(--text);
  /* Tooltip law: a readable tooltip must always be an opaque surface. */
  background: var(--ds-tip-bg, var(--surface, #fff));
  background-color: var(--surface, #fff) !important;
  border: 1px solid var(--ds-tip-border);
  box-shadow: 0 10px 28px -8px rgba(15, 23, 42, .16), 0 2px 8px rgba(44, 120, 115, .08);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .24s ease, transform .24s ease, visibility .24s;
}

[data-ds-tip]::before {
  content: "";
  position: absolute;
  z-index: 61;
  width: 8px;
  height: 8px;
  /* Keep the arrow attached to the same non-transparent bubble surface. */
  background: var(--ds-tip-bg, var(--surface, #fff));
  background-color: var(--surface, #fff) !important;
  border: 1px solid var(--ds-tip-border);
  transform: rotate(45deg);
  opacity: 0;
  visibility: hidden;
  transition: opacity .24s ease, transform .24s ease, visibility .24s;
}

[data-ds-tip][data-ds-tip-pos="top"]::after,
[data-ds-tip]:not([data-ds-tip-pos])::after {
  bottom: calc(100% + 10px);
  left: 50%;
  right: auto;
  transform: translateX(-50%) translateY(6px);
}

[data-ds-tip][data-ds-tip-pos="top"]::before,
[data-ds-tip]:not([data-ds-tip-pos])::before {
  bottom: calc(100% + 6px);
  left: 50%;
  right: auto;
  margin-left: -4px;
  border-top: none;
  border-inline-end: none;
}

[data-ds-tip][data-ds-tip-pos="bottom"]::after {
  top: calc(100% + 10px);
  left: 50%;
  right: auto;
  transform: translateX(-50%) translateY(-6px);
}

[data-ds-tip][data-ds-tip-pos="bottom"]::before {
  top: calc(100% + 6px);
  left: 50%;
  right: auto;
  margin-left: -4px;
  border-bottom: none;
  border-inline-start: none;
}

[data-ds-tip][data-ds-tip-pos="bottom-end"]::after {
  top: calc(100% + 10px);
  inset-inline-end: 0;
  inset-inline-start: auto;
  left: auto;
  right: auto;
  transform: translateY(-6px);
  max-width: min(280px, 72vw);
}

[data-ds-tip][data-ds-tip-pos="bottom-end"]::before {
  top: calc(100% + 6px);
  inset-inline-end: 12px;
  inset-inline-start: auto;
  left: auto;
  right: auto;
  margin: 0;
  border-bottom: none;
  border-inline-start: none;
}

[data-ds-tip][data-ds-tip-pos="bottom-end"]:hover::after,
[data-ds-tip][data-ds-tip-pos="bottom-end"]:focus-within::after {
  transform: translateY(0);
}

[data-ds-tip][data-ds-tip-pos="start"]::after {
  inset-inline-end: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(6px);
}

[data-ds-tip][data-ds-tip-pos="start"]::before {
  inset-inline-end: calc(100% + 6px);
  top: 50%;
  margin-top: -4px;
  border-top: none;
  border-inline-start: none;
}

[data-ds-tip][data-ds-tip-pos="end"]::after {
  inset-inline-start: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
}

[data-ds-tip][data-ds-tip-pos="end"]::before {
  inset-inline-start: calc(100% + 6px);
  top: 50%;
  margin-top: -4px;
  border-bottom: none;
  border-inline-end: none;
}

[data-ds-tip]:hover::after,
[data-ds-tip]:hover::before,
[data-ds-tip]:focus-within::after,
[data-ds-tip]:focus-within::before {
  opacity: 1;
  visibility: visible;
}

[data-ds-tip][data-ds-tip-pos="top"]:hover::after,
[data-ds-tip][data-ds-tip-pos="top"]:focus-within::after,
[data-ds-tip]:not([data-ds-tip-pos]):hover::after,
[data-ds-tip]:not([data-ds-tip-pos]):focus-within::after,
[data-ds-tip][data-ds-tip-pos="bottom"]:hover::after,
[data-ds-tip][data-ds-tip-pos="bottom"]:focus-within::after {
  transform: translateX(-50%) translateY(0);
}

[data-ds-tip][data-ds-tip-pos="start"]:hover::after,
[data-ds-tip][data-ds-tip-pos="start"]:focus-within::after {
  transform: translateY(-50%) translateX(0);
}

[data-ds-tip][data-ds-tip-pos="end"]:hover::after,
[data-ds-tip][data-ds-tip-pos="end"]:focus-within::after {
  transform: translateY(-50%) translateX(0);
}

[data-ds-tip-tone="mint"]  { --ds-tip-bg: color-mix(in srgb, var(--pastel-mint) 45%, var(--surface)); }
[data-ds-tip-tone="sky"]   { --ds-tip-bg: color-mix(in srgb, var(--pastel-sky) 45%, var(--surface)); }
[data-ds-tip-tone="rose"]  { --ds-tip-bg: color-mix(in srgb, var(--pastel-rose) 45%, var(--surface)); }
[data-ds-tip-tone="amber"] { --ds-tip-bg: color-mix(in srgb, var(--pastel-peach) 50%, var(--surface)); }
[data-ds-tip-tone="peach"] { --ds-tip-bg: color-mix(in srgb, var(--pastel-peach) 50%, var(--surface)); }
[data-ds-tip-tone="lilac"] { --ds-tip-bg: color-mix(in srgb, var(--pastel-lilac) 48%, var(--surface)); }
[data-ds-tip-tone="slate"] { --ds-tip-bg: color-mix(in srgb, var(--muted) 10%, var(--surface)); }

.ds-tip--semantic:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand-500) 72%, transparent);
  outline-offset: 3px;
  border-radius: 8px;
}

/* Semantic annotations must be layout-neutral. They can decorate an
   existing grid/flex/block region but must never redefine its display. */
.ds-tip--semantic { min-width: 0; }

[data-theme="dark"] [data-ds-tip] {
  --ds-tip-bg: color-mix(in srgb, var(--brand-500) 15%, var(--surface));
  --ds-tip-border: color-mix(in srgb, var(--brand-500) 35%, var(--border));
}

[data-theme="dark"] [data-ds-tip]::after {
  color: var(--text);
}

/* Virtual machines and remote desktops usually run with animations turned
   off. A tooltip must then appear at once instead of depending on a fade. */
@media (prefers-reduced-motion: reduce) {
  [data-ds-tip]::after,
  [data-ds-tip]::before {
    transition: none !important;
  }
}


/* /portal/ds/css/guided-execution.css */
.gex-shell {
  position: fixed; inset: 0; z-index: 10050; direction: rtl;
  font-family: var(--font-family, "Vazirmatn", sans-serif); pointer-events: none;
  opacity: 0; visibility: hidden;
  transition: opacity .18s ease, visibility 0s linear .18s;
}
.gex-shell[hidden] { display: none; }
.gex-shell.gex-shell--visible { opacity: 1; visibility: visible; transition-delay: 0s; }
.gex-shell > .gex-scrim {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  overflow: visible; pointer-events: none;
}
.gex-highlight {
  position: fixed; z-index: 10052; box-sizing: border-box;
  border: 3px solid color-mix(in srgb, var(--brand-500, #0f766e) 76%, #fff);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-500, #0f766e) 18%, transparent);
  pointer-events: none;
  opacity: 1;
  transition: left .22s ease, top .22s ease, width .22s ease, height .22s ease, border-radius .22s ease, opacity .16s ease;
}
.gex-popover {
  position: fixed; z-index: 10053; width: min(376px, calc(100vw - 32px)); overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--brand-500, #0f766e) 24%, var(--border));
  border-radius: var(--radius-xl, 18px); background: var(--surface, #fff); color: var(--text);
  box-shadow: 0 22px 60px rgba(15, 23, 42, .24); pointer-events: auto;
  opacity: 0; transform: translateY(8px) scale(.985);
  transition: left .32s cubic-bezier(.22, .8, .24, 1), top .32s cubic-bezier(.22, .8, .24, 1), width .32s cubic-bezier(.22, .8, .24, 1), height .32s cubic-bezier(.22, .8, .24, 1), border-radius .32s cubic-bezier(.22, .8, .24, 1), box-shadow .32s cubic-bezier(.22, .8, .24, 1), background-color .32s ease, opacity .2s ease, transform .2s cubic-bezier(.22, .8, .24, 1);
}
.gex-shell--visible .gex-popover { opacity: 1; transform: none; }
.gex-shell--moving .gex-popover { opacity: .78; transform: translateY(2px) scale(.99); border-radius: calc(var(--radius-xl, 18px) + 6px); background-color: color-mix(in srgb, var(--surface, #fff) 92%, var(--brand-50, #ecfdf5)); box-shadow: 0 14px 42px rgba(15, 23, 42, .18); }
.gex-shell--moving .gex-highlight { opacity: 0; }
.gex-popover__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px 10px; }
.gex-eyebrow { margin: 0; color: var(--brand-700, #0f766e); font-size: 11px; font-weight: 800; }
.gex-close {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0;
  border-radius: var(--radius-sm, 9px); background: var(--surface-2, #f8fafc);
  color: var(--text-muted); font: 700 20px/1 sans-serif; cursor: pointer;
}
.gex-close:hover { background: color-mix(in srgb, var(--brand-500, #0f766e) 10%, var(--surface)); color: var(--brand-700, #0f766e); }
.gex-progress { height: 3px; margin: 0 18px 16px; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--brand-500, #0f766e) 12%, var(--surface-2)); }
.gex-progress > i { display: block; height: 100%; border-radius: inherit; background: var(--brand-500, #0f766e); transition: width .28s ease; }
.gex-popover h2 { margin: 0; padding: 0 18px 7px; color: var(--text); font-size: 18px; line-height: 1.65; }
.gex-popover p { margin: 0; padding: 0 18px; color: var(--text-2, var(--text-muted)); font-size: 13px; line-height: 2; }
.gex-details { display: grid; gap: 8px; margin: 12px 18px 0; }
.gex-details[hidden] { display: none; }
.gex-detail { display: grid; gap: 2px; padding: 8px 12px; border-radius: var(--radius-md, 12px); background: var(--surface-2, #f8fafc); }
.gex-detail > b { color: var(--brand-700, #0f766e); font-size: 12px; font-weight: 800; line-height: 1.8; }
.gex-detail > span { color: var(--text-2, var(--text-muted)); font-size: 12.5px; line-height: 1.9; }
.gex-example, .gex-error { margin: 12px 18px 0; padding: 10px 12px; border-radius: var(--radius-md, 12px); font-size: 12px; line-height: 1.8; }
.gex-example { border-inline-start: 3px solid var(--brand-500, #0f766e); background: var(--surface-2, #f8fafc); }
.gex-error { background: color-mix(in srgb, var(--red-500, #e0435b) 9%, var(--surface)); color: var(--red-600, #c13248); }
.gex-actions { display: flex; justify-content: flex-start; gap: 8px; margin-top: 16px; padding: 13px 18px 16px; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2, #f8fafc) 55%, var(--surface)); }
.gex-actions .btn { height: 40px; }
/* GEX-348: long desktop/tablet guides grow sideways and use the available
   reading width instead of creating a nested vertical scrollbar. */
.gex-popover[data-gex-wide="true"] .gex-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gex-launcher {
  display: inline-flex !important; align-items: center; justify-content: center; flex: none;
  width: 40px !important; height: 40px !important; min-width: 40px !important; min-height: 40px !important;
  padding: 0 !important; border: 1px solid var(--border) !important;
  border-radius: var(--radius-md, 12px) !important; background: var(--surface, #fff) !important;
  color: var(--brand-700, #0f766e) !important; box-shadow: var(--shadow-xs, 0 1px 2px rgba(15, 23, 42, .08)) !important;
}
.gex-launcher:hover { border-color: color-mix(in srgb, var(--brand-500, #0f766e) 35%, var(--border)) !important; background: var(--surface-2, #f8fafc) !important; }
.gex-launcher svg, .gex-launcher [data-ds-icon] { width: 18px; height: 18px; }
.gex-title-row { display: flex !important; align-items: center !important; gap: 12px !important; width: max-content; max-width: 100%; }
.gex-form-title-row { display:flex; align-items:center; justify-content:flex-start; gap:10px; margin:0 0 10px; direction:rtl; }
.gex-form-title-row > h3 { margin:0; min-width:0; }
.gex-form-launcher { flex:0 0 40px; }
.gex-title-row > .page-title, .gex-title-row > h1 { margin-block: 0 !important; }
/* GEX-390: relative, not static, so the .btn hover shine (::before, left:-100%) stays inside the launcher
   instead of widening the page header and scrolling it sideways in RTL. No offsets are set, so the place is unchanged. */
.gex-launcher--after-title, .gex-launcher-title-anchor .gex-launcher--after-title { position: relative !important; }
.gex-launcher-title-anchor { display: inline-flex !important; align-items: center !important; flex: none !important; }

.gex-chooser__note { margin: 0 !important; padding: 12px 14px !important; border-radius: var(--radius-md, 12px) !important; line-height: 1.8 !important; }
.gex-guide-list { display: grid; gap: 12px; margin-top: 16px; }
.gex-guide-list .gex-guide-option {
  display: flex !important; flex-direction: row !important; align-items: center !important;
  justify-content: space-between !important; gap: 16px !important; width: 100% !important;
  height: auto !important; min-height: 72px !important; padding: 12px 16px !important;
  border: 1px solid var(--border) !important; border-radius: var(--radius-lg, 14px) !important;
  background: var(--surface, #fff) !important; color: var(--text) !important;
  text-align: right !important; white-space: normal !important;
}
.gex-guide-list .gex-guide-option:hover { border-color: color-mix(in srgb, var(--brand-500, #0f766e) 45%, var(--border)) !important; background: color-mix(in srgb, var(--brand-50, #ecfdf5) 55%, var(--surface)) !important; }
.gex-guide-list .gex-guide-option:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand-500, #0f766e) 28%, transparent) !important; outline-offset: 2px; }
.gex-guide-option__copy { display: grid; flex: 1; gap: 4px; min-width: 0; justify-items: start; text-align: right !important; }
.gex-guide-option__copy b { color: var(--text); font-size: 14px; line-height: 1.7; }
.gex-guide-option__copy small { margin: 0; color: var(--text-muted); font-size: 12px; line-height: 1.8; }
.gex-guide-option__arrow { align-self: center; flex: none; width: 18px; height: 18px; color: var(--brand-600, #0f766e); }

@media (max-width: 700px) {
  .gex-popover { inset-inline: 12px !important; top: auto !important; bottom: 12px !important; width: auto !important; }
  /* GEX-252: when the target sits in the lower half and cannot scroll higher
     (end of a form), the renderer chooses the top side; the bottom sheet must
     then move to the top instead of covering the field the user must fill. */
  .gex-popover[data-gex-side="top"] { top: 12px !important; bottom: auto !important; }
  .gex-actions .btn { flex: 1; min-height: 44px; justify-content: center; }
  .gex-title-row { gap: 8px !important; }
  .gex-guide-list .gex-guide-option { min-height: 68px !important; padding: 11px 13px !important; }
  .gex-popover[data-gex-wide="true"] .gex-details { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .gex-shell, .gex-highlight, .gex-progress > i, .gex-popover { transition: none; }
}


/* /portal/ds/css/qr-engine.css */
/*
 * QR Engine (L1) — namespace qre-*. Shared modal used by every QR consumer
 * (offline-marketing, advisors, profiles-detail) + trigger button styling.
 * Built on ui-kit tokens; theme-aware + RTL (TRFC-0002 / ARFC-0003 T2).
 */
.qre-trigger { display: inline-flex; align-items: center; gap: 6px; font-family: inherit;
  font-size: 12px; font-weight: 600; padding: 7px 12px; border-radius: 10px;
  border: 1px solid var(--border, #e9ebf3); background: var(--surface, #fff);
  color: var(--text, #23283b); cursor: pointer; transition: box-shadow .15s, transform .15s; }
.qre-trigger:hover { box-shadow: 0 4px 14px rgba(30, 109, 255, .14); transform: translateY(-1px); }
.qre-trigger__ic { font-size: 14px; line-height: 1; }

.qre-modal-back { position: fixed; inset: 0; background: rgba(15, 20, 35, .48);
  display: flex; align-items: center; justify-content: center; z-index: 1200;
  opacity: 0; transition: opacity .18s ease; padding: 16px; }
.qre-modal-back.is-open { opacity: 1; }
.qre-modal { position: relative; width: min(360px, 100%); background: var(--surface, #fff);
  border-radius: var(--radius-lg, 20px); overflow: hidden; text-align: center;
  box-shadow: 0 24px 60px rgba(20, 25, 50, .22); transform: scale(.96); transition: transform .18s ease; }
.qre-modal-back.is-open .qre-modal { transform: scale(1); }

/* Header treatment borrowed from DiacoUI drawer template (.rui-drawer__head et al. in
   ui-kit.css): gradient band (accent → darker) + soft blurred orbs + frosted glass icon
   badge + glass close button that rotates on hover. Kept centered (not edge-anchored)
   because the QR preview/payload/actions below must stay mounted in one body area. */
.qre-modal__head {
  position: relative; overflow: hidden; isolation: isolate;
  padding: 26px 20px 20px;
  background: linear-gradient(155deg, var(--rui-accent) 0%, color-mix(in srgb, var(--rui-accent) 55%, #10162c) 115%);
  color: #fff;
}
.qre-modal__orb { position: absolute; border-radius: 50%; background: #fff; filter: blur(28px); pointer-events: none; z-index: -1; }
.qre-modal__orb-a { width: 140px; height: 140px; top: -60px; inset-inline-start: -40px; opacity: .16; }
.qre-modal__orb-b { width: 100px; height: 100px; bottom: -46px; inset-inline-end: 8px; opacity: .12; }
.qre-modal__head-row { display: flex; align-items: center; gap: 12px; text-align: start; }
.qre-modal__ic {
  width: 44px; height: 44px; border-radius: 14px; flex: none; font-size: 20px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.2); backdrop-filter: blur(6px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.32), 0 8px 18px -8px rgba(0,0,0,.3);
}
.qre-modal__title { font-size: 15.5px; font-weight: 800; color: #fff; margin: 0 0 4px; }
.qre-modal__sub { font-size: 12px; color: rgba(255,255,255,.82); margin: 0; }
.qre-modal__close {
  position: absolute; top: 14px; left: 14px; z-index: 2; border: none; font-size: 14px; line-height: 1; cursor: pointer;
  color: #fff; background: rgba(255,255,255,.2); backdrop-filter: blur(6px);
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.3);
  transition: background .15s, transform .2s;
}
html[dir="ltr"] .qre-modal__close, [dir="ltr"] .qre-modal__close { left: auto; right: 14px; }
.qre-modal__close:hover { background: rgba(255,255,255,.34); transform: rotate(90deg); }

.qre-modal__body { padding: 18px 20px 18px; }
.qre-modal__preview { display: flex; justify-content: center; margin: 4px 0 14px; }
.qre-modal__preview .qre-qr { width: 200px; height: 200px; border: 1px solid var(--border, #e9ebf3);
  border-radius: 10px; }
.qre-qr rect:not(:first-child) { fill: #16324a; }
[data-theme="dark"] .qre-qr rect:first-child { fill: #e8eefc; }
[data-theme="dark"] .qre-qr rect:not(:first-child) { fill: #16324a; }
.qre-modal__error { font-size: 12.5px; color: #ef4444; background: rgba(239, 68, 68, .1);
  border-radius: 10px; padding: 12px; margin-bottom: 14px; }
.qre-modal__payload { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  justify-content: center; margin-bottom: 14px; }
.qre-modal__link { font-size: 10.5px; color: var(--muted, #8a90a6); word-break: break-all;
  max-width: 100%; }
.qre-modal__copy { font-size: 11px; font-weight: 600; border: 1px solid var(--border, #e9ebf3);
  background: var(--surface, #fff); color: #1e6dff; border-radius: 999px; padding: 4px 10px;
  cursor: pointer; }
.qre-modal__copy:hover { background: rgba(30, 109, 255, .08); }
.qre-modal__actions { display: flex; gap: 8px; justify-content: center; }
.qre-modal__dl { flex: 1; font-family: inherit; font-size: 12.5px; font-weight: 700;
  padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border, #e9ebf3);
  background: var(--bg-soft, #f3f4f9); color: var(--text, #23283b); cursor: pointer; }
.qre-modal__dl:hover { background: var(--border, #e9ebf3); }

.qre-badge { font-size: 10px; font-weight: 700; border-radius: 999px; padding: 3px 9px; }
.qre-badge--public { background: rgba(16, 185, 129, .12); color: #0d9668; }
.qre-badge--internal { background: rgba(245, 158, 11, .14); color: #b45309; }

[data-theme="dark"] .qre-modal,
[data-theme="dark"] .qre-trigger,
[data-theme="dark"] .qre-modal__copy,
[data-theme="dark"] .qre-modal__dl { background: var(--surface, #1b1f2e); border-color: var(--border, #2a3042); }
/* .qre-modal__close intentionally NOT re-themed for dark mode: it sits on the
   gradient header band (not the surface), so it keeps its glass-on-color look
   in both themes — same as .rui-drawer__close. */

@media (max-width: 420px) {
  .qre-modal__head { padding: 20px 14px 16px; }
  .qre-modal__body { padding: 14px 14px 14px; }
  .qre-modal__preview .qre-qr { width: 170px; height: 170px; }
}


/* /portal/ds/css/ds-time-picker.css */
/* Persian time picker (ds-pickers.js attachDsTimeInput / attachDsDateTimeInput) for pages that do
   not load the catalog stylesheet, such as the customer portal. The rules are the catalog's own
   (design-system.css «Custom time picker») without the catalog-shell prefix, plus the popup frame
   the catalog gives every picker. Before 1405/08/24 the portal had none of it, so the clock opened
   as a bare unstyled box under the field. Keep both copies in step. */
.ds-ptp-popup {
  position: fixed;
  z-index: 10040;
  background: var(--surface);
  border: 1px solid var(--border);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: auto;
}
.ds-ptp-popup.is-open { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .ds-ptp-popup { transition: none; } }

/* Custom time picker */
.ds-ptp-popup {
  width: 280px;
  padding: 0;
  border-radius: 16px;
  overflow: hidden;
  border-color: var(--border-strong);
  box-shadow: 0 14px 40px color-mix(in srgb, var(--text) 14%, transparent);
}

.ds-ptp {
  padding: 14px 14px 10px;
  background: linear-gradient(180deg, var(--surface) 0%, color-mix(in srgb, var(--brand-500) 4%, var(--surface)) 100%);
}

.ds-ptp__display {
  text-align: center;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--brand-700);
  line-height: 1.1;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--brand-500) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--brand-500) 18%, var(--border));
  direction: ltr;
}

.ds-ptp__controls {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  direction: ltr;
}

.ds-ptp__clock {
  padding: 10px 8px 8px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--brand-500) 6%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--brand-500) 14%, var(--border));
}

.ds-ptp__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.ds-ptp__step {
  width: 64px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease, transform .12s ease;
  padding: 0;
}

.ds-ptp__step:hover {
  border-color: var(--brand-400);
  background: color-mix(in srgb, var(--brand-500) 10%, var(--surface));
  color: var(--brand-700);
}

.ds-ptp__step:active { transform: scale(.96); }

.ds-ptp__input {
  width: 64px;
  height: 52px;
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  direction: ltr;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.ds-ptp__input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 18%, transparent);
}

.ds-ptp__lbl {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
}

.ds-ptp__sep {
  font-size: 28px;
  font-weight: 800;
  color: var(--brand-500);
  align-self: center;
  margin-top: 28px;
  line-height: 1;
  direction: ltr;
  user-select: none;
}

.ds-ptp__quick,
.ds-ptp__presets {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.ds-ptp__quick-title {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.ds-ptp__quick-row,
.ds-ptp__preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ds-ptp__quick-btn,
.ds-ptp__preset {
  min-width: 44px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  direction: ltr;
  transition: all .15s ease;
}

.ds-ptp__quick-btn:hover,
.ds-ptp__preset:hover {
  border-color: var(--brand-400);
  color: var(--brand-700);
  background: color-mix(in srgb, var(--brand-500) 8%, var(--surface));
}

.ds-ptp__quick-btn.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--brand-500) 30%, transparent);
}

.ds-ptp .pdp-foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.ds-ptp .pdp-foot-btn:not(.pdp-foot-btn-ghost) {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  border-color: transparent;
  color: #fff;
}

.ds-ptp .pdp-foot-btn-today {
  background: color-mix(in srgb, var(--brand-500) 12%, var(--surface));
  border-color: var(--brand-300);
  color: var(--brand-700);
}

/* Jalali datetime picker (date + time combined) */
.ds-pdt__split {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 12px;
  flex-wrap: nowrap;
}

.ds-pdt__calendar {
  flex: 1 1 auto;
  min-width: 0;
  width: 0;
  overflow: hidden;
}

.ds-pdt__split .ds-pdt__time {
  flex: 0 0 152px;
  width: 152px;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  border-inline-start: 1px dashed var(--border);
  padding-inline-start: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-shrink: 0;
}

.ds-pdt__time-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin-bottom: 8px;
}

.ds-pdt__time-preview {
  font-size: 17px;
  font-weight: 800;
  color: var(--brand-700);
  direction: ltr;
  letter-spacing: .05em;
  line-height: 1.1;
}

.ds-ptp__clock--compact {
  padding: 8px 6px 6px;
  border-radius: 12px;
}

.ds-ptp__quick--inline {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.ds-ptp__quick-row--grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.ds-ptp__quick-row--grid .ds-ptp__quick-btn {
  min-width: 0;
  width: 100%;
  padding: 5px 0;
  font-size: 11px;
  border-radius: 8px;
}

.ds-pdt__display {
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--brand-700);
  line-height: 1.3;
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--brand-500) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--brand-500) 18%, var(--border));
  direction: ltr;
}

.ds-pdt__time {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.ds-pdt__time-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  margin-bottom: 6px;
  text-align: center;
}

.ds-ptp__controls--compact {
  gap: 8px;
}

.ds-ptp__controls--compact .ds-ptp__input {
  width: 52px;
  height: 44px;
  font-size: 20px;
}

.ds-ptp__controls--compact .ds-ptp__step {
  width: 52px;
  height: 28px;
}

.ds-pdt__time .ds-ptp__quick-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.ds-pdt__split .ds-ptp__controls--compact .ds-ptp__input {
  width: 44px;
  height: 38px;
  font-size: 18px;
}

.ds-pdt__split .ds-ptp__controls--compact .ds-ptp__step {
  width: 44px;
  height: 24px;
}

.ds-pdt__split .ds-ptp__controls--compact {
  gap: 6px;
}

.ds-pdt__split .ds-ptp__sep {
  margin-top: 22px;
  font-size: 20px;
  line-height: 1;
  align-self: flex-start;
}

.ds-ptp__controls--compact .ds-ptp__lbl {
  font-size: 9px;
  margin-top: 1px;
}

@media (max-width: 520px) {
  .ds-pdt__split {
    flex-direction: column;
  }
  .ds-pdt__calendar {
    width: 100%;
  }
  .ds-pdt__split .ds-pdt__time {
    flex: none;
    width: 100%;
    border-inline-start: none;
    border-top: 1px dashed var(--border);
    padding-inline-start: 0;
    padding-top: 8px;
  }
}

.pdp-trigger,
.ds-ptp__step,
.ds-ptp__quick-btn,
.ds-ptp__preset {
  cursor: pointer;
}


/* /portal/assets/portal.css */
/* Customer portal page layout (docs/CUSTOMER_PORTAL.md). Components (hero,
   KPI cards, forms, inbox, upload, accordion, notes, tabs, master-detail list,
   detail facts) are the panel design-system ones served from /portal/ds; this
   file only arranges the page and puts sections on token-based surfaces. */
body.portal{min-height:100vh;margin:0;display:flex;flex-direction:column;background:var(--bg);color:var(--text);font-family:var(--font-family,'Vazirmatn',sans-serif)}
html:not([data-portal-ready="true"]) .portal__header,html:not([data-portal-ready="true"]) .portal__footer{visibility:hidden}
.portal__skip{position:absolute;inset-inline-start:-9999px}
.portal__skip:focus{inset-inline-start:16px;top:8px;z-index:10;padding:8px 12px;border-radius:10px;background:var(--surface)}

/* ---- header: brand · pages and sections · account ---- */
.portal__header{position:sticky;top:0;z-index:5;display:flex;align-items:center;gap:12px 20px;padding:10px max(16px,calc((100vw - 1200px) / 2));border-bottom:1px solid var(--border);background:color-mix(in srgb,var(--surface) 92%,transparent);backdrop-filter:blur(10px)}
.portal__brand{display:flex;align-items:center;gap:10px;min-width:0;color:var(--text);text-decoration:none}
.portal__brand img{max-height:36px;width:auto}
.portal__brand strong{font-size:1rem;overflow-wrap:anywhere}
.portal__identity{display:grid;min-width:0}
.portal__identity small{color:var(--text-muted);overflow-wrap:anywhere}
.portal__brand>.ds-entity-avatar{flex:0 0 auto}
.portal__brand .ds-pattern-avatar{flex:0 0 auto}
.portal__brand [hidden]{display:none}
.portal__nav{display:flex;align-items:center;gap:4px;flex:1;min-width:0;overflow-x:auto;scrollbar-width:none}
.portal__nav::-webkit-scrollbar{display:none}
.portal__nav a{display:inline-flex;align-items:center;gap:6px;flex:0 0 auto;padding:8px 12px;border-radius:999px;color:var(--text-muted);text-decoration:none;font-size:.88rem;font-weight:600;white-space:nowrap}
.portal__nav a [data-ds-icon]{display:inline-flex;width:18px;height:18px}
.portal__nav a:hover,.portal__nav a:focus-visible{color:var(--brand-700);background:var(--brand-50)}
.portal__nav a[aria-current="page"]{color:var(--brand-700);background:var(--brand-50)}
.portal__nav-sep{flex:0 0 1px;align-self:stretch;margin:6px 4px;background:var(--border)}
.portal__account{display:flex;align-items:center;gap:8px;flex:0 0 auto}
.portal__user{display:inline-flex;align-items:center;gap:8px;padding:4px 4px 4px 12px;border:1px solid var(--border);border-radius:999px;color:var(--text);text-decoration:none;font-size:.86rem;font-weight:700;white-space:nowrap}
.portal__user:hover,.portal__user:focus-visible,.portal__user[aria-current="page"]{border-color:var(--brand-300);background:var(--brand-50)}

/* ---- page frame ---- */
.portal__main{flex:1;width:min(1440px,100%);box-sizing:border-box;margin:0 auto;padding:24px clamp(16px,2.5vw,36px) 48px;display:grid;grid-template-columns:minmax(0,1fr);gap:18px;align-content:start;outline:0}
.portal__footer{padding:18px 16px;border-top:1px solid var(--border);color:var(--text-muted);font-size:.8rem;text-align:center;background:var(--surface)}
.portal__page{display:grid;gap:18px}
.portal__page-title{margin:0;font-size:1.35rem}
.portal__notice[hidden]{display:none}
.portal__hero .ds-page-hero__visual{display:grid;place-items:center}
.portal__hero-image{max-width:100%;max-height:260px;border-radius:16px;object-fit:cover}

/* One surface for every section of a portal page. */
.portal__panel{display:grid;gap:14px;align-content:start;min-width:0;padding:20px;border:1px solid var(--border);border-radius:var(--radius-lg,20px);background:var(--surface);box-shadow:var(--shadow-xs)}
.portal__panel-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px 16px}
.portal__panel-head h2{margin:0;font-size:1.05rem}
.portal__panel-head p{margin:4px 0 0;color:var(--text-muted);font-size:.86rem;line-height:1.8}
.portal__panel>.ds-pattern-detail-facts{margin:0}

/* Main column + side column (ticket, new ticket, profile). */
.portal__split{display:grid;grid-template-columns:minmax(0,1fr) minmax(280px,340px);align-items:start;gap:18px}
.portal__aside{display:grid;gap:18px;align-content:start;position:sticky;top:86px}
.portal__aside .ds-pattern-detail-facts{grid-template-columns:repeat(2,minmax(0,1fr))}
.portal__tips{margin:0;padding-inline-start:18px;display:grid;gap:8px;color:var(--text-muted);font-size:.88rem;line-height:1.8}

/* ---- content blocks ---- */
.portal__image{display:block;max-width:100%;height:auto;border-radius:14px}
.portal__figure{margin:0}
.portal__figure figcaption{margin-top:8px;color:var(--text-muted);font-size:.85rem}
.portal__media-text{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:20px;align-items:center}
.portal__media-text--end>img{order:2}
.portal__text p,.portal__media-text p{margin:0;line-height:1.9}
.portal__cta{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px}
.portal__cta h2{margin:0;font-size:1.1rem}
.portal__cta p{margin:6px 0 0;color:var(--text-muted)}
.portal__features{grid-template-columns:repeat(auto-fit,minmax(220px,1fr))}
.portal__features .kpi-label{color:var(--text);font-size:.95rem;font-weight:800}
.portal__features .kpi-delta{display:block;margin-top:6px;color:var(--text-muted);font-size:.85rem;line-height:1.8;font-weight:500}
.portal__contact{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}
.portal__contact>.ds-pattern-detail-note{margin:0}
.portal__contact strong{display:flex;align-items:center;gap:6px}
.portal__contact strong .ds-ico{width:18px;height:18px;color:var(--brand-700)}
/* Icon inside a catalog avatar (ticket rows, sign-in head): sized like the avatar's letters. */
.portal .ds-pattern-avatar .ds-ico{width:20px;height:20px}
.portal .ds-pattern-avatar--lg .ds-ico{width:26px;height:26px}
/* Account book: the table scrolls inside its own frame instead of widening the panel on a phone. */
.portal [data-ledger-body]{min-width:0}
.portal [data-ledger-body] .rui-table td:nth-child(3){min-width:200px}
/* Empty-state icon: the catalog size (ds-grid.css), which the portal does not load. */
.portal .rui-empty__icon .ds-ico{width:1.35em;height:1.35em;vertical-align:middle}

/* ---- sign-in ---- */
.portal__auth{width:min(480px,100%);margin:12px auto 0;box-sizing:border-box;padding:28px}
.portal__auth-head{display:grid;justify-items:center;gap:10px;text-align:center;min-inline-size:0}
.portal__auth-head h1{margin:0;font-size:1.25rem;min-inline-size:0;overflow-wrap:anywhere}
.portal__auth-head p{margin:0;color:var(--text-muted);font-size:.9rem;line-height:1.8}
.portal__auth .ds-form-actions{justify-content:space-between}
.portal__auth-foot{margin:0;padding-top:14px;border-top:1px solid var(--border);color:var(--text-muted);font-size:.82rem;line-height:1.8;text-align:center}

/* ---- tickets ---- */
/* The list is used on its own (no detail pane beside it), so it drops the split divider. */
.portal__ticket-list{display:grid;gap:6px;padding:0;border:0}
.portal__ticket-list a{text-decoration:none;color:inherit}
.portal__ticket-list .ds-pattern-master-detail__item{border-color:var(--border);background:var(--surface)}
.portal__ticket-list .ds-pattern-master-detail__item>span:nth-child(2){min-width:0}
.portal__ticket-end{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:6px}
.portal__amount{white-space:nowrap;font-weight:800}
.portal__conversation{grid-template-columns:1fr;min-width:0;min-height:420px;box-shadow:none}
.portal__conversation .ds-pattern-inbox__conversation{height:min(640px,calc(100vh - 230px));min-height:460px}
.portal__conversation .ds-pattern-inbox__messages{min-height:0;overflow-y:auto}
.portal__ticket-files{display:grid;gap:8px}.portal__ticket-files .ds-pattern-inbox__file{margin:0}
.portal__reply-field{display:flex;min-width:0;margin:0}
.portal__reply-field textarea{box-sizing:border-box;width:100%;min-height:44px;max-height:92px;padding:10px 12px;resize:none;overflow-y:hidden;border:0;border-radius:12px;outline:0;color:var(--text);background:var(--surface);font:inherit;font-size:16px;line-height:1.5}
.portal__reply-field>.sr-only{position:absolute!important;width:1px!important;height:1px!important;margin:-1px!important;padding:0!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}

/* ---- company users ---- */
.portal__users{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:12px}
.portal__user-card{display:grid;gap:10px;align-content:start;padding:14px;border:1px solid var(--border);border-radius:var(--radius,14px);background:var(--surface-2)}
.portal__user-card>header{display:flex;align-items:center;gap:10px}
.portal__user-card>header>span:nth-child(2){display:grid;flex:1;min-width:0}
.portal__user-card>header small{color:var(--text-muted);font-size:.8rem}
.portal__user-card .ds-inline-row{flex-wrap:wrap}

@media(max-width:1000px){
  .portal__split{grid-template-columns:1fr}
  .portal__aside{position:static}
}
@media(max-width:800px){
  .portal__header{flex-wrap:wrap;padding:10px 16px}
  .portal__brand{flex:1;min-width:0}
  .portal__nav{order:3;flex-basis:100%}
  .portal__media-text{grid-template-columns:1fr}
  .portal__media-text--end>img{order:0}
  .portal__user-name{display:none}
  .portal__user{padding:4px}
  .portal__panel{padding:16px}
  .portal__ticket-list .ds-pattern-master-detail__item{grid-template-columns:auto minmax(0,1fr)}
  .portal__ticket-end{grid-column:2;justify-content:flex-start}
}
/* Fields in one row align to the top even when only some have a hint. */
.portal .ds-auto-grid{align-items:start}
/* A section closed with [hidden] stays closed even though .portal__panel is a grid. */
.portal [hidden]{display:none!important}
/* Form buttons keep their natural width instead of stretching across the card. */
.portal .ds-form-actions{flex-wrap:wrap;justify-content:flex-start}
.portal .ds-form-actions .btn{flex:0 0 auto;min-inline-size:132px}
.portal__search-row{display:flex;gap:8px;min-width:0}
.portal__search-row>.ds-field__input{flex:1;min-width:0}
.portal__search-row>.btn{flex:0 0 auto}
/* Profile: account card and password card side by side, at a readable width. */
.portal__pair{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;align-items:start}
.portal__access-chips{display:flex;flex-wrap:wrap;gap:6px}
@media(max-width:860px){.portal__pair{grid-template-columns:1fr}}
/* On a phone the catalog stacks the actions (column-reverse); each button keeps its own height at full width. */
@media(max-width:520px){.portal .ds-form-actions .btn{flex:0 0 auto;inline-size:100%}}
/* Restore the catalog's mobile action sizing inside the sign-in forms. */
@media(max-width:520px){.portal__auth .ds-form-actions .btn{flex:0 0 auto}}
/* Sale document detail (/finance/:id) and its print view: only the document
   itself is printed, never the portal header, navigation or actions. */
.portal__document{display:grid;gap:18px;min-width:0}
.portal__document .ds-pattern-detail-facts{margin:0}
.portal__document .rui-table-wrap{overflow-x:auto}
.portal__document .rui-table{min-width:680px}
.portal__document .rui-table .ds-num{white-space:nowrap}
.portal__doc-sub{display:block;margin-top:2px;color:var(--text-muted);font-size:.8rem}
.portal__document-totals{grid-template-columns:repeat(auto-fit,minmax(160px,1fr))}
@media print{
  .portal__skip,.portal__header,.portal__footer,.portal__no-print,.portal__notice{display:none!important}
  body.portal{display:block;min-height:0;background:none}
  .portal__main{width:100%;padding:0}
  .portal__document .portal__panel,.portal__document .ds-page-hero{box-shadow:none}
  .portal__document .rui-table-wrap{overflow:visible}
  .portal__document tr,.portal__document .ds-pattern-detail-facts>div{break-inside:avoid}
  .portal__document *{-webkit-print-color-adjust:exact;print-color-adjust:exact}
}

/* Compact page head (owner request 1405/07/23): title and description on one
   side, actions and short numbers in the hero's own side column, so every
   portal page head is only as tall as its content. */
.portal .portal__hero.ds-page-hero{padding:16px 22px;gap:12px 20px}
.portal .portal__hero .ds-page-hero__title{font-size:21px;line-height:1.5}
.portal .portal__hero .ds-page-hero__sub{margin-top:2px;max-width:72ch;line-height:1.8}
.portal__hero-side{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:8px 10px}
.portal__hero-side>.ds-page-hero__actions,.portal__hero-side>.ds-page-hero__chips{margin:0}
@media(max-width:760px){.portal .portal__hero.ds-page-hero{grid-template-columns:1fr}.portal__hero-side{justify-content:flex-start}}

/* Purchase request form: product search results and the requested items are
   catalog tables; each quantity carries its own unit (owner request 1405/07/23). */
.portal__purchase{display:grid;gap:14px}
/* Purchase request (owner request 1405/07/27): «انتخاب کالا» beside «جزئیات درخواست», stacked on a narrow screen. */
.portal__purchase-grid{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:18px;align-items:start}
.portal__purchase-pane{display:grid;gap:14px;min-width:0;padding:18px;border:1px solid var(--border);border-radius:var(--radius-lg,18px);background:var(--surface)}
.portal__purchase-pane--cart{background:var(--surface-2);position:sticky;top:12px}
.portal__purchase-pane .ds-form-actions{margin:0}
.portal__purchase-step{display:flex;align-items:center;gap:10px;margin:0;font-size:1rem;font-weight:800;color:var(--text)}
.portal__purchase-step-no{display:inline-grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--brand-50);color:var(--brand-700);font-size:.85rem;font-weight:800}
.portal__picker{display:grid;gap:8px;min-width:0}
.portal .ds-field__prefix [data-ds-icon]{display:inline-flex;width:20px;height:20px}
.portal .ds-field__prefix .ds-ico{width:20px;height:20px}
.portal__results-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px}
.portal__results-head small{color:var(--text-muted)}
.portal__pick-list{display:grid;gap:6px;max-height:420px;overflow:auto;padding:0 0 0 2px;border:0;overscroll-behavior:contain}
.portal__pick-list .ds-pattern-master-detail__item{border-color:var(--border);background:var(--surface);transition:border-color .15s ease,background-color .15s ease}
.portal__pick-list .ds-pattern-master-detail__item:hover{border-color:var(--brand-500)}
.portal__pick-list .ds-pattern-master-detail__item.is-added{background:var(--brand-50)}
.portal__pick-list .ds-pattern-master-detail__item>span:nth-child(2){min-width:0}
.portal__pick-list .ds-pattern-status{display:inline-flex;align-items:center;gap:4px}
.portal__pick-list .ds-pattern-status .ds-ico{width:14px;height:14px}
.portal__cart-list{max-height:none;overflow:visible}
.portal__cart-item{grid-template-columns:minmax(0,1fr) auto auto;align-items:center}
.portal__results-empty{display:flex;align-items:center;justify-content:center;gap:8px;margin:0;padding:18px 12px;border:1px dashed var(--border);border-radius:var(--radius,14px);color:var(--text-muted);text-align:center;font-size:.9rem}
.portal__results-empty .ds-ico{flex:0 0 auto;width:18px;height:18px;opacity:.7}
@media (max-width: 899px){
  .portal__purchase-grid{grid-template-columns:minmax(0,1fr)}
  .portal__purchase-pane--cart{position:static}
}
@media (max-width: 560px){
  .portal__purchase-pane{padding:14px}
  .portal__pick-list .ds-pattern-master-detail__item{grid-template-columns:auto minmax(0,1fr)}
  .portal__pick-list .portal__ticket-end{grid-column:2;justify-content:flex-start}
  .portal__pick-list .portal__cart-item{grid-template-columns:minmax(0,1fr) auto}
  .portal__pick-list .portal__cart-item>span:first-child{grid-column:1 / -1}
  .portal__pick-list .portal__cart-item .portal__qty{grid-column:1;max-width:none;min-width:0}
  .portal__pick-list{max-height:none;overflow:visible}
  .portal__purchase-pane .ds-form-actions{flex-direction:column-reverse;flex-wrap:nowrap}
  .portal__purchase-pane .ds-form-actions>.btn{flex:0 0 auto;width:100%;justify-content:center}
}
.portal__qty{display:flex;align-items:center;gap:8px;max-width:260px}
.portal__qty>.ds-field__input{flex:1;min-width:0}
.portal__qty-unit{flex:0 0 auto;min-width:56px;padding:8px 10px;border:1px solid var(--border);border-radius:10px;background:var(--surface-2);color:var(--text);font-size:.85rem;font-weight:700;text-align:center}

/* The guide launcher sits right after the page title, as in the panel. */
.portal__auth-head .gex-title-row{justify-self:center}
.portal__hero .gex-title-row .ds-page-hero__title{margin:0}
/* Icon beside text (owner request 1405/07/24): the icon holder is a centred flex box
   without a text line, so it sits on the text's middle instead of its baseline. */
.portal [data-ds-icon]{display:inline-flex;align-items:center;justify-content:center;line-height:0;vertical-align:middle}
.portal .ds-page-hero__chip,.portal .ds-pattern-status,.portal__contact strong,.portal__nav a,.portal .btn{align-items:center}
/* Keep the launcher hover shine inside the button on tinted page heads. */
.portal .gex-launcher{contain:paint}
/* Motion (owner request 1405/07/23): the panel's own entrance, hover and float animations
   (main.css keyframes and curves). Every route repaints #portal-main, so each page plays its
   entrance once; software-rendering.css turns all of it off for Remote Desktop/reduced motion. */
.portal__main .portal__hero{animation:slideDown .45s cubic-bezier(.22,.7,.16,1) both}
.portal__panel,.portal__main .ds-pattern-inbox,.portal__main .ds-pattern-detail-note{animation:slideUp .5s cubic-bezier(.22,.7,.16,1) both;transition:box-shadow .25s ease,border-color .2s ease}
.portal__panel:hover{border-color:var(--border-strong);box-shadow:var(--shadow)}
.portal__page>:nth-child(2),.portal__aside>:nth-child(1){animation-delay:.08s}
.portal__page>:nth-child(3),.portal__aside>:nth-child(2){animation-delay:.16s}
.portal__page>:nth-child(n+4),.portal__aside>:nth-child(n+3){animation-delay:.24s}
.portal__ticket-list>*{animation:slideUp .4s cubic-bezier(.22,.7,.16,1) both}
.portal__ticket-list>:nth-child(2){animation-delay:.04s}.portal__ticket-list>:nth-child(3){animation-delay:.08s}.portal__ticket-list>:nth-child(4){animation-delay:.12s}
.portal__ticket-list>:nth-child(5){animation-delay:.16s}.portal__ticket-list>:nth-child(n+6){animation-delay:.2s}
.portal__auth{animation:scaleIn .45s cubic-bezier(.22,.7,.16,1) .08s both}
/* Home dashboard: quick-access rows end with a go arrow; up to four summary cards in one row. */
.portal__home-kpis{grid-template-columns:repeat(auto-fit,minmax(200px,1fr))}
.portal__quick-go{display:inline-flex;width:20px;height:20px;color:var(--text-muted);transition:transform .25s cubic-bezier(.22,.7,.16,1),color .2s ease}
.portal__quick .ds-pattern-master-detail__item:hover .portal__quick-go{color:var(--brand-700);transform:translateX(-3px)}
.portal__quick{display:grid;gap:4px;padding:0;border:0}
.portal__quick a{text-decoration:none;color:inherit}
.portal__quick .ds-pattern-master-detail__item>span:nth-child(2){min-width:0}
.portal__quick-go svg{width:20px;height:20px}
@media(max-width:760px){.portal__home-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.portal__split:has([data-portal-home-quick]) .portal__aside{order:-1}}
/* «فایل‌های این تیکت»: the chat folder tabs over a media grid or a file list. */
.portal__file-folder{margin-top:10px}.portal__file-folder .ds-pattern-inbox__gallery{gap:6px}.portal__file-folder .ds-pattern-inbox__gallery-item{border-radius:10px}
/* Inside a site's frame the modal sits in the part of the frame the visitor sees (portal.js keeps
   --portal-view-top / --portal-view-h current), and media previews fit that height. */
html.portal--embedded .ds-modal-back{inset:auto 0 auto 0;top:var(--portal-view-top,0px);height:var(--portal-view-h,100vh)}
html.portal--embedded .ds-modal{max-height:calc(var(--portal-view-h,100vh) - 24px)}
html.portal--embedded{--ds-media-max-h:max(160px,calc(var(--portal-view-h,100vh) - 230px))}
/* The WordPress frame is never shorter than 620px (the plugin's .diaco-portal__frame min-height):
   a short page fills that height with the footer at its foot instead of leaving an empty strip under it (1405/07/27). */
html.portal--embedded body.portal{min-height:620px}
/* Page notices take their tone: before, «rose» and «amber» had no rule and an error showed in mint. */
.portal__notice--rose{border-color:color-mix(in srgb,var(--red-500) 32%,var(--border));color:var(--red-600,#bd3349);background:color-mix(in srgb,var(--pastel-rose) 45%,var(--surface))}
.portal__notice--amber{border-color:color-mix(in srgb,var(--amber-500) 34%,var(--border));color:#8a5300;background:color-mix(in srgb,var(--pastel-peach) 45%,var(--surface))}
/* Purchase requests: the row title opens the request; its page shows the review steps. */
.portal__row-link{display:grid;gap:2px;min-width:0;color:inherit;text-decoration:none}
.portal__row-link:hover strong,.portal__row-link:focus-visible strong{color:var(--brand-700);text-decoration:underline;text-underline-offset:3px}
.portal__order-status{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}
.portal__order-status small{color:var(--text-muted);font-size:12px}
.portal__steps{display:grid;gap:0;margin:4px 0 0;padding:0;list-style:none}
.portal__step{position:relative;display:grid;grid-template-columns:28px minmax(0,1fr);gap:10px;align-items:start;padding-block:6px 10px;color:var(--text-muted)}
.portal__step:not(:last-child)::after{content:'';position:absolute;inset-inline-start:13px;top:34px;bottom:-4px;width:2px;border-radius:2px;background:var(--border)}
.portal__step.is-done:not(:last-child)::after{background:var(--brand-500)}
.portal__step-mark{display:inline-grid;width:28px;height:28px;place-items:center;border-radius:50%;background:var(--surface-2);color:var(--text-muted)}
.portal__step-mark svg{width:16px;height:16px}
.portal__step strong{display:block;font-size:13px}
.portal__step small{display:block;font-size:11.5px}
.portal__step.is-done{color:var(--text)}
.portal__step.is-done .portal__step-mark{background:var(--brand-500);color:#fff}
.portal__step.is-current{color:var(--text)}
.portal__step.is-current .portal__step-mark{background:var(--pastel-peach);color:#8a5300;box-shadow:0 0 0 4px color-mix(in srgb,var(--pastel-peach) 55%,transparent)}
.portal__step-dot{width:8px;height:8px;border-radius:50%;background:currentColor;opacity:.55}
/* «همکاری و پورسانت»: the referral link wraps inside its note and the QR keeps a quiet zone on white. */
.portal__partner-link{overflow-wrap:anywhere;font-size:13px;color:var(--text-muted)}
.portal__partner-actions{display:flex;gap:8px;flex-wrap:wrap}
.portal__partner-qr{display:inline-flex;align-self:flex-start;padding:8px;background:#fff;border-radius:var(--radius-md,10px)}
.portal__partner-qr svg{width:132px;height:132px}

/* ==== Visual refresh (owner request 1405/08/24): «همه رو شکیل کن» ====
   A living sign-in stage with the official Diaco and DiaMind logos and the work flowing between
   them, and inner pages with depth: a washed page background, a branded header line, hero icon
   badges, accent-marked section heads and softer lists. Only design-system tokens are used;
   software-rendering.css and prefers-reduced-motion switch every animation off. */
body.portal{background:
  radial-gradient(1200px 420px at 85% -120px,color-mix(in srgb,var(--pastel-mint) 55%,transparent),transparent 70%),
  radial-gradient(900px 380px at 0% -80px,color-mix(in srgb,var(--pastel-sky) 45%,transparent),transparent 70%),
  var(--bg)}
.portal__header{border-bottom-color:color-mix(in srgb,var(--brand-500) 14%,var(--border));box-shadow:0 6px 24px -18px color-mix(in srgb,var(--brand-700) 45%,transparent)}
.portal__header::before{content:'';position:absolute;inset:0 0 auto 0;height:3px;background:linear-gradient(90deg,var(--brand-500),var(--accent-500),var(--amber-500),var(--accent-500),var(--brand-500));background-size:200% 100%;animation:portalLine 9s linear infinite}
.portal__brand .ds-entity-avatar,.portal__brand>.ds-pattern-avatar{box-shadow:0 0 0 3px var(--surface),0 0 0 4px color-mix(in srgb,var(--brand-500) 35%,transparent)}
.portal__nav a{position:relative;transition:color .2s ease,background-color .2s ease,transform .2s ease}
.portal__nav a:hover{transform:translateY(-1px)}
.portal__nav a[aria-current="page"]{color:var(--surface);background:linear-gradient(135deg,var(--brand-500),color-mix(in srgb,var(--brand-500) 70%,var(--accent-500)));box-shadow:0 6px 16px -8px var(--brand-500)}
.portal__nav a[aria-current="page"] .ds-ico{color:inherit}
.portal__footer{background:transparent;border-top-color:color-mix(in srgb,var(--brand-500) 12%,var(--border))}

/* Page heads: an icon badge with soft rings, and two slow light orbs behind the copy. */
.portal .portal__hero.portal__hero--glyph{grid-template-columns:auto minmax(0,1fr) auto}
.portal__hero-glyph{position:relative;align-self:start;display:inline-grid;place-items:center;width:52px;height:52px;border-radius:16px;color:var(--ds-hero-tc);background:color-mix(in srgb,var(--ds-hero-tc) 16%,var(--surface));box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--ds-hero-tc) 30%,transparent),0 10px 24px -14px var(--ds-hero-tc);animation:portalBadge 4s ease-in-out infinite}
.portal__hero-glyph::after{content:'';position:absolute;inset:-6px;border-radius:20px;border:1px solid color-mix(in srgb,var(--ds-hero-tc) 28%,transparent);animation:portalRing 3.2s ease-out infinite}
.portal__hero-glyph .ds-ico{width:26px;height:26px}
.portal .portal__hero::before,.portal .portal__hero::after{content:'';position:absolute;z-index:0;border-radius:50%;pointer-events:none}
.portal .portal__hero::before{width:220px;height:220px;inset-inline-end:-60px;top:-110px;background:radial-gradient(circle,color-mix(in srgb,var(--ds-hero-tc) 26%,transparent),transparent 68%);animation:portalDrift 14s ease-in-out infinite}
.portal .portal__hero::after{width:160px;height:160px;inset-inline-start:30%;bottom:-120px;background:radial-gradient(circle,color-mix(in srgb,var(--accent-500) 22%,transparent),transparent 70%);animation:portalDrift 18s ease-in-out infinite reverse}
.portal .portal__hero>*{position:relative;z-index:1}

/* Sections: a short accent mark before every head, a lifted hover. */
.portal__panel{border-color:color-mix(in srgb,var(--brand-500) 8%,var(--border));box-shadow:0 1px 2px color-mix(in srgb,var(--brand-700) 6%,transparent),0 12px 28px -24px color-mix(in srgb,var(--brand-700) 40%,transparent)}
.portal__panel-head h2{display:flex;align-items:center;gap:10px}
.portal__panel-head h2::before{content:'';flex:0 0 auto;width:4px;height:18px;border-radius:4px;background:linear-gradient(180deg,var(--brand-500),var(--accent-500))}
.portal__ticket-list .ds-pattern-master-detail__item,.portal__quick .ds-pattern-master-detail__item{border-color:color-mix(in srgb,var(--brand-500) 8%,var(--border))}
.portal__ticket-list .ds-pattern-master-detail__item:hover,.portal__quick .ds-pattern-master-detail__item:hover{border-color:color-mix(in srgb,var(--brand-500) 40%,var(--border));box-shadow:0 8px 20px -16px var(--brand-500)}
.portal .kpi-grid .kpi{transition:transform .25s cubic-bezier(.22,.7,.16,1),box-shadow .25s ease}
.portal .kpi-grid .kpi:hover{transform:translateY(-3px);box-shadow:var(--shadow)}
.portal .ds-empty-state,.portal .rui-empty{border-radius:var(--radius-lg,20px);background:radial-gradient(300px 140px at 50% 0%,color-mix(in srgb,var(--pastel-mint) 35%,transparent),transparent 70%)}

/* ---- sign-in stage ---- */
body.portal.portal--auth{background:var(--bg)}
body.portal--auth .portal__header{background:color-mix(in srgb,var(--surface) 70%,transparent)}
body.portal--auth .portal__main{width:min(1240px,100%);padding-block:28px 40px}
.portal__stage{position:relative;display:grid;justify-items:center;align-items:center;min-height:calc(100vh - 210px);padding:clamp(8px,3vw,32px) 0;isolation:isolate}
.portal__stage--duo{grid-template-columns:minmax(0,1.15fr) minmax(320px,460px);gap:clamp(20px,4vw,56px);justify-items:stretch}
.portal__stage .portal__auth{position:relative;z-index:1;margin:0;width:min(480px,100%);justify-self:center;border-color:color-mix(in srgb,var(--brand-500) 16%,var(--border));background:color-mix(in srgb,var(--surface) 90%,transparent);backdrop-filter:blur(14px);box-shadow:0 30px 60px -38px color-mix(in srgb,var(--brand-700) 55%,transparent)}
.portal__stage .portal__auth::before{content:'';position:absolute;inset:0 22px auto;height:3px;border-radius:0 0 4px 4px;background:linear-gradient(90deg,var(--brand-500),var(--accent-500),var(--amber-500))}
.portal__stage-bg{position:fixed;inset:0;z-index:-1;overflow:hidden;pointer-events:none;background:radial-gradient(color-mix(in srgb,var(--brand-500) 16%,transparent) 1px,transparent 1.4px) 0 0/22px 22px,linear-gradient(160deg,color-mix(in srgb,var(--pastel-mint) 40%,var(--bg)) 0%,var(--bg) 45%,color-mix(in srgb,var(--pastel-peach) 35%,var(--bg)) 100%)}
.portal__stage-bg>span{position:absolute;border-radius:50%;opacity:.75;animation:portalOrb 22s ease-in-out infinite}
.portal__stage-bg>span:nth-child(1){width:46vmax;height:46vmax;inset-inline-end:-12vmax;top:-14vmax;background:radial-gradient(circle,color-mix(in srgb,var(--brand-500) 30%,transparent),transparent 65%)}
.portal__stage-bg>span:nth-child(2){width:38vmax;height:38vmax;inset-inline-start:-10vmax;bottom:-16vmax;background:radial-gradient(circle,color-mix(in srgb,var(--amber-500) 36%,transparent),transparent 65%);animation-duration:28s;animation-direction:reverse}
.portal__stage-bg>span:nth-child(3){width:26vmax;height:26vmax;inset-inline-start:35%;top:30%;background:radial-gradient(circle,color-mix(in srgb,var(--pastel-sky) 70%,transparent),transparent 65%);animation-duration:34s}
html.portal--embedded .portal__stage{min-height:0}
html.portal--embedded .portal__stage-bg{position:absolute}

.portal__flow{position:relative;z-index:1;display:grid;gap:22px;align-content:center;min-width:0;animation:slideUp .6s cubic-bezier(.22,.7,.16,1) both}
.portal__flow-head{display:grid;gap:8px}
.portal__flow-eyebrow{justify-self:start;display:inline-flex;align-items:center;gap:8px;padding:5px 12px;border-radius:999px;background:color-mix(in srgb,var(--surface) 80%,transparent);border:1px solid color-mix(in srgb,var(--brand-500) 22%,var(--border));color:var(--brand-500);font-size:12.5px;font-weight:800}
.portal__flow-eyebrow::before{content:'';width:7px;height:7px;border-radius:50%;background:var(--accent-500);animation:portalPing 2.2s ease-out infinite}
.portal__flow-head h2{margin:0;font-size:clamp(1.35rem,2.4vw,2rem);line-height:1.5;color:var(--text);letter-spacing:-.01em}
.portal__flow-head p{margin:0;max-width:52ch;color:var(--text-muted);font-size:.95rem;line-height:1.9}
.portal__flow-track{display:grid;grid-template-columns:minmax(0,1fr) minmax(90px,1fr) minmax(0,1fr);align-items:center;gap:6px}
.portal__flow-node{display:grid;justify-items:center;gap:10px;margin:0;min-width:0}
.portal__flow-logo{display:grid;place-items:center;width:100%;aspect-ratio:16/10;box-sizing:border-box;padding:14px;border-radius:22px;background:#fff;border:1px solid color-mix(in srgb,var(--brand-500) 14%,var(--border));box-shadow:0 24px 44px -30px color-mix(in srgb,var(--brand-700) 60%,transparent);animation:portalFloat 6s ease-in-out infinite}
.portal__flow-node--diamind .portal__flow-logo{animation-delay:-3s}
.portal__flow-logo img{display:block;max-width:100%;max-height:100%;width:auto;height:auto;object-fit:contain}
.portal__flow-node figcaption{color:var(--text-muted);font-size:.8rem;font-weight:700;text-align:center}
.portal__flow-wire{position:relative;display:grid;align-items:center;min-width:0;padding-bottom:18px}
.portal__flow-wire svg{display:block;width:100%;height:auto;overflow:visible}
.portal__flow-path{fill:none;stroke-width:1.4;stroke-linecap:round;stroke-dasharray:3 4;animation:portalDash 1.6s linear infinite}
.portal__flow-path.is-top{stroke:color-mix(in srgb,var(--amber-500) 80%,var(--brand-500))}
.portal__flow-path.is-bottom{stroke:color-mix(in srgb,var(--brand-500) 75%,transparent);animation-direction:reverse}
.portal__flow-dot{fill:var(--brand-500)}
.portal__flow-dot.is-warm{fill:var(--amber-500)}
.portal__flow-dot.is-cool{fill:var(--accent-500)}
.portal__flow-words{position:absolute;inset:auto 0 0;display:grid;justify-items:center;height:22px}
.portal__flow-words>span{grid-area:1/1;padding:2px 10px;border-radius:999px;background:color-mix(in srgb,var(--surface) 88%,transparent);border:1px solid var(--border);color:var(--text);font-size:11px;font-weight:700;white-space:nowrap;opacity:0;animation:portalWord 12s ease-in-out infinite}
.portal__flow-words>span:nth-child(2){animation-delay:3s}.portal__flow-words>span:nth-child(3){animation-delay:6s}.portal__flow-words>span:nth-child(4){animation-delay:9s}
.portal__flow-items{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:0;padding:0;list-style:none}
.portal__flow-items li{display:flex;align-items:center;gap:10px;min-width:0;padding:10px 12px;border-radius:14px;background:color-mix(in srgb,var(--surface) 78%,transparent);border:1px solid color-mix(in srgb,var(--brand-500) 12%,var(--border));color:var(--text);font-size:.86rem;font-weight:700;animation:slideUp .5s cubic-bezier(.22,.7,.16,1) both;animation-delay:calc(.25s + var(--i) * .08s)}
.portal__flow-items li>[data-ds-icon]{flex:0 0 auto;display:inline-grid;place-items:center;width:32px;height:32px;border-radius:10px;color:var(--brand-500);background:color-mix(in srgb,var(--brand-500) 12%,var(--surface))}
.portal__flow-items li:nth-child(2)>[data-ds-icon]{color:color-mix(in srgb,var(--amber-500) 70%,var(--text));background:color-mix(in srgb,var(--amber-500) 20%,var(--surface))}
.portal__flow-items li:nth-child(3)>[data-ds-icon]{color:color-mix(in srgb,var(--accent-500) 70%,var(--text));background:color-mix(in srgb,var(--accent-500) 18%,var(--surface))}
.portal__flow-items li .ds-ico{width:18px;height:18px}
.portal__flow-cta{justify-self:start;display:inline-flex;align-items:center;gap:8px;padding:10px 16px;border-radius:12px;background:var(--promo-btn-bg,var(--brand-500));color:var(--promo-btn-text,#fff);font-size:.86rem;font-weight:800;text-decoration:none;box-shadow:0 12px 24px -14px var(--promo-btn-bg,var(--brand-500));transition:transform .25s cubic-bezier(.22,.7,.16,1)}
.portal__flow-cta:hover,.portal__flow-cta:focus-visible{transform:translateY(-2px)}
.portal__flow-cta .ds-ico{width:16px;height:16px}

@media(max-width:960px){
  .portal__stage--duo{grid-template-columns:minmax(0,1fr);justify-items:center}
  .portal__flow{width:min(560px,100%);gap:14px}
  .portal__flow-head{justify-items:center;text-align:center}
  .portal__flow-eyebrow,.portal__flow-cta{justify-self:center}
  .portal__flow-items,.portal__flow-cta{display:none}
}
@media(max-width:760px){
  .portal .portal__hero.portal__hero--glyph{grid-template-columns:auto minmax(0,1fr)}
  .portal .portal__hero--glyph>.portal__hero-side{grid-column:1/-1}
}
@media(max-width:560px){
  body.portal--auth .portal__main{padding-block:14px 28px}
  .portal__stage{min-height:0}
  .portal__flow-head p{display:none}
  .portal__flow-head h2{font-size:1.15rem}
  .portal__flow-logo{padding:8px;border-radius:16px}
  .portal__flow-node figcaption{font-size:.72rem}
  .portal__flow-words{display:none}
  .portal__flow-wire{padding-bottom:0}
  .portal__flow-track{grid-template-columns:minmax(0,1fr) minmax(64px,.8fr) minmax(0,1fr)}
  .portal__hero-glyph{width:44px;height:44px;border-radius:14px}
  .portal__hero-glyph .ds-ico{width:22px;height:22px}
}
@keyframes portalLine{to{background-position:200% 0}}
@keyframes portalBadge{0%,100%{transform:translateY(0)}50%{transform:translateY(-3px)}}
@keyframes portalRing{0%{opacity:.9;transform:scale(.92)}100%{opacity:0;transform:scale(1.18)}}
@keyframes portalDrift{0%,100%{transform:translate(0,0)}50%{transform:translate(-18px,14px)}}
@keyframes portalOrb{0%,100%{transform:translate(0,0) scale(1)}33%{transform:translate(4vmax,3vmax) scale(1.06)}66%{transform:translate(-3vmax,2vmax) scale(.96)}}
@keyframes portalFloat{0%,100%{transform:translateY(0)}50%{transform:translateY(-8px)}}
@keyframes portalDash{to{stroke-dashoffset:-14}}
@keyframes portalWord{0%,4%{opacity:0;transform:translateY(8px)}8%,25%{opacity:1;transform:translateY(0)}29%,100%{opacity:0;transform:translateY(-8px)}}
@keyframes portalPing{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--accent-500) 60%,transparent)}100%{box-shadow:0 0 0 9px transparent}}
@media(prefers-reduced-motion:reduce){
  .portal__header::before,.portal__hero-glyph,.portal__hero-glyph::after,.portal .portal__hero::before,.portal .portal__hero::after,.portal__stage-bg>span,.portal__flow,.portal__flow-logo,.portal__flow-path,.portal__flow-items li,.portal__flow-eyebrow::before{animation:none}
  .portal__flow-dot{display:none}
  .portal__flow-words>span{animation:none}.portal__flow-words>span:first-child{opacity:1}
  .portal__nav a,.portal .kpi-grid .kpi,.portal__flow-cta{transition:none}
}
html[data-rendering="software"] .portal__flow-dot{display:none}
html[data-rendering="software"] .portal__flow-words>span:first-child{opacity:1}
/* «اسناد» (owner feedback 1405/08/24: the left half of every section was empty): the groups sit two
   per row, each document is a card with its state at the end and its actions under the title. */
.portal__doc-groups{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,440px),1fr));gap:18px;align-items:start}
.portal__doc-list .ds-pattern-master-detail__item{grid-template-columns:auto minmax(0,1fr) auto;align-items:start;row-gap:10px;cursor:default}
.portal__doc-list .ds-pattern-master-detail__item>span:nth-child(2){display:grid;gap:2px;min-width:0}
.portal__doc-actions{grid-column:2/-1;display:flex;flex-wrap:wrap;align-items:center;gap:6px}
@media(max-width:560px){.portal__doc-actions{grid-column:1/-1}.portal__doc-actions .btn{flex:1 1 auto;justify-content:center}}
.portal__doc-list small{white-space:normal;overflow:visible;text-overflow:clip}
/* «جلسات» (owner feedback 1405/08/24: too much empty space, calendar too big): the compact month in the
   main column, upcoming meetings, requests and past meetings beside it; on a narrow screen the lists come first. */
.portal__split.portal__meetings{grid-template-columns:minmax(0,1fr) minmax(320px,400px)}
.portal__meetings .portal__aside{position:static}
.portal__meetings .portal__aside .ds-pattern-master-detail__item{grid-template-columns:auto minmax(0,1fr)}
.portal__meetings .portal__aside .portal__ticket-end{grid-column:2;justify-content:flex-start}
.portal__meetings .portal__aside .portal__doc-actions{grid-column:2}
@media(max-width:1000px){.portal__split.portal__meetings{grid-template-columns:minmax(0,1fr)}.portal__meetings .portal__aside{order:-1}}
/* «پشتیبانی از راه دور» (owner request 1405/08/24): each computer opens its own history under it, for both sides. */
.portal__diadesk-history{grid-column:2/-1;max-height:320px;overflow:auto;padding:8px 10px;border-radius:12px;background:var(--surface-2)}
.portal__diadesk-history .portal__step-mark [data-ds-icon]{display:inline-flex;line-height:0}
.portal__diadesk-history .portal__step-mark .ds-ico{width:16px;height:16px}
@media(max-width:560px){.portal__diadesk-history{grid-column:1/-1}}


/* /portal/ds/css/software-rendering.css */
/*
 * Canonical software-rendering profile.
 *
 * Windows Server Remote Desktop may expose Chrome through D3D11 WARP. In
 * that environment animation, blur and large shadow layers are painted on
 * the CPU. The profile is intentionally selected on the document root so it
 * applies to every route and to components mounted after initial load.
 * Geometry-bearing transforms are not reset here: dialogs, dropdowns and
 * RTL controls legitimately use them for placement.
 */
html[data-rendering="software"] {
  scroll-behavior: auto !important;
}

html[data-rendering="software"] *,
html[data-rendering="software"] *::before,
html[data-rendering="software"] *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
  box-shadow: none !important;
  will-change: auto !important;
}

/* Keep keyboard focus visible after shadow-based focus rings are removed. */
html[data-rendering="software"] :focus-visible {
  outline: 2px solid var(--brand-500, #0d9488) !important;
  outline-offset: 2px !important;
}

/* Reveal motion primitives immediately instead of leaving pre-animation
   opacity/transform states on screen. */
html[data-rendering="software"] .ds-motion-reveal,
html[data-rendering="software"] .ds-motion-stagger > *,
html[data-rendering="software"] .acc-reveal {
  opacity: 1 !important;
  transform: none !important;
}
