:root {
  --bg: #f4efe8;
  --paper: rgba(255, 251, 245, 0.94);
  --ink: #17212b;
  --muted: #5d6a78;
  --line: #d8cfbf;
  --accent: #1f5c74;
  --accent-strong: #153f50;
  --accent-soft: #dcecf3;
  --warm: #c26f45;
  --warn: #9f4738;
  --success: #336a4b;
  --shadow: 0 18px 40px rgba(23, 33, 43, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(31, 92, 116, 0.12), transparent 24%),
    radial-gradient(circle at top right, rgba(194, 111, 69, 0.14), transparent 22%),
    linear-gradient(180deg, #f9f6f1 0%, #efe7da 100%);
  overflow: hidden;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1580px, calc(100vw - 20px));
  height: 100vh;
  margin: 0 auto;
  padding: 10px 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 10px;
}

.app-shell.is-booting {
  visibility: hidden;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.95fr);
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(216, 207, 191, 0.88);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.topbar-copy {
  display: flex;
  align-items: center;
  min-width: 0;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 5px;
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 11px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 3vw, 38px);
  line-height: 0.98;
}

h2 {
  font-size: 22px;
  line-height: 1.04;
}

.lead {
  margin-top: 8px;
  max-width: 760px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.topbar-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.topbar-service-controls {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-start;
  min-width: 0;
}

.topbar-sync-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.topbar-service-controls .sidebar-service-strip {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.topbar-service-controls .sidebar-automation-links {
  display: inline-flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 8px;
}

.topbar-service-controls .sidebar-memory-button {
  min-height: 40px;
}

.topbar-service-controls .sidebar-icon-button {
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  min-height: 40px;
  font-size: 20px;
}

.sync-status-card,
.metric-card,
.panel,
.conversation-card,
.info-card,
.visit-card,
.bubble {
  border: 1px solid rgba(216, 207, 191, 0.82);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.sync-status-card {
  padding: 11px 13px;
  border-radius: 16px;
  background: linear-gradient(150deg, #163342, #244c60);
  color: white;
  min-width: 250px;
  flex: 1 1 250px;
}

.sync-status-label {
  display: block;
  font-weight: 700;
  font-size: 13px;
}

.sync-status-meta {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.3;
  font-size: 12px;
}

.ghost-button,
.primary-button {
  min-height: 36px;
  padding: 8px 13px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease;
  font-size: 13px;
}

.ghost-button {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
}

.primary-button {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  font-weight: 700;
}

.danger-button {
  color: var(--warn);
  border-color: rgba(166, 78, 61, 0.3);
  background: rgba(166, 78, 61, 0.08);
}

.ghost-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.danger-button:hover {
  border-color: rgba(166, 78, 61, 0.5);
  background: rgba(166, 78, 61, 0.12);
}

.ghost-button:disabled,
.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.overview-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.service-launchpad {
  display: block;
}

.service-launchpad-card {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.8fr) auto;
  gap: 14px;
  align-items: center;
  padding: 15px 18px;
  border-radius: 20px;
  border: 1px solid rgba(216, 207, 191, 0.88);
  background:
    radial-gradient(circle at top right, rgba(42, 159, 223, 0.14), transparent 28%),
    linear-gradient(145deg, rgba(255, 251, 245, 0.96), rgba(246, 252, 255, 0.94));
  box-shadow: var(--shadow);
}

.service-launchpad-copy {
  min-width: 0;
}

.service-launchpad-copy h2 {
  font-size: 24px;
  line-height: 1.04;
}

.service-launchpad-lead,
.service-launchpad-caption {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.service-launchpad-lead {
  margin-top: 8px;
}

.service-launchpad-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.service-launchpad-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(220, 236, 243, 0.88);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.service-launchpad-pill.warn {
  background: rgba(194, 111, 69, 0.14);
  color: var(--warn);
}

.service-launchpad-pill.success {
  background: rgba(51, 106, 75, 0.14);
  color: var(--success);
}

.service-launchpad-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.metric-card {
  padding: 9px 12px;
  border-radius: 16px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.metric-card strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  line-height: 1.2;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(290px, 340px) minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.workspace.details-open {
  grid-template-columns: minmax(290px, 340px) minmax(0, 1fr) minmax(300px, 360px);
}

.panel {
  padding: 12px;
  border-radius: 18px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.details-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.details-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.details-panel-head h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.05;
}

.details-panel-scroll {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  margin-top: 10px;
  padding-right: 2px;
}

.details-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.details-summary-block {
  padding: 10px 12px;
  border: 1px solid rgba(216, 207, 191, 0.8);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
}

.details-summary-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 5px 0;
}

.details-summary-row + .details-summary-row {
  border-top: 1px solid rgba(216, 207, 191, 0.52);
}

.details-summary-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.details-summary-value {
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
}

.details-visits {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 2px;
}

.sidebar-head,
.chat-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-head {
  align-items: center;
}

.chat-head {
  align-items: flex-start;
  position: relative;
  z-index: 20;
  overflow: visible;
}

.sidebar-head-copy {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}

.sidebar-create-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(31, 92, 116, 0.22);
  border-radius: 999px;
  background: rgba(220, 236, 243, 0.88);
  color: var(--accent-strong);
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background-color 0.16s ease,
    opacity 0.16s ease;
}

.sidebar-create-button:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 92, 116, 0.4);
  background: rgba(220, 236, 243, 0.98);
}

.sidebar-create-button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.sidebar-automation-toggles {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  flex: 1 1 auto;
  min-width: 0;
}

.sidebar-automation-controls {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 12px;
  margin-top: 12px;
  padding-bottom: 0;
}

.sidebar-automation-controls:empty {
  display: none;
  margin-top: 0;
}

.sidebar-switch-inline-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sidebar-switch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sidebar-automation-links {
  display: grid;
  grid-template-columns: 48px repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}

.sidebar-memory-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 40px;
  padding-inline: 14px;
  text-align: center;
  white-space: nowrap;
}

