/* Deepora — design system in the Wesal style.
   Light = Wesal CRM app (RECRM.UI); dark = we-sal.net. Cairo, Arabic-first,
   logical properties so RTL and LTR both work. */

/* ---------- tokens ---------- */
:root {
  --bg: #f6f6f8; --card: #ffffff; --card-2: #fafafc; --fg: #505050; --heading: #202020; --muted: #7a7a85; --dim: #a7a7b2;
  --line: #ececf0; --line-strong: #dcdce3; --input: #ffffff;
  --primary: #6c3ad8; --primary-600: #5b2ec0; --tint: #f3f0fb; --tint-2: #e9e2fa;
  --green: #20b26a; --green-600: #1a9a5b; --green-tint: #e6f6ee;
  --amber: #b45309; --amber-tint: #fef3c7; --red: #dc2626; --red-tint: #fee2e2; --blue: #2563eb; --blue-tint: #dbeafe; --gray-tint: #f1f1f4;
  --radius: 10px; --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 5%);
  --shadow: 0 1px 3px rgb(16 24 40 / 7%), 0 1px 2px rgb(16 24 40 / 4%);
  --shadow-lg: 0 12px 32px rgb(16 24 40 / 12%);
  --sidebar: 264px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #120a24; --card: #1a1035; --card-2: #1f1440; --fg: #d6d3e6; --heading: #ffffff; --muted: #a39fb8; --dim: #6f6a88;
    --line: rgb(255 255 255 / 8%); --line-strong: rgb(255 255 255 / 15%); --input: rgb(255 255 255 / 4%);
    --primary: #8b5cf6; --primary-600: #7c3aed; --tint: rgb(139 92 246 / 16%); --tint-2: rgb(139 92 246 / 26%);
    --green: #10b981; --green-600: #0ea371; --green-tint: rgb(16 185 129 / 15%);
    --amber: #fbbf24; --amber-tint: rgb(251 191 36 / 14%); --red: #f87171; --red-tint: rgb(248 113 113 / 14%);
    --blue: #60a5fa; --blue-tint: rgb(96 165 250 / 14%); --gray-tint: rgb(255 255 255 / 7%);
    --shadow-sm: none; --shadow: 0 0 0 1px rgb(255 255 255 / 3%); --shadow-lg: 0 16px 40px rgb(0 0 0 / 45%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #120a24; --card: #1a1035; --card-2: #1f1440; --fg: #d6d3e6; --heading: #ffffff; --muted: #a39fb8; --dim: #6f6a88;
  --line: rgb(255 255 255 / 8%); --line-strong: rgb(255 255 255 / 15%); --input: rgb(255 255 255 / 4%);
  --primary: #8b5cf6; --primary-600: #7c3aed; --tint: rgb(139 92 246 / 16%); --tint-2: rgb(139 92 246 / 26%);
  --green: #10b981; --green-600: #0ea371; --green-tint: rgb(16 185 129 / 15%);
  --amber: #fbbf24; --amber-tint: rgb(251 191 36 / 14%); --red: #f87171; --red-tint: rgb(248 113 113 / 14%);
  --blue: #60a5fa; --blue-tint: rgb(96 165 250 / 14%); --gray-tint: rgb(255 255 255 / 7%);
  --shadow-sm: none; --shadow: 0 0 0 1px rgb(255 255 255 / 3%); --shadow-lg: 0 16px 40px rgb(0 0 0 / 45%);
  color-scheme: dark;
}

/* ---------- base ---------- */
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.6 "Cairo", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif; background: var(--bg); color: var(--fg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { color: var(--heading); margin: 0; line-height: 1.35; }
h1 { font-size: 22px; font-weight: 800; }
h2 { font-size: 15px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
h4 { font-size: 14px; font-weight: 700; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.dim { color: var(--dim); }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .2px; }
.icon { display: inline-flex; flex-shrink: 0; }
.center { display: flex; justify-content: center; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.stack-sm { display: grid; gap: 8px; }
.row-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row-inline.spread { justify-content: space-between; }
.pre { white-space: pre-wrap; }
.link { font-weight: 600; }
.link:hover { text-decoration: underline; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot .logo-mark { width: 44px; height: 44px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; transform: scale(.94); } }

/* ---------- brand ---------- */
.logo-mark { display: block; width: 36px; height: 36px; border-radius: 11px; box-shadow: 0 6px 18px -6px rgb(108 58 216 / 55%); flex-shrink: 0; }
.side-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; border-radius: 12px; transition: background .15s; }
a.side-brand:hover { background: var(--card-2); }
a.side-brand:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.logo-text { font-size: 18px; font-weight: 800; color: var(--heading); letter-spacing: .3px; line-height: 1.1; }
.logo-sub { font-size: 12px; color: var(--muted); }
.side-brand.light .logo-text, .side-brand.light .logo-sub { color: #fff; }
.side-brand.light .logo-sub { opacity: .8; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 18px 14px; background: var(--card); border-inline-end: 1px solid var(--line); }
.side-brand { padding: 4px 8px 6px; }
.side-nav { display: grid; gap: 2px; overflow-y: auto; flex: 1; align-content: start; }
.nav-group { font-size: 11.5px; font-weight: 700; color: var(--dim); padding: 10px 12px 4px; letter-spacing: .3px; }
.nav-group.nav-client { display: grid; gap: 2px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.nav-group.nav-client strong { font-size: 13.5px; color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-label { font-size: 12px; font-weight: 600; color: var(--dim); white-space: nowrap; }
.ctx-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 9px 14px; margin-bottom: 14px; border-radius: var(--radius); background: var(--card-2); border: 1px solid var(--line); border-inline-start: 3px solid var(--primary); font-size: 13.5px; }
.ctx-strip .icon { color: var(--primary); }
.ctx-strip a { margin-inline-start: auto; font-weight: 600; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--radius); color: var(--fg); font-weight: 600; transition: background .15s, color .15s; }
.nav-item .icon { color: var(--muted); }
.nav-item:hover { background: var(--tint); color: var(--primary); }
.nav-item:hover .icon { color: var(--primary); }
.nav-item.active { background: var(--tint); color: var(--primary); }
.nav-item.active .icon { color: var(--primary); }
.nav-item.active::before { content: ""; position: absolute; inset-inline-start: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 4px; background: var(--primary); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--card-2); color: var(--fg); }
.side-user:hover, .side-user.active { border-color: var(--tint-2); background: var(--tint); }
.side-user-text { display: grid; min-width: 0; }
.side-user-text strong { color: var(--heading); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-text small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--tint-2); color: var(--primary); font-weight: 800; font-size: 13px; flex-shrink: 0; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 62px; padding: 0 24px; background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; }
.switcher { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card); color: var(--heading); font-weight: 700; max-width: 340px; }
.switcher select { appearance: none; border: 0; background: transparent; color: inherit; font: inherit; padding: 0; height: auto; box-shadow: none; cursor: pointer; min-width: 120px; max-width: 260px; }
.switcher select:focus { box-shadow: none; }
.switcher .icon { color: var(--primary); pointer-events: none; }
.switcher.static { cursor: default; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card); color: var(--fg); font: inherit; font-weight: 600; cursor: pointer; }
.pill:hover { color: var(--primary); border-color: var(--tint-2); background: var(--tint); }
.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 28px 40px; }
.page { display: grid; gap: 20px; }
.scrim { display: none; }
.only-mobile { display: none !important; }

