/* Quote module Demo 2 (/QuoteDemo2). Prefix: qd2-. Builds on the Demo 1 theme (quote-demo.css, .qd-theme).
   Surface colours are variables, so dark mode (body.qd2-dark) only swaps variables. The quote document itself stays "paper". */

.qd2 {
    --s-bg: #ffffff;
    --s-bg2: #fff8f0;
    --s-bg3: #f6efe6;
    --s-text: #222222;
    --s-muted: #66625e;
    --s-line: rgba(5, 21, 46, 0.09);
    --s-strong: #05152e;
    --s-accent: #3a4fa3;
    --s-shadow: 0 1px 2px rgba(5, 21, 46, 0.05), 0 10px 30px rgba(5, 21, 46, 0.08);
    position: relative;
    color: var(--s-text);
    font-family: var(--qd-font);
}

body.qd2-dark .qd2 {
    --s-bg: #161b26;
    --s-bg2: #1d2331;
    --s-bg3: #252c3c;
    --s-text: #e7e9ee;
    --s-muted: #9aa3b2;
    --s-line: rgba(255, 255, 255, 0.09);
    --s-strong: #f3f5f9;
    --s-accent: #8fa6ff;
    --s-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.35);
}

body.qd2-dark .qd-theme .page { background: #0f131b; }
body.qd2-dark .app-shell.qd-theme .app-header { background: rgba(15, 19, 27, 0.9); border-bottom-color: rgba(255, 255, 255, 0.08); }
body.qd2-dark .app-shell.qd-theme .app-title { color: #f3f5f9; }
body.qd2-dark .qd2 .form-control,
body.qd2-dark .qd2 .form-select,
body.qd2-dark .qd2 .input-group-text { background-color: var(--s-bg2); color: var(--s-text); border-color: var(--s-line); }
body.qd2-dark .qd2 .btn-outline-secondary,
body.qd2-dark .qd2 .btn-outline-primary { background: var(--s-bg2); color: var(--s-text); border-color: var(--s-line); }
body.qd2-dark .qd2 .btn-primary { background: #3a4fa3; border-color: #3a4fa3; }
body.qd2-dark .qd2 .text-muted { color: var(--s-muted) !important; }
body.qd2-dark .qd2 .qd-card,
body.qd2-dark .qd2 .qd-comment { background: var(--s-bg2); color: var(--s-text); }
body.qd2-dark .qd2 .qd-comment.mine { background: #3a4fa3; }
body.qd2-dark .qd2 h1, body.qd2-dark .qd2 h2, body.qd2-dark .qd2 h3 { color: var(--s-strong); }

.qd2 a { color: var(--s-accent); }
.qd2 kbd { padding: 0.05rem 0.35rem; border-radius: 6px; background: var(--s-bg3); color: var(--s-muted); font-size: 0.7rem; font-family: inherit; box-shadow: inset 0 -1px 0 var(--s-line); }
.qd2-hint { color: var(--s-muted); font-size: 0.8rem; }
.qd2-eyebrow { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--s-muted); }
.qd2-label-sm { display: block; margin-bottom: 0.3rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--s-muted); }
.qd2-h1 { font-size: clamp(1.3rem, 1rem + 1.2vw, 1.9rem); font-weight: 800; margin: 0.1rem 0; color: var(--s-strong); }

/* ---------- Top bar ---------- */
.qd2-topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-bottom: 1rem; }
.qd2-badge-demo { padding: 0.25rem 0.65rem; border-radius: 9999px; background: linear-gradient(135deg, #3a4fa3, #4aa3df); color: #fff; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; }
.qd2-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; flex: 1 1 10rem; min-width: 0; color: var(--s-strong); }
.qd2-crumb { max-width: 14rem; }
.qd2-top-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin-left: auto; }
.qd2-top-actions .btn-outline-secondary { border-radius: 9999px; }
.qd2-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 2.1rem; height: 2.1rem; border: 0; border-radius: 50%; background: transparent; color: var(--s-text); text-decoration: none; transition: background-color 0.15s ease; }
.qd2-icon-btn:hover { background: var(--s-bg3); color: var(--s-strong); }
.qd2-icon-btn:disabled { opacity: 0.35; }
.qd2-icon-btn.on { color: #e0a100; }
.qd2-classic { display: inline-flex; align-items: center; padding: 0.3rem 0.75rem; border-radius: 9999px; background: var(--s-bg3); color: var(--s-text) !important; font-size: 0.85rem; font-weight: 600; text-decoration: none; }

/* ---------- Skeleton ---------- */
.qd2-skeleton { display: flex; flex-direction: column; gap: 0.8rem; }
.qd2-skeleton .sk { border-radius: 12px; background: linear-gradient(90deg, var(--s-bg3) 0%, var(--s-bg2) 50%, var(--s-bg3) 100%); background-size: 200% 100%; animation: qd2-shimmer 1.2s infinite linear; }
.sk-title { height: 2.2rem; width: 45%; }
.sk-line { height: 1rem; width: 70%; }
.sk-line.short { width: 35%; }
.sk-card { height: 8rem; border-radius: 22px !important; }
@keyframes qd2-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Dialog, toasts, palette ---------- */
.qd2-backdrop { position: fixed; inset: 0; z-index: 1060; background: rgba(5, 21, 46, 0.45); backdrop-filter: blur(3px); animation: qd2-fade 0.15s ease-out; }
.qd2-dialog { position: fixed; z-index: 1061; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(30rem, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem); display: flex; flex-direction: column; border-radius: 22px; background: var(--s-bg); color: var(--s-text); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); animation: qd2-pop 0.18s ease-out; }
.qd2-dialog.wide { width: min(40rem, calc(100vw - 1.5rem)); }
.qd2-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.3rem 0.4rem; }
.qd2-dialog-head h2 { margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--s-strong); }
.qd2-dialog-body { padding: 0.6rem 1.3rem 1rem; overflow-y: auto; }
.qd2-dialog-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; padding: 0.9rem 1.3rem 1.1rem; border-top: 1px solid var(--s-line); }
@keyframes qd2-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes qd2-pop { from { opacity: 0; transform: translate(-50%, -46%) scale(0.98); } to { opacity: 1; transform: translate(-50%, -50%); } }

