/* ==========================================================================
   BI Vendas — design system "Data-Dense Dashboard"
   Tokens semânticos, tema claro/escuro via [data-theme], mobile-first.
   ========================================================================== */

:root {
  --font-sans: 'Fira Sans';
  --font-mono: 'Nunito';
  --font-ui: var(--font-sans), system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-num: var(--font-mono), var(--font-sans), system-ui, sans-serif;

  /* Espaçamento (escala 4/8) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;
  --tap: 44px;

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --t-fast: 150ms;
  --t-med: 250ms;
}

:root, :root[data-theme='light'] {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --border: #d8e0ec;
  --border-strong: #b9c5d9;
  --text: #0f1b3d;
  --text-2: #3b4a6b;
  --muted: #55658a;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --on-primary: #ffffff;
  --primary-soft: #e3eafd;
  --success: #047857; --success-soft: #dcf5ea;
  --warning: #b45309; --warning-soft: #fdf0d8;
  --danger: #b91c1c;  --danger-soft: #fde4e4;
  --info: #0e7490;    --info-soft: #d9f1f6;
  --overlay: rgba(15, 27, 61, 0.45);
  --shadow: 0 1px 2px rgba(15, 27, 61, 0.06), 0 4px 16px -6px rgba(15, 27, 61, 0.12);
  --shadow-lg: 0 24px 60px -12px rgba(15, 27, 61, 0.35);
  --focus: #1d4ed8;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0a1020;
  --surface: #121a2f;
  --surface-2: #1a2440;
  --border: #2a3658;
  --border-strong: #3d4c78;
  --text: #eaf0ff;
  --text-2: #b7c3e0;
  --muted: #94a3c7;
  --primary: #7aa5ff;
  --primary-hover: #9bbcff;
  --on-primary: #0a1020;
  --primary-soft: #1b2b57;
  --success: #34d399; --success-soft: #11382f;
  --warning: #fbbf24; --warning-soft: #3d3010;
  --danger: #fb7185;  --danger-soft: #431a27;
  --info: #22d3ee;    --info-soft: #0f3340;
  --overlay: rgba(2, 6, 18, 0.65);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px -8px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, 0.7);
  --focus: #9bbcff;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; text-align: inherit; }
h1, h2, h3, h4 { line-height: 1.25; font-weight: 600; }
ul { list-style: none; padding: 0; }
dl, dd { margin: 0; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.mono { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.pad { padding: var(--s-3); }
.block { display: block; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.wrap { white-space: normal; overflow-wrap: anywhere; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.flip { transform: rotate(180deg); }
.flip90 { transform: rotate(90deg); }
.icon { flex-shrink: 0; }

.skip { position: absolute; left: var(--s-4); top: -100px; z-index: 200; background: var(--primary); color: var(--on-primary); padding: var(--s-2) var(--s-4); border-radius: var(--r-md); font-weight: 600; }
.skip:focus { top: var(--s-2); }

/* ---------- Estrutura ---------- */
.shell {
  width: 100%; max-width: 1720px; margin: 0 auto;
  padding: var(--s-4) max(var(--s-4), env(safe-area-inset-right)) calc(var(--s-8) + 88px) max(var(--s-4), env(safe-area-inset-left));
}
.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.layout { display: grid; gap: var(--s-4); grid-template-columns: minmax(0, 1fr); align-items: start; }
.col-main, .col-side { min-width: 0; display: flex; flex-direction: column; gap: var(--s-3); }
@media (min-width: 900px) { .shell { padding-top: var(--s-6); } }
@media (min-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr) clamp(380px, 29vw, 520px); gap: var(--s-5); }
  .col-side { position: sticky; top: 76px; }
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 1720px; margin: 0 auto; min-height: 60px;
  padding: var(--s-2) max(var(--s-4), env(safe-area-inset-right)) var(--s-2) max(var(--s-4), env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
}
.topbar-brand { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.topbar-logo { height: 32px; width: auto; object-fit: contain; }
:root[data-theme='light'] .topbar-logo { filter: invert(1) brightness(0.25); }
.topbar-ctx { font-weight: 600; color: var(--text-2); font-size: 0.9375rem; padding-left: var(--s-3); border-left: 1px solid var(--border-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: var(--s-2); }
.progress { height: 3px; background: var(--primary-soft); overflow: hidden; position: relative; }
.progress[hidden] { display: none; }
.progress::after { content: ''; position: absolute; inset: 0; width: 35%; background: var(--primary); animation: slide 1.1s var(--ease) infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--tap); padding: 0 var(--s-4);
  border-radius: var(--r-md); border: 1px solid transparent;
  font-weight: 600; font-size: 0.9375rem; text-align: center;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn[aria-busy='true'] { cursor: progress; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-soft { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-soft:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-2); }
.btn-ghost { border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.icon-btn {
  display: inline-grid; place-items: center; width: var(--tap); height: var(--tap);
  border-radius: var(--r-md); color: var(--text-2);
  transition: background-color var(--t-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.avatar {
  width: var(--tap); height: var(--tap); border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 0.8125rem;
  background: var(--primary-soft); color: var(--primary); border: 1px solid var(--border);
}

/* ---------- Cartões e métricas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: var(--s-4); min-width: 0; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { margin-bottom: var(--s-3); }
.card-head-split { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-3); }
.card-title { font-size: 1.0625rem; }
.card-sub { font-size: 0.875rem; color: var(--muted); margin-top: 2px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }

.card-hero { background: linear-gradient(160deg, var(--primary-soft), var(--surface) 70%); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.hero-top { display: flex; justify-content: space-between; gap: var(--s-4); align-items: flex-start; flex-wrap: wrap; }
.hero-title { display: grid; gap: 2px; justify-items: start; }
.hero-meta { display: grid; gap: 2px; text-align: right; font-weight: 600; color: var(--text-2); font-size: 0.9375rem; }
.hero-value { font-size: clamp(1.9rem, 7vw, 2.75rem); font-weight: 700; margin-top: var(--s-3); line-height: 1.1; overflow-wrap: anywhere; }
.kpi-label { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.delta { display: inline-flex; align-items: center; gap: 6px; margin-top: var(--s-2); font-weight: 600; font-size: 0.9375rem; color: var(--muted); }
.delta.is-up { color: var(--success); }
.delta.is-down { color: var(--danger); }

.metric-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: var(--s-4); }
.metric-grid > :first-child { grid-column: 1 / -1; }
@media (min-width: 640px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric-grid > :first-child { grid-column: auto; }
}
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); box-shadow: var(--shadow); border-left: 4px solid var(--border-strong); min-width: 0; }
.metric-success { border-left-color: var(--success); }
.metric-warning { border-left-color: var(--warning); }
.metric-danger { border-left-color: var(--danger); }
.metric dt { display: flex; align-items: center; gap: 6px; font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
.metric dd { font-size: 1.25rem; font-weight: 600; margin-top: 4px; overflow-wrap: anywhere; }
.metric-hint { font-size: 0.8125rem; color: var(--muted); margin-top: 2px; font-weight: 400; font-family: var(--font-ui); }

/* ---------- Controles ---------- */
.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: var(--r-md); }
.seg-item {
  flex: 1 1 auto; min-height: 40px; padding: 0 var(--s-3); border-radius: var(--r-sm);
  font-size: 0.875rem; font-weight: 600; color: var(--muted); white-space: nowrap; text-align: center;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.seg-item:hover { color: var(--text); }
.seg-item[aria-selected='true'] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.toolbar { display: grid; gap: var(--s-3); }
@media (min-width: 640px) { .toolbar { grid-template-columns: minmax(0, 1fr) auto; align-items: center; } }

.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-size: 0.875rem; font-weight: 600; color: var(--text-2); }
.field-hint { font-size: 0.8125rem; color: var(--muted); }
input[type='text'], input[type='search'] {
  width: 100%; min-height: var(--tap); padding: 0 var(--s-3);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  font-size: 1rem; color: var(--text);
}
input.num { font-family: var(--font-num); font-weight: 700; font-variant-numeric: tabular-nums; }
input::placeholder { color: var(--muted); opacity: 1; }
input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
input[aria-invalid='true'] { border-color: var(--danger); }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 44px; }

.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 var(--s-3); border-radius: var(--r-pill); font-size: 0.8125rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.chip-primary { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.chip-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.chip-warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.chip-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.chip-neutral { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }

.alert { padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--danger-soft); color: var(--danger); font-weight: 600; font-size: 0.9375rem; border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); display: flex; gap: var(--s-3); align-items: flex-start; }
.ok-banner { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); }

/* ---------- Itens ---------- */
.item-list { display: flex; flex-direction: column; gap: var(--s-3); }
.item {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow); padding: var(--s-4); min-width: 0;
  display: grid; gap: var(--s-3);
}
.item[hidden] { display: none; }
.item-desconto { border-left-color: var(--warning); }
.item-adicional { border-left-color: var(--success); }
.item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-3); flex-wrap: wrap; }
.item-name { font-size: 1.0625rem; overflow-wrap: anywhere; }
.item-body { display: grid; gap: var(--s-4); }
@media (min-width: 720px) { .item-body { grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); align-items: start; } }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--s-2); }
.fact { background: var(--surface-2); border-radius: var(--r-md); padding: var(--s-2) var(--s-3); min-width: 0; }
.fact dt { font-size: 0.8125rem; color: var(--muted); font-weight: 600; }
.fact dd { font-size: 1.0625rem; font-weight: 600; overflow-wrap: anywhere; }
.fact-promo { background: var(--danger-soft); }
.fact-promo dt, .fact-promo dd { color: var(--danger); }
.item-info { display: grid; gap: var(--s-3); min-width: 0; }
.edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
@media (max-width: 340px) { .edit-grid { grid-template-columns: minmax(0, 1fr); } }
.item-status { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; font-size: 0.9375rem; color: var(--text-2); }
.item-reset { min-height: 36px; color: var(--primary); font-weight: 600; font-size: 0.875rem; padding: 0 var(--s-2); border-radius: var(--r-sm); }
.item-reset:hover { background: var(--primary-soft); }
.item-reset[hidden] { display: none; }

