/* =========================================================
   chat.css — профессиональный чат заказа: история + composer
   ========================================================= */

.chat { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg); }
.chat__hd {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg-soft);
  font-size: 13px; font-weight: 600; color: var(--ink);
}
.chat__hd .cnt { font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--muted); }
.chat__history {
  padding: 18px 16px; max-height: 62vh; min-height: 240px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
  background:
    radial-gradient(var(--line-2) 0.5px, transparent 0.5px);
  background-size: 22px 22px;
}

.chat-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 20px; color: var(--muted); margin: auto; }
.chat-empty svg { width: 40px; height: 40px; color: var(--muted-2); margin-bottom: 12px; }
.chat-empty b { color: var(--ink); font-size: 14px; margin-bottom: 4px; }

/* Разделитель дня */
.c-day { display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; }
.c-day::before, .c-day::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.c-day span { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .05em; }

/* Ряд сообщения */
.c-row { display: flex; gap: 10px; padding: 3px 0; }
.c-row.me { flex-direction: row-reverse; }
.c-av-col { width: 32px; flex: none; }
.c-av { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; }
.c-main { min-width: 0; max-width: 78%; }
.c-row.me .c-main { align-items: flex-end; display: flex; flex-direction: column; }
.c-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; font-size: 12px; }
.c-head b { color: var(--ink); font-weight: 600; }
.c-head i { font-family: var(--font-mono); font-style: normal; font-size: 9.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 1px 5px; border: 1px solid var(--line); border-radius: 3px; }
.c-time { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted-2); }
.c-time .cn { color: var(--signal); opacity: .8; }
.c-bub {
  padding: 10px 13px; border-radius: 3px 12px 12px 12px;
  background: var(--bg); border: 1px solid var(--line);
  font-size: 13.5px; line-height: 1.5; color: var(--ink); word-wrap: break-word;
}
.c-row.me .c-bub { background: var(--brand-wash); border-color: color-mix(in srgb, var(--brand) 22%, transparent); border-radius: 12px 3px 12px 12px; }
.c-row.grp .c-av { visibility: hidden; }
.c-bub b { font-weight: 700; }
.c-bub code { font-family: var(--font-mono); font-size: 12px; background: var(--bg-soft); padding: 1px 5px; border-radius: 3px; }
.c-bub ul { margin: 6px 0; padding-left: 18px; }
.c-bub a { color: var(--brand); text-decoration: underline; }

/* Вложения в пузыре */
.c-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.c-img { width: 96px; height: 96px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); cursor: pointer; }
.c-img img { width: 100%; height: 100%; object-fit: cover; }
.c-atts { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.fcard { display: flex; align-items: center; gap: 10px; padding: 9px 11px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.fcard:hover { border-color: var(--brand); }
.fcard__ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius); background: var(--bg); color: var(--brand); flex: none; }
.fcard__ic svg { width: 18px; height: 18px; }
.fcard__img { width: 34px; height: 34px; border-radius: var(--radius); object-fit: cover; flex: none; }
.fcard__m { min-width: 0; }
.fcard__n { font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcard__s { font-size: 11px; color: var(--muted); }
.fcard__ok { color: var(--ok-text); font-weight: 600; }

/* ---------- Composer ---------- */
.cx { border-top: 1px solid var(--line); background: var(--bg); position: relative; }
.cx.drag { outline: 2px dashed var(--brand); outline-offset: -6px; }
.cx__drop {
  position: absolute; inset: 0; z-index: 3; display: none;
  align-items: center; justify-content: center; gap: 10px;
  background: color-mix(in srgb, var(--brand-wash) 90%, var(--bg));
  color: var(--brand); font-size: 13.5px; font-weight: 600;
}
.cx.drag .cx__drop { display: flex; }
.cx__drop svg { width: 22px; height: 22px; }
.cx__chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px 0; }
.cx__chips:empty { display: none; }
.pv { display: inline-flex; align-items: center; gap: 7px; padding: 5px 8px 5px 6px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; max-width: 200px; }
.pv img, .pv .pvic { width: 22px; height: 22px; border-radius: 4px; object-fit: cover; flex: none; }
.pv .pvic { display: grid; place-items: center; background: var(--bg); color: var(--brand); }
.pv .pvic svg { width: 13px; height: 13px; }
.pv-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.pv b { cursor: pointer; color: var(--muted); font-weight: 700; padding: 0 2px; }
.pv b:hover { color: var(--signal); }

.cx__ta { width: 100%; border: 0; resize: none; padding: 14px; font: inherit; font-size: 14px; line-height: 1.55; color: var(--ink); background: transparent; max-height: 200px; }
.cx__ta:focus { outline: none; }
.cx__ta::placeholder { color: var(--muted-2); }

.cx__bar { display: flex; align-items: center; gap: 6px; padding: 6px 10px 10px; }
.cx__tools { display: flex; gap: 2px; }
.tbtn { display: grid; place-items: center; width: 32px; height: 32px; background: none; border: 0; border-radius: var(--radius); color: var(--muted); cursor: pointer; font-size: 14px; transition: background var(--dur-fast), color var(--dur-fast); }
.tbtn:hover { background: var(--bg-soft); color: var(--ink); }
.tbtn svg { width: 17px; height: 17px; }
.cx__hint { margin-left: auto; font-size: 11px; color: var(--muted-2); font-family: var(--font-mono); }
.cx__send { display: grid; place-items: center; width: 38px; height: 38px; flex: none; background: var(--brand-fill); color: #fff; border: 0; border-radius: var(--radius); cursor: pointer; transition: background var(--dur-fast), transform var(--dur-fast); }
.cx__send:hover:not(:disabled) { background: var(--brand-fill-2); }
.cx__send:active:not(:disabled) { transform: scale(.94); }
.cx__send:disabled { opacity: .4; cursor: not-allowed; }
.cx__send svg { width: 18px; height: 18px; }

/* Поп-меню эмодзи / шаблонов */
.cx__pop { position: absolute; bottom: 54px; left: 12px; z-index: 5; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-3); padding: 8px; }
.cx__pop[hidden] { display: none; }
.cx__emoji { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; width: 260px; }
.emo { width: 34px; height: 34px; font-size: 18px; background: none; border: 0; border-radius: var(--radius); cursor: pointer; }
.emo:hover { background: var(--bg-soft); }
.cx__tpl { display: flex; flex-direction: column; gap: 2px; width: 320px; max-width: calc(100vw - 60px); }
.tplb { text-align: left; padding: 9px 11px; font-size: 12.5px; color: var(--ink-2); background: none; border: 0; border-radius: var(--radius); cursor: pointer; line-height: 1.4; }
.tplb:hover { background: var(--bg-soft); color: var(--ink); }