/* ---------- page pieces ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head p { margin-top: 4px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card > .link { display: inline-block; margin-top: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 18px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; }
.toolbar .search { flex: 1; min-width: 220px; max-width: 420px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.stat { display: flex; align-items: center; gap: 14px; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.stat-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--tint); color: var(--primary); }
.stat.green .stat-icon { background: var(--green-tint); color: var(--green); }
.stat.red .stat-icon { background: var(--red-tint); color: var(--red); }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-value { color: var(--heading); font-size: 24px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }

.agent-card { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.agent-avatar { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(135deg, var(--primary), #9b6bf3); color: #fff; box-shadow: 0 8px 20px -8px var(--primary); }
.agent-info { flex: 1; min-width: 220px; display: grid; gap: 6px; }
.kv-list { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--fg); font-size: 13px; }
.kv-list em { font-style: normal; color: var(--muted); }

.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head h2 { font-size: 18px; margin-bottom: 4px; }

/* ---------- forms ---------- */
input, select, textarea { font: inherit; color: var(--heading); background: var(--input); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0 12px; height: 40px; width: 100%; transition: border-color .15s, box-shadow .15s; }
textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.7; }
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--tint); }
input:disabled, select:disabled { opacity: .6; cursor: not-allowed; }
input[type="search"] { padding-inline-start: 12px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 700; color: var(--heading); }
.field-hint { font-size: 12px; color: var(--muted); }
.readonly-field { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--radius); background: var(--card-2); border: 1px solid var(--line); }
.form-error { color: var(--red); font-size: 13px; min-height: 0; }
.form-error:empty { display: none; }
.ok-text { color: var(--green); font-weight: 600; }
.segmented { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--gray-tint); gap: 2px; }
.segmented button { border: 0; background: transparent; color: var(--fg); font: inherit; font-weight: 600; padding: 7px 16px; border-radius: 9px; cursor: pointer; }
.segmented button.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow); }
.hint-box { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--tint); color: var(--primary); font-size: 13px; font-weight: 500; }
.hint-box.warn { background: var(--amber-tint); color: var(--amber); }
.hint-box .icon { margin-top: 2px; }
.callout { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--radius); background: var(--card-2); border: 1px solid var(--line); }
.secret-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--tint); }
.secret-box code { font-size: 17px; font-weight: 700; letter-spacing: 1px; color: var(--heading); }
.success-box { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 18px; border-radius: var(--radius-lg); background: var(--green-tint); color: var(--green); font-weight: 600; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px; border-radius: var(--radius); border: 1px solid transparent; font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-600); }
.btn.cta { background: var(--green); color: #fff; }
.btn.cta:hover { background: var(--green-600); }
.btn.secondary { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn.secondary:hover { background: var(--tint); }
.btn.ghost { background: var(--card); color: var(--heading); border-color: var(--line-strong); }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger:hover { filter: brightness(.92); }
.btn.ghost:hover { border-color: var(--tint-2); background: var(--tint); color: var(--primary); }
.btn.danger { background: var(--red); color: #fff; }
.btn:disabled { opacity: .55; cursor: progress; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--tint); color: var(--primary); }
.icon-btn.danger:hover { background: var(--red-tint); color: var(--red); }
.row-actions { display: inline-flex; gap: 2px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; line-height: 1.7; }
.badge.purple { background: var(--tint); color: var(--primary); }
.badge.green { background: var(--green-tint); color: var(--green); }
.badge.amber { background: var(--amber-tint); color: var(--amber); }
.badge.red { background: var(--red-tint); color: var(--red); }
.badge.blue { background: var(--blue-tint); color: var(--blue); }
.badge.gray { background: var(--gray-tint); color: var(--muted); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: start; font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 10px 12px; background: var(--card-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th:first-child { border-start-start-radius: 10px; }
.table th:last-child { border-start-end-radius: 10px; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; color: var(--fg); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--tint); }
.table td.end, .table th.end { text-align: end; }
.cell-title { display: flex; align-items: center; gap: 10px; }
.cell-title strong { color: var(--heading); }
.table.editable td { padding: 6px; }
.table.editable input, .table.editable select { height: 36px; min-width: 110px; }
.table.editable .w-xs { min-width: 70px; width: 80px; }
.table.editable .w-sm { min-width: 100px; }
.table.editable .w-lg { min-width: 220px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs button { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tabs button:hover { color: var(--primary); }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .tab-short { display: none; }

/* ---------- savebar ---------- */
.savebar { position: sticky; bottom: 16px; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.savebar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.save-state { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--muted); font-size: 13px; }
.save-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.save-state.dirty { color: var(--amber); }
.save-state.dirty::before { background: var(--amber); }

/* ---------- empty / skeleton ---------- */
.empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 40px 16px; }
.empty-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--tint); color: var(--primary); margin-bottom: 4px; }
.empty p { max-width: 420px; }
.empty .btn { margin-top: 8px; }
.skeleton { display: grid; gap: 12px; padding: 8px 0; }
.sk-line { height: 14px; border-radius: 8px; background: linear-gradient(90deg, var(--gray-tint) 0%, var(--line) 50%, var(--gray-tint) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.sk-line:nth-child(3n+1) { width: 60%; height: 22px; }
.sk-line:nth-child(3n+2) { width: 92%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- drawer ---------- */
.drawer-back { position: fixed; inset: 0; z-index: 40; background: rgb(18 10 36 / 40%); opacity: 0; transition: opacity .2s; }
.drawer-back.in { opacity: 1; }
.drawer { position: fixed; z-index: 41; top: 0; bottom: 0; inset-inline-end: 0; width: min(580px, 100%); display: flex; flex-direction: column; background: var(--card); box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .25s ease; }
[dir="rtl"] .drawer { transform: translateX(-100%); }
.drawer.in { transform: none !important; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; padding: 14px; border-radius: var(--radius-lg); background: var(--card-2); border: 1px solid var(--line); }
.meta { display: grid; gap: 2px; }
.meta-k { font-size: 12px; color: var(--muted); font-weight: 600; }
.meta-v { color: var(--heading); font-weight: 600; }
.audio { width: 100%; height: 40px; }
.lead-chip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--line); }
.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 86%; padding: 9px 13px; border-radius: 14px; display: grid; gap: 2px; }
.bubble p { color: var(--heading); }
.bubble-who { font-size: 11.5px; font-weight: 700; }
.bubble.bot { align-self: flex-start; background: var(--tint); border-start-start-radius: 4px; }
.bubble.bot .bubble-who { color: var(--primary); }
.bubble.user { align-self: flex-end; background: var(--gray-tint); border-start-end-radius: 4px; }
.bubble.user .bubble-who { color: var(--muted); }

/* ---------- modal ---------- */
dialog.modal { width: min(480px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--fg); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgb(18 10 36 / 45%); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px 0; }
.modal-body { padding: 16px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 60; bottom: 20px; inset-inline-start: 50%; transform: translateX(-50%); display: grid; gap: 8px; }
[dir="rtl"] .toasts { transform: translateX(50%); }
.toast { display: flex; align-items: center; gap: 8px; min-width: 240px; max-width: min(520px, calc(100vw - 32px)); padding: 11px 16px; border-radius: 12px; background: #202020; color: #fff; font-weight: 600; box-shadow: var(--shadow-lg); animation: toast-in .2s ease; }
.toast.ok .icon { color: #34d399; }
.toast.err { background: #7f1d1d; }
.toast.out { opacity: 0; transition: opacity .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- auth ---------- */
.auth { display: grid; grid-template-columns: minmax(380px, 46%) 1fr; min-height: 100vh; }
.auth-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 40px 48px; color: #fff;
  background: radial-gradient(600px 400px at 85% 15%, rgb(16 185 129 / 28%), transparent 60%), radial-gradient(700px 500px at 10% 90%, rgb(168 85 247 / 45%), transparent 60%), linear-gradient(160deg, #2a1660 0%, #150d2a 100%); }
.auth-pitch { display: grid; gap: 14px; max-width: 460px; }
.auth-pitch h1 { color: #fff; font-size: 32px; line-height: 1.35; }
.auth-pitch p { color: #d6d3e6; font-size: 15.5px; }
.auth-pitch ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; }
.auth-pitch li { display: flex; align-items: center; gap: 10px; color: #ede9fe; font-weight: 600; }
.auth-pitch li .icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgb(16 185 129 / 22%); color: #34d399; }
.auth-foot { color: #a39fb8; font-size: 12.5px; }
.auth-panel { display: flex; flex-direction: column; padding: 24px; background: var(--bg); }
.auth-top { display: flex; justify-content: flex-end; }
.auth-card { width: min(420px, 100%); margin: auto; display: grid; gap: 18px; padding: 32px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); }
.auth-card h2 { font-size: 22px; font-weight: 800; }
.auth-note { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--tint); color: var(--primary); font-size: 13px; font-weight: 600; }
.auth-note .icon { margin-top: 2px; }
.emergency summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.row-form { display: flex; gap: 8px; margin-top: 10px; }

/* ---------- agent / config ---------- */
.word-list { display: grid; gap: 8px; }
.word-row { display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: center; gap: 8px; }
.word-acts { display: flex; gap: 4px; }
.marks-bar { display: flex; flex-wrap: wrap; gap: 6px; }
.mark-btn { min-width: 40px; height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--input); color: inherit; font-size: 20px; line-height: 1; cursor: pointer; }
.mark-btn:last-child { font-size: 13px; }
.mark-btn:hover { border-color: var(--primary); }
.word-row > .icon { color: var(--dim); transform: rotate(-90deg); }
[dir="rtl"] .word-row > .icon { transform: rotate(90deg); }
.integration-head { display: flex; align-items: center; gap: 16px; }
.int-logo { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(135deg, #10b981, #7c3aed); color: #fff; font-weight: 800; font-size: 16px; flex-shrink: 0; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .switcher-label { display: none; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 50; width: 280px; transform: translateX(-105%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  [dir="rtl"] .sidebar { transform: translateX(105%); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgb(18 10 36 / 40%); }
  .only-mobile { display: inline-grid !important; }
  .topbar { padding: 0 12px; }
  .content { padding: 18px 14px 32px; }
  .grid-2 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 24px; gap: 16px; }
  .auth-pitch h1 { font-size: 22px; }
  .auth-pitch ul, .auth-foot { display: none; }
  .switcher { max-width: 200px; min-width: 0; white-space: nowrap; }
  .switcher > span:not(.icon), .switcher strong { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .switcher select { min-width: 80px; max-width: 140px; }
  .pill > span:not(.icon) { display: none; }
  .pill { min-width: 40px; justify-content: center; }
  .word-row { grid-template-columns: 1fr auto; }
  .word-row > .icon { display: none; }
}

/* ---------- workflows ---------- */
.switch { position: relative; width: 40px; height: 22px; border-radius: 999px; border: 0; background: var(--line-strong); cursor: pointer; flex-shrink: 0; transition: background .15s; padding: 0; }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow); transition: inset-inline-start .15s; }
.switch.on { background: var(--green); }
.switch.on::after { inset-inline-start: 21px; }
.switch-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--heading); cursor: pointer; }
.wf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.wf-card { display: grid; gap: 12px; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); cursor: pointer; transition: border-color .15s, transform .15s; }
.wf-card:hover { border-color: var(--tint-2); transform: translateY(-1px); }
.wf-card-top, .wf-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wf-trigger { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-weight: 700; font-size: 12.5px; background: var(--tint); padding: 3px 10px; border-radius: 999px; }
.wf-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--dim); }
.wf-chain > .icon { transform: rotate(-90deg); }
[dir="rtl"] .wf-chain > .icon { transform: rotate(90deg); }
.wf-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 8px; background: var(--card-2); border: 1px solid var(--line); color: var(--fg); font-size: 12.5px; font-weight: 600; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.tpl-card { display: grid; gap: 6px; justify-items: start; text-align: start; padding: 16px; border-radius: var(--radius-lg); border: 1px dashed var(--line-strong); background: var(--card-2); color: var(--fg); font: inherit; cursor: pointer; }
.tpl-card:hover { border-color: var(--primary); background: var(--tint); }
.tpl-card strong { color: var(--heading); }
.tpl-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--tint); color: var(--primary); }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--muted); justify-self: start; }
.back-link .icon { transform: rotate(90deg); }
[dir="rtl"] .back-link .icon { transform: rotate(-90deg); }
.builder-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.input-lg { flex: 1; min-width: 240px; height: 46px; font-size: 18px; font-weight: 700; }
.builder { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.builder-main { display: grid; gap: 16px; }
.builder-side { position: sticky; top: 80px; }
.flow-block { display: grid; gap: 14px; }
.flow-tag { justify-self: start; padding: 3px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 800; }
.flow-tag.when { background: var(--blue-tint); color: var(--blue); }
.flow-tag.if { background: var(--amber-tint); color: var(--amber); }
.flow-tag.then { background: var(--green-tint); color: var(--green); }
.cond-row { display: grid; grid-template-columns: 44px minmax(140px, 1.2fr) minmax(120px, 1fr) minmax(120px, 1fr) auto; gap: 8px; align-items: center; }
.cond-and { font-size: 12.5px; font-weight: 800; color: var(--muted); text-align: center; }
.steps { display: grid; gap: 12px; }
.step-card { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; background: var(--card-2); display: grid; gap: 12px; }
.step-head { display: flex; align-items: center; gap: 10px; }
.step-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; font-weight: 800; }
.step-icon { color: var(--primary); }
.step-actions { margin-inline-start: auto; display: flex; gap: 2px; }
.icon-btn.flip .icon { transform: rotate(180deg); }
.step-adder { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 4px; }
.hdr-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; }
textarea.code, .code-block { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.code-block { margin: 6px 0 0; padding: 10px 12px; max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius); color: var(--heading); }
details.mini summary { cursor: pointer; font-weight: 700; color: var(--muted); font-size: 13px; }
details.mini[open] summary { margin-bottom: 10px; }
.var-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 60vh; overflow-y: auto; }
.var-chip { display: grid; gap: 1px; text-align: start; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); color: var(--heading); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.var-chip code { font-size: 11px; color: var(--primary); }
.var-chip:hover { border-color: var(--primary); background: var(--tint); }
.timeline { display: grid; gap: 0; }
.tl-item { position: relative; display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding-bottom: 14px; }
.tl-item::before { content: ""; position: absolute; top: 24px; bottom: 0; inset-inline-start: 12px; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-dot { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; }
.tl-item.ok .tl-dot { background: var(--green); }
.tl-item.bad .tl-dot { background: var(--red); }
.tl-body { display: grid; gap: 4px; min-width: 0; }
.err-snippet { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; color: var(--red); font-size: 12.5px; vertical-align: middle; }
.w-method { max-width: 140px; }
@media (max-width: 1100px) { .builder { grid-template-columns: 1fr; } .builder-side { position: static; } }
.trigger-panel { display: grid; gap: 12px; padding: 14px; border: 1px dashed var(--line); border-radius: var(--radius-lg); background: var(--card-2); }
.day-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.day-chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--heading); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.day-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.copy-row { display: flex; gap: 6px; align-items: center; min-width: 0; }
.mono-box { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); font-size: 12.5px; color: var(--heading); }
.param-row { display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; align-items: center; }
.param-tag { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; font-weight: 700; color: var(--primary); text-align: center; background: var(--tint); border-radius: 8px; padding: 6px 0; }
.wa-preview:not(:empty) { white-space: pre-wrap; padding: 10px 12px; border-radius: 12px; background: var(--tint); border-inline-start: 3px solid var(--accent, #20b26a); margin: 0; }
@media (max-width: 640px) { .cond-row { grid-template-columns: 1fr 1fr; } .cond-and { display: none; } .hdr-row { grid-template-columns: 1fr auto; } }

/* ---------- live tools ---------- */
.tool-name { font-size: 14px; font-weight: 700; color: var(--heading); background: var(--card-2); border: 1px solid var(--line); padding: 2px 8px; border-radius: 7px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.param-row { display: grid; grid-template-columns: minmax(130px, 1fr) 120px minmax(160px, 1.4fr) minmax(120px, 1fr) auto auto; gap: 8px; align-items: center; }
.check-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--fg); white-space: nowrap; cursor: pointer; }
input.check { width: 16px; height: 16px; accent-color: var(--primary); }
@media (max-width: 760px) { .param-row { grid-template-columns: 1fr 1fr; } }

/* ---------- system guide ---------- */
.g-intro { max-width: 860px; line-height: 1.9; margin-top: -8px; }
.g-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; min-width: 0; }
.g-layout > *, .g-section > *, .wf, .wf > * { min-width: 0; }
.g-toc { position: sticky; top: 78px; max-height: calc(100vh - 96px); overflow-y: auto; }
.g-toc-inner { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); }
.g-search { display: flex; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--input); color: var(--muted); }
.g-search input { border: 0; background: transparent; padding: 9px 0; min-width: 0; width: 100%; box-shadow: none; outline: none; }
.g-toc-title { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13px; color: var(--heading); padding: 2px 6px 6px; }
.g-toc-nav { display: grid; gap: 1px; }
.g-toc-link { display: flex; gap: 8px; padding: 6px 8px; border-radius: 8px; color: var(--fg); font-size: 13.5px; line-height: 1.5; text-decoration: none; }
.g-toc-link:hover { background: var(--card-2); }
.g-toc-link.active { background: var(--tint); color: var(--primary); font-weight: 700; }
.g-toc-num { min-width: 18px; color: var(--dim); font-variant-numeric: tabular-nums; }
.g-toc-toggle { display: none; }
.g-body { display: grid; gap: 18px; min-width: 0; }
.g-section { scroll-margin-top: 80px; display: grid; gap: 12px; line-height: 1.9; }
.g-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.g-section-head h2 { display: flex; align-items: center; gap: 10px; font-size: 19px; color: var(--primary); margin: 0; }
.g-section-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--tint); color: var(--primary); flex: none; }
.g-summary { padding: 12px 14px; border-radius: var(--radius); background: var(--card-2); border: 1px solid var(--line); }
.g-h { margin: 6px 0 -2px; font-size: 15px; color: var(--heading); }
.g-list { margin: 0; padding-inline-start: 22px; display: grid; gap: 4px; }
.g-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; padding: 1px 6px; border-radius: 6px; background: var(--tint); color: var(--primary); unicode-bidi: isolate; overflow-wrap: anywhere; }
a.g-code { text-decoration: none; }
a.g-code:hover { text-decoration: underline; }
.g-ui { font-weight: 700; color: var(--heading); }
.g-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.g-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.g-table th { background: var(--tint); color: var(--primary); text-align: start; font-weight: 700; padding: 8px 10px; }
.g-table td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
.g-callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid; }
.g-callout p { margin: 2px 0 0; }
.g-callout.info { background: var(--blue-tint); border-color: color-mix(in srgb, var(--blue) 30%, transparent); color: var(--fg); }
.g-callout.info > .icon { color: var(--blue); }
.g-callout.warn { background: var(--amber-tint); border-color: color-mix(in srgb, var(--amber) 35%, transparent); }
.g-callout.warn > .icon { color: var(--amber); }
.g-callout.danger { background: var(--red-tint); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.g-callout.danger > .icon { color: var(--red); }
.g-callout.tip { background: var(--green-tint); border-color: color-mix(in srgb, var(--green) 35%, transparent); }
.g-callout.tip > .icon { color: var(--green); }
.g-tech { display: grid; gap: 10px; padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--card-2); font-size: 14px; }
.g-tech h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; color: var(--muted); }
.g-meta { color: var(--primary); font-weight: 600; }
.g-dir { display: inline-flex; }
html[dir="rtl"] .g-dir svg, .g-dir.rev svg { transform: scaleX(-1); }
html[dir="rtl"] .g-dir.rev svg { transform: none; }

