/* =====================================================================
   Omnichannel Support - design system
   Clean enterprise SaaS (slate-50 canvas, white cards, rounded-lg/xl),
   aligned with the Loyalty App. Logical properties only (inline-start/end)
   so RTL (he/ar) and LTR (en) render from the same rules.
   ===================================================================== */
:root {
  color-scheme: light;
  --bg: #f8fafc;            /* slate-50 */
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;     /* slate-100 */
  --border: #f1f5f9;        /* card border: gray-100 */
  --border-strong: #e2e8f0; /* inputs, dividers: slate-200 */
  --text: #0f172a;          /* slate-900 */
  --text-2: #475569;        /* slate-600 */
  --muted: #94a3b8;         /* slate-400 */
  --primary: #2563eb;       /* blue-600 */
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;  /* blue-50 */
  --primary-ink: #ffffff;
  --success: #16a34a;  --success-soft: #f0fdf4;  --success-ink: #166534;
  --warning: #d97706;  --warning-soft: #fffbeb;  --warning-ink: #92400e;
  --danger: #dc2626;   --danger-soft: #fef2f2;   --danger-ink: #991b1b;
  --note-bg: #fefce8;  --note-border: #fde68a;   --note-ink: #713f12;   /* light yellow internal notes */
  --ch-whatsapp: #16a34a; --ch-web: #2563eb; --ch-email: #7c3aed; --ch-phone: #0891b2;
  --bubble-in: #ffffff; --bubble-out: #eff6ff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, .08);
  --radius-lg: 8px;
  --radius-xl: 12px;
  --sidebar-w: 248px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Rubik", "Heebo", "Noto Sans Hebrew", "Noto Sans Arabic", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1120; --surface: #111827; --surface-2: #0f172a; --surface-3: #1e293b;
    --border: #1e293b; --border-strong: #334155;
    --text: #f1f5f9; --text-2: #cbd5e1; --muted: #64748b;
    --primary: #3b82f6; --primary-hover: #60a5fa; --primary-soft: #172554;
    --success-soft: #052e16; --success-ink: #86efac; --warning-soft: #422006; --warning-ink: #fcd34d;
    --danger-soft: #450a0a; --danger-ink: #fca5a5;
    --note-bg: #3f3a0f; --note-border: #a16207; --note-ink: #fef08a;
    --bubble-in: #1e293b; --bubble-out: #172554;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 4px 16px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120; --surface: #111827; --surface-2: #0f172a; --surface-3: #1e293b;
  --border: #1e293b; --border-strong: #334155;
  --text: #f1f5f9; --text-2: #cbd5e1; --muted: #64748b;
  --primary: #3b82f6; --primary-hover: #60a5fa; --primary-soft: #172554;
  --success-soft: #052e16; --success-ink: #86efac; --warning-soft: #422006; --warning-ink: #fcd34d;
  --danger-soft: #450a0a; --danger-ink: #fca5a5;
  --note-bg: #3f3a0f; --note-border: #a16207; --note-ink: #fef08a;
  --bubble-in: #1e293b; --bubble-out: #172554;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 4px 16px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  cursor: pointer; white-space: nowrap; font-weight: 500; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: var(--success); filter: brightness(1.08); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(1.08); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-sm .icon { width: 16px; height: 16px; }

.input, select.input, textarea.input {
  width: 100%; min-height: 36px; padding: 7px 11px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); background: var(--surface); transition: border-color .12s, box-shadow .12s;
}
textarea.input { resize: vertical; min-height: 80px; }
.input:focus, .btn:focus-visible, .chip:focus-visible, .nav a:focus-visible {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}
label.field { display: grid; gap: 4px; }
label.field > span { font-size: 12px; font-weight: 500; color: var(--text-2); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; align-items: end; }
.form-grid .span-all { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }

/* toggle switch */
.switch { position: relative; display: inline-flex; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background .15s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(16px); }
[dir="rtl"] .switch input:checked + i::after { transform: translateX(-16px); }

