:root {
  --bg: #f4f3f8;
  --panel: #ffffff;
  --panel-2: #f8f7fc;
  --hover: #f3f1fa;
  --line: #e8e5f0;
  --line-2: #d7d2e5;
  --text: #1e1c2a;
  --text-2: #5d596f;
  --text-3: #918da3;
  --accent: #6b46e5;
  --accent-hover: #5a35d6;
  --accent-soft: #efeaff;
  --accent-text: #4a2bbf;
  --on-accent: #ffffff;
  --in: #f1f0f6;
  --out: #ebe5ff;
  --out-text: #261a63;
  --note: #fff5d6;
  --note-line: #f0d98f;
  --note-text: #5f4500;
  --danger: #cf3535;
  --danger-soft: #fdeceb;
  --warn-soft: #fff1d4;
  --warn-text: #8a5800;
  --ok: #18804a;
  --ok-soft: #e4f5eb;
  --shadow: 0 1px 2px rgba(24, 18, 48, .06), 0 12px 32px rgba(24, 18, 48, .12);
  --r: 12px;
  --r-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111017;
    --panel: #1a1922;
    --panel-2: #201f29;
    --hover: #24222f;
    --line: #2c2a38;
    --line-2: #3b3849;
    --text: #ecebf3;
    --text-2: #aba7bd;
    --text-3: #77738a;
    --accent: #8667ff;
    --accent-hover: #9a80ff;
    --accent-soft: #2a2348;
    --accent-text: #c9bcff;
    --in: #24232e;
    --out: #2e2656;
    --out-text: #e6defe;
    --note: #3a3119;
    --note-line: #5b4c22;
    --note-text: #f2dc9f;
    --danger: #ff6b6b;
    --danger-soft: #3b1d21;
    --warn-soft: #3a2e15;
    --warn-text: #f3c56a;
    --ok: #4cc785;
    --ok-soft: #16301f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); }
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
.boot { display: grid; place-items: center; height: 100vh; color: var(--text-2); }
.ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--panel); color: var(--text);
  cursor: pointer; white-space: nowrap; font-weight: 500;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.note-btn { background: var(--note); border-color: var(--note-line); color: var(--note-text); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.danger { color: var(--danger); }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-sm);
  border: 0; background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.input, .select {
  height: 36px; padding: 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--panel); width: 100%;
  outline: none; transition: border-color .12s, box-shadow .12s;
}
.select { padding-right: 30px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23918da3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 16px; }
.select.sm { height: 30px; font-size: 13px; padding-left: 10px; width: auto; }
.input:focus, .select:focus, .ta:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.input:focus-visible, .select:focus-visible, .ta:focus-visible { outline: none; }
label.field { display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px 24px; display: grid; gap: 12px; box-shadow: var(--shadow);
}
.login-card h1 { margin: 6px 0 0; font-size: 22px; }
.login-card p { margin: 0 0 6px; }
.login-err { color: var(--danger); font-size: 13px; min-height: 18px; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; color: #fff; flex: none; }
.logo .ico { width: 20px; height: 20px; }

/* app shell */
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  height: 56px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 12px 0 16px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .logo { width: 32px; height: 32px; }
.brand b { font-size: 16px; }
.brand .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.conn { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.conn.down { background: var(--danger); }
.user-btn { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 4px; border: 0; background: transparent; border-radius: var(--r-sm); cursor: pointer; }
.user-btn:hover { background: var(--hover); }
.user-btn .who { display: grid; text-align: left; line-height: 1.2; }
.user-btn .who small { color: var(--text-3); font-size: 12px; }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px;
}
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--hover); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

.main { flex: 1; min-height: 0; display: grid; grid-template-columns: 360px minmax(0, 1fr); }
.side { min-height: 0; display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line); }
.side-tools { padding: 12px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.search { position: relative; }
.search .ico { position: absolute; left: 11px; top: 10px; color: var(--text-3); }
.search .input { padding-left: 34px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--text-2); cursor: pointer; font-size: 13px;
}
.chip:hover { background: var(--hover); }
.chip.on { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); font-weight: 500; }
.chip .n { font-size: 12px; opacity: .8; }
.list { flex: 1; overflow-y: auto; }
.list-empty { padding: 28px 16px; text-align: center; color: var(--text-2); }

