/* Developers Connect — design system (RTL-first, logical properties throughout) */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f6;
  --border: #e3e8ef;
  --border-strong: #cdd5df;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #8592a6;
  --primary: #0e7c66;
  --primary-600: #0b6a57;
  --primary-50: #e7f5f1;
  --primary-100: #cdebe3;
  --accent: #2563eb;
  --danger: #dc2626;
  --danger-50: #fef2f2;
  --warning: #d97706;
  --warning-50: #fffbeb;
  --success: #16a34a;
  --success-50: #f0fdf4;
  --info-50: #eff6ff;
  --sidebar: #0b1424;
  --sidebar-2: #13203a;
  --sidebar-text: #aab6ca;
  --bubble-in: #ffffff;
  --bubble-out: #dff3ec;
  --bubble-ai: #e8efff;
  --bubble-app: #fdf3dc;
  --chat-bg: #eef1f5;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .14);
  --font: "IBM Plex Sans Arabic", "Segoe UI", system-ui, -apple-system, Tahoma, sans-serif;
  --sidebar-w: 236px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220; --surface: #111a2b; --surface-2: #0f1727; --surface-3: #18233a; --border: #1f2c44; --border-strong: #2c3b57;
    --text: #e6ecf5; --text-2: #a8b4c7; --text-3: #6f7d94; --primary: #2bb594; --primary-600: #23a383; --primary-50: #0f2a26; --primary-100: #14403a;
    --danger-50: #2a1414; --warning-50: #2a2010; --success-50: #0f2a1a; --info-50: #0f1d33;
    --sidebar: #070d18; --sidebar-2: #101a2d; --bubble-in: #172238; --bubble-out: #12372f; --bubble-ai: #1a2748; --bubble-app: #352b14; --chat-bg: #0c1424;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1220; --surface: #111a2b; --surface-2: #0f1727; --surface-3: #18233a; --border: #1f2c44; --border-strong: #2c3b57;
  --text: #e6ecf5; --text-2: #a8b4c7; --text-3: #6f7d94; --primary: #2bb594; --primary-600: #23a383; --primary-50: #0f2a26; --primary-100: #14403a;
  --danger-50: #2a1414; --warning-50: #2a2010; --success-50: #0f2a1a; --info-50: #0f1d33;
  --sidebar: #070d18; --sidebar-2: #101a2d; --bubble-in: #172238; --bubble-out: #12372f; --bubble-ai: #1a2748; --bubble-app: #352b14; --chat-bg: #0c1424;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; }
