/* =====================================================================
   Miles Hub — Plan with AI page: chat column, option cards (Best overall /
   Cheapest cash / Best use of miles), typing indicator, context side panel.
   Also defines .lux-meter (shared with the account page's taste profile).
   ===================================================================== */
.plan { padding-bottom: 2rem; }
.plan-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 1.5rem 0 1rem; }
.plan-head h1 { display: flex; align-items: center; gap: .5rem; font-size: 1.6rem; flex-wrap: wrap; }
.plan-spark { color: var(--accent); }
.plan-head-sub { color: var(--muted); font-weight: 500; font-size: 1.05rem; }
.plan-head p { margin: .3rem 0 0; max-width: 640px; }
.plan-head-right { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.plan-ai-badge { white-space: normal; text-align: left; line-height: 1.3; }
.plan-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.25rem; align-items: start; }
@media (max-width: 980px) { .plan-layout { grid-template-columns: 1fr; } }

/* ---- chat column ---- */
.plan-chat { display: flex; flex-direction: column; min-height: 70vh; max-height: calc(100vh - var(--header-h) - 2rem); overflow: hidden; position: sticky; top: calc(var(--header-h) + 1rem); }
@media (max-width: 980px) { .plan-chat { position: static; max-height: none; min-height: 60vh; } }
.plan-messages { flex: 1; overflow-y: auto; padding: 1.1rem 1.1rem .4rem; display: flex; flex-direction: column; gap: 1rem; scroll-behavior: smooth; scrollbar-width: thin; }
.pm { display: flex; gap: .7rem; max-width: 100%; animation: pop .25s var(--ease); }
.pm.user { flex-direction: row-reverse; }
.pm.user .pm-content { align-items: flex-end; max-width: 80%; }
.pm.assistant .pm-content { flex: 1; min-width: 0; }
.pm-content { display: flex; flex-direction: column; gap: .45rem; min-width: 0; }
.pm-avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), #ffb35c); color: #1a1200; font-weight: 800; box-shadow: 0 6px 14px -8px var(--accent); }
.pm-bubble { padding: .75rem .95rem; border-radius: 16px; line-height: 1.5; font-size: .97rem; overflow-wrap: anywhere; }
.pm.user .pm-bubble { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.pm.assistant .pm-bubble { background: var(--surface-2); border-bottom-left-radius: 6px; }
.pm-bubble.md p { margin: 0 0 .5rem; }
.pm-bubble.md p:last-child { margin-bottom: 0; }
.pm-bubble.md ul { margin: .3rem 0 .5rem 1.1rem; padding: 0; }
.pm-bubble.md li { margin: .15rem 0; }
.pm-bubble.md h3, .pm-bubble.md h4, .pm-bubble.md h5 { margin: .6rem 0 .3rem; font-size: 1rem; }
.pm-bubble.md h3:first-child, .pm-bubble.md h4:first-child { margin-top: 0; }
.pm-bubble.md code { background: var(--surface); }
.pm-meta { padding: 0 .3rem; }
.pm-err { display: flex; gap: .6rem; align-items: flex-start; background: var(--danger-bg) !important; color: var(--danger); }
.pm-err > .icon { flex: none; margin-top: .15rem; }
.pm-err .small { color: var(--text); opacity: .85; margin-top: .15rem; }
.pm-err .btn-row { margin-top: .6rem; }
.typing .pm-bubble { display: flex; align-items: center; gap: .7rem; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: bounce 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-5px); opacity: 1; } }
.plan-suggest { padding: .5rem 1.1rem 0; gap: .4rem; }
.plan-suggest .chip { display: inline-flex; align-items: center; }
.plan-suggest .chip:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.plan-suggest.compact .chip { font-size: .76rem; padding: .22rem .6rem; }
.plan-suggest-big { margin-top: .4rem; }
.plan-suggest-big .chip { background: var(--surface); text-align: left; white-space: normal; display: inline-flex; gap: .35rem; align-items: center; padding: .5rem .85rem; color: var(--text); font-weight: 600; line-height: 1.3; }
.plan-suggest-big .chip .icon { color: var(--accent); flex: none; }
.plan-suggest-big .chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.plan-composer { display: flex; gap: .6rem; align-items: flex-end; padding: .7rem 1.1rem .4rem; }
.plan-composer .input { min-height: 44px; max-height: 180px; resize: none; line-height: 1.4; padding: .7rem .95rem; border-radius: 14px; }
.plan-send { width: 46px; height: 46px; padding: 0; border-radius: 14px; flex: none; }
.plan-send .icon { transition: transform .2s var(--ease); }
.plan-send:hover:not([disabled]) .icon { transform: translate(2px, -2px); }
.plan-send .spinner { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; width: 18px; height: 18px; }
.plan-hint { padding: 0 1.1rem .8rem; margin: 0; }

