/* LK24H Store AI System-wide Smart Cart — canonical rebuilt base R1→R122 FIXED R1; popup opens only after visible AI FAB click */
#ai-order-slot{position:static;margin:0;padding:0;border:0}
#ai-order-root{display:none;font-family:inherit;color:#18181b}
#ai-order-root .ai-order-card{background:#fff;border:1px solid #e4e4e7;border-radius:16px;box-shadow:0 8px 24px rgba(24,24,27,.08);overflow:hidden}
#ai-order-root .ai-order-head{display:flex;align-items:center;gap:10px;padding:12px 14px;border-bottom:1px solid #f1f1f3;background:linear-gradient(180deg,#fff,#fafafa)}
#ai-order-root .ai-order-icon{display:grid;place-items:center;width:38px;height:38px;border-radius:12px;background:#fff1f2;color:#be123c;font-size:18px;flex:0 0 auto}
#ai-order-root .ai-order-title{min-width:0;flex:1}
#ai-order-root .ai-order-title h2{font-size:16px;line-height:1.2;margin:0;font-weight:800;color:#18181b}
#ai-order-root .ai-order-title p{font-size:12px;line-height:1.4;margin:3px 0 0;color:#71717a}
#ai-order-root #ai-order-close{display:none;border:0;background:transparent;font-size:26px;line-height:1;color:#71717a;padding:4px 6px;cursor:pointer}
#ai-order-root #ai-order-status{font-size:13px;line-height:1.45;margin:0;padding:10px 14px;color:#52525b;background:#fafafa}
#ai-order-root .ai-order-expanded{padding:12px 14px 14px}
#ai-order-root .ai-hint{font-size:12px;line-height:1.45;margin:0 0 9px;color:#52525b}
#ai-order-root #ai-order-quick{display:flex;gap:7px;overflow:auto;padding-bottom:2px;margin-bottom:9px;scrollbar-width:none}
#ai-order-root #ai-order-quick::-webkit-scrollbar{display:none}
#ai-order-root .ai-agent-chip{appearance:none;border:1px solid #e4e4e7;background:#fff;color:#3f3f46;border-radius:999px;padding:7px 10px;font-size:12px;font-weight:700;white-space:nowrap;cursor:pointer}
#ai-order-root .ai-agent-chip:active{transform:translateY(1px)}
#ai-order-root #ai-order-text{display:block;width:100%;box-sizing:border-box;border:1px solid #d4d4d8;border-radius:12px;padding:10px 11px;font:inherit;font-size:14px;line-height:1.45;min-height:84px;resize:vertical;background:#fff;color:#18181b}
#ai-order-root #ai-order-text:focus-visible{outline:2px solid #fecdd3;outline-offset:1px;border-color:#fb7185}
#ai-order-root .ai-row{display:flex;gap:8px;flex-wrap:wrap;margin-top:9px}
#ai-order-root .ai-btn{appearance:none;border:1px solid #d4d4d8;background:#fff;color:#27272a;border-radius:10px;padding:9px 12px;font-size:13px;font-weight:800;cursor:pointer;min-height:38px}
#ai-order-root .ai-btn--primary{border-color:#be123c;background:#be123c;color:#fff}
#ai-order-root .ai-btn:disabled{opacity:.55;cursor:not-allowed}
#ai-order-root #ai-voice-status{font-size:12px;color:#52525b;padding-top:7px}
#ai-order-root #ai-result{margin-top:12px}
#ai-order-root .ai-empty,#ai-order-root .ai-loading,#ai-order-root .ai-agent-message,#ai-order-root .ai-success{border-radius:12px;padding:10px 11px;font-size:13px;line-height:1.45}
#ai-order-root .ai-empty{background:#fafafa;color:#71717a;border:1px dashed #d4d4d8}
#ai-order-root .ai-loading{background:#fff7ed;color:#9a3412;border:1px solid #fed7aa}
#ai-order-root .ai-agent-message{background:#f8fafc;color:#334155;border:1px solid #e2e8f0;margin-bottom:9px}
#ai-order-root .ai-success{background:#ecfdf5;color:#166534;border:1px solid #bbf7d0;margin-bottom:9px}
#ai-order-root .ai-draft-list-summary{font-size:12px;color:#71717a;margin:0 0 8px}
#ai-order-root .ai-draft-list{display:grid;gap:10px}
#ai-order-root .ai-draft-card{border:1px solid #e4e4e7;border-radius:14px;padding:11px;background:#fff;box-shadow:0 3px 10px rgba(24,24,27,.04)}
#ai-order-root .ai-draft-card.has-error{border-color:#fca5a5;background:#fffafa}
#ai-order-root .ai-draft-head{display:flex;align-items:flex-start;gap:9px}
#ai-order-root .ai-draft-number{display:grid;place-items:center;width:25px;height:25px;border-radius:9px;background:#f4f4f5;color:#3f3f46;font-size:12px;font-weight:900;flex:0 0 auto}
#ai-order-root .ai-draft-main{min-width:0;flex:1}
#ai-order-root .ai-draft-name{display:block;font-size:14px;line-height:1.35;color:#18181b}
#ai-order-root .ai-draft-meta{font-size:11px;line-height:1.4;color:#71717a;margin-top:3px;word-break:break-word}
#ai-order-root .ai-remove-line{appearance:none;border:0;background:#f4f4f5;color:#71717a;border-radius:9px;width:28px;height:28px;font-size:19px;line-height:1;cursor:pointer;flex:0 0 auto}
#ai-order-root .ai-draft-candidates{display:flex;gap:6px;flex-wrap:wrap;margin-top:9px}
#ai-order-root .ai-field-label{font-size:11px;font-weight:800;color:#52525b;width:100%;margin-bottom:1px}
#ai-order-root .ai-choice-chip{display:inline-flex;align-items:center;gap:6px;border:1px solid #d4d4d8;border-radius:10px;padding:7px 9px;background:#fff;font-size:12px;line-height:1.25;color:#3f3f46;cursor:pointer}
#ai-order-root .ai-choice-chip:has(input:checked){border-color:#fb7185;background:#fff1f2;color:#9f1239}
#ai-order-root .ai-choice-chip input{margin:0;accent-color:#be123c}
#ai-order-root .ai-choice-chip--product{max-width:100%}
#ai-order-root .ai-draft-edit-row{display:grid;grid-template-columns:minmax(100px,.32fr) minmax(0,1fr);gap:8px;margin-top:9px}
#ai-order-root .ai-field{display:block;min-width:0}
#ai-order-root .ai-field input,#ai-order-root .ai-attribute-group input[type="number"],#ai-order-root .ai-attribute-group textarea,#ai-order-root .ai-attribute-group select{display:block;width:100%;box-sizing:border-box;border:1px solid #d4d4d8;border-radius:10px;padding:8px 9px;background:#fff;color:#18181b;font:inherit;font-size:13px;line-height:1.35}
#ai-order-root .ai-draft-attributes{display:grid;gap:8px;margin-top:10px;padding-top:9px;border-top:1px solid #f1f1f3}
#ai-order-root .ai-config-state{font-size:12px;line-height:1.4;color:#71717a;background:#fafafa;border-radius:9px;padding:8px 9px}
#ai-order-root .ai-config-state--error{color:#9f1239;background:#fff1f2}
#ai-order-root .ai-attribute-group{display:block;border:0;padding:0;margin:0;min-width:0}
#ai-order-root .ai-attribute-title{display:flex;align-items:center;gap:7px;font-size:12px;font-weight:900;color:#3f3f46;margin-bottom:6px}
#ai-order-root .ai-required{display:inline-flex;border-radius:999px;padding:2px 6px;background:#fff1f2;color:#be123c;font-size:10px;font-weight:900}
#ai-order-root .ai-attribute-help{font-size:11px;color:#71717a;margin:-2px 0 6px}
#ai-order-root .ai-attribute-choices{display:flex;gap:6px;flex-wrap:wrap}
#ai-order-root .ai-color-swatch{width:14px;height:14px;border-radius:50%;border:1px solid rgba(0,0,0,.15);box-shadow:inset 0 0 0 1px rgba(255,255,255,.5)}
#ai-order-root .ai-toggle-line{display:inline-flex;align-items:center;gap:7px;font-size:13px;color:#3f3f46}