/* architecture picture */
.arch { display: grid; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card-2); }
.arch-row { display: grid; grid-template-columns: 1fr 70px 1.2fr 70px 1.4fr 70px 1fr; align-items: stretch; gap: 0; }
.arch-row.second { grid-template-columns: 1fr 70px 1.2fr 0.3fr 1fr 1fr; gap: 10px 0; }
.arch-row.second .arch-node:last-child { margin-inline-start: 10px; }
.arch-node { display: grid; gap: 2px; align-content: start; justify-items: center; text-align: center; padding: 10px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); line-height: 1.5; }
.arch-node strong { font-size: 13.5px; color: var(--heading); }
.arch-node.main { border-color: var(--primary); box-shadow: 0 0 0 3px var(--tint); }
.arch-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--tint); color: var(--primary); }
.arch-node.t-blue .arch-icon { background: var(--blue-tint); color: var(--blue); }
.arch-node.t-amber .arch-icon { background: var(--amber-tint); color: var(--amber); }
.arch-node.t-green .arch-icon { background: var(--green-tint); color: var(--green); }
.arch-node.t-gray .arch-icon { background: var(--gray-tint); color: var(--muted); }
.arch-arrow { position: relative; display: grid; place-items: center; text-align: center; padding: 0 4px; }
.arch-arrow::before { content: ""; position: absolute; inset-inline: 6px; top: 50%; border-top: 2px dashed var(--line-strong); }
.arch-arrow span { position: relative; background: var(--card-2); padding: 0 2px; font-size: 11px; line-height: 1.3; }

