/* «Диалоги» поверх HeroUI + roi-theme.css. Свои классы — с префиксом dl-, чтобы не совпасть с утилитами. */
html, body { height: 100%; overflow: hidden; }
body { overscroll-behavior: none; }
.shell { height: 100vh; height: 100dvh; display: flex; }
.dl-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
.dl-list { width: 100%; }
.dl-chat { width: 100%; display: none; }
.shell.dl-open .dl-list { display: none; }
.shell.dl-open .dl-chat { display: flex; }
@media (min-width: 900px) {
  .dl-list { width: 360px; flex: 0 0 360px; border-right: 1px solid var(--separator); }
  .dl-chat, .shell.dl-open .dl-chat { display: flex; flex: 1; }
  .shell.dl-open .dl-list { display: flex; }
  .dl-back { display: none !important; }
}

/* ── список ── */
.dl-head { padding: calc(14px + var(--roi-top)) 16px 10px; display: flex; flex-direction: column; gap: 10px; }
.dl-title { font-size: 34px; margin: 0; }
.dl-tabs { display: flex; gap: 6px; background: var(--surface-secondary); border-radius: 12px; padding: 3px; }
.dl-tab { flex: 1; border: 0; background: none; color: var(--muted); font: 500 13.5px Inter, sans-serif; padding: 7px 8px; border-radius: 9px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.dl-tab.is-on { background: var(--surface); color: var(--foreground); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.dl-search { position: relative; }
.dl-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.dl-search input { width: 100%; box-sizing: border-box; border: 1px solid var(--border); background: var(--surface); color: var(--foreground);
  border-radius: 12px; padding: 9px 12px 9px 36px; font: 400 14.5px Inter, sans-serif; outline: none; }
.dl-search input:focus { border-color: var(--accent); }
.dl-rows { flex: 1; overflow-y: auto; padding: 0 8px calc(12px + env(safe-area-inset-bottom, 0px)); }
.dl-row { display: flex; gap: 11px; align-items: center; padding: 9px 8px; border-radius: 14px; cursor: pointer; user-select: none; }
.dl-row:hover { background: var(--surface-secondary); }
.dl-row.is-on { background: var(--accent-soft); }
.dl-ava { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  font: 600 16px Inter, sans-serif; background: linear-gradient(135deg, var(--roi-g1), var(--roi-g2)); }
.dl-ava.sm { width: 38px; height: 38px; flex-basis: 38px; font-size: 14px; }
.dl-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dl-row-top, .dl-row-bot { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dl-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.dl-time { font-size: 12px; color: var(--muted); flex: none; }
.dl-prev { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.dl-prev b { color: var(--foreground); font-weight: 500; }
.dl-badge { min-width: 20px; height: 20px; padding: 0 6px; box-sizing: border-box; border-radius: 10px; background: var(--accent); color: #fff;
  font: 600 12px/20px Inter, sans-serif; text-align: center; flex: none; }
.dl-badge[hidden] { display: none; }
.dl-chip { font-size: 11px; padding: 1px 7px; border-radius: 8px; background: var(--danger-soft, rgba(220,38,38,.12)); color: var(--danger); flex: none; }
.dl-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; color: var(--muted);
  padding: 40px 24px; flex: 1; }
.dl-empty svg { color: var(--accent); }
.dl-empty b { color: var(--foreground); font-size: 16px; }

/* ── чат ── */
.dl-bar { display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--roi-top)) 12px 10px; border-bottom: 1px solid var(--separator);
  background: var(--background); }
.dl-icon-btn { border: 0; background: none; color: var(--accent); width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  cursor: pointer; flex: none; padding: 0; }
.dl-icon-btn:hover { background: var(--surface-secondary); }
.dl-bar-main { flex: 1; min-width: 0; }
.dl-bar-name { font-weight: 600; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-bar-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: text; }
.dl-feed { flex: 1; overflow-y: auto; padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 3px; overscroll-behavior: contain; }
.dl-feed-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.dl-day { align-self: center; font-size: 12px; color: var(--muted); background: var(--surface-secondary); padding: 3px 10px; border-radius: 10px; margin: 10px 0 6px; }
.dl-msg-row { display: flex; transition: transform .18s ease; }
.dl-msg-row.out { justify-content: flex-end; }
.dl-msg { max-width: min(78%, 560px); padding: 7px 11px 6px; border-radius: 17px; font-size: 14.5px; line-height: 1.4; white-space: pre-wrap;
  word-break: break-word; position: relative; user-select: text; -webkit-user-select: text; }
.dl-msg.in { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.dl-msg.out { background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.dl-msg.is-hl { animation: dl-hl 1.2s ease; }
@keyframes dl-hl { 0%, 40% { box-shadow: 0 0 0 3px var(--accent-soft); } 100% { box-shadow: none; } }
.dl-msg.deleted { font-style: italic; opacity: .65; }
.dl-meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: 11px; opacity: .72; margin-top: 2px; user-select: none; }
.dl-msg.out .dl-meta { opacity: .85; }
.dl-meta .dl-failed { color: var(--danger); opacity: 1; display: inline-flex; align-items: center; gap: 3px; }
.dl-msg.out .dl-meta .dl-failed { color: #fff; font-weight: 600; }
.dl-quote { border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 3px 8px; margin: 1px 0 5px; font-size: 13px;
  cursor: pointer; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; }
.dl-quote b { display: block; font-weight: 600; font-size: 12.5px; color: var(--accent); }
.dl-msg.out .dl-quote { border-left-color: #fff; background: rgba(255,255,255,.18); }
.dl-msg.out .dl-quote b { color: #fff; }
.dl-reacts { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.dl-react { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border-radius: 11px; font-size: 11.5px; background: var(--accent-soft);
  color: var(--accent); border: 0; cursor: pointer; }
.dl-msg.out .dl-react { background: rgba(255,255,255,.22); color: #fff; }
.dl-react.mine { outline: 1.5px solid currentColor; }
.dl-msg blockquote { margin: 3px 0; padding: 2px 9px; border-left: 3px solid currentColor; opacity: .92; }
.dl-msg code, .dl-editor code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: rgba(127,127,127,.16);
  padding: 0 4px; border-radius: 4px; }
.dl-msg pre { margin: 3px 0; padding: 6px 8px; background: rgba(127,127,127,.16); border-radius: 8px; font-family: ui-monospace, Menlo, monospace;
  font-size: 13px; white-space: pre-wrap; }
.dl-msg a { color: inherit; text-decoration: underline; }
.dl-sp { background: currentColor; border-radius: 4px; cursor: pointer; transition: background .2s; }
.dl-sp.is-open { background: rgba(127,127,127,.18); }
.dl-editor .dl-sp { background: rgba(127,127,127,.35); filter: none; }
.dl-new { position: absolute; right: 14px; bottom: 12px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--accent); display: grid; place-items: center; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.dl-new[hidden] { display: none; }
.dl-new .dl-badge { position: absolute; top: -7px; right: -4px; }

/* ── поле ввода ── */
.dl-composer { border-top: 1px solid var(--separator); background: var(--background);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 6px; }
.dl-ctx { display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.dl-ctx[hidden] { display: none; }
.dl-ctx svg { color: var(--accent); flex: none; }
.dl-ctx-main { flex: 1; min-width: 0; border-left: 2px solid var(--accent); padding-left: 8px; font-size: 13px; }
.dl-ctx-main b { display: block; color: var(--accent); font-weight: 600; font-size: 12.5px; }
.dl-ctx-main span { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-fmt { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.dl-fmt[hidden] { display: none; }
.dl-fmt button { border: 0; background: var(--surface-secondary); color: var(--foreground); min-width: 34px; height: 32px; border-radius: 8px;
  display: grid; place-items: center; cursor: pointer; padding: 0 6px; flex: none; }
.dl-fmt button:hover { color: var(--accent); }
.dl-input-row { display: flex; align-items: flex-end; gap: 6px; }
.dl-editor { flex: 1; min-width: 0; max-height: 40vh; overflow-y: auto; border: 1px solid var(--border); background: var(--surface);
  border-radius: 18px; padding: 9px 14px; font: 400 15px/1.4 Inter, sans-serif; outline: none; white-space: pre-wrap; word-break: break-word; }
.dl-editor:focus { border-color: var(--accent); }
.dl-editor:empty::before { content: attr(data-ph); color: var(--muted); pointer-events: none; }
.dl-editor blockquote { margin: 2px 0; padding: 0 8px; border-left: 3px solid var(--accent); }
.dl-send { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid;
  place-items: center; cursor: pointer; }
.dl-send:disabled { opacity: .45; cursor: default; }
.dl-readonly { display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--muted); font-size: 13.5px; padding: 6px; text-align: center; }

/* ── меню сообщения ── */
.dl-menu-bg { position: fixed; inset: 0; z-index: 90; }
.dl-menu { position: fixed; z-index: 91; min-width: 220px; background: var(--overlay, var(--surface)); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 6px; display: flex; flex-direction: column; }
.dl-menu-reacts { display: flex; gap: 2px; padding: 2px 2px 6px; border-bottom: 1px solid var(--separator); margin-bottom: 4px; }
.dl-menu-reacts button { flex: 1; border: 0; background: none; color: var(--foreground); height: 38px; border-radius: 10px; display: grid;
  place-items: center; cursor: pointer; }
.dl-menu-reacts button:hover, .dl-menu-reacts button.is-on { background: var(--accent-soft); color: var(--accent); }
.dl-menu-item { border: 0; background: none; color: var(--foreground); display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 10px; font: 400 14.5px Inter, sans-serif; cursor: pointer; text-align: left; }
.dl-menu-item:hover { background: var(--surface-secondary); }
.dl-menu-item.danger { color: var(--danger); }

/* ── служебные экраны ── */
.dl-screen { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; background: var(--background); }
.dl-screen .card { max-width: 360px; width: 100%; text-align: center; }
.dl-toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 120;
  background: var(--foreground); color: var(--background); padding: 8px 14px; border-radius: 12px; font-size: 13.5px; max-width: 86vw; }
.dl-skel { height: 58px; border-radius: 14px; margin: 4px 0; }
@media (prefers-reduced-motion: reduce) { .dl-msg-row, .dl-msg.is-hl { transition: none; animation: none; } }