.item { display: flex; gap: 10px; padding: 10px 12px 10px 10px; border-left: 3px solid transparent; border-bottom: 1px solid var(--line); cursor: pointer; }
.item:hover { background: var(--hover); }
.item.sel { background: var(--accent-soft); border-left-color: var(--accent); }
.item-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.item-top, .item-mid { display: flex; align-items: center; gap: 6px; min-width: 0; }
.item-name { flex: 1; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item.unread .item-name { font-weight: 700; }
.item-time { font-size: 12px; color: var(--text-3); flex: none; }
.item-last { flex: 1; min-width: 0; color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item.unread .item-last { color: var(--text); }
.item-last .who { color: var(--text-3); }
.item-tags { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.item-mgr { font-size: 12px; color: var(--text-3); margin-left: 2px; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 600; display: inline-grid; place-items: center; flex: none; }

.tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 12px; white-space: nowrap; background: var(--panel-2); color: var(--text-2); border: 1px solid var(--line); }
.tag .ico { width: 12px; height: 12px; }
.tag-max { font-weight: 600; letter-spacing: .02em; }
.tag-wait { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.tag-warn { background: var(--warn-soft); color: var(--warn-text); border-color: transparent; }
.tag-team { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.tag.lg { height: 26px; padding: 0 9px; font-size: 13px; border-radius: 7px; }

.av { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 600; font-size: 14px; }
.av.sm { width: 28px; height: 28px; font-size: 11px; }
.av0 { background: #ece6ff; color: #4a2bbf; } .av1 { background: #e2f3ff; color: #165a8a; }
.av2 { background: #e3f6ea; color: #1b6a3f; } .av3 { background: #fff0db; color: #8a5300; }
.av4 { background: #ffe6ee; color: #9b2650; } .av5 { background: #e5f5f5; color: #19625f; }
.av6 { background: #f3e6ff; color: #6d2aa3; } .av7 { background: #eceef2; color: #3d4452; }
@media (prefers-color-scheme: dark) {
  .av0 { background: #322a5c; color: #d2c6ff; } .av1 { background: #173247; color: #a9d8ff; }
  .av2 { background: #173426; color: #9fe2bb; } .av3 { background: #3c2c12; color: #ffd38a; }
  .av4 { background: #40202d; color: #ffb3cb; } .av5 { background: #15393a; color: #9fe3e0; }
  .av6 { background: #35224a; color: #e2c2ff; } .av7 { background: #2a2d35; color: #c8cdd8; }
}

/* dialog pane */
.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.pane-empty { margin: auto; text-align: center; color: var(--text-2); padding: 24px; max-width: 360px; }
.pane-empty .logo { margin: 0 auto 14px; width: 48px; height: 48px; border-radius: 14px; }
.pane-empty h2 { color: var(--text); font-size: 18px; margin: 0 0 6px; }
.dlg-head { flex: none; background: var(--panel); border-bottom: 1px solid var(--line); padding: 10px 16px; display: grid; gap: 8px; }
.dlg-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dlg-title .back { display: none; margin-left: -8px; }
.dlg-name { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlg-sub { color: var(--text-2); font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dlg-sub .phone { color: var(--text); font-variant-numeric: tabular-nums; }
.dlg-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dlg-actions .spacer { flex: 1; }
.resp { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.resp b { color: var(--text); font-weight: 500; }
.phone-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); }
.phone-form .input { width: 220px; height: 32px; }

.msgs { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 6px; }
.day { align-self: center; margin: 10px 0 6px; padding: 2px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 12px; color: var(--text-2); }
.ev { align-self: center; max-width: 80%; text-align: center; font-size: 12px; color: var(--text-3); padding: 2px 8px; }
.ev .sync { justify-content: center; }
.msg { display: flex; flex-direction: column; max-width: min(640px, 82%); }
.msg.in { align-self: flex-start; align-items: flex-start; }
.msg.out, .msg.note { align-self: flex-end; align-items: flex-end; }
.msg .meta { font-size: 12px; color: var(--text-3); margin: 6px 4px 2px; display: flex; gap: 6px; align-items: center; }
.bubble { max-width: 100%; min-width: 0; padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.msg.in .bubble { background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.out .bubble { background: var(--out); color: var(--out-text); border-bottom-right-radius: 4px; }
.msg.out .bubble a { color: inherit; }
.msg.note .bubble { background: var(--note); color: var(--note-text); border: 1px dashed var(--note-line); border-bottom-right-radius: 4px; }
.msg .time { font-size: 11px; opacity: .65; margin-left: 8px; float: right; margin-top: 4px; }
.atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; max-width: 100%; min-width: 0; }
.atts:first-child { margin-top: 0; }
.att-img img { display: block; max-width: min(240px, 100%); max-height: 240px; border-radius: 10px; object-fit: cover; background: var(--panel-2); }
.att-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 8px; background: rgba(127, 127, 160, .12); color: inherit; text-decoration: none; font-size: 13px; max-width: 100%; min-width: 0; }
.att-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync { display: flex; gap: 10px; font-size: 11px; color: var(--text-3); margin: 2px 4px 0; flex-wrap: wrap; }
.sync .ok { color: var(--ok); }
.sync .bad { color: var(--danger); }
.sync span { display: inline-flex; align-items: center; gap: 3px; }
.sync .ico { width: 12px; height: 12px; }

.composer { flex: none; background: var(--panel); border-top: 1px solid var(--line); padding: 10px 16px 12px; display: grid; gap: 8px; }
.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); width: max-content; }
.seg button { border: 0; background: transparent; padding: 4px 12px; border-radius: 7px; cursor: pointer; color: var(--text-2); font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); font-weight: 500; }
.seg button.on.note-on { background: var(--note); color: var(--note-text); }
.comp-row { display: flex; gap: 8px; align-items: flex-end; }
.ta { flex: 1; min-width: 0; min-height: 40px; max-height: 40vh; resize: none; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); outline: none; line-height: 1.45; }
.composer.note-mode .ta { background: var(--note); border-color: var(--note-line); }
.comp-row .btn { height: 40px; }
.comp-hint { font-size: 12px; color: var(--text-3); }
.comp-err { font-size: 13px; color: var(--danger); }

/* modal */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(15, 12, 28, .45); display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.modal.wide { max-width: 980px; }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 10px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.modal-head h2 { margin: 0; font-size: 17px; flex: 1; }
.modal-body { padding: 16px 20px 20px; display: grid; gap: 14px; }
.mgr { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; }
.card { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 10px; background: var(--panel-2); }
.card h3 { margin: 0; font-size: 14px; }
.creds { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--r-sm); background: var(--ok-soft); color: var(--text); }
.creds code { font-size: 14px; background: var(--panel); padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); }
.err-box { padding: 10px 12px; border-radius: var(--r-sm); background: var(--danger-soft); color: var(--danger); font-size: 13px; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
.tbl th { text-align: left; font-weight: 500; color: var(--text-2); padding: 9px 10px; border-bottom: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.off td { color: var(--text-3); }
.tbl .input, .tbl .select { height: 32px; font-size: 13px; }
.tbl .acts { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.warn-text { color: var(--warn-text); }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { padding: 10px 14px; border-radius: 10px; background: var(--text); color: var(--panel); box-shadow: var(--shadow); font-size: 13px; }
.toast.err { background: var(--danger); color: #fff; }

@media (max-width: 860px) {
  .main { grid-template-columns: 1fr; }
  .app.dlg-open .side { display: none; }
  .app:not(.dlg-open) .pane { display: none; }
  .dlg-title .back { display: inline-grid; }
  .brand .muted, .user-btn .who { display: none; }
  .topbar { padding: 0 8px 0 12px; }
  .msg { max-width: 90%; }
  .msgs { padding: 12px 10px 6px; }
  .dlg-head, .composer { padding-left: 12px; padding-right: 12px; }
  .phone-form .input { width: 100%; }
  .dlg-actions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px 2px; }
  .dlg-actions::-webkit-scrollbar { display: none; }
  .dlg-actions > * { flex: none; }
  .dlg-actions .spacer, .resp .resp-label { display: none; }
  .comp-hint { font-size: 11px; }
}

/* второй этап: файлы, шаблоны, поиск по переписке */
.composer { position: relative; }
.comp-row .icon-btn { height: 40px; width: 36px; flex: none; }
.files { display: flex; flex-wrap: wrap; gap: 6px; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 280px; min-width: 0; padding: 4px 4px 4px 6px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel-2); font-size: 13px; }
.file-chip img { width: 30px; height: 30px; border-radius: 6px; object-fit: cover; flex: none; }
.file-chip .muted { font-size: 12px; white-space: nowrap; }
.file-chip.up { opacity: .7; }
.file-chip.bad { border-color: var(--danger); }
.icon-btn.sm-x { width: 24px; height: 24px; }
.icon-btn.sm-x .ico { width: 14px; height: 14px; }
.picker { position: absolute; left: 12px; right: 12px; bottom: calc(100% - 4px); z-index: 25; display: flex; flex-direction: column; gap: 8px; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); max-height: min(60vh, 460px); }
.picker-list { flex: 1 1 auto; overflow-y: auto; display: grid; align-content: start; gap: 2px; min-height: 0; }
.picker-item { display: grid; gap: 2px; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.picker-item:hover, .picker-item.on { background: var(--accent-soft); }
.picker-item .muted { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-empty { padding: 10px; }
.picker-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; flex-wrap: wrap; }
.found-head { padding: 10px 14px; font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--panel-2); border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); }
.item.found { padding-top: 8px; padding-bottom: 8px; }
.found-snip { font-size: 13px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.found-snip .who { color: var(--text-3); }
mark { background: #ffe27a; color: inherit; border-radius: 3px; padding: 0 1px; }
.msg.flash .bubble, .ev.flash { outline: 2px solid var(--accent); outline-offset: 2px; transition: outline-color .4s; }
.att-sticker { width: 120px; height: auto; display: block; }
.att-audio { display: grid; gap: 4px; max-width: 100%; }
.att-audio audio { width: 280px; max-width: 100%; height: 36px; }
.att-transcript { font-size: 12px; font-style: italic; opacity: .8; white-space: normal; }
.att-video { position: relative; display: block; line-height: 0; }
.att-video img { max-width: min(260px, 100%); max-height: 260px; border-radius: 10px; object-fit: cover; }
.att-video .play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 44px; height: 44px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; }
.att-video .play .ico { width: 20px; height: 20px; fill: #fff; stroke: none; }
.pane.drop { outline: 3px dashed var(--accent); outline-offset: -10px; }
.tpl-row { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); }
.tpl-main { min-width: 0; display: grid; gap: 4px; }
.tpl-text { white-space: pre-wrap; font-size: 13px; color: var(--text-2); max-height: 7.5em; overflow: hidden; }
.tpl-ta { min-height: 180px; max-height: none; }
.acts-row { display: flex; gap: 8px; flex-wrap: wrap; }
@media (prefers-color-scheme: dark) {
  mark { background: #6b5a14; }
}
@media (max-width: 860px) {
  .picker { left: 8px; right: 8px; max-height: 55vh; }
  .picker-foot .muted { display: none; }
  .comp-row { gap: 4px; }
  .comp-row .icon-btn { width: 32px; }
  .comp-row .btn { width: 44px; padding: 0; flex: none; }
  .comp-row .btn .btn-text { display: none; }
  .tpl-row { flex-direction: column; }
  .file-chip { max-width: 100%; }
}
