/* CURE WA Hub — dark dashboard language (design-inspiration notes.md) */
:root {
  --bg: #0B0F1A;
  --surface: #1A1F2E;
  --surface-2: #222941;
  --sidebar: #0F1117;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #E7ECF5;
  --text-2: #94A3B8;
  --muted: #64748B;
  --accent: #2DD4BF;
  --accent-strong: #14B8A6;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --chart-teal: #0D9488;
  --chart-blue: #3B82F6;
  --blue: #3B82F6;
  --green: #22C55E;
  --green-soft: rgba(34, 197, 94, 0.14);
  --red: #EF4444;
  --red-soft: rgba(239, 68, 68, 0.14);
  --amber: #F59E0B;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --r: 14px;
  --r-sm: 9px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --glass: rgba(22, 28, 42, 0.72);
  --glass-brd: rgba(255, 255, 255, 0.11);
  --glass-blur: blur(26px) saturate(1.8);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  --glass-grad: linear-gradient(180deg, rgba(26, 32, 45, 0.86), rgba(14, 18, 27, 0.84));
  --ease: cubic-bezier(.2, .7, .3, 1);
  --spring: cubic-bezier(.34, 1.25, .5, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
::selection { background: rgba(45, 212, 191, 0.28); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea {
  font: inherit; color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  outline: none;
  width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); }
label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin: 12px 0 5px; }
a { color: var(--accent); text-decoration: none; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 9px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: 13.5px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  transition: filter .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(.98); }
.btn svg, .btn-icon svg { width: 18px; height: 18px; flex: 0 0 auto; }
.btn-sm svg { width: 14px; height: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, #5EEAD4 0%, #2DD4BF 48%, #0F9D8F 100%);
  border-color: transparent; color: #052e2b;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-danger { background: var(--red-soft); border-color: transparent; color: #FCA5A5; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { padding: 8px; border-radius: 10px; }

/* ── badges / pills ──────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2);
}
.pill.ok    { background: var(--green-soft); color: #4ADE80; }
.pill.warn  { background: var(--amber-soft); color: #FCD34D; }
.pill.bad   { background: var(--red-soft);   color: #FCA5A5; }
.pill.info  { background: rgba(59,130,246,.14); color: #93C5FD; }
.pill.teal  { background: var(--accent-soft); color: var(--accent); }

/* ── login ───────────────────────────────────────── */
.login-wrap {
  height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(600px 400px at 15% 10%, rgba(45,212,191,.09), transparent 60%),
    radial-gradient(700px 500px at 90% 90%, rgba(59,130,246,.08), transparent 60%),
    var(--bg);
}
.login-card {
  width: min(380px, 92vw); background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px; padding: 34px 30px;
  box-shadow: var(--shadow);
}
.login-card h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.login-card .sub { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.login-logo {
  width: 46px; height: 46px; border-radius: 14px; margin-bottom: 18px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 22px;
}
.login-err { color: #FCA5A5; font-size: 12.5px; min-height: 18px; margin-top: 10px; }

/* ── app shell ───────────────────────────────────── */
.shell { display: flex; height: 100vh; height: 100dvh; }
.sidebar {
  width: 228px; flex: 0 0 228px;
  background: linear-gradient(180deg, rgba(16, 21, 30, 0.72), rgba(9, 12, 18, 0.66));
  backdrop-filter: blur(26px) saturate(1.8); -webkit-backdrop-filter: blur(26px) saturate(1.8);
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04), 1px 0 30px rgba(0, 0, 0, 0.35);
  display: flex; flex-direction: column; padding: 18px 12px; position: relative;
  transition: width .3s cubic-bezier(.4, 0, .2, 1), flex-basis .3s cubic-bezier(.4, 0, .2, 1), padding .3s cubic-bezier(.4, 0, .2, 1);
}
.nav-item { position: relative; transition: background .2s ease, color .15s ease, border-color .2s ease, transform .18s ease, padding .3s cubic-bezier(.4,0,.2,1), border-radius .25s ease; }
/* labels fade + slide away instead of snapping */
.nav-item span, .brand-text, .sidebar-user .who {
  overflow: hidden; white-space: nowrap; max-width: 160px;
  transition: opacity .16s ease, max-width .3s cubic-bezier(.4,0,.2,1);
}
/* square menu toggle, top of the sidebar with the logo */
.collapse-toggle {
  flex: 0 0 34px; width: 34px; height: 34px; padding: 0; border-radius: 10px;
  order: 2; margin-inline-start: auto;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2);
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.collapse-toggle:hover { color: var(--accent); border-color: var(--accent); background: var(--surface); }
.shell.collapsed .collapse-toggle { order: -1; margin: 0; }
/* hamburger ↔ X morph */
.burger { position: relative; width: 18px; height: 14px; }
.burger i {
  position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px;
  background: currentColor;
  transition: transform .3s cubic-bezier(.4, 0, .2, 1), top .3s cubic-bezier(.4, 0, .2, 1), opacity .18s ease;
}
.burger i:nth-child(1) { top: 0; }
.burger i:nth-child(2) { top: 6px; }
.burger i:nth-child(3) { top: 12px; }
.shell.collapsed .burger i:nth-child(1) { top: 6px; transform: rotate(45deg); }
.shell.collapsed .burger i:nth-child(2) { opacity: 0; transform: scaleX(0); }
.shell.collapsed .burger i:nth-child(3) { top: 6px; transform: rotate(-45deg); }

/* ── collapsed rail: frosted-glass icon bubbles ── */
.shell.collapsed .sidebar { width: 78px; flex: 0 0 78px; padding: 16px 13px; }
.shell.collapsed .nav-item span,
.shell.collapsed .brand-text,
.shell.collapsed .sidebar-user .who { opacity: 0; max-width: 0; }
.shell.collapsed .brand { flex-direction: column; align-items: center; gap: 12px; padding: 2px 0 14px; }
.shell.collapsed .brand-text { display: none; }
.shell.collapsed .brand-logo { flex: 0 0 52px; width: 52px; height: 52px; padding: 9px; border-radius: 15px; }
.shell.collapsed .nav { gap: 9px; }
.shell.collapsed .nav-item {
  justify-content: center; gap: 0; padding: 12px 0; border-radius: 16px;
  background: var(--glass); border: 1px solid var(--glass-brd);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.22);
}
.shell.collapsed .nav-item svg { width: 20px; height: 20px; }
.shell.collapsed .nav-item:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); transform: translateY(-1px); }
.shell.collapsed .nav-item.active {
  background: var(--accent-soft); border-color: rgba(45, 212, 191, 0.4);
  color: var(--accent); box-shadow: 0 0 20px rgba(45, 212, 191, 0.18);
}
.shell.collapsed .nav-item .count {
  position: absolute; top: 5px; right: 12px; margin: 0; padding: 0 5px; line-height: 15px; font-size: 10px;
}
.shell.collapsed .sidebar-user { flex-direction: column; gap: 9px; align-items: center; padding: 12px 0 2px; }
.shell.collapsed .sidebar-user .who { display: none; }
.shell.collapsed .sidebar-user .avatar {
  flex: 0 0 48px; width: 48px; height: 48px; border-radius: 15px;
  display: grid; place-items: center;
  background: var(--accent-soft); border: 1px solid rgba(45, 212, 191, 0.3);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.22);
  color: var(--accent); font-size: 15px; font-weight: 800;
}
.shell.collapsed .user-actions { gap: 7px; }
.shell.collapsed #btn-lang,
.shell.collapsed #btn-logout {
  flex: 0 0 34px; width: 34px; height: 34px; padding: 0; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--glass); border: 1px solid var(--glass-brd);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.shell.collapsed #btn-lang { color: var(--accent); font-weight: 800; font-size: 13px; }