h1 { font-size: 20px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.muted { color: var(--text-2); } .subtle { color: var(--text-3); } .small { font-size: 12px; } .tiny { font-size: 11px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; direction: ltr; unicode-bidi: embed; }
.ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }
.hidden, [hidden] { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.top { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- App shell ---------- */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar { width: var(--sidebar-w); flex-shrink: 0; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; color: #fff; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, #16a37f, #0e7c66); display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #fff; flex-shrink: 0; }
.brand-name { font-weight: 600; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 11px; color: var(--sidebar-text); opacity: .8; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #64748b; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--sidebar-text); font-size: 13.5px; margin-bottom: 1px; text-decoration: none; }
.nav a:hover { background: var(--sidebar-2); color: #fff; }
.nav a.active { background: var(--sidebar-2); color: #fff; box-shadow: inset 3px 0 0 #16a37f; }
[dir="rtl"] .nav a.active { box-shadow: inset -3px 0 0 #16a37f; }
.nav .badge { margin-inline-start: auto; }
.nav svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .06); }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 56px; flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 0 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .title { font-weight: 600; font-size: 15px; }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; }
.view { flex: 1; overflow: auto; min-height: 0; }
.page { padding: 22px; max-width: 1280px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.menu-toggle { display: none; }
.backdrop { display: none; }
@media (max-width: 900px) {
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; transform: translateX(-100%); transition: transform .2s; }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .app.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(2, 6, 23, .45); z-index: 30; }
  .menu-toggle { display: inline-flex; }
  .page { padding: 14px; }
}

/* ---------- Components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 14.5px; }
.card-head .actions { margin-inline-start: auto; display: flex; gap: 6px; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 500; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-600); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn.danger:hover { background: var(--danger-50); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn svg { width: 17px; height: 17px; }
.topbar .btn.ghost { color: var(--text-2); }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 11.5px; font-weight: 500; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.green { background: var(--success-50); color: var(--success); }
.badge.red { background: var(--danger-50); color: var(--danger); }
.badge.amber { background: var(--warning-50); color: var(--warning); }
.badge.blue { background: var(--info-50); color: var(--accent); }
.badge.teal { background: var(--primary-50); color: var(--primary); }
.badge.count { background: var(--primary); color: #fff; min-width: 20px; justify-content: center; }
.nav .badge.count { background: #16a37f; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--text-3); flex-shrink: 0; }
.dot.online { background: #22c55e; } .dot.away { background: #f59e0b; } .dot.busy { background: #ef4444; } .dot.offline { background: #94a3b8; }

label.field, .field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.field > span { color: var(--text-2); font-weight: 500; }
.field .hint { font-size: 12px; color: var(--text-3); }
.input, select.input, textarea.input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); outline: none; transition: border-color .12s, box-shadow .12s; }
textarea.input { height: auto; min-height: 90px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.input.sm { height: 32px; font-size: 13px; }
.input[readonly] { background: var(--surface-2); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 22px; transition: .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; inset-inline-start: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(16px); }
[dir="rtl"] .switch input:checked + span::before { transform: translateX(-16px); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field-error { color: var(--danger); font-size: 12px; }

table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: start; font-weight: 500; font-size: 12px; color: var(--text-3); padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 12px; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; font-weight: 500; white-space: nowrap; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

.stat { padding: 16px; }
.stat .label { color: var(--text-2); font-size: 12.5px; }
.stat .value { font-size: 26px; font-weight: 600; margin-top: 4px; letter-spacing: -.01em; }
.stat .meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.empty { padding: 40px 20px; text-align: center; color: var(--text-3); }
.empty svg { width: 42px; height: 42px; opacity: .5; margin-bottom: 8px; }
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; border: 1px solid; }
.alert.info { background: var(--info-50); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.alert.warn { background: var(--warning-50); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.alert.error { background: var(--danger-50); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }
.alert.success { background: var(--success-50); border-color: color-mix(in srgb, var(--success) 30%, transparent); }

.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--primary-100); color: var(--primary); display: grid; place-items: center; font-weight: 600; flex-shrink: 0; font-size: 14px; position: relative; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.avatar .dot { position: absolute; bottom: 0; inset-inline-end: 0; border: 2px solid var(--surface); width: 11px; height: 11px; }

.spinner { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 40px; }

/* Toasts & modal & dropdown */
.toasts { position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #0f172a; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow-lg); font-size: 13px; max-width: 360px; animation: pop .15s ease-out; }
.toast.error { background: #b91c1c; } .toast.success { background: #0e7c66; }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }
.modal-back { position: fixed; inset: 0; background: rgba(2, 6, 23, .5); z-index: 80; display: grid; place-items: center; padding: 16px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 560px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 820px; }
.modal-head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.modal-head h3 { font-size: 16px; }
.modal-head .close { margin-inline-start: auto; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.dropdown { position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 200px; padding: 6px; max-height: 360px; overflow-y: auto; }
.dropdown button, .dropdown a { display: flex; width: 100%; align-items: center; gap: 8px; text-align: start; padding: 8px 10px; border: 0; background: none; border-radius: 7px; cursor: pointer; font-size: 13.5px; color: var(--text); text-decoration: none; }
.dropdown button:hover, .dropdown a:hover { background: var(--surface-3); }
.dropdown hr { border: 0; border-top: 1px solid var(--border); margin: 5px 0; }

/* Notifications panel */
.notif-panel { position: fixed; top: 56px; inset-inline-end: 12px; width: 360px; max-width: calc(100vw - 24px); max-height: 70vh; z-index: 70; display: flex; flex-direction: column; }
.notif-item { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--primary-50); }
.notif-list { overflow-y: auto; }

/* ---------- Inbox ---------- */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr) 300px; height: 100%; min-height: 0; }
.inbox.no-details { grid-template-columns: 340px minmax(0, 1fr); }
.conv-list { border-inline-end: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.conv-filters { padding: 10px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.seg { display: flex; background: var(--surface-3); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { flex: 1; border: 0; background: none; padding: 5px 6px; border-radius: 6px; font-size: 12.5px; cursor: pointer; color: var(--text-2); white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 500; }
.seg .n { font-size: 11px; color: var(--text-3); }
.conv-items { flex: 1; overflow-y: auto; }
.conv-item { display: flex; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--border); cursor: pointer; position: relative; }
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--primary-50); }
.conv-item .name { font-weight: 600; font-size: 13.5px; }
.conv-item .time { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.conv-item .preview { font-size: 12.5px; color: var(--text-2); }
.conv-item.unread .preview { color: var(--text); font-weight: 500; }
.conv-item .meta { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.conv-item .pin { position: absolute; top: 8px; inset-inline-end: 8px; width: 12px; height: 12px; color: var(--text-3); }
.prio-urgent { box-shadow: inset 3px 0 0 var(--danger); } .prio-high { box-shadow: inset 3px 0 0 var(--warning); }
[dir="rtl"] .prio-urgent { box-shadow: inset -3px 0 0 var(--danger); } [dir="rtl"] .prio-high { box-shadow: inset -3px 0 0 var(--warning); }

.chat { display: flex; flex-direction: column; min-height: 0; background: var(--chat-bg); }
.chat-head { height: 60px; flex-shrink: 0; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; padding: 0 14px; }
.chat-head .who { min-width: 0; flex: 1; }
.chat-head .who .name { font-weight: 600; }
.chat-banner { padding: 7px 14px; font-size: 12.5px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); background: var(--surface); }
.chat-banner.ai { background: var(--bubble-ai); }
.chat-banner.mobile { background: var(--bubble-app); }
.chat-banner.warn { background: var(--warning-50); }
.messages { flex: 1; overflow-y: auto; padding: 16px 6%; display: flex; flex-direction: column; gap: 4px; }
.day-sep { align-self: center; background: var(--surface); color: var(--text-2); font-size: 11.5px; padding: 3px 10px; border-radius: 8px; margin: 10px 0; box-shadow: var(--shadow); }
.event-line { align-self: center; color: var(--text-3); font-size: 11.5px; margin: 4px 0; }
.msg { max-width: min(72%, 560px); padding: 7px 10px 5px; border-radius: 10px; background: var(--bubble-in); box-shadow: 0 1px 0.5px rgba(0, 0, 0, .08); position: relative; align-self: flex-start; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.out { align-self: flex-end; background: var(--bubble-out); }
.msg.out.ai { background: var(--bubble-ai); }
.msg.out.business_app { background: var(--bubble-app); }
.msg.out.automation { background: var(--bubble-ai); }
.msg .src { font-size: 11px; font-weight: 600; color: var(--primary); margin-bottom: 2px; display: flex; gap: 4px; align-items: center; }
.msg.ai .src, .msg.automation .src { color: var(--accent); }
.msg.business_app .src { color: var(--warning); }
.msg .body { white-space: pre-wrap; }
.msg .foot { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: 10.5px; color: var(--text-3); margin-top: 2px; }
.msg .tick { width: 15px; height: 15px; }
.msg .tick.read { color: #2b9df0; }
.msg.failed { border: 1px solid var(--danger); }
.msg .err { color: var(--danger); font-size: 11.5px; margin-top: 3px; }
.msg img.media, .msg video.media { max-width: 280px; max-height: 320px; border-radius: 7px; display: block; margin-bottom: 4px; cursor: zoom-in; }
.msg audio { width: 260px; max-width: 100%; }
.msg .doc { display: flex; align-items: center; gap: 8px; padding: 8px; background: rgba(0, 0, 0, .04); border-radius: 7px; margin-bottom: 4px; }
.msg .quote { border-inline-start: 3px solid var(--primary); background: rgba(0, 0, 0, .04); padding: 4px 8px; border-radius: 5px; font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.msg .buttons { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.msg .buttons span { border-top: 1px solid rgba(0, 0, 0, .08); text-align: center; color: var(--accent); padding-top: 4px; font-size: 13px; }
.msg .reaction { position: absolute; bottom: -10px; inset-inline-start: 8px; background: var(--surface); border-radius: 10px; padding: 0 4px; font-size: 13px; box-shadow: var(--shadow); }
.msg.history { opacity: .85; }
.composer { background: var(--surface); border-top: 1px solid var(--border); padding: 10px 12px; }
.composer.locked { text-align: center; color: var(--text-2); }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { flex: 1; resize: none; border: 1px solid var(--border-strong); border-radius: 20px; padding: 9px 14px; max-height: 160px; min-height: 40px; line-height: 1.45; outline: none; background: var(--surface); }
.composer textarea:focus { border-color: var(--primary); }
.composer .btn.icon { border-radius: 50%; width: 40px; height: 40px; }
.composer .attach-preview { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--surface-3); border-radius: 8px; margin-bottom: 8px; font-size: 12.5px; }
.composer .reply-preview { border-inline-start: 3px solid var(--primary); padding: 4px 10px; background: var(--surface-3); border-radius: 6px; margin-bottom: 8px; font-size: 12.5px; display: flex; gap: 8px; align-items: center; }
.composer .note-mode textarea { background: var(--warning-50); }
.composer .modes { display: flex; gap: 4px; margin-bottom: 6px; }
.composer .modes button { border: 0; background: none; font-size: 12px; padding: 3px 9px; border-radius: 6px; cursor: pointer; color: var(--text-2); }
.composer .modes button.active { background: var(--surface-3); color: var(--text); font-weight: 500; }
.chat-empty { flex: 1; display: grid; place-items: center; color: var(--text-3); text-align: center; padding: 20px; }

.details { border-inline-start: 1px solid var(--border); background: var(--surface); overflow-y: auto; }
.details section { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.details h4 { font-size: 12px; color: var(--text-3); font-weight: 500; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 6px 8px; font-size: 13px; }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.note { background: var(--warning-50); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; margin-bottom: 6px; }
.note .by { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.timeline { font-size: 12px; color: var(--text-2); display: flex; flex-direction: column; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; color: #fff; }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; opacity: .8; }

@media (max-width: 1280px) { .inbox { grid-template-columns: 300px minmax(0, 1fr); } .inbox .details { display: none; } .inbox.show-details .details { display: block; position: fixed; inset-block: 56px 0; inset-inline-end: 0; width: 320px; z-index: 35; box-shadow: var(--shadow-lg); } }
@media (max-width: 760px) {
  .inbox, .inbox.no-details { grid-template-columns: minmax(0, 1fr); }
  .inbox .chat { display: none; }
  .inbox.chat-open .conv-list { display: none; }
  .inbox.chat-open .chat { display: flex; }
  .messages { padding: 12px 10px; }
  .msg { max-width: 86%; }
  .inbox.show-details .details { width: 100%; }
}
.back-btn { display: none; }
@media (max-width: 760px) { .back-btn { display: inline-flex; } }

/* Auth pages */
.auth-wrap { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-side { background: radial-gradient(circle at 20% 10%, #16a37f 0, transparent 45%), linear-gradient(160deg, #0b1424, #10294a); color: #e2e8f0; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h1 { font-size: 30px; color: #fff; margin: 18px 0 10px; }
.auth-side ul { padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; color: #cbd5e1; }
.auth-form { display: grid; place-items: center; padding: 32px 18px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 22px; margin-bottom: 6px; }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: minmax(0, 1fr); } .auth-side { display: none; } }

.code-block { background: #0b1220; color: #e2e8f0; padding: 12px 14px; border-radius: 8px; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; direction: ltr; text-align: left; overflow-x: auto; white-space: pre; }
.steps { display: flex; flex-direction: column; gap: 0; }
.step { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.step:last-child { border-bottom: 0; }
.step .ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: 11px; color: #fff; background: var(--text-3); }
.step.success .ic { background: var(--success); } .step.failed .ic { background: var(--danger); } .step.skipped .ic, .step.info .ic { background: var(--accent); }
.bar-chart { display: flex; align-items: flex-end; gap: 3px; height: 170px; padding-top: 10px; }
.bar-chart .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 1px; min-width: 3px; position: relative; }
.bar-chart .b span { display: block; border-radius: 2px 2px 0 0; }
.bar-chart .b .in { background: var(--primary); } .bar-chart .b .out { background: #93c5fd; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 5px; vertical-align: -1px; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .85); z-index: 120; display: grid; place-items: center; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 92vh; }
.view.fill { overflow: hidden; }
.view.fill > .inbox { height: 100%; }
.suggestion { margin-bottom: 8px; padding: 8px 10px; border-radius: 8px; background: var(--bubble-ai); font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.tpl-item { padding: 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; margin-bottom: 8px; }
.tpl-item:hover, .tpl-item.active { border-color: var(--primary); background: var(--primary-50); }
/* default icon size (inline SVG icons from DC.icon) */
svg { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }
.stat svg { width: 20px; height: 20px; color: var(--text-3); }
.empty svg { width: 42px; height: 42px; }
.chat-empty svg { width: 48px; height: 48px; opacity: .45; margin-bottom: 6px; }
a:has(> .card) { color: inherit; text-decoration: none; display: block; }
a:has(> .card):hover .card { border-color: var(--border-strong); }
.conv-item .pin { width: 12px; height: 12px; }
.msg .tick { width: 15px; height: 15px; }
.chat-head .who .small { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }
.chat-head .who .small .badge { flex-shrink: 0; }
@media (max-width: 1500px) { .chat-head .hide-sm { display: none; } .chat-head .btn.sm { padding: 0 8px; } }

/* admin_b */
.hbar { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.hbar > i { display: block; height: 100%; border-radius: 4px; }
.rep-split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .rep-split { grid-template-columns: minmax(0, 1fr); } }
.rep-chart .b { height: 100%; }
.rep-chart .pair { display: flex; align-items: flex-end; gap: 1px; height: 100%; }
.rep-chart .pair span { flex: 1; min-width: 1px; }
.rep-chart .b:hover .pair span { opacity: .75; }
.aud-caret svg { width: 14px; height: 14px; color: var(--text-3); transition: transform .12s; }
tr.open .aud-caret svg { transform: rotate(90deg); }
[dir="rtl"] tr.open .aud-caret svg { transform: rotate(-90deg); }
label.switch { display: inline-block; vertical-align: middle; }

/* impersonation banner */
.impersonation-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: #b45309; color: #fff; font-size: 13px; font-weight: 500; flex-shrink: 0; }
.impersonation-bar .btn { background: #fff; color: #92400e; border-color: #fff; }
