/* ==========================================================================
   RM GROUP — rozmowa z asystentem wyceny, karta wyceny, zgłoszenie
   ========================================================================== */

.card.is-chat .row, .card.is-chat .card-ft { display: none; }
.chat[hidden], .chat [hidden] { display: none !important; }

.chat { border-top: 0; }
.chat-sum { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; background: var(--paper-2); border-bottom: 1px solid var(--line-l); color: var(--ink); }
.chat-edit { white-space: nowrap; background: none; border: 0; font: inherit; color: var(--red-l); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; letter-spacing: inherit; text-transform: inherit; }

.chat-log { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; padding: 20px; scroll-behavior: smooth; }
.msg { max-width: 86%; padding: 12px 16px; font-size: .95rem; line-height: 1.5; white-space: pre-line; }
.msg--ai { align-self: flex-start; background: var(--paper-2); border-left: 3px solid var(--red); }
.msg--me { align-self: flex-end; background: var(--ink); color: var(--paper); }
.msg--sys { align-self: stretch; max-width: none; font-family: var(--mono); font-size: .78rem; letter-spacing: .02em; color: var(--mute-l); border: 1px dashed var(--line-l); }
.msg--typing { display: flex; gap: 5px; padding: 16px; }
.msg--typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink); animation: tpk 1s ease-in-out infinite; }
.msg--typing i:nth-child(2) { animation-delay: .15s; }
.msg--typing i:nth-child(3) { animation-delay: .3s; }
@keyframes tpk { 0%, 100% { opacity: .2; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

.chat-in { display: flex; border-top: 1.5px solid var(--ink); }
.chat-in input { flex: 1; min-width: 0; border: 0; padding: 16px 20px; font-size: 1rem; background: var(--paper); }
.chat-in input:focus { outline: none; box-shadow: inset 0 -2px 0 var(--red); }
.chat-send { width: 60px; border: 0; background: var(--ink); color: var(--paper); font-size: 1.3rem; cursor: pointer; transition: background .25s; }
.chat-send:hover:not(:disabled) { background: var(--red); }
.chat-in :disabled { opacity: .5; cursor: not-allowed; }
.chat-note { padding: 10px 20px 14px; font-size: .78rem; color: var(--mute-l); }

/* --- Karta wyceny ------------------------------------------------------------ */
.qcard { margin: 0 20px 20px; border: 1.5px solid var(--ink); }
.qcard-hd { padding: 10px 16px; background: var(--ink); color: var(--paper); }
.qcard-svc { padding: 16px 16px 0; font-weight: 600; }
.qcard-big { padding: 6px 16px 16px; font-size: clamp(1.5rem, 3vw, 2.3rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; font-variation-settings: "SHRP" 100, "slnt" -12; }
.qcard-big span { font-size: .5em; font-weight: 500; letter-spacing: 0; color: var(--mute-l); font-variation-settings: "SHRP" 100; }
.qcard-big small { font-family: var(--mono); font-size: .38em; letter-spacing: .1em; text-transform: uppercase; color: var(--red-l); font-variation-settings: normal; }
.qcard-tb { width: 100%; border-collapse: collapse; font-size: .88rem; }
.qcard-tb th, .qcard-tb td { padding: 9px 16px; border-top: 1px solid var(--line-l); text-align: left; font-weight: 400; }
.qcard-tb td { text-align: right; font-family: var(--mono); font-size: .8rem; white-space: nowrap; }
.qcard-tb .is-sum th, .qcard-tb .is-sum td { border-top: 1.5px solid var(--ink); }
.qcard-tb .is-total th, .qcard-tb .is-total td { font-weight: 700; background: var(--paper-2); }
.qcard-notes { list-style: none; padding: 12px 16px 14px; border-top: 1px solid var(--line-l); display: grid; gap: 4px; font-size: .78rem; color: var(--mute-l); }
.qcard-notes li::before { content: "* "; color: var(--red); }

/* --- Zgłoszenie ---------------------------------------------------------------- */
.zgl { margin: 0 20px 20px; padding: 18px; background: var(--paper-2); }
.zgl-h { font-weight: 800; text-transform: uppercase; letter-spacing: -.01em; margin-bottom: 14px; }
.zgl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.zgl-f { display: grid; gap: 6px; }
.zgl-f .mono { color: var(--mute-l); font-size: .66rem; }
.zgl-f input, .zgl-f textarea { border: 0; border-bottom: 1.5px solid var(--ink); background: transparent; padding: 6px 0; font-size: 1rem; }
.zgl-f textarea { min-height: 2.4em; resize: vertical; }
.zgl-f input:focus, .zgl-f textarea:focus { outline: none; border-color: var(--red); }
.zgl-f:has(textarea) { grid-column: 1 / -1; }
.zgl-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.zgl-err { min-height: 1.2em; margin: 10px 0 6px; color: var(--red-l); font-size: .85rem; }
.zgl-ok { font-weight: 600; padding: 4px 0; }
.zgl-ok::before { content: ""; display: inline-block; width: 14px; height: 3px; margin-right: 10px; background: var(--red); transform: skewX(var(--skew)) translateY(-4px); }

@media (max-width: 640px) {
  .zgl-grid { grid-template-columns: 1fr; }
  .chat-log { max-height: 360px; padding: 16px; }
  .qcard, .zgl { margin: 0 12px 16px; }
  .msg { max-width: 94%; }
}

/* Podpowiedzi pod polami karty i formularza */
.hint { flex-basis: 100%; margin-top: 2px; font-size: .8rem; line-height: 1.45; color: var(--mute-l); }
.zgl-f .hint { margin-top: 0; }

/* Szybkie odpowiedzi pod pytaniem asystenta */
.quick { display: flex; flex-wrap: wrap; gap: 8px; padding-left: 4px; }
.quick-btn {
  min-height: 36px; padding: 7px 14px; border: 1px solid var(--ink); background: var(--paper); cursor: pointer;
  font: inherit; font-size: .88rem; font-weight: 500; color: var(--ink); transition: background .2s, color .2s;
}
.quick-btn:hover { background: var(--ink); color: var(--paper); }
.quick-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* Pisanie, ponowienie, link telefonu w komunikatach */
.msg--typing { align-items: center; }
.typing-txt { margin-left: 6px; font-size: .82rem; color: var(--mute-l); }
.msg-retry {
  display: block; margin-top: 10px; padding: 8px 14px; border: 1px solid var(--ink); background: var(--paper); cursor: pointer;
  font-family: var(--display); font-size: .88rem; font-weight: 600; letter-spacing: 0; color: var(--ink);
}
.msg-retry:hover { background: var(--ink); color: var(--paper); }
.tel-link { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.chat-log:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