.shell.collapsed #btn-logout { color: var(--text-2); }
.shell.collapsed #btn-logout svg { width: 17px; height: 17px; }
.shell.collapsed #btn-lang:hover,
.shell.collapsed #btn-logout:hover { color: var(--accent); border-color: rgba(45, 212, 191, 0.4); background: rgba(255, 255, 255, 0.06); }
[dir="rtl"] .collapse-toggle { right: auto; left: -13px; }
[dir="rtl"] .shell.collapsed .nav-item .count { right: auto; left: 12px; }

/* hover tooltips on the collapsed rail */
.shell.collapsed .sidebar [data-tip] { position: relative; }
.shell.collapsed .sidebar [data-tip]::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 12px); top: 50%;
  transform: translateY(-50%) translateX(-6px);
  background: var(--glass); border: 1px solid var(--glass-brd);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  color: var(--text); font-size: 12.5px; font-weight: 600; white-space: nowrap;
  padding: 6px 11px; border-radius: 9px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; z-index: 40;
  transition: opacity .14s ease, transform .14s ease;
}
.shell.collapsed .sidebar [data-tip]:hover::after {
  opacity: 1; transform: translateY(-50%) translateX(0);
}
[dir="rtl"] .shell.collapsed .sidebar [data-tip]::after {
  left: auto; right: calc(100% + 12px); transform: translateY(-50%) translateX(6px);
}
[dir="rtl"] .shell.collapsed .sidebar [data-tip]:hover::after { transform: translateY(-50%) translateX(0); }
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 34px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 17px;
}
.brand b { font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.brand span { display: block; font-size: 10.5px; color: var(--muted); font-weight: 600; letter-spacing: .06em; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.user-actions { display: flex; align-items: center; gap: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9.5px 12px; border-radius: 11px; color: var(--text-2);
  font-weight: 600; font-size: 13.5px; text-align: left; width: 100%;
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; }
.nav-item { border: 1px solid transparent; }
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.04); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.20), rgba(45, 212, 191, 0.06));
  border-color: rgba(45, 212, 191, 0.28);
  color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 6px 18px rgba(45, 212, 191, 0.16);
}
.nav-item.active::before {
  content: ""; position: absolute; inset-inline-start: -12px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 3px; background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.shell.collapsed .nav-item.active::before { display: none; }
.nav-item .count {
  margin-left: auto; background: var(--accent); color: #06281f;
  font-size: 10.5px; font-weight: 800; border-radius: 999px; padding: 1px 7px;
}
.sidebar-user {
  border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px;
  display: flex; align-items: center; gap: 10px; padding-left: 6px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 32px;
  background: var(--surface-2); color: var(--accent);
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.sidebar-user .who { flex: 1; min-width: 0; }
.sidebar-user .who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .who span { font-size: 11px; color: var(--muted); text-transform: capitalize; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 24px; border-bottom: 1px solid var(--glass-brd);
  background: linear-gradient(180deg, rgba(22, 28, 40, 0.80), rgba(12, 16, 24, 0.76));
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-hi);
  position: sticky; top: 0; z-index: 4;
}
.topbar h2 { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar h2 { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.topbar .spacer { flex: 1; }
.view { flex: 1; overflow-y: auto; padding: 22px 24px; }

/* ── cards / grid ────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 20px;
}
.card h3 {
  font-size: 13.5px; font-weight: 700; color: var(--text-2); margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.card h3 svg { width: 15px; height: 15px; flex: 0 0 auto; opacity: .85; }
.grid { display: grid; gap: 16px; }
.tiles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px 18px;
  position: relative;
}
.t-spark { position: absolute; right: 16px; bottom: 18px; }
.tile .t-ico svg { width: 13px; height: 13px; }
.tile .t-label { font-size: 11.5px; font-weight: 700; color: var(--text-2); letter-spacing: .04em; text-transform: uppercase; display:flex; align-items:center; gap:8px; }
.tile .t-ico {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.22), rgba(59, 130, 246, 0.22));
  border: 1px solid rgba(45, 212, 191, 0.18);
  color: var(--accent); font-size: 13px;
}
.tile .t-value { font-size: 27px; font-weight: 800; letter-spacing: -.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.tile .t-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* gradient progress rings (percentage KPIs) */
.tile-ring { display: flex; flex-direction: column; align-items: center; text-align: center; }
.tile-ring .t-label { justify-content: flex-start; align-self: stretch; }
.ring-wrap { position: relative; width: 86px; height: 86px; margin: 8px 0 2px; }
.ring { width: 100%; height: 100%; display: block; }
.ring-center {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 17.5px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.ring-arc { animation: ring-sweep 1s cubic-bezier(.22, 1, .36, 1) .15s forwards; }
@keyframes ring-sweep { to { stroke-dashoffset: var(--ring-to); } }
@media (prefers-reduced-motion: reduce) {
  .ring-arc { animation: none; stroke-dashoffset: var(--ring-to); }
}

/* ── tables ──────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted); padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.025); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── inbox ───────────────────────────────────────── */
.inbox { display: flex; height: 100%; margin: -22px -24px; }
.chat-list {
  width: 315px; flex: 0 0 315px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; background: var(--sidebar);
}
.chat-list-head { padding: 14px 14px 10px; display: flex; gap: 8px; }
.chat-list-items { flex: 1; overflow-y: auto; }
.chat-item {
  display: flex; gap: 12px; padding: 11px 14px; cursor: pointer; width: 100%;
  text-align: left; position: relative; border-bottom: none;
}
.chat-item::after {
  content: ""; position: absolute; bottom: 0; inset-inline-start: 70px; inset-inline-end: 0;
  height: 1px; background: rgba(255, 255, 255, 0.045);
}
.chat-item .avatar { width: 44px; height: 44px; flex: 0 0 44px; font-size: 15px; }
.chat-item .ci-time.unread { color: var(--accent); font-weight: 700; }
.ci-bottom { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.ci-bottom .ci-prev { flex: 1; min-width: 0; margin-top: 0; }
.ci-meta { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.ci-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chat-item:hover { background: rgba(255,255,255,.03); }
.chat-item.active { background: var(--surface); }
.chat-item .ci-body { flex: 1; min-width: 0; }
.chat-item .ci-top { display: flex; justify-content: space-between; gap: 8px; }
.chat-item .ci-name { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .ci-time { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.chat-item .ci-prev { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat-item .ci-badges { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.unread-dot {
  background: var(--accent); color: #06281f; font-size: 10.5px; font-weight: 800;
  border-radius: 999px; padding: 0 6.5px; line-height: 17px;
}

.thread { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.thread-head {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center; gap: 10px;
  margin: 10px; padding: 10px 14px; border-radius: 14px;
  background: var(--glass-grad); border: 1px solid var(--glass-brd);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-hi), 0 6px 22px rgba(0, 0, 0, 0.28);
}
.th-back { display: none; }
.th-actions { display: flex; gap: 8px; flex-shrink: 0; }
.th-kebab { display: none; }
.th-name, .th-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-menu {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 8px; z-index: 30;
  min-width: 210px; padding: 6px;
  background: linear-gradient(180deg, rgba(30, 36, 48, 0.94), rgba(13, 16, 24, 0.96));
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 16px 44px rgba(0, 0, 0, 0.5);
  animation: rise .2s var(--ease);
}
.thread-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: start;
  padding: 11px 12px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
}
.thread-menu button:hover { background: rgba(255, 255, 255, 0.06); }
.thread-menu button svg { width: 16px; height: 16px; flex: 0 0 auto; }
.thread-menu .tm-info {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  font-size: 12px; color: var(--text-2); border-top: 1px solid var(--border); margin-top: 4px;
}
.thread-menu .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.thread-head .th-name { font-weight: 800; font-size: 14.5px; }
.thread-head .th-sub { font-size: 11.5px; color: var(--muted); }
.thread-body { position: absolute; inset: 0; overflow-y: auto; padding: 80px 24px 122px; display: flex; flex-direction: column; gap: 4px; }
.day-sep { align-self: center; margin: 12px 0 8px; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px 12px; }
.bubble {
  max-width: min(68%, 560px); padding: 8px 12px; border-radius: 14px;
  font-size: 13.5px; word-break: break-word; position: relative;
}
.bubble .b-text { white-space: pre-wrap; }
.bubble.in { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.bubble.out { align-self: flex-end; background: #134E4A; border-bottom-right-radius: 5px; }
.bubble .b-meta { display: flex; align-items: center; gap: 5px; justify-content: flex-end; margin-top: 3px; font-size: 10.5px; color: rgba(231,236,245,.55); }
.bubble .b-sender { font-size: 10.5px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.bubble.out .b-sender { color: #5EEAD4; }
.bubble img { max-width: 300px; border-radius: 9px; display: block; margin-bottom: 4px; }
.bubble .b-doc {
  display: flex; align-items: center; gap: 9px; background: rgba(0,0,0,.22);
  padding: 9px 11px; border-radius: 9px; margin-bottom: 4px; color: var(--text);
}
.bubble .b-tmpl { font-size: 10.5px; font-weight: 700; color: #99F6E4; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 3px; }
.tick-read { color: #2DD4BF; }
.tick-fail { color: #FCA5A5; }

.composer {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  margin: 10px; padding: 9px 12px 10px; border-radius: 18px;
  background: var(--glass-grad); border: 1px solid var(--glass-brd);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-hi), 0 10px 30px rgba(0, 0, 0, 0.32);
}
.composer-bar { display: flex; gap: 9px; align-items: flex-end; position: relative; }
.composer textarea { resize: none; max-height: 130px; min-height: 42px; background: rgba(255, 255, 255, 0.05); border-color: var(--glass-brd); }
.window-note {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2);
  padding: 0 2px 9px;
}
.window-note .dot { width: 7px; height: 7px; border-radius: 50%; }
.empty {
  flex: 1; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 30px;
}
.empty .big { font-size: 38px; margin-bottom: 10px; }
.empty-ico {
  width: 58px; height: 58px; border-radius: 50%; margin: 0 auto 12px;
  background: var(--surface); border: 1px solid var(--border-strong);
  display: grid; place-items: center; color: var(--muted);
}
.empty-ico svg { width: 24px; height: 24px; }

/* ── charts ──────────────────────────────────────── */
.chart-wrap { position: relative; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; display: none;
  background: #0d1220; border: 1px solid var(--border-strong); border-radius: 9px;
  padding: 7px 10px; font-size: 12px; box-shadow: var(--shadow); white-space: nowrap;
}
.chart-tip b { font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 16px; align-items: center; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; }

/* ── modal ───────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4, 7, 14, 0.72);
  display: grid; place-items: center; z-index: 50; backdrop-filter: blur(3px);
}
.modal {
  width: min(560px, 94vw); max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 18px; padding: 24px; box-shadow: var(--shadow);
}
.modal.wide { width: min(780px, 96vw); }
.modal h3 { font-size: 16px; font-weight: 800; margin-bottom: 4px; color: var(--text); }
.modal .m-sub { font-size: 12.5px; color: var(--text-2); margin-bottom: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }

/* ── toast ───────────────────────────────────────── */
#toast-root { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 9px; z-index: 100; }
.toast {
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent); border-radius: 11px;
  padding: 11px 15px; font-size: 13px; box-shadow: var(--shadow);
  max-width: 380px; animation: slide-in .18s ease-out;
}
.toast.error { border-left-color: var(--red); }
@keyframes slide-in { from { transform: translateX(20px); opacity: 0; } }

/* ── misc ────────────────────────────────────────── */
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); font-size: 12px; }
.mt { margin-top: 16px; }
.hidden { display: none !important; }
.progress { height: 7px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent-strong); border-radius: 99px; transition: width .3s; }
.switch { position: relative; width: 38px; height: 22px; flex: 0 0 38px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 99px; background: var(--surface-2);
  border: 1px solid var(--border-strong); transition: background .15s;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--text-2); transition: transform .15s, background .15s;
}
.switch input:checked + .track { background: var(--accent-strong); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(16px); background: #052e2b; }
.chip-days { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-days .chip {
  padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--surface-2); color: var(--text-2); border: 1px solid transparent;
}
.chip-days .chip.on { background: var(--accent-soft); color: var(--accent); }
.steps { display: flex; gap: 8px; margin-bottom: 18px; }
.steps .step {
  flex: 1; text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted);
  padding-bottom: 8px; border-bottom: 2px solid var(--surface-2);
}
.steps .step.on { color: var(--accent); border-color: var(--accent); }
.file-drop {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r);
  padding: 22px; text-align: center; color: var(--text-2); font-size: 13px; cursor: pointer;
}
.file-drop:hover { border-color: var(--accent); color: var(--text); }
.file-drop .fd-ico svg { width: 22px; height: 22px; display: block; margin: 0 auto 6px; color: var(--text-2); }
.kbd { background: var(--surface-2); border-radius: 5px; padding: 1px 6px; font-size: 11px; font-family: Consolas, monospace; }

/* ── language switch + RTL ────────────────────────── */
.lang-switch {
  display: block; margin: 14px auto 0; color: var(--text-2); font-size: 13px; font-weight: 600;
}
.lang-switch:hover { color: var(--accent); }
#btn-lang { font-weight: 800; font-size: 13px; }

[dir="rtl"] body, [dir="rtl"] { font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", Arial, sans-serif; }
[dir="rtl"] .nav-item .count { margin-left: 0; margin-right: auto; }
[dir="rtl"] .chat-item .ci-time,
[dir="rtl"] .bubble .b-meta { direction: ltr; }
[dir="rtl"] .bubble.out { align-self: flex-end; }
[dir="rtl"] .bubble.in { align-self: flex-start; }
[dir="rtl"] .t-spark { right: auto; left: 16px; }
[dir="rtl"] .toast { border-left: none; border-right: 3px solid var(--accent); }
[dir="rtl"] .toast.error { border-right-color: var(--red); }
[dir="rtl"] #toast-root { right: auto; left: 22px; }
[dir="rtl"] .th-back svg,
[dir="rtl"] .btn-back svg { transform: scaleX(-1); }
[dir="rtl"] input, [dir="rtl"] textarea { text-align: right; }
[dir="rtl"] .float-field .input { padding: 0 var(--ff-pad-left) 0 12px; }
[dir="rtl"] .float-field .icon { left: auto; right: 14px; }
[dir="rtl"] .float-field .label { left: auto; right: var(--ff-pad-left); transform-origin: right center; }
[dir="rtl"] .float-field .input:focus ~ .label,
[dir="rtl"] .float-field .input:not(:placeholder-shown) ~ .label {
  transform: translate(calc(var(--ff-pad-left) - 12px), calc(-0.5 * var(--ff-height) - 23px)) scale(0.8);
}

/* (tablet + mobile layout rules live at the end of this file) */

/* ── brand / logo ─────────────────────────────────── */
.brand-logo img, .login-icon { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-text { min-width: 0; text-align: center; }
.brand-text b { display: block; font-size: 18px; font-weight: 800; letter-spacing: .02em; line-height: 1.1; }
.brand-text span { display: block; font-size: 10.5px; color: var(--muted); font-weight: 600; letter-spacing: .06em; }
.brand-logo {
  flex: 0 0 38px; width: 38px; height: 38px; padding: 7px;
  background: #10151f;
  border: 1px solid rgba(45, 212, 191, 0.3);
  border-radius: 11px;
  box-shadow: 0 0 16px rgba(45, 212, 191, 0.14);
}
.login-brand { width: 200px; max-width: 70%; margin: 0 auto 14px; display: block; }

/* ── Floating Label Field kit (verbatim component) ── */
.float-field {
  --ff-height: 54px;
  --ff-font: 16px;
  --ff-pad-left: 16px;
  --ff-bg: #00000f;
  --ff-text: #fff;
  --ff-border: #2a2a3a;
  --ff-accent: #8a2be2;
  --ff-glow: rgba(138, 43, 226, .55);
  --ff-label: #6b6b80;
  --ff-label-active: #b18cff;
  --ff-radius: 8px;
  --ff-speed: .3s;

  position: relative;
}
.float-field.has-icon { --ff-pad-left: 42px; }

.float-field .input {
  width: 100%;
  height: var(--ff-height);
  padding: 0 12px 0 var(--ff-pad-left);
  font-size: var(--ff-font);
  color: var(--ff-text);
  background: var(--ff-bg);
  border: 2px solid var(--ff-border);
  border-radius: var(--ff-radius);
  outline: none;
  box-sizing: border-box;
  transition: border-color var(--ff-speed) ease-out,
              box-shadow var(--ff-speed) ease-out;
}

.float-field .label {
  position: absolute;
  left: var(--ff-pad-left);
  top: 50%;
  transform: translateY(-50%);
  transform-origin: left center;
  font-size: var(--ff-font);
  color: var(--ff-label);
  pointer-events: none;
  will-change: transform;
  transition: transform var(--ff-speed) ease-out,
              color var(--ff-speed) ease-out;
  margin: 0;
  font-weight: 500;
}

.float-field .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--ff-label-active);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ff-speed) ease-out;
}

.float-field .input:focus {
  border-color: var(--ff-accent);
  box-shadow: 0 0 18px 2px var(--ff-glow);
}

/* THE TRANSFORMATION — floats when focused OR filled */
.float-field .input:focus ~ .label,
.float-field .input:not(:placeholder-shown) ~ .label {
  transform: translate(calc(12px - var(--ff-pad-left)),
                       calc(-0.5 * var(--ff-height) - 23px))
             scale(0.8);
  color: var(--ff-label-active);
}

.float-field .input:focus ~ .icon,
.float-field .input:not(:placeholder-shown) ~ .icon {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .float-field * { transition: none !important; }
}

/* CURE theme for the kit — tokens only, per kit rules */
.ff-cure {
  --ff-height: 46px;
  --ff-font: 13.5px;
  --ff-radius: 10px;
  --ff-bg: var(--bg);
  --ff-text: var(--text);
  --ff-border: var(--border-strong);
  --ff-accent: var(--accent-strong);
  --ff-glow: rgba(45, 212, 191, .25);
  --ff-label: var(--muted);
  --ff-label-active: #5EEAD4;
  margin-top: 30px;
}
.ff-cure .input:disabled { opacity: .6; }

/* ── emoji picker ─────────────────────────────────── */
.emoji-panel {
  position: absolute; bottom: 54px; right: 0; width: min(330px, 82vw); height: 270px;
  background: linear-gradient(180deg, rgba(30, 36, 48, 0.88), rgba(13, 16, 24, 0.94));
  backdrop-filter: blur(30px) saturate(2); -webkit-backdrop-filter: blur(30px) saturate(2);
  border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 12px 40px rgba(0, 0, 0, 0.5);
  z-index: 20; display: flex; flex-direction: column; overflow: hidden;
  animation: rise .26s var(--ease);
}
.emoji-tabs { display: flex; gap: 3px; padding: 8px 8px 6px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.emoji-tabs button { padding: 5px 10px; border-radius: 9px; font-size: 17px; line-height: 1; border: 1px solid transparent; transition: background .15s ease; }
.emoji-tabs button.on {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05));
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.emoji-grid { flex: 1; overflow-y: auto; padding: 8px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.emoji-grid button { font-size: 23px; padding: 6px 0; border-radius: 8px; line-height: 1; transition: transform .16s var(--spring); }
.emoji-grid button:hover { transform: scale(1.3); }
.emoji-grid button:active { transform: scale(1.05); }

/* quick replies panel */
.qr-panel { width: min(340px, 82vw); height: auto; max-height: 300px; padding: 6px; }
.qr-list { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.qr-item {
  display: block; text-align: start; padding: 8px 10px; border-radius: 9px; width: 100%;
}
.qr-item:hover { background: var(--surface); }
.qr-item b { display: block; font-size: 13px; color: var(--accent); }
.qr-item span { display: block; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qr-empty { padding: 18px 14px; text-align: center; font-size: 13px; }

/* ── mobile / responsive inbox ────────────────────── */
/* (mobile rules live at the end of this file) */

/* ═══ Liquid glass refactor (kit) — motion, ambient, reactions, mobile ═══ */

/* motion language */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.card, .tile { animation: rise .45s var(--ease) both; }

/* ambient drifting orbs behind everything */
.orbs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
#app { position: relative; z-index: 1; }
.orbs i { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .35; animation: drift 32s ease-in-out infinite alternate; }
.orbs i:nth-child(1) { width: 55vw; height: 55vw; left: -18vw; top: -22vw; background: radial-gradient(circle, rgba(45,212,191,0.20), transparent 62%); }
.orbs i:nth-child(2) { width: 48vw; height: 48vw; right: -16vw; bottom: -18vw; background: radial-gradient(circle, rgba(59,130,246,0.16), transparent 62%); animation-duration: 40s; animation-delay: -12s; }
.orbs i:nth-child(3) { width: 30vw; height: 30vw; left: 42vw; top: 52vh; background: radial-gradient(circle, rgba(139,92,246,0.10), transparent 60%); animation-duration: 26s; animation-delay: -6s; }
@keyframes drift { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(6vw,-4vh,0) scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .orbs i { animation: none; } .card, .tile { animation: none; } }

/* reactions attached to bubbles (WhatsApp style) */
.bubble.has-reaction { margin-bottom: 16px; }
.bubble .b-reaction {
  position: absolute; bottom: -13px; inset-inline-start: 10px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 1.5px 7px; font-size: 13.5px; line-height: 1.4;
  box-shadow: 0 3px 10px rgba(0,0,0,.4);
  animation: pop .3s var(--spring);
}
.bubble.out .b-reaction { inset-inline-start: auto; inset-inline-end: 10px; }

/* emoji-only messages render big without a bubble */
.bubble.emoji-big { background: transparent !important; border: none !important; padding: 0 2px; }
.bubble.emoji-big .b-text { font-size: 44px; line-height: 1.15; display: block; }
.bubble.emoji-big .b-meta { color: var(--muted); }

/* stickers: no bubble chrome, larger art */
.bubble.bubble-sticker { background: transparent !important; border: none !important; padding: 2px; }
.bubble .b-sticker { width: 132px; height: auto; border-radius: 8px; display: block; margin-bottom: 2px; }

/* ── floating mobile bottom pill (glass, sliding bubble) ── */
.mpill-wrap {
  position: fixed; left: 12px; right: 12px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 45; display: none; justify-content: center; pointer-events: none;
}
.mpill {
  pointer-events: auto; position: relative; height: 58px; border-radius: 29px;
  width: 100%; max-width: 460px; overflow: hidden; direction: ltr;
  touch-action: none; user-select: none; -webkit-user-select: none;
  background: linear-gradient(180deg, rgba(30,36,44,0.66), rgba(14,17,22,0.64));
  backdrop-filter: blur(30px) saturate(2); -webkit-backdrop-filter: blur(30px) saturate(2);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), inset 0 -1px 0 rgba(255,255,255,0.04), 0 12px 40px rgba(0,0,0,0.5);
}
.mpill-bubble {
  position: absolute; top: 6px; bottom: 6px; left: 6px; width: 60px;
  border-radius: 23px; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.05));
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 4px 16px rgba(0,0,0,0.3);
  transition: left .38s var(--spring), opacity .2s ease;
}
.mpill-slots { position: absolute; inset: 6px; display: flex; z-index: 2; }
.mpill-slot { flex: 1; display: flex; align-items: center; justify-content: center; min-width: 0; color: rgba(231,236,245,0.35); transition: color .2s ease; }
.mpill-slot svg { width: 22px; height: 22px; }
.mpill-slot.lit { color: var(--accent); }

/* "More" bottom sheet */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(4,7,14,0.6); backdrop-filter: blur(3px);
  z-index: 60; display: flex; align-items: flex-end; justify-content: center;
}
.more-sheet {
  width: 100%; max-width: 480px; margin: 0 10px calc(86px + env(safe-area-inset-bottom));
  padding: 8px; border-radius: 22px;
  background: linear-gradient(180deg, rgba(30,36,48,0.92), rgba(13,16,24,0.95));
  backdrop-filter: blur(30px) saturate(2); -webkit-backdrop-filter: blur(30px) saturate(2);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.16), 0 18px 50px rgba(0,0,0,0.55);
  animation: rise .28s var(--ease);
}
.sheet-grab { width: 38px; height: 4px; border-radius: 4px; background: rgba(255,255,255,0.18); margin: 4px auto 10px; }
.sheet-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; border-radius: 13px; font-size: 14.5px; font-weight: 600; color: var(--text-2); }
.sheet-item svg { width: 20px; height: 20px; flex: 0 0 auto; }
.sheet-item:hover, .sheet-item.on { background: rgba(45,212,191,0.10); color: var(--accent); }

/* ── tablet: forced glass rail + two-pane inbox ── */
@media (max-width: 1023px) {
  .collapse-toggle { display: none; }
  .nav { overflow-y: auto; overflow-x: hidden; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .chat-list { width: 250px; flex: 0 0 250px; }
}

/* ── mobile <768px: native-WhatsApp screen stack ── */
@media (max-width: 767px) {
  .sidebar { display: none; }
  .mpill-wrap { display: flex; }
  body.mchat .mpill-wrap { display: none; }
  body.mchat .topbar { display: none; }

  .topbar { padding: 12px 16px; }
  .topbar h2 { font-size: 17px; }
  .view { padding: 14px 12px calc(96px + env(safe-area-inset-bottom)); }

  /* inbox: full-width list, chat pushes over as its own screen */
  .view-inbox { padding: 0; position: relative; }
  .inbox { position: absolute; inset: 0; margin: 0; }
  .chat-list { width: 100%; flex: 0 0 100%; border-right: none; }
  .chat-list-items { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .chat-item { padding: 12px 16px; }
  .chat-item .avatar { width: 50px; height: 50px; flex: 0 0 50px; font-size: 16px; }
  .chat-item::after { inset-inline-start: 78px; }

  .thread {
    position: absolute; inset: 0; z-index: 8; background: var(--bg);
    transform: translateX(100%); transition: transform .25s ease-out;
  }
  [dir="rtl"] .thread { transform: translateX(-100%); }
  .inbox.chat-open .thread { transform: translateX(0); }
  .th-back { display: inline-flex !important; }

  /* compact 56px chat header */
  .thread-head { margin: 6px; padding: 6px 8px; gap: 8px; border-radius: 14px; }
  .thread-head .avatar { width: 36px; height: 36px; flex: 0 0 36px; font-size: 13px; }
  .th-name { font-size: 14.5px; }
  .th-sub { font-size: 11px; }
  .th-actions { display: none; }
  .th-kebab { display: inline-flex; }

  .thread-body { padding: 66px 10px 132px; }
  .bubble { max-width: 78%; }

  .composer {
    margin: 8px; bottom: var(--kb, 0px);
    padding-bottom: calc(9px + env(safe-area-inset-bottom));
  }
  .composer .btn-icon { width: 36px; height: 36px; padding: 7px; }
  .composer-bar { gap: 6px; }

  .tiles { grid-template-columns: 1fr 1fr; }
  .card { overflow-x: auto; }
  .modal { border-radius: 16px; padding: 20px; }
}