.sidebar-icon-button {
  width: 48px;
  min-width: 48px;
  max-width: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 999px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.sidebar-service-strip {
  padding: 10px 12px;
  border: 1px solid rgba(216, 207, 191, 0.82);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84);
}

.sidebar-auto-settings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(216, 207, 191, 0.82);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
}

.sidebar-auto-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-auto-settings-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-auto-settings-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sidebar-auto-mode-chip {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(216, 207, 191, 0.9);
  background: rgba(255, 255, 255, 0.96);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition:
    border-color 0.16s ease,
    background-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.sidebar-auto-mode-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 92, 116, 0.36);
}

.sidebar-auto-mode-chip.active {
  border-color: rgba(31, 92, 116, 0.34);
  background: rgba(220, 236, 243, 0.96);
  color: var(--accent-strong);
}

.sidebar-auto-mode-chip:disabled {
  cursor: not-allowed;
  opacity: 0.68;
  transform: none;
}

.sidebar-switch {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-height: 72px;
  padding: 10px 11px;
  border-radius: 16px;
  border: 1px solid rgba(216, 207, 191, 0.9);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background-color 0.16s ease,
    box-shadow 0.16s ease;
}

.sidebar-switch:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 92, 116, 0.38);
}

.sidebar-switch.active {
  border-color: rgba(31, 92, 116, 0.42);
  background: linear-gradient(180deg, rgba(220, 236, 243, 0.9), rgba(246, 251, 254, 0.96));
  box-shadow: 0 10px 20px rgba(31, 92, 116, 0.08);
}

.sidebar-switch-compact {
  width: auto;
  min-height: 0;
  padding: 6px 8px;
  border-radius: 999px;
  gap: 0;
}

.sidebar-switch-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-switch-compact .sidebar-switch-top {
  align-items: center;
  gap: 8px;
}

