/* SunShineNRG admin UI — мінімалістичний стиль */
:root {
  --gold: #d4a435;
  --gold-light: #f3d77a;
  --navy: #0d2a4a;
  --navy-light: #1a4174;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e3e6eb;
  --text: #1c2a3a;
  --text-muted: #6b7785;
  --danger: #d83a3a;
  --success: #2e8b57;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(13, 42, 74, .08), 0 1px 2px rgba(13, 42, 74, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--gold); }

/* ======== Topbar ======== */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px;
  background: var(--navy);
  color: white;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 8px; color: white; font-weight: 600; }
.brand-icon { color: var(--gold); font-size: 24px; }
.brand-text { font-size: 18px; }

.topnav { display: flex; gap: 18px; flex: 1; }
.topnav a { color: rgba(255,255,255,.85); padding: 6px 0; }
.topnav a:hover { color: var(--gold); }

.userbox { display: flex; align-items: center; gap: 10px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; }
.username { font-size: 14px; }
.btn-logout {
  padding: 6px 14px; border-radius: var(--radius);
  background: rgba(255,255,255,.1); color: white;
  font-size: 13px;
}
.btn-logout:hover { background: rgba(255,255,255,.18); color: white; }

/* ======== Content ======== */
.content {
  max-width: 1100px; margin: 32px auto; padding: 0 24px;
}
h1 { font-size: 28px; color: var(--navy); margin: 0 0 8px; }
h2 { font-size: 20px; color: var(--navy); margin: 24px 0 12px; }
h3 { font-size: 17px; color: var(--navy); margin: 0 0 6px; }
.lead { font-size: 16px; color: var(--text-muted); margin: 0 0 24px; }

/* ======== Cards ======== */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card {
  display: block; padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 4px 12px rgba(212, 164, 53, .15);
  color: var(--text);
}
.card p { margin: 6px 0 0; color: var(--text-muted); font-size: 14px; }

/* ======== Forms ======== */
.form-row { margin-bottom: 16px; }
.form-row label {
  display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px;
}
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font: inherit; background: var(--surface);
  transition: border-color .15s;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 164, 53, .15);
}
.form-row .hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-row.error input { border-color: var(--danger); }
.form-row.error .hint { color: var(--danger); }

.btn {
  display: inline-block; padding: 10px 20px; border-radius: var(--radius);
  background: var(--navy); color: white; font-weight: 500;
  border: none; cursor: pointer; font: inherit;
}
.btn:hover { background: var(--navy-light); color: white; }
.btn.primary { background: var(--gold); color: var(--navy); }
.btn.primary:hover { background: var(--gold-light); color: var(--navy); }
.btn.secondary { background: var(--surface); color: var(--navy); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); }

/* ======== Login page ======== */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  padding: 24px;
}
.login-card {
  background: var(--surface);
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  width: 100%; max-width: 380px;
  text-align: center;
}
.login-brand { margin-bottom: 28px; }
.login-brand .brand-icon { font-size: 42px; }
.login-brand h1 { color: var(--navy); margin: 8px 0 4px; font-size: 24px; }
.login-brand .subtitle { color: var(--text-muted); margin: 0; font-size: 14px; }

.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; padding: 12px 20px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-weight: 500; transition: border-color .15s, box-shadow .15s;
}
.btn-google:hover {
  border-color: var(--gold); color: var(--text);
  box-shadow: 0 2px 8px rgba(212, 164, 53, .15);
}

.login-hint {
  font-size: 12px; color: var(--text-muted);
  margin-top: 24px; line-height: 1.6;
}

.login-form { text-align: left; }
.login-btn { width: 100%; margin-top: 8px; padding: 12px; font-size: 15px; }

.alert {
  background: #fdecec; color: var(--danger); border: 1px solid #f5b8b8;
  padding: 10px 14px; border-radius: var(--radius); font-size: 13px;
  margin-bottom: 16px;
}
.alert.warn {
  background: #fff7e0; color: #8a6500; border-color: #f5dc91;
}
.alert.warn a { color: #8a6500; text-decoration: underline; }

.actions { display: flex; gap: 8px; align-items: center; }
.inline-form { display: inline; margin: 0; }
.checkbox-row label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; font-weight: normal; }
.checkbox-row input[type=checkbox] { width: auto; }

/* ======== Diagnostics ======== */
.diagnostics {
  margin-top: 32px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.diagnostics summary { cursor: pointer; color: var(--text-muted); font-size: 13px; }
.diagnostics ul { margin: 12px 0 0; padding-left: 20px; font-size: 13px; }
.diagnostics code { background: var(--bg); padding: 2px 6px; border-radius: 3px; font-size: 12px; }

/* ======== Footer ======== */
.footer {
  text-align: center; padding: 24px;
  color: var(--text-muted); font-size: 13px;
}

/* ======== Page head ======== */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.page-head h1 { margin: 0; }
.muted { color: var(--text-muted); }
.muted a { color: var(--text-muted); }

/* ======== Search ======== */
.search { display: flex; gap: 8px; margin-bottom: 20px; }
.search input { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; }

/* ======== Table ======== */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th { text-align: left; padding: 10px 14px; background: var(--bg); color: var(--text-muted); font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover { background: var(--bg); }

/* ======== Empty ======== */
.empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty p { margin-bottom: 16px; }

/* ======== Form sections ======== */
.card-form { max-width: 720px; }
.form-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 16px; box-shadow: var(--shadow); }
.form-section h2 { margin-top: 0; font-size: 16px; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }

.hint.success { color: var(--success); }
.hint.warn { color: #b87b00; }

/* ======== Detail page ======== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }
.card-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card-block h2 { margin-top: 0; font-size: 16px; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.dl dt { color: var(--text-muted); font-weight: 500; }
.dl dd { margin: 0; }
.list { padding-left: 20px; margin: 0 0 16px; }
.list li { margin: 4px 0; font-size: 14px; }

/* ======== Audit form ======== */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 720px) { .grid-3 { grid-template-columns: 1fr; } }

.radio-group { display: flex; gap: 16px; padding: 8px 0; }
.radio-group label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: normal; font-size: 14px; }
.radio-group input[type=radio] { width: auto; }

.checkboxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.checkbox-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; font-size: 14px; transition: border-color .15s, background .15s;
}
.checkbox-card:hover { border-color: var(--gold); background: #fffbf0; }
.checkbox-card input[type=checkbox] { width: auto; }

input[type=range] { width: 100%; padding: 0; height: 28px; }

/* ======== PVGIS Preview ======== */
.pvgis-section { background: linear-gradient(135deg, #f7faff 0%, #fff 100%); }
.pvgis-result { margin-top: 16px; }
.pvgis-card { padding: 16px; border-radius: var(--radius); border: 1px solid var(--border); background: white; }
.pvgis-good { border-color: var(--success); background: #f4fcf6; }
.pvgis-ok { border-color: #f5dc91; background: #fff7e0; }
.pvgis-poor { border-color: var(--danger); background: #fdecec; }
.pvgis-headline { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.pvgis-icon { font-size: 28px; }
.pvgis-annual { font-size: 22px; font-weight: 600; color: var(--navy); }
.pvgis-perkw { color: var(--text-muted); font-size: 13px; }
.pvgis-stats { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; font-size: 14px; }
.pvgis-stats li { color: var(--text); }
.pvgis-msg { margin: 0; font-size: 14px; }
.pvgis-msg.good { color: var(--success); }
.pvgis-msg.ok { color: #8a6500; }
.pvgis-msg.poor { color: var(--danger); }

/* ======== Audit detail ======== */
.features-list { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.features-list li { padding: 4px 0; }

/* ======== Error page ======== */
.error-page { text-align: center; padding: 60px 20px; max-width: 600px; margin: 0 auto; }
.error-code { font-size: 80px; font-weight: 700; color: var(--gold); line-height: 1; margin-bottom: 16px; }
.error-detail { font-size: 16px; color: var(--text-muted); margin-bottom: 24px; }
.error-actions { display: flex; gap: 12px; justify-content: center; }

/* ======== Coords toolbar ======== */
.coords-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.coords-toolbar .hint { margin: 0; }
.leaflet-container { font: inherit; }

/* ======== Equipment picker ======== */
.equipment-form .form-section select option { padding: 4px 0; }
.sticky-summary { position: sticky; bottom: 12px; z-index: 5; background: linear-gradient(135deg, #fffbf0 0%, #fff 100%); border-color: var(--gold); }
.summary-grid { display: grid; gap: 6px; }
.summary-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; border-bottom: 1px dashed var(--border); }
.summary-row:last-child { border-bottom: none; }
.summary-row .summary-label { color: var(--text-muted); }
.summary-row strong { color: var(--text); }
.total-row { padding-top: 12px; border-top: 2px solid var(--gold); margin-top: 8px; }
.total-row .total-price { font-size: 22px; color: var(--navy); }
.total-row small { font-size: 12px; font-weight: normal; }
.snapshot-details { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.snapshot-details summary { cursor: pointer; color: var(--text-muted); font-size: 13px; }
.snapshot-list { font-size: 13px; padding-left: 18px; margin: 8px 0 0; }
.snapshot-list ul { padding-left: 14px; }
.checkbox-card span small { display: block; margin-top: 2px; font-size: 12px; }

/* ======== AI block ======== */
.ai-section { margin-bottom: 18px; padding: 16px; background: #fafbfd; border-left: 3px solid var(--gold); border-radius: 4px; }
.ai-section h3 { margin: 0 0 8px; font-size: 14px; color: var(--text-muted); font-weight: 600; }
.ai-text { white-space: pre-wrap; font-size: 14px; line-height: 1.65; color: var(--text); }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }
.htmx-request.htmx-indicator { display: inline; }

/* Table footer */
.table tfoot td { padding: 10px 14px; border-top: 2px solid var(--border); font-weight: 600; }

.alert.success-alert {
  background: #e8f5ee; color: var(--success); border-color: #b6dec5;
}

/* =====================================================================
   Hamburger / nav-toggle (desktop за замовчуванням — гамбургер схований,
   меню в одному ряду з брендом через display: contents)
   ===================================================================== */
.nav-toggle { display: contents; }
.nav-burger {
  display: none;
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.nav-burger::-webkit-details-marker { display: none; }
.nav-burger::marker { content: ''; }

.nav-panel {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
}
.nav-panel .topnav { flex: 1; }

/* =====================================================================
   Tablet (≤900px) — невелика стиснутість, але поки без гамбургера
   ===================================================================== */
@media (max-width: 900px) {
  .topbar { gap: 16px; padding: 10px 18px; }
  .nav-panel { gap: 16px; }
  .topnav { gap: 14px; }
  .content { padding: 0 18px; margin: 24px auto; }
}

/* =====================================================================
   Mobile (≤640px) — телефон і вузький планшет
   ===================================================================== */
@media (max-width: 640px) {

  /* ---------- Topbar + hamburger ---------- */
  .topbar {
    gap: 10px;
    padding: 10px 14px;
    flex-wrap: nowrap;
    position: relative;
  }
  .brand-text { font-size: 16px; }

  .nav-toggle {
    display: block;
    margin-left: auto;
    position: static;
  }
  .nav-burger {
    display: block;
    width: 30px;
    height: 24px;
    padding: 6px;
    box-sizing: content-box;
    border-radius: 6px;
  }
  .nav-burger:hover { background: rgba(255,255,255,.08); }
  .nav-burger > span {
    display: block;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: transform .2s, opacity .2s;
  }
  .nav-burger > span:nth-child(2) { margin: 7px 0; }
  .nav-toggle[open] .nav-burger > span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
  .nav-toggle[open] .nav-burger > span:nth-child(2) { opacity: 0; }
  .nav-toggle[open] .nav-burger > span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

  /* Dropdown панель */
  .nav-panel {
    display: none;
    position: absolute;
    top: 100%;
    right: 8px;
    left: 8px;
    margin-top: 6px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px;
    background: var(--navy);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(0,0,0,.35);
    z-index: 100;
  }
  .nav-toggle[open] .nav-panel { display: flex; }
  .nav-panel .topnav {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    flex: none;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,.12);
    margin-bottom: 6px;
  }
  .nav-panel .topnav a {
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 15px;
  }
  .nav-panel .topnav a:hover { background: rgba(255,255,255,.08); }
  .nav-panel .userbox {
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 6px 4px;
  }
  .nav-panel .username { flex: 1; min-width: 0; }
  .nav-panel .btn-logout { padding: 10px 16px; font-size: 14px; }

  /* ---------- Content / typography ---------- */
  .content { padding: 0 12px; margin: 18px auto; }
  h1 { font-size: 22px; }
  h2 { font-size: 18px; margin: 20px 0 10px; }
  h3 { font-size: 16px; }
  .lead { font-size: 14px; margin-bottom: 16px; }

  /* ---------- Page head: stack title + actions ---------- */
  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .page-head h1 { font-size: 22px; }
  .page-head .actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  .page-head .actions > a,
  .page-head .actions > .btn,
  .page-head .actions > form {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }
  .page-head .actions .inline-form .btn { width: 100%; }

  /* ---------- Buttons: touch-friendly ---------- */
  .btn {
    min-height: 44px;
    padding: 11px 16px;
    font-size: 15px;
    text-align: center;
  }
  .btn-logout { min-height: 40px; }

  /* ---------- Forms: anti-iOS-zoom + повна ширина ---------- */
  .form-row input,
  .form-row select,
  .form-row textarea,
  .search input,
  input[type=text],
  input[type=tel],
  input[type=email],
  input[type=password],
  input[type=number],
  input[type=date],
  input[type=search],
  select,
  textarea {
    font-size: 16px;
  }
  .form-section { padding: 16px; }
  .form-actions {
    flex-wrap: wrap;
    gap: 10px;
  }
  .form-actions .btn {
    flex: 1 1 100%;
  }
  .card-form { max-width: 100%; }

  /* radio / checkbox: ширші тапи */
  .radio-group { flex-direction: column; gap: 10px; }
  .radio-group label { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
  .checkboxes { grid-template-columns: 1fr; }
  .checkbox-card { padding: 12px 14px; min-height: 48px; }

  /* ---------- Search ---------- */
  .search { flex-direction: column; gap: 10px; }
  .search .btn { width: 100%; }

  /* ---------- Tables: горизонтальний скрол замість зрізання ---------- */
  .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    box-shadow: var(--shadow);
    border-radius: var(--radius);
  }
  .table thead, .table tbody, .table tfoot { display: table; width: 100%; }
  .table th, .table td { font-size: 13px; padding: 10px 10px; }
  /* у списку клієнтів адресу обрізати, щоб не розтягувала */
  .table td.muted { white-space: normal; max-width: 180px; }

  /* ---------- Definition lists: dt над dd ---------- */
  .dl {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }
  .dl dt { padding-top: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
  .dl dt:first-child { padding-top: 0; }
  .dl dd { padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
  .dl dd:last-of-type { border-bottom: none; }

  /* ---------- Grids ---------- */
  .grid-2, .grid-3 { grid-template-columns: 1fr; gap: 10px; }
  /* перебиваємо inline-style="grid-column: span 2" — щоб поля не лізли */
  .grid-3 > * { grid-column: auto !important; }

  /* ---------- Cards (dashboard) ---------- */
  .cards { grid-template-columns: 1fr; gap: 12px; }
  .card { padding: 16px; }

  /* ---------- Detail blocks ---------- */
  .card-block { padding: 16px; }
  .card-block h2 { font-size: 16px; }

  /* ---------- Coords toolbar / map ---------- */
  .coords-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .coords-toolbar .btn { width: 100%; }
  .coords-toolbar .hint { text-align: center; }
  #coords-map { height: 280px !important; }

  /* ---------- PVGIS preview ---------- */
  .pvgis-headline { flex-wrap: wrap; gap: 8px; }
  .pvgis-stats { grid-template-columns: 1fr; }

  /* ---------- Equipment picker ---------- */
  .sticky-summary { position: static; }
  .summary-row { flex-wrap: wrap; gap: 4px; }
  .total-row .total-price { font-size: 18px; }

  /* ---------- AI block ---------- */
  .ai-section { padding: 12px; }
  .ai-text { font-size: 14px; }

  /* ---------- Login ---------- */
  .login-page { padding: 16px; }
  .login-card { padding: 24px 20px; }

  /* ---------- Footer ---------- */
  .footer { padding: 16px 12px; font-size: 12px; }

  /* ---------- Diagnostics: щоб довгі коди не розпирали ---------- */
  .diagnostics code { word-break: break-all; }
  .dl dd { word-break: break-word; overflow-wrap: anywhere; }
}

/* ---------- Azimuth picker (Leaflet satellite) ---------- */
.azimuth-picker { margin-top: 8px; }
.azimuth-picker .azimuth-toggle {
  background: #f0f4ff; border: 1px solid #c4d0e8; border-radius: var(--radius);
  padding: 8px 14px; cursor: pointer; font-size: 14px;
}
.azimuth-picker .azimuth-toggle:hover { background: #e6edff; }
.azimuth-map-panel { display: none; margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: #fafbfc; }
.azimuth-map-panel.open { display: block; }
#azimuth-map { width: 100%; height: 320px; border-radius: 6px; }
.azimuth-controls { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.azimuth-controls button { font-size: 13px; padding: 6px 12px; }
.azimuth-controls button[disabled] { opacity: 0.4; cursor: not-allowed; }
.azimuth-controls button.recommended {
  background: #1a8c4a; color: white; border-color: #15723c;
  box-shadow: 0 0 0 2px rgba(26, 140, 74, 0.25);
}
.azimuth-controls button.recommended:hover { background: #15723c; }
.azimuth-hint { margin-top: 8px; font-size: 13px; color: #555; min-height: 20px; }
.azimuth-hint.ok { color: #1a8c4a; font-weight: 600; }
.azimuth-side-label {
  background: transparent !important; border: none !important; box-shadow: none !important;
  color: white; font-weight: 700; font-size: 12px; padding: 0 !important;
  text-shadow: 0 0 3px rgba(0,0,0,0.8);
}
.azimuth-side-label::before { display: none !important; }

/* ---------- PVGIS recommend block ---------- */
.pvgis-recommend {
  margin-top: 14px; padding: 12px; border-radius: var(--radius);
  background: #fff8e1; border: 1px solid #f0d878;
}
.pvgis-recommend h3 { margin: 0 0 6px 0; font-size: 14px; font-weight: 600; }
.pvgis-recommend p { margin: 4px 0; }

/* ---------- Roof pack summary (live preview на формі аудиту) ---------- */
.roof-pack-summary {
  padding: 8px 10px; border-radius: var(--radius);
  background: #f5f7fa; border: 1px solid #d8dde5;
  font-size: 13px; line-height: 1.4; min-height: 38px;
}
.roof-pack-summary.ok { background: #e8f5ec; border-color: #b6dbc2; color: #15723c; }
.roof-pack-summary.warn { background: #fdecec; border-color: #ebc6c6; color: #a13030; }

/* Hint у блоці панелей "Дах вміщує N штук" */
.roof-capacity-hint {
  background: #eef6ff; border: 1px solid #bcd6f2; border-radius: var(--radius);
  padding: 6px 10px; color: #1e4d80; margin-top: 4px;
}
.roof-capacity-hint .muted { color: #678; }

/* ---------- Адмін-звіт по маржі ---------- */
.margin-filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin: 14px 0 18px 0;
}
.margin-custom {
  display: inline-flex; gap: 6px; align-items: center;
  margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--border);
}
.margin-custom input[type="date"] {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius);
}

.margin-table-wrap { overflow-x: auto; }
.margin-table {
  width: 100%; border-collapse: collapse; margin-top: 12px;
  background: white; border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.margin-table th {
  background: #f5f7fa; padding: 10px 12px; text-align: left;
  font-size: 12px; text-transform: uppercase; color: #555;
  border-bottom: 2px solid var(--border);
}
.margin-table td {
  padding: 10px 12px; border-bottom: 1px solid #ececec;
}
.margin-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.margin-table tbody tr:hover { background: #fafbfc; }
.margin-table a { color: var(--accent); text-decoration: none; font-weight: 600; }
.margin-table a:hover { text-decoration: underline; }

.margin-row.good { background: linear-gradient(90deg, #f0fbf3 0%, transparent 60%); }
.margin-row.ok { background: linear-gradient(90deg, #fff8e6 0%, transparent 60%); }
.margin-row.poor { background: linear-gradient(90deg, #fdecec 0%, transparent 60%); }
.margin-row.unknown { background: linear-gradient(90deg, #f0f0f5 0%, transparent 60%); }

.margin-total td { background: #eef3f9; font-size: 14px; padding: 12px; }

.margin-chip {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.margin-chip.good { background: #d5f0dd; color: #15723c; }
.margin-chip.ok { background: #fdf0c6; color: #8a6300; }
.margin-chip.poor { background: #fbd5d5; color: #a13030; }

.margin-summary-box {
  margin-top: 20px; padding: 16px 18px; background: white;
  border: 1px solid var(--border); border-radius: var(--radius);
  max-width: 600px;
}
.margin-summary-line {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; gap: 16px;
}
.margin-summary-line.big {
  font-size: 16px; padding: 12px; margin: 8px -10px -8px -10px;
  border-radius: var(--radius); border: 1px solid transparent;
}
.margin-summary-line.big.good { border-color: #b6dbc2; }
.margin-summary-line.big.ok { border-color: #f0d878; }
.margin-summary-line.big.poor { border-color: #ebc6c6; }
.margin-summary-box hr {
  border: none; border-top: 1px dashed var(--border); margin: 8px 0;
}

/* ---------- Опитувальник побутових споживачів (ДБН) ---------- */
.checkbox-card.big {
  display: flex; align-items: center; padding: 12px 14px; gap: 10px;
  background: #fff8e1; border: 1px solid #f0d878; border-radius: var(--radius);
  font-weight: 500;
}
.appliances-table {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: white; overflow: hidden; margin: 12px 0;
}
.appliances-head {
  display: grid; grid-template-columns: minmax(0, 1fr) 80px 130px;
  gap: 8px; padding: 10px 14px;
  background: #f5f7fa; border-bottom: 2px solid var(--border);
  font-size: 12px; text-transform: uppercase; color: #555; font-weight: 600;
}
.appliances-head .ah-qty, .appliances-head .ah-pw { text-align: right; }
.appliances-cat {
  padding: 8px 14px; background: #fafbfc; color: #678;
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; border-bottom: 1px dashed #e0e3e8;
}
.appliance-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 80px 130px;
  gap: 8px; padding: 8px 14px; align-items: center;
  border-bottom: 1px solid #ececec;
  transition: background 0.15s;
}
.appliance-row:last-child { border-bottom: none; }
.appliance-row.is-on { background: #f0fbf3; }
.appliance-row .ar-toggle {
  display: flex; align-items: center; gap: 8px; cursor: pointer; min-width: 0;
}
.appliance-row .ar-icon { font-size: 18px; }
.appliance-row .ar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appliance-row input[type="number"] {
  text-align: right; padding: 6px 8px; font-variant-numeric: tabular-nums;
}
.appliance-row .appl-qty, .appliance-row .appl-kw {
  font-size: 13px;
}

@media (max-width: 700px) {
  .appliances-head { display: none; }
  .appliance-row {
    grid-template-columns: 1fr 70px 100px;
    gap: 6px; padding: 8px 10px;
  }
  .appliance-row .ar-label { font-size: 14px; }
  .appliance-row input[type="number"] { font-size: 13px; }
}

/* Підсумок розрахунку (на формі — JS, на audit_detail — server-side) */
.appliances-result, .load-block {
  margin-top: 14px; padding: 14px; border-radius: var(--radius);
  background: #f5f7fa; border: 1px solid var(--border);
}
.appliances-result.muted { color: #889; font-style: italic; }
.appliances-result .ar-grid, .load-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px;
}
.appliances-result .ar-grid > div, .load-grid > div {
  display: flex; flex-direction: column; gap: 2px; padding: 8px;
  background: white; border-radius: 6px; border: 1px solid #e8ebef;
}
.appliances-result .ar-grid > div span, .load-grid > div span { font-size: 11px; }
.appliances-result .ar-grid > div strong, .load-grid > div strong { font-size: 16px; }
.appliances-result .ar-grid > div strong.big, .load-grid > div strong.big {
  font-size: 20px; color: var(--accent);
}

.ar-rec, .inverter-rec, .rec-box {
  margin-top: 12px; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid; line-height: 1.5;
}
.ar-rec.rec-good, .inverter-rec.rec-good, .rec-box.rec-good {
  background: #e8f5ec; border-color: #b6dbc2; color: #15723c;
}
.ar-rec.rec-ok, .inverter-rec.rec-ok, .rec-box.rec-ok {
  background: #fff8e1; border-color: #f0d878; color: #8a6300;
}
.ar-rec.rec-tight, .inverter-rec.rec-tight, .rec-box.rec-tight {
  background: #fdecec; border-color: #ebc6c6; color: #a13030;
}
.inverter-rec .ir-head { font-size: 16px; margin-bottom: 6px; }
.rec-box { margin-bottom: 12px; }

.load-details { margin-top: 12px; }
.load-details summary { cursor: pointer; padding: 6px 0; }
.load-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.load-table th { background: #f5f7fa; padding: 8px; text-align: left; font-size: 12px; text-transform: uppercase; }
.load-table td { padding: 6px 8px; border-bottom: 1px solid #ececec; }
.load-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Audit detail v2 (стримана палітра) ---------- */
.kpi-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-bottom: 18px;
}
.kpi-tile {
  background: white; border: 1px solid var(--border); border-left: 4px solid #c4c9d2;
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.kpi-tile .kpi-icon { font-size: 18px; opacity: 0.6; }
.kpi-tile .kpi-label { font-size: 11px; color: #678; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-tile .kpi-value {
  font-size: 22px; font-weight: 600; color: #222;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.kpi-tile .kpi-value.muted { color: #aab; font-weight: 400; }
.kpi-tile .kpi-sub { font-size: 12px; color: #678; }
.kpi-tile.kpi-empty { background: #fafbfc; border-left-color: #d8dde5; }
.kpi-tile.kpi-quality-good { border-left-color: #1a8c4a; }
.kpi-tile.kpi-quality-ok { border-left-color: #d4a72c; }
.kpi-tile.kpi-quality-poor { border-left-color: #c14040; }
.kpi-tile.kpi-quality-tight { border-left-color: #d4a72c; }

@media (max-width: 900px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .kpi-tile { padding: 12px 14px; }
  .kpi-tile .kpi-value { font-size: 20px; }
}
@media (max-width: 480px) {
  .kpi-tile { padding: 10px 12px; }
  .kpi-tile .kpi-value { font-size: 18px; }
}

/* Compact dl */
.dl-tight { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; margin: 0; }
.dl-tight dt { color: #678; font-size: 13px; padding-top: 2px; }
.dl-tight dd { margin: 0; font-size: 14px; padding: 2px 0; }
hr.thin { border: none; border-top: 1px solid #eef0f3; margin: 14px 0 10px; }

/* Quality summary всередині блоку Дах */
.quality-summary { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; }
.quality-summary .qs-line { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.quality-summary .qs-line strong { font-variant-numeric: tabular-nums; }
.quality-summary .qs-verdict { margin: 8px 0 0 0; font-size: 13px; }
.quality-summary.quality-good .qs-verdict { color: #15723c; }
.quality-summary.quality-ok .qs-verdict { color: #8a6300; }
.quality-summary.quality-poor .qs-verdict { color: #a13030; }

.muted-strong { color: #555; font-size: 13px; margin: 4px 0; }

/* Mini-таблиця приладів — 2 колонки */
.appliances-mini {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 10px;
}
.appliances-mini-table { width: 100%; border-collapse: collapse; }
.appliances-mini-table th {
  background: #f5f7fa; padding: 6px 10px; text-align: left;
  font-size: 11px; text-transform: uppercase; color: #678;
  border-bottom: 1px solid var(--border);
}
.appliances-mini-table td {
  padding: 6px 10px; border-bottom: 1px solid #f0f2f5; font-size: 13px;
}
.appliances-mini-table .num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) {
  .appliances-mini { grid-template-columns: 1fr; gap: 12px; }
}

/* Compact card */
.card-block.compact { padding: 12px 16px; }
.card-block.compact h3 { margin: 0 0 6px 0; font-size: 15px; font-weight: 600; }

/* Chips for legacy features */
.legacy-features { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  display: inline-block; padding: 4px 10px; background: #f0f4fa;
  border: 1px solid #c4d0e8; border-radius: 999px; font-size: 13px;
}

/* Next step block — мінімалістичний */
.card-block.next-step {
  text-align: center; padding: 14px;
}
.card-block.next-step .btn { padding: 10px 18px; }

/* ---------- Collapsible form sections ---------- */
.form-section.collapsible { padding: 0; }
.form-section.collapsible > summary {
  list-style: none; cursor: pointer; padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  background: white; border-radius: var(--radius);
  user-select: none;
}
.form-section.collapsible > summary::-webkit-details-marker { display: none; }
.form-section.collapsible > summary::after {
  content: "▼"; color: #889; font-size: 12px; transition: transform 0.15s;
}
.form-section.collapsible[open] > summary::after { transform: rotate(180deg); }
.form-section.collapsible > summary h2 { margin: 0; font-size: 18px; }
.form-section.collapsible > summary:hover { background: #fafbfc; }
.form-section.collapsible[open] > summary {
  border-bottom: 1px solid #ececec;
  position: sticky; top: 0; z-index: 10;
  background: white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.form-section.collapsible[open] > summary::after { content: "▲"; }
.form-section .cs-body { padding: 16px 20px 20px; }
.section-collapse-bottom {
  margin-top: 16px; font-size: 13px; padding: 6px 14px;
}
.section-pair {
  display: grid; grid-template-columns: 1fr 16px 1fr; gap: 6px; align-items: center;
}
.section-pair > span { text-align: center; color: #889; font-weight: 600; }
@media (max-width: 600px) {
  .form-section .cs-body { padding: 12px 14px 16px; }
  .form-section.collapsible > summary { padding: 12px 14px; }
}

h3.sub-h { margin: 4px 0 10px; font-size: 14px; font-weight: 600; color: #555; text-transform: uppercase; letter-spacing: 0.5px; }

/* ---------- Planned loads grid ---------- */
.planned-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px; margin-top: 8px;
}

/* ---------- Recommendation templates (chip buttons) ---------- */
.rec-templates {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
  padding-top: 10px; border-top: 1px dashed var(--border);
  align-items: center;
}
.chip-btn {
  background: #f0f4fa; border: 1px solid #c4d0e8; border-radius: 999px;
  padding: 4px 10px; font-size: 12px; cursor: pointer; color: #1e4d80;
}
.chip-btn:hover { background: #e2eaf6; }

/* ---------- Autosave status ---------- */
.autosave-status {
  font-size: 12px; padding: 6px 10px; margin-bottom: 8px;
  border-radius: 4px; background: #f5f7fa; display: inline-block;
}
.autosave-status.saving { color: #678; }
.autosave-status.saved { color: #15723c; background: #e8f5ec; }
.autosave-status.error { color: #a13030; background: #fdecec; }

/* ---------- Photos grid (form + detail) ---------- */
.photo-cats { display: flex; flex-direction: column; gap: 14px; }
.photo-cat {
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: #fafbfc;
}
.photo-cat-head { margin-bottom: 8px; display: flex; flex-direction: column; gap: 2px; }
.photo-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.photo-item {
  position: relative; width: 110px; height: 110px;
  border-radius: 6px; overflow: hidden; border: 1px solid var(--border);
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del {
  position: absolute; top: 2px; right: 2px;
  background: rgba(0,0,0,0.7); color: white; border: none;
  width: 22px; height: 22px; border-radius: 50%; font-size: 14px; cursor: pointer; line-height: 1;
}
.photo-upload input[type="file"] { display: none; }
.photo-upload .btn { font-size: 13px; padding: 6px 12px; }
.photo-status { font-size: 11px; margin-top: 4px; min-height: 14px; }
.photo-status.saved { color: #15723c; }
.photo-status.error { color: #a13030; }

.photos-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px; margin-top: 10px;
}
.photo-thumb {
  display: block; position: relative; aspect-ratio: 4/3;
  border-radius: 6px; overflow: hidden; border: 1px solid var(--border);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-cat-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.6); color: white;
  padding: 3px 8px; font-size: 11px; text-align: center;
}

/* ---------- Top-3 пікові ---------- */
.top3-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.top3-item {
  display: grid; grid-template-columns: 24px 1fr auto;
  gap: 10px; align-items: center; padding: 6px 10px;
  background: #fafbfc; border-radius: 4px;
}
.top3-icon { font-size: 18px; }
.top3-value { font-weight: 600; font-variant-numeric: tabular-nums; color: #c14040; }

/* ---------- Інфраструктура — компактна стрічка ---------- */
.infra-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; margin-top: 8px;
}
.infra-row > div {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 12px;
  background: #fafbfc; border-radius: 6px; border: 1px solid #e8ebef;
}
.infra-row > div span { font-size: 11px; color: #678; text-transform: uppercase; letter-spacing: 0.4px; }
.infra-row > div strong { font-size: 14px; font-variant-numeric: tabular-nums; }

/* ---------- Mini-note (Стан крокв тощо) ---------- */
.mini-note {
  margin-top: 10px; padding: 8px 12px; border-radius: 6px;
  background: #fafbfc; border-left: 3px solid #d8dde5;
  font-size: 13px; line-height: 1.5;
  white-space: pre-wrap;
}

/* ====================================================== */
/*  Audit detail v3 — виразний layout з кольоровими картками */
/* ====================================================== */

/* HERO */
.audit-hero {
  display: flex; gap: 16px; align-items: flex-end; justify-content: space-between;
  margin: 0 0 18px; flex-wrap: wrap;
}
.audit-hero .ah-tag {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: #888; font-weight: 600; margin-bottom: 4px;
}
.audit-hero .ah-title {
  font-size: 26px; font-weight: 700; margin: 0 0 6px; color: #1c1f24; line-height: 1.1;
}
.audit-hero .ah-meta {
  display: flex; gap: 8px; flex-wrap: wrap; color: #678; font-size: 13px;
}
.audit-hero .ah-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-icon-danger {
  background: transparent; border: 1px solid #ebc6c6; color: #a13030;
  padding: 8px 12px; border-radius: var(--radius); cursor: pointer; font-size: 16px;
}
.btn-icon-danger:hover { background: #fdecec; }

@media (max-width: 600px) {
  .audit-hero .ah-title { font-size: 20px; }
  .audit-hero .ah-actions { width: 100%; }
}

/* Info-card з кольоровою рискою */
.info-card {
  background: white; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 14px; position: relative;
  border-left: 4px solid #d8dde5;
}
.info-card.compact { padding: 14px 18px; }
.info-card > header {
  display: flex; align-items: center; gap: 10px; margin: 0 0 12px;
}
.info-card > header h2 { margin: 0; font-size: 17px; font-weight: 600; color: #2a2d33; }
.info-card > header .ic-icon { font-size: 22px; line-height: 1; }

.info-card.accent-roof       { border-left-color: #6b8e3f; }
.info-card.accent-electric   { border-left-color: #d49923; }
.info-card.accent-infra      { border-left-color: #678; }
.info-card.accent-load       { border-left-color: #c14040; }
.info-card.accent-sun        { border-left-color: #e07b00; }
.info-card.accent-photo      { border-left-color: #4a72b0; }
.info-card.accent-conclusion { border-left-color: #5e3a8e; }

.audit-cards { gap: 14px; }

@media (max-width: 600px) {
  .info-card { padding: 14px 16px; }
  .info-card.compact { padding: 12px 14px; }
  .info-card > header h2 { font-size: 15px; }
}

/* Підсекція картки */
.card-section {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px dashed #e6e8ec;
}
.cs-tag {
  display: inline-block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px;
  font-weight: 700; color: #889; margin-bottom: 8px;
}
.warn-mark { color: #c14040; font-size: 14px; }

/* Завантаження-стрічка */
.load-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px; margin-top: 4px;
}
.load-strip > div {
  padding: 10px 12px; background: #fafbfc; border-radius: 8px;
  border: 1px solid #eef0f3;
  display: flex; flex-direction: column; gap: 2px;
}
.load-strip > div span { font-size: 11px; color: #889; text-transform: uppercase; letter-spacing: 0.4px; }
.load-strip > div strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.load-strip > div.primary { background: #fff5e0; border-color: #f0d878; }
.load-strip > div.primary strong { font-size: 22px; color: #8a6300; }

/* Сонячний грід */
.sun-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}
.sun-grid > div {
  padding: 10px 12px; background: #fafbfc; border-radius: 8px;
  border: 1px solid #eef0f3;
  display: flex; flex-direction: column; gap: 2px;
}
.sun-grid > div span { font-size: 11px; color: #889; text-transform: uppercase; letter-spacing: 0.4px; }
.sun-grid > div strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.sun-grid > div.primary { background: #fff5e0; border-color: #f0d878; }
.sun-grid > div.primary.verdict-good { background: #e8f5ec; border-color: #b6dbc2; color: #15723c; }
.sun-grid > div.primary.verdict-ok { background: #fff8e1; border-color: #f0d878; color: #8a6300; }
.sun-grid > div.primary.verdict-poor { background: #fdecec; border-color: #ebc6c6; color: #a13030; }

/* Банер рекомендації */
.rec-banner {
  display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start;
  margin-top: 14px; padding: 14px 16px; border-radius: 8px;
  border-left: 4px solid;
}
.rec-banner.rec-good  { background: #f0fbf3; border-color: #1a8c4a; color: #15723c; }
.rec-banner.rec-ok    { background: #fff8e1; border-color: #d4a72c; color: #8a6300; }
.rec-banner.rec-tight { background: #fdecec; border-color: #c14040; color: #a13030; }
.rec-banner .rec-icon { font-size: 22px; }
.rec-banner strong { font-size: 16px; display: block; margin-bottom: 4px; color: inherit; }
.rec-banner p, .rec-banner div { margin: 0; font-size: 13px; line-height: 1.45; }
.rec-banner .warn-line { margin-top: 6px; font-size: 12px; opacity: 0.9; }

/* Деталі споживачів — collapsible */
.appliances-details { margin-top: 14px; }
.appliances-details > summary {
  cursor: pointer; padding: 8px 12px; background: #f5f7fa;
  border-radius: 6px; font-size: 13px; color: #678;
  list-style: none;
}
.appliances-details > summary::-webkit-details-marker { display: none; }
.appliances-details > summary::before { content: "▸ "; }
.appliances-details[open] > summary::before { content: "▾ "; }
.appliances-details[open] > summary { background: #eef2f7; }

/* Текст висновку */
.rec-text { padding: 8px 0; }
.rec-text strong { font-size: 13px; color: #555; }
.rec-text p { margin: 6px 0 0; white-space: pre-wrap; line-height: 1.55; }
.rec-text.muted-block { margin-top: 14px; padding-top: 14px; border-top: 1px dashed #e6e8ec; }
.rec-text.muted-block p { color: #555; font-size: 14px; }

/* Big primary CTA внизу */
.next-step { text-align: center; margin: 20px 0 30px; }
.btn.big { padding: 12px 24px; font-size: 16px; }

/* ---------- Місячний барчарт (PVGIS генерація vs споживання) ---------- */
.monthly-chart { margin-top: 16px; }
.monthly-chart .mc-legend { display: flex; gap: 14px; font-size: 11px; color: #678; margin-bottom: 8px; }
.monthly-chart .mc-leg.gen { color: #d49923; }
.monthly-chart .mc-leg.con { color: #4a72b0; }

.mc-bars {
  display: grid; grid-template-columns: repeat(12, 1fr);
  gap: 4px; align-items: end; padding-top: 4px;
}
.mc-month {
  display: flex; flex-direction: column; align-items: center;
  gap: 2px; min-width: 0;
}
.mc-bar-pair {
  height: 100px; width: 100%;
  display: flex; align-items: end; justify-content: center; gap: 2px;
  background: linear-gradient(to top, #f5f7fa 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
}
.mc-bar { width: 8px; border-radius: 2px 2px 0 0; transition: all 0.3s; }
.mc-bar.gen { background: #f0a830; }
.mc-bar.con { background: #4a72b0; opacity: 0.85; }
.mc-month .mc-label { font-size: 10px; color: #678; text-transform: uppercase; }
.mc-month .mc-val { font-size: 10px; color: #555; font-variant-numeric: tabular-nums; }
.mc-month.best .mc-bar.gen { background: #15723c; }
.mc-month.best .mc-label { color: #15723c; font-weight: 700; }
.mc-month.worst .mc-bar.gen { background: #c14040; }
.mc-month.worst .mc-label { color: #c14040; font-weight: 700; }
@media (max-width: 600px) {
  .mc-bars { gap: 2px; }
  .mc-bar { width: 5px; }
  .mc-bar-pair { height: 80px; }
  .mc-month .mc-label, .mc-month .mc-val { font-size: 8px; }
}

/* ---------- Економіка зеленого тарифу ---------- */
.green-econ { margin-top: 18px; padding: 14px; background: #f0fbf3; border: 1px solid #b6dbc2; border-radius: var(--radius); }
.green-econ h3 { margin: 0 0 10px; color: #15723c; }
.green-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.g-cell {
  background: white; border-radius: 8px; padding: 10px 12px;
  border-left: 3px solid #b6dbc2;
  display: flex; flex-direction: column; gap: 2px;
}
.g-cell span { font-size: 11px; color: #678; text-transform: uppercase; letter-spacing: 0.4px; }
.g-cell strong { font-size: 18px; color: #15723c; font-variant-numeric: tabular-nums; }
.g-cell small { font-size: 11px; color: #889; }
.g-cell.total { background: #15723c; border-left-color: #15723c; }
.g-cell.total span, .g-cell.total small { color: #c8e8d3; }
.g-cell.total strong { color: white; font-size: 22px; }

/* ---------- Sticky save-bar для довгої форми аудиту ---------- */
.form-actions.sticky-actions {
  position: sticky; bottom: 0; z-index: 50;
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 12px 18px;
  background: white;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 -6px 16px rgba(0,0,0,0.06);
  margin: 18px 0 0;
}
.form-actions.sticky-actions .btn.big {
  min-width: 200px;
  font-weight: 600;
}
.form-actions.sticky-actions .btn[disabled] {
  opacity: 0.6; cursor: progress;
}
@media (max-width: 600px) {
  .form-actions.sticky-actions {
    padding: 10px 12px;
    flex-direction: row-reverse;   /* основна кнопка ліворуч на телефоні? Ні, краще завжди справа — але reverse тільки змінить порядок */
  }
  .form-actions.sticky-actions .btn.big { flex: 1; min-width: 0; padding: 12px 14px; }
  .form-actions.sticky-actions .btn.secondary { flex: 0 0 auto; }
}

/* ---------- Дрібні правки для grid-2 на телефоні ---------- */
@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .card-block { padding: 14px; }
  .card-block h2 { font-size: 16px; }
  .dl-tight { grid-template-columns: 110px 1fr; }
}
@media (max-width: 480px) {
  .dl-tight { grid-template-columns: 100px 1fr; gap: 4px 8px; }
  .dl-tight dt, .dl-tight dd { font-size: 13px; }
  .kpi-tile .kpi-value { font-size: 17px; }
  .photos-grid { grid-template-columns: repeat(2, 1fr); }
}
