/* Dotácie — editor section (views/editor/subsidies.js). Prefix .sub-. Mobile first (360 px):
   cards instead of tables, one column, long texts folded, numbers prominent. Colours only via tokens. */

.sub { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sub-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sub-panel[hidden], .sub [hidden] { display: none !important; }
.sub-calc-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---- tabs: three equal pills that may wrap to two lines on a phone ---- */
.sub-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: visible; }
.sub-tabs .tab { height: auto; min-height: 44px; padding: 6px 8px; justify-content: center; text-align: center; white-space: normal; line-height: 1.25; border-radius: var(--radius); font-size: 13.5px; font-weight: 600; }
.sub-tabs .tab .tab-label { min-width: 0; overflow-wrap: anywhere; }
.sub-tabs .tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }

/* ---- on / off ---- */
.sub-switch-body { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-width: 0; }
.sub-switch-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: var(--radius); background: var(--brand-soft); color: var(--brand-strong); }
.sub-switch .toggle { flex: 1 1 auto; min-width: 0; }
.sub-switch .toggle-label { font-weight: 600; }
.sub--off .sub-tiles .kpi-value { color: var(--text-2); }

/* ---- profile ---- */
.sub-profile-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sub-toggles { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sub-toggles .toggle { min-height: 40px; }
.sub-toggles .toggle-label { font-weight: 600; }
.sub-toggles .field { padding-left: 46px; }
.sub-profile-grid { padding-top: 14px; border-top: 1px solid var(--border); }

/* ---- generic text bits ---- */
.sub-h3 { margin: 0; font-size: 16px; font-weight: 650; }
.sub-h4 { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; font-weight: 650; }
.sub-h4 .icon { color: var(--muted); }
.sub-h5 { margin: 10px 0 4px; font-size: 12.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-2); }
.sub-note { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.sub-faint { color: var(--muted); }
.sub-block-head { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; min-width: 0; }
.sub-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.sub-list li { overflow-wrap: anywhere; }
.sub-sources { font-size: 13px; }
.sub-ext { overflow-wrap: anywhere; }
.sub-link { display: inline-flex; align-items: center; gap: 2px; min-height: 40px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.sub-asof { margin: 8px 0 0; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
.sub-asof strong { color: var(--text); }

/* ---- base: "Z čoho počítame" ---- */
.sub-base-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 20px 28px; }
.sub-base-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sub-base-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.sub-base-summary { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sub-big { font-size: 14px; color: var(--text-2); }
.sub-big strong { font-size: 20px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.sub-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sub-chip { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; color: var(--text-2); background: var(--surface-2); overflow-wrap: anywhere; }
.sub-chip--muted { color: var(--muted); background: transparent; }
.sub-chip--accent { color: var(--link); background: var(--accent-soft); border-color: transparent; }
.sub-rows { display: flex; flex-direction: column; min-width: 0; }
.sub-rows:empty { display: none; }
.sub-row { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-top: 1px solid var(--border); min-width: 0; }
.sub-row-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sub-row-name { font-weight: 600; overflow-wrap: anywhere; }
.sub-row-meta { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sub-row-control { min-width: 0; }
.sub-row-control .input { width: 100%; min-width: 0; }
.sub-stocking { margin: 0; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); font-size: 13px; line-height: 1.5; color: var(--text-2); }

/* ---- scheme groups and cards ---- */
.sub-group { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sub-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-top: 4px; }
.sub-group-total { font-size: 13px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sub-group-more { align-self: flex-start; white-space: normal; height: auto; min-height: 40px; text-align: left; }
.sub-sch-list { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sub-sch { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.sub-sch--na { display: none; }
.sub-group--all .sub-sch--na { display: block; }
.sub-sch--counted { border-left: 3px solid var(--brand); }
.sub-sch-summary { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 12px 10px 14px; cursor: pointer; list-style: none; }
.sub-sch-summary::-webkit-details-marker { display: none; }
.sub-sch-title { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; flex: 1 1 auto; min-width: 0; }
.sub-sch-name { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.sub-sch-sum { display: flex; flex-direction: column; align-items: flex-end; flex: none; text-align: right; }
.sub-sch-amount { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sub-sch-amount.is-muted { font-weight: 600; color: var(--text-2); }
.sub-sch-amount-sub { font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.sub-sch-caret { flex: none; color: var(--muted); transition: transform 0.15s ease; }
.sub-sch[open] > .sub-sch-summary .sub-sch-caret { transform: rotate(180deg); }
.sub-sch-body { display: flex; flex-direction: column; gap: 12px; padding: 4px 14px 14px; border-top: 1px solid var(--border); min-width: 0; }
.sub-sch-body > :first-child { margin-top: 10px; }
.sub-kv { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sub-kv-label { font-size: 13px; color: var(--text-2); }
.sub-kv-value { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.sub-sch-rate-block { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sub-sch-rate .input-affix, .sub-sch-qty .input-affix { max-width: 220px; }
.sub-sch-source { font-size: 12.5px; line-height: 1.45; color: var(--text-2); overflow-wrap: anywhere; }
.sub-sch-source strong { color: var(--text); }
.sub-sch-reset { align-self: flex-start; }
.sub-sch-note { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
.sub-sch-note--warn { display: flex; gap: 6px; align-items: flex-start; color: var(--warning-text); }
.sub-sch-note--warn .icon { flex: none; margin-top: 2px; }
.sub-mode-block { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sub-mode-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.sub-mode { display: flex; width: 100%; max-width: 420px; }
.sub-mode .segmented-item { flex: 1 1 0; justify-content: center; min-width: 0; padding: 0 6px; }
.sub-mode-hint { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.sub-sch-reason { display: flex; gap: 6px; align-items: flex-start; margin: 0; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); font-size: 13px; line-height: 1.45; color: var(--text-2); }
.sub-sch-reason .icon { flex: none; margin-top: 2px; color: var(--muted); }
.sub-sch-scenario { margin: 0; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---- folded texts ---- */
.sub-details { min-width: 0; }
.sub-details > summary { display: flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; list-style: none; font-size: 13.5px; font-weight: 600; color: var(--link); }
.sub-details > summary::-webkit-details-marker { display: none; }
.sub-details > summary::after { content: ''; flex: none; width: 7px; height: 7px; margin-left: auto; margin-right: 4px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform 0.15s ease; }
.sub-details[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
.sub-details-body { display: flex; flex-direction: column; gap: 8px; padding: 2px 0 6px; font-size: 13.5px; line-height: 1.55; color: var(--text-2); min-width: 0; }
.sub-details-body p { margin: 0; overflow-wrap: anywhere; }
.sub-details-body strong { color: var(--text); font-weight: 650; }
.sub-official { font-size: 12.5px; }

/* ---- charts ---- */
.sub-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; min-width: 0; }
.sub-charts > * { min-width: 0; }

/* ---- investment grants ---- */
.sub-grants-summary { margin: 0; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sub-grant-list { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.sub-grant-list:empty { display: none; }
.sub-grant-add { align-self: flex-start; }
.sub-grant { display: flex; flex-direction: column; gap: 14px; padding: 14px; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.sub-grant--on { border-left: 3px solid var(--brand); }
.sub-grant-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sub-grant-name { flex: 1 1 auto; min-width: 0; font-weight: 600; }
.sub-grant-remove { flex: none; }
.sub-grant-call { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.sub-grant-items { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sub-items { display: flex; flex-direction: column; min-width: 0; }
.sub-item { display: flex; align-items: center; min-height: 40px; padding: 4px 0; min-width: 0; }
.sub-item .checkbox-text { min-width: 0; }
.sub-item .checkbox-label { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.sub-grant-result { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); }
.sub-grant-amount { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sub-grant-formula { flex: 1 1 100%; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sub-grant-include .toggle { min-height: 40px; }
.sub-grant-include .toggle-label { font-weight: 600; }
.sub-grant-effect { margin: 0; padding: 10px 12px; border-left: 3px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; background: var(--accent-soft); font-size: 13px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.sub-cat-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; min-width: 0; }
.sub-cat { display: flex; flex-direction: column; gap: 8px; padding: 14px; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.sub-cat-name { margin: 0; font-size: 14.5px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.sub-cat-desc { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-2); overflow-wrap: anywhere; }
.sub-cat-desc strong { color: var(--text); font-weight: 650; }
.sub-cat-add { align-self: flex-start; margin-top: auto; }
.sub-badges { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- guide ---- */
.sub-guide-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.sub-progress-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.sub-progress { flex: 1 1 160px; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.sub-progress-fill { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--brand); transition: width 0.2s ease; }
.sub-progress-text { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sub-chapters { display: flex; flex-direction: column; min-width: 0; }
.sub-chapter { border-top: 1px solid var(--border); }
.sub-chapter > summary { min-height: 48px; color: var(--text); font-size: 14.5px; }
.sub-ch-title { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.sub-ch-count { flex: none; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sub-ch-count.is-done { background: var(--good-soft); color: var(--good-text); }
.sub-chapter > summary::after { margin-left: 0; }
.sub-ch-intro { color: var(--text-2); }
.sub-step { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-top: 1px dashed var(--border); min-width: 0; }
.sub-step-check { min-height: 40px; align-items: center; }
.sub-step-check .checkbox-label { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.sub-step-body { display: flex; flex-direction: column; gap: 6px; padding-left: 28px; min-width: 0; }
.sub-tips { list-style: none; padding-left: 0; }
.sub-tips li { padding: 6px 10px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--text); font-size: 13px; }

.sub-cal { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sub-cal-list { display: flex; flex-direction: column; min-width: 0; }
.sub-cal-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); min-width: 0; }
.sub-cal-row:first-child { border-top: 0; padding-top: 0; }
.sub-cal-pick { flex: none; min-width: 40px; min-height: 40px; align-items: center; justify-content: center; margin-left: -8px; }
.sub-cal-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.sub-cal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.sub-cal-date { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sub-cal-title { font-weight: 600; overflow-wrap: anywhere; }
.sub-cal-desc { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-2); overflow-wrap: anywhere; }
.sub-cal-actions { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); min-width: 0; }
.sub-cal-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sub-cal-controls .input { flex: 0 1 200px; min-width: 0; width: auto; }
.sub-cal-controls .btn { white-space: normal; height: auto; min-height: 40px; text-align: left; }
.sub-cal-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.sub-cal-links .btn { white-space: normal; height: auto; min-height: 40px; text-align: left; }
.sub-faq { display: flex; flex-direction: column; min-width: 0; }
.sub-faq-item { border-top: 1px solid var(--border); }
.sub-faq-item:first-child { border-top: 0; }
.sub-faq-item > summary { min-height: 48px; color: var(--text); padding: 6px 0; }
.sub-sources-box { padding: 4px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }

/* ---- touch: inputs ≥ 16 px (app.css), tap targets ≥ 40 px ---- */
@media (pointer: coarse), (max-width: 720px) {
  .sub .segmented-item { height: 40px; }
  .sub .btn-sm { min-height: 40px; }
  .sub-grant-remove.btn-icon { width: 40px; height: 40px; }
  .sub .dropdown > .btn { min-height: 44px; }
  /* external links: every one is a 40 px tall target of its own (no bullets, rows do the spacing) */
  .sub-ext { display: inline-block; min-height: 40px; padding: 10px 0; box-sizing: border-box; }
  .sub-sources { gap: 0; padding-left: 0; list-style: none; }
  .sub-sch-source .sub-ext { margin: -6px 0; }
}
@media (max-width: 480px) {
  .sub-switch-body { padding: 12px; }
  .sub-toggles .field { padding-left: 0; }
  .sub-mode .segmented-item { font-size: 12.5px; padding: 0 4px; }
  .sub-sch-rate .input-affix, .sub-sch-qty .input-affix { max-width: none; }
  .sub-cal-controls .input { flex: 1 1 100%; }
  .sub-cal-controls .btn { flex: 1 1 100%; justify-content: center; }
}

@media print {
  .sub-tabs, .sub-group-more, .sub-grant-add, .sub-cat-add, .sub-cal-actions, .sub-sch-reset { display: none !important; }
  .sub-sch--na { display: none !important; }
}