.sidebar-switch-title {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.sidebar-switch-compact .sidebar-switch-title {
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.sidebar-switch-meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.sidebar-switch-description {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.sidebar-switch-status {
  grid-column: 1 / -1;
  min-height: 0;
}

.sidebar-switch-status.sidebar-switch-status-waiting {
  border-style: dashed;
}

.sidebar-switch-status.sidebar-switch-status-muted {
  opacity: 0.8;
}

.sidebar-codeword-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 2px;
  cursor: default;
}

.sidebar-codeword-control:hover {
  transform: none;
}

.sidebar-codeword-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar-codeword-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.sidebar-codeword-title {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-codeword-description {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.sidebar-codeword-state-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.sidebar-codeword-state-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-codeword-state-value {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-codeword-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-codeword-actions {
  display: flex;
  justify-content: flex-start;
}

.sidebar-codeword-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 128px;
  min-height: 34px;
  padding: 5px 8px 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(216, 207, 191, 0.9);
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    background-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.sidebar-codeword-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 92, 116, 0.38);
}

.sidebar-codeword-toggle.active {
  border-color: rgba(31, 92, 116, 0.42);
  background: linear-gradient(180deg, rgba(220, 236, 243, 0.96), rgba(246, 251, 254, 0.98));
  box-shadow: 0 8px 16px rgba(31, 92, 116, 0.08);
}

.sidebar-codeword-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
  box-shadow: none;
}

.sidebar-codeword-toggle-label {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.sidebar-codeword-badge {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(216, 207, 191, 0.9);
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.sidebar-codeword-badge.active {
  border-color: rgba(31, 92, 116, 0.28);
  background: rgba(220, 236, 243, 0.9);
  color: var(--accent-strong);
}

.sidebar-switch-indicator {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: rgba(157, 170, 183, 0.72);
  transition: background-color 0.16s ease;
}

.sidebar-switch-compact .sidebar-switch-indicator {
  width: 30px;
  height: 18px;
}

.sidebar-switch-indicator::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: white;
  box-shadow: 0 2px 5px rgba(23, 33, 43, 0.18);
  transition: transform 0.16s ease;
}

.sidebar-switch-compact .sidebar-switch-indicator::after {
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
}

.sidebar-switch.active .sidebar-switch-indicator {
  background: rgba(31, 92, 116, 0.86);
}

.sidebar-switch.active .sidebar-switch-indicator::after {
  transform: translateX(14px);
}

.sidebar-switch-compact.active .sidebar-switch-indicator::after {
  transform: translateX(12px);
}

.sidebar-count {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 13px;
}

.sidebar h2 {
  font-size: 17px;
}

.chat-panel h2 {
  font-size: 30px;
  line-height: 0.96;
}

.channel-filters {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 10px;
  margin-top: 18px;
  min-height: 92px;
}

.conversation-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.conversation-search-input {
  width: 100%;
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 14px;
  border: 1px solid rgba(216, 207, 191, 0.9);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.3;
}

.conversation-search-input:focus {
  outline: none;
  border-color: rgba(31, 92, 116, 0.45);
  box-shadow: 0 0 0 3px rgba(31, 92, 116, 0.08);
}

.conversation-search-button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(31, 92, 116, 0.18);
  background: rgba(220, 236, 243, 0.72);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.conversation-search-button:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 92, 116, 0.32);
  background: rgba(220, 236, 243, 0.9);
}

.conversation-search-button:focus {
  outline: none;
  border-color: rgba(31, 92, 116, 0.45);
  box-shadow: 0 0 0 3px rgba(31, 92, 116, 0.08);
}

.conversation-search-status {
  margin-top: -2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}

.channel-filter-toggle {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 14px;
  border: 1px solid rgba(216, 207, 191, 0.9);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.channel-filter-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 92, 116, 0.4);
}

.channel-filter-toggle.open {
  background: rgba(250, 252, 254, 0.98);
}

.channel-filter-toggle-meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.channel-filter-panel {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(216, 207, 191, 0.76);
  background: rgba(255, 255, 255, 0.78);
}

.channel-filter-statuses,
.channel-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.channel-filter-chip {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(216, 207, 191, 0.9);
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.channel-filter-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 92, 116, 0.4);
}

.channel-filter-chip.active {
  border-color: rgba(31, 92, 116, 0.34);
  background: rgba(220, 236, 243, 0.96);
  color: var(--accent-strong);
}

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 14px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(216, 207, 191, 0.76);
  border-radius: 18px;
}

.conversation-card {
  width: 100%;
  padding: 11px 13px;
  border: none;
  border-bottom: 1px solid rgba(216, 207, 191, 0.72);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.9);
  text-align: left;
  cursor: pointer;
  display: block;
  box-shadow: none;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.conversation-card:first-child {
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
}

.conversation-card:last-of-type {
  border-bottom: none;
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 18px;
}

.conversation-card.active {
  background: linear-gradient(180deg, rgba(235, 240, 245, 0.98), rgba(249, 251, 253, 0.98));
}

.conversation-card:hover {
  background: rgba(245, 249, 252, 0.98);
}

.conversation-card-top,
.bubble-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.conversation-card-main {
  min-width: 0;
}

.conversation-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
}

