:root,[data-theme="light"]{
  --text-xs:clamp(.75rem,.7rem + .25vw,.875rem);
  --text-sm:clamp(.875rem,.8rem + .35vw,1rem);
  --text-base:clamp(1rem,.95rem + .25vw,1.125rem);
  --text-xl:clamp(1.5rem,1.2rem + 1.25vw,2.25rem);
  --space-2:.5rem;
  --space-3:.75rem;
  --space-4:1rem;
  --space-5:1.25rem;
  --space-6:1.5rem;
  --color-bg:#f7f6f2;
  --color-surface:#f9f8f5;
  --color-surface-2:#fbfbf9;
  --color-surface-offset:#f3f0ec;
  --color-border:#d4d1ca;
  --color-divider:#dcd9d5;
  --color-text:#28251d;
  --color-text-muted:#66645e;
  --color-text-inverse:#f9f8f4;
  --color-primary:#01696f;
  --color-primary-hover:#0c4e54;
  --color-primary-highlight:#cedcd8;
  --radius-md:.5rem;
  --radius-lg:.75rem;
  --radius-xl:1rem;
  --radius-full:9999px;
  --shadow-sm:0 1px 2px rgba(0,0,0,.06);
  --font-body:'Satoshi',Inter,system-ui,sans-serif;
}
[data-theme="dark"]{
  --color-bg:#171614;
  --color-surface:#1c1b19;
  --color-surface-2:#201f1d;
  --color-surface-offset:#1d1c1a;
  --color-border:#393836;
  --color-divider:#262523;
  --color-text:#e1dfda;
  --color-text-muted:#a09f9a;
  --color-text-inverse:#151412;
  --color-primary:#4f98a3;
  --color-primary-hover:#227f8b;
  --color-primary-highlight:#313b3b;
}
*{box-sizing:border-box;margin:0;padding:0}
html{-webkit-text-size-adjust:none;text-size-adjust:none;scroll-behavior:smooth}
body{min-height:100dvh;font-family:var(--font-body);font-size:var(--text-base);line-height:1.5;background:var(--color-bg);color:var(--color-text)}
button,input,select{font:inherit;color:inherit}
img,svg,canvas{display:block;max-width:100%}
.skip-link{position:absolute;left:-9999px;top:auto}
.skip-link:focus{left:var(--space-4);top:var(--space-4);background:var(--color-primary);color:var(--color-text-inverse);padding:var(--space-3) var(--space-4);border-radius:var(--radius-md);z-index:100}
.app{display:grid;grid-template-columns:1fr;gap:var(--space-6);padding:var(--space-6);min-height:100dvh}
.panel,.card{background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-xl);box-shadow:var(--shadow-sm)}
.main{display:grid;gap:var(--space-6);width:100%}
.head-card{padding:var(--space-5)}
.top-grid,.bottom-grid{display:grid;grid-template-columns:2fr 1fr;gap:var(--space-6);align-items:start}
.left-column{padding:var(--space-5)}
.right-column,.results-card{padding:var(--space-5)}
#infoAccordions{padding:var(--space-5)}
.header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-4)}
.brand{display:flex;align-items:center;gap:var(--space-3)}
.logo{width:42px;height:42px;border-radius:12px;background:linear-gradient(135deg,var(--color-primary-highlight),transparent),var(--color-surface-offset);display:grid;place-items:center;border:1px solid var(--color-primary);flex:none}
.logo svg{width:24px;height:24px;color:var(--color-primary)}
h1{font-size:var(--text-xl);line-height:1.05}
h2{font-size:1.25rem;margin-bottom:.5rem}
.muted{color:var(--color-text-muted)}
.tiny{font-size:var(--text-xs);color:var(--color-text-muted)}
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;border-radius:var(--radius-full);border:1px solid var(--color-border);background:var(--color-surface-2);flex:none}
.head-actions{display:flex;align-items:center;gap:var(--space-2);flex:none}
.screenshot-btn{min-height:44px;white-space:nowrap}
@media (max-width:640px){.head-actions{flex-wrap:wrap;justify-content:flex-end}}
form{display:grid;gap:var(--space-4)}
.field{display:grid;gap:var(--space-2)}
.field-row{display:grid;grid-template-columns:1fr 1fr;gap:var(--space-3)}
label{font-size:var(--text-sm);font-weight:600}
input,select{width:100%;min-height:44px;padding:.8rem .95rem;border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-surface-2)}
input[type="checkbox"],input[type="radio"]{width:22px;height:22px;min-height:auto}
.inline-check{display:flex;align-items:center;justify-content:space-between;padding:.85rem .95rem;border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-surface-2)}
.actions{display:flex;gap:var(--space-3);flex-wrap:wrap;padding-top:var(--space-2)}
.optimize-actions{padding-top:0}
.optimize-actions .btn{flex:1 1 240px}
.btn{display:inline-flex;align-items:center;justify-content:center;min-height:46px;padding:0 1rem;border-radius:var(--radius-md);border:1px solid transparent;font-weight:700;text-decoration:none;cursor:pointer;text-align:center}
.btn-primary{background:var(--color-primary);color:var(--color-text-inverse)}
.btn-primary:hover{background:var(--color-primary-hover)}
.btn-primary:disabled{opacity:.6;cursor:progress}
.btn-secondary{background:var(--color-surface-offset);border-color:var(--color-border);color:var(--color-text)}
.btn-secondary:hover{background:var(--color-surface)}
.metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:var(--space-4)}
.metric{padding:var(--space-4);background:var(--color-surface-2);border-radius:var(--radius-lg);border:1px solid var(--color-border)}
.metric .value{font-size:clamp(1.4rem,1.1rem + 1vw,2rem);font-weight:700;font-variant-numeric:tabular-nums lining-nums}
.metric .label{font-size:var(--text-xs);text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-muted)}
.chart-column{padding:var(--space-5);display:grid;gap:var(--space-5)}
.chart-column .chart-card{padding:0;border:none;box-shadow:none;background:transparent}
.chart-column .chart-wrap{height:240px}
.chart-wrap{position:relative;width:100%;height:320px}
.chart-stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.5rem .75rem;margin-top:.75rem;padding:.85rem 1rem;border:1px solid var(--color-divider);border-radius:var(--radius-lg);background:var(--color-surface-2);font-size:var(--text-sm)}
.chart-stats strong{font-weight:700}
.table{width:100%;border-collapse:collapse;font-size:var(--text-sm)}
.table th,.table td{padding:.8rem;border-bottom:1px solid var(--color-divider);text-align:left;vertical-align:top}
.table th{color:var(--color-text-muted);font-size:var(--text-xs);text-transform:uppercase;letter-spacing:.06em}
details{background:var(--color-surface-2);border:1px solid var(--color-border);border-radius:var(--radius-lg);padding:var(--space-4)}
details+details{margin-top:var(--space-3)}
summary{cursor:pointer;font-weight:700}
.results-card.full-width,#infoAccordions.full-width,.planner-card.full-width{grid-column:1 / -1}
.bottom-grid{grid-template-columns:1fr}
.results-panel{padding:var(--space-4);border:1px solid var(--color-divider);border-radius:var(--radius-lg);background:var(--color-surface-2);display:flex;flex-direction:column}
.inner-table{font-size:var(--text-sm)}
.metrics-inline{margin-bottom:var(--space-4)}
.results-actions{margin-top:1rem;display:grid;gap:.5rem}
.analysis-note{font-size:var(--text-xs);color:var(--color-text-muted);line-height:1.4}
.results-panel h3{font-size:1.5rem;line-height:1.25;margin-bottom:1rem}