/* workflow diagrams */
.wf { margin: 4px 0; display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); box-shadow: var(--shadow-sm); }
.wf-head { display: flex; gap: 12px; align-items: flex-start; }
.wf-head h3 { margin: 0; font-size: 16px; color: var(--heading); }
.wf-head p { margin: 2px 0 0; }
.wf-head-icon { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 12px; background: linear-gradient(135deg, var(--primary), var(--green)); color: #fff; }
.wf-legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wf-actor { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.t-blue.wf-actor, .wf-dot.t-blue { background: var(--blue-tint); color: var(--blue); }
.t-purple.wf-actor, .wf-dot.t-purple { background: var(--tint-2); color: var(--primary); }
.t-amber.wf-actor, .wf-dot.t-amber { background: var(--amber-tint); color: var(--amber); }
.t-primary.wf-actor, .wf-dot.t-primary { background: var(--tint); color: var(--primary); }
.t-teal.wf-actor, .wf-dot.t-teal { background: color-mix(in srgb, #0d9488 15%, transparent); color: #0d9488; }
.t-pink.wf-actor, .wf-dot.t-pink { background: color-mix(in srgb, #db2777 14%, transparent); color: #db2777; }
.t-green.wf-actor, .wf-dot.t-green { background: var(--green-tint); color: var(--green-600); }
.t-gray.wf-actor, .wf-dot.t-gray { background: var(--gray-tint); color: var(--muted); }
.wf-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--line); }
.seg-btn { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg-btn.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow); }
.wf-strip { display: flex; align-items: center; gap: 0; overflow-x: auto; padding: 6px 2px 10px; }
.wf-node { position: relative; flex: 1 1 96px; min-width: 86px; max-width: 170px; display: grid; justify-items: center; gap: 6px; padding: 10px 6px 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--card-2); font: inherit; cursor: pointer; color: var(--fg); transition: transform .15s, border-color .15s, box-shadow .15s; }
.wf-node:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.wf-node-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--gray-tint); color: var(--muted); }
.wf-node.t-blue .wf-node-icon, .wf-node-icon.t-blue { background: var(--blue-tint); color: var(--blue); }
.wf-node.t-purple .wf-node-icon, .wf-node-icon.t-purple { background: var(--tint-2); color: var(--primary); }
.wf-node.t-amber .wf-node-icon, .wf-node-icon.t-amber { background: var(--amber-tint); color: var(--amber); }
.wf-node.t-primary .wf-node-icon, .wf-node-icon.t-primary { background: var(--tint); color: var(--primary); }
.wf-node.t-teal .wf-node-icon, .wf-node-icon.t-teal { background: color-mix(in srgb, #0d9488 15%, transparent); color: #0d9488; }
.wf-node.t-pink .wf-node-icon, .wf-node-icon.t-pink { background: color-mix(in srgb, #db2777 14%, transparent); color: #db2777; }
.wf-node.t-green .wf-node-icon, .wf-node-icon.t-green { background: var(--green-tint); color: var(--green-600); }
.wf-node-num { position: absolute; top: 6px; inset-inline-start: 8px; font-size: 11px; font-weight: 800; color: var(--dim); }
.wf-node-title { font-size: 12.5px; font-weight: 700; text-align: center; line-height: 1.4; color: var(--heading); }
.wf-node.done { border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.wf-node.active { border-color: var(--primary); background: var(--card); box-shadow: 0 0 0 3px var(--tint), var(--shadow); transform: translateY(-2px); }
.wf-conn { flex: 0 0 16px; height: 3px; border-radius: 3px; background: repeating-linear-gradient(90deg, var(--line-strong) 0 6px, transparent 6px 10px); }
.wf-conn.done { background: var(--green); }
.wf-conn.flow { background: repeating-linear-gradient(90deg, var(--primary) 0 6px, transparent 6px 10px); background-size: 20px 3px; animation: wf-flow .6s linear infinite; }
html[dir="rtl"] .wf-conn.flow { animation-direction: reverse; }
@keyframes wf-flow { to { background-position: 20px 0; } }
@media (prefers-reduced-motion: reduce) { .wf-conn.flow { animation: none; } .wf-node { transition: none; } }
.wf-panel { display: grid; gap: 10px; padding: 14px; border-radius: var(--radius-lg); background: var(--card-2); border: 1px solid var(--line); line-height: 1.85; animation: wf-in .25s ease; }
@keyframes wf-in { from { opacity: .3; transform: translateY(4px); } }
.wf-panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wf-panel-head h4 { margin: 0; font-size: 15px; color: var(--heading); }
.wf-panel p { margin: 0; }
.wf-info { display: grid; gap: 4px; padding: 10px 12px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.wf-info-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 800; color: var(--muted); }
.wf-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.wf-tag { padding: 2px 8px; border-radius: 8px; background: var(--gray-tint); font-size: 12.5px; }
.wf-subs { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.wf-sub { position: relative; padding: 8px 12px 10px; padding-inline-start: 26px; border-inline-start: 2px solid var(--line); margin-inline-start: 8px; }
.wf-sub.current { background: var(--tint); border-radius: 0 10px 10px 0; border-inline-start-color: var(--primary); }
html[dir="rtl"] .wf-sub.current { border-radius: 10px 0 0 10px; }
.wf-sub p { margin: 2px 0 0; }
.wf-sub-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border: 0; background: none; padding: 0; font: inherit; color: var(--heading); cursor: pointer; text-align: start; }
.wf-dot { position: absolute; inset-inline-start: -7px; top: 13px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--card); }
.wf-caret { display: inline-flex; color: var(--muted); transition: transform .15s; }
.wf-caret.open { transform: rotate(180deg); }
.wf-tech { display: grid; gap: 4px; margin-top: 6px; padding: 8px 10px; border-radius: var(--radius); border: 1px dashed var(--line-strong); font-size: 13px; }
.wf-nav { display: flex; justify-content: space-between; gap: 8px; }
.wf-note { margin: 0; }
.wf-print { display: none; }
.wf-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.wf-index-card { display: grid; gap: 6px; justify-items: start; text-align: start; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card-2); font: inherit; color: var(--fg); cursor: pointer; line-height: 1.6; }
.wf-index-card:hover { border-color: var(--primary); background: var(--tint); }
.wf-index-card strong { color: var(--heading); }

@media (max-width: 980px) {
  .g-layout { grid-template-columns: 1fr; }
  .g-toc { position: static; max-height: none; }
  .g-toc-toggle { display: flex; align-items: center; gap: 6px; border: 0; background: none; font: inherit; font-weight: 700; color: var(--heading); cursor: pointer; padding: 2px; }
  .g-toc-nav { display: none; }
  body.g-toc-open .g-toc-nav { display: grid; }
  .arch-row, .arch-row.second { grid-template-columns: 1fr; gap: 6px; }
  .arch-arrow { min-height: 24px; }
  .arch-arrow::before { inset-inline: auto; inset-block: 2px; top: auto; left: 50%; border-top: 0; border-left: 2px dashed var(--line-strong); }
  .arch-spacer { display: none; }
  .arch-row.second .arch-node:last-child { margin: 0; }
}

@media print {
  .sidebar, .topbar, .g-toc, .page-actions, .g-noprint, .wf-toolbar, .wf-strip, .wf-panel, .wf-legend, .savebar, .toast-wrap { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .g-layout { display: block; }
  .g-section { border: 0; box-shadow: none; padding: 0 0 12px; break-inside: auto; }
  .g-section + .g-section { break-before: page; }
  .wf { box-shadow: none; break-inside: auto; }
  .wf-print { display: grid; gap: 8px; }
  .wf-print-stage h4 { margin: 6px 0 0; }
  .g-section[hidden] { display: grid !important; }
}

/* ---------- reports & monitoring (charts) ----------
   Categorical slots validated for colour-vision deficiency on these surfaces
   (light #fff, dark #1a1035); --seq-* is the sequential violet ramp; status
   colours are only used for health states, always with an icon + label. */
:root {
  --viz-1: #6c3ad8; --viz-2: #1a9a5b; --viz-3: #eda100;
  --seq-0: #f4f2f8; --seq-1: #ece6fb; --seq-2: #d8cbf6; --seq-3: #b9a1ee; --seq-4: #9675e3; --seq-5: #7348d6; --seq-6: #4f27a6;
  --st-good: #0ca30c; --st-warning: #fab219; --st-critical: #d03b3b;
  --viz-grid: #ececf0; --viz-axis: #c9c8d3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --viz-1: #8b5cf6; --viz-2: #0ea371; --viz-3: #c98500;
    --seq-0: #221641; --seq-1: #2c1d55; --seq-2: #3a2672; --seq-3: #5a3cae; --seq-4: #6f4ccf; --seq-5: #8f6ff0; --seq-6: #bfa8fb;
    --viz-grid: rgb(255 255 255 / 7%); --viz-axis: rgb(255 255 255 / 16%);
  }
}
:root[data-theme="dark"] {
  --viz-1: #8b5cf6; --viz-2: #0ea371; --viz-3: #c98500;
  --seq-0: #221641; --seq-1: #2c1d55; --seq-2: #3a2672; --seq-3: #5a3cae; --seq-4: #6f4ccf; --seq-5: #8f6ff0; --seq-6: #bfa8fb;
  --viz-grid: rgb(255 255 255 / 7%); --viz-axis: rgb(255 255 255 / 16%);
}
.rp-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.rp-custom { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 10px; border: 1px solid transparent; }
.rp-custom.active { border-color: var(--primary); background: var(--tint); }
.rp-custom input { padding: 6px 8px; width: auto; }
.rp-export { display: flex; gap: 6px; margin-inline-start: auto; }
.rp-body { transition: opacity .15s; }
.rp-body.loading, .stack.loading { opacity: .55; pointer-events: none; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi-grid.small { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi-grid.small:has(> :nth-child(5):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1180px) { .kpi-grid.small, .kpi-grid.small:has(> :nth-child(5):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat-tile { position: relative; display: grid; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); box-shadow: var(--shadow-sm); min-width: 0; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--heading); line-height: 1.2; }
.stat-tile.hero .stat-value { font-size: 34px; }
.kpi-grid.small .stat-value { font-size: 20px; }
.stat-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 18px; }
.stat-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--gray-tint); color: var(--muted); }
.stat-delta span:first-child { font-size: 9px; }
.stat-delta.good { background: var(--green-tint); color: var(--green-600); }
.stat-delta.bad { background: var(--red-tint); color: var(--red); }
.spark { width: 100%; height: 28px; margin-top: 4px; }
.spark-line { fill: none; stroke: var(--viz-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; opacity: .55; }
.spark-dot { fill: var(--viz-1); stroke: var(--card); stroke-width: 2; }
.vcard { display: grid; gap: 12px; min-width: 0; }
.vcard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.vcard-head h3 { margin: 0; font-size: 15.5px; color: var(--heading); }
.vcard-head p { margin: 2px 0 0; }
.viz-toggle { border: 0; background: none; color: var(--primary); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap; padding: 2px; }
.viz-toggle:hover { text-decoration: underline; }
.viz-chart { width: 100%; }
.viz-svg { width: 100%; height: auto; display: block; overflow: visible; }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; shape-rendering: crispEdges; }
.viz-base { stroke: var(--viz-axis); stroke-width: 1; shape-rendering: crispEdges; }
.viz-tick { fill: var(--muted); font-size: 11px; font-family: inherit; font-variant-numeric: tabular-nums; }
.viz-end { fill: var(--heading); font-size: 12px; font-weight: 700; font-family: inherit; }
.viz-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-area { opacity: .1; }
.viz-dot { stroke: var(--card); stroke-width: 2; }
.viz-col { transition: opacity .1s; }
.viz-cross { stroke: var(--viz-axis); stroke-width: 1; }
.viz-svg rect[tabindex]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--fg); }
.viz-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.viz-key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; flex: none; }
.viz-key.box { width: 10px; height: 10px; border-radius: 3px; }
.viz-tip { position: fixed; z-index: 100; pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .1s, transform .1s; background: var(--card); color: var(--fg); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 8px 10px; font-size: 12.5px; display: grid; gap: 4px; min-width: 120px; }
.viz-tip.on { opacity: 1; transform: none; }
.viz-tip-title { color: var(--muted); font-weight: 600; }
.viz-tip-row { display: flex; align-items: center; gap: 8px; }
.viz-tip-row strong { color: var(--heading); font-size: 14px; }
.viz-tip-label { color: var(--muted); }
.viz-table { overflow-x: auto; max-height: 360px; border: 1px solid var(--line); border-radius: var(--radius); }
.viz-table table, .mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.viz-table th, .mini-table th { background: var(--tint); color: var(--primary); text-align: start; padding: 7px 10px; position: sticky; top: 0; }
.viz-table td, .mini-table td { padding: 6px 10px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.barlist { display: grid; gap: 10px; }
.barlist-row { display: grid; grid-template-columns: minmax(110px, 34%) 1fr auto; align-items: center; gap: 10px; border-radius: 8px; }
.barlist-row:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.barlist-label { display: grid; font-size: 13.5px; color: var(--heading); min-width: 0; }
.barlist-label span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barlist-track { height: 12px; display: flex; }
.barlist-bar { display: block; height: 100%; border-start-end-radius: 4px; border-end-end-radius: 4px; }
.barlist-value { display: flex; gap: 6px; align-items: baseline; min-width: 64px; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.barlist-value strong { color: var(--heading); }
.heat-wrap { display: grid; gap: 10px; overflow-x: auto; }
.heat { display: grid; grid-template-columns: 74px repeat(24, minmax(16px, 1fr)); gap: 2px; min-width: 560px; }
.heat-day { font-size: 12px; color: var(--muted); align-self: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-inline-end: 4px; }
.heat-hour { font-size: 10.5px; color: var(--muted); text-align: start; font-variant-numeric: tabular-nums; }
.heat-cell { height: 22px; border-radius: 4px; background: var(--seq-0); outline-offset: 1px; }
.heat-cell:focus-visible, .heat-cell:hover { outline: 2px solid var(--heading); }
.heat-cell.s1 { background: var(--seq-1); } .heat-cell.s2 { background: var(--seq-2); } .heat-cell.s3 { background: var(--seq-3); }
.heat-cell.s4 { background: var(--seq-4); } .heat-cell.s5 { background: var(--seq-5); } .heat-cell.s6 { background: var(--seq-6); }
.heat-scale { display: flex; align-items: center; gap: 3px; }
.heat-scale .heat-cell { width: 22px; height: 12px; }
.heat-scale .heat-cell:hover { outline: 0; }
.seg-bar { display: flex; gap: 2px; height: 10px; border-radius: 999px; overflow: hidden; background: var(--seq-0); }
.seg-bar span { display: block; height: 100%; }
.seg-list { display: grid; gap: 8px; margin-top: 12px; }
.seg-item { display: grid; grid-template-columns: auto 1fr auto 48px; align-items: center; gap: 8px; font-size: 13.5px; }
.seg-item strong { color: var(--heading); font-variant-numeric: tabular-nums; }
.funnel { display: grid; gap: 12px; }
.funnel-row { display: grid; grid-template-columns: minmax(130px, 26%) 1fr 110px; align-items: center; gap: 12px; }
.funnel-label { display: grid; color: var(--heading); font-size: 14px; }
.funnel-track { height: 22px; display: flex; background: var(--seq-0); border-radius: 6px; }
.funnel-bar { height: 100%; border-radius: 6px; }
.funnel-value { display: flex; gap: 8px; align-items: baseline; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.funnel-value strong { color: var(--heading); font-size: 16px; }
.insights { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.insights li { display: flex; gap: 10px; align-items: flex-start; line-height: 1.8; }
.insights li > .icon { color: var(--primary); margin-top: 5px; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--heading); background: var(--gray-tint); }
.status-pill .icon { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: #fff; }
.status-pill .icon svg { width: 11px; height: 11px; stroke-width: 3; }
.status-pill.st-ok .icon { background: var(--st-good); }
.status-pill.st-warning .icon { background: var(--st-warning); color: #0b0b0b; }
.status-pill.st-critical .icon { background: var(--st-critical); }
.mon-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--card); }
.mon-banner.st-ok { border-inline-start: 4px solid var(--st-good); }
.mon-banner.st-warning { border-inline-start: 4px solid var(--st-warning); }
.mon-banner.st-critical { border-inline-start: 4px solid var(--st-critical); background: var(--red-tint); }
.mon-banner strong { color: var(--heading); }
.mon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.mon-card { display: grid; gap: 10px; align-content: start; }
.mon-card.st-border-warning { box-shadow: inset 0 3px 0 var(--st-warning); }
.mon-card.st-border-critical { box-shadow: inset 0 3px 0 var(--st-critical); }
.mon-card-head { display: flex; align-items: center; gap: 8px; }
.mon-card-head h3 { margin: 0; flex: 1; font-size: 15px; color: var(--heading); }
.mon-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--tint); color: var(--primary); }
.mon-stats { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; margin: 0; font-size: 13.5px; }
.mon-stats dt { color: var(--muted); }
.mon-stats dd { margin: 0; color: var(--heading); font-weight: 700; text-align: end; font-variant-numeric: tabular-nums; max-width: 180px; overflow-wrap: anywhere; }
.mon-mini { list-style: none; margin: 0; padding: 8px 0 0; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.mon-mini li { display: grid; gap: 1px; }
.mon-err { color: var(--red); overflow-wrap: anywhere; }
.mon-hint { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--amber-tint); }
.mon-events { list-style: none; margin: 0; padding: 0; display: grid; }
.mon-events li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.mon-events li:first-child { border-top: 0; }
.section-title { margin: 4px 0 -6px; font-size: 14px; color: var(--muted); }
@media (max-width: 640px) {
  .rp-export { margin: 0; }
  .barlist-row { grid-template-columns: 1fr auto; }
  .barlist-track { grid-column: 1 / -1; order: 3; }
  .funnel-row { grid-template-columns: 1fr auto; }
  .funnel-track { grid-column: 1 / -1; order: 3; }
  .grid-2 { grid-template-columns: 1fr; }
  .stat-value { font-size: 22px; }
  .kpi-grid.small, .kpi-grid.small:has(> :nth-child(5):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-tile { padding: 12px; }
  .stat-tile.hero .stat-value { font-size: 28px; }
}
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.switch-row:first-child, .hint-box + .switch-row { border-top: 0; }
.switch-row p { margin: 2px 0 0; }

/* ---------- knowledge base ---------- */
.kb-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; align-items: start; }
.kb-stats { display: grid; gap: 16px; }
.kb-mode { display: flex; gap: 12px; align-items: flex-start; }
.kb-mode > .icon { color: var(--primary); margin-top: 2px; }
.kb-mode strong { color: var(--heading); }
.kb-mode p { margin: 2px 0 0; }
.kb-meter { display: grid; gap: 6px; }
.kb-meter-top { display: flex; justify-content: space-between; color: var(--fg); }
.kb-meter-track { height: 8px; border-radius: 999px; background: var(--seq-1); overflow: hidden; display: flex; }
.kb-meter-track span { display: block; height: 100%; background: var(--viz-1); border-radius: 999px; }
.kb-meter p { margin: 0; }
.kb-ask input { flex: 1; min-width: 0; }
.kb-ask-out { display: grid; gap: 8px; }
.kb-hit { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card-2); }
.kb-hit-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kb-hit-head strong { color: var(--heading); }
.kb-hit p { margin: 6px 0 0; white-space: pre-wrap; font-size: 13.5px; line-height: 1.8; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.kb-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.kb-filter { max-width: 320px; flex: 1; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--fg); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip.active { border-color: var(--primary); background: var(--tint); color: var(--primary); }
.chip-count { font-size: 11.5px; padding: 0 7px; border-radius: 999px; background: var(--gray-tint); color: var(--muted); }
.kb-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.kb-card { display: grid; gap: 8px; align-content: start; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); box-shadow: var(--shadow-sm); cursor: pointer; transition: border-color .15s, transform .15s; min-width: 0; }
.kb-card:hover, .kb-card:focus-visible { border-color: var(--primary); transform: translateY(-1px); outline: 0; }
.kb-card.off { opacity: .6; }
.kb-card h3 { margin: 0; font-size: 15px; color: var(--heading); line-height: 1.6; }
.kb-card-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kb-card-head > .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.kb-card-actions { display: flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.kb-snippet { margin: 0; font-size: 13.5px; line-height: 1.8; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.kb-card-foot { display: flex; justify-content: space-between; }
.kb-kind { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.kb-kind.t-purple { background: var(--tint-2); color: var(--primary); }
.kb-kind.t-blue { background: var(--blue-tint); color: var(--blue); }
.kb-kind.t-amber { background: var(--amber-tint); color: var(--amber); }
.kb-kind.t-gray { background: var(--gray-tint); color: var(--muted); }
dialog.modal.modal-wide { width: min(760px, calc(100vw - 32px)); }
@media (max-width: 900px) { .kb-top { grid-template-columns: 1fr; } .kb-filter { max-width: none; } }

/* ---------- WhatsApp AI test chat ---------- */
.secret-box code { overflow-wrap: anywhere; font-size: 14px; letter-spacing: 0; }
.chat-log { display: flex; flex-direction: column; gap: 8px; min-height: 260px; max-height: 460px; overflow-y: auto; padding: 14px; border-radius: var(--radius-lg); background: color-mix(in srgb, var(--green) 6%, var(--card-2)); border: 1px solid var(--line); }
.chat-empty { margin: auto; text-align: center; }
.bubble { max-width: min(78%, 520px); padding: 8px 12px; border-radius: 14px; font-size: 14.5px; line-height: 1.75; box-shadow: var(--shadow-sm); }
.bubble.me { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-start-start-radius: 4px; }
.bubble.ai { align-self: flex-end; background: color-mix(in srgb, var(--green) 16%, var(--card)); border-start-end-radius: 4px; }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--heading); }
.bubble-tools { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.bubble.typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.bubble.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out; }
.bubble.typing span:nth-child(2) { animation-delay: .2s; } .bubble.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .bubble.typing span { animation: none; } }
.chat-note { align-self: center; font-size: 12.5px; padding: 4px 12px; border-radius: 999px; background: var(--amber-tint); color: var(--amber); }
.chat-note.err { background: var(--red-tint); color: var(--red); }
.chat-input input { flex: 1; min-width: 0; }

