/* ---------- чаты с клиентами ---------- */
.navbtn { position: relative; }
.navbtn .nbadge { position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #FF5100;
  color: #fff; font: 700 10px/17px system-ui, sans-serif; text-align: center; }
.views > section.chats { padding: 0; overflow: hidden; }
.chwrap { display: grid; grid-template-columns: 320px 1fr; gap: 12px; height: 100%; min-height: 0; }
.chlist { display: flex; flex-direction: column; gap: 8px; min-height: 0; background: var(--panel); border-radius: 18px; padding: 10px; box-shadow: var(--shadow); }
.chflt { display: flex; flex-wrap: wrap; gap: 4px; }
.chflt button { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 5px 10px; font: inherit; font-size: 12px; cursor: pointer; color: var(--ink); }
.chflt button[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
#chQ { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; background: var(--panel-2); color: var(--ink); }
#chItems { overflow-y: auto; min-height: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.chitem { position: relative; display: grid; gap: 2px; text-align: left; border: 0; background: none; border-radius: 12px; padding: 9px 34px 9px 10px; cursor: pointer; font: inherit; color: var(--ink); }
.chitem:hover { background: var(--panel-2); }
.chitem.on { background: var(--panel-2); outline: 1px solid var(--line); }
.chitem .t { display: flex; justify-content: space-between; gap: 6px; }
.chitem .t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.chitem .t small, .chitem .p { color: var(--muted); font-size: 12px; }
.chitem .p, .chitem .l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chitem .l { font-size: 13px; color: var(--muted); }
.chitem.unread .l { color: var(--ink); font-weight: 600; }
.chitem em { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-style: normal; background: #FF5100; color: #fff;
  border-radius: 9px; min-width: 18px; padding: 0 5px; font-size: 11px; line-height: 18px; text-align: center; }
.chitem .new { font-style: normal; color: #FF5100; font-weight: 700; }
.chitem .err, .chm .err { color: var(--bad, #d9534f); font-style: normal; }
.chnone { padding: 14px 6px; text-align: center; }
.chpane { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.chpane.inproj { height: min(62vh, 620px); box-shadow: none; border: 1px solid var(--line); }
.chempty { margin: auto; text-align: center; color: var(--muted); padding: 30px; line-height: 1.6; }
.chhead { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.chhead .chwho { flex: 1; min-width: 0; display: grid; }
.chhead .chwho b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chhead .chwho small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chhead .chwho a { color: inherit; }
.chhead select { max-width: 150px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; font: inherit; font-size: 13px; background: var(--panel); color: var(--ink); }
.chback { display: none; padding: 6px 10px; }
.chmenu { position: relative; }
.chmenu summary { list-style: none; padding: 6px 10px; cursor: pointer; }
.chmenu summary::-webkit-details-marker { display: none; }
.chmenu > div { position: absolute; right: 0; top: 110%; z-index: 20; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px; display: grid; min-width: 220px; }
.chmenu > div button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink); }
.chmenu > div button:hover { background: var(--panel-2); }
.chbar { padding: 8px 12px; font-size: 13px; border-bottom: 1px solid var(--line); }
.chbar.new { background: #fff3ea; color: #8a3a00; }
.chbar.err { background: #fdecea; color: #8b1d16; }
.chbar.wait { background: var(--panel-2); color: var(--muted); }
.chmsgs { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; min-height: 0; background: var(--panel-2); }
#chList { display: flex; flex-direction: column; gap: 6px; }
.chmore { align-self: center; margin-bottom: 8px; font-size: 12px; }
.chday { align-self: center; font-size: 12px; color: var(--muted); margin: 6px 0; }
.chsys { align-self: center; font-size: 12px; color: var(--muted); text-align: center; max-width: 85%; }
.chm { max-width: min(78%, 560px); padding: 7px 10px 5px; border-radius: 14px; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.chm.in { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chm.out { align-self: flex-end; background: #ffe7d6; border-bottom-right-radius: 4px; color: #2a1a10; }
.chm .chby { font-size: 12px; font-weight: 700; color: #b33c00; margin-bottom: 2px; }
.chm .chtx a { color: inherit; text-decoration: underline; }
.chm .chf { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; align-items: flex-start; }
.chm .chf img { width: 150px; height: 150px; object-fit: cover; border-radius: 10px; cursor: zoom-in; background: var(--panel-2); }
.chm .cfile { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .6); border: 1px solid var(--line); border-radius: 10px;
  padding: 5px 8px; font: inherit; font-size: 13px; cursor: pointer; color: inherit; max-width: 100%; }
.chm .cfile span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.chm .chmeta { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; }
.chm.out .chmeta { color: #8a6450; }
.chm .chmeta i { font-style: normal; }
.chm .chfail { font-size: 12px; color: var(--bad, #d9534f); margin-top: 3px; }
.chm .chfail.soft { color: #8a6450; text-align: right; }
.chm .chfail a { color: inherit; }
.chsend { border-top: 1px solid var(--line); padding: 8px 10px; display: grid; gap: 6px; background: var(--panel); }
.chrow { display: flex; gap: 6px; align-items: flex-end; }
.chsend textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; font: inherit; font-size: 14px;
  max-height: 180px; background: var(--panel-2); color: var(--ink); }
.chsend .btn { padding: 9px 12px; }
.chpend { display: flex; flex-wrap: wrap; gap: 6px; }
.chpend:empty { display: none; }
.chpend .nchip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 4px 8px; font-size: 12px; }
.chpend .nchip button { border: 0; background: none; cursor: pointer; color: var(--muted); }
.chhint { font-size: 11px; color: var(--muted); }
.chconnect { display: grid; gap: 8px; padding: 12px; border: 1px dashed var(--line); border-radius: 14px; margin-top: 8px; }
.chconnect input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; background: var(--panel); color: var(--ink); }
.chconnect p { margin: 0; font-size: 13px; }
.chaddmore { margin-top: 10px; }
.chaddmore summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.chtabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chtabs button { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 5px 10px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink); }
.chtabs button.active { background: var(--ink); color: var(--panel); }
.chtabs em { font-style: normal; color: #FF5100; font-weight: 700; }
@media (max-width: 760px) {
  .chwrap { grid-template-columns: 1fr; }
  .chwrap .chpane { display: none; }
  .chwrap.chat-open .chlist { display: none; }
  .chwrap.chat-open .chpane { display: flex; }
  .chback { display: inline-flex; }
  .chm { max-width: 88%; }
  .chhead select { max-width: 110px; }
}
/* 9 кнопок меню на телефоне */
@media (max-width: 700px) { .rail-nav .navbtn { width: 36px; height: 36px; } }