.conversation-card-top strong {
  font-size: 16px;
  line-height: 1.2;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-inline-number {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.channel-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  color: #fff;
  flex: 0 0 auto;
  line-height: 0;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    0 1px 2px rgba(34, 55, 71, 0.12);
}

.channel-badge.channel-badge-compact {
  width: 22px;
  height: 22px;
}

.channel-badge-icon {
  width: 15px;
  height: 15px;
  display: block;
  flex: 0 0 auto;
  color: #fff;
  fill: currentColor;
}

.channel-badge-icon * {
  fill: currentColor !important;
}

.channel-badge.channel-badge-compact .channel-badge-icon {
  width: 13px;
  height: 13px;
}

.channel-badge-textmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1;
  color: #fff;
}

.channel-badge.channel-badge-compact .channel-badge-textmark {
  font-size: 8px;
}

.channel-badge-whatsapp {
  background: #22b35c;
}

.channel-badge-telegram {
  background: #2a9fdf;
}

.channel-badge-viber {
  background: #7360f2;
}

.channel-badge-instagram {
  background: linear-gradient(135deg, #f58529, #dd2a7b 55%, #8134af);
}

.channel-badge-vk {
  background: #3d7af1;
}

.channel-badge-max {
  background: #44505c;
}

.channel-badge-wazzup,
.channel-badge-default {
  background: #70828f;
}

.conversation-card-top span,
.conversation-card-bottom,
.bubble-meta span,
.bubble-foot,
.chat-subtitle,
.chat-toolbar-meta,
.visit-empty,
.empty-list {
  color: var(--muted);
}

.conversation-time {
  flex: 0 0 auto;
  font-size: 13px;
  white-space: nowrap;
}

.conversation-card-bottom {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 3px;
  min-height: 42px;
  font-size: 12px;
}

.conversation-card-status {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  min-width: 64px;
}

.conversation-client-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}

.conversation-client-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
}

