/* Perform hub — Цілі/OKR (Phase 51). Cards, progress bar, confidence badges,
   KR tree, drawer — all via tokens.css variables, no hardcoded colors. */

.goal-scope { display: flex; gap: var(--space-1); background: var(--color-surface-2); padding: var(--space-1); border-radius: var(--radius-md); flex-shrink: 0; }
.goal-scope__btn { padding: var(--space-2) var(--space-3); border: 0; background: transparent; border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: var(--font-medium); color: var(--color-fg-muted); cursor: pointer; white-space: nowrap; }
.goal-scope__btn.is-active { background: var(--color-surface); color: var(--color-fg); box-shadow: var(--shadow-sm); }

/* The period select (+ optional team select) and "Нова ціль" button move as
   one group — .lv-section-head's own flex-wrap sends this whole group to a
   second line together on narrow screens, instead of the select shrinking
   to near-zero width mid-row while everything else stays squeezed in place. */
.goal-toolbar-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.goal-toolbar-actions .modal-input { width: auto; min-width: 140px; }
@media (max-width: 480px) {
  .goal-toolbar-actions { width: 100%; }
  .goal-toolbar-actions .modal-input { flex: 1; min-width: 0; }
  .goal-toolbar-actions #goal-new { width: 100%; }
}

.goal-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: var(--space-4); }
.goal-card { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-5); cursor: pointer; transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), border-color var(--dur-fast); }
.goal-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--color-border-strong); }
.goal-card__head { display: flex; align-items: center; gap: var(--space-2); }
/* 2026-07-13 — icon-chip, tinted by confidence on actual OKR goal cards
   (real state, not decorative) or a neutral default on development-plan
   cards (which reuse .goal-card but skip the confidence concept). Same
   device as the Dashboard/Leaves/Profile polish pass this session. */
.goal-card__icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--radius-sm); flex-shrink: 0; background: var(--color-primary-soft); color: var(--color-primary); }
.goal-card__icon .icon { width: 15px; height: 15px; }
.goal-card__icon--success { background: var(--color-success-soft); color: var(--color-success); }
.goal-card__icon--warning { background: var(--color-warning-soft); color: var(--color-warning); }
.goal-card__icon--danger { background: var(--color-danger-soft); color: var(--color-danger); }
.goal-card__expand { display: grid; place-items: center; width: 24px; height: 24px; border: 0; background: transparent; color: var(--color-fg-muted); border-radius: var(--radius-sm); flex-shrink: 0; }
.goal-card__expand:hover { background: var(--color-surface-hover); }
.goal-card__owner { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-fg-muted); flex: 1; min-width: 0; }
.goal-card__owner span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal-card__title { font-size: var(--text-base); font-weight: var(--font-semibold); }
.goal-card__progress { display: flex; align-items: center; gap: var(--space-3); }
.goal-card__due { font-size: var(--text-xs); color: var(--color-fg-subtle); }
.goal-card__children { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--color-border); }

.goal-bar { flex: 1; height: 8px; border-radius: var(--radius-full); background: var(--color-surface-2); overflow: hidden; }
.goal-bar__fill { height: 100%; background: var(--color-primary); border-radius: var(--radius-full); transition: width var(--dur-base) var(--ease-out); }
.goal-bar__pct { font-size: var(--text-xs); font-weight: var(--font-semibold); color: var(--color-fg-muted); min-width: 2.5em; text-align: right; }

.goal-conf { display: inline-flex; align-items: center; padding: 2px var(--space-2); border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: var(--font-semibold); white-space: nowrap; }
.goal-conf--onTrack { background: var(--color-success-soft); color: var(--color-success); }
.goal-conf--atRisk { background: var(--color-warning-soft); color: var(--color-warning); }
.goal-conf--offTrack { background: var(--color-danger-soft); color: var(--color-danger); }

.goal-kr { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-sm); }
.goal-kr__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-fg-muted); }

