/* NIWIK v29 – shared visual coherence. Loaded last; overrides only, no new design.
   Result-colour bands (--result-*, --feedback-*) are intentionally untouched. */

/* 1. Alias tokens used by newer modules onto the existing palette; slightly darker muted text. */
:root{
  --primary:var(--blue,#1268f4);
  --border:var(--line,#e4eaf2);
  --text:var(--ink,#15233c);
  --panel:var(--white,#fff);
  --subtle:var(--bg,#f5f7fb);
  --muted:#5f6e83;
}

/* 2. One clear keyboard focus ring. Field and period rules previously removed or paled it. */
button:focus-visible,a:focus-visible,summary:focus-visible,[tabindex]:focus-visible,
input:focus-visible,select:focus-visible,textarea:focus-visible,
.field input:focus-visible,.field select:focus-visible,.field textarea:focus-visible,.filter-control:focus-visible,
.mm-field input:focus-visible,.mm-field select:focus-visible,.mm-field textarea:focus-visible,
.period-controls select:focus-visible,.period-controls input:focus-visible{
  outline:3px solid var(--blue,#1268f4);
  outline-offset:2px;
}
/* Borderless search inputs: ring the visible box instead of the bare text line. */
.search-box:has(input:focus-visible){outline:3px solid var(--blue,#1268f4);outline-offset:2px}
.search-box input:focus-visible{outline:none}
/* Programmatic focus targets (panels) stay without a ring, as before. */
.manager-meetings-v29 [data-mm-flow-panel]:focus-visible{outline:none}
@media (forced-colors:active){
  :focus-visible,.search-box:has(input:focus-visible){outline-color:Highlight}
}

/* 3. Numeric values: no negative tracking, stable digits, so "12 345,67 zł" never overlaps.
   Sizes, colours and wrapping of parents are unchanged. */
.metric-value,
.analysis-value-pair dd,
.goal-values strong,
.personal-score>strong,
.monthly-goal-metrics dd,
.expiry-stats strong,
.expiry-stats-v24 strong,
.expiry-empty-plan>div strong,
.fitnessbi-readings--metric .fitnessbi-readings__value,
.rc-goal-value strong,
.ranking-compact-v26 .ranking-overall>strong,
.glofox-pool-total strong,
.bonus-workflow-v29 .bw-amounts strong,
.bonus-workflow-v29 [data-bw-own-card] .bw-own-approved-amount strong,
.bonus-workflow-v29 [data-bw-own-card] .bw-own-decision-amount strong,
.bonus-workflow-v29 [data-bw-own-card] .bw-own-estimate-amount strong{
  letter-spacing:0;
  font-kerning:none;
  font-variant-numeric:tabular-nums lining-nums;
}

/* 4. Table headings and secondary lines: readable muted tone (more specific headings keep their own colour). */
th{color:var(--muted)}
td .subline{color:var(--muted)}

/* 5. Errors look the same everywhere: red accent on soft red, dark text.
   Pending warnings and RC signals (.mm-rc-signal) stay amber. */
.bonus-workflow-v29 .bw-error,
.mm-error{
  border-left:3px solid var(--red,#ce4250);
  background:var(--red-soft,#fdf0f1);
  color:var(--ink,#15233c);
}

/* 6. Shift report editor only (scoped by .report-editor-section). One scroll area: the modal body. */
.modal:has(.report-editor-section){
  display:flex;flex-direction:column;
  max-height:calc(100dvh - 32px);
  overflow:hidden;
}
.modal:has(.report-editor-section)>.modal-head{flex:0 0 auto}
.modal:has(.report-editor-section)>.modal-body{
  flex:1 1 auto;min-height:0;
  overflow-y:auto;overflow-x:hidden;
  font-size:14px;line-height:1.55;
}
form#resource-form:has(.report-editor-section){font-size:14px;line-height:1.55}
form#resource-form:has(.report-editor-section) .report-section{
  margin:0 0 14px;padding:14px 16px 16px;
  max-height:none;overflow:visible;
  min-width:0;
}
form#resource-form:has(.report-editor-section) .report-section>legend,
form#resource-form:has(.report-editor-section) .report-section>h3{
  font-size:15.5px;line-height:1.35;font-weight:700;color:var(--ink,#15233c);
  padding:0 4px;margin:0 0 4px;
}
form#resource-form:has(.report-editor-section) .report-section>p,
form#resource-form:has(.report-editor-section) .data-note p,
form#resource-form:has(.report-editor-section) .page-note,
form#resource-form:has(.report-editor-section) details>p{
  font-size:14px;line-height:1.55;
}
form#resource-form:has(.report-editor-section) .report-section>p{margin:0 0 10px;color:var(--muted)}
form#resource-form:has(.report-editor-section) .form-grid{gap:12px 16px}
form#resource-form:has(.report-editor-section) .form-group{min-width:0;gap:4px}
form#resource-form:has(.report-editor-section) .form-group>span{font-size:14px;line-height:1.45;font-weight:600}
form#resource-form:has(.report-editor-section) .form-group small,
form#resource-form:has(.report-editor-section) .small{font-size:13px;line-height:1.5}
form#resource-form:has(.report-editor-section) .form-group small{color:var(--muted)}
form#resource-form:has(.report-editor-section) input,
form#resource-form:has(.report-editor-section) select,
form#resource-form:has(.report-editor-section) textarea{min-width:0;max-width:100%;box-sizing:border-box;font-size:14px}
form#resource-form:has(.report-editor-section) summary{font-size:14px;line-height:1.45}

/* Paired actual start/end hours: adjacent on desktop, spanning the whole grid row. */
form#resource-form .report-time-pair[data-report-time-pair]{
  grid-column:1/-1;
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 16px;
  min-width:0;
}

/* Sports cards and FitBar: two cohesive groups, each with its own basis. */
form#resource-form .report-closing-totals .report-closing-groups{
  display:grid;grid-template-columns:minmax(0,3fr) minmax(0,2fr);gap:14px;align-items:start;
  margin:4px 0 10px;
}
form#resource-form .report-closing-totals .report-closing-group{
  min-width:0;
  border:1px solid var(--line,#e4eaf2);border-radius:8px;
  background:var(--bg,#f5f7fb);
  padding:12px 14px;
  display:flex;flex-direction:column;gap:10px;
}
form#resource-form .report-closing-totals .report-closing-group-title{font-size:15px;line-height:1.35;color:var(--ink,#15233c)}
form#resource-form .report-closing-totals .report-closing-group .form-grid{
  grid-template-columns:repeat(auto-fit,minmax(150px,1fr));
}
form#resource-form .report-closing-totals .report-closing-group[data-closing-group="fitBar"] .form-grid{grid-template-columns:minmax(0,1fr)}
form#resource-form .report-closing-totals .report-closing-mode select{background:var(--white,#fff)}
form#resource-form .report-closing-totals .report-closing-group .data-note{margin:0}
form#resource-form .report-closing-totals [data-fitbar-help]{font-size:14px}
form#resource-form .report-required-mark{color:var(--red,#ce4250);font-weight:700}
form#resource-form .report-required-help{font-size:13px;line-height:1.5;color:var(--muted);margin:0 0 10px}
form#resource-form .report-closing-totals [data-closing-status]{font-size:13px;line-height:1.5;margin:0 0 6px}

/* Save / next actions: report-only sticky bar at the bottom of the modal body, opaque, in normal flow. */
form#resource-form:has(.report-editor-section)>.editor-save,
form#resource-form:has(.report-editor-section)>[data-report-close-actions]{
  margin-top:14px;
  padding:12px 0 4px;
  background:var(--white,#fff);
  border-top:1px solid var(--line,#e4eaf2);
  font-size:14px;line-height:1.5;
}
form#resource-form:has(.report-editor-section)>[data-report-close-actions] .editor-save{
  border-top:0;margin-top:8px;padding:0;background:transparent;
}
form#resource-form:has(.report-editor-section)>.editor-save,
form#resource-form:has(.report-editor-section) [data-report-close-actions] .editor-save{
  display:flex;flex-wrap:wrap;gap:8px 10px;align-items:center;
}
@media (min-width:601px) and (min-height:640px){
  form#resource-form:has(.report-editor-section)>.editor-save,
  form#resource-form:has(.report-editor-section)>[data-report-close-actions]{
    position:sticky;bottom:0;z-index:2;
    box-shadow:0 -6px 12px -10px rgba(21,35,60,.35);
  }
}

@media (max-width:900px){
  form#resource-form .report-closing-totals .report-closing-groups{grid-template-columns:minmax(0,1fr)}
}
@media (max-width:600px){
  .modal:has(.report-editor-section){max-height:100dvh}
  form#resource-form:has(.report-editor-section) .report-section{padding:12px}
  form#resource-form .report-time-pair[data-report-time-pair]{grid-template-columns:minmax(0,1fr)}
  form#resource-form .report-closing-totals .report-closing-group .form-grid{grid-template-columns:minmax(0,1fr)}
  form#resource-form:has(.report-editor-section) input,
  form#resource-form:has(.report-editor-section) select,
  form#resource-form:has(.report-editor-section) textarea{font-size:16px}
  form#resource-form:has(.report-editor-section) .editor-save .btn{flex:1 1 100%}
}

/* 7. Single-club NETGAIN KPI (new classes only; multi-club rows and other KPIs untouched).
   Row colours come inline from the validated result-colour policy and are not overridden. */
.fitnessbi-netgain-kpi{display:flex;flex-direction:column;gap:6px;min-width:0}
.fitnessbi-netgain-kpi .fitnessbi-netgain-source,
.fitnessbi-netgain-compact .fitnessbi-netgain-source{
  margin:0;font-size:13px;line-height:1.45;color:var(--muted);overflow-wrap:anywhere;
}
.fitnessbi-netgain-kpi .fitnessbi-readings__due,
.fitnessbi-netgain-kpi .fitnessbi-netgain-note,
.fitnessbi-netgain-compact .fitnessbi-netgain-note{
  margin:0;font-size:13px;line-height:1.45;color:var(--ink,#15233c);
}
.fitnessbi-netgain-kpi .fitnessbi-readings__due{font-weight:600}
.fitnessbi-netgain-rows{display:flex;flex-direction:column;gap:6px;margin:2px 0 0;min-width:0}
.fitnessbi-netgain-row{
  display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 8px;
  padding:6px 10px;border-radius:8px;
  font-size:13px;line-height:1.4;min-width:0;
}
.fitnessbi-netgain-row__period{font-weight:600}
.fitnessbi-netgain-row__period>span{font-weight:400;opacity:.85}
.fitnessbi-netgain-row__value{font-size:14px;font-variant-numeric:tabular-nums lining-nums;letter-spacing:0}
.fitnessbi-netgain-row__status{flex:1 1 100%;font-size:12.5px}
.fitnessbi-netgain-more{margin-top:2px;font-size:13px}
.fitnessbi-netgain-more>summary{font-size:13px;line-height:1.45;cursor:pointer}
.fitnessbi-netgain-more[open]{max-height:none;overflow:visible}
/* Expanded original reader: flat, natural height, no nested-card look. */
.fitnessbi-netgain-more>.fitnessbi-readings,
.fitnessbi-netgain-more>section{
  margin:8px 0 0;padding:0;border:0;box-shadow:none;background:transparent;max-height:none;overflow:visible;
}
.fitnessbi-netgain-kpi .fitnessbi-netgain-more>.fitnessbi-readings>header h3{display:none}
.fitnessbi-netgain-more .fitnessbi-readings__club{padding:0;border:0;box-shadow:none;background:transparent}
.fitnessbi-netgain-kpi .fitnessbi-netgain-more .fitnessbi-readings__value{font-size:18px}
.fitnessbi-netgain-kpi>.btn{align-self:flex-start}
/* Dashboard compact NETGAIN: one flex gap replaces stacked inherited margins; all text stays. */
.management-netgain-club-pace>.fitnessbi-netgain-compact{display:flex;flex-direction:column;gap:4px;min-width:0}
.fitnessbi-netgain-compact>.fitnessbi-netgain-rows,
.fitnessbi-netgain-kpi>.fitnessbi-netgain-rows{margin:0;gap:4px}
.fitnessbi-netgain-compact>.fitnessbi-netgain-more,
.fitnessbi-netgain-kpi>.fitnessbi-netgain-more{margin-top:0}
@media (max-width:600px){
  .fitnessbi-netgain-row{padding:6px 8px}
}
