/* Окно чата «Министерства жалоб». Цвета бренда: сургуч, тёплый белый, тёплый чёрный, фиолетовые чернила. */
:root {
  --wax: #8C1D27; --wax-dark: #6E151E; --warm: #FFFCF7; --ink: #231F1C; --violet: #3E3A8C;
  --page: #F3EFE8; --line: #E3DACD; --muted: #6B635B; --bubble: #FFFFFF; --mine: #2F2A26;
  --r: 14px; --w: 760px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font: 400 16px/1.55 Manrope, system-ui, sans-serif; -webkit-font-smoothing: antialiased;
  min-height: 100dvh; display: flex; flex-direction: column; }
button { font: inherit; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: color-mix(in srgb, var(--page) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.logo img { display: block; height: 40px; width: auto; }
.ghost { border: 1px solid var(--line); background: var(--warm); color: var(--ink); border-radius: 10px; padding: 8px 14px; font-weight: 600; font-size: 14px; min-height: 40px; }
.ghost:hover { border-color: #CFC4B4; }
.primary { border: 0; background: var(--wax); color: var(--warm); border-radius: 10px; padding: 12px 18px; font-weight: 700; min-height: 46px; }
.primary:hover { background: var(--wax-dark); }
.primary:disabled { opacity: .6; cursor: default; }

.chat { flex: 1; width: 100%; max-width: var(--w); margin: 0 auto; padding: 22px 16px 24px; display: flex; flex-direction: column; gap: 14px; }
.intro h1 { font-size: clamp(26px, 5vw, 34px); line-height: 1.15; letter-spacing: -.015em; margin: 8px 0 10px; font-weight: 700; }
.intro p { margin: 0 0 16px; color: #4F4943; max-width: 60ch; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.quick button, .btns button { border: 1px solid #D9CFC1; background: var(--warm); color: var(--ink); border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600; min-height: 40px; }
.quick button:hover, .btns button:hover { border-color: var(--wax); color: var(--wax); }

.msgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg .ava { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 9px; overflow: hidden; }
.msg .ava img { width: 100%; height: 100%; display: block; }
.bubble { background: var(--bubble); border: 1px solid var(--line); border-radius: 4px var(--r) var(--r) var(--r); padding: 12px 15px; max-width: 100%; overflow-wrap: anywhere; }
.bubble p { margin: 0 0 8px; } .bubble p:last-child { margin-bottom: 0; }
.bubble ul { margin: 4px 0 8px; padding-left: 20px; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--mine); color: #FBF6EE; border-color: var(--mine); border-radius: var(--r) 4px var(--r) var(--r); max-width: 85%; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0 44px; }

.typing { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; padding-left: 44px; }
.dots { display: inline-flex; gap: 4px; } .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--wax); opacity: .35; animation: b 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes b { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.error { background: #FBE9E7; border: 1px solid #F0C7C2; color: #7A1D17; border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.error button { border: 0; background: none; color: var(--wax); font-weight: 700; text-decoration: underline; }

/* ---------- документ ---------- */
.doc { background: var(--warm); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: 0 14px 34px rgba(35,31,28,.08); }
.doc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: #FBF7F0; }
.doc-kind { font-weight: 700; }
.stamp { display: inline-block; border: 2px solid var(--violet); color: var(--violet); border-radius: 4px; padding: 4px 8px; font: 400 12px/1 'PT Mono', monospace; letter-spacing: .1em; transform: rotate(-3deg); white-space: nowrap; }
.paper { padding: 26px clamp(18px, 5vw, 44px) 22px; font-family: 'PT Serif', Georgia, serif; font-size: 15px; line-height: 1.5; color: #1E1B19; position: relative; }
.paper .hdr { margin-left: auto; width: min(320px, 70%); font-size: 14px; }
.paper .hdr div { margin: 0; }
.paper h3 { text-align: center; font-size: 16px; letter-spacing: .04em; margin: 22px 0 2px; }
.paper .sub { text-align: center; margin: 0 0 14px; }
.paper p { text-indent: 1.25em; margin: 0 0 6px; text-align: justify; }
.paper ol { margin: 4px 0 8px; padding-left: 2.2em; }
.paper .sign { display: flex; justify-content: space-between; margin-top: 20px; }
.blur { position: relative; margin-top: 6px; }
.blur .lines span { display: block; height: 10px; background: #E9E1D5; border-radius: 3px; margin: 9px 0; filter: blur(1.4px); }
.blur .lines span:nth-child(3n) { width: 82%; } .blur .lines span:nth-child(4n) { width: 64%; }
.blur .veil { position: absolute; inset: -6px -10px 0; background: linear-gradient(transparent, var(--warm) 85%); }
.doc-meta { padding: 0 18px 4px; color: var(--muted); font-size: 14px; }
.doc-cta { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.doc-cta .price { font-size: 14px; color: var(--muted); }
.doc-cta .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.steps li { display: flex; gap: 8px; align-items: baseline; }
.steps .n { font: 600 12px/1 'PT Mono', monospace; color: var(--warm); background: var(--ink); border-radius: 50%; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.steps .ok .n { background: #2E7D4F; }
.send-how { background: #F5F0FF; border: 1px solid #DDD6F5; color: #2C2870; border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.send-how b { display: block; margin-bottom: 4px; }
.send-how ul { margin: 0; padding-left: 18px; }
.dl { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }

/* ---------- ввод ---------- */
.composer { position: sticky; bottom: 0; width: 100%; max-width: var(--w); margin: 0 auto; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: 1fr auto; gap: 8px; background: linear-gradient(transparent, var(--page) 22%); }
.composer textarea { resize: none; border: 1px solid #D5CABA; background: #fff; border-radius: 14px; padding: 13px 15px; font: inherit; min-height: 50px; max-height: 180px; color: var(--ink); }
.composer textarea:focus, .dialog input:focus { outline: 2px solid color-mix(in srgb, var(--wax) 50%, transparent); outline-offset: 1px; }
.composer button { width: 50px; height: 50px; border: 0; border-radius: 14px; background: var(--wax); color: var(--warm); display: inline-flex; align-items: center; justify-content: center; align-self: end; }
.composer button svg { width: 22px; height: 22px; }
.composer button:disabled { opacity: .5; }
.fine { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--muted); line-height: 1.4; }

/* ---------- форма данных ---------- */
.dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); background: var(--warm); color: var(--ink); }
.dialog::backdrop { background: rgba(35,31,28,.45); }
.dialog form { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.dialog h2 { margin: 0; font-size: 22px; }
.dialog p { margin: 0; }
.dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; }
.dialog input:not([type=checkbox]) { border: 1px solid #D5CABA; border-radius: 10px; padding: 11px 12px; font: 400 16px/1.3 Manrope, sans-serif; background: #fff; }
.dialog .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dialog .check { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 500; }
.dialog .check input { margin-top: 3px; width: 18px; height: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
@media (max-width: 560px) { .dialog .two { grid-template-columns: 1fr; } .logo img { height: 34px; } .btns { margin-left: 0; } }
