/* Guided estimate chat (js/estimate-chat.js). Shared by estimate.php and the floating chat (assets/css/chat-widget.css),
   so it carries its own tokens and primitives and adapts to its own width instead of the viewport. */
.estimate-chat {
    --estimate-brand: #4f46e5;
    --estimate-brand-strong: #4338ca;
    --estimate-text: #252b3a;
    --estimate-text-soft: #667085;
    --estimate-text-faint: #8a94a6;
    --estimate-line: #e5e9f2;
    --estimate-success: #137a55;
    container: estimate-chat / inline-size;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    scroll-margin-top: 100px;
    color: var(--estimate-text);
    font-family: Pretendard, "Pretendard Variable", "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: normal;
    text-align: left;
    word-break: keep-all;
}
.estimate-chat *, .estimate-chat *::before, .estimate-chat *::after { box-sizing: border-box; }
.estimate-chat__sr { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; }
.estimate-chat__head { display: flex; align-items: center; gap: 14px; padding: 18px 24px; border-bottom: 1px solid var(--estimate-line); background: #fff; }
.estimate-chat__avatar { flex: 0 0 auto; display: grid; width: 44px; height: 44px; place-items: center; border-radius: 14px; color: #fff; background: linear-gradient(140deg, #6d6af5, var(--estimate-brand-strong)); }
.estimate-chat__avatar svg { width: 24px; height: 24px; }
.estimate-chat__title { flex: 1 1 auto; min-width: 0; }
.estimate-chat__title h2 { margin: 0; color: var(--estimate-text); font-size: 18px; font-weight: 800; line-height: 1.4; letter-spacing: -0.02em; }
.estimate-chat__title p { margin: 2px 0 0; color: var(--estimate-text-soft); font-size: 14px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.estimate-chat__reset { flex: 0 0 auto; min-height: 40px; padding: 0 14px; border: 1px solid var(--estimate-line); border-radius: 10px; color: var(--estimate-text); background: #f8f9fc; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.estimate-chat__reset:hover { border-color: #c9cde0; }
.estimate-chat__log { position: relative; display: flex; flex-direction: column; gap: 10px; height: clamp(440px, 62vh, 620px); padding: 24px; overflow-y: auto; overscroll-behavior: contain; background: #f6f7fb; }
.estimate-chat__log:focus-visible, .estimate-chat__reset:focus-visible, .estimate-chat__send:focus-visible, .estimate-chat__choice:focus-visible, .estimate-chat__pill:focus-visible, .estimate-chat__link:focus-visible, .estimate-chat__button:focus-visible { outline: 3px solid rgba(79, 70, 229, .28); outline-offset: 2px; }
.estimate-chat__row { display: flex; align-items: flex-end; gap: 8px; }
.estimate-chat__row--user { justify-content: flex-end; }
.estimate-chat__face { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px var(--estimate-line); object-fit: cover; }
.estimate-chat__row--assistant + .estimate-chat__row--assistant .estimate-chat__face { visibility: hidden; }
.estimate-chat__bubble { max-width: min(560px, 86%); margin: 0; padding: 11px 16px; border: 1px solid var(--estimate-line); border-radius: 18px 18px 18px 6px; color: var(--estimate-text); background: #fff; font-size: 16px; line-height: 1.65; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; }
.estimate-chat__row--user .estimate-chat__bubble { border-color: var(--estimate-brand); border-radius: 18px 18px 6px 18px; color: #fff; background: var(--estimate-brand); }
.estimate-chat__typing .estimate-chat__bubble { display: flex; align-items: center; gap: 5px; min-height: 46px; }
.estimate-chat__typing i { width: 7px; height: 7px; border-radius: 50%; background: #a3a8c3; animation: estimate-chat-dot 1.2s ease-in-out infinite; }
.estimate-chat__typing i:nth-of-type(2) { animation-delay: .15s; }
.estimate-chat__typing i:nth-of-type(3) { animation-delay: .3s; }
.estimate-chat__typing em { margin-left: 8px; color: var(--estimate-text-soft); font-size: 14px; font-style: normal; }
.estimate-chat__typing em[hidden] { display: none; }
@keyframes estimate-chat-dot { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.estimate-chat__note { align-self: center; max-width: 90%; margin: 4px 0; padding: 8px 14px; border-radius: 999px; color: #9a3412; background: #fff4e5; font-size: 14px; line-height: 1.5; text-align: center; }
.estimate-chat__prompt { display: grid; gap: 8px; margin: 2px 0 4px; }
.estimate-chat__choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-width: 620px; }
.estimate-chat__choice { padding: 12px 14px; border: 1px solid #d6d8f3; border-radius: 14px; color: var(--estimate-text); background: #fff; font: inherit; text-align: left; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.estimate-chat__choice strong { display: block; font-size: 16px; font-weight: 800; line-height: 1.4; }
.estimate-chat__choice span { display: block; margin-top: 3px; color: var(--estimate-text-soft); font-size: 14px; line-height: 1.5; }
.estimate-chat__choice:hover { border-color: var(--estimate-brand); background: #f7f6ff; }
.estimate-chat__choice[aria-pressed="true"] { border-color: var(--estimate-brand); background: #f1f0ff; box-shadow: inset 0 0 0 1px var(--estimate-brand); }
.estimate-chat__pills { display: flex; flex-wrap: wrap; gap: 8px; max-width: 640px; }
.estimate-chat__pill { min-height: 44px; padding: 8px 16px; border: 1px solid #d6d8f3; border-radius: 999px; color: var(--estimate-brand-strong); background: #fff; font: inherit; font-size: 15px; font-weight: 700; line-height: 1.4; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.estimate-chat__pill:hover { border-color: var(--estimate-brand); background: #f7f6ff; }
.estimate-chat__pill--primary { border-color: var(--estimate-brand); color: #fff; background: var(--estimate-brand); }
.estimate-chat__pill--primary:hover { background: var(--estimate-brand-strong); }
.estimate-chat__pill:disabled { border-color: #d9dce6; color: #9aa1b2; background: #f1f2f6; cursor: not-allowed; }
.estimate-chat__summary, .estimate-chat__form { flex: 0 0 auto; width: min(640px, 100%); padding: 22px; border: 1px solid #cfd2f5; border-radius: 18px; background: #fff; box-shadow: 0 12px 30px rgba(79, 70, 229, .08); }
.estimate-chat__eyebrow { margin: 0 0 8px; color: var(--estimate-brand); font-size: 12px; font-weight: 800; line-height: 1.4; letter-spacing: 0.14em; }
.estimate-chat__summary h3 { margin: 0; color: var(--estimate-text); font-size: 20px; font-weight: 800; line-height: 1.4; letter-spacing: -0.02em; text-wrap: balance; }
.estimate-chat__overview { margin: 8px 0 0; color: var(--estimate-text-soft); font-size: 16px; line-height: 1.7; text-wrap: pretty; }
.estimate-chat__facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0 16px; margin: 16px 0 0; padding: 4px 0; border-top: 1px solid var(--estimate-line); border-bottom: 1px solid var(--estimate-line); }
.estimate-chat__facts dt, .estimate-chat__facts dd { margin: 0; padding: 7px 0; font-size: 15px; line-height: 1.5; }
.estimate-chat__facts dt { color: var(--estimate-text-soft); }
.estimate-chat__facts dd { color: var(--estimate-text); font-weight: 700; }
.estimate-chat__requests { display: grid; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.estimate-chat__requests li { position: relative; padding-left: 22px; color: var(--estimate-text); font-size: 15px; line-height: 1.55; }
.estimate-chat__requests li::before { content: "✓"; position: absolute; left: 0; color: var(--estimate-success); font-weight: 900; }
.estimate-chat__price { margin-top: 16px; padding: 16px 18px; border-radius: 14px; background: #f3f2ff; }
.estimate-chat__price > span { display: block; color: var(--estimate-brand-strong); font-size: 14px; font-weight: 800; }
.estimate-chat__price strong { display: block; margin-top: 4px; color: var(--estimate-text); font-size: clamp(24px, 3vw, 30px); font-weight: 850; line-height: 1.25; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.estimate-chat__price strong span { display: block; font-size: 19px; letter-spacing: -0.02em; }
.estimate-chat__price small { display: block; margin-top: 6px; color: var(--estimate-text-soft); font-size: 14px; line-height: 1.55; }
.estimate-chat__price-notes { margin: 6px 0 0; color: var(--estimate-text-faint); font-size: 14px; line-height: 1.55; }
.estimate-chat__price-notes:empty { display: none; }
.estimate-chat__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.estimate-chat__button { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; gap: 8px; padding: 0 22px; border: 1px solid var(--estimate-line); border-radius: 12px; color: var(--estimate-text); background: #f8f9fc; font: inherit; font-size: 15px; font-weight: 800; text-decoration: none; cursor: pointer; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.estimate-chat__button:hover { transform: translateY(-1px); }
.estimate-chat__button--primary { border-color: transparent; color: #fff; background: var(--estimate-brand); }
.estimate-chat__button--primary:hover { background: var(--estimate-brand-strong); }
.estimate-chat__button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.estimate-chat__link { min-height: 44px; padding: 0 6px; border: 0; color: var(--estimate-brand-strong); background: none; font: inherit; font-size: 15px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.estimate-chat__link:disabled { color: #9aa1b2; cursor: not-allowed; }
.estimate-chat__cases { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--estimate-line); }
.estimate-chat__cases h4 { margin: 0 0 8px; color: var(--estimate-text-soft); font-size: 14px; font-weight: 800; }
.estimate-chat__cases ul { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.estimate-chat__cases a { color: var(--estimate-brand-strong); font-size: 16px; font-weight: 800; text-decoration: none; }
.estimate-chat__cases a:hover { text-decoration: underline; }
.estimate-chat__cases p { margin: 2px 0 0; color: var(--estimate-text-soft); font-size: 14px; line-height: 1.6; text-wrap: pretty; }
.estimate-chat__form { display: grid; gap: 14px; }
.estimate-chat__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.estimate-chat__form label:not(.estimate-chat__consent):not(.estimate-chat__hp) { display: grid; gap: 6px; color: var(--estimate-text); font-size: 15px; font-weight: 800; }
.estimate-chat__label em { margin-left: 4px; color: var(--estimate-text-faint); font-size: 14px; font-style: normal; font-weight: 600; }
.estimate-chat__form input:not([type="checkbox"]), .estimate-chat__form textarea { width: 100%; min-height: 48px; margin: 0; padding: 11px 14px; border: 1px solid #d9deea; border-radius: 12px; color: var(--estimate-text); background: #fff; font: inherit; font-size: 16px; font-weight: 500; line-height: 1.5; box-shadow: none; }
.estimate-chat__form textarea { min-height: 150px; resize: vertical; }
.estimate-chat__form input:focus-visible, .estimate-chat__form textarea:focus-visible { outline: 3px solid rgba(79, 70, 229, .28); outline-offset: 1px; }
.estimate-chat__consent { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; color: var(--estimate-text-soft); font-size: 14px; line-height: 1.6; cursor: pointer; }
.estimate-chat__consent input { width: 20px; min-height: 20px; margin: 2px 0 0; accent-color: var(--estimate-brand); }
.estimate-chat__consent span { color: inherit; font-size: inherit; font-weight: 500; }
.estimate-chat__hp { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; }
.estimate-chat__recaptcha { margin: 0; color: var(--estimate-text-faint); font-size: 14px; line-height: 1.5; }
.estimate-chat__recaptcha a { color: var(--estimate-text-soft); }
.estimate-chat__form .estimate-chat__actions { margin-top: 0; }
.estimate-chat__form-message { min-height: 0; margin: 0; color: #b54708; font-size: 14px; font-weight: 700; }
.estimate-chat__form-message:empty { display: none; }
.estimate-chat__composer { margin: 0; padding: 14px 16px 16px; border-top: 1px solid var(--estimate-line); background: #fff; }
.estimate-chat__field { display: flex; align-items: flex-end; gap: 10px; padding: 5px 5px 5px 16px; border: 1px solid #d3d7e5; border-radius: 16px; background: #fff; transition: border-color .15s ease, box-shadow .15s ease; }
.estimate-chat__field:focus-within { border-color: var(--estimate-brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .14); }
.estimate-chat__field textarea { flex: 1 1 auto; min-width: 0; min-height: 44px; max-height: 132px; margin: 0; padding: 10px 0; border: 0; outline: 0; color: var(--estimate-text); background: transparent; font: inherit; font-size: 16px; line-height: 1.5; resize: none; box-shadow: none; }
.estimate-chat__field textarea:disabled { color: var(--estimate-text-faint); }
.estimate-chat__send { flex: 0 0 auto; display: grid; width: 44px; height: 44px; padding: 0; place-items: center; border: 0; border-radius: 12px; color: #fff; background: var(--estimate-brand); cursor: pointer; transition: background .15s ease; }
.estimate-chat__send:hover { background: var(--estimate-brand-strong); }
.estimate-chat__send:disabled { background: #c5c9d8; cursor: not-allowed; }
.estimate-chat__send svg { width: 20px; height: 20px; }
.estimate-chat__notice { margin: 10px 2px 0; color: var(--estimate-text-faint); font-size: 14px; line-height: 1.55; text-wrap: balance; }

@container estimate-chat (max-width: 560px) {
    .estimate-chat__head { padding: 14px 16px; }
    .estimate-chat__log { padding: 16px; }
    .estimate-chat__bubble { max-width: 92%; }
    .estimate-chat__row--assistant .estimate-chat__bubble { max-width: calc(100% - 40px); }
    .estimate-chat__choices, .estimate-chat__grid { grid-template-columns: 1fr; }
    .estimate-chat__summary, .estimate-chat__form { padding: 18px; }
    .estimate-chat__price strong { font-size: 24px; }
    .estimate-chat__composer { padding: 12px; }
    .estimate-chat__actions .estimate-chat__button { flex: 1 1 auto; padding: 0 16px; }
}

@media (max-width: 640px) {
    .estimate-chat__log { height: clamp(360px, calc(100vh - 340px), 560px); height: clamp(360px, calc(100svh - 340px), 560px); }
}

@media (prefers-reduced-motion: reduce) {
    .estimate-chat *, .estimate-chat *::before, .estimate-chat *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