/* ---------- Carrossel de fotos ---------- */
.viewer { position: relative; width: 100%; height: 180px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; user-select: none; }
@media (min-width: 720px) { .viewer { height: 200px; } }
.viewer img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.viewer img[hidden] { display: none; }
.viewer-empty { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: var(--s-2); color: var(--muted); font-size: 0.875rem; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow); }
.viewer-nav:hover { background: var(--surface); }
.viewer-prev { left: var(--s-2); }
.viewer-next { right: var(--s-2); }
.viewer-count { position: absolute; bottom: var(--s-2); right: var(--s-2); padding: 2px var(--s-2); border-radius: var(--r-pill); background: var(--overlay); color: #fff; font-size: 0.75rem; font-weight: 600; }

/* ---------- Pagamentos ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.data-table th { text-align: left; font-size: 0.8125rem; font-weight: 600; color: var(--muted); padding: var(--s-2) var(--s-2); border-bottom: 1px solid var(--border); }
.data-table td { padding: var(--s-3) var(--s-2); border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .num-col { text-align: right; }
.data-table tfoot td { font-weight: 700; border-top: 2px solid var(--border-strong); border-bottom: 0; }
.table-scroll { overflow-x: auto; }

/* ---------- Barra de ação fixa ---------- */
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -6px 20px -10px rgba(15, 27, 61, 0.25);
  padding: var(--s-3) max(var(--s-4), env(safe-area-inset-right)) calc(var(--s-3) + env(safe-area-inset-bottom)) max(var(--s-4), env(safe-area-inset-left));
}
.action-bar[hidden] { display: none; }
.action-inner { max-width: 1720px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.action-total { display: grid; min-width: 0; }
.action-total .mono { font-size: 1.25rem; line-height: 1.2; }
.action-btns { display: flex; gap: var(--s-2); }

/* ---------- Modal e aviso rápido ---------- */
.modal { border: 0; border-radius: var(--r-lg); padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(92vw, 440px); margin: auto; }
.modal::backdrop { background: var(--overlay); }
.modal-body { padding: var(--s-6); display: grid; gap: var(--s-3); }
.modal-body h2 { font-size: 1.125rem; }
.modal-actions { display: flex; gap: var(--s-3); justify-content: flex-end; margin-top: var(--s-2); flex-wrap: wrap; }
.summary { display: grid; gap: var(--s-2); background: var(--surface-2); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); }
.summary div { display: flex; justify-content: space-between; gap: var(--s-3); font-size: 0.9375rem; }
.summary dt { color: var(--muted); font-weight: 600; }
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 120;
  max-width: min(92vw, 420px); padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  background: var(--text); color: var(--bg); font-weight: 600; font-size: 0.9375rem; box-shadow: var(--shadow-lg);
  animation: rise-in 260ms var(--ease) both;
}
.toast[hidden] { display: none; }