.qd2-toasts { position: fixed; z-index: 1070; left: 50%; bottom: 1.1rem; transform: translateX(-50%); display: flex; flex-direction: column; gap: 0.5rem; width: min(26rem, calc(100vw - 1.5rem)); pointer-events: none; }
.qd2-toast { pointer-events: auto; display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.6rem 0.6rem 1rem; border-radius: 14px; background: #05152e; color: #fff; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25); animation: qd2-up 0.2s ease-out; font-size: 0.9rem; }
.qd2-toast .qd2-icon-btn { color: rgba(255, 255, 255, 0.7); width: 1.8rem; height: 1.8rem; }
.qd2-toast-action { border: 0; border-radius: 9999px; padding: 0.25rem 0.8rem; background: rgba(255, 255, 255, 0.15); color: #fff; font-weight: 700; }
.qd2-toast-action:hover { background: rgba(255, 255, 255, 0.25); }
@keyframes qd2-up { from { opacity: 0; transform: translateY(0.6rem); } to { opacity: 1; transform: none; } }

.qd2-palette { position: fixed; z-index: 1061; left: 50%; top: 12vh; transform: translateX(-50%); width: min(36rem, calc(100vw - 1.5rem)); border-radius: 18px; overflow: hidden; background: var(--s-bg); color: var(--s-text); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35); animation: qd2-fade 0.12s ease-out; }
.qd2-palette-input { display: flex; align-items: center; gap: 0.6rem; padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--s-line); }
.qd2-palette-input input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--s-text); font-size: 1.05rem; }
.qd2-palette-list { max-height: 55vh; overflow-y: auto; padding: 0.4rem; }
.qd2-palette-item { display: flex; align-items: center; gap: 0.7rem; width: 100%; padding: 0.55rem 0.75rem; border: 0; border-radius: 10px; background: transparent; color: var(--s-text); text-align: left; }
.qd2-palette-item.active { background: var(--s-bg3); }
.qd2-palette-hint { color: var(--s-muted); font-size: 0.75rem; white-space: nowrap; }
.qd2-palette-empty { padding: 1rem; color: var(--s-muted); text-align: center; }

/* ---------- Editor layout ---------- */
.qd2-editor-bar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.55rem 0.8rem; margin-bottom: 0.8rem; border-radius: 16px; background: color-mix(in srgb, var(--s-bg) 92%, transparent); backdrop-filter: blur(10px); box-shadow: var(--s-shadow); }
.qd2-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.1rem; min-width: 0; }
.qd2-stat { display: flex; flex-direction: column; line-height: 1.15; }
.qd2-stat > span { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--s-muted); }
.qd2-stat strong { font-size: 0.95rem; white-space: nowrap; color: var(--s-strong); }
.qd2-saved { color: var(--s-muted); font-size: 0.78rem; }
.qd2-bar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.qd2-cmdk { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.5rem 0.35rem 0.75rem; border: 1px solid var(--s-line); border-radius: 9999px; background: var(--s-bg2); color: var(--s-muted); font-size: 0.85rem; }
.qd2-cmdk:hover { color: var(--s-strong); }
.qd2-locked { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; padding: 0.6rem 1rem; margin-bottom: 0.8rem; border-radius: 14px; background: var(--s-bg3); }