.client-status-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.client-status-icon::before {
  content: "";
  display: block;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.client-status-icon.new::after {
  content: "";
  position: absolute;
  width: 2px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.conversation-client-badge.existing {
  background: rgba(51, 106, 75, 0.12);
  color: var(--success);
}

.conversation-client-badge.new {
  background: rgba(194, 111, 69, 0.12);
  color: var(--warm);
}

.client-status-icon.existing {
  background: rgba(51, 106, 75, 0.16);
  color: var(--success);
}

.client-status-icon.existing::before {
  width: 8px;
  height: 4px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  background: transparent;
  border-radius: 0;
  transform: rotate(-45deg) translateY(-1px);
}

.client-status-icon.new {
  background: rgba(194, 111, 69, 0.16);
  color: var(--warm);
}

.conversation-card p {
  margin-top: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.conversation-counter,
.conversation-delivered {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.conversation-counter {
  background: #ef5d4c;
  color: white;
}

.conversation-delivered {
  color: #9aa7b1;
}

.conversation-list-note {
  padding: 12px 14px;
  border-top: 1px solid rgba(216, 207, 191, 0.72);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  background: rgba(255, 255, 255, 0.9);
}

.badge,
.badge-soft,
.badge-warn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  white-space: nowrap;
}

.badge,
.badge-soft {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.badge.warn,
.badge-warn {
  background: rgba(159, 71, 56, 0.14);
  color: var(--warn);
}

.badge.suppressed {
  background: rgba(159, 71, 56, 0.12);
  color: var(--warn);
}

.badge.client-existing {
  background: rgba(51, 106, 75, 0.12);
  color: var(--success);
}

.badge.client-new {
  background: rgba(194, 111, 69, 0.12);
  color: var(--warm);
}

.chat-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: visible;
  position: relative;
}

.chat-panel.is-transitioning::after {
  content: "Открываю диалог…";
  position: absolute;
  inset: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: rgba(255, 251, 245, 0.68);
  backdrop-filter: blur(6px);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  z-index: 3;
}

.chat-panel.is-transitioning .chat-scroll,
.chat-panel.is-transitioning .assistant-context-strip,
.chat-panel.is-transitioning .assistant-suggestion,
.chat-panel.is-transitioning .chat-composer,
.chat-panel.is-transitioning .chat-toolbar,
.chat-panel.is-transitioning .chat-head {
  pointer-events: none;
}

.chat-head-copy {
  max-width: 760px;
}

.chat-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-title-row h2 {
  min-width: 0;
}

.mobile-chat-back-button {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(216, 207, 191, 0.9);
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent-strong);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.mobile-chat-back-button:hover {
  border-color: rgba(31, 92, 116, 0.36);
  background: rgba(220, 236, 243, 0.8);
}

.chat-head-topline {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-head-topline .panel-kicker {
  margin: 0;
  font-size: 10px;
}

.chat-id-button {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.chat-id-button:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.chat-id-button.is-static {
  cursor: default;
  pointer-events: none;
  text-decoration: none;
  color: var(--muted);
}

.chat-head-actions {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: wrap;
  position: relative;
  z-index: 22;
  overflow: visible;
  justify-content: flex-start;
}

.icon-action-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 999px;
  font-size: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.icon-action-button > span {
  font-size: 15px;
  line-height: 1;
}

.chat-subtitle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 3px;
}

.chat-subtitle {
  margin-top: 0;
  font-size: 11px;
  line-height: 1.35;
}

.chat-title-identity {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chat-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px;
  min-height: 34px;
  align-items: center;
  align-content: center;
  overflow-x: visible;
  overflow-y: visible;
  scrollbar-width: none;
  max-width: 74px;
}

.chat-badges::-webkit-scrollbar {
  display: none;
}

.badge.badge-icon-only {
  min-width: 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  position: relative;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.badge-icon-counter {
  position: absolute;
  right: -3px;
  top: -3px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: #ef5d4c;
  color: white;
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
}

.tooltip-trigger {
  position: relative;
}

.tooltip-trigger::after,
.tooltip-trigger::before {
  content: none;
}

.app-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  max-width: min(240px, calc(100vw - 24px));
  padding: 6px 9px;
  border-radius: 9px;
  background: rgba(23, 33, 43, 0.94);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translate3d(0, 4px, 0);
  transition: opacity 0.06s ease, transform 0.06s ease, visibility 0.06s ease;
  z-index: 9999;
}

.app-tooltip:not(.hidden) {
  opacity: 1;
  visibility: visible;
  transform: translate3d(0, 0, 0);
}

.app-tooltip.multiline {
  white-space: normal;
}

.app-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 8px;
  height: 8px;
  transform: translateX(-50%) rotate(45deg);
  background: rgba(23, 33, 43, 0.94);
}

.app-tooltip.is-bottom::after {
  top: -4px;
  bottom: auto;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.info-card {
  padding: 9px 11px;
  border-radius: 12px;
}

.info-card span,
.visit-card small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.info-card strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.25;
}

.visit-strip {
  display: flex;
  gap: 8px;
  overflow: auto;
  margin-top: 10px;
  padding-bottom: 2px;
}

.visit-card {
  min-width: 175px;
  padding: 9px 11px;
  border-radius: 12px;
}

.details-visit-card {
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid rgba(31, 92, 116, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(246, 250, 252, 0.96));
  box-shadow: 0 12px 24px rgba(23, 33, 43, 0.08);
  cursor: pointer;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease;
}

.details-visit-card:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 92, 116, 0.32);
}

.details-visit-card.active {
  border-color: rgba(31, 92, 116, 0.62);
  background:
    linear-gradient(180deg, rgba(220, 236, 243, 0.98), rgba(242, 249, 252, 0.96));
  box-shadow: 0 16px 28px rgba(31, 92, 116, 0.16);
}

.visit-card strong {
  font-size: 13px;
}

.details-visit-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.details-visit-head strong {
  font-size: 14px;
  line-height: 1.25;
}

.details-visit-amount {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.details-visit-body {
  margin-top: 8px;
}

.details-visit-salon {
  display: block;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.details-visit-address {
  color: var(--muted);
}

.visit-card span,
.visit-card p,
.visit-card small {
  margin-top: 4px;
  font-size: 11px;
}

.details-visit-body p {
  line-height: 1.4;
}

.visit-empty {
  padding: 8px 2px 2px;
  font-size: 11px;
}

.chat-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.chat-toolbar-meta {
  flex: 0 0 auto;
  min-width: 0;
  font-size: 12px;
  white-space: nowrap;
}

.chat-search-nav {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
  margin-left: auto;
}

.chat-search-nav-meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.compact {
  min-height: 34px;
  padding: 6px 11px;
  font-size: 13px;
}

.chat-scroll {
  flex: 1 1 auto;
  margin-top: 8px;
  padding: 10px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(249, 243, 233, 0.9)),
    rgba(255, 251, 245, 0.9);
  border: 1px solid rgba(216, 207, 191, 0.7);
  min-height: 0;
  height: auto;
  overflow: auto;
}

.assistant-context-strip {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 12px;
  border: 1px solid rgba(31, 92, 116, 0.12);
  background: rgba(243, 249, 252, 0.88);
  min-height: 0;
  overflow: hidden;
}

.assistant-context-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.assistant-context-head-copy {
  min-width: 0;
}

.assistant-context-head-title {
  display: inline-flex;
  align-items: center;
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.assistant-suggestion {
  display: flex;
  flex-direction: column;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(31, 92, 116, 0.18);
  background:
    linear-gradient(180deg, rgba(237, 247, 251, 0.96), rgba(250, 252, 254, 0.98));
  box-shadow: 0 14px 28px rgba(31, 92, 116, 0.08);
  min-height: 112px;
  flex: 0 0 auto;
  overflow: hidden;
}

.assistant-context-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px 6px;
  min-width: 0;
}

.assistant-context-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  padding: 4px 5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.58);
}

