:root {
  --ink: #16221c;
  --muted: #66736c;
  --line: #dfe6e1;
  --paper: #ffffff;
  --canvas: #f3f6f2;
  --green: #1b6b45;
  --green-dark: #0f5233;
  --lime: #b8db3b;
  --blue: #214d78;
  --danger: #a93636;
  --shadow: 0 12px 34px rgba(22, 48, 34, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 15px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.shell { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
.site-header { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid rgba(223,230,225,.9); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); }
.header-row { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 800; letter-spacing: -.5px; }
.brand-mark { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; color: #fff; background: var(--green); box-shadow: inset -7px -7px 0 rgba(184,219,59,.3); }
.header-nav { display: flex; align-items: center; gap: 28px; color: #4d5d54; font-weight: 600; }
.header-nav a:hover, .header-nav .active { color: var(--green); }
.hero { padding: 60px 0 34px; }
.hero h1 { max-width: 790px; margin: 4px 0 12px; font-size: clamp(34px, 5vw, 60px); line-height: 1.02; letter-spacing: -2.8px; }
.hero > p:last-child { max-width: 720px; margin: 0; color: var(--muted); font-size: 18px; }
.eyebrow { margin: 0 0 6px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
.calculator-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; align-items: start; gap: 22px; padding-bottom: 70px; }
.calculator-form { display: grid; gap: 22px; }
.card { border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: var(--shadow); padding: 26px; }
.section-heading { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.section-heading > span { flex: 0 0 34px; display: grid; place-items: center; height: 34px; border-radius: 10px; color: #fff; background: var(--green); font-weight: 800; }
.section-heading h2 { margin: 0; font-size: 22px; letter-spacing: -.4px; }
.section-heading p { margin: 2px 0 0; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
label, legend { color: #3e4e45; font-size: 13px; font-weight: 700; }
label small { display: block; min-height: 18px; margin-top: 6px; color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.35; }
input, select { width: 100%; height: 46px; margin-top: 7px; border: 1px solid #cdd7d0; border-radius: 11px; outline: none; padding: 0 12px; color: var(--ink); background: #fbfcfb; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(27,107,69,.12); }
input:disabled { color: #98a49d; background: #eef1ef; }
.city-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.city-button { border: 1px solid #d6dfd9; border-radius: 999px; padding: 8px 13px; color: #526159; background: #f8faf8; font-size: 13px; font-weight: 700; }
.city-button:hover { border-color: #9fb6a7; }
.city-button.active { border-color: var(--green); color: #fff; background: var(--green); }
.switch-row { display: flex; align-items: center; gap: 11px; margin: 18px 0; cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; flex: 0 0 42px; width: 42px; height: 24px; border-radius: 99px; background: #c5cec8; transition: .2s; }
.switch::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.2); transition: .2s; }
.switch-row input:checked + .switch { background: var(--green); }
.switch-row input:checked + .switch::after { transform: translateX(18px); }
.switch-row strong, .switch-row small { display: block; }
.switch-row small { color: var(--muted); font-weight: 500; }
.label-with-tip { display: inline-flex; align-items: center; gap: 6px; }
.tooltip { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: #fff; background: var(--green); font-size: 12px; font-weight: 800; cursor: help; }
.tooltip [role="tooltip"] { position: absolute; z-index: 30; left: 50%; bottom: calc(100% + 10px); width: 260px; padding: 11px 12px; border-radius: 10px; color: #fff; background: #173228; box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: 12px; font-weight: 500; line-height: 1.4; opacity: 0; visibility: hidden; transform: translate(-50%, 4px); transition: .18s; pointer-events: none; }
.tooltip:hover [role="tooltip"], .tooltip:focus [role="tooltip"] { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.segmented-field { margin: 18px 0 0; border: 0; padding: 0; }
.segmented { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 8px; border-radius: 12px; padding: 4px; background: #edf1ee; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; border-radius: 9px; padding: 8px 16px; color: #69756e; cursor: pointer; }
.segmented input:checked + span { color: var(--green-dark); background: #fff; box-shadow: 0 2px 8px rgba(24,64,42,.08); }
.roof-preview-wrap { margin-top: 22px; border-radius: 16px; padding: 17px; background: #f4f7f4; }
.preview-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 13px; color: #46564d; font-size: 13px; }
.preview-head span { color: var(--muted); }
.roof-preview { position: relative; display: grid; place-items: center; width: 100%; min-height: 310px; overflow: hidden; border: 8px solid #9a7551; background: repeating-linear-gradient(135deg,#59655e 0,#59655e 14px,#525e57 14px,#525e57 28px); box-shadow: inset 0 0 32px rgba(0,0,0,.28); }
.roof-preview.triangle { clip-path: polygon(50% 0,100% 100%,0 100%); padding: 35% 22% 2%; }
.roof-preview.trapezoid { clip-path: polygon(18% 0,82% 0,100% 100%,0 100%); padding: 5% 8% 2%; }
.panel-grid { position: absolute; inset: 6%; display: grid; align-content: center; justify-content: center; gap: min(5px, .7vw); }
.panel-tile { min-width: 6px; min-height: 10px; border: 1px solid rgba(255,255,255,.72); border-radius: 2px; background: linear-gradient(135deg,#1d4f78,#0f2c4a); box-shadow: inset 0 0 0 1px rgba(15,28,48,.55); }
.panel-tile::after { content: ""; display: block; width: 50%; height: 100%; border-right: 1px solid rgba(255,255,255,.15); }
.preview-empty { position: relative; z-index: 2; border-radius: 9px; padding: 8px 12px; color: #fff; background: rgba(18,34,26,.72); }
.preview-note { margin: 10px 0 0; color: var(--muted); font-size: 11px; }
.results-column { position: sticky; top: 92px; display: grid; gap: 18px; }
.results-card { color: #fff; border: 0; background: linear-gradient(145deg, var(--green-dark), #1e754c); }
.results-card .eyebrow { color: var(--lime); }
.primary-result { margin: 8px 0 22px; }
.primary-result strong { display: block; font-size: 48px; line-height: 1; letter-spacing: -2px; }
.primary-result span { color: rgba(255,255,255,.72); }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden; border: 1px solid rgba(255,255,255,.14); border-radius: 14px; background: rgba(255,255,255,.14); }
.metrics div { min-height: 74px; padding: 12px; background: rgba(10,47,29,.5); }
.metrics span, .metrics strong { display: block; }
.metrics span { color: rgba(255,255,255,.64); font-size: 11px; }
.metrics strong { margin-top: 4px; font-size: 18px; }
.optimal-note { margin: 15px 0 0; color: rgba(255,255,255,.7); font-size: 12px; }
.notice { margin-top: 15px; border-radius: 10px; padding: 10px 12px; font-size: 12px; }
.notice.warning { color: #fff4c2; background: rgba(105,70,0,.45); }
.notice.error { color: #7b1d1d; background: #fde8e8; }
.production-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.production-head strong { font-size: 31px; letter-spacing: -1px; }
.production-head > div > span { color: var(--muted); font-size: 12px; }
.source-badge { border-radius: 999px; padding: 5px 8px; color: var(--green); background: #e8f1eb; font-size: 10px; font-weight: 800; white-space: nowrap; }
.chart { display: grid; grid-template-columns: repeat(12, 1fr); align-items: end; gap: 4px; height: 146px; margin: 20px 0 9px; padding-top: 8px; border-bottom: 1px solid var(--line); }
.bar-wrap { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 5px; }
.bar { width: 100%; min-height: 2px; border-radius: 4px 4px 0 0; background: linear-gradient(#b8db3b,#3a8a51); transition: height .25s; }
.bar-label { color: var(--muted); font-size: 9px; }
.primary-button { width: 100%; min-height: 45px; border: 0; border-radius: 11px; padding: 10px 14px; color: #fff; background: var(--green); font-weight: 800; }
.primary-button:hover { background: var(--green-dark); }
.primary-button:disabled { cursor: wait; opacity: .65; }
.api-status { min-height: 34px; margin: 9px 0 0; color: var(--muted); font-size: 11px; }
.consult-link { display: flex; justify-content: space-between; align-items: center; border-radius: 14px; padding: 16px 18px; color: var(--green-dark); background: var(--lime); font-weight: 800; }
footer { border-top: 1px solid var(--line); background: #fff; }
.footer-row { min-height: 72px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; }

/* Admin */
.admin-main { min-height: calc(100vh - 142px); padding: 48px 0 70px; }
.admin-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 24px; }
.admin-intro h1 { margin: 2px 0 5px; font-size: 38px; letter-spacing: -1.4px; }
.admin-intro p { margin: 0; color: var(--muted); }
.login-card { width: min(460px, calc(100% - 32px)); margin: 70px auto; }
.login-card h1 { margin: 0 0 6px; }
.login-card > p { margin: 0 0 20px; color: var(--muted); }
.login-card label { display: block; margin-top: 13px; }
.login-card button { margin-top: 20px; }
.admin-actions { display: flex; gap: 9px; }
.secondary-button, .danger-button { min-height: 40px; border: 1px solid #cdd7d0; border-radius: 10px; padding: 8px 13px; background: #fff; font-weight: 700; }
.secondary-button:hover { border-color: var(--green); color: var(--green); }
.danger-button { color: var(--danger); border-color: #e8c7c7; }
.tabs { display: flex; gap: 7px; margin-bottom: 18px; }
.tab { border: 1px solid var(--line); border-radius: 99px; padding: 8px 14px; color: var(--muted); background: #fff; font-weight: 700; }
.tab.active { color: #fff; border-color: var(--green); background: var(--green); }
.admin-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 18px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #f7f9f7; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
td { font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.model-name { font-weight: 800; }
.model-maker, .model-specs { color: var(--muted); font-size: 11px; }
.status { display: inline-flex; border-radius: 99px; padding: 4px 8px; color: #1a6843; background: #e4f3e9; font-size: 10px; font-weight: 800; }
.status.off { color: #777; background: #ecefee; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.icon-button { border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: #fff; font-size: 12px; }
.icon-button.delete { color: var(--danger); }
.dialog { width: min(680px, calc(100% - 28px)); max-height: calc(100vh - 40px); overflow: auto; border: 0; border-radius: 20px; padding: 0; box-shadow: 0 28px 90px rgba(0,0,0,.25); }
.dialog::backdrop { background: rgba(10,24,16,.6); backdrop-filter: blur(3px); }
.dialog-form { padding: 25px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 18px; }
.dialog-head h2 { margin: 0; }
.dialog-close { border: 0; background: transparent; font-size: 25px; line-height: 1; }
.spec-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-top: 15px; }
.check-row { display: flex; align-items: center; gap: 9px; margin-top: 17px; }
.check-row input { width: 18px; height: 18px; margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.empty-row { padding: 32px; color: var(--muted); text-align: center; }

@media (max-width: 980px) {
  .calculator-layout { grid-template-columns: 1fr; }
  .results-column { position: static; }
  .results-card, .production-card { max-width: none; }
}
@media (max-width: 720px) {
  .shell { width: min(100% - 22px, 1180px); }
  .header-row { min-height: 62px; }
  .header-nav a:first-child, .header-nav a:last-child { display: none; }
  .hero { padding: 37px 0 24px; }
  .hero h1 { font-size: 37px; letter-spacing: -1.8px; }
  .hero > p:last-child { font-size: 15px; }
  .card { border-radius: 17px; padding: 19px; }
  .grid.two, .grid.three, .spec-fields { grid-template-columns: 1fr; }
  .angle-fields { gap: 12px; }
  .roof-preview { min-height: 240px; }
  .tooltip [role="tooltip"] { left: auto; right: -20px; transform: translateY(4px); }
  .tooltip:hover [role="tooltip"], .tooltip:focus [role="tooltip"] { transform: translateY(0); }
  .footer-row, .admin-intro { align-items: flex-start; flex-direction: column; justify-content: center; }
  .footer-row { padding: 18px 0; gap: 7px; }
  .admin-intro { gap: 17px; }
  .admin-actions { flex-wrap: wrap; }
  th:nth-child(3), td:nth-child(3) { display: none; }
  th, td { padding: 12px; }
}
