/* Support Board — modern UI, RTL-ready via CSS logical properties. */
:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --border: #e7eaee;
  --text: #24292f;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --accent: #2a87ff;
  --accent-soft: #e8f1ff;
  --accent-dark: #1668d9;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --bubble-in: #f1f3f5;
  --bubble-out: #d9ebff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --font: 'Inter', 'Tajawal', 'Segoe UI', Tahoma, system-ui, sans-serif;
}
[lang="ar"] { --font: 'Tajawal', 'Inter', 'Segoe UI', Tahoma, system-ui, sans-serif; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; color: var(--text); }
/* custom scrollbars everywhere */
* { scrollbar-width: thin; scrollbar-color: #c9d2dc transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #ccd4dd; border-radius: 999px;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #a8b4c2; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-corner { background: transparent; }
.hidden { display: none !important; }

/* ============================= Login ============================== */
.login-page {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow: auto;
  background: linear-gradient(135deg, #0f2027, #203a43 45%, #2a87ff);
}
/* split "side login": branding panel + form panel, side by side */
.login-shell {
  display: flex; width: 900px; max-width: 100%; min-height: 540px;
  background: var(--panel); border-radius: 24px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(8, 15, 30, .35);
}

/* ---- branding side ---- */
.login-aside {
  position: relative; flex: 1 1 0; min-width: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 48px 40px; color: #fff;
  background: linear-gradient(150deg, #1668d9, #2a87ff 55%, #45c1ff);
  overflow: hidden;
}
.login-aside::before, .login-aside::after {
  content: ""; position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}
.login-aside::before { width: 320px; height: 320px; top: -120px; inset-inline-end: -90px; }
.login-aside::after  { width: 220px; height: 220px; bottom: -90px; inset-inline-start: -70px; background: rgba(255, 255, 255, .08); }
.login-aside-inner { position: relative; z-index: 1; text-align: center; max-width: 320px; }
.login-brand { margin: 0 0 14px; font-size: 26px; font-weight: 800; letter-spacing: .2px; }
.login-aside-text { margin: 0; font-size: 14px; line-height: 1.75; color: rgba(255, 255, 255, .85); }

/* ---- form side ---- */
.login-main {
  flex: 1 1 0; min-width: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 48px 44px;
}
.login-card {
  width: 100%; max-width: 360px;
  background: transparent; box-shadow: none; padding: 0;
}
.login-logo {
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
}
.login-logo-lg {
  width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 24px;
  background: rgba(255, 255, 255, .18); backdrop-filter: blur(2px);
}
/* logo shown inside the form card only on phones (branding panel hidden) */
.login-card-logo { display: none; margin: 0 auto 18px; }
.login-card h1 { margin: 0 0 6px; font-size: 22px; }
.login-card p { margin: 0 0 24px; color: var(--text-2); }
/* centered values inside the login inputs (per request) */
.login-card .field input { text-align: center; }

/* stack the two panels on tablets: branding on top, form below */
@media (max-width: 760px) {
  .login-page { padding: 0; align-items: stretch; }
  .login-shell {
    flex-direction: column; width: 100%; max-width: 100%;
    min-height: 100vh; min-height: 100dvh; border-radius: 0;
  }
  .login-aside { flex: 0 0 auto; padding: 38px 26px 30px; }
  .login-aside-inner { max-width: none; }
  .login-logo-lg { width: 58px; height: 58px; margin-bottom: 14px; }
  .login-brand { font-size: 21px; }
  .login-main { flex: 1 1 auto; padding: 30px 24px 40px; align-items: flex-start; }
  .login-card { max-width: 440px; margin: 0 auto; }
}

/* phones: drop the branding panel, show a clean full-screen form card */
@media (max-width: 540px) {
  .login-aside { display: none; }
  .login-main { align-items: center; padding: 28px 22px; }
  .login-card-logo { display: flex !important; }
}
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fafbfc; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: #fff;
}
/* password show/hide toggle (input stays LTR, so the eye sits on the right) */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  border: none; background: transparent; color: var(--text-3);
  border-radius: 8px; cursor: pointer; transition: color .15s, background .15s;
}
.pw-toggle:hover { color: var(--text); background: var(--bg); }
.pw-toggle .pw-eye-off { display: none; }
.pw-wrap.show .pw-toggle .pw-eye { display: none; }
.pw-wrap.show .pw-toggle .pw-eye-off { display: block; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border: none; border-radius: 10px;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 14px;
  transition: background .15s;
}
.btn:hover { background: var(--accent-dark); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-block { width: 100%; padding: 12px; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #d92d20; }
.btn-light { background: var(--accent-soft); color: var(--accent-dark); }
.btn-light:hover { background: #d6e7ff; }
.login-error {
  background: #fef2f2; color: var(--red); border: 1px solid #fecaca;
  border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px;
}
.lang-switch { display: flex; gap: 8px; justify-content: center; margin-top: 22px; }
.lang-switch button {
  border: 1px solid var(--border); background: #fff; border-radius: 999px;
  padding: 6px 16px; font-size: 13px; color: var(--text-2);
}
.lang-switch button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.login-hint { margin-top: 18px; font-size: 12px; color: var(--text-3); text-align: center; }

/* "Forgot my password?" / "Back to sign in" text links under the login form */
.login-link {
  display: block; width: 100%; margin-top: 14px; padding: 4px;
  background: none; border: none; cursor: pointer;
  font-size: 13px; color: var(--accent); text-align: center;
}
.login-link:hover { text-decoration: underline; }

/* Forgot-password success: the freshly generated password + copy button */
.forgot-success {
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px;
  padding: 16px; margin-bottom: 16px;
}
.forgot-success .fp-msg { font-size: 13px; color: var(--text-2); margin: 0 0 12px; }
.forgot-success .fp-pass { display: flex; gap: 8px; margin-bottom: 14px; }
.fp-pass-input {
  flex: 1; min-width: 0; font-family: ui-monospace, monospace; font-size: 16px;
  letter-spacing: 1px; text-align: center; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--text);
}
html[data-theme="dark"] .forgot-success { background: rgba(34,197,94,.08); border-color: rgba(34,197,94,.3); }
html[data-theme="dark"] .fp-pass-input { background: var(--panel); }

/* "Remember me" checkbox row on the login form — aligned to the field edge
   (inline-start: right in Arabic/RTL, left in English/LTR) */
.remember-row {
  display: flex; align-items: center; justify-content: flex-start; gap: 8px;
  width: 100%; margin: -2px 0 16px; font-size: 13px; color: var(--text-2);
  cursor: pointer; user-select: none;
}
.remember-row input { flex: none; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* Active sessions list (profile dialog) */
.sessions-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sessions-head b { font-size: 13.5px; }
.sessions-list { display: flex; flex-direction: column; gap: 8px; max-height: 230px; overflow-y: auto; }
.session-row {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff;
}
.session-row.current { border-color: var(--accent); background: var(--accent-soft); }
.session-ico { color: var(--text-2); display: flex; flex-shrink: 0; }
.session-meta { flex: 1; min-width: 0; }
.session-top { display: flex; align-items: center; gap: 8px; }
.session-top b { font-size: 13px; }
.session-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ============================= Shell ============================== */
.app {
  display: grid; height: 100vh;
  grid-template-columns: 68px 340px 1fr 320px;
  /* Cap the single row at the viewport so long conversations scroll inside
     the chat body instead of growing the row and pushing the composer
     off-screen (grid rows otherwise size to their content). */
  grid-template-rows: minmax(0, 1fr);
}
.app.no-details { grid-template-columns: 68px 340px 1fr; }

/* icon rail */
.rail {
  background: var(--panel); border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 0; gap: 6px;
}
.rail .logo {
  width: 42px; height: 42px; border-radius: 13px; background: var(--accent);
  color: #fff; display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.rail-btn {
  width: 44px; height: 44px; border: none; border-radius: 12px;
  background: transparent; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.rail-btn:hover { background: var(--bg); color: var(--text); }
.rail-btn.active { background: var(--accent-soft); color: var(--accent-dark); }
.rail-btn .badge {
  position: absolute; top: 4px; inset-inline-end: 4px;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.rail .spacer { flex: 1; }
.rail .me-avatar { margin-top: 8px; }

/* styled tooltips — any element with data-tip */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; z-index: 60;
  top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: #1f2937; color: #fff; padding: 6px 12px; border-radius: 8px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  opacity: 0; pointer-events: none; box-shadow: var(--shadow);
  transition: opacity .15s ease .15s;
}
[data-tip]::before {
  content: ''; position: absolute; z-index: 60;
  top: calc(100% + 2px); left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-bottom-color: #1f2937;
  opacity: 0; pointer-events: none; transition: opacity .15s ease .15s;
}
[data-tip]:hover::after, [data-tip]:hover::before { opacity: 1; }

/* above the element — for the composer row at the bottom edge */
[data-tip][data-tip-pos="top"]::after { top: auto; bottom: calc(100% + 8px); }
[data-tip][data-tip-pos="top"]::before {
  top: auto; bottom: calc(100% + 2px);
  border-bottom-color: transparent; border-top-color: #1f2937;
}

/* beside the icon rail */
.rail [data-tip]::after {
  top: 50%; left: auto; inset-inline-start: calc(100% + 12px);
  transform: translateY(-50%);
}
.rail [data-tip]::before {
  top: 50%; left: auto; inset-inline-start: calc(100% + 6px);
  transform: translateY(-50%);
  border-bottom-color: transparent; border-inline-end-color: #1f2937;
}

.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff;
  background: linear-gradient(135deg, #7c8aa0, #5b6678);
  position: relative; user-select: none;
}
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.profile-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.profile-head .avatar.lg { width: 64px; height: 64px; font-size: 20px; }
.avatar-edit { position: relative; cursor: pointer; flex: none; border-radius: 50%; }
.avatar-edit .av-overlay {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(15, 23, 42, .45); color: #fff;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
}
.avatar-edit:hover .av-overlay { opacity: 1; }
.modal-sep { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.avatar .dot {
  position: absolute; bottom: 0; inset-inline-end: 0;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--text-3); border: 2px solid var(--panel);
}
.avatar .dot.online { background: var(--green); }

/* ============================= Inbox list ============================== */
.inbox {
  background: var(--panel); border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column; min-width: 0;
}
.inbox-head {
  display: flex; align-items: center; gap: 8px;
  padding: 16px 16px 12px;
}
.inbox-head select {
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--border); background-color: #fff;
  border-radius: 10px; padding: 8px 12px; padding-inline-end: 34px;
  font-weight: 700; font-size: 14px; outline: none; max-width: 180px; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
  transition: border-color .15s, box-shadow .15s;
}
[dir="rtl"] .inbox-head select { background-position: left 10px center; }
.inbox-head select:hover { border-color: #c9d4e0; }
.inbox-head select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inbox-head .count { color: var(--text-3); font-weight: 600; }
.icon-btn {
  width: 36px; height: 36px; border: none; border-radius: 10px;
  background: transparent; color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn.danger:hover { background: #fef2f2; color: var(--red); }
.inbox-search { padding: 0 16px 12px; }
.inbox-search input {
  width: 100%; padding: 9px 14px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg); outline: none;
}
.inbox-filters { display: flex; gap: 6px; padding: 0 16px 12px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); border-radius: 999px; background: #fff;
  padding: 4px 12px; font-size: 12px; color: var(--text-2);
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.conv-list { flex: 1; overflow-y: auto; }
.conv-item {
  display: flex; gap: 12px; padding: 14px 16px; cursor: pointer;
  border-inline-start: 3px solid transparent;
  border-bottom: 1px solid var(--border);
}
.conv-item:hover { background: #fafbfc; }
.conv-item.active { background: var(--accent-soft); border-inline-start-color: var(--accent); }
.conv-item.unread { border-inline-start-color: var(--red); }
.conv-item .meta { flex: 1; min-width: 0; }
.conv-item .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.conv-item .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; }
.conv-item.unread .name { color: var(--text); }
.conv-item .time { font-size: 11px; color: var(--text-3); flex: none; }
.conv-item .row2 { display: flex; align-items: center; gap: 8px; }
.conv-item .preview {
  flex: 1; min-width: 0;
  margin-top: 4px; color: var(--text-2); font-size: 13px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.45;
  unicode-bidi: plaintext; text-align: start;
}
.sub-store {
  display: inline-block; margin-top: 3px;
  font-size: 10.5px; font-weight: 600; color: var(--text-2);
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 1px 7px; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-store {
  flex: none; margin-top: 4px; max-width: 96px;
  font-size: 10.5px; font-weight: 600; color: var(--text-2);
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 2px 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-badge {
  flex: none; min-width: 20px; height: 20px; padding: 0 6px; margin-top: 4px;
  border-radius: 10px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(239, 68, 68, .35);
}
.conv-item.unread .preview { color: var(--text); font-weight: 600; }
.empty-state {
  padding: 60px 20px; text-align: center; color: var(--text-3);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}

/* ============================= Chat panel ============================== */
.chat { display: flex; flex-direction: column; min-width: 0; background: var(--panel); }
.chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.chat-head h2 { margin: 0; font-size: 17px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; text-align: start; }
.chat-head .sub { font-size: 12px; color: var(--text-2); }
.chat-body { flex: 1; overflow-y: auto; padding: 22px 24px; background: #fbfcfd; }
.day-divider {
  display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--text-3); font-size: 12px;
}
.day-divider::before, .day-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.msg-row { display: flex; margin-bottom: 8px; }
.msg-row.out { justify-content: flex-end; }
.msg {
  max-width: 68%; width: fit-content; padding: 8px 13px; border-radius: 16px;
  background: var(--bubble-in); line-height: 1.5; position: relative;
  overflow-wrap: break-word; box-shadow: 0 1px 1px rgba(16, 24, 40, .05);
}
.msg-row.out .msg {
  background: linear-gradient(135deg, #2a87ff, #6d5cff);
  color: #fff; border-end-end-radius: 5px;
}
.msg-row.in .msg { border-end-start-radius: 5px; }
/* Each message renders in its own text direction (Arabic flows RTL, English
   flows LTR). inline-block keeps the bubble hugging its text and lets the
   time sit beside the last line, WhatsApp-style. */
.msg-body {
  display: inline-block; max-width: 100%; vertical-align: bottom;
  unicode-bidi: plaintext; text-align: start; white-space: pre-wrap;
}
.msg .msg-time {
  display: inline-block; margin-inline-start: 9px; vertical-align: bottom;
  position: relative; bottom: -1px;
  font-size: 10px; color: var(--text-3); white-space: nowrap; unicode-bidi: plaintext;
}
.msg-row.out .msg-time { color: rgba(255, 255, 255, .8); }
.msg .ticks { color: var(--text-3); }
.msg .ticks.read { color: var(--accent); }
.msg-row.out .ticks { color: rgba(255, 255, 255, .75); }
.msg-row.out .ticks.read { color: #9ef0ff; }
.msg img.att-img { max-width: 280px; max-height: 220px; border-radius: 10px; display: block; margin-top: 6px; cursor: pointer; }
.msg .att-file {
  display: flex; align-items: center; gap: 8px; margin-top: 6px;
  background: rgba(255,255,255,.65); padding: 8px 12px; border-radius: 10px;
  text-decoration: none; color: var(--text); font-size: 13px;
}
.msg.system { background: transparent; color: var(--text-3); font-style: italic; }
.msg-actions {
  position: absolute; top: -14px; inset-inline-end: 6px; display: none; gap: 2px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 1px;
}
.msg:hover .msg-actions { display: flex; }
.msg-actions button {
  border: none; background: transparent; width: 26px; height: 24px;
  border-radius: 6px; color: var(--text-2); font-size: 12px;
}
.msg-actions button:hover { background: var(--bg); }
.typing-indicator { padding: 0 24px 8px; min-height: 40px; }
.typing-bubble {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--bubble-in); border-radius: 16px; border-end-start-radius: 5px;
  padding: 10px 14px; box-shadow: 0 1px 1px rgba(16, 24, 40, .05);
  animation: tb-in .18s ease;
}
@keyframes tb-in { from { opacity: 0; transform: translateY(4px); } }
.typing-bubble .tn { font-size: 11px; color: var(--text-2); }
.type-dots { display: inline-flex; gap: 4px; align-items: center; }
.type-dots i {
  width: 7px; height: 7px; border-radius: 50%; background: #9aa6b5;
  animation: tdot 1.2s infinite ease-in-out;
}
.type-dots i:nth-child(2) { animation-delay: .15s; }
.type-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes tdot {
  0%, 60%, 100% { transform: translateY(0); opacity: .35; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.composer { border-top: 1px solid var(--border); padding: 14px 20px 16px; }
.readonly-note {
  border-top: 1px solid var(--border); background: #fffaf0; color: #92600a;
  padding: 13px 20px; font-size: 13px; font-weight: 600; text-align: center;
}
.composer-box {
  border: 1px solid var(--border); border-radius: 14px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea {
  width: 100%; border: none; outline: none; resize: none; background: transparent;
  padding: 13px 16px 4px; max-height: 140px; line-height: 1.5;
  /* placeholder + caret follow the interface direction (right in RTL),
     while each typed line still auto-detects its own direction */
  text-align: start; unicode-bidi: plaintext;
}
/* Toolbar keeps a fixed physical layout in both directions: the action
   icons (attach, replies, emoji, voice) on the left, the send button on
   the right — even in RTL. */
.composer-tools { display: flex; align-items: center; gap: 2px; padding: 4px 8px 8px; direction: ltr; }
.composer-tools .grow { flex: 1; }
.composer .send-btn { width: 38px; height: 38px; border-radius: 11px; flex: none; padding: 0; }
.send-icon { display: block; }
/* send button is always on the right now, so the plane keeps its natural angle */
[dir="rtl"] .send-icon { transform: none; }
/* inline lucide icons align with surrounding text */
svg.li { flex: none; vertical-align: -2px; }
.ticks svg.li { vertical-align: -3px; }
.att-file svg.li { vertical-align: -2px; }
.attach-preview { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 12px 0; }
.attach-preview .att {
  display: flex; align-items: center; gap: 6px; background: var(--bg);
  border-radius: 8px; padding: 5px 10px; font-size: 12px;
}
.attach-preview .att button { border: none; background: none; color: var(--red); font-weight: 700; }

/* voice recording */
#btn-voice.rec { background: #fef2f2; color: var(--red); }
.rec-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fef2f2; color: #b91c1c; border-radius: 999px;
  padding: 4px 6px 4px 12px; font-size: 12px; font-weight: 700;
}
.rec-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--red);
  animation: rec-blink 1s infinite;
}
@keyframes rec-blink { 50% { opacity: .2; } }
.rec-cancel {
  border: none; background: #fff; color: #b91c1c; border-radius: 50%;
  width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
}
.rec-cancel:hover { background: #fee2e2; }
.att-audio { display: none; }
/* Facebook-style voice player (custom waveform, no native download menu) */
.voice { display: flex; align-items: center; gap: 10px; margin-top: 5px; width: 252px; max-width: 100%; }
.voice .v-audio { display: none; }
.voice .v-play {
  flex: none; width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; transition: filter .15s;
}
.voice .v-play:hover { filter: brightness(1.08); }
.msg-row.out .voice .v-play { background: rgba(255, 255, 255, .28); }
.voice .v-wave { position: relative; flex: 1; display: flex; align-items: center; gap: 2px; height: 28px; cursor: pointer; }
.voice .v-wave i { flex: 1; min-width: 2px; max-width: 3px; border-radius: 2px; background: var(--border); transition: background .1s; }
.voice .v-wave i.on { background: var(--accent); }
.msg-row.out .voice .v-wave i { background: rgba(255, 255, 255, .4); }
.msg-row.out .voice .v-wave i.on { background: #fff; }
.voice .v-time { flex: none; font-size: 11px; color: var(--text-3); min-width: 30px; text-align: end; unicode-bidi: plaintext; }
.msg-row.out .voice .v-time { color: rgba(255, 255, 255, .85); }

/* emoji + saved replies popovers */
.popover {
  position: absolute; bottom: 54px; inset-inline-start: 8px; z-index: 20;
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); width: 300px; max-height: 280px; overflow-y: auto; padding: 10px;
}
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-grid button { border: none; background: none; font-size: 20px; padding: 4px; border-radius: 8px; }
.emoji-grid button:hover { background: var(--bg); }
.reply-item { padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.reply-item:hover { background: var(--bg); }
.reply-item .rt { font-weight: 700; font-size: 13px; }
.reply-item .rb { color: var(--text-2); font-size: 12px; margin-top: 2px; }

/* ============================= Details sidebar ============================== */
.details {
  background: var(--panel); border-inline-start: 1px solid var(--border);
  overflow-y: auto; padding: 20px;
}
.details .d-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.details .d-head h3 { margin: 0; font-size: 16px; }
.d-section { margin-bottom: 20px; }
.d-section h4 {
  margin: 0 0 10px; font-size: 13px; font-weight: 700;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.d-row { display: flex; gap: 10px; padding: 5px 0; font-size: 13px; align-items: center; }
.d-row .ic { color: var(--text-3); flex: none; width: 18px; display: flex; }
.d-row .k { color: var(--text-2); flex: none; width: 96px; }
.d-row .v { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; }
.d-row select { flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; outline: none; }
.note-item { background: #fff8e1; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; unicode-bidi: plaintext; text-align: start; }
.note-item .who { font-size: 11px; color: var(--text-2); margin-top: 4px; }
.note-input { display: flex; gap: 8px; }
.note-input input { flex: 1; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; outline: none; }

/* ============================= Pages (team/users/etc.) ============================== */
.page { grid-column: 2 / -1; overflow-y: auto; padding: 28px 34px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04); overflow: hidden;
}
table.list { width: 100%; border-collapse: collapse; }
table.list th {
  text-align: start; font-size: 11px; color: var(--text-2); font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  padding: 13px 18px; border-bottom: 1px solid var(--border);
  background: #f9fafb; position: sticky; top: 0; z-index: 1;
}
table.list td { padding: 14px 18px; border-bottom: 1px solid #eef1f4; font-size: 13px; text-align: start; }
table.list tr:last-child td { border-bottom: none; }
table.list tbody tr { transition: background .12s; }
table.list tbody tr:hover td { background: #f6f9fc; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--bg); color: var(--text-2);
}
.pill.admin { background: #ede9fe; color: #6d28d9; }
.pill.manager { background: #e0f2fe; color: #0369a1; }
.pill.operator { background: #ecfdf5; color: #047857; }
.pill.ok { background: #ecfdf5; color: #047857; }
.pill.off { background: #fef2f2; color: #b91c1c; }
.pill .dep-dot { width: 8px; height: 8px; border-radius: 50%; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat-card { padding: 20px 22px; transition: transform .15s ease, box-shadow .15s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card .num { font-size: 30px; font-weight: 800; }
.stat-card .lbl { color: var(--text-2); font-size: 13px; margin-top: 4px; }

/* ============================= Modal & toast ============================== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 23, 42, .5);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: overlay-in .15s ease;
}
@keyframes overlay-in { from { opacity: 0; } }
.modal {
  background: #fff; border-radius: 18px; width: 560px; max-width: 100%;
  max-height: calc(100vh - 60px); overflow-y: auto; padding: 0;
  box-shadow: 0 24px 64px rgba(15, 23, 42, .25);
  animation: modal-in .2s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.modal h2 {
  margin: 0 0 20px; padding: 18px 24px; font-size: 16px;
  border-bottom: 1px solid var(--border); background: #fafbfc;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 2;
}
.modal-x {
  border: none; background: transparent; color: var(--text-2);
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.modal-x:hover { background: var(--bg); color: var(--text); }
/* body content gets side padding; the header/footer bleed full width */
.modal > *:not(h2):not(.actions) { margin-left: 24px; margin-right: 24px; }
.modal .actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 22px; padding: 14px 24px;
  border-top: 1px solid var(--border); background: #fafbfc;
  position: sticky; bottom: 0;
}
.modal .field label { font-size: 12.5px; color: var(--text-2); }
.modal .field input:disabled { background: var(--bg); color: var(--text-3); }

/* bootstrap-style form grid: paired inline fields */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }
.form-row .field { margin-bottom: 6px; }

/* validation states + feedback line */
.field .feedback { min-height: 16px; font-size: 11.5px; color: var(--red); margin-top: 4px; }
.field.invalid input, .field.invalid select {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .12) !important;
  background: #fff;
}
.check-row { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check-row input { accent-color: var(--accent); width: 16px; height: 16px; }

/* dropdowns: custom chevron, consistent height */
.field select, .d-row select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px !important;
  cursor: pointer;
}
[dir="rtl"] .field select, [dir="rtl"] .d-row select {
  background-position: left 12px center;
  padding-right: 14px !important;
  padding-left: 36px !important;
}
.priv-grid { display: grid; gap: 8px; }
.priv-grid label {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 13px;
}
.priv-grid label:hover { background: var(--bg); }
.priv-grid input { accent-color: var(--accent); width: 16px; height: 16px; }

.code-box {
  width: 100%; font-family: 'SFMono-Regular', Consolas, monospace; font-size: 12px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); resize: none;
  direction: ltr; text-align: left; outline: none; display: block;
  white-space: pre; overflow-x: auto;
}
.code-wrap p { color: var(--text-2); font-size: 13px; margin: 0 0 10px; text-align: start; }
.copy-btn { margin-top: 10px; transition: background .15s, color .15s, transform .1s; }
.copy-btn:active { transform: scale(.96); }
.copy-btn.copied { background: var(--green) !important; color: #fff !important; }

/* ============================= Data table ============================== */
.dt-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: #fff;
}
.dt-search {
  display: flex; align-items: center; gap: 8px; flex: 1; max-width: 320px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
  padding: 0 12px; color: var(--text-3);
  transition: border-color .15s, box-shadow .15s;
}
.dt-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: #fff; }
.dt-search input {
  flex: 1; border: none; outline: none; background: transparent;
  padding: 9px 0; font-size: 13px; min-width: 0;
}
.dt-count {
  background: var(--accent-soft); color: var(--accent-dark);
  border-radius: 999px; padding: 3px 11px; font-size: 12px; font-weight: 700;
}
.dt-scroll { overflow-x: auto; }
.dt-empty { text-align: center !important; color: var(--text-3); padding: 36px 18px !important; }
/* row-selection checkboxes + bulk delete */
.dt-check-cell { width: 40px; text-align: center; padding-inline: 10px !important; }
.dt-row-check, .dt-check-all {
  width: 16px; height: 16px; accent-color: var(--accent);
  cursor: pointer; vertical-align: middle;
}
.dt-bulk-del { margin-inline-start: auto; padding: 8px 14px; font-size: 13px; }
.dt-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; border-top: 1px solid var(--border); background: #f9fafb;
}
.dt-range { font-size: 12px; color: var(--text-2); }
.dt-pages { display: flex; align-items: center; gap: 4px; }
.dt-btn {
  min-width: 30px; height: 30px; padding: 0 6px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
  color: var(--text-2); font-size: 12.5px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .12s;
}
.dt-btn:hover:not(:disabled):not(.cur) { border-color: #c9d4e0; color: var(--text); }
.dt-btn.cur { background: var(--accent); border-color: var(--accent); color: #fff; }
.dt-btn:disabled { opacity: .4; cursor: default; }
.dt-dots { color: var(--text-3); padding: 0 2px; }
[dir="rtl"] .dt-prev svg, [dir="rtl"] .dt-next svg { transform: scaleX(-1); }
.me-avatar { cursor: pointer; transition: transform .12s; }
.me-avatar:hover { transform: scale(1.08); }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  display: inline-block; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn.btn-success { background: var(--green) !important; }
.spinner-dark {
  width: 30px; height: 30px; border-width: 3px;
  border-color: rgba(16, 24, 40, .12); border-top-color: var(--accent);
}

/* delete-confirmation modal */
.confirm-ico {
  width: 54px; height: 54px; border-radius: 50%;
  background: #fef2f2; color: var(--red);
  display: flex; align-items: center; justify-content: center;
  margin: 4px auto 14px;
}
.confirm-msg { text-align: center; color: var(--text-2); font-size: 14px; margin: 0 0 6px; }

#toasts { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 80; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #1f2937; color: #fff; border-radius: 12px; padding: 12px 18px;
  font-size: 13px; box-shadow: var(--shadow); animation: toast-in .2s ease;
  max-width: 340px;
}
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.conn-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 70;
  background: var(--amber); color: #fff; text-align: center;
  padding: 6px; font-size: 13px; font-weight: 600;
}

/* ============================= Responsive ============================== */
.chat-back { display: none; }
[dir="rtl"] .chat-back svg { transform: scaleX(-1); }

/* laptops / small desktops: drop the details sidebar */
@media (max-width: 1200px) {
  .app { grid-template-columns: 68px 300px 1fr; }
  .details { display: none; }
}

/* tablets: narrower inbox */
@media (max-width: 1000px) {
  .app { grid-template-columns: 60px 260px 1fr; }
}

/* phones: single column + bottom navigation bar; chat opens full-screen */
@media (max-width: 820px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 58px;
    height: 100dvh;
  }
  .rail {
    grid-row: 2; grid-column: 1;
    flex-direction: row; justify-content: space-around;
    padding: 0 8px; gap: 0;
    border-inline-end: none; border-top: 1px solid var(--border);
  }
  .rail .logo, .rail .me-avatar, .rail .spacer { display: none; }
  [data-tip]::after, [data-tip]::before { display: none; }   /* no hover on touch */

  .inbox  { grid-row: 1; grid-column: 1; border-inline-end: none; }
  .chat   { grid-row: 1; grid-column: 1; display: none; }
  .details { display: none; }
  .page   { grid-row: 1; grid-column: 1; padding: 18px 16px; }

  /* opening a conversation switches to a full-screen chat with a back button */
  .app.mobile-chat .inbox { display: none; }
  .app.mobile-chat .chat:not(.hidden) { display: flex; }
  .chat-back { display: inline-flex; }

  .msg { max-width: 85%; }
  .chat-body { padding: 16px 14px; }
  .composer { padding: 10px 12px 12px; }
  .chat-head { padding: 10px 12px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { padding: 20px 18px; }
  table.list th, table.list td { padding: 10px 10px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 22px; }
}

/* ---- transfer chat modal ---- */
.transfer-list { display:flex; flex-direction:column; gap:8px; max-height:320px; overflow-y:auto; margin:10px 0 4px; }
.tr-item {
  display:flex; align-items:center; gap:12px; padding:10px 14px; width:100%;
  border:1px solid var(--border, #e2e8f0); border-radius:12px; background:#fff; cursor:pointer;
  text-align:start; font-family:inherit; font-size:14px; color:inherit;
  transition:background .12s, border-color .12s, transform .12s;
}
.tr-item:hover:not(:disabled) { background:#f4f7ff; border-color:#bcd2ff; transform:translateY(-1px); }
.tr-item:disabled { opacity:.55; cursor:default; }
.tr-item .tr-meta { display:flex; flex-direction:column; line-height:1.45; flex:1; min-width:0; }
.tr-item .tr-meta b { font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tr-item .tr-role { font-size:12px; color:var(--text-2, #64748b); }
.tr-item .tr-go { color:#b6c2d4; display:flex; flex:none; }
.tr-item:hover:not(:disabled) .tr-go { color:#2a87ff; }
.tr-empty {
  text-align:center; color:var(--text-2, #64748b); padding:26px 14px;
  border:1.5px dashed #dbe3ee; border-radius:12px; display:flex; flex-direction:column;
  align-items:center; gap:8px; font-size:13.5px; line-height:1.7;
}
.tr-empty svg { opacity:.45; }
.tr-empty p { margin:0; max-width:300px; }

/* ---- Jawwal customer-purchases panel (conversation details) ---- */
.jawwal-panel { font-size: 13px; }
.jawwal-empty { display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center; padding: 16px 8px; line-height: 1.6; }
.jawwal-empty svg { opacity: .4; }
.jawwal-empty p { margin: 0; }
.jawwal-reg { display: flex; align-items: center; gap: 6px; color: #166534;
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 9px;
  padding: 7px 10px; margin-bottom: 10px; }
.jawwal-reg .muted { color: #4b8c5f; }
.jawwal-summary { display: flex; gap: 8px; margin-bottom: 12px; }
.jawwal-summary > div { flex: 1; text-align: center; background: var(--bg, #f6f8fb);
  border: 1px solid var(--border, #e2e8f0); border-radius: 10px; padding: 8px 4px; }
.jawwal-summary .n { display: block; font-weight: 700; font-size: 14px; }
.jawwal-summary .l { display: block; font-size: 11px; color: var(--text-2, #64748b); margin-top: 2px; }
.jawwal-list { display: flex; flex-direction: column; gap: 8px; }
.jawwal-pur { border: 1px solid var(--border, #e2e8f0); border-radius: 10px; padding: 9px 11px; }
.jp-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.jp-amt { font-weight: 700; }
.jp-date { font-size: 11.5px; color: var(--text-2, #64748b); }
.jp-sub { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.jp-cards { font-size: 11.5px; color: var(--text-2, #64748b); }
.jp-brands { margin-top: 5px; font-size: 12px; color: var(--text, #1f2937); unicode-bidi: plaintext; }

.jawwal-empty .btn-sm { margin-top: 4px; }

/* customer belongs to another store — warning in the purchases panel */
.jawwal-other {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center; padding: 16px 12px; line-height: 1.6;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; color: #92400e;
}
.jawwal-other svg { color: #d97706; }
.jawwal-other b { font-size: 13.5px; }
.jawwal-other p { margin: 0; font-size: 12.5px; }

/* ============================ app preloader ============================ */
.app-preloader {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; background: var(--bg);
  transition: opacity .45s ease, visibility .45s ease;
}
.app-preloader.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.preloader-logo {
  width: 64px; height: 64px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; background: var(--accent);
  box-shadow: 0 10px 30px rgba(42, 135, 255, .35);
  animation: pl-pulse 1.6s ease-in-out infinite;
}
@keyframes pl-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 10px 30px rgba(42, 135, 255, .35); }
  50% { transform: scale(1.08); box-shadow: 0 16px 40px rgba(42, 135, 255, .5); }
}
.preloader-bar {
  width: 168px; height: 4px; border-radius: 999px;
  background: var(--border); overflow: hidden; position: relative;
}
.preloader-bar > span {
  position: absolute; inset: 0; width: 40%; border-radius: 999px;
  background: var(--accent); animation: pl-slide 1.1s ease-in-out infinite;
}
@keyframes pl-slide {
  0% { inset-inline-start: -40%; }
  100% { inset-inline-start: 100%; }
}

/* ============================ theme toggle icon ============================ */
#theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] #theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] #theme-toggle .icon-sun { display: block; }

/* ============================ dark mode ============================ */
html[data-theme="dark"] {
  --bg: #0f141b;
  --panel: #161d27;
  --border: #28323f;
  --text: #e6eaf0;
  --text-2: #9aa6b4;
  --text-3: #6f7c8c;
  --accent-soft: #182a40;
  --accent-dark: #3b93ff;
  --bubble-in: #232d39;
  --bubble-out: #1d3a5b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
/* input / select / textarea fields */
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .field input:focus,
html[data-theme="dark"] .field select:focus,
html[data-theme="dark"] .field textarea:focus,
html[data-theme="dark"] .field.invalid input,
html[data-theme="dark"] .field.invalid select { background-color: #0c1118; }
html[data-theme="dark"] .inbox-head select,
html[data-theme="dark"] .d-row select { background-color: #0c1118; }
/* surfaces that hard-code a white background */
html[data-theme="dark"] .chip,
html[data-theme="dark"] .composer-box,
html[data-theme="dark"] .popover,
html[data-theme="dark"] .emoji-grid,
html[data-theme="dark"] .msg-actions,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .dt-toolbar,
html[data-theme="dark"] .dt-footer,
html[data-theme="dark"] .dt-btn,
html[data-theme="dark"] .session-row,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .card,
html[data-theme="dark"] .lang-switch button { background: var(--panel); }
/* themed accent-soft pills / agent message keep contrast */
html[data-theme="dark"] .msg.out { color: var(--text); }
html[data-theme="dark"] .note-item { background: #2a2613; color: var(--text); }
html[data-theme="dark"] .composer-warn,
html[data-theme="dark"] .readonly-note { background: #2a2613; color: #e3c989; }
html[data-theme="dark"] .conn-banner { color: #1a1300; }