/* ---- option cards ---- */
.plan-options { margin-top: .2rem; }
.po-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: .2rem 0 .7rem; }
.po-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.po-group { display: flex; flex-direction: column; }
.po-group-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; color: var(--muted); display: flex; align-items: center; gap: .3rem; margin-bottom: .55rem; }
.po-group:first-child .po-group-label { color: var(--accent); }
.po-list { display: grid; gap: .7rem; }
.po-card { padding: .95rem 1rem; position: relative; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.po-card.is-best { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent), var(--shadow); }
.po-card.is-best::before { content: "✦ Recommended"; position: absolute; top: -10px; left: 12px; background: var(--accent); color: #1a1200; font-size: .68rem; font-weight: 800; padding: .15rem .5rem; border-radius: 999px; }
.po-card.is-cash { border-color: color-mix(in srgb, var(--ok) 50%, var(--border)); }
.po-card.is-miles { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); }
.po-top { display: flex; align-items: flex-start; gap: .7rem; }
.po-heading { flex: 1; min-width: 0; }
.po-title { font-weight: 800; line-height: 1.25; }
.po-badges { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
.po-icon { color: var(--primary); background: var(--primary-soft); border-color: transparent; }
.po-price { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.po-price b { font-size: 1.3rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.po-why { margin: 0; font-size: .9rem; color: var(--muted); }
.po-award { display: flex; gap: .45rem; align-items: flex-start; font-size: .86rem; padding: .55rem .7rem; border-radius: 10px; background: var(--surface-2); color: var(--text); line-height: 1.35; }
.po-award > .icon { flex: none; margin-top: .15rem; color: var(--primary); }
.po-award.ok { background: var(--ok-bg); color: var(--ok); }
.po-award.ok > .icon { color: var(--ok); }
.po-award.short { background: var(--warn-bg); color: var(--warn); }
.po-award.short > .icon { color: var(--warn); }
.po-award a { font-weight: 600; color: inherit; text-decoration: underline; }
.po-tick { font-size: 1rem; }
.po-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: auto; }
.po-more { margin-top: .8rem; }
.po-more summary { cursor: pointer; font-weight: 600; color: var(--primary); display: inline-flex; align-items: center; gap: .3rem; list-style: none; }
.po-more summary::-webkit-details-marker { display: none; }
.po-more summary .icon { transition: transform .2s; }
.po-more[open] summary .icon { transform: rotate(180deg); }
.po-more .po-list { margin-top: .6rem; }
.pm-searches .chip { display: inline-flex; align-items: center; gap: .3rem; text-decoration: none !important; }

/* ---- side panel ---- */
.plan-side { display: flex; flex-direction: column; gap: .9rem; position: sticky; top: calc(var(--header-h) + 1rem); }
@media (max-width: 980px) { .plan-side { position: static; } }
.plan-side-card h3 { display: flex; align-items: center; gap: .4rem; font-size: .95rem; margin-bottom: .6rem; }
.plan-side-card h3 .icon { color: var(--primary); }
.plan-side-card .stepper { border-bottom: 0; padding: .2rem 0; }
.plan-miles { list-style: none; margin: 0 0 .7rem; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.plan-miles li { display: flex; align-items: center; gap: .6rem; }
.pmi-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.pmi-text b { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pmi-bal { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan-dests { margin-top: .6rem; }
.plan-dests .chip { cursor: default; display: inline-flex; align-items: center; gap: .2rem; }
.plan-taste-sum { margin: .6rem 0 0; }

/* ---- luxury meter (shared with account page) ---- */
.lux-meter { position: relative; height: 10px; border-radius: 999px; background: linear-gradient(90deg, var(--ok), var(--primary) 50%, var(--accent)); margin: .55rem 0 .3rem; }
.lux-fill { position: absolute; left: 0; top: 0; height: 100%; width: 0; border-radius: 999px; transition: width .7s var(--ease); }
.lux-fill::after { content: ""; position: absolute; right: -9px; top: -4px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 3px solid var(--text); box-shadow: var(--shadow); }
.lux-scale { display: flex; justify-content: space-between; }
