:root {
  --primary: #5e72e4;
  --primary-dark: #324cdd;
  --success: #2dce89;
  --success-dark: #24a46d;
  --warning: #fb6340;
  --danger: #f5365c;
  --info: #11cdef;
  --ink: #32325d;
  --muted: #8898aa;
  --line: #e9ecef;
  --page: #f8f9fe;
  --card: #ffffff;
  --sidebar: #ffffff;
  --shadow: 0 0 2rem 0 rgba(136, 152, 170, 0.15);
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--page); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
a { color: var(--primary); text-decoration: none; }

.guest { min-height: 100vh; display: grid; place-items: center; background:
  radial-gradient(900px 420px at 50% -10%, rgba(94, 114, 228, 0.18), transparent 60%),
  var(--page);
  padding: 32px 16px;
}
.guest-wrap { width: min(440px, 100%); }
.login-card { width: 100%; margin: 0; }
.gate-brand { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 1.4rem 1.5rem 0; }
.gate-brand img { width: 44px; height: 44px; border-radius: 12px; }
.gate-brand strong { font-size: 1.25rem; letter-spacing: -0.03em; }
.login-card .card-header { text-align: center; font-size: 1.35rem; font-weight: 700; border: 0; padding-bottom: 0; }
.login-card .card-footer { text-align: center; }
.login-card .card-footer .btn { margin-top: 4px; }
.hint { color: #adb5bd; font-size: 13px; margin: -6px 0 14px; }
.form-error { min-height: 1.2em; color: var(--danger); margin: 0 0 8px; font-size: 14px; }
.form-ok { color: var(--success); font-size: 14px; margin: 0 0 8px; }

.card {
  background: var(--card);
  border: 1px solid rgba(233, 236, 239, 0.9);
  border-radius: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.card-header h3 { margin: 0; font-size: 1rem; }
.start-list { margin: 0; padding-left: 1.2rem; line-height: 1.9; }
.card-header, .card-footer { padding: 1.25rem 1.5rem; }
.card-header { border-bottom: 1px solid var(--line); }
.card-body { padding: 1.25rem 1.5rem; }
.card-footer { border-top: 1px solid var(--line); }
.card-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
}

.input-group {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid #cad1d7;
  border-radius: 0.375rem;
  margin-bottom: 14px;
  overflow: hidden;
}
.input-icon {
  width: 46px;
  text-align: center;
  color: var(--primary);
  background: #fff;
}
input, textarea, select {
  width: 100%;
  border: 1px solid #cad1d7;
  border-radius: 0.375rem;
  padding: 0.7rem 0.85rem;
  color: var(--ink);
  background: #fff;
}
.input-group input { border: 0; }
input:focus, textarea:focus { outline: 2px solid rgba(94, 114, 228, 0.25); border-color: var(--primary); }
textarea { min-height: 110px; resize: vertical; }
label.field { display: grid; gap: 6px; margin-bottom: 14px; color: var(--muted); font-size: 14px; font-weight: 700; }

.btn {
  border: 0;
  border-radius: 0.375rem;
  padding: 0.65rem 1.1rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: 0.65; cursor: wait; }
.btn-success { background: var(--success); }
.btn-success:hover { background: var(--success-dark); }
.btn-warning { background: var(--warning); }
.btn-warning:hover { background: #fa3a0e; }
.btn-dark { background: #212529; }
.btn-dark:hover { background: #111; }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 13px; }
.btn-block { width: 100%; }
.btn-white { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.toolbar { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }

.shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  background: var(--sidebar);
  box-shadow: var(--shadow);
  overflow: auto;
  z-index: 20;
  padding: 1.2rem 0 2rem;
  transition: transform 0.2s ease;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 12px 1rem;
  padding: 0.2rem 0.4rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.03em;
}
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: calc(100% - 16px);
  margin: 2px 8px;
  text-align: left;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #525f7f;
  padding: 0.62rem 0.85rem;
  font-size: 0.92rem;
  font-weight: 600;
}
.nav-link i { width: 18px; text-align: center; color: #8898aa; }
.nav-link.active, .nav-link:hover { color: var(--primary); background: rgba(94, 114, 228, 0.08); }
.nav-link.active i, .nav-link:hover i { color: var(--primary); }
.nav-link.parent::after { content: "\f107"; font-family: "Font Awesome 6 Free"; font-weight: 900; margin-left: auto; font-size: 12px; }
.submenu { display: none; padding-left: 12px; }
.submenu.open { display: block; }
.workspace { margin-left: 250px; min-height: 100vh; }
.topbar {
  height: 64px;
  background: #fff;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar strong { letter-spacing: -0.02em; font-size: 0.95rem; }
.top-logo { display: none; height: 42px; width: 42px; object-fit: contain; }
.top-user { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.top-user button { background: #f6f9fc; border: 1px solid var(--line); color: var(--ink); font-weight: 700; border-radius: 999px; padding: 0.35rem 0.8rem; }
.menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: transparent; border: 0; color: var(--ink); font-size: 18px; }
.menu-btn:hover { background: #f4f6fb; }
@media (min-width: 901px) {
  html.nav-hidden .sidebar { transform: translateX(-100%); }
  html.nav-hidden .workspace { margin-left: 0; }
  html[dir="rtl"].nav-hidden .sidebar { transform: translateX(100%); }
  html[dir="rtl"].nav-hidden .workspace { margin-right: 0; }
}
main { padding: 1.5rem 1.5rem 3rem; }
.page-title { margin: 0 0 1.1rem; font-size: 1.65rem; font-weight: 800; color: var(--ink); letter-spacing: -0.04em; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.25rem; margin-bottom: 1.5rem; }
.stat-row { display: flex; justify-content: space-between; align-items: center; }
.h2 { font-size: 1.8rem; font-weight: 700; }
.icon-shape {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}
.bg-danger { background: var(--danger); }
.bg-primary { background: var(--primary); }
.bg-success { background: var(--success); }
.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.alert { border-radius: 0.375rem; padding: 0.9rem 1rem; margin-bottom: 1rem; color: #fff; }
.alert-danger { background: var(--danger); }
.alert a, .alert .btn-white { margin-top: 8px; }
fieldset {
  border: 1px solid #d8dee6;
  border-radius: 0.375rem;
  padding: 1rem 1.2rem 0.4rem;
  margin-bottom: 1rem;
}
legend { padding: 0 8px; font-weight: 700; color: var(--ink); }
ol { line-height: 1.8; }
.linkish { background: none; border: 0; padding: 0; color: var(--primary); font-weight: 700; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.9rem 1rem; border-top: 1px solid var(--line); vertical-align: top; font-size: 14px; }
thead th { border-top: 0; background: #f6f9fc; color: #8898aa; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.badge {
  display: inline-block;
  border-radius: 10rem;
  padding: 0.25em 0.7em;
  font-size: 12px;
  font-weight: 700;
  background: #e9ecef;
  color: var(--ink);
}
.badge-success { background: var(--success); color: #fff; }
.badge-danger { background: var(--danger); color: #fff; }
.badge-warning { background: #ffd600; color: #32325d; }
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 0; }
.tabs button {
  background: #fff;
  border: 1px solid transparent;
  border-bottom: 0;
  padding: 0.6rem 1rem;
  color: var(--primary);
  font-weight: 700;
}
.tabs button.active { border-color: var(--primary); color: var(--ink); border-radius: 0.375rem 0.375rem 0 0; }

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(50, 50, 93, 0.45);
  display: grid;
  place-items: center;
  z-index: 40;
  padding: 16px;
}
.modal { width: min(640px, 100%); background: #fff; border-radius: 16px; box-shadow: 0 24px 60px rgba(50, 50, 93, 0.18); overflow: hidden; }
.modal-header { background: #fff; color: var(--ink); padding: 1rem 1.2rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.modal-header h3 { margin: 0; font-size: 1.05rem; }
.modal-header button { background: #f6f9fc; border: 0; color: var(--ink); width: 32px; height: 32px; border-radius: 999px; font-size: 18px; }
.modal .card-body { background: #fff; }

body.in-chat main { padding: 0; }
.chat-shell { height: calc(100vh - 64px); background: #fff; }
.chat-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); height: 100%; min-height: 0; }
.chat-layout.show-profile { grid-template-columns: 340px minmax(0, 1fr) 300px; }
.chat-back { display: none; background: transparent; border: 0; color: var(--ink); font-size: 16px; }
.chat-profile { display: none; background: #fff; border-left: 1px solid var(--line); padding: 1.1rem; overflow: auto; }
.chat-layout.show-profile .chat-profile { display: block; }
.profile-head { display: flex; align-items: center; gap: 8px; }
.profile-back { display: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: #111b21; }
.chat-profile h2 { margin: 0 0 8px; font-size: 1rem; }
.tag { display: inline-block; margin: 0 4px 4px 0; background: #eef2ff; color: #324cdd; border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 700; }
.label-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; background: #11cdef; }
.label-dot.waiting { background: #fb6340; }
.label-dot.done { background: #98a2b3; }
.label-dot.order { background: #5e72e4; }
.label-dot.paid { background: #2dce89; }
.label-dot.delivery { background: #11cdef; }
.label-dot.complaint { background: #f5365c; }
.product-card { display: grid; grid-template-columns: 72px 1fr; gap: 8px; align-items: center; margin: 2px 0 6px; padding: 6px; border-radius: 12px; background: #f4f6fb; color: var(--ink); text-decoration: none; overflow: hidden; }
.product-card.no-photo { grid-template-columns: 1fr; }
.product-card img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; background: #fff; }
.product-card strong, .product-card small { display: block; }
.product-card strong { font-size: 0.86rem; }
.product-card small { color: #667085; font-size: 12px; font-weight: 500; max-height: 2.6em; overflow: hidden; }
.bubble.out .product-card { background: rgba(255,255,255,0.16); color: #fff; }
.bubble.out .product-card small { color: rgba(255,255,255,0.82); }
.bubble.later { background: #fff; color: var(--ink); border: 1px dashed #c5cef8; }
.later-panel, .link-draft { margin: 0 14px 8px; }
.later-panel { display: flex; gap: 8px; align-items: center; }
.later-panel input { margin: 0; }
.clip.recording { color: #f5365c; }
.pin-mark { color: var(--primary); margin-right: 4px; }
.team-notes { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.team-notes h3 { margin: 0; font-size: 0.95rem; }
.team-notes article { background: #f6f9fc; border-radius: 10px; padding: 8px 10px; }
.team-notes small { color: #8898aa; }
.team-notes textarea { min-height: 68px; }
.team-notes .icon-btn { background: transparent; border: 0; color: #f5365c; cursor: pointer; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input, .filters select { width: auto; }
.wait-list { display: flex; flex-direction: column; gap: 8px; }
.wait-list button { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
html[dir="rtl"] body { font-family: "Noto Naskh Arabic", "Plus Jakarta Sans", sans-serif; }
html[dir="rtl"] .sidebar { inset: 0 0 0 auto; }
html[dir="rtl"] .workspace { margin-left: 0; margin-right: 250px; }
html[dir="rtl"] .nav-link { text-align: right; }
html[dir="rtl"] .chat-profile { border-left: 0; border-right: 1px solid var(--line); }
.gate-brand + #gate-lang { margin: 12px auto 0; display: block; }
.chat-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: #fff; }
.chat-search-wrap { position: relative; margin: 14px 14px 8px; }
.chat-search-wrap i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #98a2b3; font-size: 13px; }
.chat-search { width: 100%; margin: 0; border: 0; border-radius: 999px; background: #f4f6fb; padding: 0.72rem 0.9rem 0.72rem 2.2rem; }
html[dir="rtl"] .chat-search { padding: 0.72rem 2.2rem 0.72rem 0.9rem; }
html[dir="rtl"] .chat-search-wrap i { left: auto; right: 14px; }
.chat-people { overflow: auto; min-height: 0; }
.chat-person {
  width: 100%;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #f2f4f7;
  border-radius: 0;
  background: #fff;
  padding: 12px 14px;
}
.chat-person.active { background: #f4f6ff; box-shadow: inset 3px 0 0 var(--primary); }
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; flex: none;
}
.avatar.group { background: #111827; }
.bubble .who { display: block; font-size: 12px; font-weight: 800; color: #3b4cca; margin-bottom: 2px; }
.chat-bar .avatar { width: 38px; height: 38px; }
.person-copy { min-width: 0; }
.person-top, .person-preview, .person-side { display: flex; align-items: center; }
.person-top { justify-content: space-between; gap: 8px; }
.person-top strong { font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-top time { color: #98a2b3; font-size: 11px; font-weight: 600; flex: none; }
.person-preview { display: block; color: #667085; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.person-side { flex-direction: column; align-items: flex-end; gap: 6px; }
.person-side .line-chip { margin-top: 0; }
.unread-pill { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.chat-empty { padding: 16px; }
.chat-main { display: flex; flex-direction: column; min-height: 0; background:
  radial-gradient(circle at 1px 1px, rgba(94,114,228,0.08) 1px, transparent 0) 0 0 / 18px 18px,
  #f7f8fc; }
.chat-bar {
  display: flex; align-items: center; gap: 12px;
  background: #fff; color: var(--ink);
  padding: 0.7rem 1rem; border-bottom: 1px solid var(--line);
}
.chat-who { min-width: 0; display: grid; }
.chat-who strong { font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-who small { color: #667085; font-weight: 600; font-size: 12px; }
.icon-round { margin-left: auto; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f4f6fb; color: var(--ink); }
.chat-bar select { width: auto; max-width: 140px; color: var(--ink); }
.thread { flex: 1; padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 0; }
.thread-empty { margin: auto; text-align: center; color: #98a2b3; }
.thread-empty i { font-size: 28px; display: block; margin-bottom: 8px; }
.bubble { max-width: min(72%, 460px); padding: 0.55rem 0.75rem 0.35rem; border-radius: 16px 16px 16px 6px; background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06); }
.bubble p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.bubble.out { align-self: flex-end; background: var(--primary); color: #fff; border-radius: 16px 16px 6px 16px; }
.bubble.failed { background: #fff1f3; color: var(--ink); }
.bubble small { display: flex; justify-content: flex-end; gap: 4px; align-items: center; color: #98a2b3; margin-top: 4px; font-size: 11px; }
.bubble.out small { color: rgba(255,255,255,0.78); }
.bubble small .read { color: #b9f6ca; }
.bubble.out small .read { color: #fff; }
.bubble small.bad { color: var(--danger); }
.bubble a { color: inherit; font-weight: 700; }
.composer { display: flex; gap: 8px; padding: 10px 14px 14px; background: #fff; border-top: 1px solid var(--line); align-items: flex-end; }
.composer-more, .phone-ico, .profile-actions, .profile-assign { display: none; }
.day-chip { display: none; }
.composer-pill { display: contents; }
.who-presence, .wa-chips, .new-chat, .compose-sheet, .attach-sheet, .emoji-pop, .hold-menu,
.encrypt-note, .unread-divider, .pin-row, .mute-row, .voice-hold, .pill-emoji, .pill-camera,
.preview-kind, .tick, .hold-info { display: none; }
.composer textarea {
  flex: 1; border: 0; border-radius: 22px; background: #f4f6fb;
  padding: 0.7rem 1rem; min-height: 44px; max-height: 160px;
  resize: none; overflow-y: auto; line-height: 1.45; white-space: pre-wrap;
}
.composer .btn { width: 44px; height: 44px; border-radius: 50%; padding: 0; display: grid; place-items: center; }
.composer .btn[disabled] { opacity: 0.7; }
.chat-note { margin: 0; padding: 0.45rem 0.8rem; background: #fff8e6; color: #8a6d3b; font-size: 0.85rem; }
.nav-badge { background: #2dce89; color: #fff; border-radius: 999px; padding: 0 6px; margin-left: 6px; font-size: 11px; }
.bubble.has-media { padding: 4px 4px 2px; max-width: min(78%, 340px); }
.bubble .photo { display: block; padding: 0; border: 0; background: transparent; width: 100%; cursor: zoom-in; }
.bubble img, .bubble video { display: block; width: 100%; max-height: 360px; object-fit: cover; border-radius: 12px; background: #eef1f6; }
.bubble audio { width: 230px; margin: 6px; }
.file-card { display: flex; align-items: center; gap: 8px; margin: 4px; padding: 10px 12px; border-radius: 12px; background: #f4f6fb; color: var(--ink); font-weight: 700; }
.lightbox { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(15, 18, 28, 0.88); padding: 24px; }
.lightbox.hidden { display: none; }
.lightbox img { max-width: min(1100px, 94vw); max-height: 88vh; width: auto; height: auto; object-fit: contain; border-radius: 12px; box-shadow: 0 24px 80px rgba(0,0,0,.35); }
.lightbox-close { position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #fff; color: #111; font-size: 24px; }
.notify-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 16px 0; padding: 10px 14px; border-radius: 12px; background: #eef2ff; color: var(--ink); border: 1px solid #d9e0ff; }
.notify-bar.hidden { display: none; }
.toast-stack { position: fixed; z-index: 70; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; width: min(340px, calc(100vw - 24px)); }
html[dir="rtl"] .toast-stack { right: auto; left: 18px; }
.toast { display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: center; text-align: left; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 16px; padding: 12px; box-shadow: 0 16px 40px rgba(16, 24, 40, 0.16); }
.toast strong, .toast small { display: block; }
.toast strong { font-size: 0.92rem; }
.toast small { color: #667085; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast-mark { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; }
.quote, .quote-bar { border-left: 3px solid #5e72e4; background: rgba(94,114,228,0.08); padding: 4px 8px; margin-bottom: 6px; font-size: 12px; }
.quote-bar { margin: 0 12px; display: flex; justify-content: space-between; }
.clip { width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; color: #32325d; background: transparent; }
.clip input { display: none; }
.quick-panel { background: #fff; border-top: 1px solid var(--line); padding: 10px 12px 12px; }
.quick-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.quick-head button { background: transparent; border: 0; font-size: 20px; cursor: pointer; }
.quick-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; max-height: 180px; overflow: auto; }
.quick-item { display: flex; gap: 8px; align-items: center; text-align: left; background: #f6f9fc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; width: 100%; }
.quick-item span { display: block; color: #32325d; }
.quick-item small { color: #8898aa; }
.quick-item .icon-btn { margin-left: auto; background: transparent; border: 0; color: #f5365c; cursor: pointer; }
.line-chip { display: inline-block; margin-top: 4px; background: rgba(94,114,228,.12); color: #5e72e4; border-radius: 999px; padding: 0 8px; font-size: 11px; font-weight: 700; }
.inbox-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 14px 12px; }
.inbox-tools.solo { grid-template-columns: 1fr; }
.inbox-tools select {
  width: 100%; margin: 0; border: 0; border-radius: 12px; background: #f4f6fb;
  padding: 0.48rem 0.65rem; font-size: 12.5px; font-weight: 700; color: #32325d; height: 36px;
}
.wait-clock { color: #f5365c; font-size: 11px; font-weight: 800; white-space: nowrap; }
.thread-search { position: relative; margin: 10px 14px 0; }
.thread-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #98a2b3; font-size: 13px; }
.thread-search input { width: 100%; margin: 0; border: 0; border-radius: 999px; background: #fff; padding: 0.65rem 0.9rem 0.65rem 2.2rem; }
.product-add { display: grid; gap: 8px; }
.product-add input { min-height: 0; }
.line-filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.line-filters button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 10px; cursor: pointer; color: #32325d; }
.line-filters button.active { background: #5e72e4; color: #fff; border-color: #5e72e4; }
.line-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.line-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #f8f9fe; }
.line-card img { width: 180px; height: 180px; background: #fff; }
.quick-add { display: grid; grid-template-columns: 160px 1fr auto; gap: 8px; align-items: start; }
.quick-add textarea { min-height: 58px; }
.flow-board { display: flex; flex-direction: column; align-items: center; padding: 12px 0; }
.flow-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; cursor: grab; }
.flow-arrow { width: 2px; height: 22px; background: #5e72e4; }
.two-col { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 1rem; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; }
  .sidebar.open { transform: none; }
  .workspace { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .stats, .chat-layout, .two-col, .quick-add { grid-template-columns: 1fr; }
  html[dir="rtl"] .workspace { margin-right: 0; }
  html[dir="rtl"] .sidebar.open { transform: none; }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  .chat-shell { height: calc(100vh - 64px); }
  .chat-layout, .chat-layout.show-profile { grid-template-columns: 1fr; }
  .chat-layout .chat-main, .chat-layout .chat-profile { display: none; }
  .chat-layout.show-thread .chat-side { display: none; }
  .chat-layout.show-thread .chat-main { display: flex; }
  .chat-layout.show-profile .chat-profile { display: block; }
  .chat-back { display: inline-grid; place-items: center; width: 36px; height: 36px; }
  .composer { position: sticky; bottom: 0; }
  .thread { max-height: none; }

  body.in-chat { background: #fff; }
  body.in-chat .notify-bar { margin: 0; border: 0; border-radius: 0; background: #f0f2f5; }
  body.in-chat .topbar {
    height: 56px;
    padding: 0 6px;
    border-bottom: 0;
    background: #fff;
    justify-content: flex-start;
    gap: 0;
  }
  body.in-chat .topbar strong { display: none; }
  body.in-chat .top-logo { display: block; order: 1; width: 40px; height: 40px; }
  body.in-chat .top-user { order: 2; margin-left: auto; }
  body.in-chat .menu-btn { order: 3; color: #54656f; }
  body.in-chat .menu-btn .fa-bars { display: none; }
  body.in-chat .menu-btn::after {
    content: "\f142";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 18px;
  }
  body.in-chat .top-user span,
  body.in-chat .top-user > .fa-user,
  body.in-chat #lang-toggle,
  body.in-chat #open-password { display: none; }
  body.in-chat #logout {
    background: transparent;
    border: 0;
    color: #54656f;
    padding: 0.35rem 0.45rem;
    font-size: 0;
  }
  body.in-chat #logout::before {
    content: "\f2f5";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 16px;
  }
  body.in-chat main { padding: 0; }
  body.in-chat .chat-shell { height: calc(100dvh - 56px); background: #fff; }
  body.in-chat:has(.chat-layout.show-thread) .topbar,
  body.in-chat:has(.chat-layout.show-thread) .notify-bar { display: none; }
  body.in-chat:has(.chat-layout.show-thread) .chat-shell { height: 100dvh; }

  body.in-chat .chat-search-wrap { margin: 4px 12px 8px; }
  body.in-chat .chat-search {
    background: #f0f2f5;
    border-radius: 8px;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }
  body.in-chat .inbox-tools {
    display: flex;
    gap: 8px;
    margin: 0 12px 6px;
    overflow-x: auto;
  }
  body.in-chat .inbox-tools select {
    width: auto;
    height: 32px;
    border-radius: 16px;
    border: 0;
    background: #f0f2f5;
    color: #54656f;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 600;
  }
  body.in-chat .chat-people { flex: 1; background: #fff; }
  body.in-chat .chat-side { border-right: 0; }
  body.in-chat .chat-person {
    grid-template-columns: 49px minmax(0, 1fr) auto;
    gap: 14px;
    min-height: 72px;
    padding: 8px 16px 8px 14px;
    border-bottom: 0;
    background: #fff;
    position: relative;
    align-items: center;
  }
  body.in-chat .chat-person::after {
    content: "";
    position: absolute;
    left: 73px;
    right: 0;
    bottom: 0;
    height: 1px;
    background: #e9edef;
  }
  html[dir="rtl"] body.in-chat .chat-person::after { left: 0; right: 73px; }
  body.in-chat .chat-person.active { background: #f5f6f6; box-shadow: none; }
  body.in-chat .chat-person .avatar { width: 49px; height: 49px; font-size: 16px; }
  body.in-chat .person-top strong { font-size: 17px; font-weight: 500; color: #111b21; letter-spacing: 0; }
  body.in-chat .person-top time { color: #667781; font-weight: 400; font-size: 12px; }
  body.in-chat .chat-person:has(.unread-pill) time { color: #25d366; font-weight: 600; }
  body.in-chat .person-preview { color: #667781; font-size: 14px; margin-top: 1px; }
  body.in-chat .person-side { align-self: end; margin-bottom: 10px; }
  body.in-chat .unread-pill { background: #25d366; min-width: 20px; height: 20px; font-size: 12px; }
  body.in-chat .label-dot { display: none; }
  body.in-chat .wait-clock { color: #e53935; }

  body.in-chat .chat-main {
    width: 100%;
    max-width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background-color: #efeae2;
    background-image:
      radial-gradient(circle at 12px 18px, rgba(11, 20, 26, 0.035) 1.2px, transparent 1.4px),
      radial-gradient(circle at 28px 8px, rgba(11, 20, 26, 0.03) 1px, transparent 1.3px);
    background-size: 42px 42px;
  }
  body.in-chat .chat-layout.show-thread { height: 100%; min-height: 0; overflow: hidden; }
  body.in-chat .chat-bar {
    flex-shrink: 0;
    overflow: hidden;
    background: #008069;
    color: #fff;
    min-height: 56px;
    gap: 4px;
    padding: max(6px, env(safe-area-inset-top)) 4px 6px 0;
    border-bottom: 0;
  }
  body.in-chat .bar-extra { display: none !important; }
  body.in-chat .desk-ico { display: none; }
  body.in-chat .phone-ico { display: inline; }
  body.in-chat .chat-back { color: #fff; width: 36px; height: 40px; flex: none; }
  body.in-chat .chat-bar .avatar { width: 36px; height: 36px; flex: none; }
  body.in-chat .chat-who { flex: 1; min-width: 0; }
  body.in-chat .chat-who strong { color: #fff; font-size: 1rem; font-weight: 600; }
  body.in-chat .chat-who small { color: rgba(255, 255, 255, 0.82); font-weight: 500; }
  body.in-chat .chat-bar .icon-round {
    margin-left: 0;
    width: 36px;
    height: 36px;
    flex: none;
    background: transparent;
    color: #fff;
  }
  body.in-chat .chat-note { background: #fff4d6; flex-shrink: 0; }

  body.in-chat .thread {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    padding: 8px 12px 4px;
    gap: 2px;
    overflow-x: hidden;
    overflow-y: auto;
    background: transparent;
  }
  body.in-chat .day-chip {
    display: block;
    align-self: center;
    margin: 8px 0 6px;
    padding: 5px 12px;
    border-radius: 8px;
    background: #fff;
    color: #54656f;
    font-size: 12.5px;
    font-weight: 600;
    box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  }
  body.in-chat .bubble {
    position: relative;
    align-self: flex-start;
    width: fit-content;
    max-width: 82%;
    margin: 1px 6px;
    padding: 6px 8px 4px 9px;
    border-radius: 8px;
    background: #fff;
    color: #111b21;
    box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  }
  body.in-chat .bubble.run-follow { margin-top: 1px; }
  body.in-chat .bubble.run-first { margin-top: 8px; }
  body.in-chat .bubble.run-first::after {
    content: "";
    position: absolute;
    top: 0;
    left: -6px;
    border-top: 8px solid #fff;
    border-left: 8px solid transparent;
  }
  body.in-chat .bubble.out {
    align-self: flex-end;
    background: #d9fdd3;
    color: #111b21;
    border-radius: 8px;
  }
  body.in-chat .file-card {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 6px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(11, 20, 26, 0.06);
    color: #111b21;
    text-decoration: none;
    font-weight: 600;
  }
  body.in-chat .file-card i {
    width: 36px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: none;
    border-radius: 6px;
    background: #7f66ff;
    color: #fff;
    font-size: 18px;
  }
  body.in-chat .file-card span { display: grid; min-width: 0; }
  body.in-chat .file-card strong { font-size: 14px; }
  body.in-chat .bubble .file-card small {
    display: block;
    margin: 0;
    color: #667781;
    font-size: 12px;
    font-weight: 500;
  }
  body.in-chat .bubble.out .file-card { background: rgba(255, 255, 255, 0.55); }
  body.in-chat .bubble.out.run-first::after {
    left: auto;
    right: -6px;
    border-top-color: #d9fdd3;
    border-left: 0;
    border-right: 8px solid transparent;
  }
  html[dir="rtl"] body.in-chat .chat-back i { transform: scaleX(-1); }
  html[dir="rtl"] body.in-chat .bubble.run-first::after { left: auto; right: -6px; border-left: 0; border-right: 8px solid transparent; }
  html[dir="rtl"] body.in-chat .bubble.out.run-first::after { right: auto; left: -6px; border-right: 0; border-left: 8px solid transparent; border-top-color: #d9fdd3; }
  body.in-chat .bubble.failed { background: #ffe8ea; color: #111b21; }
  body.in-chat .bubble.failed.run-first::after,
  body.in-chat .bubble.out.failed.run-first::after { border-top-color: #ffe8ea; }
  body.in-chat .bubble small,
  body.in-chat .bubble.out small { color: #667781; }
  body.in-chat .bubble small .read,
  body.in-chat .bubble.out small .read { color: #53bdeb; }
  body.in-chat .bubble.out .product-card { background: rgba(255, 255, 255, 0.55); color: #111b21; }
  body.in-chat .bubble.out .product-card small { color: #667781; }

  body.in-chat .composer {
    position: relative;
    flex: none;
    flex-wrap: nowrap;
    align-items: flex-end;
    width: 100%;
    max-width: 100%;
    gap: 4px;
    overflow: hidden;
    background: #f0f2f5;
    border-top: 0;
    padding: 5px 6px calc(6px + env(safe-area-inset-bottom));
  }
  body.in-chat .composer-more {
    display: grid;
    order: 1;
    width: 40px;
    height: 42px;
    flex: none;
    border-radius: 50%;
    color: #54656f;
  }
  body.in-chat .composer.show-tools .composer-more i { transform: rotate(45deg); }
  body.in-chat .composer-extra { display: none; }
  body.in-chat .composer.show-tools .composer-extra { display: none; }
  body.in-chat .composer-pill {
    display: flex;
    order: 2;
    flex: 1 1 0;
    align-items: flex-end;
    min-width: 0;
    overflow: hidden;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.08);
  }
  body.in-chat .pill-emoji,
  body.in-chat .pill-camera {
    display: grid;
    place-items: center;
    width: 40px;
    height: 42px;
    flex: none;
    color: #54656f;
    background: transparent;
  }
  body.in-chat .pill-camera input { display: none; }
  body.in-chat .composer textarea { background: transparent; box-shadow: none; border-radius: 0; }
  body.in-chat #voice-btn {
    order: 3;
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #00a884;
    color: #fff;
  }
  body.in-chat .composer .btn { display: none; }
  body.in-chat .composer.has-text #voice-btn { display: none; }
  body.in-chat .composer.has-text .btn { display: grid; }
  body.in-chat .quote-bar {
    margin: 0 8px;
    border-radius: 8px;
    border-left: 4px solid #00a884;
    background: #fff;
    color: #111b21;
  }
  body.in-chat .composer textarea {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    max-width: 100%;
    background: transparent;
    border: 0;
    border-radius: 0;
    min-height: 42px;
    max-height: 120px;
    padding: 0.55rem 0.2rem;
    box-shadow: none;
  }
  body.in-chat .composer .btn {
    order: 4;
    width: 42px;
    height: 42px;
    flex: none;
    background: #00a884;
    border: 0;
    color: #fff;
  }
  body.in-chat .clip { width: 36px; height: 42px; color: #54656f; }
  body.in-chat .quick-panel,
  body.in-chat .later-panel,
  body.in-chat .link-draft { background: #f0f2f5; max-width: 100%; }
  body.in-chat .thread-search { margin: 0; }
  body.in-chat .thread-search input { background: #fff; border-radius: 0; }
  body.in-chat .profile-actions { display: flex; gap: 8px; margin: 12px 0; }
  body.in-chat .profile-actions button {
    flex: 1;
    display: grid;
    justify-items: center;
    gap: 4px;
    border: 0;
    background: #f0f2f5;
    border-radius: 12px;
    padding: 10px 4px;
    color: #008069;
    font-size: 12px;
    font-weight: 700;
  }
  body.in-chat .profile-assign { display: grid; }
  body.in-chat .chat-layout.show-profile .chat-main { display: none; }
  body.in-chat .chat-layout.show-profile .chat-profile {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: #fff;
    padding: calc(12px + env(safe-area-inset-top)) 16px 24px;
  }
  body.in-chat .profile-back { display: inline-grid; place-items: center; }
  body.in-chat .profile-head h2 { margin: 0; }

  body.in-chat .who-phone { display: none; }
  body.in-chat .who-presence { display: block; color: rgba(255, 255, 255, 0.82); font-weight: 500; }
  body.in-chat .who-presence.live { color: #fff; }
  body.in-chat #status-filter { display: none; }
  body.in-chat .wa-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 12px 8px;
    scrollbar-width: none;
  }
  body.in-chat .wa-chips button {
    height: 32px;
    border: 0;
    border-radius: 16px;
    background: #f0f2f5;
    color: #54656f;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
  }
  body.in-chat .wa-chips button.on { background: #00a884; color: #fff; }
  body.in-chat .chat-side { position: relative; }
  body.in-chat .tick, body.in-chat .preview-kind, body.in-chat .pin-row, body.in-chat .mute-row { display: inline; color: #667781; font-size: 12px; margin-right: 4px; }
  body.in-chat .tick.read { color: #53bdeb; }
  body.in-chat .tick.bad { color: #e53935; }
  body.in-chat .pin-mark { display: none; }
  body.in-chat .chat-person .avatar:not(.group),
  body.in-chat .chat-bar .avatar:not(.group) {
    background: #dfe5e7 !important;
    color: transparent;
    font-size: 0;
  }
  body.in-chat .chat-person .avatar:not(.group)::before,
  body.in-chat .chat-bar .avatar:not(.group)::before {
    content: "\f007";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 20px;
    color: #fff;
  }
  body.in-chat .new-chat {
    display: grid;
    place-items: center;
    position: absolute;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 16px;
    background: #00a884;
    color: #fff;
    font-size: 22px;
    box-shadow: 0 3px 8px rgba(11, 20, 26, 0.25);
    z-index: 5;
  }
  html[dir="rtl"] body.in-chat .new-chat { right: auto; left: 16px; }
  body.in-chat .encrypt-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    align-self: center;
    max-width: 320px;
    margin: 8px auto 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #ffeecd;
    color: #54656f;
    font-size: 12.5px;
    line-height: 1.35;
    text-align: center;
    box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  }
  body.in-chat .encrypt-note i { margin-top: 2px; color: #8696a0; }
  body.in-chat .desk-empty { display: none; }
  body.in-chat .unread-divider {
    display: flex;
    justify-content: center;
    margin: 8px 0;
  }
  body.in-chat .unread-divider span {
    background: #fff;
    color: #54656f;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 12.5px;
    font-weight: 600;
    box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  }
  body.in-chat .bubble.photo-only { padding: 3px; }
  body.in-chat .bubble.photo-only img { border-radius: 6px; }
  body.in-chat .bubble.photo-only small {
    position: absolute;
    right: 8px;
    bottom: 8px;
    margin: 0;
    padding: 1px 6px;
    border-radius: 8px;
    background: rgba(11, 20, 26, 0.45);
    color: #fff;
  }
  body.in-chat .bubble .starred-mark { color: #f5c451; margin-right: 3px; }
  body.in-chat .hold-info:not(:empty) {
    display: block;
    margin: 0;
    padding: 6px 14px;
    background: #fff;
    color: #54656f;
    font-size: 13px;
  }
  body.in-chat .voice-hold { align-items: center; gap: 10px; color: #54656f; min-width: 0; }
  body.in-chat .composer.recording .composer-pill { visibility: hidden; position: absolute; }
  body.in-chat .composer.recording .voice-hold { display: flex; order: 2; flex: 1; }
  body.in-chat .composer.canceling .voice-hold { color: #e53935; }
  body.in-chat .wave { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
  body.in-chat .wave i {
    display: block;
    width: 3px;
    height: 8px;
    border-radius: 2px;
    background: #00a884;
    animation: wa-wave 0.9s ease-in-out infinite;
  }
  body.in-chat .wave i:nth-child(2) { animation-delay: 0.15s; }
  body.in-chat .wave i:nth-child(3) { animation-delay: 0.3s; }
  body.in-chat .wave i:nth-child(4) { animation-delay: 0.45s; }
  body.in-chat .composer.recording #voice-btn { background: #e53935; }
  body.in-chat .emoji-pop, body.in-chat .attach-sheet {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: calc(62px + env(safe-area-inset-bottom));
    z-index: 6;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(11, 20, 26, 0.16);
  }
  body.in-chat .chat-main { position: relative; }
  body.in-chat .emoji-pop { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; }
  body.in-chat .emoji-pop button { width: 40px; height: 40px; border: 0; background: transparent; font-size: 22px; }
  body.in-chat .attach-sheet { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 16px 12px; }
  body.in-chat .attach-sheet button {
    display: grid;
    justify-items: center;
    gap: 6px;
    border: 0;
    background: transparent;
    color: #54656f;
    font-size: 12px;
    font-weight: 600;
  }
  body.in-chat .attach-sheet i {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 20px;
    background: #00a884;
  }
  body.in-chat .attach-sheet button:nth-child(1) i { background: #7f66ff; }
  body.in-chat .attach-sheet button:nth-child(2) i { background: #ff2e74; }
  body.in-chat .attach-sheet button:nth-child(3) i { background: #007bfc; }
  body.in-chat .attach-sheet button:nth-child(4) i { background: #f5a623; }
  body.in-chat .attach-sheet button:nth-child(5) i { background: #02a698; }
  body.in-chat .attach-sheet button:nth-child(6) i { background: #5e72e4; }
  body.in-chat .attach-sheet button:nth-child(7) i { background: #8696a0; }
  body.in-chat .hold-menu {
    display: grid;
    position: fixed;
    z-index: 40;
    min-width: 180px;
    padding: 6px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(11, 20, 26, 0.2);
  }
  body.in-chat .hold-menu button {
    border: 0;
    background: transparent;
    text-align: left;
    padding: 10px 12px;
    border-radius: 8px;
    color: #111b21;
    font-size: 15px;
  }
  body.in-chat .compose-sheet {
    display: grid;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(11, 20, 26, 0.45);
    align-items: end;
  }
  body.in-chat .sheet-card {
    background: #fff;
    border-radius: 16px 16px 0 0;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    display: grid;
    gap: 10px;
  }
  body.in-chat .sheet-card strong { font-size: 18px; color: #111b21; }
  body.in-chat .sheet-card input { background: #f0f2f5; border: 0; border-radius: 12px; }
  body.in-chat .sheet-actions { display: flex; justify-content: flex-end; gap: 8px; }
  body.in-chat .bubble { touch-action: pan-y; }
}

@keyframes wa-wave {
  0%, 100% { height: 6px; }
  50% { height: 18px; }
}