#ai-order-root .ai-draft-title-row{display:flex;align-items:center;gap:7px;flex-wrap:wrap}
#ai-order-root .ai-added-badge{display:inline-flex;align-items:center;border-radius:999px;padding:2px 7px;background:#ecfdf5;color:#166534;font-size:10px;font-weight:900}
#ai-order-root .ai-choice-chip.is-suggested{border-style:dashed;border-color:#f59e0b;background:#fffbeb}
#ai-order-root .ai-suggested-badge{display:inline-flex;align-items:center;border-radius:999px;padding:2px 5px;background:#fef3c7;color:#92400e;font-size:9px;font-weight:900;white-space:nowrap}
#ai-order-root .ai-draft-preview{margin-top:9px;border-radius:9px;padding:8px 9px;font-size:12px;line-height:1.35}
#ai-order-root .ai-draft-preview.is-waiting{background:#fafafa;color:#71717a;border:1px solid #f1f1f3}
#ai-order-root .ai-draft-preview.is-ready{background:#f0fdf4;color:#166534;border:1px solid #bbf7d0;font-weight:800}
#ai-order-root .ai-draft-errors{display:grid;gap:3px;margin-top:9px;border-radius:9px;background:#fef2f2;color:#b91c1c;padding:8px 9px;font-size:12px;line-height:1.35}
#ai-order-root .ai-popup-foot{display:flex;justify-content:flex-end;padding:10px 14px 13px;border-top:1px solid #f1f1f3;background:#fafafa}
#ai-order-root #ai-add-cart-btn{width:100%}
#ai-order-root #ai-order-backdrop{display:none}
#ai-fab-order.fab.ai{position:fixed!important;right:var(--fab-right,16px)!important;bottom:var(--fab-ai-bottom,calc(var(--fab-filter-bottom,144px) + 64px))!important;width:var(--fab-size,56px)!important;height:var(--fab-size,56px)!important;display:flex!important;visibility:visible!important;opacity:1!important;align-items:center;justify-content:center;gap:4px;flex-direction:column;font-size:11px;font-weight:900;z-index:9001!important;background:#7c3aed!important;color:#fff!important}
#ai-fab-order .fab-ai__icon{font-size:18px;line-height:1}
#ai-fab-order .fab-ai__text{font-size:10px;line-height:1}
.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}

