/* Solar Planner: follows sunsolutionbd.com (Manrope, deep green, gold accent, pill buttons). */
@font-face { font-family: Manrope; src: url(assets/manrope-latin.woff2) format('woff2'); font-weight: 200 800; font-display: swap; }
:root {
  --paper: #f5f8f6; --surface: #fcfdfb; --soft: #e9efeb; --ink: #173c34; --muted: #526c61; --line: #d2ddd6;
  --accent: #ead37b; --accent-ink: #183e34; --good: #1f7a4d; --warn: #9a6a00; --bad: #a3321f;
  --solar: #e0b73a; --used: #1f7a4d; --use: #173c34; --batt: #2d6a9f;
  --round: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #102b24; --surface: #16352c; --soft: #1c3c32; --ink: #ecf3eb; --muted: #b4c7ba; --line: #3c5749;
    --good: #6fcf97; --warn: #f2c94c; --bad: #ffb4ab; --used: #6fcf97; --use: #ecf3eb; --batt: #7fb8e6;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 Manrope, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 500; letter-spacing: -.05em; line-height: 1.08; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 500; letter-spacing: -.035em; line-height: 1.15; }
h3 { font-size: 1.1rem; font-weight: 600; letter-spacing: -.01em; }
p, small { color: var(--muted); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.skip { position: absolute; left: 16px; top: -60px; background: var(--surface); padding: 8px 14px; border-radius: 999px; z-index: 2000; }
.skip:focus { top: 10px; }
.muted { color: var(--muted); }

.top { display: flex; align-items: center; gap: 14px; padding: 12px max(16px, calc((100% - 1100px) / 2)); background: var(--ink); color: var(--paper); position: sticky; top: 0; z-index: 1000; }
@media (prefers-color-scheme: dark) { .top { background: #0b211b; color: #ecf3eb; } }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; }
.brand img { border-radius: 8px; background: #fff; }
.top-title { opacity: .75; border-left: 1px solid currentColor; padding-left: 14px; }
.top-call { margin-left: auto; text-decoration: none; font-weight: 600; background: var(--accent); color: var(--accent-ink); padding: 6px 14px; border-radius: 999px; }

main { width: min(1100px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 48px; }
.intro { display: grid; gap: 12px; margin-bottom: 22px; }
.intro p { max-width: 62ch; font-size: 1.05rem; }
.stepper { list-style: none; display: flex; gap: 8px; padding: 0; margin: 8px 0 0; flex-wrap: wrap; }
.stepper li { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--soft); color: var(--muted); font-weight: 600; font-size: .9rem; }
.stepper li span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); }
.stepper li.on { background: var(--ink); color: var(--paper); }
.stepper li.on span { background: var(--accent); color: var(--accent-ink); }
.stepper li.done span { background: var(--good); color: #fff; }

.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--round); padding: clamp(18px, 3vw, 32px); }
.step-head { display: grid; gap: 6px; margin-bottom: 18px; }
.step-head p { max-width: 70ch; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 8px 20px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary .arrow { display: grid; place-items: center; width: 30px; height: 30px; margin-right: -12px; border-radius: 50%; background: var(--accent-ink); color: var(--accent); }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; }
.btn.dark { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.sm { min-height: 38px; padding: 6px 14px; font-size: .9rem; }
.row-end { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.row-end .muted { margin-right: auto; }

.search { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.search input { flex: 1 1 260px; }
input, select, textarea { width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: 0; }
.results { list-style: none; padding: 6px; margin: 0 0 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.results button { width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; }
.results button:hover { background: var(--soft); }

.map-wrap { position: relative; }
#map { height: min(62vh, 560px); min-height: 340px; border-radius: 14px; border: 1px solid var(--line); z-index: 1; }
.map-tools { position: absolute; left: 12px; bottom: 12px; z-index: 500; display: flex; gap: 6px; flex-wrap: wrap; }
.map-tools .btn { background: var(--surface); box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.map-tools .btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.map-note { margin-top: 8px; font-size: .92rem; }
.leaflet-container { font: inherit; }
.pin { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 3px solid #173c34; box-shadow: 0 2px 8px rgba(0,0,0,.4); }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; }
.field { display: grid; gap: 6px; align-content: start; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > label, legend { font-weight: 600; font-size: .95rem; padding: 0; }
.field small { font-size: .84rem; line-height: 1.45; }
.field.check label { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.field.check input { width: 20px; min-height: 20px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg label, .choices label { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; background: var(--paper); }
.seg input, .choices input { width: auto; min-height: 0; accent-color: var(--ink); }
.seg label:has(input:checked), .choices label:has(input:checked) { border-color: var(--ink); background: var(--soft); }
.choices { display: grid; gap: 6px; }
.choices label { border-radius: 12px; }
.choices span b { margin-right: 6px; }
.err { color: var(--bad); font-weight: 600; min-height: 1em; margin-top: 10px; }

/* results */
.loading { display: grid; justify-items: center; gap: 16px; padding: 40px 10px; text-align: center; }
.sun { width: 56px; height: 56px; border-radius: 50%; background: var(--solar); box-shadow: 0 0 0 10px color-mix(in srgb, var(--solar) 25%, transparent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 20px color-mix(in srgb, var(--solar) 8%, transparent); } }
@media (prefers-reduced-motion: reduce) { .sun { animation: none; } html { scroll-behavior: auto; } }

.plan-head { display: grid; gap: 8px; margin-bottom: 18px; }
.plan-head .site { font-size: .92rem; }
.callout { background: var(--soft); border-radius: 14px; padding: 14px 16px; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin: 18px 0; }
.opt { border: 1px solid var(--line); border-radius: var(--round); padding: 18px; display: grid; gap: 12px; align-content: start; background: var(--paper); }
.opt.rec { border: 2px solid var(--ink); }
.opt .tag { justify-self: start; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 3px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.opt .big { font-size: 2rem; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; }
.figs { display: grid; grid-template-columns: minmax(9em, 1fr) auto; gap: 6px 14px; margin: 0; }
.figs dt { color: var(--muted); font-size: .92rem; }
.figs dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: .88rem; }
.checks li { display: flex; gap: 8px; }
.checks .ok::before { content: "✓"; color: var(--good); font-weight: 700; }
.checks .warn::before { content: "!"; color: var(--warn); font-weight: 800; padding: 0 3px; }
.checks .fail::before { content: "×"; color: var(--bad); font-weight: 800; }

.card { border: 1px solid var(--line); border-radius: var(--round); padding: 18px; margin-top: 16px; background: var(--paper); }
.card h3 { margin-bottom: 4px; }
.card > p { margin-bottom: 10px; font-size: .92rem; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: Manrope, Arial, sans-serif; }
.chart .axis { stroke: var(--line); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tabs { display: inline-flex; gap: 4px; background: var(--soft); padding: 4px; border-radius: 999px; margin-bottom: 10px; }
.tabs button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; font-weight: 600; cursor: pointer; color: var(--muted); }
.tabs button[aria-pressed="true"] { background: var(--surface); color: var(--ink); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; }
tr.chosen td { font-weight: 700; }
.table-scroll { overflow-x: auto; }
.loan { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 10px; align-items: end; margin-top: 10px; }
.loan label { font-size: .85rem; font-weight: 600; display: grid; gap: 4px; }

.send { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.send .full { grid-column: 1 / -1; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.ok-box { background: color-mix(in srgb, var(--good) 14%, transparent); border-radius: 14px; padding: 14px 16px; color: var(--ink); font-weight: 600; }
details { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 16px; }
summary { cursor: pointer; font-weight: 600; }
.terms { padding-left: 18px; font-size: .88rem; color: var(--muted); }
.print-only { display: none; }

.foot { width: min(1100px, calc(100% - 32px)); margin: 0 auto 40px; display: grid; gap: 8px; font-size: .9rem; }
.foot .small { font-size: .8rem; }

@media (max-width: 760px) {
  .grid2, .send { grid-template-columns: 1fr; }
  .top-title { display: none; }
  .loan { grid-template-columns: 1fr 1fr; }
  .row-end .btn.primary { flex: 1; }
  .opt .big { font-size: 1.7rem; }
  .opt, .card { padding: 14px; }
  .chart text { font-size: 12px; }
}

/* Save as PDF / print: the plan only, on white */
@media print {
  :root { --paper: #fff; --surface: #fff; --soft: #f1f4f2; --ink: #173c34; --muted: #4a5f56; --line: #ccd6d0; color-scheme: light; }
  body { background: #fff; font-size: 11pt; }
  .top, .intro, #step-1, #step-2, #step-3, .foot, .no-print, .skip { display: none !important; }
  main { width: 100%; padding: 0; }
  .step { border: 0; padding: 0; }
  .print-only { display: block; }
  .opt, .card { break-inside: avoid; }
  .options { grid-template-columns: 1fr 1fr; }
  details { display: block; }
  details > summary { display: none; }
  details:not([open]) > *:not(summary) { display: block; }
  a { text-decoration: none; }
}