.goal-drawer__desc { color: var(--color-fg-muted); font-size: var(--text-sm); margin-bottom: var(--space-3); }
.goal-drawer__progress { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.goal-drawer__h { font-size: var(--text-sm); font-weight: var(--font-semibold); color: var(--color-fg-muted); margin-bottom: var(--space-2); }
.goal-spark { width: 100%; height: 64px; display: block; margin-bottom: var(--space-4); }

/* Goals workspace refresh */
.perform-goals-page { width: min(1160px, 100%); margin: 0 auto; padding-bottom: var(--space-8); }
.goals-page-head { margin: var(--space-5) 0; padding: var(--space-6); border: 1px solid var(--color-border); border-radius: var(--radius-2xl); background: linear-gradient(135deg, var(--color-primary-soft), var(--color-surface)); }
.goals-page-head p { margin: 0 0 var(--space-2); color: var(--color-primary); font-size: var(--text-xs); font-weight: var(--font-bold); text-transform: uppercase; letter-spacing: .08em; }
.goals-page-head h2 { margin: 0; font-size: clamp(1.45rem, 3vw, 2rem); letter-spacing: -.035em; }
.goals-page-head span { display: block; max-width: 680px; margin-top: var(--space-2); color: var(--color-fg-muted); font-size: var(--text-sm); line-height: 1.55; }
.goals-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-6); padding: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-xl); background: var(--color-surface); box-shadow: var(--shadow-sm); }
.goals-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-6); }
.goals-overview > div { min-width: 0; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; align-items: center; column-gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-xl); background: var(--color-surface); box-shadow: var(--shadow-sm); }
.goals-overview > div > span { grid-row: 1 / 3; display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--color-primary-soft); color: var(--color-primary); }
.goals-overview .is-success > span { background: var(--color-success-soft); color: var(--color-success); }
.goals-overview .is-warning > span { background: var(--color-warning-soft); color: var(--color-warning); }
.goals-overview .icon { width: 18px; height: 18px; }
.goals-overview b { font-size: var(--text-xl); line-height: 1; font-variant-numeric: tabular-nums; }
.goals-overview small { color: var(--color-fg-muted); font-size: var(--text-xs); }
.goals-list-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); }
.goals-list-head h3 { margin: 0; font-size: var(--text-lg); }
.goals-list-head p { margin: 4px 0 0; color: var(--color-fg-muted); font-size: var(--text-xs); }
.goals-list-head > span { display: grid; place-items: center; min-width: 30px; height: 30px; border-radius: var(--radius-full); background: var(--color-surface-2); color: var(--color-fg-muted); font-size: var(--text-xs); font-weight: var(--font-bold); }
.perform-goals-page .goal-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.perform-goals-page .goal-card { position: relative; min-width: 0; min-height: 280px; gap: 0; padding: var(--space-5); border: 1px solid var(--color-border); border-radius: var(--radius-xl); background: var(--color-surface); box-shadow: var(--shadow-sm); }
.perform-goals-page .goal-card--success { border-top: 3px solid var(--color-success); }
.perform-goals-page .goal-card--warning { border-top: 3px solid var(--color-warning); }
.perform-goals-page .goal-card--danger { border-top: 3px solid var(--color-danger); }
.perform-goals-page .goal-card__icon { width: 42px; height: 42px; border-radius: var(--radius-lg); }
.perform-goals-page .goal-card__icon .icon { width: 19px; height: 19px; }
.perform-goals-page .goal-card__owner { font-size: var(--text-xs); }
.perform-goals-page .goal-card__title { margin-top: var(--space-5); font-size: var(--text-lg); line-height: 1.35; }
.goal-card__desc { display: -webkit-box; margin: var(--space-2) 0 0; overflow: hidden; color: var(--color-fg-muted); font-size: var(--text-xs); line-height: 1.5; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.perform-goals-page .goal-card__progress { margin-top: auto; padding-top: var(--space-5); }
.perform-goals-page .goal-bar { height: 10px; }
.perform-goals-page .goal-card > footer { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--color-border); }
.perform-goals-page .goal-card > footer > span { display: inline-flex; align-items: center; gap: 5px; color: var(--color-fg-subtle); font-size: 10px; }
.perform-goals-page .goal-card > footer > span .icon { width: 12px; height: 12px; }
.perform-goals-page .goal-card__expand { width: auto; height: auto; display: inline-flex; align-items: center; gap: 5px; margin-left: auto; padding: 5px 8px; color: var(--color-primary); font-size: 10px; font-weight: var(--font-semibold); }
.perform-goals-page .goal-card__children { margin-top: var(--space-4); padding-top: var(--space-4); }
.goals-empty { display: grid; place-items: center; min-height: 280px; padding: var(--space-8); border: 1px dashed var(--color-border-strong); border-radius: var(--radius-xl); text-align: center; }
.goals-empty > span { display: grid; place-items: center; width: 58px; height: 58px; border-radius: var(--radius-full); background: var(--color-primary-soft); color: var(--color-primary); }
.goals-empty .icon { width: 26px; height: 26px; }
.goals-empty h3 { margin: var(--space-4) 0 0; }
.goals-empty p { margin: var(--space-2) 0 0; color: var(--color-fg-muted); font-size: var(--text-sm); }