/* ---------- badges & chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-success { background: var(--success-soft); color: var(--success-ink); }
.badge-warning { background: var(--warning-soft); color: var(--warning-ink); }
.badge-danger { background: var(--danger-soft); color: var(--danger-ink); }
.badge-note { background: var(--note-bg); color: var(--note-ink); }
.ch { color: #fff; }
.ch-WHATSAPP { background: var(--ch-whatsapp); } .ch-WEB { background: var(--ch-web); }
.ch-EMAIL { background: var(--ch-email); } .ch-PHONE { background: var(--ch-phone); } .ch-SMS { background: var(--ch-phone); }
.chip { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: 3px 12px; cursor: pointer; white-space: nowrap; font-size: 13px; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; background: var(--muted); }
.dot-ONLINE, .dot-IDLE { background: var(--success); }
.dot-BUSY, .dot-IN_CALL { background: var(--danger); }
.dot-AWAY, .dot-ON_HOLD, .dot-RINGING { background: var(--warning); }
.dot-DND { background: #7c3aed; }
.dot-OFFLINE, .dot-UNAVAILABLE { background: var(--muted); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-sm); }
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 15px; font-weight: 600; }
.card-head .grow { flex: 1; }
.card-body { padding: 16px; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }

/* =====================================================================
   App shell: fixed sidebar + content
   ===================================================================== */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-inline-end: 1px solid var(--border-strong); z-index: 40;
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 700; font-size: 16px; }
.sb-logo { width: 32px; height: 32px; border-radius: 10px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; }
.sb-logo .icon { width: 18px; height: 18px; }
.nav { display: grid; gap: 2px; padding: 6px 10px; overflow-y: auto; flex: 1; align-content: start; }
.nav .nav-label { font-size: 11px; font-weight: 600; color: var(--muted); padding: 14px 10px 6px; letter-spacing: .02em; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-lg); color: var(--text-2); font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav a .count { margin-inline-start: auto; font-size: 11px; background: var(--danger); color: #fff; border-radius: 999px; padding: 0 6px; min-width: 18px; text-align: center; }
.sb-footer { border-top: 1px solid var(--border-strong); padding: 12px; display: grid; gap: 10px; }
.sb-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; position: relative; font-size: 13px; }
.avatar .dot { position: absolute; bottom: -1px; inset-inline-end: -1px; width: 11px; height: 11px; border: 2px solid var(--surface); }
.sb-user .who { min-width: 0; flex: 1; }
.sb-user .who b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user .who span { font-size: 12px; color: var(--muted); }
.sb-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sb-controls select { min-height: 32px; padding: 4px 8px; font-size: 13px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.page-head { display: flex; align-items: center; gap: 12px; padding: 20px 24px 0; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 700; }
.page-head .sub { color: var(--text-2); font-size: 13px; }
.page-head .grow { flex: 1; }
.page { padding: 20px 24px 40px; display: grid; gap: 16px; max-width: 1440px; width: 100%; }
.mobile-bar { display: none; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--success-ink); background: var(--success-soft); padding: 2px 10px; border-radius: 999px; }
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: pulse 1.6s infinite; }
.live-pill.off { color: var(--danger-ink); background: var(--danger-soft); }
.live-pill.off i { background: var(--danger); animation: none; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .live-pill i { animation: none; } }

