:root {
  color-scheme: light;
  --canvas: #f4f5f7;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --surface-hover: #f3f4f6;
  --text: #3f4654;
  --text-strong: #111827;
  --muted: #98a1b0;
  --border: #ecedf1;
  --border-strong: #dfe2e8;
  --primary: #2f6fed;
  --primary-hover: #2560d8;
  --primary-soft: #eef4ff;
  --primary-text: #2f6fed;
  --success: #17a26b;
  --success-soft: #e6f7ef;
  --warning: #c67f18;
  --warning-soft: #fdf3e2;
  --danger: #d94a55;
  --danger-soft: #fdedee;
  --rail: #ffffff;
  --rail-text: #667085;
  --rail-active: var(--primary-soft);
  --incoming: #f1f2f5;
  --incoming-text: var(--text-strong);
  --outgoing: #dfeaff;
  --outgoing-text: #17325e;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .05);
  --shadow-lift: 0 12px 32px rgba(16, 24, 40, .12);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #14161a;
  --surface: #1c1f24;
  --surface-soft: #21242a;
  --surface-hover: #272b32;
  --text: #d3d7de;
  --text-strong: #f5f7fa;
  --muted: #8b93a1;
  --border: #2c3038;
  --border-strong: #383d47;
  --primary: #5b8def;
  --primary-hover: #6f9cf5;
  --primary-soft: #1f2a3d;
  --primary-text: #8db2ff;
  --success: #38c78d;
  --success-soft: #163226;
  --warning: #e0aa4d;
  --warning-soft: #37301f;
  --danger: #ef7a83;
  --danger-soft: #3d2427;
  --rail: #1a1d21;
  --rail-text: #99a1af;
  --rail-active: #253048;
  --incoming: #282c33;
  --incoming-text: var(--text-strong);
  --outgoing: #2b3d5e;
  --outgoing-text: #e6efff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .22);
  --shadow-lift: 0 14px 36px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; }
body { margin: 0; overflow: hidden; background: var(--canvas); color: var(--text); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

.kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .9px;
}

.logo-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(145deg, #5b8def, var(--primary));
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(47, 111, 237, .26);
}

.logo-mark.small { width: 34px; height: 34px; border-radius: 11px; font-size: 15px; }

.avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(145deg, #a8c3f7, var(--primary));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.avatar.large { width: 40px; height: 40px; }
.avatar.xl { width: 72px; height: 72px; font-size: 22px; }
.avatar.has-image { background: var(--surface-hover); }
.avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }

.btn, .icon-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}

.btn { padding: 0 16px; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.secondary, .icon-button { border-color: var(--border-strong); background: var(--surface); color: var(--text); }
.btn.secondary:hover, .icon-button:hover { border-color: var(--muted); background: var(--surface-hover); }
.btn.wide { width: 100%; }
.icon-button { min-width: 38px; padding: 0 11px; }
.btn:disabled, .icon-button:disabled { cursor: not-allowed; opacity: .45; }

label { display: grid; gap: 6px; color: var(--text); font-size: 12px; font-weight: 600; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}
input, select { min-height: 40px; padding: 0 12px; }
textarea { padding: 10px 12px; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* Login */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 12%, rgba(47,111,237,.10), transparent 34%),
    radial-gradient(circle at 82% 88%, rgba(47,111,237,.08), transparent 32%),
    var(--canvas);
}

.login-card {
  width: min(420px, 100%);
  padding: 40px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-logo { width: 176px; margin-bottom: 22px; }
.login-card h1 { margin: 6px 0 8px; color: var(--text-strong); font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.login-card > .muted { margin: 0 0 26px; font-size: 14px; line-height: 1.6; }
.login-card form { display: grid; gap: 16px; }
.login-hint { display: block; margin-top: 20px; color: var(--muted); font-size: 12px; }
.form-error { margin: -4px 0 0; color: var(--danger); font-size: 12px; }

/* Shell and navigation */
.app-shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  background: var(--canvas);
}

.sidebar {
  z-index: 20;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  border-right: 1px solid var(--border);
  background: var(--rail);
  color: var(--rail-text);
}

.brand { display: grid; gap: 4px; padding: 0 6px 2px; color: inherit; text-decoration: none; }
.brand-logo { width: 104px; height: auto; display: block; }
.brand-mark { width: 30px; height: 30px; display: none; object-fit: contain; }
.brand-tagline { color: var(--muted); font-size: 10px; }
.navigation { width: 100%; display: grid; gap: 3px; margin-top: 26px; }

.nav-item {
  position: relative;
  width: 100%;
  min-height: 42px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--rail-text);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: background .15s, color .15s;
}

