/*
 * Cabinet visual system (UX v2). One stylesheet on purpose: Propshaft serves it
 * as is, and every page shares the same tokens and components. Colour never
 * carries a status alone — pills always keep their text label.
 */

:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f8;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #5b6475;
  --line: #e2e8f0;
  --line-strong: #c3cddb;

  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #eaf1ff;
  --accent-soft-2: #dbe7ff;

  --success: #15803d;
  --success-soft: #e7f6ec;
  --warning: #a15c07;
  --warning-soft: #fff3dc;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --violet: #6d28d9;
  --violet-soft: #f1ebff;

  --sidebar: #0f1d3d;
  --sidebar-2: #172a52;
  --sidebar-text: #c9d4ec;
  --sidebar-muted: #8c9bbd;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 20px rgba(15, 23, 42, 0.05);
  --focus: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--text); line-height: 1.25; }
h1 { font-size: 1.75rem; font-weight: 750; margin: 0 0 18px; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; font-weight: 700; margin: 28px 0 12px; }
h3 { font-size: 1rem; font-weight: 650; margin: 18px 0 8px; }
p { margin: 0 0 12px; }

a { color: var(--accent-strong); text-underline-offset: 2px; }
a:hover { color: var(--accent); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.icon { flex: none; display: inline-block; vertical-align: middle; }

.skip-link { position: absolute; top: -100px; left: 12px; z-index: 20; padding: 12px; background: white; border-radius: var(--radius-sm); }
.skip-link:focus { top: 8px; }

/* --- Shell ------------------------------------------------------------ */

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding: 20px 14px 14px;
  background: linear-gradient(180deg, var(--sidebar) 0%, #0c1733 100%);
  color: var(--sidebar-text);
}

.sidebar :focus-visible { outline-color: #9db8ff; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #7c3aed);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.brand-text { display: grid; min-width: 0; }
.brand-name { font-weight: 750; font-size: 0.95rem; white-space: nowrap; }
.account-name { color: var(--sidebar-muted); font-size: 0.82rem; overflow-wrap: anywhere; }

.cabinet-menu { flex: 1; }
.cabinet-menu > summary { display: none; min-height: 44px; padding: 10px 8px; cursor: pointer; color: #ffffff; font-weight: 600; }

.nav-list { display: grid; gap: 2px; }
.nav-group { display: grid; gap: 2px; }
.nav-group-personal { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); }

.nav-group-title {
  margin: 14px 10px 4px;
  color: var(--sidebar-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 7px 12px;
  font-size: 0.94rem;
  border-radius: 10px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link .icon { opacity: 0.85; }
.nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #ffffff; }

.nav-link[aria-current="page"] {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.32), rgba(59, 130, 246, 0.14));
  color: #ffffff;
  font-weight: 650;
  box-shadow: inset 3px 0 0 #60a5fa;
}

.nav-link[aria-current="page"] .icon { opacity: 1; color: #93c5fd; }
.nav-link-strong { color: #fde68a; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 12px 8px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user-text { display: grid; min-width: 0; }
.sidebar-user-email { color: #ffffff; font-size: 0.86rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role { color: var(--sidebar-muted); font-size: 0.78rem; }

.main-pane { min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 60px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 28px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar-spacer { flex: 1; }

.context-help { margin: 0; font-size: 0.9rem; }
.context-help a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
  text-decoration: none;
}
.context-help a:hover { background: var(--accent-soft-2); }

.notification-counter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 0.88rem;
}
.notification-counter.has-unread { background: var(--warning-soft); color: var(--warning); }
a.notification-counter { text-decoration: none; }
a.notification-counter:hover { filter: brightness(0.96); }

.notification-filters { margin-bottom: 8px; }
.notification-toolbar { margin: 0 0 12px; color: var(--muted); font-size: 0.88rem; }

/* Feed: one line per item, shared by the notifications and the attention queues. */
.feed-section { margin-bottom: 16px; }
.feed-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.feed-row + .feed-row { border-top: 1px solid var(--line); }
.feed-row form { margin: 0; }
.feed-line {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px 12px;
  padding: 8px 14px;
}
.feed-line:hover { background: var(--surface-2); }
.feed-badge {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--muted);
}
.feed-badge.tone-amber { background: var(--warning-soft); color: var(--warning); }
.feed-badge.tone-violet { background: var(--violet-soft); color: var(--violet); }
.feed-badge.tone-red { background: var(--danger-soft); color: var(--danger); }
.feed-badge.tone-blue { background: var(--accent-soft-2); color: var(--accent-strong); }
.feed-badge.tone-green { background: var(--success-soft); color: var(--success); }
.feed-text { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.feed-title { flex: none; max-width: 60%; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
a.feed-title { color: var(--text); text-decoration: none; }
a.feed-title:hover { color: var(--accent-strong); text-decoration: underline; }
.feed-summary { min-width: 0; overflow: hidden; color: var(--muted); font-size: 0.88rem; text-overflow: ellipsis; white-space: nowrap; }
.feed-time { color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.feed-state { font-size: 0.75rem; white-space: nowrap; }
.feed-actions { display: flex; align-items: center; gap: 6px; }
.feed-actions form { display: contents; }
.feed-actions a, .feed-actions button { text-decoration: none; white-space: nowrap; }
.feed-actions a, .feed-actions button { text-decoration: none; white-space: nowrap; }
.feed-actions .primary-button, .feed-actions .secondary-button { min-height: 32px; padding: 0 12px; font-size: 0.86rem; }
.feed-row.is-stale .feed-title,
.feed-row.is-stale .feed-summary { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.feed-row.is-stale .feed-badge { opacity: 0.55; }
.feed-empty { display: flex; align-items: center; gap: 8px; margin: 0; padding: 14px; color: var(--muted); }

/* A notification row is a single button: reading it opens its object. */
.notification-open {
  display: grid;
  grid-template-columns: 8px 28px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 0;
  padding: 8px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-weight: 400;
  text-align: left;
}
.notification-open:hover { background: var(--surface-2); }
.notification-open .feed-title { font-weight: 500; }
.feed-row.is-unread .notification-open { background: var(--accent-soft); }
.feed-row.is-unread .notification-open:hover { background: var(--accent-soft-2); }
.feed-row.is-unread .feed-title { font-weight: 700; }
.feed-dot { width: 8px; height: 8px; border-radius: 50%; }
.feed-row.is-unread .feed-dot { background: var(--accent); }
.notification-open .feed-state { grid-column: 4; }
.notification-open .feed-time { grid-column: 5; }
.notification-pages { display: flex; gap: 8px; justify-content: center; margin: 12px 0; }

/* Attention queues: the SLA state tints the row edge, like the old table. */
.feed-row.handoff-row-overdue { box-shadow: inset 3px 0 0 var(--danger); background: #fff5f4; }
.feed-row.handoff-row-warning { box-shadow: inset 3px 0 0 #f59e0b; background: #fffaf0; }
.feed-row.handoff-row-overdue .handoff-sla { color: var(--danger); }
.feed-row.handoff-row-warning .handoff-sla { color: var(--warning); }
.attention-note { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; color: var(--muted); font-size: 0.88rem; }

.notification-telegram-topics { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.notification-topic-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; padding: 0; list-style: none; }
.notification-hashtag { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88rem; }

.account-switcher { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.account-switcher select { width: 220px; min-width: 0; max-width: 100%; }

.impersonation-banner {
  flex: 1 0 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid #f0c36d;
  border-radius: var(--radius);
  background: var(--warning-soft);
  color: #6b3f00;
  overflow-wrap: anywhere;
}

.logout-button { display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; }

.content-surface {
  padding: 28px;
  max-width: 1440px;
  overflow-wrap: anywhere;
}

.content-surface:focus { outline: none; }

.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 28px 0;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}
.flash-notice { background: var(--success-soft); color: var(--success); border: 1px solid #bfe5cc; }
.flash-alert { background: var(--danger-soft); color: var(--danger); border: 1px solid #f5c2bd; }

.auth-pane {
  width: min(440px, calc(100% - 32px));
  margin: 10vh auto 40px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.auth-pane .flash { margin: 0 0 16px; }
.auth-pane form { max-width: none; }

/* --- Controls --------------------------------------------------------- */

button, input, select, textarea { font: inherit; color: inherit; }

button,
input[type="submit"],
.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

button:hover, .secondary-button:hover { background: var(--surface-2); border-color: #9fb0c6; }

input[type="submit"],
.primary-button,
button.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
}

input[type="submit"]:hover,
.primary-button:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #ffffff; }

.danger-button,
input[type="submit"].danger-button {
  background: var(--danger) !important;
  border-color: var(--danger) !important;
  color: #ffffff !important;
}

button:disabled, input[type="submit"]:disabled { opacity: 0.55; cursor: not-allowed; }

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="hidden"]),
select,
textarea {
  min-height: 42px;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea { width: min(100%, 720px); line-height: 1.5; resize: vertical; }

input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); }

label { font-weight: 600; color: var(--text-2); font-size: 0.92rem; }

form { display: grid; gap: 10px; max-width: 560px; }
form > input[type="submit"] { justify-self: start; min-width: 140px; }
fieldset { margin: 0; padding: 12px 16px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
fieldset legend { padding: 0 6px; font-weight: 600; color: var(--text-2); font-size: 0.92rem; }
fieldset label { display: inline-flex; align-items: center; gap: 6px; margin-right: 12px; font-weight: 500; }
.button_to { display: inline; max-width: none; }

.primary-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 650;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.primary-link:hover { background: var(--accent-strong); color: #ffffff; }

.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0; }
.button-row a, .help-contents a, .empty-state a, .overview-card a { display: inline-flex; align-items: center; min-height: 44px; }

.inline-check { display: flex; align-items: center; gap: 8px; }
.muted-text, .hint { color: var(--muted); }
.hint { font-size: 0.9rem; }
.alert { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--warning-soft); color: #6b3f00; }

/* --- Surfaces --------------------------------------------------------- */

.card,
.empty-state,
.overview-card,
.help-article,
.channel-card,
.authorization-wizard,
.inbox-contact-card,
.inbox-composer {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.empty-state, .overview-card, .help-article { margin: 16px 0; }
.empty-state { text-align: left; background: linear-gradient(180deg, #ffffff, var(--surface-2)); }
.empty-state h2 { margin-top: 0; }

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 20px;
}
.page-header h1 { margin: 0; }
.page-header p { margin: 4px 0 0; color: var(--muted); }

.page-intro, .help-article p { max-width: 75ch; line-height: 1.6; color: var(--text-2); }

table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); }

.content-surface table {
  display: table;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}


th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: var(--surface-2); color: var(--muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafcff; }
td a { font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }

.json-block {
  max-width: 900px;
  overflow: auto;
  padding: 14px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.json-inline { max-width: 360px; max-height: 140px; overflow: auto; margin: 0; white-space: pre-wrap; font-size: 0.82rem; }

/* --- Pills, avatars, channels ---------------------------------------- */

.pill,
.inbox-badge,
.handoff-urgency {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
}

.pill::before,
.inbox-badge[data-ai-mode]::before,
.inbox-badge[data-status]::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}

.pill-plain::before { display: none; }

.pill-blue, .inbox-badge[data-ai-mode="on"] { background: var(--accent-soft); color: var(--accent-strong); }
.pill-amber, .inbox-badge[data-ai-mode="paused"] { background: var(--warning-soft); color: var(--warning); }
.pill-gray, .inbox-badge[data-ai-mode="off"], .inbox-badge[data-status="closed"] { background: var(--surface-3); color: var(--muted); }
.pill-green, .inbox-badge[data-status="open"] { background: var(--success-soft); color: var(--success); }
.pill-red, .inbox-badge-unread { background: var(--danger-soft); color: var(--danger); }
.pill-violet { background: var(--violet-soft); color: var(--violet); }

.avatar {
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
}
.avatar-sm { width: 34px; height: 34px; font-size: 0.8rem; }
.avatar-md { width: 44px; height: 44px; font-size: 0.92rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar-tone-0 { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.avatar-tone-1 { background: linear-gradient(135deg, #10b981, #047857); }
.avatar-tone-2 { background: linear-gradient(135deg, #f59e0b, #c2410c); }
.avatar-tone-3 { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.avatar-tone-4 { background: linear-gradient(135deg, #ec4899, #be185d); }
.avatar-tone-5 { background: linear-gradient(135deg, #06b6d4, #0e7490); }

.channel-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}
.inbox-row-top .channel-chip { flex: none; max-width: 55%; }
.channel-chip-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; flex: none; }
.channel-telegram .channel-dot, .channel-telegram_user .channel-dot { background: #229ed9; }
.channel-whatsapp .channel-dot { background: #25d366; }
.channel-avito .channel-dot { background: #00aaff; }
.channel-max .channel-dot, .channel-max_user .channel-dot { background: #7c3aed; }
.channel-webchat .channel-dot { background: #2563eb; }
.channel-vapi_number .channel-dot { background: #f97316; }

/* --- Dashboard -------------------------------------------------------- */

.dashboard-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px;
  margin-bottom: 20px;
  border-radius: var(--radius-lg);
  background: radial-gradient(120% 140% at 100% 0%, #dbe7ff 0%, #eef3ff 45%, #ffffff 100%);
  border: 1px solid #dbe4f5;
  box-shadow: var(--shadow-sm);
}
.dashboard-hero h1 { margin-bottom: 6px; }
.dashboard-hero p { margin: 0; color: var(--text-2); max-width: 60ch; }
.dashboard-hero-art { color: #93b4f5; opacity: 0.9; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 16px; margin-bottom: 8px; }

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
a.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: #c9d6ee; color: inherit; }
.stat-icon { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; flex: none; }
.stat-value { display: block; font-size: 1.6rem; font-weight: 750; line-height: 1.1; }
.stat-label { display: block; color: var(--muted); font-size: 0.88rem; }
.tone-blue .stat-icon { background: var(--accent-soft); color: var(--accent); }
.tone-green .stat-icon { background: var(--success-soft); color: var(--success); }
.tone-amber .stat-icon { background: var(--warning-soft); color: var(--warning); }
.tone-red .stat-icon { background: var(--danger-soft); color: var(--danger); }
.tone-violet .stat-icon { background: var(--violet-soft); color: var(--violet); }

.overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.overview-card { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.overview-card h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 1.05rem; }
.overview-card p { color: var(--muted); margin: 0; flex: 1; }
.soft-blue { background: var(--accent-soft); color: var(--accent); }
.soft-green { background: var(--success-soft); color: var(--success); }
.soft-amber { background: var(--warning-soft); color: var(--warning); }
.soft-red { background: var(--danger-soft); color: var(--danger); }
.soft-violet { background: var(--violet-soft); color: var(--violet); }
.overview-card-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; }

/* --- Help ------------------------------------------------------------- */

.help-contents {
  max-width: 900px;
  padding: 16px 20px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.help-contents ul { margin: 0; padding-left: 22px; columns: 2 280px; column-gap: 32px; }
.help-contents a { min-height: 36px; }
.help-articles { max-width: 900px; }
.help-article { scroll-margin-top: 80px; }
.help-article h2 { margin-top: 0; }
.help-article:focus { outline: none; box-shadow: var(--focus); }

/* --- Inbox list ------------------------------------------------------- */

.inbox-views { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.inbox-pagination { display: grid; gap: 6px; margin-top: 14px; }

.inbox-view {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}
.inbox-view:hover { border-color: #b8c7e0; color: var(--text); }
.inbox-view[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: #ffffff; }

.inbox-filter-panel { margin-bottom: 16px; }
.inbox-filter-panel > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.9rem;
  list-style: none;
  background: var(--surface-3);
}
.inbox-filter-panel > summary::-webkit-details-marker { display: none; }
.inbox-filter-panel[open] > summary { background: var(--accent-soft); color: var(--accent-strong); }

.inbox-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 12px 16px;
  align-items: end;
  max-width: none;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.inbox-filter-field { display: grid; gap: 4px; min-width: 0; }
.inbox-filter-field select { width: 100%; }
.inbox-filter-checkbox { display: inline-flex; gap: 8px; align-items: center; min-height: 42px; }
.inbox-filter-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

.inbox-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.inbox-list:empty { display: none; }

.inbox-row {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s ease;
}
.inbox-row:last-child { border-bottom: 0; }
.inbox-row:hover { background: #f7faff; }
.inbox-row[data-awaiting="true"] { box-shadow: inset 3px 0 0 var(--danger); }

.inbox-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.inbox-row-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.inbox-row-title { font-weight: 700; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-row-title::after { content: ""; position: absolute; inset: 0; }
.inbox-row-title:hover { color: var(--accent-strong); }
.inbox-row-preview { color: var(--muted); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-row-time { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.inbox-row-meta { position: relative; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; max-width: 360px; }
.inbox-row-assignee { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.8rem; }

.inbox-empty { color: var(--muted); }

/* --- Conversation ----------------------------------------------------- */

.back-link { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; margin-bottom: 10px; color: var(--muted); font-weight: 600; text-decoration: none; }
.back-link:hover { color: var(--accent-strong); }

.inbox-all-conversations { display: none; }
.inbox-split {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.inbox-split > .inbox-thread-layout { min-width: 0; }
.inbox-sidebar {
  position: sticky;
  top: 80px;
  height: calc(100vh - 100px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.inbox-sidebar > .inbox-empty { padding: 14px; }
.inbox-sidebar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}
.inbox-sidebar-row:last-child { border-bottom: 0; }
.inbox-sidebar-row:hover { background: var(--surface-2); color: var(--accent-strong); }
.inbox-sidebar-row[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-strong);
  box-shadow: inset 3px 0 0 var(--accent-strong);
}
.inbox-sidebar-row-main { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; flex: 1; }
.inbox-sidebar-row-top { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; }
.inbox-sidebar-row-name { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-sidebar-row .inbox-row-preview { max-width: 100%; }
.inbox-sidebar-row-badges { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; min-width: 0; }
.inbox-sidebar-row-badges .inbox-badge { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.inbox-badge[data-lead-stage] { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }

@media (max-width: 1500px) {
  .inbox-split > .inbox-thread-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .inbox-split { grid-template-columns: minmax(0, 1fr); }
  .inbox-sidebar { display: none; }
  .inbox-all-conversations { display: inline-flex; }
}

.inbox-thread-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

.inbox-thread { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.inbox-thread-header {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.inbox-thread-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.inbox-thread-title h1 { margin: 0; font-size: 1.4rem; }
.inbox-thread-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 0; }
.inbox-thread-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 20px; }
.inbox-thread-header .button-row { margin: 0; }
.inbox-thread-header .button-row button, .inbox-thread-header .button-row .secondary-button { min-height: 40px; padding: 0 12px; }
.inbox-thread-header .button-row a { font-weight: 600; text-decoration: none; }

.ai-explainer {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
}
.ai-explainer[data-ai-mode="on"] { background: var(--accent-soft); color: #1e3a8a; }
.ai-explainer[data-ai-mode="paused"] { background: var(--warning-soft); color: #6b3f00; }
.ai-explainer[data-ai-mode="off"] { background: var(--surface-3); color: var(--text-2); }

.inbox-reasoning { margin-top: 12px; font-size: 0.9rem; }
.inbox-reasoning > summary { cursor: pointer; color: var(--violet); font-weight: 650; min-height: 32px; display: inline-flex; align-items: center; gap: 6px; }
.inbox-reasoning > p { margin: 8px 0 0; }
.inbox-reasoning-meta { color: var(--muted); font-size: 0.82rem; }

.inbox-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 240px;
  max-height: calc(100vh - 420px);
  overflow-y: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 1px 1px, rgba(148, 163, 184, 0.18) 1px, transparent 0) 0 0 / 22px 22px,
    var(--surface-2);
}
.inbox-messages:empty::before { content: "Сообщений пока нет"; margin: auto; color: var(--muted); }

.inbox-message {
  position: relative;
  max-width: min(78%, 640px);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  align-self: flex-start;
}

.inbox-message[data-author="contact"] { border-top-left-radius: 4px; }
.inbox-message[data-author="ai"] {
  align-self: flex-end;
  border-color: #cfdcfb;
  border-top-right-radius: 4px;
  background: linear-gradient(180deg, #eef4ff, #e6efff);
}
.inbox-message[data-author="manager"] {
  align-self: flex-end;
  border-color: #bfe3cd;
  border-top-right-radius: 4px;
  background: #eaf7ef;
}
.inbox-message[data-author="system"] { align-self: center; background: var(--surface-3); box-shadow: none; }
.inbox-message[data-content-type="system_note"] {
  align-self: stretch;
  max-width: none;
  border: 1px dashed #e6c476;
  background: #fff8e6;
  font-style: normal;
}

.inbox-message-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--muted); font-size: 0.78rem; }
.inbox-message-author { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--text-2); }
.inbox-message[data-author="ai"] .inbox-message-author { color: var(--accent-strong); }
.inbox-message[data-author="manager"] .inbox-message-author { color: var(--success); }
.inbox-message[data-content-type="system_note"] .inbox-message-author { color: var(--warning); }
.inbox-message-status { margin-left: auto; }
.inbox-message-status[data-delivery="failed"] { color: var(--danger); font-weight: 700; }
.inbox-message-body { margin: 4px 0 0; white-space: pre-wrap; color: var(--text); }
.inbox-message-transcript { margin: 6px 0 0; padding: 6px 10px; border-radius: 8px; background: rgba(15, 23, 42, 0.04); font-size: 0.9rem; }
.inbox-transcript-label { color: var(--muted); font-weight: 600; }

.message-media { margin-top: 8px; }
.message-media img, .message-media video { max-width: 100%; max-height: 320px; border-radius: 10px; }
.message-media audio { max-width: 100%; }

/* The indicator fades itself out: a client who starts typing and never sends
   must not leave it burning in the manager's inbox forever. */
.inbox-typing { min-height: 1.2em; color: var(--muted); font-size: 0.88rem; font-style: italic; }
.inbox-typing[data-state="on"] { animation: inbox-typing-fade 10s forwards; }

@keyframes inbox-typing-fade {
  0%, 85% { opacity: 1; }
  100% { opacity: 0; }
}

.inbox-composer { margin: 0; }
.inbox-composer h2 { margin: 0 0 12px; font-size: 1rem; }
.inbox-composer-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-3);
}
.inbox-composer-tabs [role="tab"] { min-height: 40px; border: 0; background: transparent; color: var(--muted); box-shadow: none; }
.inbox-composer-tabs [role="tab"]:hover { background: rgba(255, 255, 255, 0.6); color: var(--text); }
.inbox-composer-tabs [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow-sm); }
#composer-note-tab[aria-selected="true"] { color: var(--warning); }

.inbox-reply-form, .inbox-note-form { display: flex; flex-direction: column; gap: 8px; max-width: none; }
.inbox-reply-form textarea, .inbox-note-form textarea { width: 100%; }
.inbox-note-form textarea { background: #fffbf0; border-color: #e6c476; }
.inbox-reply-form input[type="submit"], .inbox-note-form input[type="submit"] { align-self: flex-end; }
.inbox-note-form input[type="submit"] { background: #b45309; border-color: #b45309; }

.composer-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--warning-soft);
  color: #6b3f00;
  font-size: 0.88rem;
  line-height: 1.45;
}

.inbox-traces { padding: 4px 0; }
.inbox-traces > summary { cursor: pointer; color: var(--muted); font-weight: 650; min-height: 40px; display: inline-flex; align-items: center; }

.inbox-contact-card { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 4px; }
.inbox-contact-card h2 { margin: 0 0 8px; font-size: 1.05rem; }
.inbox-contact-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.contact-card-head { display: flex; align-items: center; gap: 12px; }
.contact-card-head a { font-weight: 700; font-size: 1.05rem; text-decoration: none; }
.inbox-contact-card p { margin: 0; font-size: 0.92rem; }
.inbox-contact-card form { max-width: none; }
.inbox-contact-card input[type="submit"] { min-height: 38px; }
.inbox-contact-card details > summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; min-height: 32px; display: flex; align-items: center; }

.inbox-identities, .inbox-leads, .inbox-consents { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 0.92rem; }
.inbox-identities li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.inbox-identity-kind { color: var(--muted); }
.inbox-identity-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.inbox-leads li { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.inbox-leads li > a { font-weight: 650; text-decoration: none; }
.inbox-lead-stage { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.inbox-lead-stage select { flex: 1 1 130px; min-width: 0; min-height: 38px; }
.inbox-lead-stage input[type="submit"] { flex: 1 1 auto; min-height: 38px; }
.inbox-opt-out-form { justify-items: start; }
.inbox-calls { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.inbox-calls > summary { display: list-item; color: var(--muted); font-size: 0.9rem; }
.inbox-typing:empty { min-height: 0; }
.inbox-opt-out[data-opt-out="true"] { color: var(--danger); font-weight: 650; }
.inbox-opt-out-form input[type="submit"] { background: var(--surface); border-color: var(--line-strong); color: var(--text); box-shadow: none; }

/* --- Attention queues ------------------------------------------------- */

.handoff-sla-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.handoff-queue, .handoff-recent { width: 100%; }
.handoff-row-overdue td { background: #fff5f4; }
.handoff-row-overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.handoff-row-warning td { background: #fffaf0; }
.handoff-row-warning td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
.handoff-sla { font-weight: 650; white-space: nowrap; }
.handoff-row-overdue .handoff-sla { color: var(--danger); }
.handoff-row-warning .handoff-sla { color: var(--warning); }

.handoff-urgency-high { background: var(--danger-soft); color: var(--danger); }
.handoff-urgency-normal { background: var(--accent-soft); color: var(--accent-strong); }
.handoff-urgency-low { background: var(--surface-3); color: var(--muted); }

.handoff-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.approval-card { display: grid; gap: 10px; }
.approval-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.approval-card-head h2 { margin: 0; font-size: 1.05rem; display: flex; align-items: center; gap: 10px; }
.approval-card-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px 20px; margin: 0; }
.approval-card-body dt { color: var(--muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.approval-card-body dd { margin: 2px 0 0; }
.approval-plan { display: grid; gap: 6px; margin: 0; padding-left: 1.3em; }
.approval-plan .pill { margin-left: 6px; }

/* --- Settings, channels, sandbox (existing screens) -------------------- */

.channel-cards, .authorization-methods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  max-width: 900px;
  margin: 20px 0;
}
.channel-cards > h2 { grid-column: 1 / -1; }
.authorization-wizard { max-width: 760px; }
.authorization-qr svg { width: min(320px, 100%); height: auto; background: #ffffff; padding: 8px; border-radius: var(--radius); }

.pairing-code {
  display: inline-block;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.4rem;
  letter-spacing: 0.18em;
}

.sandbox-chat { display: grid; gap: 12px; max-width: 820px; }
.sandbox-message { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.sandbox-message-ai { border-left: 4px solid var(--accent); background: #f5f8ff; }
.sandbox-message-system { border-left: 4px solid var(--muted); }
.sandbox-message-meta { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 0.82rem; margin-bottom: 6px; }

.notification-kinds { width: 100%; }
.notification-kinds td:first-child { min-width: min(260px, 40vw); }
.notification-kind-description { color: var(--muted); font-size: 0.9em; }

/* --- Responsive ------------------------------------------------------- */

@media (max-width: 1100px) {
  .inbox-thread-layout { grid-template-columns: minmax(0, 1fr); }
  .inbox-contact-card { position: static; }
  .inbox-messages { max-height: 70vh; }
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; min-height: 0; gap: 0; padding: 12px 12px 4px; overflow: visible; }
  .cabinet-menu { flex: none; }
  .brand { padding-bottom: 10px; }
  .cabinet-menu > summary { display: list-item; margin-left: 8px; }
  .nav-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .nav-group-title { grid-column: 1 / -1; }
  .nav-link { min-height: 44px; padding: 8px 10px; }
  .nav-label { min-width: 0; overflow-wrap: anywhere; }
  .sidebar-user { display: none; }
  .topbar { position: static; padding: 10px 16px; }
  .topbar-spacer { display: none; }
  .content-surface { padding: 16px; }
  .content-surface table { display: block; overflow-x: auto; }
  .counter-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .notification-counter, .context-help a, .logout-button { min-height: 38px; font-size: 0.85rem; }
  .notification-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .notification-filters .inbox-view { flex: none; }
  .feed-text { flex-direction: column; gap: 0; }
  .feed-title, .feed-summary { max-width: 100%; }
  .notification-open .feed-state { max-width: 96px; overflow: hidden; text-overflow: ellipsis; }
  .feed-line { grid-template-columns: 28px minmax(0, 1fr); gap: 4px 10px; }
  .feed-line > :not(.feed-badge) { grid-column: 2; justify-self: start; }
  .feed-line > .feed-badge { align-self: start; }
  .flash { margin: 12px 16px 0; }
  h1 { font-size: 1.45rem; }
  .card, .empty-state, .overview-card, .help-article, .inbox-contact-card, .inbox-composer { padding: 16px; }
  .dashboard-hero { padding: 20px; }
  .dashboard-hero-art { display: none; }
  .button-row > *, .inbox-filters > * { max-width: 100%; }
  .channel-cards, .authorization-methods { grid-template-columns: minmax(0, 1fr); }
  .inbox-row { grid-template-columns: auto minmax(0, 1fr); padding: 12px 14px; }
  .inbox-row-meta { grid-column: 1 / -1; justify-content: flex-start; max-width: none; }
  .inbox-message { max-width: 92%; }
  .inbox-row-top .channel-chip-name { display: none; }
  .inbox-messages { padding: 12px; }
  .help-contents ul { columns: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.section-gap { margin-top: 16px; }
.card > h2:first-child { margin-top: 0; }
details > summary { cursor: pointer; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; }

/* --- Inbound source integration guide -------------------------------- */

.inbound-guide-step { margin: 16px 0; max-width: 960px; }
.inbound-guide-step h2 { margin-top: 0; }
.inbound-guide-step .json-block { white-space: pre; }
.content-surface .inbound-guide-step table { box-shadow: none; }

.contact-avatar { position: relative; display: inline-flex; flex-shrink: 0; }
.avatar-photo { position: absolute; inset: 0; object-fit: cover; }
.avatar-photo[hidden] { display: none; }
.inbox-message-scroll { position: relative; min-width: 0; }
.inbox-scroll-last { position: absolute; right: 16px; bottom: 16px; min-width: 44px; min-height: 44px; border-radius: 24px; box-shadow: var(--shadow-sm); z-index: 1; }
.inbox-scroll-last[hidden], .inbox-followup-form [hidden] { display: none; }
.inbox-followup-form { display: grid; gap: 8px; margin-bottom: 12px; min-width: 0; }
.inbox-followup-form select, .inbox-followup-form input { min-width: 0; max-width: 100%; width: 100%; }
dialog { max-width: calc(100vw - 32px); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }

.conversation-avatar { position: relative; display: inline-flex; flex-shrink: 0; align-self: flex-start; }
.conversation-channel-badge { position: absolute; right: -4px; bottom: -4px; display: inline-flex; padding: 2px; border-radius: 50%; background: var(--surface); color: var(--accent-strong); border: 1px solid var(--line); }
.conversation-channel-badge .channel-kind-icon { width: 14px; height: 14px; }
.channel-kind-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; }
.channel-kind-filter { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); }
.channel-kind-filter[aria-checked="true"] { color: var(--accent-strong); background: var(--surface-2); border-color: var(--accent-strong); }
.channel-kind-filters form { margin: 0; }
