/* =============================================================================
 * quick-add.css — the first-record quick-capture popover (getting-started hero).
 * Paired with assets/js/components/quick-add.js. Keepr is light-only.
 *
 * Deliberately mirrors the send-completion (.ksc-*) popover so the two read as
 * one family: an icon tile + title header, a stepped body with progress dots and
 * one big question per step, and a footer with a reassurance line beside the
 * primary action. Opened CENTRED for the hero (a card is not a tight,
 * button-adjacent context); the anchored variant is kept for future callers.
 * ========================================================================== */

.qa-backdrop { position: fixed; inset: 0; z-index: 10600; background: transparent; opacity: 0; pointer-events: none; transition: opacity 0.15s ease; }
.qa-backdrop.is-in { opacity: 1; pointer-events: auto; }
/* A soft focus-dim, not a heavy "system modal" overlay — the first-record
   moment should feel inviting, not blocking. Centred by default for the hero
   (a large card low on a scrollable page is the wrong thing to anchor a tail
   to); true anchoring stays for small, button-adjacent triggers like send. */
.qa-backdrop.qa-dim { background: rgba(20, 28, 45, 0.16); }

.qa-pop {
    position: fixed; z-index: 10601;
    width: 360px; max-width: calc(100vw - 24px);
    background: var(--color-bg-card, #fff);
    border-radius: 15px;
    box-shadow: 0 18px 46px rgba(21, 28, 46, 0.26);
    opacity: 0; transform: translateY(8px) scale(0.94);
    transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.2, 0.9, 0.25, 1.08);
}
.qa-backdrop.is-in .qa-pop { opacity: 1; transform: none; }