/* ---------- Mobile (uso principal) ---------- */
@media (max-width: 599px) {
  .shell { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  .topbar-ctx { padding-left: var(--s-2); font-size: 0.875rem; }
  .topbar-logo { height: 26px; }
  .avatar { display: none; }
  .hero-meta { text-align: left; }
  .hero-top { flex-direction: column; gap: var(--s-2); }
  .item { padding: var(--s-3); }
  .facts { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: var(--s-2); }
  .fact { padding: var(--s-2); }
  .fact dd { font-size: 1rem; }
  .viewer { height: 200px; }
  .viewer-nav { width: 44px; height: 44px; }
  .item-reset { min-height: var(--tap); }
  .seg { width: 100%; }
  .seg-item { min-height: var(--tap); }
  .action-inner { flex-direction: column; align-items: stretch; gap: var(--s-2); }
  .action-total { display: flex; justify-content: space-between; align-items: baseline; }
  .action-btns .btn { flex: 1; }
  .action-btns .btn-primary { flex: 2; }
  .toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
  /* Diálogo como folha na base da tela, ao alcance do polegar */
  .modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0; animation: sheet-up 260ms var(--ease) both; }
  .modal-body { padding: var(--s-5) var(--s-4) calc(var(--s-5) + env(safe-area-inset-bottom)); }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Estados ---------- */
.empty-state { text-align: center; padding: 14vh var(--s-4) 0; display: grid; gap: var(--s-4); justify-items: center; max-width: 480px; margin: 0 auto; }
.empty-state h2 { font-size: 1.25rem; }
.empty-state p { color: var(--muted); }
.empty-card { text-align: center; color: var(--muted); padding: var(--s-6) var(--s-4); }
.skeleton { border-radius: var(--r-md); background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ---------- Movimento ---------- */
@keyframes rise-in { from { opacity: 0; transform: translateY(16px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes expand-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }
.stack > * { animation: rise-in 520ms var(--ease) both; }
.stack > *:nth-child(2) { animation-delay: 60ms; }
.stack > *:nth-child(3) { animation-delay: 120ms; }
.item { animation: rise-in 360ms var(--ease) both; }
.item:nth-child(2) { animation-delay: 30ms; }
.item:nth-child(3) { animation-delay: 60ms; }
.item:nth-child(4) { animation-delay: 90ms; }
.item:nth-child(n+5) { animation-delay: 120ms; }
.metric-grid > * { animation: rise-in 480ms var(--ease) both; }
.metric-grid > *:nth-child(2) { animation-delay: 60ms; }
.metric-grid > *:nth-child(3) { animation-delay: 120ms; }
.topbar { animation: expand-in 400ms var(--ease) both; }
.chip { animation: pop-in 260ms var(--ease) both; }
.card, .metric, .item { transition: transform var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease), border-color var(--t-fast) var(--ease); }
@media (hover: hover) {
  .metric:hover, .item:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .progress::after { width: 100%; transform: none; opacity: 0.5; }
}
