/* ============================================================================
   Intercom Panel — Design System
   A modern, warm, professional workspace UI (light theme, indigo accent).
   ============================================================================ */

:root {
  --accent: #5B5FEF;
  --accent-dark: #4548c9;
  --accent-light: #eef0ff;
  --accent-soft: #e4e6ff;
  --success: #10B981;
  --success-soft: #e7f9f2;
  --danger: #EF4444;
  --danger-soft: #fdecec;
  --warning: #F59E0B;

  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --border: #e6e8f2;
  --border-strong: #d8dbec;

  --text-1: #171a2b;
  --text-2: #4b4f6b;
  --text-3: #8c90ab;
  --text-inverse: #ffffff;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(23, 26, 43, 0.06);
  --shadow-md: 0 8px 24px rgba(23, 26, 43, 0.08);
  --shadow-lg: 0 20px 48px rgba(23, 26, 43, 0.18);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", Helvetica, Arial, sans-serif;

  --rail-w: 84px;
  --list-w: 340px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
  font-size: 14.5px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
input, textarea, select { font-family: inherit; font-size: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d3d6e8; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #b9bdd9; }

.hidden { display: none !important; }
.svg-icon, svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------------------
   Buttons & form controls
   --------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text-1);
  font-weight: 600;
  font-size: 14px;
  transition: all .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-outline { background: transparent; border-color: var(--border-strong); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); box-shadow: none; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; border-radius: var(--radius-pill); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field span, label > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=tel], input[type=file], textarea, select {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-1);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