.qd2-editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: 1rem; align-items: start; }
@media (max-width: 991.98px) { .qd2-editor-grid { grid-template-columns: minmax(0, 1fr); } }
.qd2-canvas { min-width: 0; }
.qd2-canvas.previewing .qd2-paper { box-shadow: 0 0 0 3px #4aa3df, var(--s-shadow); }
.qd2-paper { border-radius: 22px; overflow: hidden; box-shadow: var(--s-shadow); background: #fff; }
.qd2-side { position: sticky; top: 4.4rem; min-width: 0; max-height: calc(100vh - 9rem); display: flex; flex-direction: column; border-radius: 22px; background: var(--s-bg); box-shadow: var(--s-shadow); overflow: hidden; }
@media (max-width: 991.98px) { .qd2-side { position: static; max-height: none; } }
.qd2-tabs { display: flex; gap: 0.2rem; padding: 0.4rem; border-bottom: 1px solid var(--s-line); overflow-x: auto; scrollbar-width: none; }
.qd2-tabs button { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.1rem; min-width: 3.6rem; padding: 0.4rem 0.3rem; border: 0; border-radius: 12px; background: transparent; color: var(--s-muted); font-size: 0.72rem; font-weight: 700; }
.qd2-tabs button i { font-size: 1.1rem; }
.qd2-tabs button.on { background: var(--s-bg3); color: var(--s-strong); }
.qd2-count { position: absolute; top: 0.15rem; right: 0.6rem; min-width: 1.1rem; padding: 0 0.3rem; border-radius: 9999px; background: #dc2626; color: #fff; font-size: 0.62rem; line-height: 1.1rem; }
.qd2-side-body { overflow-y: auto; }
.qd2-panel-section { padding: 0.9rem 1rem; border-bottom: 1px solid var(--s-line); }
.qd2-panel-section:last-child { border-bottom: 0; }

.qd2-phone { display: flex; justify-content: center; padding: 1rem 0 2rem; }
.qd2-phone-screen { width: 390px; max-width: 100%; height: 760px; max-height: 80vh; overflow-y: auto; border: 12px solid #111; border-radius: 44px; background: #fff; box-shadow: var(--s-shadow); scrollbar-width: none; }

/* ---------- Panels ---------- */
.qd2-search { display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0.9rem; border-radius: 9999px; background: var(--s-bg2); border: 1px solid var(--s-line); }
.qd2-search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--s-text); }
.qd2-result-list { display: flex; flex-direction: column; gap: 0.1rem; margin-top: 0.5rem; max-height: 18rem; overflow-y: auto; }
.qd2-result { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.4rem; border-radius: 10px; font-size: 0.88rem; }
.qd2-result:hover { background: var(--s-bg2); }
.qd2-add-small { display: inline-flex; align-items: center; justify-content: center; width: 1.9rem; height: 1.9rem; border: 0; border-radius: 50%; background: var(--qd-navy); color: #fff; }
.qd2-add-small:disabled { opacity: 0.35; }
.qd2-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 2rem; width: 2rem; height: 2rem; border-radius: 9px; background: var(--d-accent, #fff0df); color: var(--d-primary, #05152e); }
.qd2-seg { display: flex; padding: 0.2rem; gap: 0.2rem; border-radius: 9999px; background: var(--s-bg3); }
.qd2-seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem; padding: 0.3rem 0.6rem; border: 0; border-radius: 9999px; background: transparent; color: var(--s-muted); font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.qd2-seg button.on { background: var(--s-bg); color: var(--s-strong); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.qd2-view { flex: 0 0 auto; }
.qd2-view button { padding: 0.3rem 0.55rem; }
.qd2-quick { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.6rem; }
.qd2-quick-item { display: flex; align-items: center; gap: 0.6rem; width: 100%; padding: 0.45rem 0.6rem; border: 0; border-radius: 12px; background: var(--s-bg2); color: var(--s-text); font-size: 0.86rem; }
.qd2-quick-item:hover { background: var(--s-bg3); }
.qd2-ai-btn { display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem 0.85rem; border: 0; border-radius: 14px; background: linear-gradient(135deg, rgba(58, 79, 163, 0.1), rgba(74, 163, 223, 0.12)); color: var(--s-strong); text-align: left; }
.qd2-ai-btn > i { font-size: 1.2rem; color: #3a4fa3; }
.qd2-ai-btn:hover { background: linear-gradient(135deg, rgba(58, 79, 163, 0.18), rgba(74, 163, 223, 0.2)); }
.qd2-ai-btn:disabled { opacity: 0.5; }
.qd2-ai-chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.6rem; border: 0; border-radius: 9999px; background: linear-gradient(135deg, #3a4fa3, #4aa3df); color: #fff; font-size: 0.72rem; font-weight: 700; }
.qd2-ai-banner { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 700; color: var(--s-strong); }
.qd2-ai-banner > i { color: #3a4fa3; font-size: 1.2rem; }
.qd2-ai-answer { margin-top: 0.6rem; padding: 0.75rem 0.85rem; border-radius: 14px; background: var(--s-bg2); border: 1px solid var(--s-line); }
.qd2-ai-text { white-space: pre-line; font-size: 0.9rem; }
.qd2-caret { display: inline-block; width: 0.5rem; height: 1rem; margin-left: 2px; background: #3a4fa3; vertical-align: text-bottom; animation: qd2-blink 0.8s steps(2) infinite; }
@keyframes qd2-blink { 50% { opacity: 0; } }
.qd2-kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; margin: 0 0 0.5rem; }
.qd2-kv div { padding: 0.45rem 0.55rem; border-radius: 10px; background: var(--s-bg2); }
.qd2-kv dt { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--s-muted); }
.qd2-kv dd { margin: 0; font-weight: 700; }
.qd2-price-story { font-size: 0.82rem; color: var(--s-muted); margin-bottom: 0.4rem; }
.qd2-people { list-style: none; padding: 0; margin: 0 0 0.5rem; display: flex; flex-direction: column; gap: 0.45rem; }
.qd2-people li { display: flex; align-items: center; gap: 0.6rem; font-size: 0.88rem; }
.qd2-avatar { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 2rem; width: 2rem; height: 2rem; border-radius: 50%; background: linear-gradient(135deg, #3a4fa3, #4aa3df); color: #fff; font-size: 0.75rem; font-weight: 800; }
.qd2-avatar.muted { background: var(--s-bg3); color: var(--s-muted); }
.qd2-avatar.lg { flex-basis: 2.8rem; width: 2.8rem; height: 2.8rem; font-size: 0.95rem; }
.qd2-pill-ok, .qd2-pill-wait { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.1rem 0.55rem; border-radius: 9999px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.qd2-pill-ok { background: #e3f4ea; color: #157347; }
.qd2-pill-wait { background: var(--s-bg3); color: var(--s-muted); }
.qd2-invite { display: flex; flex-direction: column; gap: 0.4rem; }
.qd2-link-box { display: flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.25rem 0.25rem 0.8rem; border-radius: 9999px; background: var(--s-bg2); border: 1px solid var(--s-line); font-size: 0.8rem; min-width: 0; }
.qd2-link-box span { flex: 1; min-width: 0; }
.qd2-bars { display: flex; flex-direction: column; gap: 0.35rem; margin: 0.4rem 0 0.6rem; }
.qd2-bar-row { display: grid; grid-template-columns: 6.5rem 1fr auto; align-items: center; gap: 0.5rem; font-size: 0.8rem; }
.qd2-bar { height: 0.5rem; border-radius: 9999px; background: var(--s-bg3); overflow: hidden; }
.qd2-bar span { display: block; height: 100%; border-radius: 9999px; background: linear-gradient(90deg, #3a4fa3, #4aa3df); }
.qd2-signal { display: flex; gap: 0.45rem; padding: 0.45rem 0.6rem; margin-top: 0.35rem; border-radius: 10px; background: rgba(224, 161, 0, 0.12); font-size: 0.82rem; }
.qd2-signal i { color: #e0a100; }
.qd2-followup { padding: 0.6rem 0.7rem; margin-top: 0.5rem; border-radius: 12px; background: var(--s-bg2); border-left: 3px solid #3a4fa3; }
.qd2-template-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.4rem; }
.qd2-template { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem; border: 2px solid transparent; border-radius: 12px; background: var(--s-bg2); color: var(--s-text); font-size: 0.85rem; font-weight: 600; min-width: 0; }
.qd2-template.on { border-color: var(--s-strong); background: var(--s-bg); }
.qd2-template-swatch { flex: 0 0 1.6rem; height: 1.6rem; border-radius: 8px; }
.qd2-timeline { list-style: none; margin: 0; padding: 0; }
.qd2-timeline li { display: flex; gap: 0.7rem; padding: 0.35rem 0; font-size: 0.85rem; }
.qd2-dot { flex: 0 0 0.55rem; height: 0.55rem; margin-top: 0.45rem; border-radius: 50%; background: #4aa3df; }
.qd2-checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.qd2-checklist li { display: flex; gap: 0.5rem; }
.qd2-checklist li::before { font-family: bootstrap-icons; content: "\f26b"; color: #157347; }
.qd2-checklist li.bad::before { content: "\f33a"; color: #dc2626; }
.qd2-suggestions { margin: 0.8rem 0 0; padding-left: 1.1rem; }

/* ---------- Web document (paper; theme from the template via --d-*) ---------- */
.qd2-doc { container-type: inline-size; --d-line: rgba(0, 0, 0, 0.08); color: var(--d-text); font-family: var(--d-font), "Segoe UI", sans-serif; font-size: 1rem; line-height: 1.55; background: #fff; }
.qd2-doc h1, .qd2-doc h2, .qd2-doc .qd2-h { font-family: var(--d-heading), "Segoe UI", sans-serif; color: var(--d-primary); }
.qd2-doc > section, .qd2-doc > figure { padding: 1.3rem clamp(1rem, 4cqw, 2.6rem); margin: 0; }
.qd2-doc p { margin: 0 0 0.7rem; }
.qd2-h { font-size: 1.15rem; font-weight: 800; margin: 0 0 0.6rem; }
.qd2-h i { margin-right: 0.35rem; }
.qd2-label { display: block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(0, 0, 0, 0.5); }
.qd2-kicker { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--d-primary); opacity: 0.75; }
.qd2-logo { max-height: 2.6rem; max-width: 12rem; object-fit: contain; }
.qd2-company { font-family: var(--d-heading), sans-serif; font-weight: 800; font-size: 1.3rem; color: var(--d-primary); }

.qd2-cover { position: relative; padding-top: 2.2rem !important; padding-bottom: 2rem !important; background: linear-gradient(150deg, var(--d-accent) 0%, #fff 70%); border-top: 6px solid var(--d-primary); }
.qd2-cover-logo { margin-bottom: 2.2rem; }
.qd2-cover-title { font-size: clamp(1.8rem, 1.2rem + 4cqw, 3.2rem); line-height: 1.05; font-weight: 800; margin: 0.4rem 0 0.8rem; }
.qd2-cover-sub { font-size: 1.1rem; max-width: 40rem; }
.qd2-cover-image { display: block; width: 100%; max-height: 18rem; object-fit: cover; border-radius: 16px; margin-top: 1.2rem; }
.qd2-cover-parties { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--d-line); }
.qd2-cover-parties strong, .qd2-cover-parties span { display: block; overflow-wrap: anywhere; }

.qd2-header-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 3px solid var(--d-primary); }
.qd2-meta { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; font-size: 0.85rem; color: rgba(0, 0, 0, 0.6); }
.qd2-meta strong { color: var(--d-text); }
.qd2-title { font-size: clamp(1.5rem, 1.1rem + 2.5cqw, 2.3rem); font-weight: 800; margin: 0.2rem 0 1rem; }
.qd2-title-input { width: 100%; margin: 0.2rem 0 1rem; padding: 0.1rem 0.4rem; border: 2px dashed transparent; border-radius: 10px; background: transparent; color: var(--d-primary); font-family: var(--d-heading), sans-serif; font-size: clamp(1.5rem, 1.1rem + 2.5cqw, 2.3rem); font-weight: 800; }
.qd2-title-input:hover { border-color: rgba(0, 0, 0, 0.12); }
.qd2-title-input:focus { outline: none; border-color: #4aa3df; background: #fff; }
.qd2-parties { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
.qd2-party { display: flex; flex-direction: column; padding: 0.9rem 1rem; border-radius: 14px; background: var(--d-accent); font-size: 0.92rem; min-width: 0; overflow-wrap: anywhere; }
.qd2-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.qd2-terms { font-size: 0.92rem; color: rgba(0, 0, 0, 0.75); }
.qd2-image { text-align: center; }
.qd2-image img { max-width: 100%; border-radius: 14px; }
.qd2-image figcaption { margin-top: 0.4rem; font-size: 0.85rem; color: rgba(0, 0, 0, 0.55); }
.qd2-pagebreak { display: flex; align-items: center; gap: 0.6rem; padding: 0 2rem; color: rgba(0, 0, 0, 0.35); font-size: 0.72rem; }
.qd2-pagebreak::before, .qd2-pagebreak::after { content: ""; flex: 1; border-top: 1px dashed rgba(0, 0, 0, 0.2); }
.qd2-footer { padding: 1rem 2rem 1.4rem; text-align: center; font-size: 0.8rem; color: rgba(0, 0, 0, 0.45); border-top: 1px solid var(--d-line); }
.qd2-placeholder { color: rgba(0, 0, 0, 0.35); font-style: italic; }

/* Editing in place */
.qd2-doc.editing .qd2-editable { position: relative; cursor: text; border-radius: 12px; margin: -0.4rem; padding: 0.4rem; transition: box-shadow 0.12s ease, background-color 0.12s ease; }
.qd2-doc.editing .qd2-editable:hover { box-shadow: 0 0 0 2px rgba(74, 163, 223, 0.6); background: rgba(74, 163, 223, 0.04); }
.qd2-doc.editing .qd2-editable:hover::after { content: "\f4cb  Edit"; font-family: bootstrap-icons, var(--qd-font); position: absolute; top: -0.7rem; right: 0.6rem; padding: 0.05rem 0.5rem; border-radius: 9999px; background: #4aa3df; color: #fff; font-size: 0.7rem; }
.qd2-own-text { margin-top: 0.4rem; font-size: 0.75rem; color: #4aa3df; }
.qd2-inline-editor { padding: 0.8rem; border-radius: 14px; background: #f7fbff; box-shadow: 0 0 0 2px #4aa3df; }
.qd2-inline-title { margin-bottom: 0.5rem; font-weight: 700; }

/* Lines: table on wide containers, cards on narrow */
.qd2-lines { display: flex; flex-direction: column; }
.qd2-line, .qd2-line-head { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) 6.5rem 6.5rem 5rem 8rem; align-items: center; gap: 0.6rem; padding: 0.6rem 0.4rem; border-bottom: 1px solid var(--d-line); }
.qd2-line-head { padding-top: 0.3rem; padding-bottom: 0.4rem; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(0, 0, 0, 0.5); border-bottom: 2px solid var(--d-primary); }
.qd2-line .num, .qd2-line-head .num { text-align: right; }
.qd2-line-lead { display: flex; align-items: center; gap: 0.25rem; }
.qd2-line-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.5rem; min-width: 0; }
.qd2-line-name { font-weight: 700; overflow-wrap: anywhere; }
.qd2-line-no { font-size: 0.78rem; color: rgba(0, 0, 0, 0.45); }
.qd2-line-desc { flex-basis: 100%; font-size: 0.85rem; color: rgba(0, 0, 0, 0.55); }
.qd2-chip { padding: 0 0.45rem; border-radius: 9999px; background: var(--d-accent); color: var(--d-primary); font-size: 0.7rem; font-weight: 700; }
.qd2-amount { font-weight: 700; white-space: nowrap; }
.qd2-line.not-counted .qd2-line-name, .qd2-line.not-counted .qd2-amount { color: rgba(0, 0, 0, 0.4); }
.qd2-line.not-counted .qd2-amount { text-decoration: line-through; }
.qd2-line.is-discount { color: #15803d; }
.qd2-line.selected, .qd2-section-row.selected, .qd2-text-row.selected { background: rgba(74, 163, 223, 0.08); box-shadow: inset 3px 0 0 #4aa3df; }
.qd2-line.drop-target, .qd2-section-row.drop-target, .qd2-text-row.drop-target { box-shadow: inset 0 3px 0 #4aa3df; }
.qd2-doc.editing .qd2-line, .qd2-doc.editing .qd2-section-row, .qd2-doc.editing .qd2-text-row { cursor: pointer; }
.qd2-doc.editing .qd2-line:hover { background: rgba(0, 0, 0, 0.02); }
.qd2-drag { color: rgba(0, 0, 0, 0.25); cursor: grab; }
.qd2-num-input { width: 100%; max-width: 5.5rem; padding: 0.2rem 0.4rem; border: 1px solid transparent; border-radius: 8px; background: rgba(0, 0, 0, 0.03); text-align: right; }
.qd2-num-input:hover { border-color: rgba(0, 0, 0, 0.15); }
.qd2-num-input:focus { outline: none; border-color: #4aa3df; background: #fff; }
.qd2-remove { margin-left: 0.3rem; padding: 0 0.25rem; border: 0; background: transparent; color: rgba(0, 0, 0, 0.3); }
.qd2-remove:hover { color: #dc2626; }
.qd2-section-row { display: flex; align-items: center; gap: 0.5rem; padding: 1rem 0.4rem 0.4rem; border-bottom: 2px solid var(--d-primary); color: var(--d-primary); font-weight: 800; }
.qd2-section-name { flex: 1; }
.qd2-section-sum { font-size: 0.8rem; font-weight: 600; color: rgba(0, 0, 0, 0.5); }
.qd2-text-row { display: flex; gap: 0.5rem; padding: 0.6rem 0.4rem; font-style: italic; color: rgba(0, 0, 0, 0.6); border-bottom: 1px solid var(--d-line); }
.qd2-alt-head { padding: 0.8rem 0.4rem 0.2rem; font-size: 0.85rem; color: var(--d-primary); }
.qd2-empty { padding: 1.5rem; text-align: center; color: rgba(0, 0, 0, 0.4); }
.qd2-stepper { display: inline-flex; align-items: center; gap: 0.1rem; border-radius: 9999px; background: var(--d-accent); }
.qd2-stepper button { width: 1.9rem; height: 1.9rem; border: 0; border-radius: 50%; background: transparent; color: var(--d-primary); font-weight: 800; }
.qd2-stepper button:disabled { opacity: 0.3; }
.qd2-stepper span { min-width: 1.6rem; text-align: center; font-weight: 700; }
.qd2-add-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }
.qd2-add-btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.45rem 0.9rem; border: 2px dashed rgba(0, 0, 0, 0.15); border-radius: 12px; background: transparent; color: var(--d-primary); font-weight: 700; font-size: 0.88rem; }
.qd2-add-btn:hover { border-color: #4aa3df; background: rgba(74, 163, 223, 0.06); }
.qd2-add-btn.subtle { color: rgba(0, 0, 0, 0.55); font-weight: 600; }

.qd2-totals { margin-left: auto; max-width: 24rem; display: flex; flex-direction: column; gap: 0.25rem; }
.qd2-totals > div { display: flex; justify-content: space-between; gap: 1rem; }
.qd2-totals .qd2-muted { color: rgba(0, 0, 0, 0.5); font-size: 0.9rem; }
.qd2-totals .qd2-discount { color: #15803d; }
.qd2-totals .qd2-grand { margin-top: 0.3rem; padding-top: 0.5rem; border-top: 2px solid var(--d-primary); color: var(--d-primary); font-size: 1.25rem; font-weight: 800; }

.qd2-sign { background: linear-gradient(180deg, #fff 0%, var(--d-accent) 100%); }
.qd2-signers { list-style: none; padding: 0; margin: 0.6rem 0 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.qd2-signers li { display: flex; align-items: center; gap: 0.6rem; }

@container (max-width: 640px) {
    .qd2-line-head { display: none; }
    .qd2-line { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "lead main amount" "lead qty price"; row-gap: 0.3rem; padding: 0.8rem 0.3rem; }
    .qd2-line-lead { grid-area: lead; align-self: start; }
    .qd2-line-main { grid-area: main; }
    .qd2-line .qd2-cell:nth-of-type(3) { grid-area: qty; justify-self: start; }
    .qd2-line .qd2-cell:nth-of-type(4) { grid-area: price; font-size: 0.8rem; color: rgba(0, 0, 0, 0.5); }
    .qd2-line .qd2-cell:nth-of-type(4)::before { content: attr(data-label) " "; }
    .qd2-line .qd2-cell:nth-of-type(5) { display: none; }
    .qd2-line .qd2-amount { grid-area: amount; align-self: start; }
    .qd2-parties, .qd2-columns, .qd2-cover-parties { grid-template-columns: 1fr; }
    .qd2-totals { max-width: none; }
}

/* ---------- Customer page ---------- */
.qd2-customer { max-width: 56rem; margin: 0 auto; padding-bottom: 6rem; }
.qd2-seller-card { display: flex; align-items: center; gap: 0.75rem; padding: 0.8rem 1rem; margin-bottom: 0.6rem; border-radius: 18px; background: var(--s-bg); box-shadow: var(--s-shadow); }
.qd2-status-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-bottom: 0.6rem; color: var(--s-muted); font-size: 0.85rem; }
.qd2-section-nav { position: sticky; top: 0; z-index: 10; display: flex; gap: 0.35rem; padding: 0.45rem 0; margin-bottom: 0.6rem; overflow-x: auto; scrollbar-width: none; background: linear-gradient(var(--qd-cream-soft) 70%, transparent); }
body.qd2-dark .qd2-section-nav { background: linear-gradient(#0f131b 70%, transparent); }
.qd2-section-nav button { flex: 0 0 auto; padding: 0.3rem 0.8rem; border: 1px solid var(--s-line); border-radius: 9999px; background: var(--s-bg); color: var(--s-text); font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
.qd2-done { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; padding: 0.9rem 1.1rem; margin-bottom: 0.8rem; border-radius: 18px; background: #e3f4ea; color: #0f5132; }
.qd2-done > i { font-size: 1.6rem; color: #157347; }
.qd2-action-bar { position: fixed; z-index: 1040; left: 50%; bottom: 0.8rem; transform: translateX(-50%); display: flex; align-items: center; gap: 0.4rem; width: min(40rem, calc(100vw - 1rem)); padding: 0.5rem 0.5rem 0.5rem 1rem; border-radius: 9999px; background: color-mix(in srgb, var(--s-bg) 94%, transparent); backdrop-filter: blur(12px); box-shadow: 0 12px 40px rgba(5, 21, 46, 0.2); }
.qd2-action-total { display: flex; flex-direction: column; line-height: 1.15; margin-right: auto; min-width: 0; }
.qd2-action-total strong { font-size: 1.05rem; white-space: nowrap; color: var(--s-strong); }
.qd2-action-bar .btn-primary { white-space: nowrap; }
.qd2-sign-summary { display: flex; flex-direction: column; gap: 0.3rem; padding: 0.8rem 1rem; border-radius: 14px; background: var(--s-bg2); }
.qd2-sign-summary div { display: flex; justify-content: space-between; gap: 1rem; }
.qd2-bankid { padding: 1.5rem 0; text-align: center; }
.qd2-pay { padding: 0.8rem 1rem; border: 1px solid var(--s-line); border-radius: 14px; background: var(--s-bg); color: var(--s-text); font-size: 1rem; }
.qd2-pay.vipps { background: #ff5b24; border-color: #ff5b24; color: #fff; }
.qd2-message { max-width: 32rem; margin: 3rem auto; padding: 2.5rem 1.5rem; text-align: center; border-radius: 22px; background: var(--s-bg); box-shadow: var(--s-shadow); }
.qd2-message > i { font-size: 2.4rem; color: var(--s-muted); }
.qd2-message h1 { font-size: 1.4rem; font-weight: 800; margin: 0.8rem 0 0.4rem; }
.qd2-offscreen { position: fixed !important; left: -10000px; top: 0; width: 900px !important; height: 600px !important; }
@media (max-width: 575.98px) {
    .qd2-action-bar { border-radius: 18px; bottom: 0.5rem; }
    .qd2-action-bar .btn-primary { padding-left: 0.8rem; padding-right: 0.8rem; }
}

/* ---------- Home ---------- */
.qd2-home { display: flex; flex-direction: column; gap: 1rem; }
.qd2-sale-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; padding: 1rem 1.2rem; border-radius: 22px; background: var(--s-bg); box-shadow: var(--s-shadow); }
.qd2-demo-picker { width: auto; max-width: 100%; font-size: 0.78rem; opacity: 0.75; }
.qd2-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr)); gap: 0.9rem; }
.qd2 a.qd2-quote-card { display: flex; flex-direction: column; gap: 0.3rem; padding: 1.1rem 1.2rem; border-radius: 22px; background: var(--s-bg); color: var(--s-text); text-decoration: none; box-shadow: var(--s-shadow); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.qd2 a.qd2-quote-card:hover { transform: translateY(-3px); box-shadow: 0 20px 40px rgba(5, 21, 46, 0.14); }
.qd2-card-title { font-weight: 700; font-size: 1.05rem; color: var(--s-strong); }
.qd2-card-amount { font-size: 1.4rem; font-weight: 800; color: var(--s-strong); }
.qd2-card-meta { display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; color: var(--s-muted); font-size: 0.8rem; }
.qd2-card-meta i { margin-right: 0.25rem; }
.qd2-empty-state { padding: 3rem 1.5rem; text-align: center; border-radius: 22px; background: var(--s-bg); box-shadow: var(--s-shadow); }
.qd2-empty-state > i { font-size: 2.4rem; color: #4aa3df; }
.qd2-empty-state h2 { font-size: 1.3rem; font-weight: 800; margin: 0.6rem 0 0.3rem; }
.qd2-empty-state p { color: var(--s-muted); max-width: 30rem; margin: 0 auto 1rem; }
.qd2-empty-page { padding: 2rem; text-align: center; color: var(--s-muted); }

@media (prefers-reduced-motion: reduce) {
    .qd2 *, .qd2-dialog, .qd2-toast, .qd2-backdrop { animation: none !important; transition: none !important; }
}

/* ---------- Round 2: ERP, change requests, what changed, dashboard, Teams ---------- */
.qd2-icon-btn.active { background: var(--s-bg3); color: var(--s-strong); }
.qd2-icon-btn.sm { width: 1.6rem; height: 1.6rem; font-size: 0.85rem; }
.qd2-erp-chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.3rem 0.15rem 0.7rem; border-radius: 9999px; background: #e3f4ea; color: #0f5132; font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.qd2-request { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; padding: 0.7rem 1rem; margin-bottom: 0.8rem; border-radius: 14px; background: rgba(224, 161, 0, 0.14); color: var(--s-text); }
.qd2-request > i { color: #b7791f; font-size: 1.1rem; }
.qd2-erp-head { display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; margin-bottom: 0.5rem; font-size: 0.85rem; }
.qd2-erp-table { font-size: 0.85rem; color: var(--s-text); }
.qd2-erp-table tr.text td { font-style: italic; color: var(--s-muted); }
.qd2-erp-table tfoot td { border-bottom: 0; }
body.qd2-dark .qd2-erp-table { --bs-table-bg: transparent; --bs-table-color: var(--s-text); }
.qd2-checklist li { align-items: center; }
.qd2-checklist li.warn::before { content: "\f33b"; color: #b7791f; }
.qd2-changes { list-style: none; margin: 0.4rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.86rem; }
.qd2-changes li { display: flex; gap: 0.45rem; }
.qd2-changes li::before { font-family: bootstrap-icons; content: "\f4fe"; color: #4aa3df; }
.qd2-changes li.added::before { content: "\f4fa"; color: #157347; }
.qd2-changes li.removed::before { content: "\f2e6"; color: #dc2626; }
.qd2-whatchanged { margin-bottom: 0.8rem; padding: 0.7rem 1rem; border-radius: 14px; background: var(--s-bg); box-shadow: var(--s-shadow); }
.qd2-whatchanged summary { font-weight: 700; color: var(--s-strong); cursor: pointer; }
.qd2-stock { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.4rem; font-size: 0.85rem; font-weight: 600; }
.qd2-stock.ok { color: #157347; }
.qd2-stock.low { color: #b7791f; }

.qd2-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(11rem, 100%), 1fr)); gap: 0.8rem; margin-bottom: 1rem; }
.qd2-kpi { display: flex; flex-direction: column; gap: 0.1rem; padding: 1rem 1.1rem; border-radius: 20px; background: var(--s-bg); box-shadow: var(--s-shadow); min-width: 0; }
.qd2-kpi span { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--s-muted); }
.qd2-kpi strong { font-size: 1.35rem; font-weight: 800; color: var(--s-strong); overflow-wrap: anywhere; }
.qd2-kpi em { font-style: normal; font-size: 0.8rem; color: var(--s-muted); }
.qd2-funnel { display: flex; gap: 0.3rem; margin-bottom: 0.3rem; min-height: 3.2rem; }
.qd2-funnel-part { display: flex; flex-direction: column; justify-content: center; flex-basis: 0; min-width: 4.5rem; padding: 0.4rem 0.7rem; border-radius: 12px; color: #fff; font-size: 0.75rem; }
.qd2-funnel-part strong { font-size: 1.1rem; }
.qd2-funnel-draft { background: #8a93a3; }
.qd2-funnel-sent { background: #3a4fa3; }
.qd2-funnel-signed { background: #157347; }
.qd2-funnel-rejected { background: #b42318; }
.qd2-dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr)); gap: 0.9rem; }
.qd2-dash-card { padding: 1rem 1.1rem; border-radius: 22px; background: var(--s-bg); box-shadow: var(--s-shadow); min-width: 0; }
.qd2-dash-card h2 { font-size: 1rem; font-weight: 800; margin-bottom: 0.6rem; color: var(--s-strong); }
.qd2-dash-card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.qd2 .qd2-dash-card a { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; padding: 0.5rem 0.6rem; border-radius: 12px; color: var(--s-text); text-decoration: none; }
.qd2 .qd2-dash-card a:hover { background: var(--s-bg2); }

.qd2-teams { max-width: 46rem; margin: 0 auto; border-radius: 22px; overflow: hidden; background: var(--s-bg); box-shadow: var(--s-shadow); }
.qd2-teams-head { display: flex; align-items: center; gap: 0.8rem; padding: 0.9rem 1.1rem; background: #464eb8; color: #fff; }
.qd2-teams-head .qd2-hint { color: rgba(255, 255, 255, 0.75); }
.qd2-teams-logo { display: inline-flex; align-items: center; justify-content: center; width: 2.4rem; height: 2.4rem; border-radius: 10px; background: rgba(255, 255, 255, 0.18); font-size: 1.3rem; }
.qd2-teams-feed { display: flex; flex-direction: column; gap: 0.9rem; padding: 1rem; max-height: 70vh; overflow-y: auto; background: var(--s-bg2); }
.qd2-teams-post { display: flex; gap: 0.7rem; }
.qd2-teams-bot { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 2.2rem; height: 2.2rem; border-radius: 50%; background: #464eb8; color: #fff; }
.qd2-teams-meta { font-size: 0.8rem; margin-bottom: 0.2rem; }
.qd2-teams-meta span { color: var(--s-muted); margin-left: 0.4rem; }
.qd2-teams-card { padding: 0.75rem 0.9rem; border-radius: 10px; background: var(--s-bg); border-left: 4px solid #464eb8; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); font-size: 0.9rem; }
.qd2-teams-card.approval { border-left-color: #e0a100; }

/* ---------- Shared Demo 1 pages shown inside Demo 2 (/QuoteDemo2/settings, ...): dark mode ---------- */
body.qd2-dark .qd2-page .qd-hero,
body.qd2-dark .qd2-page .qd-card-attention { background: var(--s-bg2); }
body.qd2-dark .qd2-page .qd-fields > div,
body.qd2-dark .qd2-page .qd-block,
body.qd2-dark .qd2-page .qd-list-item,
body.qd2-dark .qd2-page .qd-template-card,
body.qd2-dark .qd2-page .qd-copy-panel,
body.qd2-dark .qd2-page .qd-consent,
body.qd2-dark .qd2-page .qd-choice,
body.qd2-dark .qd2-page .qd-example,
body.qd2-dark .qd2-page .qd-demo-note,
body.qd2-dark .qd2-page .qd-tab,
body.qd2-dark .qd2-page .qd-chip,
body.qd2-dark .qd2-page .qd-activity-icon,
body.qd2-dark .qd2-page .qd-logo-preview,
body.qd2-dark .qd2-page .qd-format-bar,
body.qd2-dark .qd2-page .qd-sp { background: var(--s-bg3); color: var(--s-text); }
body.qd2-dark .qd2-page .qd-tab.active { background: #3a4fa3; color: #fff; }
body.qd2-dark .qd2-page .qd-sp-table { --bs-table-bg: transparent; --bs-table-color: var(--s-text); --bs-table-hover-bg: rgba(255, 255, 255, 0.04); --bs-table-hover-color: var(--s-text); }
body.qd2-dark .qd2-page .qd-sp-table th { background: var(--s-bg2); color: var(--s-muted); }
body.qd2-dark .qd2-page .qd-theme a.qd-sp-name,
body.qd2-dark .qd2-page a.qd-sp-name,
body.qd2-dark .qd2-page .qd-sp-crumbs a { color: var(--s-text); }
body.qd2-dark .qd2-page .table { --bs-table-bg: transparent; --bs-table-color: var(--s-text); }
body.qd2-dark .qd2-page .qd-block-head .badge { background: var(--s-bg2) !important; color: var(--s-text) !important; }
body.qd2-dark .qd2-page .form-text,
body.qd2-dark .qd2-page .qd-hero-sub,
body.qd2-dark .qd2-page .qd-eyebrow,
body.qd2-dark .qd2-page .qd-fields dt { color: var(--s-muted); }
body.qd2-dark .qd2-page .form-label,
body.qd2-dark .qd2-page .qd-hero-title,
body.qd2-dark .qd2-page .qd-fields dd { color: var(--s-text); }
body.qd2-dark .qd2-page .alert-info,
body.qd2-dark .qd2-page .alert-secondary,
body.qd2-dark .qd2-page .alert-primary { background: var(--s-bg3); color: var(--s-text); }

/* ---------- Chat (Demo 2) ---------- */
.qd2-chat { display: flex; flex-direction: column; gap: 0.6rem; }
.qd2-chat-list { display: flex; flex-direction: column; gap: 0.55rem; max-height: min(26rem, 55vh); min-height: 8rem; overflow-y: auto; padding: 0.3rem 0.1rem; scroll-behavior: smooth; }
.qd2-chat-empty { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; margin: auto; padding: 1.2rem; text-align: center; color: var(--s-muted); font-size: 0.88rem; }
.qd2-chat-empty i { font-size: 1.8rem; color: #4aa3df; }
.qd2-chat-new { display: flex; align-items: center; gap: 0.5rem; color: #dc2626; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.qd2-chat-new::before, .qd2-chat-new::after { content: ""; flex: 1; border-top: 1px solid rgba(220, 38, 38, 0.35); }
.qd2-msg { display: flex; align-items: flex-end; gap: 0.45rem; max-width: 88%; }
.qd2-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.qd2-msg-body { min-width: 0; padding: 0.5rem 0.8rem; border-radius: 18px 18px 18px 6px; background: var(--s-bg3); color: var(--s-text); }
.qd2-msg.mine .qd2-msg-body { border-radius: 18px 18px 6px 18px; background: #3a4fa3; color: #fff; }
.qd2-msg-meta { font-size: 0.7rem; opacity: 0.7; margin-bottom: 0.1rem; }
.qd2-msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.qd2-msg-ref { display: flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; opacity: 0.8; font-style: italic; }
.qd2-avatar.sm { flex-basis: 1.7rem; width: 1.7rem; height: 1.7rem; font-size: 0.62rem; }
.qd2-chat-input { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; padding: 0.3rem; border-radius: 16px; background: var(--s-bg2); border: 1px solid var(--s-line); }
.qd2-chat-input .form-control { flex: 1; min-width: 8rem; border: 0; background: transparent; box-shadow: none !important; }
.qd2-chat-about { width: 2.6rem; padding: 0.3rem; border: 0; border-radius: 10px; background: var(--s-bg3); color: var(--s-muted); font-weight: 700; text-align: center; }
.qd2-send { display: inline-flex; align-items: center; justify-content: center; width: 2.3rem; height: 2.3rem; border: 0; border-radius: 50%; background: #3a4fa3; color: #fff; }
.qd2-send:disabled { opacity: 0.35; }
