:root {
  --bg: #F5F6FA; --surface: #FFFFFF; --surface-2: #EEF0F6; --ink: #0E1324; --muted: #5B6478; --line: #E1E4EE;
  --sun-1: #FFC531; --sun-2: #FF8A1F; --sun-3: #FF5E3A; --grad: linear-gradient(135deg, var(--sun-1), var(--sun-2) 55%, var(--sun-3));
  --accent: #E8590C; --accent-soft: #FFF1E3; --violet: #6C5CE7; --good: #12996B; --good-soft: #E2F6EE; --bad: #D6336C; --bad-soft: #FDE8EF; --ok-soft: #FFF3D6; --ok: #A66300;
  --r: 20px; --r-sm: 14px; --shadow: 0 1px 2px rgba(14, 19, 36, .04), 0 8px 24px rgba(14, 19, 36, .06);
  --ease: cubic-bezier(.2, .8, .2, 1); --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0E1A; --surface: #151A2B; --surface-2: #1E2438; --ink: #F2F4FA; --muted: #9AA3B8; --line: #2A3148;
    --accent: #FFA24D; --accent-soft: #33230F; --good: #3DD6A0; --good-soft: #10302A; --bad: #FF7BA5; --bad-soft: #3A1524; --ok-soft: #3A2C0C; --ok: #FFC531;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
  }
}
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { font: 400 16px/1.55 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif; background: var(--bg); color: var(--ink); min-height: 100dvh; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--sun-2); outline-offset: 2px; border-radius: 10px; }
svg { flex: none; }
h1 { font-size: clamp(2rem, 7vw, 3rem); line-height: 1.12; letter-spacing: -.03em; font-weight: 800; text-wrap: balance; }
h2 { font-size: clamp(1.5rem, 5vw, 2rem); line-height: 1.2; letter-spacing: -.02em; font-weight: 800; text-wrap: balance; }
h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 14px; }
b, strong { font-weight: 700; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.eyebrow { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 46ch; }
.help, .hint { color: var(--muted); font-size: .875rem; }
.hint { margin-top: 8px; } .hint b { color: var(--ink); }
.error { color: var(--bad); font-size: .9rem; font-weight: 600; } .error:empty { display: none; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 16px; top: 12px; z-index: 99; background: var(--surface); padding: 8px 12px; border-radius: 10px; }

/* Thanh trên */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 16px; padding-top: env(safe-area-inset-top); box-sizing: content-box;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 1.1rem; letter-spacing: -.02em; min-height: 44px; }
.brand b { font-weight: 800; }
.brand-mark { width: 26px; height: 26px; border-radius: 9px; background: var(--grad); box-shadow: 0 4px 12px rgba(255, 138, 31, .45); position: relative; }
.brand-mark::after { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: #fff; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; color: var(--ink); transition: background .2s, transform .2s var(--spring); margin-left: -8px; }
.icon-btn:hover { background: var(--surface-2); } .icon-btn:active { transform: scale(.9); }
.icon-btn.small { width: 36px; height: 36px; margin: 0; color: var(--muted); } .icon-btn.small svg { width: 18px; height: 18px; }
.sync { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: .78rem; font-weight: 600; color: var(--muted); padding: 6px 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.sync.on i { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); } .sync.wait i { background: var(--sun-1); animation: pulse 1s infinite; } .sync.off i { background: var(--bad); }

/* Khung */
#app { max-width: 720px; margin: 0 auto; padding: 12px 16px calc(120px + env(safe-area-inset-bottom)); outline: none; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Chuyển cảnh */
.enter .stack > * { animation: rise .55s var(--ease) both; }
.enter .stack > :nth-child(2) { animation-delay: 50ms; } .enter .stack > :nth-child(3) { animation-delay: 100ms; } .enter .stack > :nth-child(4) { animation-delay: 150ms; }
.enter .stack > :nth-child(5) { animation-delay: 200ms; } .enter .stack > :nth-child(6) { animation-delay: 250ms; } .enter .stack > :nth-child(n+7) { animation-delay: 300ms; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes grow { from { transform: scaleY(0); } }
@keyframes growX { from { transform: scaleX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 50% { transform: translateY(-10px) scale(1.04); } }
@keyframes ring { from { stroke-dashoffset: var(--from); } to { stroke-dashoffset: var(--to); } }

/* Trang chủ */
.hero { position: relative; padding-top: 28px; }
.sun { position: absolute; top: -40px; right: -70px; width: 260px; height: 260px; pointer-events: none; animation: float 7s ease-in-out infinite; }
.sun span { position: absolute; inset: 0; border-radius: 50%; }
.sun span:nth-child(1) { inset: 70px; background: var(--grad); box-shadow: 0 0 60px rgba(255, 138, 31, .55); }
.sun span:nth-child(2) { inset: 34px; border: 2px dashed color-mix(in srgb, var(--sun-2) 55%, transparent); animation: spin 40s linear infinite; }
.sun span:nth-child(3) { background: radial-gradient(circle, rgba(255, 197, 49, .28), transparent 65%); }
.hero .stack { position: relative; padding-top: 110px; }
.choices, .sys-list { display: grid; gap: 12px; margin-top: 8px; }
.choice, .sys { display: flex; align-items: center; gap: 14px; text-align: left; padding: 18px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); width: 100%;
  transition: transform .25s var(--spring), box-shadow .25s, border-color .2s; }
.choice:hover, .sys:hover { transform: translateY(-3px); border-color: var(--sun-2); }
.choice:active, .sys:active { transform: scale(.98); }
.choice > svg:last-child, .sys > svg:last-child { margin-left: auto; color: var(--muted); transition: transform .25s var(--ease); }
.choice:hover > svg:last-child, .sys:hover > svg:last-child { transform: translateX(4px); }
.choice.primary { background: var(--grad); border-color: transparent; color: #1B0E00; box-shadow: 0 12px 30px rgba(255, 122, 31, .35); }
.choice.primary small, .choice.primary > svg:last-child { color: rgba(27, 14, 0, .72); }
.choice-icon { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.choice.primary .choice-icon { background: rgba(255, 255, 255, .4); color: #1B0E00; }
.choice-text { display: grid; gap: 2px; min-width: 0; } .choice-text strong { font-size: 1.05rem; } .choice-text small { color: var(--muted); font-size: .85rem; }
.trust { list-style: none; padding: 0; display: grid; gap: 8px; color: var(--muted); font-size: .9rem; }
.trust li { display: flex; gap: 8px; align-items: center; } .trust svg { width: 18px; height: 18px; color: var(--good); }

/* Biểu mẫu */
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 6px 0 24px; }
.progress-bar { height: 100%; background: var(--grad); border-radius: 99px; transform-origin: left; transition: transform .6s var(--ease); }
.field { display: grid; gap: 8px; }
.label { font-weight: 600; font-size: .95rem; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.input { width: 100%; min-height: 52px; padding: 0 16px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface); transition: border-color .2s, box-shadow .2s; appearance: none; }
.input:focus { outline: none; border-color: var(--sun-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--sun-2) 22%, transparent); }
.input.big { font-size: 1.6rem; font-weight: 700; min-height: 68px; letter-spacing: -.02em; }
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237a8296' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M3 6l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.input-wrap { position: relative; } .input-wrap .input { padding-right: 64px; }
.suffix { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 8px 16px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; font-size: .92rem; display: inline-flex; align-items: center; gap: 6px;
  transition: transform .2s var(--spring), background .2s, border-color .2s, color .2s; }
.chip small { font-weight: 500; color: var(--muted); } .chip:hover { border-color: var(--sun-2); } .chip:active { transform: scale(.94); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); } .chip.on small { color: inherit; opacity: .7; }
.pill { font-size: .85rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.range { width: 100%; height: 44px; appearance: none; background: transparent; accent-color: var(--sun-2); }
.range::-webkit-slider-runnable-track { height: 8px; border-radius: 99px; background: var(--surface-2); }
.range::-webkit-slider-thumb { appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%; background: var(--grad); border: 3px solid var(--surface); box-shadow: 0 4px 12px rgba(255, 122, 31, .5); transition: transform .2s var(--spring); }
.range:active::-webkit-slider-thumb { transform: scale(1.18); }
.range::-moz-range-track { height: 8px; border-radius: 99px; background: var(--surface-2); }
.range::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--sun-2); border: 3px solid var(--surface); }
.cards2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt { text-align: left; display: grid; gap: 6px; align-content: start; padding: 16px; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--surface); transition: transform .25s var(--spring), border-color .2s, box-shadow .2s; }
.opt small { color: var(--muted); font-size: .84rem; line-height: 1.4; } .opt:active { transform: scale(.97); }
.opt-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); transition: background .2s, color .2s; }
.opt.on { border-color: var(--sun-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--sun-2) 18%, transparent); } .opt.on .opt-icon { background: var(--grad); color: #1B0E00; }
.details { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px 16px; background: var(--surface); }
.details summary { cursor: pointer; font-weight: 600; font-size: .92rem; min-height: 44px; display: flex; align-items: center; } .details[open] { padding-bottom: 14px; }
.month { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; }

/* Nút & thanh hành động */
.btn { min-height: 52px; padding: 0 22px; border-radius: 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--surface); border: 1.5px solid var(--line);
  transition: transform .2s var(--spring), box-shadow .2s, filter .2s; }