.assistant-context-label {
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.1;
  white-space: normal;
}

.assistant-context-value {
  display: block;
  width: 100%;
  max-width: 100%;
  font-size: 11px;
  line-height: 1.15;
  color: var(--ink);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.assistant-context-item.missing .assistant-context-value {
  color: #b64a37;
}

.assistant-context-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 36px;
}

.assistant-context-actions-spacer {
  display: block;
  width: 1px;
  height: 36px;
  opacity: 0;
}

.assistant-suggestion-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.assistant-suggestion-head-copy {
  min-width: 0;
}

.assistant-suggestion-kicker {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.assistant-suggestion-summary {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.assistant-suggestion-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(31, 92, 116, 0.12);
  color: var(--accent-strong);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.assistant-suggestion-body {
  margin-top: 5px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
  min-height: 44px;
  overflow-wrap: anywhere;
}

.assistant-suggestion-body.loading {
  min-height: 48px;
  display: flex;
  align-items: center;
}

.assistant-suggestion-loading-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.assistant-loading-inline-bullet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(31, 92, 116, 0.08);
}

.assistant-suggestion-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
  position: relative;
  z-index: 1;
}

.chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(216, 207, 191, 0.7);
  min-height: 72px;
  align-items: stretch;
}

.chat-composer-input {
  width: 100%;
  height: 64px;
  min-height: 64px;
  max-height: 64px;
  resize: none;
  overflow-y: auto;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid rgba(216, 207, 191, 0.9);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
}

.chat-composer-input:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bubble-row {
  display: flex;
}

.bubble-row.search-current {
  position: relative;
}

.bubble-row.search-focus-flash .bubble {
  box-shadow: 0 0 0 3px rgba(255, 214, 64, 0.34), 0 14px 28px rgba(214, 170, 43, 0.14);
}

.day-divider {
  display: flex;
  justify-content: center;
  margin: 8px 0 4px;
}

.day-divider span {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(31, 92, 116, 0.1);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}

.bubble-row.inbound {
  justify-content: flex-start;
}

.bubble-row.outbound {
  justify-content: flex-end;
}

.bubble {
  max-width: min(72ch, 78%);
  padding: 10px 12px 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
}

.bubble.search-hit {
  border: 1px solid rgba(214, 170, 43, 0.35);
}

.bubble.search-current {
  border: 1px solid rgba(214, 170, 43, 0.58);
  background: linear-gradient(180deg, rgba(255, 248, 214, 0.98), rgba(255, 252, 238, 0.98));
  box-shadow: 0 10px 22px rgba(214, 170, 43, 0.12);
}

.bubble-row.outbound .bubble {
  background: linear-gradient(180deg, rgba(220, 236, 243, 0.96), rgba(245, 251, 255, 0.95));
}

.bubble.call-event-bubble,
.bubble-row.outbound .bubble.call-event-bubble {
  background: linear-gradient(180deg, rgba(255, 242, 223, 0.98), rgba(255, 249, 239, 0.98));
  border: 1px solid rgba(210, 145, 74, 0.32);
  box-shadow: 0 8px 18px rgba(210, 145, 74, 0.08);
}

.bubble-row.outbound .bubble.search-current {
  background: linear-gradient(180deg, rgba(255, 246, 198, 0.98), rgba(255, 252, 234, 0.98));
}

