/* Shared by /disenar/ and /disenar/probar/. The pages define the color tokens. */

/* ---------- Motion ---------- */

@keyframes kit-pop {
  0% { opacity: 0; transform: translateY(14px) scale(0.96); }
  60% { opacity: 1; transform: translateY(-3px) scale(1.01); }
  100% { opacity: 1; transform: none; }
}
@keyframes kit-bounce {
  0%, 100% { transform: scale(1); }
  35% { transform: scale(0.94); }
  70% { transform: scale(1.04); }
}
@keyframes kit-grow { from { transform: scaleY(0); } }
@keyframes kit-grow-x { from { transform: scaleX(0); } }
@keyframes kit-fade { from { opacity: 0; } }
@keyframes kit-spin { from { opacity: 0; transform: rotate(-140deg) scale(0.6); } }

/* Entrances only run inside a container marked .anim, so re-renders while typing stay still */
.anim .pop,
.pop-now {
  animation: kit-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}
.pop-now { animation-delay: 0s; }
.bounce { animation: kit-bounce 0.45s ease; }

button, .btn { transition: transform 0.12s ease; }
button:active:not(:disabled), .btn:active { transform: scale(0.97); }

/* ---------- Confirm dialog ---------- */

.kit-confirm {
  width: min(440px, calc(100% - 32px));
  margin: auto;
  padding: 26px;
  border: 0;
  border-radius: 20px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 30px 60px -20px rgba(20, 23, 43, 0.55);
}
.kit-confirm[open] { animation: kit-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.kit-confirm::backdrop { background: rgba(20, 23, 43, 0.5); }
.kit-confirm[open]::backdrop { animation: kit-fade 0.25s ease; }
.kit-confirm h2 { font-size: 1.35rem; line-height: 1.2; letter-spacing: -0.02em; }
.kit-confirm p { margin-top: 8px; color: var(--muted); }
.kit-confirm-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.kit-confirm button {
  padding: 10px 18px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.kit-confirm button:hover { border-color: var(--ink); }
.kit-confirm .ok { border-color: var(--cobalt); background: var(--cobalt); color: #fff; }
.kit-confirm .ok.danger { border-color: #b42318; background: #b42318; }
.kit-confirm .ok:hover { filter: brightness(1.08); }

/* ---------- Charts ---------- */

.ch { margin-top: 12px; }
.ch-empty { margin-top: 10px; color: var(--muted); font-size: 0.9rem; }

.ch-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 140px;
  border-bottom: 1px solid var(--line);
}
.ch-bar {
  flex: 1;
  height: var(--h);
  min-height: 3px;
  border-radius: 6px 6px 0 0;
  background: var(--mist);
  transform-origin: bottom;
}
.ch-bar.now { background: var(--cobalt); }
.anim .ch-bar {
  animation: kit-grow 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: calc(150ms + var(--i) * 60ms);
}

.ch-labels { display: flex; gap: 8px; margin-top: 6px; font-size: 0.72rem; }
.ch-labels span { flex: 1; min-width: 0; color: var(--muted); text-align: center; overflow-wrap: anywhere; }
.ch-labels b { display: block; color: var(--ink); font-weight: 700; white-space: nowrap; }
@media (max-width: 640px) {
  .ch-labels { gap: 4px; font-size: 0.66rem; }
}

.ch-line { display: block; width: 100%; height: 150px; overflow: visible; }
.ch-area { fill: var(--cobalt-soft); }
.ch-stroke, .ch-dot, .ch-dot-in { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.ch-stroke { stroke: var(--cobalt); stroke-width: 3; }
.ch-dot { stroke: var(--cobalt); stroke-width: 12; }
.ch-dot-in { stroke: #fff; stroke-width: 5; }
/* The line is revealed left to right, as if drawn */
@keyframes kit-reveal { from { clip-path: inset(-10px 100% -10px -10px); } to { clip-path: inset(-10px -10px -10px -10px); } }
.anim .ch-line { animation: kit-reveal 1.1s cubic-bezier(0.65, 0, 0.35, 1) 0.15s both; }

.ch-donut { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 10px; }
.ch-donut svg { width: 130px; height: 130px; flex: none; }
.ch-slice { fill: none; stroke-width: 22; }
.anim .ch-donut svg { animation: kit-spin 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both; }
.ch-donut-total { fill: var(--ink); font-family: inherit; font-size: 17px; font-weight: 800; text-anchor: middle; }
.ch-donut-cap { fill: var(--muted); font-family: inherit; font-size: 11px; text-anchor: middle; }
.ch-legend { flex: 1; min-width: 140px; padding: 0; list-style: none; font-size: 0.85rem; }
.ch-legend li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.ch-key { width: 10px; height: 10px; flex: none; border-radius: 3px; }
.ch-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ch-pct { font-weight: 700; }
.anim .ch-legend li {
  animation: kit-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: calc(0.35s + var(--i) * 70ms);
}

.ch-rank { display: grid; gap: 10px; margin-top: 12px; padding: 0; list-style: none; font-size: 0.85rem; }
/* Name and value on one line, the bar underneath: works from narrow widgets to full reports */
.ch-rank li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 10px;
}
.ch-rank-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ch-rank-track { grid-column: 1 / -1; height: 8px; overflow: hidden; border-radius: 999px; background: var(--paper); }
.ch-rank-fill {
  display: block;
  width: var(--w);
  height: 100%;
  border-radius: inherit;
  background: var(--cobalt);
  transform-origin: left;
}
.ch-rank li:first-child .ch-rank-fill { background: var(--signal); }
.ch-rank-val { font-weight: 700; white-space: nowrap; }
.anim .ch-rank-fill {
  animation: kit-grow-x 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: calc(0.2s + var(--i) * 80ms);
}

.ch-goal { display: flex; align-items: center; gap: 16px; margin-top: 10px; }
.ch-goal svg { width: 104px; height: 104px; flex: none; }
.ch-goal-track { fill: none; stroke: var(--paper); stroke-width: 14; }
.ch-goal-fill { fill: none; stroke: var(--cobalt); stroke-width: 14; stroke-linecap: round; }
.ch-goal.done .ch-goal-fill { stroke: #2bb38a; }
.ch-goal-pct { fill: var(--ink); font-family: inherit; font-size: 24px; font-weight: 800; text-anchor: middle; }
.ch-goal-val { font-size: 1.5rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.ch-goal-cap { color: var(--muted); font-size: 0.85rem; }
.anim .ch-goal svg { animation: kit-spin 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both; }

@media (prefers-reduced-motion: reduce) {
  .anim .pop, .pop-now, .bounce, .kit-confirm[open], .kit-confirm[open]::backdrop,
  .anim .ch-bar, .anim .ch-line,
  .anim .ch-donut svg, .anim .ch-legend li, .anim .ch-rank-fill, .anim .ch-goal svg {
    animation: none !important;
  }
  button, .btn { transition: none; }
}

@media print {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