.qa-tail { position: absolute; width: 16px; height: 16px; background: var(--color-bg-card, #fff); transform: rotate(45deg); top: -8px; box-shadow: -4px -4px 10px rgba(21, 28, 46, 0.05); }
.qa-pop.qa-above .qa-tail { top: auto; bottom: -8px; box-shadow: 5px 5px 12px rgba(21, 28, 46, 0.07); }
.qa-pop.qa-centered .qa-tail { display: none; }

.qa-inner { padding: 19px 21px 0; }
.qa-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.qa-plane { flex: none; width: 29px; height: 29px; border-radius: 8px; background: #eaf3fa; color: var(--color-primary, #67b7dc); display: grid; place-items: center; }
.qa-plane svg { width: 17px; height: 17px; }
.qa-title { font-family: Rubik, sans-serif; font-weight: 500; font-size: 14px; color: var(--color-text, #444); line-height: 1.1; }
.qa-close { margin-left: auto; border: 0; background: transparent; color: var(--color-text-light, #8a93a7); font-size: 22px; line-height: 16px; cursor: pointer; padding: 0 2px; }
.qa-close:hover { color: var(--color-text, #444); }

.qa-dots { display: flex; gap: 6px; margin-bottom: 15px; }
.qa-dot { width: 20px; height: 5px; border-radius: var(--radius-pill, 1000px); background: var(--color-border, #e7ecf1); transition: background 0.25s ease; }
.qa-dot.is-active { background: var(--color-primary, #67b7dc); }
.qa-dot.is-done { background: var(--color-primary, #67b7dc); opacity: 0.5; }

.qa-morph { overflow: hidden; }
.qa-step { animation: qaStepIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes qaStepIn { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

.qa-q { font-family: Rubik, sans-serif; font-weight: 400; font-size: 19px; line-height: 1.3; color: var(--color-text, #444); margin: 0 0 7px; text-wrap: balance; }
.qa-help { font-size: 13px; line-height: 1.45; color: var(--color-text-muted, #666); margin: 0 0 15px; }

.qa-field { display: block; margin: 0 0 12px; }
.qa-label { display: block; font-size: 11.5px; font-weight: 500; color: var(--color-text-light, #8a93a7); margin-bottom: 6px; }
.qa-input { width: 100%; background: var(--color-bg-page, #F5F7FB); border: 1px solid transparent; border-radius: var(--radius, 10px); color: var(--color-text, #444); padding: 11px 13px; line-height: 22px; font-size: 14px; font-family: Poppins, sans-serif; transition: border-color 0.15s ease, background 0.15s ease; }
.qa-input::placeholder { color: var(--color-text-light, #8a93a7); }
.qa-input:focus { outline: none; background: var(--color-bg-card, #fff); border-color: var(--color-primary, #67b7dc); }
.qa-money { display: flex; align-items: center; background: var(--color-bg-page, #F5F7FB); border: 1px solid transparent; border-radius: var(--radius, 10px); transition: border-color 0.15s ease, background 0.15s ease; }
.qa-money:focus-within { background: var(--color-bg-card, #fff); border-color: var(--color-primary, #67b7dc); }
.qa-money .qa-sym { padding: 11px 2px 11px 13px; color: var(--color-text-light, #8a93a7); font-size: 14px; line-height: 22px; }
.qa-money input { flex: 1; border: 0; background: transparent; padding: 11px 13px 11px 4px; line-height: 22px; font-size: 14px; color: var(--color-text, #444); font-family: Poppins, sans-serif; outline: none; font-variant-numeric: tabular-nums; }
.qa-note { font-size: 12.5px; line-height: 1.4; color: var(--color-text-muted, #666); background: var(--color-bg-page, #F5F7FB); border-radius: var(--radius, 10px); padding: 10px 12px; margin-top: 2px; }
/* An empty note (the normal state on the mileage step - we only speak up while
   working out a distance or when the lookup fails) takes no space at all. */
.qa-note:empty { display: none; }
.qa-error { display: none; font-size: 12.5px; color: var(--color-danger, #d4766a); margin: -4px 0 10px; }

.qa-foot { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 13px 21px; border-top: 1px solid var(--color-border-subtle, #ebedf2); }
/* The success beat clears the footer via $foot.empty() (leaving no children), and
   an actionless success step — e.g. the invoice "Draft saved" beat — otherwise
   renders as a border-top rule across empty padded space. :empty matches because
   .empty() removes text nodes too. */
.qa-foot:empty { display: none; }
.qa-reassure { display: flex; align-items: center; gap: 6px; font-size: 11.5px; line-height: 1.35; color: var(--color-text-light, #8a93a7); max-width: 60%; }
.qa-reassure svg { flex: none; color: var(--color-success, #5fb87a); width: 13px; height: 13px; }
.qa-btn { font-family: Poppins, sans-serif; font-size: 14px; border: 0; border-radius: var(--radius, 10px); padding: 9px 16px; cursor: pointer; transition: background 0.15s ease, opacity 0.15s ease; color: #fff; }
.qa-btn-primary { margin-left: auto; background: var(--color-primary, #67b7dc); }
.qa-btn-primary:hover { background: var(--color-primary-hover, #4f9fc4); }
.qa-btn-primary:disabled { opacity: 0.6; cursor: default; }
.qa-btn-link { background: transparent; color: var(--color-text-light, #8a93a7); padding: 9px 4px; }
.qa-btn-link:hover { color: var(--color-text, #444); }
.qa-btn-primary.is-loading { position: relative; color: transparent; }
.qa-btn-primary.is-loading::after { content: ""; position: absolute; top: 50%; left: 50%; width: 15px; height: 15px; margin: -8px 0 0 -8px; border: 2px solid rgba(255, 255, 255, 0.5); border-top-color: #fff; border-radius: 50%; animation: qaSpin 0.6s linear infinite; }
@keyframes qaSpin { to { transform: rotate(360deg); } }

/* success beat shown just before we hand back to the (now-populated) page */
.qa-confirmed { text-align: center; padding: 20px 8px 26px; }
.qa-confirmed-tick { display: inline-flex; margin-bottom: 8px; }
.qa-confirmed-tick svg circle { fill: var(--color-success, #5fb87a); }
.qa-confirmed-tick svg path { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 20; stroke-dashoffset: 20; animation: qaTickDraw 0.42s 0.08s ease forwards; }
@keyframes qaTickDraw { to { stroke-dashoffset: 0; } }
.qa-confirmed .qa-q { margin: 4px 0 4px; }
.qa-confirmed .qa-help { margin: 0; }

/* While the popover is open, tuck away the floating chat/assistant launchers,
   mirroring send-completion's body.ksc-open convention. */
body.qa-open .kchat-launcher, body.qa-open .kchat-panel, body.qa-open .kai-launcher, body.qa-open .kai-panel { display: none !important; }

@media (prefers-reduced-motion: reduce) {
    .qa-pop, .qa-backdrop.is-in .qa-pop { transition: opacity 0.12s ease !important; transform: none !important; }
    .qa-step { animation: none !important; }
    .qa-btn-primary.is-loading::after { animation: none !important; }
    .qa-confirmed-tick svg path { animation: none !important; stroke-dashoffset: 0 !important; }
}
@media (max-width: 560px) {
    .qa-pop { left: 16px !important; right: 16px !important; top: auto !important; bottom: 16px; width: auto; }
    .qa-tail { display: none; }
}