.btn svg { width: 20px; height: 20px; } .btn:hover { filter: brightness(1.04); } .btn:active { transform: scale(.96); }
.btn.primary { background: var(--grad); border-color: transparent; color: #1B0E00; box-shadow: 0 8px 22px rgba(255, 122, 31, .35); flex: 1; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); } .btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); } .btn.small { min-height: 40px; padding: 0 14px; border-radius: 12px; font-size: .88rem; flex: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.actionbar-in { max-width: 688px; margin: 0 auto; display: flex; gap: 10px; }

/* Phương án */
.plans { display: grid; gap: 12px; }
.plan { padding: 18px; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; display: grid; gap: 12px; transition: transform .25s var(--spring), border-color .2s, box-shadow .25s; }
.plan:hover { border-color: var(--sun-2); } .plan:active { transform: scale(.985); }
.plan.on { border-color: var(--sun-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--sun-2) 18%, transparent), var(--shadow); }
.plan-head { display: flex; align-items: center; gap: 12px; } .plan-head > div { display: grid; flex: 1; } .plan-head small { color: var(--muted); font-size: .85rem; }
.radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; transition: border-color .2s; }
.radio::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--grad); transform: scale(0); transition: transform .3s var(--spring); }
.plan.on .radio { border-color: var(--sun-2); } .plan.on .radio::after { transform: scale(1); }
.plan-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; padding-top: 12px; border-top: 1px dashed var(--line); }
.plan-stats div { display: grid; } .plan-stats span { font-size: .78rem; color: var(--muted); } .plan-stats b { font-size: .95rem; }
.plan-warn { display: flex; gap: 8px; align-items: flex-start; font-size: .84rem; color: var(--ok); background: var(--ok-soft); padding: 10px 12px; border-radius: 12px; margin-top: 10px; } .plan-warn svg { width: 18px; height: 18px; }