.nav-item:hover { color: var(--text-strong); background: var(--surface-hover); }
.nav-item.active { color: var(--primary-text); background: var(--rail-active); font-weight: 600; }
.nav-icon { height: 20px; flex: 0 0 auto; display: grid; place-items: center; }
.nav-icon svg { width: 19px; height: 19px; }
.nav-item > span:nth-child(2) { flex: 1; min-width: 0; }
.nav-item b {
  flex: 0 0 auto;
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 20px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

.sidebar-bottom { width: 100%; display: grid; gap: 8px; margin-top: auto; }
.channel-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}
.channel-card i { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.channel-card span { min-width: 0; display: grid; gap: 1px; }
.channel-card small { color: var(--muted); font-size: 11px; }
.channel-card strong { overflow: hidden; color: var(--text-strong); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.channel-card.offline i, .channel-card.warning i { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.profile-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 8px 2px;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
  text-align: left;
}
.profile-button > span:last-child { min-width: 0; display: grid; gap: 1px; }
.profile-button strong { overflow: hidden; color: var(--text-strong); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.profile-button small { color: var(--muted); font-size: 11px; text-transform: capitalize; }
.profile-button .avatar { width: 34px; height: 34px; }

.main { min-width: 0; min-height: 0; overflow: hidden; }
.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.topbar h1 { margin: 0; color: var(--text-strong); font-size: 20px; font-weight: 700; letter-spacing: -.4px; }
.topbar .kicker { display: none; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.metrics { display: none; }

/* Main messaging workspace */
.workspace {
  height: calc(100vh - 68px);
  min-height: 540px;
  display: grid;
  grid-template-columns: 336px minmax(420px, 1fr) 300px;
  gap: 16px;
  padding: 16px;
  overflow: hidden;
  background: var(--canvas);
}

.conversation-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-header {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 8px;
}
.panel-header h2 { margin: 0; color: var(--text-strong); font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.panel-header small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }

.search-box {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 2px 18px 12px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: var(--surface);
  color: var(--muted);
  transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search-box svg { width: 17px; height: 17px; }
.search-box input { min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--text); font-size: 13px; box-shadow: none; }
.search-box input:focus { box-shadow: none; }

.filters { display: flex; gap: 4px; margin: 0 18px; padding: 0 0 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button {
  position: relative;
  flex: 0 0 auto;
  padding: 8px 7px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: color .15s;
}
.filters button:hover { color: var(--text-strong); }
.filters button.active { color: var(--primary-text); font-weight: 600; }
.filters button.active::after {
  content: "";
  position: absolute;
  inset: auto 4px -3px;
  height: 2px;
  border-radius: 2px;
  background: var(--primary);
}

.conversation-list { min-height: 0; flex: 1; overflow-y: auto; padding: 8px; }
.conversation-list::-webkit-scrollbar, .messages::-webkit-scrollbar, .details-panel::-webkit-scrollbar { width: 6px; }
.conversation-list::-webkit-scrollbar-thumb, .messages::-webkit-scrollbar-thumb, .details-panel::-webkit-scrollbar-thumb { border-radius: 10px; background: var(--border-strong); }

.conversation-item {
  width: 100%;
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 10px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background .15s;
}
.conversation-item:hover { background: var(--surface-hover); }
.conversation-item.selected { background: var(--primary-soft); }
.conversation-item.selected .conversation-line strong { color: var(--primary-text); }
.conversation-copy { min-width: 0; flex: 1; }
.conversation-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.conversation-line strong { overflow: hidden; color: var(--text-strong); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.conversation-line time { flex: 0 0 auto; color: var(--muted); font-size: 11px; }
.preview { display: block; margin: 3px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.conversation-meta { display: flex; align-items: center; min-height: 14px; margin-top: 3px; }
.conversation-meta em { overflow: hidden; color: var(--muted); font-size: 11px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.conversation-meta b { flex: 0 0 auto; margin-left: auto; min-width: 19px; padding: 2px 6px; border-radius: 20px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }

/* Chat */
.chat-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.chat-header {
  height: 66px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.contact-title { min-width: 0; display: flex; align-items: center; gap: 11px; }
.contact-title > span:last-child { min-width: 0; }
.contact-title h2 { margin: 0; overflow: hidden; color: var(--text-strong); font-size: 15px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.contact-title small { display: block; margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.mobile-back { display: none; min-width: 34px; height: 34px; padding: 0; border: 0; border-radius: 10px; background: var(--surface-hover); color: var(--text); }
.mobile-back svg { width: 18px; }
.connection-pill, .table-status {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.connection-pill.pending { background: var(--warning-soft); color: var(--warning); }
.connection-pill.closed { background: var(--surface-hover); color: var(--muted); }

.messages {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  background: var(--surface);
}
.day-divider { display: flex; justify-content: center; margin: 18px 0 12px; }
.day-divider span {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.message-row:first-of-type + .day-divider, .day-divider:first-child { margin-top: 4px; }

.message-row { display: flex; margin: 10px 0; }
.message-row.out { justify-content: flex-end; }
.message-bubble {
  position: relative;
  max-width: min(72%, 540px);
  padding: 11px 14px 8px;
  border-radius: 4px 14px 14px 14px;
  background: var(--incoming);
}
.message-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height .15s, opacity .15s, margin .15s;
}
.message-bubble:hover .message-actions, .message-bubble:focus-within .message-actions { max-height: 26px; margin-bottom: 6px; opacity: 1; }
.message-actions button {
  padding: 3px 8px;
  border: 0;
  border-radius: 6px;
  background: rgba(255,255,255,.7);
  color: var(--primary-text);
  font-size: 11px;
  font-weight: 600;
}
.message-row.out .message-actions button { background: rgba(255,255,255,.7); color: var(--primary-text); }
.message-row.out .message-bubble { border-radius: 14px 4px 14px 14px; background: var(--outgoing); }
.message-bubble p { margin: 0; color: var(--incoming-text); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.message-row.out .message-bubble p { color: var(--outgoing-text); }
.message-bubble small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; text-align: right; }
.message-row.out .message-bubble small { color: color-mix(in srgb, var(--outgoing-text) 55%, transparent); }
.message-image, video { display: block; max-width: 100%; max-height: 330px; margin-bottom: 8px; border-radius: 10px; }
audio { width: min(320px, 100%); height: 38px; }
.file-chip {
  display: inline-flex;
  align-items: center;
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--primary-text);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
}

/* Reply composer bar and quoted excerpts */
.reply-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
}
.reply-bar[hidden] { display: none; }
.reply-bar-copy {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
  padding-left: 10px;
  border-left: 3px solid var(--primary);
}
.reply-bar-copy small { color: var(--primary-text); font-size: 11px; font-weight: 600; }
.reply-bar-copy strong { overflow: hidden; color: var(--text); font-size: 12px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar .icon-button { min-width: 30px; min-height: 30px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 13px; }
.reply-bar .icon-button:hover { background: var(--surface-hover); color: var(--text-strong); }

.quote-block {
  width: 100%;
  display: grid;
  gap: 2px;
  margin: 0 0 7px;
  padding: 7px 10px;
  border: 0;
  border-left: 3px solid var(--primary);
  border-radius: 5px;
  background: rgba(255, 255, 255, .55);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.quote-block small { color: var(--primary-text); font-size: 11px; font-weight: 600; }
.quote-block span { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
:root[data-theme="dark"] .quote-block { background: rgba(255, 255, 255, .07); }

.pin-flag { margin-right: 5px; font-size: 10px; font-style: normal; }
.conversation-item.pinned { background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }
.conversation-item.pinned:hover { background: var(--primary-soft); }
.conversation-item.pinned.selected { background: var(--primary-soft); }

.composer {
  position: relative;
  min-height: 70px;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.composer textarea {
  min-height: 44px;
  max-height: 120px;
  padding: 12px 14px;
  resize: none;
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  background: var(--surface);
  font-size: 13px;
}
.composer .attach { width: 40px; min-width: 40px; height: 40px; padding: 0; border: 0; background: transparent; color: var(--muted); }
.composer .attach:hover { background: var(--surface-hover); color: var(--primary-text); }
.composer .send { min-width: 44px; height: 44px; padding: 0 16px; border-radius: 22px; }
.composer .send svg { width: 17px; height: 17px; }
.composer small { position: absolute; left: 62px; bottom: 0; color: var(--muted); font-size: 11px; }

/* Information panel */
.details-panel {
  min-height: 0;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.details-panel > .panel-header { min-height: 58px; padding: 16px 18px 10px; border-bottom: 1px solid var(--border); }
.details-panel > .panel-header h2 { font-size: 15px; }
.contact-card { padding: 20px 16px; border-bottom: 1px solid var(--border); text-align: center; }
.contact-card .avatar { margin: 0 auto 12px; }
.contact-card h3 { margin: 0; color: var(--text-strong); font-size: 15px; font-weight: 600; }
.contact-card p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.detail-section { padding: 16px 18px; border-bottom: 1px solid var(--border); display: grid; gap: 12px; }
.detail-section:last-child { border-bottom: 0; }
.detail-section select { font-size: 12px; }
.detail-row { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.detail-row strong { color: var(--text); font-weight: 600; text-align: right; }

.empty-state {
  min-height: 160px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}
.empty-state strong { color: var(--text-strong); font-size: 14px; font-weight: 600; }
.empty-state span { font-size: 12px; }
.empty-state.compact { height: auto; padding: 40px 16px; }

/* Secondary views */
.content-view { height: calc(100vh - 68px); padding: 16px; overflow: auto; }
.table-card { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.table-card .panel-header { padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.table-card table { width: 100%; border-collapse: collapse; }
.table-card th, .table-card td { padding: 13px 20px; border-bottom: 1px solid var(--border); font-size: 13px; text-align: left; }
.table-card tr:last-child td { border-bottom: 0; }
.table-card th { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; }
.table-card tr:hover td { background: var(--surface-soft); }
.contact-table-name { display: inline-flex; align-items: center; gap: 10px; }
.contact-table-name .avatar { width: 32px; height: 32px; }
.reports-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 14px; }
.reports-grid article { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.reports-grid span { color: var(--muted); font-size: 12px; }
.reports-grid strong { display: block; margin-top: 8px; color: var(--text-strong); font-size: 28px; font-weight: 700; letter-spacing: -.8px; }

/* Dialogs and notices */
dialog {
  width: min(440px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lift);
}
dialog::backdrop { background: rgba(17,24,39,.42); backdrop-filter: blur(3px); }
dialog form { display: grid; gap: 15px; padding: 22px; }
.dialog-header, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-header h2 { margin: 0; color: var(--text-strong); font-size: 18px; font-weight: 700; }
.dialog-actions { justify-content: flex-end; margin-top: 4px; }
.forward-preview {
  max-height: 120px;
  overflow: auto;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.toast {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  max-width: min(390px, calc(100% - 30px));
  padding: 13px 16px;
  border-radius: 10px;
  background: #1f2530;
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow-lift);
}
.toast.error { background: var(--danger); }

.contact-title {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.pinned-banner {
  width: calc(100% - 24px);
  margin: 10px 12px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.pinned-banner[hidden] { display: none; }
.pinned-banner span { flex: 0 0 auto; color: var(--primary-text); font-size: 11px; font-weight: 600; }
.pinned-banner strong { overflow: hidden; font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.message-row.pinned .message-bubble { box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 40%, transparent); }
.message-row.flash .message-bubble { animation: message-flash 1.2s ease; }
@keyframes message-flash { 50% { box-shadow: 0 0 0 4px var(--primary-soft); } }
.pin-mark { float: right; margin: 0 0 3px 7px; font-size: 11px; }
.message-sender { display: block; margin-bottom: 5px; color: var(--primary-text); font-size: 12px; font-weight: 600; }
.media-frame {
  position: relative;
  display: grid;
  min-width: 180px;
  min-height: 110px;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(0,0,0,.06);
  color: var(--muted);
  font-size: 12px;
}
.media-frame img { position: relative; z-index: 1; }
.media-frame > span { position: absolute; padding: 12px; text-align: center; }
.media-frame.loaded > span { display: none; }
.media-frame.failed img { display: none; }
.media-player > span { display: none; padding: 12px; color: var(--muted); font-size: 12px; }
.media-player.failed audio, .media-player.failed video { display: none; }
.media-player.failed > span { display: block; }
.mobile-profile-button { display: none; padding: 0; border: 0; background: transparent; cursor: pointer; }
.mobile-profile-button .avatar { width: 34px; height: 34px; }

.contact-kind { display: inline-flex; margin-bottom: 8px; color: var(--primary-text); font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; }
.contact-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.btn.compact { min-height: 34px; padding: 0 12px; font-size: 12px; }
.btn.saved { background: var(--primary-soft); color: var(--primary-text); }
.group-dot { display: inline-flex; margin-right: 6px; padding: 1px 6px; border-radius: 5px; background: var(--primary-soft); color: var(--primary-text); font-size: 10px; font-style: normal; font-weight: 600; text-transform: uppercase; vertical-align: 1px; }

.contacts-list { display: grid; }
.contact-row {
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr) minmax(180px, 1.3fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 13px 20px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.contact-row:hover { background: var(--surface-soft); }
.contact-copy, .contact-history { display: grid; min-width: 0; gap: 3px; }
.contact-copy strong { overflow: hidden; color: var(--text-strong); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.contact-copy small, .contact-history small { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.contact-history b { color: var(--primary-text); font-size: 12px; }
.contact-open { color: var(--primary-text); font-size: 12px; font-weight: 600; }

.report-toolbar, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.report-toolbar { margin-bottom: 14px; padding: 2px 4px; }
.report-toolbar h2, .section-heading h2 { margin: 0; color: var(--text-strong); font-size: 17px; font-weight: 700; }
.report-toolbar p, .section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.overview-grid { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
.reports-grid article small { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.reports-grid article small b { color: var(--primary-text); }
.report-section { margin-top: 14px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.sla-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 12px; margin-top: 16px; }
.sla-grid article { padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }
.sla-grid span { display: block; color: var(--muted); font-size: 12px; }
.sla-grid strong { display: block; margin-top: 8px; color: var(--text-strong); font-size: 24px; font-weight: 700; letter-spacing: -.6px; }
.progress-track { height: 6px; margin-top: 14px; overflow: hidden; border-radius: 10px; background: var(--border); }
.progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--primary); transition: width .35s ease; }
.report-columns { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 14px; }
.volume-chart { height: 210px; display: grid; grid-template-columns: repeat(7, 1fr); align-items: end; gap: 10px; padding-top: 18px; }
.chart-day { height: 100%; display: grid; grid-template-rows: 1fr auto auto; gap: 6px; text-align: center; }
.chart-bars { display: flex; align-items: end; justify-content: center; gap: 5px; min-height: 120px; }
.chart-bars i { width: min(16px, 35%); min-height: 3px; border-radius: 4px 4px 2px 2px; }
.chart-bars .inbound { background: var(--primary); }
.chart-bars .outbound { background: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.chart-day strong { color: var(--text); font-size: 12px; font-weight: 600; }
.chart-day small { color: var(--muted); font-size: 11px; }
.agent-report { display: grid; gap: 8px; margin-top: 16px; }
.agent-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: var(--surface-soft); }
.agent-row .avatar { width: 32px; height: 32px; }
.agent-row span:nth-child(2) { display: grid; gap: 2px; }
.agent-row strong { color: var(--text-strong); font-size: 12px; font-weight: 600; }
.agent-row small { color: var(--muted); font-size: 11px; }
.agent-row > b { color: var(--primary-text); font-size: 12px; }
.broadcast-layout { display: grid; grid-template-columns: minmax(400px, .9fr) minmax(420px, 1.1fr); gap: 16px; }
.broadcast-card { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.broadcast-card > .panel-header { padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.broadcast-fields { display: grid; gap: 14px; padding: 18px 20px; }
.broadcast-fields textarea { min-height: 105px; resize: vertical; }
.broadcast-recipient-head { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
.broadcast-search { margin: 0; }
.select-all-row { padding: 0 4px; color: var(--primary-text); font-weight: 600; }
.broadcast-attach { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.broadcast-attach > span { min-width: 0; flex: 1; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.broadcast-attach > span:not(.muted) { color: var(--primary-text); font-weight: 600; }
.broadcast-job-media {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
}
.broadcast-job-media em { margin-left: auto; padding: 2px 7px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-text); font-size: 10px; font-style: normal; font-weight: 600; text-transform: uppercase; }
.broadcast-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.broadcast-chips[hidden] { display: none; }
.broadcast-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: var(--primary-soft);
  font-size: 11px;
}
.broadcast-chip b { color: var(--text-strong); font-weight: 600; }
.broadcast-chip small { color: var(--muted); }
.broadcast-chip button { display: grid; width: 18px; height: 18px; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 11px; }
.broadcast-chip button:hover { background: var(--surface); color: var(--danger); }
.broadcast-new-number {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--primary-soft);
  color: var(--text);
  text-align: left;
}
.broadcast-new-number:hover { background: color-mix(in srgb, var(--primary) 16%, var(--surface)); }
.broadcast-new-number > span:first-child {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
}
.broadcast-new-number > span:last-child { display: grid; gap: 2px; min-width: 0; }
.broadcast-new-number strong { color: var(--primary-text); font-size: 12px; font-weight: 600; }
.broadcast-new-number small { color: var(--muted); font-size: 11px; }
.broadcast-recipients { height: min(330px, 34vh); overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }
.broadcast-recipient {
  min-height: 56px;
  display: grid;
  grid-template-columns: 18px 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.broadcast-recipient:last-child { border-bottom: 0; }
.broadcast-recipient:hover { background: var(--surface-hover); }
.broadcast-recipient > input { width: 16px; height: 16px; min-height: 16px; margin: 0; align-self: center; }
.broadcast-recipient .avatar { width: 34px; height: 34px; }
.broadcast-recipient > span:nth-of-type(2) { display: grid; min-width: 0; gap: 2px; }
.broadcast-recipient strong, .broadcast-recipient small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.broadcast-recipient strong { color: var(--text-strong); font-size: 12px; font-weight: 600; }
.broadcast-recipient small { color: var(--muted); font-size: 11px; }
.broadcast-recipient b { padding: 2px 7px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-text); font-size: 10px; font-weight: 600; }
.consent-row { align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); color: var(--text); font-size: 12px; line-height: 1.55; }
.broadcast-warning { margin: 0; color: var(--warning); font-size: 11px; line-height: 1.55; }
.broadcast-jobs { max-height: calc(100vh - 190px); overflow-y: auto; padding: 12px; }
.broadcast-job { padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }
.broadcast-job + .broadcast-job { margin-top: 10px; }
.broadcast-job-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.broadcast-job-head > span { display: grid; gap: 3px; }
.broadcast-job-head strong { color: var(--text-strong); font-size: 13px; font-weight: 600; }
.broadcast-job-head small { color: var(--muted); font-size: 11px; }
.broadcast-job-head em { padding: 3px 8px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-text); font-size: 10px; font-style: normal; font-weight: 600; text-transform: uppercase; }
.broadcast-job-head em.completed { background: var(--success-soft); color: var(--success); }
.broadcast-job-head em.cancelled, .broadcast-job-head em.failed { background: var(--danger-soft); color: var(--danger); }
.broadcast-job p { max-height: 44px; margin: 10px 0; overflow: hidden; color: var(--text); font-size: 12px; line-height: 1.55; }
.broadcast-counts { display: flex; gap: 14px; margin: 8px 0 10px; color: var(--muted); font-size: 11px; }
.context-menu {
  position: fixed;
  z-index: 150;
  width: 158px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-lift);
}
.context-menu[hidden] { display: none; }
.context-menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 13px; text-align: left; cursor: pointer; }
.context-menu button:hover { background: var(--primary-soft); color: var(--primary-text); }
.context-menu button span { width: 16px; text-align: center; }
.profile-dialog-card { display: flex; align-items: center; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.profile-dialog-card .avatar { flex: 0 0 auto; }
.profile-dialog-card h3 { margin: 0 0 4px; color: var(--text-strong); font-size: 16px; }
.profile-dialog-card p { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
#profileDialog > .dialog-header { padding: 20px 22px 0; }
.check-row { display: flex; grid-template-columns: none; align-items: center; gap: 9px; font-size: 12px; }
.check-row input[type="checkbox"] { width: 16px; height: 16px; min-height: 16px; margin: 0; }

.manage-shell { min-height: calc(100vh - 100px); display: grid; grid-template-columns: 196px minmax(0, 1fr); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.manage-tabs { padding: 12px 10px; border-right: 1px solid var(--border); background: var(--surface-soft); }
.manage-tabs button { width: 100%; min-height: 38px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--rail-text); font-size: 13px; font-weight: 500; text-align: left; }
.manage-tabs button:hover { background: var(--surface-hover); color: var(--text-strong); }
.manage-tabs button.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.manage-panel { min-width: 0; overflow-y: auto; }
.manage-panel > .panel-header { padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.manage-panel table { width: 100%; border-collapse: collapse; }
.manage-panel th, .manage-panel td { padding: 12px 18px; border-bottom: 1px solid var(--border); font-size: 13px; text-align: left; }
.manage-panel th { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; }
.manage-panel tr:hover td { background: var(--surface-soft); }
.inline-create, .stack-create, .operation-builder { display: grid; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface-soft); }
.inline-create { grid-template-columns: minmax(140px, 1fr) minmax(180px, 2fr) auto auto; }
.stack-create { grid-template-columns: minmax(160px, .5fr) minmax(240px, 1.5fr) auto; align-items: start; }
.operation-builder { grid-template-columns: repeat(3, minmax(130px, 1fr)) auto; }
.inline-create input[type="color"] { width: 46px; padding: 5px; }
.manage-list { padding: 12px; }
.manage-item { min-height: 58px; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-bottom: 1px solid var(--border); }
.manage-item:last-child { border-bottom: 0; }
.manage-copy { min-width: 0; flex: 1; display: grid; gap: 4px; }
.manage-copy strong { color: var(--text-strong); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.manage-copy small { color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.manage-item code { padding: 4px 8px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-text); font-size: 12px; }
.color-dot, .status-dot { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: var(--item-color, var(--border-strong)); }
.status-dot.active { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.danger-button, .text-button { padding: 5px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--primary-text); font-size: 12px; font-weight: 600; }
.danger-button { color: var(--danger); }
.danger-button:hover { background: var(--danger-soft); }
.text-button:hover { background: var(--primary-soft); }
.text-button:disabled { cursor: not-allowed; opacity: .45; }
.manage-actions { display: flex; align-items: center; gap: 4px; }
.member-picker { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; }
.member-picker label { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.member-picker input { width: auto; }
.manage-subheading { padding: 18px; border-top: 1px solid var(--border); }
.working-hours-list { padding: 0 18px 18px; }
.working-hour { display: grid; grid-template-columns: 1fr 110px auto 110px; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.working-hour input[type="time"] { min-height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); }
.working-hour > span { color: var(--muted); font-size: 11px; }
.audit-list { padding: 12px; }
.audit-item { display: flex; gap: 11px; padding: 11px; border-bottom: 1px solid var(--border); }
.audit-item:last-child { border-bottom: 0; }
.audit-item .avatar { width: 32px; height: 32px; }
.audit-item strong, .audit-item p, .audit-item small { display: block; margin: 0 0 3px; }
.audit-item strong { color: var(--text-strong); font-size: 13px; font-weight: 600; }
.audit-item p { color: var(--text); font-size: 12px; }
.audit-item small { color: var(--muted); font-size: 11px; }
.detail-label-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.detail-label-head strong { color: var(--text-strong); font-size: 13px; }
.label-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.label-chips .muted { font-size: 12px; }
.label-chip { padding: 3px 9px; border: 1px solid color-mix(in srgb, var(--label-color) 38%, transparent); border-radius: 20px; background: color-mix(in srgb, var(--label-color) 14%, transparent); color: var(--text); font-size: 11px; font-weight: 500; }
.macro-runner { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.dialog-check-list { max-height: 300px; overflow-y: auto; padding: 8px 22px; }
.dialog-check-list label { display: flex; align-items: center; gap: 9px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.dialog-check-list input { width: auto; }
.custom-fields-rows { display: grid; gap: 8px; padding: 10px 22px; }
.custom-field-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; }
#addCustomFieldButton { margin: 0 22px; }
.note-mode { width: 40px; min-width: 40px; font-weight: 700; }
.note-mode.active { border-color: var(--warning); background: var(--warning-soft); color: var(--warning); }
.composer.note-active { background: var(--warning-soft); border-top-color: var(--warning); }
.private-note .message-bubble { border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent); background: var(--warning-soft); }
.private-note .message-bubble p { color: var(--text-strong); }
.private-note-label { display: block; margin-bottom: 5px; color: var(--warning); font-size: 11px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; }
.history-loader { align-self: center; margin: 2px auto 14px; padding: 7px 14px; border: 1px solid var(--border-strong); border-radius: 20px; background: var(--surface); color: var(--primary-text); font-size: 12px; font-weight: 600; }
.history-loader:hover { background: var(--primary-soft); }
.canned-suggestions { position: absolute; z-index: 15; right: 14px; bottom: calc(100% - 6px); width: min(420px, calc(100% - 28px)); max-height: 250px; overflow-y: auto; padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lift); }
.canned-suggestions button { width: 100%; display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 9px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; }
.canned-suggestions button:hover { background: var(--primary-soft); }
.canned-suggestions code { color: var(--primary-text); font-size: 12px; }
.canned-suggestions span { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1240px) {
  .workspace { grid-template-columns: 320px minmax(390px, 1fr); }
  .details-panel { display: none; }
}

@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 68px minmax(0, 1fr); }
  .sidebar { align-items: center; padding: 18px 10px 14px; }
  .brand { justify-items: center; padding: 0; }
  .brand-logo, .brand-tagline { display: none; }
  .brand-mark { display: block; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-item > span:nth-child(2) { display: none; }
  .nav-item b { position: absolute; top: 4px; right: 4px; min-width: 17px; padding: 1px 5px; font-size: 10px; }
  .channel-card { justify-content: center; padding: 10px 0; border: 0; background: transparent; }
  .channel-card span { display: none; }
  .profile-button { justify-content: center; }
  .profile-button > span:last-child { display: none; }
}

@media (max-width: 820px) {
  body { overflow: hidden; background: var(--surface); }
  .app-shell { display: block; height: 100dvh; }
  .sidebar {
    position: fixed;
    inset: auto 0 0;
    z-index: 40;
    width: 100%;
    height: 64px;
    display: block;
    padding: 5px 8px max(5px, env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--border);
    background: var(--surface);
  }
  .brand, .sidebar-bottom { display: none; }
  .navigation { height: 100%; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 0; }
  .nav-item {
    min-height: 0;
    height: 100%;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 4px 2px;
    border-radius: 10px;
    color: var(--muted);
    font-size: 10px;
  }
  .nav-item > span:nth-child(2) { display: block; flex: 0 0 auto; }
  .nav-item:hover, .nav-item.active { color: var(--primary-text); background: var(--primary-soft); }
  .nav-icon { height: 20px; }
  .nav-icon svg { width: 19px; height: 19px; }
  .nav-item b { position: absolute; top: 1px; right: calc(50% - 24px); min-width: 16px; padding: 1px 5px; font-size: 9px; }
  .main { height: calc(100dvh - 64px); }
  .topbar { height: 62px; padding: 0 14px; }
  .topbar h1 { font-size: 19px; }
  .top-actions { gap: 6px; }
  .mobile-profile-button { display: block; }
  #syncButton, #logoutButton { display: none; }
  #themeToggle { min-width: 36px; min-height: 36px; padding: 0 9px; font-size: 12px; }
  #newConversationButton { min-height: 36px; padding: 0 12px; font-size: 12px; }
  .workspace {
    width: 100%;
    height: calc(100dvh - 126px);
    min-height: 0;
    display: block;
    gap: 0;
    padding: 0;
    background: var(--surface);
  }
  .conversation-panel { height: 100%; border: 0; border-radius: 0; box-shadow: none; }
  .conversation-panel > .panel-header { display: none; }
  .search-box { height: 42px; margin: 12px 14px 8px; }
  .filters { margin: 0 14px; }
  .conversation-list { padding: 8px 8px 10px; }
  .conversation-item { min-height: 68px; padding: 10px 8px; }
  .conversation-item .avatar { width: 46px; height: 46px; }
  .conversation-line strong { font-size: 14px; }
  .preview { font-size: 12px; }
  .conversation-meta em { display: none; }
  .chat-panel { display: none; height: 100%; border: 0; border-radius: 0; box-shadow: none; }
  .workspace.mobile-chat-open .conversation-panel { display: none; }
  .workspace.mobile-chat-open .chat-panel { display: flex; }
  body:has(.workspace.mobile-chat-open) .topbar { display: none; }
  body:has(.workspace.mobile-chat-open) .workspace { height: calc(100dvh - 64px); }
  .chat-header { height: 62px; padding: 8px 12px; }
  .mobile-back { display: grid; place-items: center; }
  .contact-title { gap: 9px; }
  .contact-title .avatar { width: 38px; height: 38px; }
  .contact-title h2 { font-size: 14px; }
  .messages { padding: 14px 12px; }
  .message-bubble { max-width: 84%; padding: 10px 12px 8px; }
  .message-bubble p { font-size: 13px; }
  .message-actions { max-height: 24px; margin-bottom: 5px; opacity: .8; }
  .composer { min-height: 64px; padding: 8px; gap: 6px; }
  .composer textarea { min-height: 42px; padding: 11px 13px; }
  .composer .attach { width: 36px; min-width: 36px; height: 40px; }
  .composer .send { min-width: 42px; width: 42px; height: 42px; padding: 0; }
  .composer .send span { display: none; }
  .composer small { left: 50px; }
  .details-panel { display: none; }
  .content-view { height: calc(100dvh - 126px); padding: 12px; }
  .table-card { border-radius: 12px; }
  .table-card table { min-width: 620px; }
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .reports-grid article { padding: 16px; }
  .report-columns, .sla-grid { grid-template-columns: 1fr; }
  .broadcast-layout { grid-template-columns: 1fr; }
  .broadcast-card { border-radius: 12px; }
  .broadcast-recipient-head { grid-template-columns: 1fr; }
  .broadcast-recipients { height: 280px; }
  .broadcast-recipient { grid-template-columns: 18px 38px minmax(0, 1fr); gap: 10px; padding: 9px 10px; }
  .broadcast-recipient > b { display: none; }
  .broadcast-recipient > span:nth-of-type(2) { width: 100%; overflow: hidden; }
  .broadcast-jobs { max-height: none; }
  .report-section { padding: 16px; }
  .contact-row { grid-template-columns: auto 1fr auto; padding: 11px 13px; }
  .contact-history { display: none; }
  .contact-open { font-size: 0; }
  .contact-open::after { content: "\203A"; font-size: 20px; }
  .manage-shell { min-height: 100%; display: block; border-radius: 12px; }
  .manage-tabs { display: flex; gap: 5px; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--border); }
  .manage-tabs button { width: auto; flex: 0 0 auto; padding: 0 12px; }
  .manage-panel { max-height: calc(100dvh - 190px); }
  .inline-create, .stack-create, .operation-builder { grid-template-columns: 1fr; }
  .manage-item { align-items: flex-start; }
  .manage-actions { flex-direction: column; align-items: flex-end; }
  .working-hour { grid-template-columns: 1fr 90px 12px 90px; }
  .toast { right: 12px; bottom: 76px; }
}

@media (max-width: 430px) {
  .login-screen { padding: 14px; }
  .login-card { padding: 28px 22px; border-radius: 16px; }
  #themeToggle { display: none; }
  #newConversationButton { padding: 0 13px; }
  .conversation-line time { font-size: 10px; }
}