.bubble-meta {
  align-items: baseline;
  margin-bottom: 5px;
  font-size: 12px;
}

.bubble-body {
  font-size: 15px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

.message-media-link {
  display: inline-block;
  max-width: min(100%, 280px);
  text-decoration: none;
}

.message-media-image {
  display: block;
  max-width: 100%;
  max-height: 360px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 18px rgba(45, 35, 24, 0.12);
}

.message-media-caption {
  margin-top: 8px;
}

.message-attachment-link {
  color: #1f5b87;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.call-message-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  font-size: 15px;
  vertical-align: text-top;
}

.call-message-text {
  display: inline;
}

.call-event-bubble .bubble-meta strong {
  color: #a55d20;
}

.message-search-mark {
  padding: 0 2px;
  border-radius: 4px;
  background: rgba(255, 214, 64, 0.72);
  color: inherit;
}

.bubble-foot {
  margin-top: 6px;
  font-size: 11px;
  display: flex;
  justify-content: flex-end;
}

.no-reply-button {
  margin-top: 8px;
  color: white;
  background: linear-gradient(135deg, #b63d31, #8f2b22);
  border: none;
  font-weight: 700;
}

.no-reply-button:hover {
  transform: translateY(-1px);
}

.restore-reply-button {
  margin-top: 8px;
  color: white;
  background: linear-gradient(135deg, #2f6d4b, #25543a);
  border: none;
  font-weight: 700;
}

.restore-reply-button:hover {
  transform: translateY(-1px);
}

.message-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  min-height: 16px;
  font-size: 12px;
  font-weight: 700;
}

.message-status.sent,
.message-status.delivered {
  color: #9aa7b1;
}

.message-status.read {
  color: #3797ff;
}

.message-status.local,
.message-status.plain {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.message-status.error {
  color: var(--warn);
  font-size: 11px;
}

.history-cap {
  align-self: center;
  margin: 0 auto 4px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(194, 111, 69, 0.12);
  color: var(--warm);
  font-size: 12px;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.empty-chat,
.empty-list {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  line-height: 1.35;
  font-size: 14px;
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
  }

  .workspace {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .workspace.details-open {
    grid-template-columns: 1fr;
  }

  .service-launchpad-card {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar,
  .chat-panel,
  .conversation-list,
  .chat-scroll {
    overflow: visible;
  }

}

@media (max-width: 560px) {
  body {
    overflow: hidden;
  }

  .app-shell {
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    padding: 0;
    gap: 0;
  }

  .topbar,
  .service-launchpad {
    display: none !important;
  }

  .workspace {
    display: block;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
  }

  .workspace.mobile-list-view .chat-panel,
  .workspace.mobile-list-view .details-panel {
    display: none !important;
  }

  .workspace.mobile-chat-view .sidebar,
  .workspace.mobile-chat-view .details-panel {
    display: none !important;
  }

  .workspace.mobile-chat-view .chat-panel {
    display: flex;
  }

  .sidebar,
  .chat-panel {
    height: 100vh;
    min-height: 100vh;
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
    box-shadow: none;
  }

  .sidebar {
    overflow: hidden;
  }

  .chat-panel {
    overflow: hidden;
  }

  .sidebar-head,
  .chat-toolbar,
  .details-panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .sidebar-automation-controls,
  .channel-filters {
    margin-top: 12px;
  }

  .conversation-list {
    margin-top: 12px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
  }

  .chat-head {
    gap: 8px;
  }

  .chat-head-topline {
    display: none;
  }

  .chat-title-row {
    gap: 8px;
  }

  .mobile-chat-view .mobile-chat-back-button:not(.hidden) {
    display: inline-flex;
  }

  .chat-panel h2 {
    font-size: 25px;
    line-height: 0.98;
  }

  .chat-subtitle-row {
    gap: 6px 10px;
  }

  .chat-head-actions,
  .chat-badges {
    align-items: flex-start;
    justify-content: flex-start;
  }

  .chat-toolbar {
    margin-top: 8px;
  }

  .chat-scroll {
    overflow: auto;
  }

  .assistant-context-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .assistant-suggestion,
  .assistant-context-strip {
    margin-top: 8px;
  }

  .chat-composer {
    grid-template-columns: 1fr;
    margin-top: 8px;
  }

  .chat-composer-input {
    min-height: 64px;
  }

  .bubble {
    max-width: 100%;
  }
}
