/* ==========================================================================
   Vytvoriť business plán (views/business-plan.js, docs/SPEC_V3.md §A1) — prefix .bp-
   Look „Nova 2“ of docs/design-v2 (white cards radius 14 px on the paper, hairline borders, green = farm / income,
   brown = costs); colours only through tokens (Nova 2 from v2.css, classic + dark from app.css / theme.css).
   Phone first: one column, nothing wider than the phone (no fixed widths, grids with minmax(0, 1fr) or
   min(100%, …)), ≥ 44 px targets on touch, 16 px+ inputs (17 px on touch – no iOS zoom).
   Also the „Vytvoriť business plán“ button in the Financie head (.fi-bp-link).
   ========================================================================== */

.bp { gap: 12px; }
.bp-ro {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-3, var(--grey-soft));
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.4;
}
.bp-ro[hidden], .bp-calc-error[hidden] { display: none; }
.bp-ro svg { flex: none; }

.bp-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 14px);
  background: var(--surface);
}
.bp-card[hidden] { display: none; }
.bp-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.bp-card-head { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bp-card-title { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.3; }
.bp-card-sub { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.4; }
.bp-card-sub[hidden] { display: none; }
.bp-hint { margin: 0; color: var(--text-2); font-size: 12.5px; line-height: 1.45; }
.bp-mini-label { color: var(--text-2); font-size: 13px; font-weight: 600; }
.bp-link {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  color: var(--link, var(--accent));
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
}
.bp-link:hover { text-decoration: underline; }

/* ---- The plan: cover preview, numbers, download ---- */
.bp-hero { gap: 14px; }
.bp-hero-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
/* the thumbnail is a picture of the PDF: paper white with the document's green and brown in every theme */
.bp-thumb {
  position: relative;
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 5px;
  width: 64px;
  height: 90px;
  padding: 16px 8px 8px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(27, 26, 23, 0.06), 0 4px 10px rgba(27, 26, 23, 0.06);
}
.bp-thumb-band { position: absolute; top: 0; left: 0; right: 0; height: 9px; background: #2f7d4a; }
.bp-thumb-line { display: block; height: 4px; border-radius: 2px; background: #d6d1c4; }
.bp-thumb-line.is-title { width: 80%; height: 6px; background: #235e38; }
.bp-thumb-line.is-short { width: 55%; }
.bp-thumb-chart { display: flex; align-items: flex-end; gap: 3px; height: 26px; margin-top: auto; }
.bp-thumb-chart span { flex: 1 1 0; border-radius: 1px 1px 0 0; background: #7fb896; }
.bp-thumb-chart span:nth-child(1) { height: 35%; }
.bp-thumb-chart span:nth-child(2) { height: 55%; background: #c49a6c; }
.bp-thumb-chart span:nth-child(3) { height: 70%; }
.bp-thumb-chart span:nth-child(4) { height: 100%; background: #2f7d4a; }
.bp-cover-text { display: flex; flex: 1 1 auto; flex-direction: column; gap: 2px; min-width: 0; }
.bp-cover-eyebrow { color: var(--green-text, var(--text-2)); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.bp-cover-farm { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; overflow-wrap: break-word; }
.bp-cover-amount { color: var(--text); font-size: 14px; line-height: 1.35; overflow-wrap: break-word; }
.bp-cover-date { color: var(--text-2); font-size: 12.5px; line-height: 1.35; }

.bp-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.bp-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding: 10px 10px 9px;
  border-radius: 12px;
  background: var(--surface-2, var(--grey-tint));
}
.bp-stat-value { font-size: 19px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bp-stat-label { color: var(--text-2); font-size: 12px; line-height: 1.3; }

.bp-pdf { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.bp-download {
  justify-content: center;
  width: 100%;
  min-height: 48px;
  font-size: 16px;
  font-weight: 700;
}
.bp-download svg { flex: none; }
.bp-dl-hint { margin: 0; color: var(--text-2); font-size: 12.5px; line-height: 1.4; text-align: center; }
.bp-dl-hint[hidden], .bp-progress[hidden], .bp-done[hidden], .bp-err[hidden] { display: none; }

.bp-progress { display: flex; flex-direction: column; gap: 6px; }
.bp-progress-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.bp-progress-label { flex: 1 1 auto; min-width: 0; line-height: 1.35; }
.bp-progress-pct { flex: none; color: var(--text-2); font-variant-numeric: tabular-nums; }
.bp-bar { height: 8px; overflow: hidden; border-radius: 999px; background: var(--surface-3, var(--grey-soft)); }
.bp-bar-fill { display: block; width: 0; height: 100%; border-radius: 999px; background: var(--green, var(--primary)); transition: width 0.25s ease; }
/* „Vytváram PDF…“: pdfmake lays the document out in one long synchronous step (≈ 0,8 s on a Mac, longer on a phone) –
   a stripe moved by a transform animation runs on the compositor and keeps moving while the main thread is busy */
.bp-bar[data-indeterminate] { position: relative; }
.bp-bar[data-indeterminate] .bp-bar-fill {
  width: 38% !important;
  transition: none;
  will-change: transform;
  animation: bp-indeterminate 1.15s ease-in-out infinite;
}
@keyframes bp-indeterminate {
  from { transform: translateX(-105%); }
  to { transform: translateX(270%); }
}
@media (prefers-reduced-motion: reduce) {
  .bp-bar[data-indeterminate] .bp-bar-fill { animation-duration: 2.6s; }
}
.bp-progress-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.bp-progress-note { color: var(--text-2); font-size: 12.5px; }

.bp-done {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: var(--green-tint, var(--surface-2));
}
.bp-done-text { display: flex; align-items: flex-start; gap: 8px; color: var(--green-text, var(--text)); }
.bp-done-text svg { flex: none; margin-top: 1px; }
.bp-done-lines { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bp-done-title { font-weight: 700; line-height: 1.35; }
.bp-done-file { color: var(--text-2); font-size: 12.5px; line-height: 1.35; overflow-wrap: anywhere; }
.bp-done-note { color: var(--warning-text); font-size: 12.5px; line-height: 1.4; }
.bp-done-note[hidden] { display: none; }
.bp-done-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bp-done-actions .btn { flex: 1 1 auto; justify-content: center; min-height: 44px; }
.bp-done-actions .btn[hidden] { display: none; }
.bp-err {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--critical-soft, var(--warning-soft));
  color: var(--critical-text);
  font-size: 13.5px;
  line-height: 1.45;
}
.bp-err svg { flex: none; margin-top: 1px; }

/* the outline (table of contents as in the PDF) */
.bp-toc { border-top: 1px solid var(--grid, var(--border)); }
.bp-toc-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.bp-toc-summary::-webkit-details-marker { display: none; }
.bp-toc-chev { flex: none; color: var(--text-2); transition: transform 0.15s ease; }
.bp-toc[open] .bp-toc-chev { transform: rotate(90deg); }
.bp-toc-list { display: flex; flex-direction: column; margin: 0 0 4px; padding: 0; list-style: none; }
.bp-toc-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--grid, var(--border));
  font-size: 14px;
  line-height: 1.35;
}
.bp-toc-item:last-child { border-bottom: 0; }
.bp-toc-item.is-sub { padding-left: 22px; color: var(--text-2); font-size: 13px; }
.bp-toc-num { flex: none; min-width: 22px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.bp-toc-title { flex: 1 1 auto; min-width: 0; }
.bp-toc-pages { flex: none; color: var(--text-2); font-size: 12.5px; white-space: nowrap; }

/* ---- Warnings ---- */
.bp-warn-card[data-tone="bad"] { border-left: 4px solid var(--critical, #b3292a); }
.bp-warn-card[data-tone="warn"] { border-left: 4px solid var(--warning, #d99a1e); }
.bp-warns { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.bp-warns[hidden], .bp-warn-ok[hidden] { display: none; }
.bp-warn { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--grid, var(--border)); }
.bp-warn:last-child { border-bottom: 0; padding-bottom: 2px; }
.bp-warn-dot { flex: none; width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--grey, var(--muted)); }
.bp-warn[data-level="bad"] .bp-warn-dot { background: var(--critical, #b3292a); }
.bp-warn[data-level="warn"] .bp-warn-dot { background: var(--warning, #d99a1e); }
.bp-warn-body { display: flex; flex: 1 1 auto; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; font-size: 14px; line-height: 1.45; }
.bp-warn-text { flex: 1 1 170px; min-width: 0; }
.bp-warn[data-level="info"] .bp-warn-text { color: var(--text-2); }
.bp-warn-act {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: flex-end;
  min-width: 44px;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--link, var(--accent));
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.bp-warn-act:hover { text-decoration: underline; }
.bp-warn-act[hidden] { display: none; }
.bp-warn-ok { margin: 0; color: var(--green-text, var(--text-2)); font-size: 14px; line-height: 1.45; }

/* ---- Forms (loan request, cover and contact) ---- */
.bp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 10px 12px; }
.bp-f { min-width: 0; margin: 0; }
.bp .field-label { font-size: 13.5px; }
.bp .input { min-height: 44px; font-size: 16px; }
.bp .bp-textarea { width: 100%; min-height: 128px; resize: vertical; line-height: 1.5; }
.bp .input[type="date"] { width: 100%; }
.bp-loan-pick { display: flex; flex-direction: column; gap: 6px; }
.bp-loan-pick[hidden] { display: none; }
.bp-loan-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bp-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  max-width: 100%;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}
.bp-chip.is-active { border-color: var(--green, var(--accent)); background: var(--green-soft, var(--accent-soft)); color: var(--green-text, var(--text)); }
.bp-chip:disabled { cursor: default; opacity: 0.75; }
.bp-chip-name { min-width: 0; overflow-wrap: anywhere; }
.bp-chip-amt { flex: none; color: var(--text-2); font-weight: 500; white-space: nowrap; }
.bp-loan-line { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2, var(--grey-tint)); font-size: 14px; line-height: 1.45; }
.bp-loan-line[hidden] { display: none; }
.bp-detail { display: flex; flex-direction: column; gap: 6px; }
.bp-seg { align-self: flex-start; max-width: 100%; }

/* ---- Chapters ---- */
.bp-all-on { flex: none; }
.bp-chapters, .bp-subs { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.bp-ch { display: flex; flex-direction: column; border-bottom: 1px solid var(--grid, var(--border)); }
.bp-ch:last-child { border-bottom: 0; }
.bp-switch {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 0;
}
.bp-switch .toggle-track { flex: none; margin-top: 1px; }
.bp-switch .toggle-input { top: 10px; }
.bp-switch-text { flex: 1 1 auto; min-width: 0; }
/* number | name, the tag on its own row under the name: a wrapped title never leaves the number alone on a line */
.bp-switch-title { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; column-gap: 0; row-gap: 3px; font-size: 15px; font-weight: 600; line-height: 1.35; }
.bp-switch-title > .bp-num { grid-column: 1; margin-right: 8px; } /* a hidden number leaves no gap */
.bp-switch-name { grid-column: 2; min-width: 0; }
.bp-switch-title > .bp-tag { grid-column: 2; justify-self: start; }
.bp-switch-desc { line-height: 1.4; }
.bp-num {
  flex: none;
  min-width: 20px;
  color: var(--green-text, var(--text-2));
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.bp-num[hidden], .bp-pages[hidden] { display: none; }
.bp-tag {
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-3, var(--grey-soft));
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
}
.bp-pages { flex: none; margin-top: 2px; color: var(--text-2); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bp-ch.is-off > .bp-switch .bp-switch-name, .bp-sub.is-off .bp-switch-name { color: var(--text-2); }
.bp-more {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  min-height: 40px;
  margin: -4px 0 6px 48px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.bp-more svg { flex: none; transition: transform 0.15s ease; }
.bp-more[aria-expanded="true"] svg { transform: rotate(180deg); }
.bp-subs { margin: 0 0 8px 22px; padding-left: 14px; border-left: 2px solid var(--grid, var(--border)); }
.bp-subs[hidden] { display: none; }
.bp-switch--sub { padding: 8px 0; }
.bp-switch--sub .bp-switch-title { font-size: 14px; }
.bp-switch--sub .bp-switch-desc { font-size: 12px; }

/* ---- Own texts ---- */
.bp-texts { display: flex; flex-direction: column; gap: 14px; }
.bp-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding-top: 12px; border-top: 1px solid var(--grid, var(--border)); }
.bp-text:first-child { padding-top: 0; border-top: 0; }
.bp-text-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; color: var(--text-2); font-size: 12.5px; line-height: 1.35; }
.bp-text-off { color: var(--warning-text); font-weight: 600; }
.bp-text-off[hidden] { display: none; }
.bp-text.is-off .bp-textarea { opacity: 0.7; }
.bp-text-field .field-label { font-size: 15px; font-weight: 700; color: var(--text); }
.bp-text-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.bp-suggest { flex: none; }
.bp-suggest[hidden] { display: none; }
.bp-suggest svg { flex: none; color: var(--green-text, currentColor); }
.bp-text-state { color: var(--text-2); font-size: 12.5px; line-height: 1.35; }
.bp-text[data-source="user"] .bp-text-state { color: var(--green-text, var(--text-2)); }

/* ---- Bottom ---- */
.bp-foot { gap: 10px; }
.bp-disclaimer { margin: 0; color: var(--text-2); font-size: 12.5px; line-height: 1.45; }

/* ---- Financie head: „Vytvoriť business plán“ ---- */
.fi > .v2-head .v2-head-row { flex-wrap: wrap; }
.fi-bp-link { white-space: normal; text-align: left; }
.fi-bp-link svg { flex: none; }

/* ---- Touch ---- */
@media (pointer: coarse) {
  .bp .input { min-height: 46px; font-size: 17px; }
  .bp .bp-textarea { font-size: 17px; }
  .bp .btn { min-height: 44px; }
  .bp-chip { min-height: 44px; }
  .bp-more { min-height: 44px; }
  .bp-warn-act { min-height: 44px; }
  .bp-link { min-height: 44px; }
  .bp-seg .segmented-item { min-height: 44px; height: auto; }
  .fi-bp-link { min-height: 44px; }
}

/* ---- Narrow phones ---- */
@media (max-width: 420px) {
  .bp-card { padding: 14px; }
  .bp-cover-farm { font-size: 18px; }
  .bp-stat { padding: 9px 8px 8px; }
  .bp-stat-value { font-size: 17px; }
  .bp-more { margin-left: 0; }
  .bp-subs { margin-left: 6px; padding-left: 10px; }
  .bp-card-top { flex-wrap: wrap; }
}
@media (max-width: 339px) {
  .bp-thumb { width: 52px; height: 74px; padding-top: 14px; }
  .bp-stat-value { font-size: 16px; }
  .bp-stat-label { font-size: 11.5px; }
  .bp-seg { align-self: stretch; }
  .bp-seg .segmented-item { flex: 1 1 0; justify-content: center; padding-inline: 6px; }
}

@media print {
  .bp-pdf, .bp-more, .bp-suggest, .bp-all-on { display: none !important; }
}

/* „Na čo je úver“: two lines that grow with the text (the drafted purpose is ~100 characters) */
.bp-purpose { min-height: 64px; resize: none; overflow: hidden; font-size: 16px; line-height: 1.4; }

/* tips on bank products – for the applicant only, not in the PDF */
.bp-hints { margin-top: 2px; border-radius: 12px; background: var(--surface-2, var(--grey-tint)); }
.bp-hints > summary { display: flex; align-items: center; min-height: 44px; padding: 0 12px; font-size: 14px; font-weight: 600; cursor: pointer; list-style: none; }
.bp-hints > summary::-webkit-details-marker { display: none; }
.bp-hints[hidden] { display: none; }
.bp-hints-list { margin: 0; padding: 0 14px 12px 30px; font-size: 13.5px; line-height: 1.45; }
.bp-hints-list li + li { margin-top: 4px; }
.bp-hints-note { margin: 0; padding: 0 14px 12px; color: var(--text-2); font-size: 12.5px; line-height: 1.4; }