textarea { resize: vertical; }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 16px; }
.alert-error { background: var(--danger-soft); color: #b91c1c; }
.alert-success { background: var(--success-soft); color: #067a55; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; }
.badge-accent { background: var(--accent-soft); color: var(--accent-dark); }
.badge-success { background: var(--success-soft); color: #067a55; }
.badge-danger { background: var(--danger-soft); color: #b91c1c; }
.badge-muted { background: #eef0f6; color: var(--text-3); }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite; }
.spinner-dark { border-color: var(--border-strong); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------------------
   Avatars
   --------------------------------------------------------------------------- */
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px;
  flex-shrink: 0; position: relative; overflow: hidden;
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: 12.5px; }
.avatar-lg { width: 76px; height: 76px; font-size: 26px; }
.avatar-xl { width: 108px; height: 108px; font-size: 36px; }
.avatar-group { position: relative; width: 42px; height: 42px; }
.presence-dot {
  position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--text-3); border: 2.5px solid var(--surface);
}
.presence-dot.online { background: var(--success); }
.presence-dot.away { background: var(--warning); }

/* ---------------------------------------------------------------------------
   Auth pages (login)
   --------------------------------------------------------------------------- */
.auth-body {
  background: radial-gradient(circle at 15% 15%, #7478ff 0%, transparent 45%),
              radial-gradient(circle at 85% 85%, #ff8fd0 0%, transparent 40%),
              linear-gradient(135deg, #5B5FEF 0%, #3f42b8 100%);
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
}
.auth-brand { text-align: center; margin-bottom: 28px; }
.brand-mark {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 20px; letter-spacing: .5px;
  box-shadow: 0 10px 24px rgba(91,95,239,.35);
}
.auth-brand h1 { font-size: 21px; margin: 0 0 6px; }
.auth-brand p { color: var(--text-3); font-size: 13.5px; margin: 0; }
.auth-form label { display: block; margin-bottom: 16px; }
.auth-form label span { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.auth-form input { width: 100%; }
.auth-footnote { text-align: center; font-size: 12.5px; color: var(--text-3); margin: 20px 0 0; }

/* ---------------------------------------------------------------------------
   App shell
   --------------------------------------------------------------------------- */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

.rail {
  width: var(--rail-w); flex-shrink: 0;
  background: linear-gradient(180deg, #201f45, #14132c);
  display: flex; flex-direction: column; align-items: center;
  padding: 18px 0; gap: 6px;
}
.rail-logo {
  width: 40px; height: 40px; border-radius: 12px; margin-bottom: 14px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
}
.rail-btn {
  width: 60px; padding: 9px 0 7px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border-radius: var(--radius-sm); color: rgba(255,255,255,.55);
  font-size: 10.5px; font-weight: 600; transition: all .15s ease;
}
.rail-btn svg { width: 21px; height: 21px; }
.rail-btn:hover { color: #fff; background: rgba(255,255,255,.08); }
.rail-btn.active { color: #fff; background: rgba(255,255,255,.14); }
.rail-spacer { flex: 1; }
.rail-avatar {
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 11px; overflow: hidden;
}
.rail-avatar img { width: 100%; height: 100%; object-fit: cover; }

.page-content { flex: 1; min-width: 0; display: flex; overflow: hidden; }

/* ---------------------------------------------------------------------------
   Chat layout
   --------------------------------------------------------------------------- */
.chat-layout { display: flex; width: 100%; height: 100%; }

.conv-list {
  width: var(--list-w); flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
}
.conv-list-head { padding: 20px 18px 12px; }
.conv-list-head h1 { font-size: 19px; margin: 0 0 14px; }
.conv-search { position: relative; margin-bottom: 12px; }
.conv-search input { width: 100%; padding-left: 38px; }
.conv-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); }

.conv-tabs { display: flex; gap: 6px; padding: 0 12px 10px; }
.conv-tab { flex: 1; text-align: center; padding: 7px 4px; border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 700; color: var(--text-3); }
.conv-tab.active { background: var(--accent-light); color: var(--accent-dark); }

.conv-items { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.conv-item {
  display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: var(--radius-md);
  margin-bottom: 2px; position: relative;
}
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--accent-light); }
.conv-item-body { flex: 1; min-width: 0; }
.conv-item-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.conv-item-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item-time { font-size: 11px; color: var(--text-3); flex-shrink: 0; }
.conv-item-preview { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-top: 2px; }
.conv-item-snippet { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-unread {
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: var(--radius-pill);
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.conv-item-icon-badge {
  position: absolute; left: 30px; bottom: 6px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface); display: flex; align-items: center; justify-content: center;
}
.conv-item-icon-badge svg { width: 9px; height: 9px; stroke: #fff; }
.conv-empty { padding: 40px 24px; text-align: center; color: var(--text-3); font-size: 13px; }

.conv-new-btn {
  margin: 0 12px 12px; display: flex; align-items: center; justify-content: center; gap: 8px;
}

.chat-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.chat-placeholder { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-3); gap: 10px; }
.chat-placeholder svg { width: 64px; height: 64px; opacity: .35; }

.chat-header {
  display: flex; align-items: center; gap: 12px; padding: 14px 22px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.chat-header-info { flex: 1; min-width: 0; }
.chat-header-name { font-weight: 700; font-size: 15px; }
.chat-header-sub { font-size: 12px; color: var(--text-3); }
.chat-header-actions { display: flex; gap: 6px; }
.mobile-back { display: none; }

.messages { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 2px; }
.date-sep { text-align: center; margin: 18px 0 12px; font-size: 11.5px; font-weight: 700; color: var(--text-3); position: relative; }
.date-sep span { background: var(--bg); padding: 0 12px; position: relative; z-index: 1; }
.date-sep::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border-strong); }

.msg-row { display: flex; gap: 10px; margin: 3px 0; max-width: 72%; }
.msg-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-row .avatar { margin-top: auto; }
.msg-row.grouped .avatar { visibility: hidden; }
.msg-col { display: flex; flex-direction: column; gap: 2px; }
.msg-sender { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 2px; }
.msg-bubble {
  background: var(--surface); padding: 10px 14px; border-radius: 16px;
  box-shadow: var(--shadow-sm); font-size: 14px; line-height: 1.45; word-wrap: break-word;
  white-space: pre-wrap;
}
.msg-row.mine .msg-bubble { background: var(--accent); color: #fff; }
.msg-row:not(.mine) .msg-bubble { border-bottom-left-radius: 4px; }
.msg-row.mine .msg-bubble { border-bottom-right-radius: 4px; }
.msg-meta { font-size: 10.5px; color: var(--text-3); margin-top: 3px; display: flex; gap: 6px; }
.msg-row.mine .msg-meta { justify-content: flex-end; }
.msg-system { align-self: center; font-size: 12px; color: var(--text-3); background: var(--surface-2); padding: 5px 12px; border-radius: var(--radius-pill); margin: 8px 0; }

.attachment-card {
  display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,.03);
  padding: 9px 12px; border-radius: 12px; margin-top: 2px; min-width: 220px; max-width: 280px;
}
.msg-row.mine .attachment-card { background: rgba(255,255,255,.16); }
.attachment-icon {
  width: 38px; height: 38px; border-radius: 10px; background: var(--accent-light); color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; flex-shrink: 0;
}
.msg-row.mine .attachment-icon { background: rgba(255,255,255,.22); color: #fff; }
.attachment-info { min-width: 0; flex: 1; }
.attachment-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-size { font-size: 11px; opacity: .75; }
.attachment-download { flex-shrink: 0; opacity: .85; }
.attachment-download svg { width: 16px; height: 16px; }
.attachment-image { max-width: 260px; border-radius: 12px; overflow: hidden; margin-top: 2px; cursor: pointer; }
.attachment-image img { width: 100%; display: block; }
.attachment-video { max-width: 300px; border-radius: 12px; overflow: hidden; margin-top: 2px; }
.attachment-video video { width: 100%; display: block; background: #000; }

.typing-indicator { display: flex; gap: 4px; padding: 4px 0; }
.typing-indicator span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: bounce 1.2s infinite; }
.typing-indicator span:nth-child(2) { animation-delay: .15s; }
.typing-indicator span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

.composer { padding: 14px 22px 18px; background: var(--surface); border-top: 1px solid var(--border); flex-shrink: 0; }
.composer-pending { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.composer-pending-item {
  display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border);
  padding: 6px 10px; border-radius: var(--radius-sm); font-size: 12.5px;
}
.composer-pending-item button { color: var(--text-3); font-weight: 700; }
.composer-row { display: flex; align-items: flex-end; gap: 10px; }
.composer textarea {
  flex: 1; border-radius: 20px; padding: 12px 16px; max-height: 140px; min-height: 44px;
}
.composer-btn {
  width: 42px; height: 42px; border-radius: 50%; background: var(--surface-2); color: var(--text-2);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.composer-btn svg { width: 19px; height: 19px; }
.composer-btn:hover { background: var(--accent-light); color: var(--accent-dark); }
.composer-send { background: var(--accent); color: #fff; }
.composer-send:hover { background: var(--accent-dark); color: #fff; }
.composer-send:disabled { opacity: .5; }

/* ---------------------------------------------------------------------------
   Modals
   --------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20, 19, 44, .45); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 460px;
  box-shadow: var(--shadow-lg); max-height: 86vh; display: flex; flex-direction: column;
}
.modal-lg { max-width: 620px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 6px; }
.modal-head h2 { font-size: 17px; margin: 0; }
.modal-close { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.modal-close:hover { background: var(--surface-2); }
.modal-body { padding: 16px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; }

.picker-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.picker-item { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: var(--radius-sm); }
.picker-item:hover { background: var(--surface-2); }
.picker-item label { flex: 1; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.picker-name { font-weight: 600; font-size: 13.5px; }
.picker-sub { font-size: 11.5px; color: var(--text-3); }

/* ---------------------------------------------------------------------------
   Generic app page (profile / calls history / admin) built inside .page-content
   --------------------------------------------------------------------------- */
.simple-page { flex: 1; overflow-y: auto; padding: 32px 40px; }
.simple-page-inner { max-width: 880px; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 22px; margin: 0 0 4px; }
.page-head p { color: var(--text-3); font-size: 13.5px; margin: 0; }

.card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 24px; margin-bottom: 20px; }
.card h3 { margin: 0 0 4px; font-size: 15.5px; }
.card-sub { color: var(--text-3); font-size: 12.5px; margin: 0 0 18px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--surface); border-radius: var(--radius-md); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.stat-card .stat-value { font-size: 26px; font-weight: 800; }
.stat-card .stat-label { font-size: 12.5px; color: var(--text-3); font-weight: 600; }

table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); padding: 0 12px 10px; font-weight: 700; }
tbody td { padding: 12px; border-top: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
tbody tr:hover { background: var(--surface-2); }
.table-user { display: flex; align-items: center; gap: 10px; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; }
.table-wrap { overflow-x: auto; }

.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.list-row-body { flex: 1; min-width: 0; }
.list-row-title { font-weight: 700; font-size: 14px; }
.list-row-sub { font-size: 12px; color: var(--text-3); }

.tab-strip { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-strip button { padding: 10px 16px; font-weight: 700; font-size: 13.5px; color: var(--text-3); border-bottom: 2px solid transparent; }
.tab-strip button.active { color: var(--accent); border-color: var(--accent); }

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty-state svg { width: 48px; height: 48px; opacity: .3; margin-bottom: 10px; }

/* ---------------------------------------------------------------------------
   Call overlay
   --------------------------------------------------------------------------- */
.call-overlay {
  position: fixed; inset: 0; background: rgba(10, 9, 28, .82); z-index: 500;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.call-panel { width: 100%; max-width: 880px; }
.call-incoming { text-align: center; color: #fff; }
.call-avatar-ring { display: inline-flex; padding: 10px; border-radius: 50%; margin-bottom: 18px; animation: pulse-ring 1.6s infinite; }
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(91,95,239,.55); }
  70% { box-shadow: 0 0 0 24px rgba(91,95,239,0); }
  100% { box-shadow: 0 0 0 0 rgba(91,95,239,0); }
}
.call-incoming h2 { font-size: 24px; margin: 0 0 6px; }
.call-incoming p { color: rgba(255,255,255,.65); margin: 0 0 30px; }
.call-actions { display: flex; gap: 26px; justify-content: center; }
.call-btn { width: 62px; height: 62px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.call-btn svg { width: 24px; height: 24px; stroke: #fff; }
.call-btn-accept { background: var(--success); }
.call-btn-decline { background: var(--danger); }
.call-btn:hover { transform: scale(1.06); }

.call-active { color: #fff; }
.call-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font-weight: 700; }
.call-timer { color: rgba(255,255,255,.6); font-weight: 600; font-variant-numeric: tabular-nums; }
.call-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.call-tile { position: relative; background: #1b1a3a; border-radius: var(--radius-md); overflow: hidden; aspect-ratio: 4/3; }
.call-tile video { width: 100%; height: 100%; object-fit: cover; }
.call-tile.audio-only { display: flex; align-items: center; justify-content: center; }
.call-tile-name { position: absolute; left: 10px; bottom: 8px; font-size: 12px; background: rgba(0,0,0,.45); padding: 3px 9px; border-radius: var(--radius-pill); }
.call-tile-muted { position: absolute; right: 10px; bottom: 8px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; }
.call-tile-muted svg { width: 12px; height: 12px; stroke: #fff; }
.call-toolbar { display: flex; justify-content: center; gap: 14px; }
.call-tool { width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; display: flex; align-items: center; justify-content: center; }
.call-tool svg { width: 20px; height: 20px; }
.call-tool.muted { background: #fff; color: #1b1a3a; }
.call-tool-end { background: var(--danger); }
.call-tool:hover { background: rgba(255,255,255,.22); }
.call-tool-end:hover { background: #d63c3c; }

/* ---------------------------------------------------------------------------
   Toasts
   --------------------------------------------------------------------------- */
.toast-stack { position: fixed; top: 18px; right: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 600; }
.toast {
  background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  padding: 12px 16px; font-size: 13px; min-width: 220px; border-left: 4px solid var(--accent);
  animation: toast-in .2s ease;
}
.toast.error { border-color: var(--danger); }
.toast.success { border-color: var(--success); }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */
@media (max-width: 880px) {
  :root { --rail-w: 64px; --list-w: 100%; }
  .rail { position: fixed; bottom: 0; left: 0; right: 0; width: 100%; height: 60px; flex-direction: row; z-index: 100;
          background: #14132c; padding: 6px 4px; }
  .rail-logo { display: none; }
  .rail-btn { width: auto; flex: 1; }
  .rail-btn span:last-child { font-size: 9px; }
  .rail-spacer { display: none; }
  .app-shell { flex-direction: column; }
  .page-content { padding-bottom: 60px; height: calc(100vh - 60px); }

  .chat-layout { position: relative; }
  .conv-list { width: 100%; position: absolute; inset: 0; z-index: 5; transition: transform .2s ease; }
  .chat-panel { width: 100%; position: absolute; inset: 0; transform: translateX(100%); transition: transform .2s ease; }
  .chat-layout.conv-open .conv-list { transform: translateX(-100%); }
  .chat-layout.conv-open .chat-panel { transform: translateX(0); }
  .mobile-back { display: flex; }
  .msg-row { max-width: 88%; }
  .simple-page { padding: 20px; }
  .call-grid { grid-template-columns: 1fr; }
}