/* ===================== PV-PLANER ===================== */
.planner-card{padding:var(--space-5)}
.planner-card>.muted{margin-bottom:var(--space-4)}
.planner-grid{display:grid;grid-template-columns:1.6fr 1fr;gap:var(--space-5);align-items:start}
.map-col{display:grid;gap:var(--space-3)}
.map-toolbar{display:flex;gap:var(--space-3)}
.map-toolbar input{flex:1}
.map-toolbar .btn{flex:none;min-width:110px}
.map{width:100%;height:460px;border-radius:var(--radius-lg);border:1px solid var(--color-border);background:var(--color-surface-offset);overflow:hidden}
.map-actions{display:flex;gap:var(--space-3);flex-wrap:wrap}
.map-actions .btn{flex:1 1 130px;min-height:44px}
.planner-controls{display:grid;gap:var(--space-4);align-content:start}
.planner-fieldset,.geom-fieldset{border:1px solid var(--color-border);border-radius:var(--radius-lg);padding:var(--space-4);display:grid;gap:var(--space-3)}
.planner-fieldset legend,.geom-fieldset legend{font-size:var(--text-sm);font-weight:700;padding:0 .4rem;color:var(--color-text-muted)}
.radio-row{display:flex;align-items:flex-start;gap:.6rem;font-weight:500;font-size:var(--text-sm);line-height:1.35;cursor:pointer}
.radio-row input{flex:none;margin-top:.1rem}
.planner-stats{display:grid;grid-template-columns:1fr 1fr;gap:.75rem;padding:var(--space-4);border:1px solid var(--color-divider);border-radius:var(--radius-lg);background:var(--color-surface-2)}
.planner-stats>div{display:grid;gap:.15rem}
.planner-stats strong{font-size:1.15rem;font-variant-numeric:tabular-nums}
.geom-fieldset{margin:var(--space-2) 0}

@media (max-width:1100px){
  .top-grid,.bottom-grid,.metrics{grid-template-columns:1fr}
  .planner-grid{grid-template-columns:1fr}
  .map{height:380px}
}
@media (max-width:700px){
  .chart-stats,.field-row,.planner-stats{grid-template-columns:1fr}
  .optimize-actions .btn{flex:1 1 100%}
  .map-toolbar{flex-wrap:wrap}
  .map-toolbar .btn{flex:1}
}


body.is-screenshotting,
body.is-screenshotting .app {
  background: var(--color-bg) !important;
}

body.is-screenshotting .panel,
body.is-screenshotting .card,
body.is-screenshotting .results-panel,
body.is-screenshotting details,
body.is-screenshotting #map,
body.is-screenshotting .planner-card,
body.is-screenshotting .results-card,
body.is-screenshotting .head-card {
  box-shadow: none !important;
  filter: none !important;
}

body.is-screenshotting .panel::before,
body.is-screenshotting .panel::after,
body.is-screenshotting .card::before,
body.is-screenshotting .card::after,
body.is-screenshotting .results-panel::before,
body.is-screenshotting .results-panel::after {
  display: none !important;
  content: none !important;
}


body.is-screenshotting .panel,
body.is-screenshotting .card,
body.is-screenshotting .results-panel,
body.is-screenshotting details,
body.is-screenshotting #map,
body.is-screenshotting .planner-card,
body.is-screenshotting .results-card,
body.is-screenshotting .head-card,
body.is-screenshotting .planner-shot-image {
  box-shadow: none !important;
  filter: none !important;
}

body.is-screenshotting .panel::before,
body.is-screenshotting .panel::after,
body.is-screenshotting .card::before,
body.is-screenshotting .card::after {
  content: none !important;
  display: none !important;
}