#ai-order-root.is-expanded{position:fixed;inset:0;z-index:2147483000;display:flex;align-items:flex-end;justify-content:center;padding:12px;box-sizing:border-box}
#ai-order-root.is-expanded #ai-order-backdrop{display:block;position:absolute;inset:0;border:0;background:rgba(15,23,42,.48)}
#ai-order-root.is-expanded .ai-order-card{position:relative;width:min(760px,100%);max-height:min(88vh,920px);overflow:auto;border-radius:18px;box-shadow:0 24px 80px rgba(15,23,42,.28)}
#ai-order-root.is-expanded #ai-order-close{display:block}
body:has(#ai-order-root.is-expanded){overscroll-behavior:none}

@media (min-width:760px){
  #ai-order-root.is-expanded{align-items:center}
  #ai-order-root .ai-draft-list{grid-template-columns:repeat(2,minmax(0,1fr))}
  #ai-order-root .ai-draft-card{align-self:start}
}
@media (max-width:640px){
  #ai-order-root .ai-order-head{padding:10px 11px}
  #ai-order-root .ai-order-expanded{padding:10px 11px 12px}
  #ai-order-root .ai-draft-edit-row{grid-template-columns:92px minmax(0,1fr)}
  #ai-order-root.is-expanded{padding:0;align-items:flex-end}
  #ai-order-root.is-expanded .ai-order-card{width:100%;max-height:92vh;border-radius:18px 18px 0 0}
}
@media (prefers-reduced-motion:reduce){
  #ai-order-root *,#ai-fab-order{transition:none!important;animation:none!important}
}
#ai-order-root .ai-draft-recognized{margin-top:8px;border-radius:9px;padding:7px 9px;background:#f8fafc;color:#475569;border:1px solid #e2e8f0;font-size:11px;line-height:1.4}
#ai-order-root .ai-config-state--unresolved{color:#92400e;background:#fffbeb;border:1px solid #fde68a}
#ai-order-root .ai-draft-card:has(.ai-config-state--unresolved){border-style:dashed}

#ai-order-root .ai-line-select{display:inline-flex;align-items:center;gap:7px;margin-top:8px;padding:6px 8px;border-radius:9px;background:#f8fafc;color:#334155;font-size:12px;font-weight:800;cursor:pointer}
#ai-order-root .ai-line-select input{margin:0;accent-color:#be123c}
#ai-order-root .ai-note-separated{margin-top:6px;font-size:11px;line-height:1.35;color:#0f766e;background:#f0fdfa;border:1px solid #99f6e4;border-radius:8px;padding:6px 8px}
#ai-order-root .ai-draft-card:has(.ai-line-select input:not(:checked)){opacity:.72;background:#fafafa}


/* R38 guarded preflight and customer-facing commit receipt */
#ai-order-root .ai-commit-receipt{margin:8px 0;padding:10px 12px;border:1px solid rgba(21,128,61,.24);border-radius:12px;background:rgba(240,253,244,.96);font-weight:700;color:#166534;font-size:13px;line-height:1.35}

/* R39-R62 cumulative: catalog, revision, availability, price and cart-proof indicators */
#ai-order-root .ai-draft-recognized{overflow-wrap:anywhere}
#ai-order-root .ai-contract-guard{font-size:12px;color:#475569}

/* R45-R62 cumulative: connector grammar, scoped notes, availability and readiness */
#ai-order-root .ai-popup-foot{display:grid;grid-template-columns:minmax(0,1fr);gap:8px}
#ai-order-root #ai-order-summary{font-size:12px;line-height:1.35;color:#52525b;text-align:left}
#ai-order-root .ai-choice-chip.is-unavailable{opacity:.58;cursor:not-allowed;text-decoration:line-through;background:#f4f4f5}
#ai-order-root .ai-choice-chip.is-unavailable input{cursor:not-allowed}
#ai-order-root .ai-unavailable-badge{display:inline-flex;align-items:center;border-radius:999px;padding:2px 5px;background:#e4e4e7;color:#52525b;font-size:9px;font-weight:900;white-space:nowrap;text-decoration:none}

/* R64-R68 range, attribute-intent and multi-configuration draft cues */
#ai-order-root .ai-draft-recognized{overflow-wrap:anywhere}
#ai-order-root .ai-draft-card[data-split-group]{border-style:dashed}
#ai-order-root .ai-attribute-intent{font-size:12px;font-weight:700}
/* R82-R86 budget and catalog preference states */
#ai-order-root .ai-draft-card.has-budget-warning{border-color:#f0b45d;background:linear-gradient(180deg,#fffaf2,#fff)}
#ai-order-root .ai-draft-card.has-budget-warning .ai-draft-recognized{color:#8a4b08}
#ai-order-root .ai-choice-chip--product span{line-height:1.35}

#ai-order-root .ai-draft-card.has-basket-budget-warning{border-color:#d97706}
#ai-order-root .ai-alternative-badge{display:inline-flex;padding:3px 8px;border-radius:999px;background:#eef2ff;font-size:12px;font-weight:700}

/* R117-R122 click-only popup contract */
#ai-order-slot:empty{display:none}
#ai-order-root:not(.is-expanded){display:none!important}
#ai-order-root.is-expanded{display:flex}

/* LK24H_OPENCLAW_PRODUCTION_INTEGRATION_STAGE_1_FIXED_R1: Android WebView/mobile visual viewport and bottom-nav containment. */
html.lk-store-ai-open,body.lk-store-ai-open{overflow:hidden!important;overscroll-behavior:none!important}
#ai-order-root{
  --lk-store-ai-vvh:100dvh;
  --lk-store-ai-vtop:0px;
  --lk-store-ai-nav-overlap:0px;
}
#ai-order-root.is-expanded{
  inset:auto 0 auto 0!important;
  top:var(--lk-store-ai-vtop,0px)!important;
  height:var(--lk-store-ai-vvh,100dvh)!important;
  max-height:var(--lk-store-ai-vvh,100dvh)!important;
  padding:8px 8px calc(8px + var(--lk-store-ai-nav-overlap,0px) + env(safe-area-inset-bottom,0px))!important;
  overflow:hidden!important;
}
#ai-order-root.is-expanded #ai-order-backdrop{inset:0!important}
#ai-order-root.is-expanded .ai-order-card{
  max-height:calc(var(--lk-store-ai-vvh,100dvh) - var(--lk-store-ai-nav-overlap,0px) - env(safe-area-inset-bottom,0px) - 16px)!important;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}
@media (max-width:640px){
  #ai-order-root.is-expanded{
    padding:4px 0 calc(4px + var(--lk-store-ai-nav-overlap,0px) + env(safe-area-inset-bottom,0px))!important;
  }
  #ai-order-root.is-expanded .ai-order-card{
    max-height:calc(var(--lk-store-ai-vvh,100dvh) - var(--lk-store-ai-nav-overlap,0px) - env(safe-area-inset-bottom,0px) - 4px)!important;
    border-radius:16px 16px 0 0!important;
  }
}