/* ---------- toast, modal, lightbox ---------- */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); padding: 10px 18px; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); z-index: 1000; max-width: calc(100% - 32px); }
#toast.error { background: var(--danger); color: #fff; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 900; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; }
.modal.wide { max-width: 760px; }
.modal .card-body { display: grid; gap: 12px; }
.modal-actions { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); justify-content: flex-end; }
.lightbox { position: fixed; inset: 0; z-index: 950; background: rgba(2, 6, 23, .9); display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; padding: 16px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 110px); border-radius: var(--radius-lg); }
.lightbox .lb-bar { display: flex; gap: 8px; align-items: center; color: #fff; }
.lightbox .btn { background: rgba(255, 255, 255, .12); border-color: transparent; color: #fff; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: start; font-weight: 600; color: var(--text-2); font-size: 12px; padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data td.num, table.data th.num { text-align: end; font-variant-numeric: tabular-nums; }
table.data tr.alert td { background: var(--danger-soft); }
table.data tr.clickable { cursor: pointer; }

/* ---------- KPI tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { padding: 14px 16px; display: grid; gap: 2px; }
.tile .t-label { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.tile .t-value { font-size: 28px; font-weight: 600; line-height: 1.2; }
.tile .t-sub { font-size: 12px; color: var(--muted); }
.tile.alert { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.tile.alert .t-value, .tile.alert .t-label { color: var(--danger-ink); }
.tile.hero .t-value { font-size: 48px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* meters: fill = severity, track = lighter step of the same hue */
.meter { position: relative; height: 6px; border-radius: 3px; min-width: 80px; overflow: hidden; }
.meter > i { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 3px; }
.meter.m-ok { background: var(--success-soft); } .meter.m-ok > i { background: var(--success); }
.meter.m-warn { background: var(--warning-soft); } .meter.m-warn > i { background: var(--warning); }
.meter.m-breach { background: var(--danger-soft); } .meter.m-breach > i { background: var(--danger); }
.sla-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.sla-ok { background: var(--success-soft); color: var(--success-ink); }
.sla-warn { background: var(--warning-soft); color: var(--warning-ink); }
.sla-breach { background: var(--danger-soft); color: var(--danger-ink); }

/* horizontal bars (single series, values always labelled) */
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(60px, 120px) 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.bar-track { height: 12px; background: var(--surface-3); border-radius: 4px; overflow: hidden; display: flex; }
.bar-track > i { display: block; height: 100%; background: var(--primary); border-radius: 4px; min-width: 2px; }
.bar-track > i + i { margin-inline-start: 2px; }
.bar-track > i.b-danger { background: var(--danger); }
.bar-row .v { text-align: end; font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--primary); }
.legend i.b-danger { background: var(--danger); }

/* presence grid */
.presence { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.p-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-xl); background: var(--surface); }
.p-card .who { min-width: 0; flex: 1; }
.p-card .who b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-card .who span { font-size: 12px; color: var(--muted); }
.p-card .load { font-size: 11px; color: var(--muted); text-align: center; }
.p-card .load b { display: block; font-size: 16px; color: var(--text); }
.p-card.s-IN_CALL, .p-card.s-BUSY { border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.p-card.s-IDLE, .p-card.s-ONLINE { border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.p-card.s-RINGING { border-color: var(--warning); }
.ext-num { font-weight: 700; font-size: 18px; min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; }
.summary-line { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.summary-line span { display: inline-flex; align-items: center; gap: 6px; }

/* =====================================================================
   Tickets workspace
   ===================================================================== */
.workspace { flex: none; height: 100vh; display: grid; grid-template-columns: 340px minmax(0, 1fr) 340px; grid-template-rows: minmax(0, 1fr); }
.ws-list { border-inline-end: 1px solid var(--border-strong); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.ws-list-head { padding: 14px; border-bottom: 1px solid var(--border-strong); display: grid; gap: 10px; }
.views { display: flex; gap: 4px; flex-wrap: wrap; }
.views button { border: 0; background: transparent; padding: 4px 10px; border-radius: 999px; cursor: pointer; color: var(--text-2); font-size: 13px; }
.views button.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.views .count { font-size: 11px; margin-inline-start: 4px; color: var(--muted); }
.ticket-list { flex: 1; overflow: auto; }
.t-item { display: block; width: 100%; text-align: start; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--border); background: transparent; cursor: pointer; }
.t-item:hover { background: var(--surface-2); }
.t-item.active { background: var(--primary-soft); }
.t-item .r1 { display: flex; align-items: center; gap: 6px; }
.t-item .name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-item .time { font-size: 12px; color: var(--muted); }
.t-item .preview { color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 2px 0 6px; }
.t-item .r3 { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.t-item.unanswered .name::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); margin-inline-start: 6px; vertical-align: middle; }

.ws-chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
#chat-view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-head select.input { width: auto; min-width: 150px; }
@media (min-width: 1281px) { #details-toggle { display: none; } }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border-strong); flex-wrap: wrap; }
.chat-head h2 { font-size: 16px; }
.chat-head .sub { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.messages { flex: 1; overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: min(76%, 640px); display: flex; flex-direction: column; gap: 3px; }
.msg .bubble { padding: 9px 13px; border-radius: var(--radius-xl); border: 1px solid var(--border-strong); white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: var(--shadow-sm); }
.msg .meta { font-size: 11px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.msg.in { align-self: flex-start; }
.msg.in .bubble { background: var(--bubble-in); border-start-start-radius: 4px; }
.msg.out { align-self: flex-end; }
.msg.out .bubble { background: var(--bubble-out); border-color: transparent; border-start-end-radius: 4px; }
.msg.out .meta { justify-content: flex-end; }
.msg .translation { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border-strong); color: var(--text-2); }
.msg .translation .tl-label { font-size: 11px; color: var(--primary); font-weight: 600; display: block; }
.msg .link-btn { border: 0; background: transparent; color: var(--primary); cursor: pointer; padding: 0; font-size: 11px; }
.msg.failed .bubble { border-color: var(--danger); }
.msg .fail { color: var(--danger); font-weight: 600; }
.msg.email .bubble { border-inline-start: 3px solid var(--ch-email); }
.msg .email-head { font-size: 12px; color: var(--text-2); border-bottom: 1px dashed var(--border-strong); padding-bottom: 4px; margin-bottom: 4px; }
.msg.note { align-self: stretch; max-width: none; }
.msg.note .bubble { background: var(--note-bg); border: 1px solid var(--note-border); border-inline-start-width: 4px; color: var(--note-ink); border-radius: var(--radius-lg); box-shadow: none; }
.msg.note .note-label { font-size: 11px; font-weight: 700; color: var(--note-ink); display: flex; align-items: center; gap: 4px; }
.msg.system { align-self: center; max-width: 92%; }
.msg.system .bubble { background: transparent; border: 0; box-shadow: none; color: var(--muted); font-size: 12px; text-align: center; padding: 2px 8px; }
.msg.system.note .bubble { background: var(--note-bg); color: var(--note-ink); border: 1px dashed var(--note-border); }
.atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.atts img { width: 140px; height: 105px; object-fit: cover; border-radius: var(--radius-lg); cursor: zoom-in; border: 1px solid var(--border-strong); background: var(--surface-3); }
.atts audio { max-width: 260px; height: 36px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--radius-lg); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: 13px; max-width: 240px; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-sep { align-self: center; font-size: 12px; color: var(--muted); background: var(--surface-3); padding: 2px 10px; border-radius: 999px; }

.quickbar { display: flex; gap: 6px; padding: 10px 14px 0; overflow-x: auto; background: var(--surface); border-top: 1px solid var(--border-strong); scrollbar-width: thin; align-items: center; }
.quickbar .qlabel { font-size: 12px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.composer { background: var(--surface); padding: 8px 14px 14px; position: relative; }
.composer .modes { display: flex; gap: 4px; margin-bottom: 8px; align-items: center; flex-wrap: wrap; }
.composer .modes button { border: 0; background: transparent; padding: 5px 12px; border-radius: var(--radius-lg); cursor: pointer; color: var(--text-2); font-weight: 600; font-size: 13px; }
.composer .modes button.active { background: var(--primary-soft); color: var(--primary); }
.composer .modes button.note-mode.active { background: var(--note-bg); color: var(--note-ink); }
.composer .modes .spacer { flex: 1; }
.composer .box { border: 1px solid var(--border-strong); border-radius: var(--radius-xl); background: var(--surface); }
.composer.is-note .box { background: var(--note-bg); border-color: var(--note-border); }
.composer textarea { width: 100%; border: 0; background: transparent; resize: none; padding: 10px 12px; min-height: 64px; max-height: 220px; outline: none; }
.composer .tools { display: flex; align-items: center; gap: 4px; padding: 4px 6px; border-top: 1px solid var(--border); }
.composer .tools .spacer { flex: 1; }
.composer .hint { font-size: 11px; color: var(--muted); }
.pending-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px 0; }
.pending-files .pf { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-3); border-radius: var(--radius-lg); padding: 3px 4px 3px 8px; font-size: 12px; max-width: 220px; }
.pending-files .pf img { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; }
.pending-files .pf button { border: 0; background: transparent; cursor: pointer; color: var(--muted); }
.slash-menu { position: absolute; bottom: calc(100% - 4px); inset-inline-start: 14px; width: min(440px, calc(100% - 28px)); max-height: 280px; overflow: auto; z-index: 20; }
.slash-menu button { display: block; width: 100%; text-align: start; padding: 8px 12px; border: 0; background: transparent; cursor: pointer; border-bottom: 1px solid var(--border); }
.slash-menu button.sel, .slash-menu button:hover { background: var(--primary-soft); }
.slash-menu b { color: var(--primary); }
.slash-menu .body { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop-overlay { position: absolute; inset: 0; border: 2px dashed var(--primary); background: color-mix(in srgb, var(--primary-soft) 88%, transparent); display: flex; align-items: center; justify-content: center; font-weight: 600; color: var(--primary); z-index: 30; border-radius: var(--radius-xl); }

.ws-details { border-inline-start: 1px solid var(--border-strong); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--border-strong); padding: 0 6px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 12px 4px; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; font-weight: 500; font-size: 13px; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-body { flex: 1; overflow: auto; padding: 16px; display: grid; gap: 16px; align-content: start; }
.section-title { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px; font-size: 13px; align-items: center; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.local-clock { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-lg); background: var(--surface-3); }
.local-clock b { font-size: 20px; font-variant-numeric: tabular-nums; }

/* sentiment gauge: angry (danger) .. calm (success), needle = score */
.sentiment { display: grid; gap: 6px; }
.sent-scale { position: relative; height: 8px; border-radius: 4px; background: linear-gradient(to right, var(--danger), var(--warning), var(--surface-3), var(--success)); }
[dir="rtl"] .sent-scale { background: linear-gradient(to left, var(--danger), var(--warning), var(--surface-3), var(--success)); }
.sent-scale .needle { position: absolute; top: -4px; width: 4px; height: 16px; border-radius: 2px; background: var(--text); transform: translateX(-50%); }
[dir="rtl"] .sent-scale .needle { transform: translateX(50%); }
.sent-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.sent-ANGRY { color: var(--danger-ink); } .sent-UPSET { color: var(--warning-ink); } .sent-CALM { color: var(--success-ink); }

.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gallery .g-item { position: relative; aspect-ratio: 1; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border-strong); background: var(--surface-3); cursor: zoom-in; padding: 0; }
.gallery .g-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery .g-item .tag { position: absolute; bottom: 4px; inset-inline-start: 4px; font-size: 10px; padding: 0 6px; border-radius: 999px; background: rgba(0, 0, 0, .6); color: #fff; }
.gallery .g-item.internal { outline: 2px solid var(--note-border); outline-offset: -2px; }
.doc-list { display: grid; gap: 6px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding-bottom: 14px; padding-inline-start: 18px; border-inline-start: 2px solid var(--border-strong); margin-inline-start: 6px; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.timeline li.current::before { background: var(--primary); }
.timeline button { border: 0; background: transparent; padding: 0; text-align: start; cursor: pointer; width: 100%; }
.timeline .tl-title { font-weight: 600; }
.timeline .tl-meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.placeholder { flex: 1; display: flex; align-items: center; justify-content: center; flex-direction: column; color: var(--muted); gap: 8px; text-align: center; padding: 24px; }
.placeholder .icon { width: 40px; height: 40px; }
.back-btn { display: none; }

/* =====================================================================
   Dialer (floating softphone controller)
   ===================================================================== */
.dialer-fab { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 60; width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--success); color: #fff; box-shadow: var(--shadow-md); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.dialer-fab .icon { width: 24px; height: 24px; }
.dialer-fab.in-call { background: var(--danger); animation: pulse 1.6s infinite; }
.dialer-fab.attention { box-shadow: 0 0 0 4px var(--warning), var(--shadow-md); }
/* Above the composer + quick-reply bar, floating over the message list instead of over controls */
body.has-composer .dialer-fab { bottom: 260px; }
body.has-composer .dialer { bottom: 324px; max-height: calc(100vh - 340px); overflow: auto; }
.dialer { position: fixed; bottom: 84px; inset-inline-end: 20px; z-index: 60; width: 300px; max-width: calc(100vw - 32px); }
.dialer .card-body { display: grid; gap: 10px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; direction: ltr; }
.keypad button { height: 44px; border-radius: var(--radius-lg); border: 1px solid var(--border-strong); background: var(--surface); font-size: 18px; font-weight: 600; cursor: pointer; }
.keypad button:hover { background: var(--surface-3); }
.call-card { padding: 12px; border-radius: var(--radius-lg); background: var(--surface-3); display: grid; gap: 4px; }
.call-card .timer { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.call-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

/* =====================================================================
   Customer widget & CSAT
   ===================================================================== */
.widget { height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; } /* dvh: the visible area on phones, without the browser bars */
.widget .messages { min-height: 0; } /* long conversations scroll inside, the composer stays on screen */
.widget-head, .widget-composer { flex-shrink: 0; }
.widget-head { background: var(--primary); color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.widget-head .title { font-weight: 700; font-size: 16px; }
.widget-head .sub { font-size: 12px; opacity: .9; }
.widget-head .grow { flex: 1; }
.widget-head select { background: rgba(255, 255, 255, .15); color: #fff; border: 0; border-radius: var(--radius-lg); padding: 4px 6px; }
.widget-head select option { color: #000; }
.widget .messages { padding: 12px; }
.widget .msg.in .bubble { background: var(--surface); }
.widget .msg.mine { align-self: flex-end; }
.widget .msg.mine .bubble { background: var(--primary); color: #fff; border-color: transparent; border-start-end-radius: 4px; border-start-start-radius: var(--radius-xl); }
.widget .msg.mine .meta { justify-content: flex-end; }
.widget .msg.theirs { align-self: flex-start; }
.widget .msg.theirs .bubble { background: var(--surface); border-start-start-radius: 4px; }
.widget-form { padding: 16px; overflow: auto; flex: 1; display: grid; gap: 12px; align-content: start; }
.widget-composer { background: var(--surface); border-top: 1px solid var(--border-strong); padding: 8px; }
.widget-composer .row { align-items: flex-end; }
.widget-composer textarea { flex: 1; min-height: 40px; max-height: 120px; resize: none; }
.rating { padding: 14px; text-align: center; background: var(--surface); border-top: 1px solid var(--border-strong); }
.rating .scale { display: flex; justify-content: center; gap: 6px; margin: 10px 0; direction: ltr; }
.rating .scale button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); font-size: 18px; cursor: pointer; }
.rating .scale button.sel { background: var(--primary); color: #fff; border-color: var(--primary); }
.center-page { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; }
.center-card { width: 100%; max-width: 420px; padding: 28px; }
.center-card h1 { font-size: 22px; margin-bottom: 4px; }
.error-text { color: var(--danger); min-height: 20px; font-size: 13px; }

/* settings */
.settings-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border-strong); }
.settings-tabs button { border: 0; background: transparent; padding: 10px 14px; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; font-weight: 500; }
.settings-tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.week-grid { display: grid; gap: 8px; }
.week-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: start; }
.week-row .slots { display: grid; gap: 6px; }
.slot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.slot input[type="time"] { width: 120px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .input { max-width: 260px; }

/* ---------- phase 3: alert colors, VIP, calendar ---------- */
table.data tr.warn td { background: var(--warning-soft); }
.tile.warn { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.tile.warn .t-value, .tile.warn .t-label { color: var(--warning-ink); }
.legend i.b-warn { background: var(--warning); }
.badge-vip { background: #fef3c7; color: #92400e; font-weight: 700; }
:root[data-theme="dark"] .badge-vip { background: #422006; color: #fcd34d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge-vip { background: #422006; color: #fcd34d; } }
.cal-layout { display: grid; grid-template-columns: minmax(200px, 240px) minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.cal-types .t-item { display: flex; align-items: center; gap: 8px; }
.color-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; display: inline-block; border: 1px solid rgba(0, 0, 0, .08); }
.cal-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--primary); color: #fff; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.cal-head b { flex: 1; text-align: center; }
.cal-head .btn { background: rgba(255, 255, 255, .15); border-color: transparent; color: #fff; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border-strong); border-top: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); overflow: hidden; }
.cal-grid .dow { padding: 8px 4px; text-align: center; font-weight: 600; font-size: 12px; background: var(--surface-2); border-bottom: 1px solid var(--border-strong); }
.cal-cell { min-height: 72px; padding: 6px 8px; border-inline-end: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; text-align: start; border-top: 0; border-inline-start: 0; }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.other { background: var(--surface-2); cursor: default; }
.cal-cell.today { background: var(--primary-soft); }
.cal-cell .num { font-size: 15px; color: var(--text-2); }
.cal-cell.weekend .num { color: var(--danger-ink); }
.cal-cell .day-tag { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-2); }
.cal-cell.override .day-tag::after { content: "●"; font-size: 8px; color: var(--primary); }
.shift-row { display: grid; grid-template-columns: minmax(0, 1.2fr) 88px 88px minmax(0, 1.2fr) auto; gap: 6px; align-items: center; }
.mode-switch { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); overflow: hidden; }
.mode-switch button { border: 0; background: var(--surface); padding: 6px 14px; cursor: pointer; }
.mode-switch button.active { background: var(--primary); color: #fff; }

/* ---------- phase 2: plan editor, codes, states ---------- */
.alert-card { background: var(--danger-soft); color: var(--danger-ink); }
.sub-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-strong); margin: -4px 0 4px; }
.sub-tabs button { border: 0; background: transparent; padding: 8px 12px; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; font-weight: 500; }
.sub-tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.grid-2 > *, .grid-3 > * { min-width: 0; }
.grid-2.detail-wide { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.plan-row { display: grid; grid-template-columns: 24px auto auto minmax(140px, 1fr) auto auto; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); }
.plan-row .pos { font-weight: 700; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.plan-row .fixed { padding: 6px 10px; border-radius: var(--radius-lg); background: var(--surface-3); color: var(--text-2); font-size: 13px; text-align: center; }
.plan-row .sec { display: inline-flex; align-items: center; gap: 4px; }
.plan-row .sec input { width: 70px; }
.plan-head { display: grid; grid-template-columns: 80px auto auto minmax(140px, 1fr) auto; gap: 8px; align-items: center; }
.plan-head audio.mini { max-width: 180px; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-row label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.toggle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.toggle-grid .p-card { align-items: flex-start; }
.toggle-grid .p-card .who span { white-space: normal; }
pre.config { direction: ltr; text-align: left; background: var(--surface-3); padding: 12px; border-radius: var(--radius-lg); overflow: auto; max-height: 60vh; font-size: 12px; white-space: pre; }
audio.mini { height: 32px; max-width: 220px; }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1280px) {
  .workspace { grid-template-columns: 300px minmax(0, 1fr); }
  .ws-details { display: none; }
  .workspace.show-details .ws-details { display: flex; position: fixed; inset-block: 0; inset-inline-end: 0; width: min(380px, 100%); z-index: 55; box-shadow: var(--shadow-md); }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(280px, 85vw); transform: translateX(-105%); transition: transform .2s; box-shadow: var(--shadow-md); }
  [dir="rtl"] .sidebar { transform: translateX(105%); }
  .shell.nav-open .sidebar { transform: none; }
  .mobile-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border-strong); position: sticky; top: 0; z-index: 30; }
  .mobile-bar b { flex: 1; }
  .page-head { padding: 16px 16px 0; }
  .page { padding: 16px 16px 32px; }
  .workspace { height: calc(100vh - 53px); grid-template-columns: minmax(0, 1fr); }
  .workspace .ws-chat { display: none; }
  .workspace.has-ticket .ws-list { display: none; }
  .workspace.has-ticket .ws-chat { display: flex; }
  .back-btn { display: inline-flex; }
  .msg { max-width: 90%; }
  .hide-sm { display: none; }
  .cal-layout { grid-template-columns: minmax(0, 1fr); }
  .shift-row { grid-template-columns: minmax(0, 1fr) 80px 80px; }
  .cal-cell { min-height: 52px; padding: 4px; }
  .plan-row { grid-template-columns: 24px auto minmax(0, 1fr) auto; }
  .plan-row .fixed, .plan-head { display: none; }
  .tile.hero .t-value { font-size: 40px; }
  .week-row { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Follow-up of abandoned calls, transfer, duplicate customers ---------- */
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.missed-calls.open { background: var(--danger-soft); border-radius: var(--radius-lg); padding: 10px; }
.dup-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--border); }
.dup-row:last-child { border-bottom: 0; }
.card-note { padding: 0 16px 8px; }
select.input.input-sm { width: auto; padding: 4px 8px; font-size: 13px; }
.page > * { min-width: 0; }   /* wide tables scroll inside .table-wrap instead of widening the page */

/* ---------- App Center (home) ---------- */
.app-center-page { display: flex; justify-content: center; }
.app-center { width: 100%; max-width: 920px; padding: 32px 24px 40px; text-align: center; }
.app-center h1 { font-size: 28px; font-weight: 700; }
.app-center .sub { color: var(--text-2); margin-top: 4px; }
.app-group { margin-top: 28px; }
.app-group-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 12px; }
.app-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px 28px; }
.app-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 170px; padding: 12px 8px; border-radius: var(--radius-xl); color: var(--text); text-decoration: none; }
.app-tile:hover { background: var(--surface-2, #f8fafc); }
.app-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.app-circle { width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--primary) 70%, #fff), var(--primary)); box-shadow: var(--shadow-md); transition: transform .15s; }
.app-tile:hover .app-circle { transform: translateY(-2px); }
.app-circle .icon { width: 44px; height: 44px; stroke-width: 1.6; }
.app-tile b { font-size: 15px; }

/* ---------- My board (custom real-time tiles) ---------- */
.board { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: 170px; gap: 12px; grid-auto-flow: dense; }
.bt { display: flex; flex-direction: column; overflow: hidden; position: relative; min-width: 0; }
.bt-head { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2, #f8fafc); min-height: 40px; }
.bt-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt-body { flex: 1; min-height: 0; container-type: size; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px 10px 10px; }
.bt-value { font-weight: 600; line-height: 1; font-size: clamp(28px, min(62cqh, 30cqw), 220px); }
.bt-sub { font-size: 13px; color: var(--muted); margin-top: 6px; text-align: center; }
.bt-list { display: block; overflow: auto; padding: 0; container-type: normal; }
.bt.alert { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.bt.alert .bt-value, .bt.alert .bt-title { color: var(--danger-ink); }
.bt.warn { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.bt.warn .bt-value, .bt.warn .bt-title { color: var(--warning-ink); }
.bt-grip { cursor: grab; color: var(--muted); display: inline-flex; }
.bt-resize { position: absolute; bottom: 2px; inset-inline-end: 2px; width: 22px; height: 22px; display: grid; place-items: center; cursor: nwse-resize; color: var(--muted); touch-action: none; }
[dir="rtl"] .bt-resize { cursor: nesw-resize; }
.bt-resize .icon { width: 14px; height: 14px; }
body.board-editing .bt { outline: 1px dashed var(--border-strong); }
.bt.dragging { opacity: .45; }
.bt.drop-target { outline: 2px solid var(--primary); }
.board-empty { grid-column: span 12; padding: 40px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
body.board-fs .sidebar, body.board-fs .mobile-bar { display: none; }
body.board-fs .shell { grid-template-columns: 1fr; }
@media (max-width: 1000px) { .board { grid-template-columns: repeat(6, minmax(0, 1fr)); } .board > .bt { grid-column: span 6 !important; } }
@media (max-width: 640px) { .board { grid-auto-rows: 140px; } }
.text-warning { color: var(--warning-ink); font-weight: 600; }
body.board-editing .bt-head { flex-wrap: wrap; }
body.board-editing .bt-head select.input-sm { order: 5; flex-basis: 100%; width: 100%; }
.bt-pad { padding: 10px 12px; }
.bt-list .presence { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }

/* ---------- WhatsApp 24h window ---------- */
.wa-window { display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin-bottom: 6px; border-radius: var(--radius-lg); font-size: 13px; background: var(--success-soft, #ecfdf5); color: var(--text-2); }
.wa-window.soon { background: var(--warning-soft); color: var(--warning-ink); }
.wa-window.closed { background: var(--warning-soft); color: var(--warning-ink); font-weight: 500; }
.wa-window .grow { flex: 1; }
.composer.wa-locked .box { opacity: .55; }
.wa-preview { white-space: pre-wrap; background: #e7ffdb; color: #111b21; border-radius: 10px; padding: 10px 12px; font-size: 14px; max-width: 420px; }

/* ---------- Board tile colors (accent on the header + top edge) ---------- */
.bt-c-blue { --bt-accent: #2563eb; } .bt-c-green { --bt-accent: #16a34a; } .bt-c-purple { --bt-accent: #7c3aed; }
.bt-c-teal { --bt-accent: #0d9488; } .bt-c-orange { --bt-accent: #ea580c; } .bt-c-pink { --bt-accent: #db2777; } .bt-c-gray { --bt-accent: #475569; }
.bt[class*="bt-c-"] { border-top: 4px solid var(--bt-accent); }
.bt[class*="bt-c-"] .bt-head { background: color-mix(in srgb, var(--bt-accent) 12%, var(--surface)); }
.bt[class*="bt-c-"] .bt-title { color: color-mix(in srgb, var(--bt-accent) 75%, var(--text)); }
.bt[class*="bt-c-"]:not(.alert):not(.warn) .bt-value { color: color-mix(in srgb, var(--bt-accent) 80%, var(--text)); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; background: var(--bt-accent, var(--surface)); font-size: 10px; color: var(--muted); }
.swatch.bt-c-none { width: auto; border-radius: 999px; padding: 0 12px; }
.swatch.active { outline: 3px solid var(--primary); outline-offset: 2px; }

/* ---------- Telephony KPI tiles: personal color + thresholds (same palette as My board) ---------- */
.tile { position: relative; }
.tile[class*="bt-c-"] { border-top: 4px solid var(--bt-accent); }
.tile[class*="bt-c-"] .t-label { color: color-mix(in srgb, var(--bt-accent) 75%, var(--text)); }
.tile[class*="bt-c-"]:not(.alert):not(.warn) .t-value { color: color-mix(in srgb, var(--bt-accent) 80%, var(--text)); }
.tile-cfg { position: absolute; top: 6px; inset-inline-end: 6px; opacity: 0; transition: opacity .15s; }
.tile:hover .tile-cfg, .tile-cfg:focus-visible { opacity: 1; }
@media (hover: none) { .tile-cfg { opacity: .6; } }
.ticket-rows td { vertical-align: middle; }
.text-danger { color: var(--danger-ink); font-weight: 600; }

/* ---------- Friendly per-channel summary cards ---------- */
.ch-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; padding: 8px; }
.ch-card { --ch: var(--ch-web); border: 1px solid var(--border); border-inline-start: 5px solid var(--ch); border-radius: var(--radius-lg); padding: 6px 10px; display: grid; gap: 2px;
  background: color-mix(in srgb, var(--ch) 6%, var(--surface)); }
.ch-card-WHATSAPP { --ch: var(--ch-whatsapp); } .ch-card-WEB { --ch: var(--ch-web); } .ch-card-EMAIL { --ch: var(--ch-email); } .ch-card-PHONE { --ch: var(--ch-phone); }
.ch-card.warn { background: var(--warning-soft); } .ch-card.alert { background: var(--danger-soft); }
.ch-card-head { display: flex; align-items: center; gap: 6px; }
.ch-card-head b { flex: 1; }
.ch-ico { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--ch); color: #fff; }
.ch-ico .icon { width: 16px; height: 16px; }
.ch-flag { color: var(--success-ink); }
.ch-card-main { display: flex; align-items: baseline; gap: 8px; }
.ch-big { font-size: 30px; font-weight: 700; line-height: 1; }
.ch-card.warn .ch-big { color: var(--warning-ink); } .ch-card.alert .ch-big { color: var(--danger-ink); }
.ch-card-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-2); }
.ch-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