/* ---------- platform status ---------- */
.ps-list { display: grid; }
.ps-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.ps-row:first-child { border-top: 0; }
.ps-row p { margin: 2px 0 0; }
.ps-value { font-size: 12.5px; color: var(--fg); overflow-wrap: anywhere; }
@media (max-width: 640px) { .ps-row { grid-template-columns: 1fr auto; } .ps-value { grid-column: 1 / -1; order: 3; } }

/* KPI cards and tiles open their report page */
.stat.stat-link, .stat-tile.stat-link { cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
.stat.stat-link:hover, .stat-tile.stat-link:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.stat.stat-link:focus-visible, .stat-tile.stat-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.stat-tile.current { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--primary); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

/* Compact two-column form rows (dialogs) */
.form-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }

.kpi-group-title { margin: 6px 0 10px; font-size: 14px; color: var(--muted); font-weight: 700; }

/* ---------- user guide (screen + print) ---------- */
.ug { display: grid; gap: 16px; max-width: 980px; }
.ug-cover h1 { margin: 0 0 4px; font-size: 24px; color: var(--heading); }
.ug-cover p { margin: 0; }
.ug-toc-title { margin: 0 0 6px; font-size: 15px; }
.ug-toc ol { margin: 0; padding-inline-start: 22px; columns: 2; column-gap: 28px; line-height: 2; }
.ug-toc a { color: var(--primary); text-decoration: none; }
.ug-toc a:hover { text-decoration: underline; }
.ug-section { display: grid; gap: 12px; line-height: 1.9; scroll-margin-top: 80px; }
.ug-section h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 19px; color: var(--primary); }
.ug-num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--tint); font-size: 14px; flex: none; }
.ug-section p { margin: 0; }
.ug-check { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ug-check li { display: flex; gap: 10px; align-items: flex-start; }
.ug-box { width: 16px; height: 16px; margin-top: 6px; border: 2px solid var(--line-strong); border-radius: 4px; flex: none; }
@media (max-width: 720px) { .ug-toc ol { columns: 1; } }
@media print {
  .ug-noprint { display: none !important; }
  .ug-page .page-head { display: none !important; }
  .ug { max-width: none; gap: 10px; }
  .ug .card { border: 0; box-shadow: none; padding: 0; background: none; }
  .ug-cover { padding-bottom: 8px; border-bottom: 2px solid #000; }
  .ug-section { break-before: page; line-height: 1.6; font-size: 11.5pt; }
  .ug-section h2 { color: #000; }
  .ug-num { background: none; border: 1px solid #000; }
  .g-table-wrap { overflow: visible; border-color: #999; }
  .g-table { font-size: 10pt; }
  .g-table th { background: #eee !important; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .g-table tr, .g-callout, .ug-check li { break-inside: avoid; }
  .g-ui, .g-code { color: #000; }
  .g-code { background: none; padding: 0; }
  .ug-toc a { color: #000; }
}

/* ---------- phones and small tablets ----------
   Grid and flex children may shrink below their content (a wide table then
   scrolls inside its box instead of widening the page); 16px form text so iOS
   does not zoom on focus; touch targets of at least 40px; data tables become
   stacked cards with each value labelled. */
.page > *, .card > *, .grid-2 > *, .page-head > * { min-width: 0; }
@media (max-width: 960px) {
  input, select, textarea { font-size: 16px; }
  .switcher select { font-size: 16px; min-height: 36px; }
  .switch { width: 54px; height: 32px; }
  .switch::after { width: 26px; height: 26px; }
  .switch.on::after { inset-inline-start: 25px; }
  .btn.sm { height: 38px; }
  .icon-btn { width: 40px; height: 40px; }
  .link.small, .viz-toggle, .ov-help .link, .back-link { display: inline-flex; align-items: center; min-height: 40px; }
  .ug-toc a, .g-toc-link { display: inline-block; padding: 6px 0; }
  .g-toc-link { display: flex; padding: 10px 8px; }
  .toolbar > * { flex: 1 1 100%; max-width: none !important; min-width: 0 !important; }
  .page-head h1 { font-size: 22px; }
  .page-actions { width: 100%; }
  .drawer-body { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  dialog.modal { width: calc(100% - 20px); max-height: calc(100dvh - 24px); }
}
@media (max-width: 640px) {
  .content { padding: 14px 12px 28px; }
  .card { padding: 16px; }
  .seg { flex-wrap: wrap; max-width: 100%; height: auto; }
  /* Page tabs (at most 4 per page): equal columns, icon over the label, no sideways swipe. */
  .tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; overflow: visible; }
  .tabs button { flex-direction: column; justify-content: center; gap: 3px; min-height: 52px; padding: 8px 2px; font-size: 12px; line-height: 1.25; white-space: normal; text-align: center; overflow-wrap: normal; hyphens: none; }
  .tabs .tab-full:has(+ .tab-short) { display: none; }
  .tabs .tab-short { display: inline; }
  .tabs button .icon { width: 18px; height: 18px; }
  /* Report periods: a 3 x 2 grid, one line per label. */
  .rp-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; gap: 2px; }
  .rp-presets .seg-btn { display: flex; align-items: center; justify-content: center; min-height: 38px; padding: 6px 4px; white-space: nowrap; text-align: center; }
  .rp-filters > .rp-custom { width: 100%; padding: 0; }
  .rp-custom { flex-wrap: wrap; max-width: 100%; }
  .rp-filters > * { max-width: 100%; min-width: 0; }
  .rp-export { flex-wrap: wrap; }
  .rp-export .btn { flex: 1 1 auto; white-space: normal; }
  .rp-custom input { min-width: 0; flex: 1 1 130px; }
  .table-wrap:has(> .table.cards) { margin: 0; padding: 0; overflow: visible; }
  .table.cards, .table.cards tbody, .table.cards tr, .table.cards td { display: block; width: 100%; }
  .table.cards thead { display: none; }
  .table.cards tr { padding: 10px 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
  .table.cards tr:last-child { margin-bottom: 0; }
  .table.cards td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); white-space: normal; text-align: end; overflow-wrap: anywhere; }
  .table.cards tbody tr:last-child td, .table.cards tr td:last-child { border-bottom: 0; }
  .table.cards td::before { content: attr(data-label); flex: none; max-width: 45%; color: var(--muted); font-size: 12.5px; font-weight: 700; text-align: start; }
  .table.cards td[data-label=""]::before { content: none; }
  .table.cards td[data-label=""] { justify-content: flex-end; }
  .table.cards tr.clickable:hover td { background: none; }
  .table.cards tr.clickable:active { background: var(--tint); }
}

/* ---------- browser test call & voice preview ---------- */
.vc { display: grid; gap: 14px; }
.vc-top { display: flex; align-items: center; gap: 14px; }
.vc-orb { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--card-2); color: var(--muted); border: 1px solid var(--line); flex: none; transition: background .2s, box-shadow .2s, color .2s; }
.vc-orb.on { background: var(--tint); color: var(--primary); border-color: var(--tint-2); }
.vc-orb.speaking { box-shadow: 0 0 0 6px var(--tint), 0 0 0 12px color-mix(in srgb, var(--primary) 12%, transparent); animation: vc-pulse 1.2s ease-in-out infinite; }
@keyframes vc-pulse { 50% { box-shadow: 0 0 0 9px var(--tint), 0 0 0 16px color-mix(in srgb, var(--primary) 8%, transparent); } }
.vc-meta { display: grid; gap: 2px; }
.vc-status { font-weight: 700; color: var(--heading); }
.vc-status.ok { color: var(--green); }
.vc-status.warn { color: var(--amber); }
.vc-status.err { color: var(--red); font-weight: 600; }
.vc-timer { color: var(--muted); font-variant-numeric: tabular-nums; }
.vc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.vc-actions .btn { flex: 1 1 140px; }
.vc-log { display: flex; flex-direction: column; gap: 8px; min-height: 160px; max-height: 42vh; overflow-y: auto; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card-2); }
.vc-log .bubble.ai { align-self: flex-start; background: var(--tint); }
.vc-log .bubble.me { align-self: flex-end; background: var(--card); border: 1px solid var(--line); }
.vc-live { min-height: 1.6em; margin: -6px 0 0; }
@media (prefers-reduced-motion: reduce) { .vc-orb.speaking { animation: none; } }
.voice-current { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radius); background: var(--tint); }
.voice-current-text { display: grid; gap: 1px; }
.voice-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.voice-filters input { flex: 1 1 220px; }
.voice-filters select { flex: 0 1 180px; }
.voice-list { display: grid; gap: 8px; max-height: 520px; overflow-y: auto; padding: 2px; }
.voice-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.voice-item.chosen { border-color: var(--primary); box-shadow: 0 0 0 2px var(--tint); }
.voice-item.playing { background: var(--tint); }
.voice-item.chosen .btn:disabled { opacity: 1; cursor: default; }
.voice-text { display: grid; gap: 4px; min-width: 0; }
.voice-text p { margin: 0; }
.voice-btns { display: flex; gap: 6px; flex: none; }
@media (max-width: 640px) { .voice-item { flex-direction: column; align-items: stretch; } .voice-btns .btn { flex: 1; } }

/* ---------- setup checklists, feature cards, sub-page header ---------- */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.checklist li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.check-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-strong); color: var(--muted); font-weight: 700; font-size: 13px; flex: none; }
.checklist li.done .check-num { background: var(--green); border-color: var(--green); color: #fff; }
.checklist li.done .check-text strong { color: var(--muted); }
.check-text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.check-text p { margin: 0; }
.check-action { flex: none; }
@media (max-width: 640px) { .checklist li { flex-wrap: wrap; } .check-action { flex: 1 1 100%; padding-inline-start: 38px; } }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.feature-card { display: grid; gap: 6px; align-content: start; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); box-shadow: var(--shadow); color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.feature-card:hover { border-color: var(--tint-2); transform: translateY(-1px); text-decoration: none; }
.feature-card.static:hover { border-color: var(--line); transform: none; }
.feature-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.feature-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--tint); color: var(--primary); }
.feature-title { color: var(--heading); font-size: 15px; }
.feature-card p { margin: 0; }
.feature-action { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--primary); font-weight: 700; font-size: 13.5px; }
.int-head { display: flex; align-items: flex-start; gap: 14px; }
.int-head .feature-icon { width: 48px; height: 48px; flex: none; }
.int-head h1 { margin: 0; font-size: 22px; }
.int-head p { margin: 4px 0 0; }
.form-section { display: grid; gap: 10px; padding-top: 6px; }
.form-section + .form-section { border-top: 1px solid var(--line); padding-top: 16px; }
.form-section > h3 { margin: 0; font-size: 14px; color: var(--heading); }
.form-section > p { margin: -4px 0 0; }
.follow-list { display: grid; gap: 4px; }
.follow-item { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: var(--radius); color: inherit; }
.follow-item:hover { background: var(--card-2); text-decoration: none; }
.follow-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--amber); flex: none; }
.follow-dot[data-tone="red"] { background: var(--red); }
.follow-text { display: grid; gap: 1px; min-width: 0; }
.ov-help { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.follow-meta bdi + bdi::before { content: " · "; }

/* ---------- Excel / CSV import ---------- */
.steps { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; counter-reset: st; font-size: 12px; font-weight: 700; color: var(--dim); }
.steps li { flex: 1; display: flex; align-items: center; gap: 6px; padding-bottom: 6px; border-bottom: 3px solid var(--line); counter-increment: st; }
.steps li::before { content: counter(st); display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--gray-tint); font-size: 11px; }
.steps li.active { color: var(--primary); border-color: var(--primary); }
.steps li.active::before { background: var(--primary); color: #fff; }
.steps li.done { color: var(--green); border-color: var(--green); }
.steps li.done::before { content: "✓"; background: var(--green-tint); }
.dropzone { display: grid; justify-items: center; gap: 6px; padding: 32px 16px; border: 2px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--card-2); color: var(--muted); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone:focus-visible, .dropzone.over { border-color: var(--primary); background: var(--tint); color: var(--primary); outline: none; }
.dropzone strong { color: var(--heading); }
.dropzone.busy { opacity: .6; pointer-events: none; }
.link-btn { padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.im-foot { display: flex; justify-content: flex-end; gap: 8px; }
.im-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.im-count { display: grid; gap: 2px; padding: 12px; border-radius: var(--radius); background: var(--gray-tint); font-size: 13px; font-weight: 600; }
.im-count strong { font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.im-count.green { background: var(--green-tint); color: var(--green); }
.im-count.blue { background: var(--blue-tint); color: var(--blue); }
.im-count.red { background: var(--red-tint); color: var(--red); }
.im-count.gray { color: var(--muted); }
.im-issues { max-height: 260px; overflow: auto; }
.import .table.compact td, .import .table.compact th { padding: 6px 10px; }
.import select { width: 100%; min-width: 140px; }
.import .ellipsis { display: inline-block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.import .req { color: var(--red); }
.im-done { display: grid; justify-items: center; gap: 8px; padding: 8px 0; }
.im-done-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--green-tint); color: var(--green); }

/* ---------- long lists (datalist.js) ---------- */
.dl-toolbar { align-items: center; }
.dl-toolbar select { width: auto; min-width: 150px; max-width: 220px; }
.dl-spacer { flex: 1; }
.dl-dates { display: inline-flex; align-items: center; gap: 6px; }
.dl-dates input { width: 150px; }
.dl-chips { max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
.dl-chips .seg-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dl-n { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--gray-tint); color: var(--muted); font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.seg-btn.active .dl-n { background: var(--tint); color: var(--primary); }
.dl-wrap { position: relative; }
.dl-loading { position: absolute; inset-inline: 0; top: -8px; height: 3px; overflow: hidden; border-radius: 3px; background: var(--tint); }
.dl-loading::after { content: ""; position: absolute; inset-block: 0; width: 30%; background: var(--primary); animation: dl-slide 1s ease-in-out infinite; }
@keyframes dl-slide { from { inset-inline-start: -30%; } to { inset-inline-start: 100%; } }
.dl-body { transition: opacity .15s; }
.dl-body.dl-dim { opacity: .55; pointer-events: none; }
.dl-sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
.dl-sort:hover, .dl-sort.active { color: var(--primary); }
.dl-arrow { font-size: 11px; opacity: .6; }
.dl-sort.active .dl-arrow { opacity: 1; }
.dl .table thead th { position: sticky; top: 0; z-index: 1; }
.dl .table tr.clickable:focus-visible td { background: var(--tint); outline: none; }
.dl-sentinel { height: 1px; }
.dl-status:empty { display: none; }
@media (max-width: 720px) {
  .dl-toolbar .search { min-width: 100%; }
  .dl-dates { width: 100%; }
  .dl-dates input { flex: 1; width: auto; }
  .dl-toolbar select { flex: 1; max-width: none; }
}

/* user guide: printed contents only (the screen uses the side pane) */
.ug-printonly { display: none; }
@media print { .ug-printonly { display: block; } }
.form-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }

/* ---------- step-by-step wizard (UI.wizard) ---------- */
.wz { display: grid; gap: 16px; min-width: 0; }
.wz-steps { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.wz-step { flex: 1; min-width: 120px; display: flex; align-items: center; gap: 8px; padding: 8px 10px 10px; border: 0; border-bottom: 3px solid var(--line); background: none; font: inherit; font-size: 13px; font-weight: 700; color: var(--muted); text-align: start; cursor: pointer; }
.wz-step:disabled { cursor: default; color: var(--dim); }
.wz-step:not(:disabled):hover { color: var(--primary); }
.wz-num { display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--gray-tint); font-size: 12px; }
.wz-step.active { color: var(--primary); border-color: var(--primary); }
.wz-step.active .wz-num { background: var(--primary); color: #fff; }
.wz-step.done { color: var(--green); border-color: var(--green); }
.wz-step.done .wz-num { background: var(--green-tint); color: var(--green); }
.wz-step.done .wz-num { font-size: 0; }
.wz-step.done .wz-num::before { content: "✓"; font-size: 12px; }
.wz-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wz-body { min-width: 0; }
.wz-panel { display: grid; gap: 12px; animation: wz-in .18s ease; }
.wz-hint { margin: 0; }
@keyframes wz-in { from { opacity: 0; transform: translateY(4px); } }
.wz-foot { display: grid; gap: 8px; }
.wz-foot .form-error:empty { display: none; }
.wz-actions { display: flex; align-items: center; gap: 8px; }
.wz-count { margin-inline-start: auto; }
.wz:not(.linear) .wz-actions { display: none; }
.wz-back .icon svg { transform: scaleX(-1); }
[dir="rtl"] .wz-actions .btn .icon svg { transform: scaleX(-1); }
[dir="rtl"] .wz-actions .wz-back .icon svg { transform: none; }
[dir="rtl"] .wz-actions .btn .icon svg:has(polyline:only-child) { transform: none; }
.builder > .builder-side[hidden] { display: none; }
.builder:has(> .builder-side[hidden]) { grid-template-columns: minmax(0, 1fr); }

/* ---------- sidebar: collapsed «More settings» for client users ---------- */
.nav-more { display: grid; gap: 2px; }
.nav-more > summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; border-radius: var(--radius); }
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary:hover { color: var(--primary); }
.nav-more > summary .icon { transition: transform .15s; }
.nav-more[open] > summary .icon { transform: rotate(180deg); }

/* ---------- setup wizard (pages-setup.js) ---------- */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.pick-grid.pick-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .pick-grid.pick-2 { grid-template-columns: minmax(0, 1fr); } }
.pick { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--card); cursor: pointer; transition: border-color .15s, background .15s; min-width: 0; }
.pick:hover { border-color: var(--primary); }
.pick:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pick.on { border-color: var(--primary); background: var(--tint); }
.pick.soon { cursor: default; opacity: .6; }
.pick.soon:hover { border-color: var(--line-strong); }
.pick-dot { flex: none; width: 18px; height: 18px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--card); }
.pick.on .pick-dot { border-color: var(--primary); box-shadow: inset 0 0 0 3px var(--card); background: var(--primary); }
.pick-text { flex: 1; min-width: 0; }
.pick-text p { margin: 2px 0 0; }
.pick-icon { flex: none; color: var(--muted); }
.pick.on .pick-icon { color: var(--primary); }
.pick > .btn { flex: none; align-self: center; }
.su-count { display: flex; align-items: baseline; gap: 8px; }
.su-count-n { font-size: 28px; font-weight: 800; color: var(--heading); }
.su-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.su-list li { display: grid; gap: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.su-kb { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.su-kb-text { flex: 1; min-width: 0; }
.su-kb-text p { margin: 4px 0 0; }
.su-clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- in-app helper chat (helper.js) ---------- */
.hp-panel { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; z-index: 60; width: min(400px, 100vw); display: flex; flex-direction: column; background: var(--card); border-inline-start: 1px solid var(--line); box-shadow: var(--shadow-lg); transform: translateX(100%); visibility: hidden; transition: transform .2s ease, visibility .2s; }
[dir="rtl"] .hp-panel { transform: translateX(-100%); }
body.hp-open .hp-panel { transform: none; visibility: visible; }
@media (min-width: 1200px) { body.hp-open .main { margin-inline-end: 400px; } }
.hp-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.hp-title { flex: 1; display: grid; min-width: 0; }
.hp-mark { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--tint-2); background: var(--tint); color: var(--primary); }
.hp-mark.sm { width: 26px; height: 26px; }
.hp-list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.hp-empty { margin-top: auto; display: grid; gap: 10px; }
.hp-hello { display: flex; gap: 12px; align-items: flex-start; }
.hp-hello strong { font-size: 16px; color: var(--heading); }
.hp-hello p { margin: 2px 0 0; }
.hp-sug-title { margin-top: 8px; font-weight: 700; }
.hp-sug { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card); color: var(--fg); font: inherit; font-weight: 600; text-align: start; cursor: pointer; }
.hp-sug:hover { border-color: var(--primary); color: var(--primary); }
.hp-sug .g-dir { color: var(--dim); }
.hp-sug > span:nth-child(2) { flex: 1; }
.hp-sug-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--gray-tint); color: var(--muted); }
.hp-msg { display: flex; gap: 8px; align-items: flex-start; }
.hp-msg.me { justify-content: flex-end; }
.hp-bubble { max-width: 85%; padding: 9px 12px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--line); line-height: 1.7; overflow-wrap: anywhere; }
.hp-bubble p { margin: 0; }
.hp-bubble p + p { margin-top: 6px; }
.hp-msg.me .hp-bubble { background: var(--primary); border-color: var(--primary); color: #fff; }
.hp-msg.err .hp-bubble { background: var(--red-tint); border-color: transparent; color: var(--red); }
.hp-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
[dir="rtl"] .hp-links .btn .icon svg { transform: scaleX(-1); }
.hp-typing { display: flex; gap: 4px; padding: 13px 14px; }
.hp-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); animation: hp-dot 1s infinite ease-in-out; }
.hp-typing i:nth-child(2) { animation-delay: .15s; }
.hp-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes hp-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.hp-input { display: flex; align-items: flex-end; gap: 8px; margin: 0 16px; padding: 8px; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--input); }
.hp-input:focus-within { border-color: var(--primary); }
.hp-input textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; font: inherit; color: var(--fg); padding: 4px 6px; max-height: 140px; box-shadow: none; }
.hp-send { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--primary); color: #fff; cursor: pointer; }
.hp-send:disabled { opacity: .5; cursor: default; }
[dir="rtl"] .hp-send svg { transform: scaleX(-1); }
.hp-note { margin: 6px 16px 12px; font-size: 11.5px; text-align: center; }
.hp-open-btn { border-color: var(--tint-2); color: var(--primary); }
@media (max-width: 700px) { .hp-open-label { display: none; } }
