/* Feedback: toasts, empty states, loading skeletons and the stale-data state of the live pill (loaded after shell.css). */

/* ---------- toasts ---------- */
.toast-region { position: fixed; top: 76px; right: 20px; z-index: 300; display: grid; gap: 10px; width: min(400px, calc(100vw - 24px)); pointer-events: none; }
.toast {
  --toast-accent: var(--primary);
  pointer-events: auto; display: flex; align-items: flex-start; gap: 12px; padding: 12px 12px 12px 14px;
  background: var(--bg-card); color: var(--t-base); border: 1px solid var(--border); border-left: 3px solid var(--toast-accent); border-radius: 14px;
  box-shadow: var(--shadow-lg); animation: toast-in .22s cubic-bezier(.2, .7, .2, 1);
}
.toast--success { --toast-accent: var(--success); }
.toast--danger { --toast-accent: var(--danger); }
.toast--warning { --toast-accent: var(--warning); }
.toast--info { --toast-accent: var(--info); }
.toast.is-leaving { opacity: 0; transform: translateX(8px); transition: opacity .2s ease, transform .2s ease; }
.toast-icon { flex: none; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; color: var(--toast-accent); background: color-mix(in srgb, var(--toast-accent) 14%, transparent); }
.toast-icon svg { width: 16px; height: 16px; }
.toast-body { flex: 1; min-width: 0; padding-top: 4px; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.toast-close { flex: none; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--t-light); display: grid; place-items: center; cursor: pointer; }
.toast-close:hover { background: var(--bg-hover); color: var(--t-base); }
.toast-close:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.toast-close svg { width: 15px; height: 15px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (max-width: 720px) { .toast-region { top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); right: 12px; left: 12px; width: auto; } }
@media print { .toast-region { display: none; } }

/* ---------- empty states ---------- */
.empty-state { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 32px 16px; }
.empty-state .es-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--bg-muted); color: var(--t-light); margin-bottom: 4px; }
.empty-state .es-icon svg { width: 22px; height: 22px; }
.empty-state .es-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--t-base); }
.empty-state .es-reason { margin: 0; max-width: 48ch; font-size: 13.5px; line-height: 1.5; color: var(--t-muted); text-align: center; padding: 0; }
.empty-state .btn { margin-top: 10px; }
.empty-state--compact { padding: 18px 12px; }
.empty-state--compact .es-icon { width: 36px; height: 36px; border-radius: 11px; }
.empty-state--compact .es-icon svg { width: 18px; height: 18px; }
td.empty-cell { padding: 0 !important; text-align: center; }
.table tbody tr:hover td.empty-cell { background: transparent; }

/* ---------- loading skeletons ---------- */
.skeleton, .echart:not([data-chart-ready])::before {
  display: block; border-radius: 10px;
  background: linear-gradient(90deg, var(--bg-muted) 0%, color-mix(in srgb, var(--bg-muted) 45%, var(--bg-card)) 50%, var(--bg-muted) 100%); background-size: 220% 100%;
  animation: skeleton-shimmer 1.4s linear infinite;
}
.echart:not([data-chart-ready])::before { content: ""; width: 100%; height: 100%; min-height: 160px; }
.skeleton--line { height: 14px; margin: 8px 0; }
.skeleton--block { height: 120px; }
@keyframes skeleton-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }

/* ---------- stale data (live.js adds .is-stale to the pill when the numbers stopped updating) ---------- */
.live-pill.is-stale { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 40%, var(--border)); }
.live-pill.is-stale .live-dot { background: var(--warning); animation: none; }

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .toast.is-leaving { transition: none; }
  .skeleton, .echart:not([data-chart-ready])::before { animation: none; }
}

/* ---------- error pages ---------- */
.error-panel { display: grid; justify-items: center; text-align: center; gap: 10px; padding: clamp(40px, 9vh, 96px) 16px; }
.error-code { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(64px, 14vw, 128px); line-height: 1; letter-spacing: -.04em; color: var(--primary); }
.error-title { margin: 0; font-size: clamp(22px, 3.4vw, 30px); letter-spacing: -.02em; }
.error-message { margin: 0; max-width: 52ch; font-size: 15px; line-height: 1.6; color: var(--t-muted); }
.error-actions { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.error-details { margin: 8px 0 0; font-size: 12.5px; color: var(--t-light); font-family: var(--font-mono); overflow-wrap: anywhere; }
.error-card .error-panel { padding: 24px 8px; }

/* ---------- "needs attention" strip (dashboard) ---------- */
.attention { margin-bottom: 20px; }
.attention-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.attention-head h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: 0; color: var(--t-base); }
.attention-count { min-width: 22px; padding: 0 7px; border-radius: var(--radius-pill); background: var(--danger-soft); color: var(--danger); font-size: 12px; font-weight: 700; text-align: center; }
.attention-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.attention-item {
  --tone: var(--warning); --tone-soft: var(--warning-soft);
  display: flex; align-items: center; gap: 12px; height: 100%; padding: 12px 14px; color: var(--t-base); text-decoration: none;
  background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--tone); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.attention-item--danger { --tone: var(--danger); --tone-soft: var(--danger-soft); }
a.attention-item:hover { background: var(--bg-hover); }
a.attention-item:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.attention-icon { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--tone-soft); color: var(--tone); }
.attention-item .attention-icon svg { width: 17px; height: 17px; }
.attention-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.attention-text strong { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.attention-text span { font-size: 12.5px; color: var(--t-muted); line-height: 1.4; }
.attention-go { flex: none; width: 16px; height: 16px; color: var(--t-light); }
.attention--clear { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-card); color: var(--t-muted); font-size: 13.5px; }
.attention--clear .attention-icon { width: 26px; height: 26px; border-radius: 8px; background: var(--success-soft); color: var(--success); }
.attention--clear .attention-icon svg { width: 15px; height: 15px; }
