/* ==========================================================================
   v5 R26 „Akčný plán“ (views/akcny-plan.js, docs/SPEC_V5_AKCNY_PLAN.md §3.4) – prefix .ap-
   Phone first (360–400 px): one column, nothing wider than the screen (min-width: 0 on every flex / grid child, long labels
   wrap), tabular right-aligned numbers, ≥ 44 px targets on touch, ≥ 16 px inputs. Colours only through tokens; status
   colours (good / warning / critical) only for status (lights, verdict, variances). The source chips are Cashflow's
   .rs-chip (cashflow.css). Linked by index.html before theme.css / v2.css.
   ========================================================================== */

.ap { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ap > * { min-width: 0; }
.ap-note { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--text-2); overflow-wrap: anywhere; }
.ap-error { margin: 0; font-size: 14px; color: var(--critical-text); overflow-wrap: anywhere; }
.ap-num { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.ap-num.is-good { color: var(--good-text); }
.ap-num.is-bad { color: var(--critical-text); }
.ap-sub-title { margin: 12px 0 6px; font-size: 14px; font-weight: 700; color: var(--text); }
.ap-inline { display: flex; flex-direction: column; gap: 8px; padding: 10px; margin-top: 6px; border-radius: var(--radius); background: var(--surface-2); min-width: 0; }
.ap-inline[hidden] { display: none; }
.ap-inline-actions, .ap-sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.ap .btn, .ap-sheet .btn { max-width: 100%; white-space: normal; height: auto; min-height: 36px; }

/* dot + light */
.ap-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.ap-light { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
[data-light="green"] > .ap-dot, [data-light="green"] .ap-month-foot > .ap-dot, .ap-light[data-light="green"] .ap-dot { background: var(--good); }
[data-light="amber"] > .ap-dot, [data-light="amber"] .ap-month-foot > .ap-dot, .ap-light[data-light="amber"] .ap-dot { background: var(--warning); }
[data-light="red"] > .ap-dot, [data-light="red"] .ap-month-foot > .ap-dot, .ap-light[data-light="red"] .ap-dot { background: var(--critical); }
[data-light="overit"] > .ap-dot, [data-light="overit"] .ap-month-foot > .ap-dot, .ap-light[data-light="overit"] .ap-dot { background: var(--accent); }
[data-light="posun"] > .ap-dot, [data-light="posun"] .ap-month-foot > .ap-dot, .ap-light[data-light="posun"] .ap-dot { background: var(--muted); }
.ap-light[data-light="red"] .ap-light-text { color: var(--critical-text); font-weight: 600; }
.ap-light[data-light="amber"] .ap-light-text { color: var(--warning-text); font-weight: 600; }

/* small tags beside the source chip */
.ap-tag {
  display: inline-flex; align-items: center; max-width: 100%; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); font-size: 11.5px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere;
}
.ap-tag--money { background: var(--green-soft); border-color: transparent; color: var(--green-text); }
.ap-tag--origin { background: var(--surface-2); }
.ap-tag--conf { background: var(--surface-2); border-style: dashed; }
.ap-tag--confirm { background: var(--brown-soft); border-color: transparent; color: var(--brown-text); }
.ap-tag--muted, .ap-tag--group { background: var(--grey-soft); border-color: transparent; color: var(--grey-text); }
.ap-tag--shown { background: var(--accent-soft); border-color: transparent; color: var(--link); }

/* ---- the plan bar and banners ---- */
.ap-top { display: flex; flex-direction: column; gap: 8px; }
.ap-top[hidden] { display: none; }
.ap-planbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.ap-planbar-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.ap-plan-seg { max-width: 100%; flex-wrap: wrap; }
.ap-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.ap-banner[data-kind="preview"] { background: var(--accent-soft); border-color: transparent; }
.ap-banner[data-kind="archived"], .ap-banner[data-kind="readonly"] { background: var(--grey-soft); border-color: transparent; }
.ap-banner[data-kind="whatif"] { background: var(--warning-soft); border-color: transparent; }
.ap-banner-text { margin: 0; flex: 1 1 220px; min-width: 0; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.ap-banner-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- empty state ---- */
.ap-empty { display: flex; flex-direction: column; gap: 10px; }
.ap-empty[hidden] { display: none; }
.ap-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.ap-empty-points { margin: 0 auto; padding-left: 20px; max-width: 560px; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.ap-empty-old { margin: 0; text-align: center; font-size: 13.5px; color: var(--text-2); }

/* ---- tabs ---- */
.ap-tabs-wrap { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ap-tabs-wrap[hidden] { display: none; }
.ap-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.ap-panel { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ap-panel[hidden] { display: none; }
.ap-sec { min-width: 0; }
.ap-sec[hidden] { display: none; }

/* ---- Prehľad: verdict (a decision notice – never folded) ---- */
.ap-verdict {
  display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: var(--radius-lg); border: 1px solid var(--border);
  border-left: 5px solid var(--border-strong); background: var(--surface); box-shadow: var(--shadow-sm); min-width: 0;
}
.ap-verdict[data-level="red"] { border-left-color: var(--critical); background: var(--critical-soft); }
.ap-verdict[data-level="amber"] { border-left-color: var(--warning); background: var(--warning-soft); }
.ap-verdict[data-level="green"] { border-left-color: var(--good); }
.ap-verdict-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ap-verdict-text { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.35; color: var(--text); overflow-wrap: anywhere; }
.ap-verdict-meta, .ap-verdict-note { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text-2); overflow-wrap: anywhere; }
.ap-verdict-live { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ap-verdict-live > p { margin: 0; flex: 1 1 200px; font-size: 14px; min-width: 0; }
.ap-notices { display: flex; flex-direction: column; gap: 8px; }
.ap-notices[hidden] { display: none; }
.ap-notice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--accent-soft); min-width: 0; }
.ap-notice > p { margin: 0; flex: 1 1 200px; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }

/* tiles: two columns on a phone (kpi-grid), values never overflow */
.ap-tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.ap-tile { min-width: 0; }
.ap-tile .kpi-value { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ap-tile .kpi-sub { overflow-wrap: anywhere; }
@media (max-width: 420px) {
  .ap-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ap-tile .kpi-value { font-size: 17px; }
}

/* warnings, causes */
.ap-warns { display: flex; flex-direction: column; gap: 10px; }
.ap-warn { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); min-width: 0; }
.ap-warn[data-level="red"] { border-color: var(--critical); background: var(--critical-soft); }
.ap-warn[data-level="amber"] { border-color: var(--warning); background: var(--warning-soft); }
.ap-warn[data-level="red"] .ap-dot { background: var(--critical); }
.ap-warn[data-level="amber"] .ap-dot { background: var(--warning); }
.ap-warn[data-level="green"] .ap-dot { background: var(--good); }
.ap-warn[data-level="info"] .ap-dot { background: var(--accent); }
.ap-warn-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.ap-warn-text { margin: 0; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.ap-warn-causes { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--text-2); }
.ap-warn-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ap-warn-actions .btn { justify-content: flex-start; text-align: left; }
.ap-causes { display: flex; flex-direction: column; gap: 6px; }
.ap-cause-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ap-cause { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); min-width: 0; }
.ap-cause-main { display: flex; flex-direction: column; gap: 2px; flex: 1 1 220px; min-width: 0; }
.ap-cause-title { font-weight: 700; font-size: 14px; }
.ap-cause-label { font-size: 14px; overflow-wrap: anywhere; }
.ap-cause-meta, .ap-cause-task { font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.ap-cause-task { color: var(--critical-text); }
.ap-cause-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* month strip: wraps (4 – 6 per row), never scrolls sideways */
.ap-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.ap-month {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; min-height: 56px; padding: 6px 8px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.ap-month:hover { background: var(--surface-3); }
.ap-month:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ap-month[data-current] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ap-month[data-light="red"] { background: var(--critical-soft); }
.ap-month[data-light="amber"] { background: var(--warning-soft); }
.ap-month-name { font-size: 12.5px; font-weight: 700; text-transform: capitalize; color: var(--text-2); }
.ap-month-val { font-size: 12.5px; font-variant-numeric: tabular-nums; font-weight: 600; max-width: 100%; overflow-wrap: anywhere; }
.ap-month-foot { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--good-text); }
.ap-strip-note, .ap-cash-info { margin-top: 8px; }
.ap-cash-body { min-width: 0; }

/* review card */
.ap-review-card { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.ap-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px 12px; margin: 0; }
.ap-count { display: flex; justify-content: space-between; gap: 8px; min-width: 0; font-size: 14px; }
.ap-count dt { color: var(--text-2); margin: 0; }
.ap-count dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.ap-count-eur { font-weight: 500; color: var(--text-2); }
.ap-review-text { margin: 0; font-size: 14px; }
.ap-review-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- Úlohy ---- */
.ap-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ap-chips .chip[hidden] { display: none; }
.ap-task-sum { margin: 0; font-size: 14px; color: var(--text-2); overflow-wrap: anywhere; }
.ap-outside:empty { display: none; }
.ap-tmonths { display: flex; flex-direction: column; gap: 10px; }
.ap-tmonth { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 6px 12px 10px; background: var(--surface); min-width: 0; }
.ap-tmonth-head { margin: 0; font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.ap-tmonth-count { font-size: 13px; font-weight: 500; color: var(--text-2); }
.ap-tmonth.is-folded .ap-tmonth-count { display: none; }
.ap-tweeks { display: flex; flex-direction: column; gap: 4px; }
.ap-tweek-head { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--text-2); }
.ap-tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ap-task + .ap-task { border-top: 1px solid var(--border); }
.ap-task-btn {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title status" "meta meta"; gap: 4px 10px; width: 100%;
  min-height: 48px; padding: 8px 2px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.ap-task-btn:hover { background: var(--surface-3); }
.ap-task-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ap-task-title { grid-area: title; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; min-width: 0; }
.ap-task-meta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12.5px; color: var(--text-2); min-width: 0; }
.ap-task-status { grid-area: status; font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.ap-task-status[data-status="done"] { color: var(--good-text); }
.ap-task-status[data-status="late"] { color: var(--warning-text); }
.ap-task-status[data-status="missed"] { color: var(--critical-text); }
.ap-task[data-status="done"] .ap-task-title, .ap-task[data-status="skipped"] .ap-task-title { color: var(--text-2); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.ap-work { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ap-work-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; font-size: 13.5px; }
.ap-work-row[data-current] .ap-work-week { font-weight: 700; }
.ap-work-nums { font-variant-numeric: tabular-nums; color: var(--text-2); text-align: right; }
.ap-work-row .ap-bar { grid-column: 1 / -1; }
.ap-bar { display: block; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; min-width: 0; }
.ap-bar-fill { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .2s ease; }

/* ---- Peniaze ---- */
.ap-money-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ap-view-seg, .ap-year-seg { max-width: 100%; }
.ap-dups:empty { display: none; }
.ap-dups { display: flex; flex-direction: column; gap: 8px; }
.ap-dup { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--warning-soft); min-width: 0; }
.ap-dup-text { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.ap-dup-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ap-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ap-line { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.ap-line[data-light="red"] { border-color: var(--critical); }
.ap-line[data-light="amber"] { border-color: var(--warning); }
.ap-line-btn {
  display: flex; flex-direction: column; gap: 6px; width: 100%; min-height: 48px; padding: 10px 12px; border: 0; background: none; color: inherit;
  font: inherit; text-align: left; cursor: pointer; border-radius: var(--radius);
}
.ap-line-btn:hover { background: var(--surface-3); }
.ap-line-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ap-line-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; min-width: 0; }
.ap-line-label { font-size: 15px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; min-width: 0; }
.ap-line-chips { display: flex; flex-wrap: wrap; gap: 4px 6px; min-width: 0; }
.ap-line-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 10px; min-width: 0; }
.ap-line-nums.is-untracked { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: end; }
.ap-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; min-width: 0; text-align: right; }
.ap-cell-label { font-size: 11.5px; color: var(--text-2); line-height: 1.25; overflow-wrap: anywhere; }
.ap-cell .ap-num { font-size: 14px; }
.ap-untracked { font-size: 12.5px; color: var(--text-2); text-align: right; }
.ap-line-posun, .ap-line-note { font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.ap-group-foot:empty { display: none; }
.ap-group-foot { margin-top: 8px; }
.ap-entry { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.ap-entry-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "text amount" "meta amount"; gap: 2px 10px; }
.ap-entry-text { grid-area: text; font-size: 14.5px; overflow-wrap: anywhere; }
.ap-entry-meta { grid-area: meta; font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.ap-entry-amount { grid-area: amount; align-self: center; }
.ap-suggest { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.ap-suggest-head { font-size: 13px; color: var(--text-2); }
.ap-suggest .btn.ap-suggest-item { justify-content: flex-start; text-align: left; max-width: 100%; }
span.ap-suggest-item { font-size: 13.5px; overflow-wrap: anywhere; }
.ap-entry-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- sheets ---- */
.ap-sheet .modal-body { min-width: 0; }
.ap-sheet-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ap-sheet-body > * { min-width: 0; }
.ap-kv { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin: 0; }
.ap-kv > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.ap-kv dt { margin: 0; font-size: 14px; color: var(--text-2); min-width: 0; overflow-wrap: anywhere; }
.ap-kv dd { margin: 0; text-align: right; }
.ap-why { width: 100%; min-height: 44px; resize: vertical; }
.ap-cells, .ap-ents, .ap-confirms, .ap-milestones, .ap-checkpoints { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ap-cell-row { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); min-width: 0; }
.ap-cell-row.is-focus { box-shadow: inset 0 0 0 2px var(--accent); }
.ap-cell-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.ap-cell-month { font-weight: 700; font-size: 14px; }
.ap-cell-state { font-size: 13px; color: var(--text-2); }
.ap-cell-state[data-state="splnene"] { color: var(--good-text); }
.ap-cell-state[data-state="oneskorene"], .ap-cell-state[data-state="ciastocne"] { color: var(--warning-text); }
.ap-cell-state[data-state="vypadok"], .ap-cell-state[data-state="nezaplatene"] { color: var(--critical-text); }
.ap-cell-nums { margin-left: auto; font-size: 13px; color: var(--text-2); }
.ap-cell-meta { margin: 0; font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.ap-cell-meta:empty { display: none; }
.ap-cell-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ap-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.ap-confirm .input-affix { width: 9.5em; max-width: 100%; }
.ap-ent { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--border); min-width: 0; }
.ap-ent-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "text amount" "meta amount"; gap: 2px 10px; }
.ap-ent-text { grid-area: text; font-size: 14px; overflow-wrap: anywhere; }
.ap-ent-meta { grid-area: meta; font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.ap-ent-main > .ap-num { grid-area: amount; align-self: center; }
.ap-ent-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ap-ent-actions:empty { display: none; }
.ap-link { padding: 0; border: 0; background: none; color: var(--link); font: inherit; text-align: left; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; overflow-wrap: anywhere; }

/* review sheet: numbered steps */
.ap-step { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; border-top: 1px solid var(--border); min-width: 0; }
.ap-step:first-of-type { border-top: 0; }
.ap-step-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 700; }
.ap-step-num { display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--link); font-size: 13px; }
.ap-closed { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: var(--radius); background: var(--good-soft); }
.ap-closed[data-changed] { background: var(--warning-soft); }
.ap-closed > p { margin: 0; font-size: 14px; }
.ap-check { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border-radius: var(--radius); background: var(--warning-soft); min-width: 0; }
.ap-check > p { margin: 0; flex: 1 1 200px; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.ap-confirm-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); min-width: 0; }
.ap-confirm-row[data-confirmed] { background: var(--good-soft); }
.ap-confirm-main { display: flex; flex-direction: column; gap: 2px; flex: 1 1 180px; min-width: 0; }
.ap-confirm-label { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.ap-confirm-meta { font-size: 12.5px; color: var(--text-2); }
.ap-confirm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.ap-confirm-actions .input-affix { width: 9.5em; max-width: 100%; }
.ap-confirmed { font-size: 13.5px; color: var(--good-text); font-weight: 600; }
.ap-flag { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); min-width: 0; }
.ap-flag-main { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.ap-late { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); min-width: 0; }
.ap-late-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.ap-late-label { font-size: 14px; font-weight: 600; flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; }
.ap-late-state { font-size: 12.5px; color: var(--warning-text); }
.ap-balance-now { margin: 0; font-size: 14px; }
.ap-balance-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 12px; align-items: end; min-width: 0; }
.ap-milestone { font-size: 14px; overflow-wrap: anywhere; }
.ap-milestone[data-kind="in"] { color: var(--good-text); }

/* ---- Opatrenia ---- */
.ap-toolbar:empty { display: none; }
.ap-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.ap-actions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ap-action { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.ap-action.is-focus { box-shadow: 0 0 0 2px var(--accent); }
.ap-action[data-status="done"], .ap-action[data-status="dropped"] { background: var(--surface-2); }
.ap-action-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ap-action-text { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.ap-action-meta, .ap-action-note, .ap-action-task { font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.ap-action-note { color: var(--warning-text); }
.ap-action-task[data-done] { color: var(--good-text); }
.ap-action-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ap-action-accept { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.ap-versions, .ap-balances { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ap-version { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); min-width: 0; }
.ap-version[data-shown] { box-shadow: inset 0 0 0 1px var(--accent); }
.ap-version-main { display: flex; flex-direction: column; gap: 2px; flex: 1 1 200px; min-width: 0; }
.ap-version-title { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.ap-version-meta, .ap-version-note { font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.ap-version-actions { margin-top: 8px; }
.ap-balance { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; }
.ap-balance-date { min-width: 6.5em; }
.ap-settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 14px; margin-top: 10px; }
.ap-setting { min-width: 0; }

/* ---- generate & PDF sheets ---- */
.ap-period-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ap-period-chips .chip { max-width: 100%; white-space: normal; text-align: left; }
.ap-gen-preview { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); min-height: 44px; }
.ap-gen-preview[data-state="busy"] { flex-direction: row; align-items: center; }
.ap-gen-line { margin: 0; font-size: 14.5px; font-weight: 600; overflow-wrap: anywhere; }
.ap-suggest-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.ap-suggest-acts .chip { white-space: normal; text-align: left; }
.ap-pdf-progress { display: flex; flex-direction: column; gap: 6px; }
.ap-pdf-progress[hidden], .ap-pdf-done[hidden] { display: none; }
.ap-bar--pdf { height: 8px; }
.ap-pdf-label, .ap-pdf-ok { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.ap-pdf-done { display: flex; flex-direction: column; gap: 8px; }

/* ---- touch: ≥ 44 px targets, 16 px inputs ---- */
@media (pointer: coarse) {
  .ap .btn, .ap-sheet .btn { min-height: 44px; }
  .ap .chip, .ap-sheet .chip { min-height: 44px; }
  .ap-month { min-height: 60px; }
  .ap-task-btn, .ap-line-btn { min-height: 52px; }
  .ap-link { min-height: 44px; }
  .ap-sheet .input, .ap .input, .ap-sheet textarea, .ap-sheet select { font-size: 16px; }
  .ap .segmented-item, .ap-sheet .segmented-item { min-height: 44px; }
  .ap .toggle, .ap-sheet .toggle, .ap-sheet .checkbox { min-height: 44px; }
  .ap-tabs .tab { min-height: 44px; }
  .ap .input, .ap .select, .ap-sheet .input, .ap-sheet .select { min-height: 44px; }
  .ap .chart-card__toggle { min-height: 44px; }
}
.ap-sheet .input, .ap-sheet textarea, .ap-sheet select, .ap .input { font-size: max(16px, 1em); }

@media (max-width: 420px) {
  .ap-line-nums { gap: 4px 6px; }
  .ap-cell .ap-num { font-size: 13px; }
  .ap-verdict { padding: 12px; }
  .ap-verdict-text { font-size: 16px; }
}

@media print {
  .ap-tabs, .ap-toolbar, .ap-cause-actions, .ap-warn-actions, .ap-review-actions, .ap-pdf-btn { display: none !important; }
}
.ap-month[data-pre] { background: var(--surface-2); color: var(--text-2); border-style: dashed; }
.ap-month.is-focus { box-shadow: 0 0 0 2px var(--accent); }
.ap-month-sel { max-width: 100%; }
.ap-howto { align-self: flex-start; font-size: 13.5px; }
.ap-howto-body ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.ap-howto-body p, .ap-howto-body li { margin: 0; font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.ap-howto-link { align-self: flex-start; }
.ap-tag--action { background: var(--accent-soft); border-color: transparent; color: var(--link); }

/* ---- kolo 15, opravy po kontrole telefónu (R26-PH-01 … PH-16) ---- */
.ap-line-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; }
.ap-line-assumed { color: var(--text-2); }
.ap-tolder .ap-tasks--older { margin-top: 6px; }
.ap-warn-same { margin: 0; font-size: 13px; }
.ap-step.is-focus { box-shadow: 0 0 0 2px var(--accent); border-radius: var(--radius); }
.ap-older { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.ap-older > .ap-tasks { align-self: stretch; }
.ap-tasks--older[hidden] { display: none; }
button.ap-action-task { align-self: flex-start; text-align: left; }
.ap-late[data-confirm] .ap-late-state { color: var(--text-2); }