@media (max-width: 700px) {
  .goal-list { grid-template-columns: 1fr; }
  .goals-toolbar { align-items: stretch; flex-direction: column; }
  .goal-toolbar-actions { width: 100%; }
  .goals-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .perform-goals-page .goal-list { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .goals-overview { grid-template-columns: 1fr; }
  .goals-page-head { padding: var(--space-5); }
}

/* Phase 52 — competencies, rating scales, review templates, review cycles. */
.rt-roles { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-1); }
.rt-section { flex-wrap: wrap; }
.rt-section select[multiple] { height: auto; padding: var(--space-2); }

.review-matrix-wrap { overflow-x: auto; margin-bottom: var(--space-4); }
.review-matrix { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.review-matrix th { text-align: left; padding: var(--space-2) var(--space-3); color: var(--color-fg-muted); font-weight: var(--font-medium); border-bottom: 1px solid var(--color-border); }
.review-matrix td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-border); vertical-align: top; }
.review-matrix td .goal-conf { margin: 0 var(--space-1) var(--space-1) 0; }
.review-matrix td .modal-input { min-width: 90px; }

/* Phase 53 — filling in a review form + calibration histogram. */
.rf-section { padding: var(--space-5); margin-bottom: var(--space-4); }
.rf-section textarea { margin-top: var(--space-3); }
.rf-scale { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-2) 0; }
.rf-scale__opt { display: flex; align-items: center; gap: var(--space-1); font-size: var(--text-sm); }
.rf-competency { padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border); }
.rf-competency:last-of-type { border-bottom: 0; }
.rf-competency__name { display: block; font-weight: var(--font-medium); margin-bottom: var(--space-1); }
.rf-goal { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; }
.rf-goal__title { flex: 1; min-width: 200px; font-size: var(--text-sm); }
.rf-goal input { max-width: 140px; }

.cal-histogram { width: 100%; max-width: 400px; height: 100px; display: block; margin-bottom: var(--space-4); }

/* Phase 54 — development plans, 1:1 snapshot block. */
.dev-action { flex-wrap: wrap; gap: var(--space-2); }
.dev-action__status { display: inline-flex; align-items: center; border: 0; border-radius: var(--radius-full); padding: 2px var(--space-2); font-size: var(--text-xs); font-weight: var(--font-semibold); cursor: pointer; white-space: nowrap; }
.dev-action__status--todo { background: var(--color-surface-2); color: var(--color-fg-muted); }
.dev-action__status--in_progress { background: var(--color-warning-soft); color: var(--color-warning); }
.dev-action__status--done { background: var(--color-success-soft); color: var(--color-success); }

.mt-perf-list { list-style: none; margin: var(--space-2) 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--text-sm); }
.mt-perf-list li { padding: var(--space-1) 0; }

/* ── Competencies (read-only glossary) ───────────────────────────────── */
.comp-cat-title:first-child { margin-top: 0; }
.comp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: var(--space-3); margin-bottom: var(--space-2); }
.comp-card { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); }
.comp-card__name { font-weight: var(--font-semibold); }
.comp-card__desc { font-size: var(--text-sm); color: var(--color-fg-muted); }
.comp-scale { display: flex; flex-wrap: wrap; gap: var(--space-1); }