/* Kết quả */
.summary { display: flex; align-items: center; gap: 20px; justify-content: space-between; } .summary > div:first-child { display: grid; gap: 10px; }
.ring { position: relative; width: 132px; height: 132px; flex: none; } .ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; stroke-linecap: round; } .ring-bg { stroke: var(--surface-2); }
.ring-fg { stroke-dashoffset: var(--to); animation: ring 1.2s var(--ease) both .15s; }
.ring-text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; } .ring-text strong { font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; } .ring-text span { font-size: .75rem; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px 14px; }
.stat { display: grid; gap: 1px; } .stat-label, .stat-sub { font-size: .8rem; color: var(--muted); } .stat strong { font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.flow { display: flex; height: 18px; border-radius: 99px; overflow: hidden; gap: 3px; transform-origin: left; animation: growX .9s var(--ease) both .2s; } .flow i { min-width: 0; border-radius: 4px; }
.f-solar { background: var(--sun-2); } .f-batt { background: var(--violet); } .f-grid { background: var(--muted); opacity: .45; } .f-exp { background: var(--surface-2); border: 1px solid var(--line); }
.legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 14px 0 10px; font-size: .88rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 7px; } .legend i { width: 10px; height: 10px; border-radius: 3px; } .legend b { color: var(--ink); }
.bars { position: relative; display: flex; align-items: flex-end; gap: 6px; height: 218px; padding: 28px 0 24px; }
.bar { flex: 1; height: 100%; position: relative; display: flex; align-items: flex-end; justify-content: center; gap: 2px; min-width: 0; }
.bar i, .bar b { flex: 1; max-width: 26px; border-radius: 7px 7px 3px 3px; transform-origin: bottom; }
.bar i { background: var(--grad); animation: grow .7s var(--ease) both; } .bar b { background: var(--surface-2); border: 1px solid var(--line); }
.bar span { position: absolute; bottom: -22px; font-size: .7rem; color: var(--muted); white-space: nowrap; }
.bars-line { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--violet); z-index: 1; height: 0; }
.bars-line span { position: absolute; right: 0; top: -22px; font-size: .72rem; font-weight: 700; color: var(--violet); background: var(--surface); padding: 0 6px; border-radius: 6px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table td, .table th { padding: 11px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; } .table th { font-size: .78rem; color: var(--muted); font-weight: 600; }
.table small { display: block; color: var(--muted); font-size: .82rem; font-weight: 400; } .table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.table tfoot td { border-bottom: 0; padding-top: 16px; } .table .total { font-size: 1.3rem; font-weight: 800; color: var(--accent); }
.notes { list-style: none; padding: 0; display: grid; gap: 10px; }
.notes li { display: flex; gap: 12px; padding: 14px; border-radius: var(--r-sm); background: var(--surface-2); } .notes li.warn { background: var(--ok-soft); }
.notes svg { width: 20px; height: 20px; margin-top: 2px; color: var(--muted); } .notes .warn svg { color: var(--ok); }
.notes strong { font-size: .93rem; } .notes p { font-size: .87rem; color: var(--muted); margin-top: 2px; }

/* Theo dõi */
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: var(--r-sm); background: var(--surface-2); } .banner p { font-size: .85rem; color: var(--muted); } .banner strong { font-size: .93rem; }
.empty { text-align: center; padding: 40px 20px; border: 1.5px dashed var(--line); border-radius: var(--r); display: grid; gap: 8px; justify-items: center; color: var(--muted); } .empty strong { color: var(--ink); font-size: 1.05rem; } .empty svg { width: 36px; height: 36px; color: var(--sun-2); } .empty p { max-width: 38ch; font-size: .92rem; }
.payback { margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--line); display: grid; gap: 8px; } .payback-head { display: flex; justify-content: space-between; font-size: .92rem; font-weight: 600; }
.meter { height: 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; } .meter i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--good), #7ADFA9); transform-origin: left; animation: growX 1s var(--ease) both .2s; }
.logform { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 8px; margin-bottom: 10px; } .logform .btn { flex: none; }
.logs { margin-top: 12px; }
.badge { font-size: .76rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; } .badge.good { background: var(--good-soft); color: var(--good); } .badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.bad { background: var(--bad-soft); color: var(--bad); }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 40; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: .9rem; max-width: calc(100vw - 32px); text-align: center; box-shadow: var(--shadow); transition: opacity .3s, transform .4s var(--spring); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 520px) {
  .summary { flex-direction: column-reverse; align-items: flex-start; } .cards2 { grid-template-columns: 1fr; }
  .logform { grid-template-columns: 1fr; } .actions .btn { flex: 1 1 100%; } .bars { gap: 3px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
@media print {
  .topbar, .no-print, .toast, .actionbar { display: none !important; } body { background: #fff; } #app { max-width: none; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; } * { animation: none !important; }
}

/* Phân khúc đầu tư */
.plan.tier { text-align: left; width: 100%; }
.tier-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .88rem; margin: 0; }
.plan .tier-list { padding-top: 12px; border-top: 1px dashed var(--line); }
.tier-list dt { color: var(--muted); white-space: nowrap; } .tier-list dd { margin: 0; font-weight: 500; }
.card h3 .pill { margin-left: 6px; vertical-align: middle; }
.card .tier-list + .help { margin-top: 12px; }

/* Mô hình 3D */
.scene-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 12px; }
.scene-head h3 { margin: 0; }
.scene-card { padding: 16px; }
.s3-stage { --sky-a: #EEF3FB; --sky-b: #F7F8FB; position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-sm); overflow: hidden;
  background: linear-gradient(180deg, var(--sky-a), var(--sky-b)); transition: background .6s; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.s3-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.s3-stage.dragging canvas { cursor: grabbing; }
.s3-loading { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: var(--muted); font-size: .9rem; }
.s3-hint { position: absolute; right: 10px; bottom: 8px; font-size: .72rem; color: #6b7386; background: rgba(255,255,255,.7); padding: 3px 8px; border-radius: 99px; pointer-events: none; }
.s3-labels { position: absolute; inset: 0; pointer-events: none; }
.s3-label { position: absolute; left: 0; display: grid; justify-items: center; text-align: center; margin-left: -60px; width: 120px; color: #0E1324; transition: transform .25s var(--ease); }
.s3-label.top { top: 10px; } .s3-label.bottom { bottom: 10px; }
.s3-label.bottom { grid-template-rows: auto auto; }
.s3-val { display: flex; align-items: baseline; gap: 3px; white-space: nowrap; }
.s3-val b { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.s3-val small { font-size: .72rem; font-weight: 700; }
.s3-val em { font-style: normal; font-weight: 800; color: var(--sun-2); margin-left: 6px; font-size: 1.05rem; }
.s3-label span { font-size: .76rem; color: #5b6478; font-weight: 600; }
.s3-line { position: absolute; width: 0; border-left: 1.5px dashed rgba(91, 100, 120, .45); }
.s3-label.top .s3-line { top: 54px; }
.s3-label.bottom .s3-line { bottom: 54px; }
.s3-stage.night .s3-label { color: #F2F4FA; } .s3-stage.night .s3-label span { color: #AEB6CA; }
.s3-stage.night .s3-line { border-color: rgba(220, 225, 240, .4); } .s3-stage.night .s3-hint { background: rgba(0,0,0,.35); color: #cfd5e4; }
.s3-bar { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.s3-bar .range { flex: 1; }
.s3-play { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #1B0E00; flex: none; box-shadow: 0 6px 16px rgba(255,122,31,.35); transition: transform .2s var(--spring); }
.s3-play:active { transform: scale(.9); }
.s3-time { min-width: 58px; text-align: center; font-variant-numeric: tabular-nums; }
.s3-sum { margin-top: 8px; } .s3-sum b { color: var(--ink); }
@media (max-width: 520px) {
  .s3-stage { aspect-ratio: 4 / 4.2; }
  .s3-label { width: 96px; margin-left: -48px; } .s3-val b { font-size: 1.05rem; } .s3-val em { font-size: .9rem; margin-left: 4px; }
  .s3-label span { font-size: .7rem; }
}

/* Ô chỉnh số tấm */
.stepper { display: grid; grid-template-columns: 52px 1fr 52px; gap: 8px; }
.step-btn { height: 52px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface); font-size: 1.4rem; font-weight: 700; transition: transform .2s var(--spring), border-color .2s; }
.step-btn:hover { border-color: var(--sun-2); } .step-btn:active { transform: scale(.92); }
.stepper .input { text-align: center; font-weight: 700; font-size: 1.15rem; padding-right: 52px; padding-left: 52px; }
.link { color: var(--accent); font-weight: 600; font-size: .85rem; min-height: 32px; padding: 0 2px; text-decoration: underline; text-underline-offset: 3px; }

.plan-note { display: flex; gap: 8px; align-items: flex-start; font-size: .84rem; color: var(--muted); background: var(--surface-2); padding: 10px 12px; border-radius: 12px; margin-top: 10px; } .plan-note svg { width: 18px; height: 18px; flex: none; }

.plan.disabled { cursor: default; background: var(--surface-2); border-style: dashed; box-shadow: none; }
.plan.disabled:hover { border-color: var(--line); } .plan.disabled:active { transform: none; }
.plan.disabled .plan-head { opacity: .55; }
.plan.disabled .plan-note { margin-top: 0; background: var(--surface); }
.plan-note .link { display: inline; min-height: 0; margin-left: 2px; }

.plan-note > div { display: grid; gap: 4px; } .plan-note p { margin: 0; }
.plan-actions { display: flex; flex-wrap: wrap; gap: 4px 14px; } .plan-actions:empty { display: none; }

/* Thẻ phương án trực quan */
.pv { display: grid; gap: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.pv-save { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pv-save span { font-size: .85rem; color: var(--muted); font-weight: 600; }
.pv-save b { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bill { display: grid; gap: 8px; }
.bill-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--surface-2); gap: 3px; }
.bill-bar i { display: block; height: 100%; }
.bill-saved { background: var(--grad); border-radius: 99px; transform-origin: left; animation: growX .8s var(--ease) both; transition: width .5s var(--ease); }
.bill-left { flex: 1; background: repeating-linear-gradient(-45deg, var(--surface-2), var(--surface-2) 5px, color-mix(in srgb, var(--muted) 18%, var(--surface-2)) 5px, color-mix(in srgb, var(--muted) 18%, var(--surface-2)) 10px); border-radius: 99px; }
.bill-legend { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.bill-legend span { display: inline-flex; align-items: center; gap: 6px; } .bill-legend b { color: var(--ink); }
.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; } .dot.saved { background: var(--sun-2); } .dot.left { background: color-mix(in srgb, var(--muted) 35%, var(--surface-2)); }
.pv-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pv-tile { display: grid; gap: 8px; align-content: start; padding: 12px; border-radius: 14px; background: var(--surface-2); min-width: 0; }
.pv-tile > div { display: grid; gap: 1px; min-width: 0; }
.pv-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); color: var(--accent); }
.pv-ic svg { width: 18px; height: 18px; }
.pv-l { font-size: .74rem; color: var(--muted); font-weight: 600; }
.pv-tile b { font-size: 1.02rem; font-weight: 800; letter-spacing: -.01em; }
.pv-tile small { font-size: .74rem; color: var(--muted); line-height: 1.35; }
.pv-meter { display: block; height: 5px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 18%, transparent); margin-top: 6px; overflow: hidden; }
.pv-meter i { display: block; height: 100%; border-radius: 99px; background: var(--sun-2); transform-origin: left; animation: growX .8s var(--ease) both .1s; }
.pv-meter.pay i { background: linear-gradient(90deg, var(--good), #7ADFA9); }
.plan.on .pv-tile { background: color-mix(in srgb, var(--sun-1) 9%, var(--surface-2)); }
@media (max-width: 640px) { .pv-tiles { grid-template-columns: 1fr 1fr; } }
.pv-tile { grid-template-columns: 32px 1fr; gap: 10px; align-items: start; padding: 11px 12px; }
.pv-tiles { grid-template-columns: 1fr 1fr; }

.pv-tile { display: grid; grid-template-columns: none; gap: 2px; padding: 12px; }
.pv-l { display: flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.pv-l svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.pv-tile b { font-size: 1.1rem; }
@media (min-width: 700px) { .pv-tiles { grid-template-columns: repeat(4, 1fr); } }

/* Thẻ mức đầu tư trực quan */
.plan.tier { gap: 14px; }
.tier-level { display: inline-flex; gap: 3px; align-items: flex-end; height: 22px; flex: none; }
.tier-level i { width: 7px; border-radius: 3px; background: var(--surface-2); }
.tier-level i:nth-child(1) { height: 9px; } .tier-level i:nth-child(2) { height: 15px; } .tier-level i:nth-child(3) { height: 21px; }
.tier-level i.on { background: var(--grad); }
.tier-cost { display: grid; gap: 8px; padding-top: 14px; border-top: 1px dashed var(--line); }
.tier-cost-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.tier-cost-top > div { display: grid; gap: 2px; }
.tier-cost-top b { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; }
.tier-pay { text-align: right; justify-items: end; } .tier-pay b { font-size: 1.1rem !important; }
.tier-bar { display: block; height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.tier-bar i { display: block; height: 100%; border-radius: 99px; background: var(--grad); transform-origin: left; animation: growX .8s var(--ease) both; transition: width .5s var(--ease); }
.tier-cost small { font-size: .78rem; color: var(--muted); }
.tier-body { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.tier-gear { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.tier-gear li { display: grid; grid-template-columns: 28px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.g-ic { grid-row: span 2; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface); color: var(--accent); }
.g-ic svg { width: 16px; height: 16px; }
.g-l { font-size: .72rem; color: var(--muted); font-weight: 600; } .g-v { font-size: .86rem; font-weight: 600; line-height: 1.35; }
.tier-warranty { display: grid; gap: 8px; align-content: start; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.w-row { display: grid; grid-template-columns: 70px 1fr auto; gap: 8px; align-items: center; font-size: .78rem; color: var(--muted); }
.w-row b { color: var(--ink); font-size: .82rem; min-width: 44px; text-align: right; }
.w-bar { height: 7px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 18%, transparent); overflow: hidden; }
.w-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--good), #7ADFA9); transform-origin: left; animation: growX .8s var(--ease) both .1s; }
.plan.tier.on .tier-gear li, .plan.tier.on .tier-warranty { background: color-mix(in srgb, var(--sun-1) 9%, var(--surface-2)); }
@media (max-width: 640px) { .tier-body { grid-template-columns: 1fr; } }

/* ===== Bước 1–3 trực quan ===== */
.ocards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.ocards.c2 { grid-template-columns: 1fr 1fr; } .ocards.c3 { grid-template-columns: repeat(3, 1fr); } .ocards.c4 { grid-template-columns: repeat(4, 1fr); }
.ocard { position: relative; display: grid; justify-items: start; align-content: start; gap: 4px; text-align: left; padding: 14px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--surface);
  transition: transform .25s var(--spring), border-color .2s, box-shadow .25s, background .2s; min-width: 0; }
.ocard:hover { border-color: var(--sun-2); transform: translateY(-2px); }
.ocard:active { transform: scale(.96); }
.ocard strong { font-size: .92rem; line-height: 1.3; }
.ocard small { font-size: .78rem; color: var(--muted); line-height: 1.35; }
.oc-ic { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); margin-bottom: 4px; transition: background .25s, color .25s, transform .4s var(--spring); }
.oc-ic svg { width: 22px; height: 22px; }
.ocard.on { border-color: var(--sun-2); background: color-mix(in srgb, var(--sun-1) 7%, var(--surface)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--sun-2) 16%, transparent), 0 10px 24px rgba(255,122,31,.12); }
.ocard.on .oc-ic { background: var(--grad); color: #1B0E00; transform: scale(1.06) rotate(-4deg); }
.ocard.on::after { content: ''; position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; border-radius: 50%; background: var(--sun-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center/13px no-repeat; animation: pop .35s var(--spring); }
.ocards.tall .ocard { padding: 18px; } .ocards.tall .oc-ic { width: 46px; height: 46px; }
@keyframes pop { from { transform: scale(0); } }
.arrow { display: grid; place-items: center; transform: rotate(var(--r)); transition: transform .5s var(--spring); }
.arrow svg { width: 22px; height: 22px; }

.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 16px; background: var(--surface-2); gap: 4px; }
.seg button { min-height: 44px; border-radius: 12px; font-weight: 700; font-size: .92rem; color: var(--muted); transition: background .25s, color .25s, box-shadow .25s; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 2px 8px rgba(14,19,36,.08); }

.presets { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-top: 2px; padding: 2px; }
.presets::-webkit-scrollbar { display: none; }
.preset { flex: none; min-height: 36px; padding: 0 14px; border-radius: 99px; font-size: .84rem; font-weight: 600; background: var(--surface-2); color: var(--muted); transition: background .2s, color .2s, transform .2s var(--spring); }
.preset:hover { color: var(--ink); } .preset:active { transform: scale(.94); }
.preset.on { background: var(--accent-soft); color: var(--accent); }

.viz { border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); padding: 16px; box-shadow: var(--shadow); }
.viz-empty { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; } .viz-empty svg { color: var(--sun-2); }
.uv { display: grid; gap: 12px; }
.uv-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.uv-head > div { display: grid; gap: 2px; } .uv-head span { font-size: .8rem; color: var(--muted); font-weight: 600; }
.uv-head b { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; } .uv-head b small { font-size: .85rem; font-weight: 700; color: var(--muted); }
.uv-side { text-align: right; justify-items: end; } .uv-side b { font-size: 1.15rem !important; }
.ladder { display: flex; gap: 3px; height: 30px; border-radius: 10px; overflow: hidden; }
.ladder i { min-width: 22px; display: grid; place-items: center; background: hsl(var(--h) 95% 58%); transform-origin: left; animation: growX .7s var(--ease) both; }
.ladder i span { font-size: .7rem; font-weight: 800; color: rgba(27,14,0,.75); font-style: normal; }
.ladder-legend { display: flex; justify-content: space-between; font-size: .76rem; color: var(--muted); }
.uv-note { display: flex; gap: 8px; align-items: flex-start; font-size: .84rem; color: var(--muted); background: var(--surface-2); padding: 10px 12px; border-radius: 12px; }
.uv-note svg { width: 18px; height: 18px; color: var(--sun-2); flex: none; } .uv-note b { color: var(--ink); }

.dn { display: flex; gap: 4px; min-height: 86px; border-radius: 16px; overflow: hidden; }
.dn > div { min-width: 0; display: grid; align-content: center; gap: 2px; padding: 10px 12px; transition: flex .5s var(--ease); overflow: hidden; }
.dn svg { width: 20px; height: 20px; }
.dn span { font-size: .8rem; white-space: nowrap; } .dn b { font-size: 1.05rem; } .dn small { font-size: .74rem; opacity: .8; white-space: nowrap; }
.dn-day { background: linear-gradient(135deg, #FFE7A3, #FFB35C); color: #4A2600; border-radius: 16px 4px 4px 16px; }
.dn-night { background: linear-gradient(135deg, #3B3F8F, #1E2150); color: #E8EAFF; border-radius: 4px 16px 16px 4px; justify-items: end; text-align: right; }
#day-viz { padding: 8px; } #day-viz .hint { padding: 4px 6px 2px; }

.sunm { display: flex; gap: 12px; align-items: center; margin-top: 4px; padding: 14px; border-radius: 16px; background: linear-gradient(135deg, color-mix(in srgb, var(--sun-1) 16%, var(--surface)), var(--surface)); border: 1px solid var(--line); }
.sunm-ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; flex: none; animation: spin 18s linear infinite; }
.sunm-body { display: grid; gap: 6px; flex: 1; min-width: 0; }
.sunm-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sunm-bar { display: block; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.sunm-bar i { display: block; height: 100%; border-radius: 99px; background: var(--grad); transform-origin: left; animation: growX .8s var(--ease) both; }
.sunm small { font-size: .78rem; color: var(--muted); }

.rv { display: flex; gap: 14px; align-items: center; }
.rv-roof { flex: 1; padding: 12px; border-radius: 12px; background: linear-gradient(160deg, #C9D2E2, #AEB9CE); clip-path: polygon(6% 0, 94% 0, 100% 100%, 0 100%); }
.rv-grid { display: grid; gap: 3px; padding: 0 4%; }
.rv-grid i { aspect-ratio: 2.1 / 1; border-radius: 2px; background: rgba(255,255,255,.35); border: 1px dashed rgba(255,255,255,.7); animation: pop .35s var(--spring) both; }
.rv-grid i.on { background: linear-gradient(135deg, #2B4C8C, #172B5C); border: 1px solid #8FA3C7; }
.rv-grid i.extra:not(.on) { opacity: .4; }
.rv-info { display: grid; gap: 2px; flex: none; text-align: right; } .rv-info b { font-size: 1.3rem; font-weight: 800; } .rv-info span { font-size: .78rem; color: var(--muted); }

@media (max-width: 520px) {
  .ocards.c3 { grid-template-columns: repeat(3, 1fr); } .ocards.c4 { grid-template-columns: 1fr 1fr; }
  .ocards.c3 .ocard { padding: 12px 10px; } .ocards.c3 .ocard small { font-size: .72rem; }
  .ocard.on::after { top: 8px; right: 8px; width: 18px; height: 18px; }
  .uv-head b { font-size: 1.4rem; }
  .rv { flex-direction: column; align-items: stretch; } .rv-info { text-align: left; grid-auto-flow: column; justify-content: start; gap: 10px; align-items: baseline; }
}
@media (prefers-color-scheme: dark) { .seg button.on { box-shadow: none; } .rv-roof { background: linear-gradient(160deg, #3A4560, #2A3348); } }

/* Màn hình chờ & ghi nhận thương hiệu */
#splash { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 24px; text-align: center;
  background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--sun-1) 22%, var(--bg)), var(--bg) 60%); transition: opacity .5s var(--ease), visibility .5s; }
#splash.out { opacity: 0; visibility: hidden; }
.sp-sun { position: relative; width: 96px; height: 96px; margin-bottom: 8px; }
.sp-sun span { position: absolute; inset: 0; border-radius: 50%; }
.sp-sun span:nth-child(1) { inset: 18px; background: var(--grad); box-shadow: 0 0 40px rgba(255,138,31,.6); animation: float 2.4s ease-in-out infinite; }
.sp-sun span:nth-child(2) { border: 2px dashed color-mix(in srgb, var(--sun-2) 60%, transparent); animation: spin 8s linear infinite; }
.sp-name { font-size: 2rem; font-weight: 600; letter-spacing: -.03em; } .sp-name b { font-weight: 800; }
.sp-tag { color: var(--muted); font-size: .95rem; max-width: 30ch; }
.sp-bar { width: 140px; height: 4px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 10px 0 18px; }
.sp-bar i { display: block; height: 100%; width: 40%; border-radius: 99px; background: var(--grad); animation: load 1.1s ease-in-out infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.sp-by { position: absolute; left: 0; right: 0; bottom: calc(28px + env(safe-area-inset-bottom)); font-size: .78rem; letter-spacing: .04em; color: var(--muted); }
.sp-by b { color: var(--ink); letter-spacing: .08em; }
.byline { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); }
.byline .brand-mark { width: 20px; height: 20px; border-radius: 7px; flex: none; } .byline .brand-mark::after { inset: 5px; }
.byline b { color: var(--ink); letter-spacing: .06em; }
.sp-by { position: static; margin-top: 28px; padding: 6px 14px; border-radius: 99px; background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--line); }

/* Thẻ cấu hình đề xuất */
.chain { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; position: relative; }
.node { position: relative; display: grid; justify-items: center; text-align: center; gap: 2px; padding: 16px 10px 14px; border-radius: 18px; background: var(--surface-2); min-width: 0;
  animation: rise .5s var(--ease) both; }
.node:nth-child(2) { animation-delay: 80ms; } .node:nth-child(3) { animation-delay: 160ms; } .node:nth-child(4) { animation-delay: 240ms; }
.node-ic { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: var(--grad); color: #1B0E00; margin-bottom: 6px; box-shadow: 0 8px 18px rgba(255,122,31,.28); }
.node-ic svg { width: 24px; height: 24px; }
.node-l { font-size: .74rem; color: var(--muted); font-weight: 600; }
.node b { font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em; }
.node small { font-size: .76rem; color: var(--muted); line-height: 1.35; }
.node.off { opacity: .6; } .node.off .node-ic { background: var(--surface); color: var(--muted); box-shadow: none; }
.node:last-child .node-ic { background: linear-gradient(135deg, #6C5CE7, #4834D4); color: #fff; box-shadow: 0 8px 18px rgba(108,92,231,.3); }
/* đường nối có chấm năng lượng chạy */
.node:not(:last-child)::after { content: ''; position: absolute; top: 40px; right: -20px; width: 18px; height: 4px; border-radius: 99px;
  background: repeating-linear-gradient(90deg, var(--sun-2) 0 5px, transparent 5px 9px); background-size: 18px 4px; animation: flowX 0.8s linear infinite; }
@keyframes flowX { from { background-position: 0 0; } to { background-position: 18px 0; } }
.cfg-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.metric { display: grid; gap: 2px; align-content: start; padding: 14px; border-radius: 16px; border: 1px solid var(--line); min-width: 0; }
.metric b { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.metric small { font-size: .76rem; color: var(--muted); line-height: 1.4; }
.metric .pv-meter { margin-top: 8px; height: 6px; }
@media (max-width: 640px) {
  .chain { grid-template-columns: 1fr 1fr; gap: 12px 14px; }
  .node:nth-child(2)::after { display: none; }
  .node:nth-child(1)::after, .node:nth-child(3)::after { right: -13px; width: 12px; }
  .cfg-metrics { grid-template-columns: 1fr; }
  .metric { grid-template-columns: 1fr auto; column-gap: 12px; }
  .metric .pv-l { grid-column: 1 / -1; } .metric b { grid-row: 2; grid-column: 2; align-self: start; font-size: 1.2rem; } .metric small { grid-row: 2; grid-column: 1; } .metric .pv-meter { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { .node::after { animation: none !important; } }

/* ===== Bản in / PDF ===== */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 12mm 12mm 14mm; }
  :root { color-scheme: light; --bg: #fff; --surface: #fff; --surface-2: #F3F4F7; --ink: #0E1324; --muted: #5B6478; --line: #E1E4EE;
    --accent: #E8590C; --accent-soft: #FFF1E3; --good: #12996B; --good-soft: #E2F6EE; --ok: #A66300; --ok-soft: #FFF3D6; --shadow: none; }
  html, body { background: #fff !important; font-size: 10pt; }
  * { animation: none !important; transition: none !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; box-shadow: none !important; }
  .topbar, .toast, #splash, .skip, .no-print, .scene-card, .actionbar { display: none !important; }
  #app { max-width: none; padding: 0; }
  .print-only { display: block !important; }
  .stack { gap: 4mm; }
  .grad { background: none; color: #E8590C; -webkit-text-fill-color: #E8590C; }

  .print-head { display: flex !important; justify-content: space-between; align-items: center; padding-bottom: 3mm; border-bottom: 2px solid #FF8A1F; }
  .ph-brand { display: flex; align-items: center; gap: 3mm; } .ph-brand .brand-mark { width: 9mm; height: 9mm; border-radius: 2.5mm; }
  .ph-brand .brand-mark::after { inset: 2.4mm; }
  .ph-brand b { font-size: 15pt; font-weight: 600; letter-spacing: -.02em; display: block; line-height: 1.1; } .ph-brand b span { font-weight: 800; }
  .ph-brand small, .ph-meta small { font-size: 8pt; color: #5B6478; }
  .ph-meta { text-align: right; } .ph-meta b { display: block; font-size: 11pt; }

  .summary { gap: 8mm; } .summary h2 { font-size: 17pt; } .summary .lead { font-size: 10pt; max-width: none; } .summary .eyebrow { font-size: 8pt; }
  .ring { width: 26mm; height: 26mm; } .ring-text strong { font-size: 15pt; }

  .card { border: 1px solid #E1E4EE; border-radius: 3mm; padding: 4mm 5mm; break-inside: avoid; }
  h3 { font-size: 11pt; margin-bottom: 3mm; }
  .help { font-size: 8pt; }

  .survey { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6mm 8mm; margin: 0; }
  .survey div { display: grid; grid-template-columns: 26mm 1fr; gap: 2mm; font-size: 9pt; padding-bottom: 1.2mm; border-bottom: 1px dashed #E1E4EE; }
  .survey dt { color: #5B6478; } .survey dd { margin: 0; font-weight: 600; }

  .chain { grid-template-columns: repeat(4, 1fr) !important; gap: 5mm !important; }
  .node { padding: 3mm 2mm; border-radius: 3mm; } .node-ic { width: 10mm; height: 10mm; border-radius: 3mm; margin-bottom: 1mm; } .node-ic svg { width: 5mm; height: 5mm; }
  .node b { font-size: 12pt; } .node small, .node-l { font-size: 7.5pt; }
  .node:not(:last-child)::after { display: block !important; right: -4.2mm !important; width: 3.4mm !important; top: 8mm; background: #FF8A1F; }
  .cfg-metrics { grid-template-columns: repeat(3, 1fr) !important; gap: 3mm; margin-top: 3mm; }
  .metric { display: grid !important; grid-template-columns: none !important; padding: 3mm; border-radius: 3mm; }
  .metric .pv-l, .metric b, .metric small, .metric .pv-meter { grid-column: auto !important; grid-row: auto !important; }
  .metric b { font-size: 12pt; } .metric small { font-size: 7.5pt; }

  .tier-list { font-size: 8.5pt; gap: 1mm 5mm; }
  .flow { height: 4mm; } .legend { font-size: 8.5pt; margin: 2.5mm 0 1.5mm; }
  .bars { height: 38mm; padding: 6mm 0 5mm; } .bars-line span { font-size: 7pt; } .bar span { font-size: 7pt; bottom: -4.5mm; }
  .table { font-size: 9pt; } .table td { padding: 1.5mm 0; } .table small { font-size: 7.5pt; } .table .total { font-size: 13pt; }
  .notes { display: block; columns: 2; column-gap: 4mm; } .notes li { break-inside: avoid; margin-bottom: 2mm; padding: 2.5mm 3mm; gap: 2mm; border-radius: 2mm; }
  .notes strong { font-size: 8.5pt; } .notes p { font-size: 7.8pt; } .notes svg { width: 3.6mm; height: 3.6mm; }
  .print-foot { display: block !important; margin-top: 2mm; padding-top: 3mm; border-top: 1px solid #E1E4EE; font-size: 7.5pt; color: #5B6478; line-height: 1.5; }
}
@media print {
  /* hai biểu đồ nhỏ đặt cạnh nhau để tiết kiệm trang */
  .result { display: grid !important; grid-template-columns: 1fr 1fr; gap: 4mm; }
  .result > * { grid-column: 1 / -1; }
  .result > .flow-card, .result > .month-card { grid-column: auto; }
  .flow-card .legend { display: grid; gap: 1.2mm; }
  .month-card .bars { height: 32mm; }
  .tier-list { grid-template-columns: 28mm 1fr; }
}
@media print { .notes-card { break-inside: auto; } .notes-card h3 { break-after: avoid; } }
@media print {
  @page { margin: 10mm 11mm 11mm; }
  .stack, .result { gap: 3mm !important; }
  .card { padding: 3.5mm 4.5mm; } h3 { margin-bottom: 2.5mm; }
  .print-head { padding-bottom: 2.5mm; }
  .survey { gap: 1.2mm 8mm; } .survey div { padding-bottom: .8mm; font-size: 8.8pt; }
  .node { padding: 2.5mm 2mm; } .cfg-metrics { margin-top: 2.5mm; } .metric { padding: 2.5mm 3mm; }
  .tier-list + .help { display: none; }
  .month-card .bars { height: 28mm; }
  .notes li { padding: 2mm 2.5mm; margin-bottom: 1.6mm; } .notes p { font-size: 7.5pt; line-height: 1.4; }
}

/* Cảnh báo sản lượng vượt nhu cầu */
.callout { display: flex; gap: 14px; padding: 18px; border-radius: var(--r); background: linear-gradient(135deg, color-mix(in srgb, var(--sun-1) 18%, var(--surface)), var(--surface)); border: 1.5px solid color-mix(in srgb, var(--sun-2) 55%, var(--line)); }
.co-ic { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--grad); color: #1B0E00; flex: none; }
.co-body { display: grid; gap: 8px; min-width: 0; } .co-body strong { font-size: 1.02rem; } .co-body p { font-size: .9rem; color: var(--muted); } .co-body p b { color: var(--ink); }
.callout.warn { background: linear-gradient(135deg, color-mix(in srgb, #FF5E3A 14%, var(--surface)), var(--surface)); border-color: color-mix(in srgb, #FF5E3A 50%, var(--line)); }
.co-opts { list-style: none; padding: 0; display: grid; gap: 8px; }
.co-opts li { position: relative; padding: 10px 12px 10px 30px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: .86rem; color: var(--muted); line-height: 1.45; }
.co-opts li::before { content: ''; position: absolute; left: 12px; top: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--sun-2); }
.co-opts b { color: var(--ink); } .co-opts .link { margin-left: 4px; font-size: .84rem; }
.plan-note > span { display: block; }
@media (max-width: 520px) { .callout { flex-direction: column; padding: 16px; } }
@media print { .callout { break-inside: avoid; padding: 3.5mm 4.5mm; border-radius: 3mm; } .co-ic { width: 9mm; height: 9mm; } .co-body p, .co-opts li { font-size: 8pt; } .co-opts li { padding: 1.6mm 2.5mm 1.6mm 6mm; } .co-opts li::before { left: 2.4mm; top: 2.8mm; } }

/* Thẻ tóm tắt kết quả */
.hero-res { display: grid !important; gap: 14px; padding: 20px; border-radius: var(--r); background: linear-gradient(140deg, color-mix(in srgb, var(--sun-1) 16%, var(--surface)), var(--surface) 70%); border: 1px solid var(--line); box-shadow: var(--shadow); }
.hr-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.hr-save { display: grid; gap: 2px; min-width: 0; }
.hr-save > span { font-size: .85rem; color: var(--muted); font-weight: 600; }
.hr-save b { font-size: clamp(1.9rem, 8vw, 2.6rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.hr-save small { font-size: .85rem; color: var(--muted); }
.hero-res .ring { width: 104px; height: 104px; } .hero-res .ring-text strong { font-size: 1.45rem; }
.hero-res .bill-legend { font-size: .8rem; }
@media (max-width: 520px) { .hero-res { padding: 16px; } .hero-res .ring { width: 88px; height: 88px; } .hero-res .ring-text strong { font-size: 1.25rem; } .hero-res .ring-text span { font-size: .68rem; } }
@media print { .hero-res { padding: 4mm 5mm; border-radius: 3mm; gap: 3mm; } .hr-save b { background: none; -webkit-text-fill-color: #E8590C; color: #E8590C; font-size: 20pt; } .hero-res .ring { width: 24mm; height: 24mm; } .hero-res .ring-text strong { font-size: 13pt; } }
.hero-res { grid-template-columns: minmax(0, 1fr); justify-content: stretch; align-items: stretch; }
@media print {
  .notes { display: grid !important; grid-template-columns: 1fr 1fr; gap: 1.6mm 3mm; columns: auto; }
  .notes li { margin-bottom: 0; }
  .hero-res .bill-bar { height: 3mm; } .hr-save small { font-size: 8pt; } .hero-res .help { margin: 0; }
}
@media print {
  .result { display: block !important; }
  .result > * { margin-bottom: 3mm; }
  .result > .flow-card, .result > .month-card { display: inline-block; vertical-align: top; width: calc(50% - 1.6mm); }
  .result > .flow-card { margin-right: 3mm; }
  .result > .print-only { display: block !important; }
  .result > .print-head { display: flex !important; }
}
@media print {
  .result > .flow-card, .result > .month-card { display: block; width: calc(50% - 1.5mm); margin-right: 0; }
  .result > .flow-card { float: left; } .result > .month-card { float: right; }
  .result > .month-card + * { clear: both; }
  .flow-card, .month-card { min-height: 46mm; }
}
@media print {
  .notes { display: block !important; columns: 2; column-gap: 3mm; }
  .notes li { display: flex; break-inside: avoid; margin-bottom: 1.6mm; }
}
@media print {
  .result { font-size: 0; }
  .result > * { font-size: 10pt; }
  .result > .flow-card, .result > .month-card { float: none; display: inline-block; vertical-align: top; width: calc(50% - 1.5mm); }
  .result > .flow-card { margin-right: 3mm; }
  .result > .month-card + * { clear: none; }
  .notes { display: grid !important; grid-template-columns: 1fr 1fr; gap: 1.6mm 3mm; columns: auto; }
  .notes li { margin-bottom: 0; }
}
/* hàng 2 biểu đồ: màn hình giữ nguyên dòng chảy, bản in đặt cạnh nhau */
.chart-row { display: contents; }
@media print {
  .result { font-size: 10pt; }
  .result > .flow-card, .result > .month-card, .chart-row > .card { display: block; float: none; width: auto; margin: 0; min-height: 0; }
  .chart-row { display: grid !important; grid-template-columns: 1fr 1fr; gap: 3mm; margin-bottom: 3mm; break-inside: avoid; }
  .chart-row > .card { margin-bottom: 0; }
  .print-foot { font-size: 7.5pt !important; }
}
@media print {
  .chart-row > .month-card { display: none !important; }
  .chart-row { grid-template-columns: 1fr; }
  .flow-card .legend { display: flex; flex-wrap: wrap; gap: 1mm 6mm; }
}
@media print { .print-foot { margin-top: 0; padding-top: 2mm; } .result > .notes-card { margin-bottom: 2mm; } }

/* Chống tràn ngang trên mobile: phần tử trang trí lấn ra mép khiến Chrome Android nới rộng khung nhìn và làm lệch trang */
html, body { max-width: 100%; overflow-x: hidden; overflow-x: clip; }
.hero { overflow-x: clip; }
.skip { left: 8px; top: 8px; transform: translateY(-300%); }
.skip:focus { transform: none; }

/* Mặt trời trang chủ: lớp nền rộng đúng bằng màn hình, mặt trời tràn tới mép thiết bị (không cắt theo khung nội dung) */
.hero { overflow-x: visible; }
.hero-bg { position: absolute; top: -12px; left: calc(50% - 50vw); width: 100vw; height: 400px; overflow: hidden; pointer-events: none; }
.hero-bg .sun { top: 14px; right: max(-70px, calc((100vw - 720px) / 2 - 70px)); }
.topbar { gap: 8px; } .topbar .brand { margin-right: auto; }

/* ===== Nghiệm thu thi công ===== */
#app.wide { max-width: 1120px; }
.t-good { color: var(--good); } .t-bad { color: var(--bad); }
.acc-sum { display: grid; gap: 12px; }
.acc-sum-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 14px; font-size: .92rem; color: var(--muted); }
.acc-sum-row b { color: var(--ink); font-size: 1.05rem; } .acc-sum-row b.t-good { color: var(--good); } .acc-sum-row b.t-bad { color: var(--bad); }
.acc-bar { display: flex; height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.acc-bar i { display: block; height: 100%; transition: width .5s var(--ease); } .acc-bar .p { background: var(--good); } .acc-bar .f { background: var(--bad); }
.acc-list { display: grid; gap: 12px; }
.acc-cat .acc-bar { height: 6px; margin-top: 6px; width: min(240px, 100%); }
.acc-cat small b.t-bad { font-weight: 700; }
.acc-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.acc-meta span { display: inline-flex; gap: 7px; align-items: center; font-size: .84rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 7px 12px; border-radius: 99px; line-height: 1.35; }
.acc-meta svg { width: 16px; height: 16px; color: var(--accent); }
.acc-nav { justify-content: space-between; } .acc-nav .btn { flex: 0 1 auto; }

.ins-layout { display: grid; gap: 16px; align-items: start; }
.ins-card { padding: 14px; z-index: 5; }
@media (min-width: 960px) {
  .ins-layout { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .ins-card { position: sticky; top: calc(72px + env(safe-area-inset-top)); }
}
@media (max-width: 959px) {
  .ins-card { position: sticky; top: calc(60px + env(safe-area-inset-top)); padding: 8px; border-radius: var(--r-sm); }
  .ins-card .scene-head { display: none; }
}
.ins-stage { position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-sm); overflow: hidden; background: linear-gradient(180deg, #EAF0FA, #F7F8FB); touch-action: pan-y; }
@media (max-width: 959px) { .ins-stage { aspect-ratio: 16 / 10; } }
@media (max-width: 959px) and (max-height: 760px) { .ins-stage { aspect-ratio: 2 / 1; } }
.ins-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.ins-stage.dragging canvas { cursor: grabbing; }
.ins-stage .s3-hint { top: 8px; bottom: auto; }
.ins-cap { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; gap: 8px; align-items: center; padding: 7px 10px; border-radius: 12px;
  background: rgba(255, 255, 255, .93); color: #0E1324; font-size: .84rem; font-weight: 600; line-height: 1.3; box-shadow: 0 4px 14px rgba(14, 19, 36, .14); animation: rise .35s var(--ease); }
.ins-cap b { font-size: .7rem; letter-spacing: .06em; padding: 3px 8px; border-radius: 99px; color: #fff; flex: none; }
.ins-cap.good b { background: #12996B; } .ins-cap.bad b { background: #D6336C; }
.ins-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.ins-mode { min-height: 42px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; font-size: .9rem; transition: background .2s, border-color .2s, transform .2s var(--spring); }
.ins-mode:active { transform: scale(.96); }
.ins-mode.good.on { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.ins-mode.bad.on { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }

.ins-list { display: grid; gap: 10px; }
.ins-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--shadow); transition: border-color .2s; }
.ins-item[open] { border-color: var(--sun-2); }
.ins-item summary { list-style: none; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; cursor: pointer; border-radius: var(--r-sm); }
.ins-item summary::-webkit-details-marker { display: none; }
.ins-no { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); font-weight: 800; font-size: .85rem; flex: none; transition: background .2s, color .2s; }
.ins-item.is-pass .ins-no { background: var(--good); color: #fff; } .ins-item.is-fail .ins-no { background: var(--bad); color: #fff; }
.ins-t { display: grid; gap: 6px; flex: 1; min-width: 0; } .ins-t strong { font-size: .97rem; line-height: 1.35; }
.ins-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.sev, .res { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.sev.danger { background: var(--bad-soft); color: var(--bad); } .sev.major { background: var(--ok-soft); color: var(--ok); } .sev.minor { background: var(--surface-2); color: var(--muted); }
.res:empty { display: none; } .is-pass .res { background: var(--good-soft); color: var(--good); } .is-fail .res { background: var(--bad-soft); color: var(--bad); }
.ins-chev { width: 20px; height: 20px; margin: 4px 0 0 auto; color: var(--muted); transition: transform .25s var(--ease); }
.ins-item[open] .ins-chev { transform: rotate(180deg); }
.ins-body { padding: 0 16px 16px 56px; display: grid; gap: 12px; }
.ins-item[open] .ins-body { animation: rise .35s var(--ease); }
.ins-block h4, .ins-risk h4 { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 3px; }
.ins-block p { font-size: .92rem; }
.ins-risk { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--bad-soft); }
.ins-risk svg { width: 20px; height: 20px; color: var(--bad); flex: none; margin-top: 2px; } .ins-risk h4 { color: var(--bad); } .ins-risk p { font-size: .9rem; }
.ins-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.ins-acts .btn.ghost { padding: 0 8px; color: var(--accent); }
.ins-res-btns { display: flex; gap: 8px; margin-left: auto; }
.btn.res-pass[aria-pressed="true"] { background: var(--good); border-color: var(--good); color: #fff; }
.btn.res-fail[aria-pressed="true"] { background: var(--bad); border-color: var(--bad); color: #fff; }
.notes .link { margin-top: 4px; }
@media (max-width: 520px) { .ins-body { padding-left: 16px; } .ins-item summary { padding: 12px 14px; } }

@media print {
  #app.wide { max-width: none; }
  .acc-report { font-size: 9pt; }
  .ar-head { display: flex; justify-content: space-between; align-items: flex-end; padding-bottom: 3mm; border-bottom: 2px solid #FF8A1F; margin-bottom: 4mm; }
  .ar-head b { display: block; font-size: 13pt; } .ar-head b span { font-weight: 800; color: #E8590C; } .ar-head small { font-size: 8pt; color: #5B6478; } .ar-head > div:last-child { text-align: right; }
  .ar-fields { display: grid; gap: 2mm; margin-bottom: 4mm; font-size: 9.5pt; }
  .ar-table { width: 100%; border-collapse: collapse; margin-bottom: 4mm; break-inside: auto; }
  .ar-table th, .ar-table td { border: 1px solid #D5D9E3; padding: 1.6mm 2mm; text-align: left; vertical-align: top; }
  .ar-table thead tr:first-child th { background: #FFF1E3; font-size: 10pt; }
  .ar-table thead tr:last-child th { font-size: 8pt; color: #5B6478; }
  .ar-table td:first-child { width: 9mm; } .ar-table td:nth-child(3) { width: 30mm; white-space: nowrap; } .ar-table td:last-child { width: 32mm; }
  .ar-table td small { display: block; color: #5B6478; font-size: 7.5pt; margin-top: .6mm; }
  .ar-table tr { break-inside: avoid; }
  .ar-res.pass { color: #12996B; font-weight: 700; } .ar-res.fail { color: #D6336C; font-weight: 700; }
  .ar-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 10mm; margin-top: 8mm; text-align: center; break-inside: avoid; }
  .ar-sign div { height: 32mm; } .ar-sign small { display: block; color: #5B6478; }
}
@media (max-width: 520px) { .ins-cap { font-size: .78rem; padding: 6px 9px; left: 6px; right: 6px; bottom: 6px; } .ins-stage .s3-hint { display: none; } }

/* ===== Gói Unlimited ===== */
.ins-how { display: flex; gap: 8px; align-items: flex-start; } .ins-how svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--accent); }
.ins-item.locked .ins-no { background: var(--accent-soft); color: var(--accent); } .ins-item.locked .ins-no svg { width: 15px; height: 15px; }
.ins-item.locked .ins-t strong { color: var(--muted); }
.sev.lockpill { background: var(--accent-soft); color: var(--accent); }
.ins-lock { display: flex; gap: 12px; padding: 14px; border-radius: 12px; background: var(--accent-soft); border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); }
.ins-lock > svg { width: 22px; height: 22px; color: var(--accent); flex: none; margin-top: 2px; }
.ins-lock > div { display: grid; gap: 8px; justify-items: start; } .ins-lock p { font-size: .9rem; color: var(--muted); }
.ins-lock .btn.primary { flex: none; }
#ins3d.locked canvas { filter: blur(7px) saturate(.6); }
.ins-lockov { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 4px; text-align: center; padding: 16px; background: rgba(14, 19, 36, .28); color: #fff; }
.ins-lockov span { font-size: 1.8rem; } .ins-lockov b { font-size: 1.05rem; } .ins-lockov small { font-size: .82rem; opacity: .9; }
.ins-mode:disabled { opacity: .45; cursor: not-allowed; }
.banner.lock-banner { background: var(--accent-soft); } .banner.lock-banner strong { display: inline-flex; gap: 6px; align-items: center; } .banner.lock-banner svg { width: 16px; height: 16px; color: var(--accent); }
.banner.ok-banner { background: var(--good-soft); } .banner.ok-banner strong { color: var(--good); }
.acc-cat small svg { width: 13px; height: 13px; vertical-align: -2px; color: var(--accent); }
.price-card { display: grid; gap: 16px; }
.price { display: flex; align-items: baseline; gap: 8px; } .price b { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; } .price span { color: var(--muted); font-weight: 600; }
.perks { list-style: none; padding: 0; display: grid; gap: 10px; } .perks li { display: flex; gap: 10px; font-size: .95rem; } .perks svg { width: 20px; height: 20px; color: var(--good); flex: none; }
.pay-step { display: grid; gap: 8px; } .pay-step .btn.primary { width: 100%; }
#ins3d.locked .s3-hint { display: none; }

/* Nghiệm thu theo giai đoạn */
.phase { display: grid; gap: 12px; }
.phase + .phase { margin-top: 8px; }
.phase-head { display: flex; gap: 12px; align-items: flex-start; }
.phase-head h3 { margin: 0; font-size: 1.1rem; } .phase-head p { font-size: .87rem; color: var(--muted); margin-top: 2px; }
.phase-head > div { flex: 1; min-width: 0; }
.phase-no { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--grad); color: #1B0E00; font-weight: 800; flex: none; }
.phase-count { font-size: .82rem; font-weight: 700; color: var(--muted); padding: 4px 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); white-space: nowrap; }
@media print { .ar-phase { font-size: 11pt; margin: 5mm 0 2mm; color: #E8590C; break-after: avoid; } }

/* Khảo sát & báo giá chi tiết */
.quote-card { display: flex; gap: 14px; border: 1.5px solid color-mix(in srgb, var(--sun-2) 55%, var(--line)); background: linear-gradient(135deg, color-mix(in srgb, var(--sun-1) 14%, var(--surface)), var(--surface)); }
.quote-card .co-ic { flex: none; }
.quote-body { display: grid; gap: 10px; flex: 1; min-width: 0; } .quote-body h3 { margin: 0; }
.quote-row { display: flex; gap: 10px; } .quote-row .input { flex: 1; min-width: 0; font-size: 1.05rem; } .quote-row .btn.primary { flex: none; }
.quote-card .help.small { font-size: .8rem; margin: 0; }
.quote-card .consent { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 0; font-size: .85rem; line-height: 1.45; color: var(--ink); cursor: pointer; }
.quote-card .consent input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--sun-2); cursor: pointer; }
.quote-card.done { align-items: flex-start; border-color: color-mix(in srgb, var(--good) 55%, var(--line)); background: color-mix(in srgb, var(--good) 8%, var(--surface)); }
.quote-card.done .co-ic { background: var(--good); color: #fff; } .quote-card.done h3 { margin: 0 0 4px; }
@media (max-width: 520px) { .quote-card { flex-direction: column; padding: 16px; } .quote-row { flex-direction: column; } .quote-row .btn.primary { width: 100%; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.promo { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--sun-1) 22%, var(--surface)); border: 1.5px dashed color-mix(in srgb, var(--sun-2) 70%, transparent); }
.promo-tag { justify-self: start; font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 99px; background: var(--grad); color: #1B0E00; }
.promo p { margin: 0; font-weight: 600; } .promo b { color: var(--accent); } .promo small { display: block; margin-top: 2px; font-weight: 500; color: var(--muted); }

/* ===== Chuẩn bị nghiệm thu ===== */
.setup-top { display: grid; gap: 14px; }
.setup-dots { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; position: relative; }
.setup-dots li { display: grid; justify-items: center; gap: 6px; text-align: center; position: relative; }
.setup-dots li::before { content: ''; position: absolute; top: 15px; right: 50%; width: 100%; height: 3px; background: var(--line); border-radius: 3px; z-index: 0; transition: background .4s; }
.setup-dots li:first-child::before { display: none; }
.setup-dots li.done::before, .setup-dots li.on::before { background: var(--sun-2); }
.setup-dots span { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: var(--surface); border: 2px solid var(--line); color: var(--muted); position: relative; z-index: 1; transition: all .3s var(--spring); }
.setup-dots span svg { width: 16px; height: 16px; }
.setup-dots li.done span { background: var(--sun-2); border-color: var(--sun-2); color: #fff; }
.setup-dots li.on span { border-color: var(--sun-2); color: var(--accent); transform: scale(1.15); box-shadow: 0 0 0 5px color-mix(in srgb, var(--sun-2) 22%, transparent); }
.setup-dots small { font-size: .72rem; color: var(--muted); font-weight: 600; } .setup-dots li.on small { color: var(--ink); }

.opt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.opt-grid.two { grid-template-columns: repeat(2, 1fr); }
.opt { position: relative; display: grid; gap: 10px; text-align: left; padding: 12px 12px 16px; border-radius: var(--r); background: var(--surface); border: 2px solid var(--line); box-shadow: var(--shadow);
  transition: transform .3s var(--spring), border-color .25s, box-shadow .25s, background .25s; }
.opt:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--sun-2) 60%, var(--line)); }
.opt:active { transform: scale(.97); }
.opt.on { border-color: var(--sun-2); background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface)); box-shadow: 0 12px 30px rgba(255, 122, 31, .25); }
.opt-art { display: block; border-radius: 14px; background: linear-gradient(180deg, #EAF2FF, #F8F5EE); overflow: hidden; }
.opt-txt { display: grid; gap: 3px; padding: 0 4px; } .opt-txt strong { font-size: 1.02rem; } .opt-txt small { color: var(--muted); font-size: .82rem; line-height: 1.4; }
.opt-tick { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--sun-2); color: #fff; transform: scale(0); transition: transform .35s var(--spring); }
.opt-tick svg { width: 16px; height: 16px; } .opt.on .opt-tick { transform: scale(1); }
.opt.on .opt-art .art { animation: pop .45s var(--spring); }
@keyframes pop { 40% { transform: scale(1.06); } }
@media (max-width: 640px) {
  .opt-grid, .opt-grid.two { grid-template-columns: 1fr; }
  .opt { grid-template-columns: 112px 1fr; align-items: center; padding: 10px; }
  .opt-txt { padding-right: 30px; }
}
.setup-extra { animation: rise .4s var(--ease); }
.setup-nav { justify-content: space-between; } .setup-nav .btn.primary { flex: 0 1 auto; margin-left: auto; }

/* Minh hoạ SVG */
.art { display: block; width: 100%; height: auto; }
.a-sun { fill: #FFC531; } .a-ray { stroke: #FFB020; stroke-width: 2; stroke-linecap: round; }
.a-wall { fill: #FFFFFF; stroke: #B9C0CE; stroke-width: 1.4; } .a-door { fill: #C9D2E2; } .a-ground { stroke: #C7CCD8; stroke-width: 1.5; }
.a-tin { fill: #C9D2E2; stroke: #8FA3C7; stroke-width: 1.2; } .a-rib { stroke: #8FA3C7; stroke-width: 1; }
.a-tile { fill: #D9785A; stroke: #A9503A; stroke-width: 1.2; } .a-tileline { fill: none; stroke: #A9503A; stroke-width: 1.2; }
.a-slab { fill: #B9BEC8; } .a-leg { stroke: #8D95A5; stroke-width: 1.6; }
.a-panel { fill: #2B4C8C; stroke: #DCE3EE; stroke-width: 1; }
.a-flow { fill: none; stroke: #FF8A1F; stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 4 5; animation: flow 1s linear infinite; }
.a-batt { fill: #FFFFFF; stroke: #6B7386; stroke-width: 1.4; } .a-charge { fill: #3DD6A0; } .a-bolt { fill: #FFFFFF; }
.a-pole { stroke: #8D95A5; stroke-width: 2.4; stroke-linecap: round; } .a-dim { opacity: .45; }
.a-stop { fill: #FDE8EF; stroke: #D6336C; stroke-width: 1.6; } .a-x { stroke: #D6336C; stroke-width: 2; stroke-linecap: round; }
.a-coin { fill: #FFC531; stroke: #E8590C; stroke-width: 1.4; } .a-coint { font: 800 9px 'Be Vietnam Pro', sans-serif; fill: #8A3D00; text-anchor: middle; }
.a-cut { stroke: #D6336C; stroke-width: 2.4; stroke-linecap: round; }
.a-txt { font: 700 7px 'Be Vietnam Pro', sans-serif; fill: #8A6400; text-anchor: middle; }
.a-box { fill: #D9B27C; stroke: #A47A45; stroke-width: 1.2; } .a-tape { stroke: #A47A45; stroke-width: 1.4; }
.a-screen { fill: #3DD6A0; }
.a-check { fill: #12996B; } .a-tick { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.a-ladder { stroke: #8D95A5; stroke-width: 1.8; stroke-linecap: round; }
.a-skin { fill: #E0B48F; } .a-helmet { fill: #FFC531; } .a-vest { fill: #FF7A1A; } .a-spark { stroke: #FFC531; stroke-width: 2; stroke-linecap: round; }
.art-sun { animation: spin 14s linear infinite; }
.art-charge { animation: charge 2.2s ease-in-out infinite; transform-origin: bottom; transform-box: fill-box; }
.art-pulse { animation: pulseS 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.art-bob { animation: bob 2.4s ease-in-out infinite; }
.art-shine { animation: shine 3s ease-in-out infinite; }
@keyframes flow { to { stroke-dashoffset: -9; } }
@keyframes charge { 0% { transform: scaleY(.25); } 60%, 100% { transform: scaleY(1); } }
@keyframes pulseS { 50% { transform: scale(1.12); } }
@keyframes bob { 50% { transform: translateY(-3px); } }
@keyframes shine { 50% { fill: #3B63B0; } }
@media (prefers-reduced-motion: reduce) { .art * { animation: none !important; } }

/* Tóm tắt phương án & thẻ cấu hình */
.pchips { display: flex; flex-wrap: wrap; gap: 8px; }
.pchip { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; font-weight: 600; padding: 6px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); }
.pchip svg { width: 16px; height: 16px; color: var(--accent); }
.prof-card { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.prof-card > div { display: grid; gap: 10px; } .prof-card .pchip { background: var(--surface-2); border-color: transparent; }
.sum-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sum-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px; display: grid; gap: 2px; box-shadow: var(--shadow); }
.sum-stat b { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sum-stat.muted b { background: none; color: var(--muted); } .sum-stat span { font-size: .82rem; color: var(--muted); }
.sum-phases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sum-phase { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: var(--r-sm); background: var(--surface); border: 1.5px solid var(--line); position: relative; }
.sum-phase div { display: grid; } .sum-phase small { color: var(--muted); font-size: .8rem; }
.sum-phase.here { border-color: var(--sun-2); background: var(--accent-soft); }
.sum-phase em { position: absolute; top: -10px; right: 10px; font-style: normal; font-size: .7rem; font-weight: 800; background: var(--grad); color: #1B0E00; padding: 2px 8px; border-radius: 99px; }
.phase-here { font-size: .72rem; font-weight: 800; background: var(--grad); color: #1B0E00; padding: 3px 9px; border-radius: 99px; white-space: nowrap; align-self: center; }
@media (max-width: 640px) { .sum-stats { grid-template-columns: repeat(3, 1fr); } .sum-stat { padding: 10px; } .sum-stat b { font-size: 1.5rem; } .sum-phases { grid-template-columns: 1fr; } }
.setup-nav { flex-wrap: nowrap; } .setup-nav .btn { white-space: nowrap; }

/* Đánh giá báo giá từ ảnh */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.q-up { display: grid; gap: 14px; }
.q-drop { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 36px 16px; border: 1.5px dashed var(--line); border-radius: var(--r-sm); background: var(--surface-2); cursor: pointer; transition: border-color .2s; }
.q-drop:hover, .q-drop:focus-within { border-color: var(--sun-2); }
.q-drop small { color: var(--muted); font-size: .86rem; max-width: 36ch; }
.q-drop-ic svg { width: 40px; height: 40px; color: var(--accent); }
.q-drop.has { padding: 8px; border-style: solid; }
.q-drop img { max-width: 100%; max-height: 420px; border-radius: 10px; object-fit: contain; }
.q-busy { display: flex; gap: 12px; align-items: center; } .q-busy small { display: block; color: var(--muted); font-size: .85rem; }
.spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
.q-res .card { display: grid; gap: 12px; }
.q-verdict { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); } .q-verdict p { font-size: .9rem; color: var(--muted); margin-top: 2px; }
.q-verdict.good { background: var(--good-soft); } .q-verdict.good strong { color: var(--good); }
.q-verdict.ok { background: var(--ok-soft); } .q-verdict.ok strong { color: var(--ok); }
.q-verdict.bad { background: var(--bad-soft); } .q-verdict.bad strong { color: var(--bad); }
.q-range { position: relative; height: 14px; border-radius: 99px; background: var(--surface-2); margin: 8px 0 0; }
.q-band { position: absolute; top: 0; bottom: 0; border-radius: 99px; background: var(--good-soft); border: 1px solid var(--good); }
.q-tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--good); transform: translateX(-1px); }
.q-dot { position: absolute; top: 50%; width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--surface); transform: translate(-50%, -50%); background: var(--good); box-shadow: var(--shadow); }
.q-dot.ok { background: var(--ok); } .q-dot.bad { background: var(--bad); }
.q-legend { display: flex; justify-content: space-between; gap: 8px; font-size: .78rem; color: var(--muted); }
.q-sum { font-size: .95rem; }
.q-res .table td .badge { display: inline-block; margin-top: 4px; }
.q-res .table td b { display: block; }
.notes li.bad { background: var(--bad-soft); } .notes li.bad svg { color: var(--bad); }
.q-issues .badge { display: inline-block; margin-bottom: 4px; } .q-issues strong { display: block; }
.q-res .table .num { padding-left: 12px; }
.q-list { padding-left: 20px; display: grid; gap: 8px; font-size: .93rem; }
.q-items summary { cursor: pointer; list-style: none; } .q-items summary::-webkit-details-marker { display: none; }
.q-items summary h3::after { content: ' ▾'; color: var(--muted); } .q-items[open] summary h3::after { content: ' ▴'; }
@media (max-width: 640px) { .q-legend span:nth-child(2) { display: none; } }

/* ===== Tiến độ nghiệm thu ===== */
.prog { display: grid; gap: 8px; }
.prog-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.prog-head > span { font-weight: 700; font-size: .95rem; }
.prog-head b { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.prog-bar { display: flex; gap: 4px; height: 14px; }
.prog-seg { position: relative; display: flex; overflow: hidden; border-radius: 99px; background: var(--surface-2); min-width: 18px; }
.prog-seg i { display: block; height: 100%; transition: width .6s var(--ease); } .prog-seg .p { background: var(--good); } .prog-seg .f { background: var(--bad); }
.prog-seg.cur { box-shadow: 0 0 0 2px var(--sun-2); }
.prog-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; color: var(--muted); }
.prog-legend span { display: inline-flex; align-items: center; gap: 5px; }
.prog-legend b { width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center; font-size: .68rem; background: var(--surface-2); color: var(--ink); }
.prog-legend em { font-style: normal; font-weight: 700; color: var(--ink); } .prog-total { margin-left: auto; font-weight: 600; }
.prog.compact { gap: 6px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
.prog.compact .prog-head > span { font-size: .8rem; color: var(--muted); } .prog.compact .prog-head b { font-size: 1.15rem; }
.prog.compact .prog-bar { height: 8px; } .prog.compact .prog-legend { font-size: .72rem; }
@media (max-width: 959px) { .prog.compact { margin-bottom: 8px; padding-bottom: 8px; } .prog.compact .prog-legend { display: none; } }

.acc-go { justify-content: space-between; text-align: left; min-height: 64px; width: 100%; }
.acc-go span { display: grid; gap: 1px; } .acc-go small { font-weight: 500; font-size: .82rem; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52ch; }
.acc-done { display: flex; gap: 8px; align-items: center; font-weight: 700; color: var(--good); } .acc-done svg { width: 20px; height: 20px; }

.phase-btn { width: 100%; text-align: left; padding: 14px; border-radius: var(--r); background: var(--surface); border: 1.5px solid var(--line); box-shadow: var(--shadow); align-items: center;
  transition: transform .25s var(--spring), border-color .2s; }
.phase-btn:hover { transform: translateY(-2px); border-color: var(--sun-2); } .phase-btn:active { transform: scale(.985); }
.phase-btn h3 { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.phase-btn .phase-no svg { width: 18px; height: 18px; }
.phase-btn.complete .phase-no { background: var(--good); color: #fff; }
.phase-prog { display: flex; align-items: center; gap: 10px; margin-top: 8px; } .phase-prog .acc-bar { flex: 1; height: 8px; } .phase-prog b { font-size: .85rem; min-width: 3ch; text-align: right; }
.phase-cta { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .88rem; color: var(--accent); white-space: nowrap; align-self: center; }
.phase-cta svg { width: 18px; height: 18px; transition: transform .25s var(--ease); } .phase-btn:hover .phase-cta svg { transform: translateX(3px); }
@media (max-width: 520px) { .phase-btn { flex-wrap: wrap; } .phase-cta { margin-left: 44px; } }

.ins-item.just-done { border-color: var(--good); }
.ins-item.just-done .ins-no { animation: donePop .5s var(--spring); }
@keyframes donePop { 40% { transform: scale(1.35); } }

/* Gói Unlimited: chọn tuần / tháng */
.pkgs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.pkg { position: relative; display: grid; gap: 6px; align-content: start; }
.pkg.best { border-color: var(--sun-2); box-shadow: 0 0 0 1px var(--sun-2), var(--shadow); }
.pkg-name { font-weight: 700; color: var(--muted); font-size: .92rem; }
.pkg-tag { position: absolute; top: -10px; right: 14px; font-size: .72rem; font-weight: 800; background: var(--grad); color: #1B0E00; padding: 3px 10px; border-radius: 99px; }
.pkg .btn { margin-top: 8px; width: 100%; }
.q-up .lock-banner { margin: 0; }
.q-prov { display: grid; gap: 6px; } .q-prov .label { font-weight: 600; font-size: .9rem; }
.legal-links { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .82rem; margin-top: 6px; } .legal-links a { color: var(--muted); }

/* Hộp đăng nhập (Google / Facebook / số điện thoại) */
.login-dlg { width: min(420px, calc(100vw - 32px)); margin: auto; padding: 20px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.login-dlg::backdrop { background: rgba(8, 10, 20, .5); }
.login-dlg .login-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; } .login-dlg .login-head h2 { flex: 1; font-size: 1.25rem; margin: 0; }
.login-dlg .login-opts { display: grid; gap: 10px; margin-top: 16px; } .login-dlg .login-opts .btn { justify-content: flex-start; width: 100%; }
.login-dlg .form-error { color: var(--bad); font-size: .88rem; min-height: 1.2em; margin-top: 8px; }
.login-dlg .stack { margin-top: 14px; }
.topbar .acct { margin-left: auto; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; line-height: 40px; }
.topbar .acct.in { background: transparent; color: var(--muted); }
.topbar .acct[hidden] { display: none; }

/* Xây mới: chọn cấu hình có sẵn theo hoá đơn */
h3.label { margin: 10px 0 -2px; font-size: .95rem; }
.plan.pkg .plan-head > svg { color: var(--muted); flex: none; transition: transform .25s var(--ease); }
.plan.pkg:hover .plan-head > svg { transform: translateX(4px); color: var(--sun-2); }
.preset-bill { display: grid; place-items: center; min-width: 74px; padding: 8px 6px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); font-size: 1.35rem; font-weight: 800; line-height: 1.1; flex: none; }
.preset-bill small { font-size: .66rem; font-weight: 600; color: var(--muted); }
.custom-build { padding: 20px 18px; align-items: flex-start; }
.custom-build .choice-text { gap: 4px; }
.custom-build strong { font-size: 1.15rem; }
.cb-badge { justify-self: start; font-size: .7rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 99px; background: #1B0E00; color: #FFD27A; }
.cb-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cb-tags i { font-style: normal; font-size: .74rem; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: rgba(255, 255, 255, .45); color: #1B0E00; }
.custom-build > svg:last-child { align-self: center; }
.or-sep { display: flex; align-items: center; gap: 12px; margin: 8px 0 0; color: var(--muted); font-size: .85rem; font-weight: 600; }
.or-sep::before, .or-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }
