/* Painel Admin — só o que é específico destas telas. Tudo o que é genérico
   (botão, campo, tabela, badge, dialog, shell…) vem do design system em
   vendor/price-ds/price-ds.css. Mesmas regras: só tokens semânticos. */

/* --- Login x app sem piscar (data-auth vem do snippet do <head>) --------- */
:root[data-auth="out"] #appView,
:root[data-auth="in"] #loginView { display: none; }
#main:focus { outline: none; }
.page[hidden] { display: none; }

/* --- Shell ----------------------------------------------------------------- */
.sidebar__busy { width: 12px; height: 12px; margin-left: auto; border-width: 1.5px; }
.sidebar__busy + .count { margin-left: var(--space-1); }
.sidebar__collapse { width: 100%; }
.user-button__name { font-size: var(--text-sm); font-weight: var(--weight-medium); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .user-button__name { display: none; } }

/* --- Tabelas ----------------------------------------------------------------- */
.entity__link { color: var(--color-text); text-decoration: none; }
.entity__link:hover { text-decoration: underline; text-underline-offset: 2px; }
.entity__url { display: block; color: var(--color-text-tertiary); text-decoration: none; max-width: 48ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity__url:hover { color: var(--color-text-secondary); text-decoration: underline; }
.table-foot { margin-top: var(--space-2); font-size: var(--text-xs); color: var(--color-text-tertiary); font-variant-numeric: var(--font-numeric); }
.table-foot:empty { display: none; }
.table__state:hover { background: transparent !important; }
.table__state td { height: auto; white-space: normal; }
.table tbody tr.is-stale .entity__name { color: var(--color-text-secondary); }
.price-cell { line-height: var(--leading-snug); }
.btn--danger-icon:hover:not(:disabled) { color: var(--color-danger-fg); background: var(--color-danger-bg); }
.job-error { color: var(--color-danger-fg); margin-top: 2px; max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 680px) {
  .table__state td { padding: 0; }
  .table tbody tr.table__state { display: block; padding: 0; }
}

/* --- Mercados: recarregar -------------------------------------------------- */
#mkReload:not(:empty) { margin-bottom: var(--stack-md); } /* bloco da página antes das abas */
.reload-banner .banner__body { min-width: 0; }
.spin { animation: ds-spin 1.4s linear infinite; }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* --- Drawer do mercado ------------------------------------------------------- */
.color-field { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.color-field__picker { width: 44px; height: var(--control-md); padding: var(--space-0-5); flex: none; }
.color-field .field__hint { flex-basis: 100%; }
.links-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.links-box { display: flex; flex-direction: column; gap: var(--space-2); }
.links-box__count:empty { display: none; }
.links-list { max-height: 296px; overflow-y: auto; overscroll-behavior: contain; } /* layout/espaço: .list--boxed .list--divided .list--sm */
.links-list__row:hover { background: var(--color-bg-subtle); }
.links-list__row--confirm, .links-list__row--confirm:hover { background: var(--color-danger-bg); }
.links-list__ask { color: var(--color-danger-fg); font-weight: var(--weight-medium); }
.links-list__url { font-size: var(--text-sm); color: var(--color-text-secondary); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.links-list__url:hover { color: var(--color-text); text-decoration: underline; }
.links-list__remove:hover:not(:disabled) { color: var(--color-danger-fg); background: var(--color-danger-bg); }
.links-add { display: flex; gap: var(--space-2); }
.links-add .input { flex: 1; }

/* --- Coleta ---------------------------------------------------------------- */
.collect-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: var(--space-5); align-items: start; }
@media (max-width: 1000px) { .collect-layout { grid-template-columns: 1fr; } }
.help-card > summary { border-bottom: 0; gap: var(--space-2); justify-content: flex-start; }
.help-card[open] > summary { border-bottom: 1px solid var(--color-border); }
.help-card__tip { padding-block-start: 0; }
.step-n {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: var(--radius-full);
  border: 1px solid var(--color-border-strong); font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-text-secondary);
}
.step-text { font-size: var(--text-sm); color: var(--color-text-secondary); }

.job-card--failed { border-color: var(--color-danger-border); }
.job-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--stack-xs) var(--inline-sm); font-size: var(--text-xs); color: var(--color-text-tertiary); }
.job-steps__item { display: flex; align-items: center; gap: var(--space-1-5); white-space: nowrap; }
.job-steps__item + .job-steps__item::before { content: ""; width: 20px; height: 1px; background: var(--color-border-strong); margin-right: var(--space-1); }
@media (max-width: 420px) { .job-steps__item + .job-steps__item::before { display: none; } }
.job-steps__dot { display: grid; place-items: center; width: 18px; height: 18px; border-radius: var(--radius-full); border: 1.5px solid var(--color-border-strong); color: var(--color-text-on-accent); }
.job-steps__item.is-current { color: var(--color-text); font-weight: var(--weight-medium); }
.job-steps__item.is-current .job-steps__dot { border-color: var(--color-accent); box-shadow: inset 0 0 0 3px var(--color-surface), inset 0 0 0 9px var(--color-accent); }
.job-steps__item.is-done { color: var(--color-text-secondary); }
.job-steps__item.is-done .job-steps__dot { background: var(--color-success-fg); border-color: var(--color-success-fg); }
.job-steps__item.is-failed { color: var(--color-danger-fg); font-weight: var(--weight-medium); }
.job-steps__item.is-failed .job-steps__dot { background: var(--color-danger-solid); border-color: var(--color-danger-solid); }
.job-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); margin: 0; }
.job-stats div { padding: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.job-stats dt { font-size: var(--text-xs); color: var(--color-text-secondary); }
.job-stats dd { margin: var(--space-1) 0 0; font-size: var(--text-xl); font-weight: var(--weight-semibold); }

/* --- Revisão do catálogo ----------------------------------------------------- */
.review-bar { margin-bottom: var(--stack-md); font-size: var(--text-sm); color: var(--color-text-secondary); } /* layout vem de .split */
.review-bar strong { color: var(--color-text); font-weight: var(--weight-semibold); }
.review-compare { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: var(--space-4); align-items: stretch; }
.review-side { padding: var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-bg-subtle); min-width: 0; }
.review-side__label { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-text-tertiary); margin-bottom: var(--space-2); }
.review-side__name { font-size: var(--text-lg); font-weight: var(--weight-medium); line-height: var(--leading-snug); overflow-wrap: anywhere; }
.review-offers { margin-top: var(--stack-md); padding-top: var(--stack-md); border-top: 1px dashed var(--color-border-strong); color: var(--color-text-secondary); } /* espaço entre linhas: .list--spaced */
.review-offers .list__end { color: var(--color-text); }
.review-vs { align-self: center; display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-full); border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-tertiary); }
mark.diff { background: var(--color-warning-bg); color: inherit; border-radius: var(--radius-xs); box-shadow: 0 0 0 2px var(--color-warning-bg); text-decoration: underline; text-decoration-color: var(--color-warning-fg); text-underline-offset: 3px; }
.review-actions { flex-wrap: wrap; }
@media (max-width: 760px) {
  .review-compare { grid-template-columns: 1fr; }
  .review-vs { justify-self: center; transform: rotate(90deg); }
  .review-actions .form-actions__start { flex-basis: 100%; }
  .review-actions .btn { flex: 1; }
  .review-actions .kbd { display: none; }
}
.queue-n { width: 20px; font-size: var(--text-xs); color: var(--color-text-tertiary); }
.queue-vs { max-width: 45%; font-size: var(--text-sm); }

/* --- Contas ------------------------------------------------------------------ */
.mono-input[type="text"] { font-family: var(--font-mono); letter-spacing: 0.02em; }
.result-card { border-color: var(--color-success-border); }
.result-card__icon { width: 18px; height: 18px; color: var(--color-success-fg); }
.secret-value { padding: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-bg-subtle); font-size: var(--text-md); letter-spacing: 0.02em; overflow-wrap: anywhere; user-select: all; }
.table-foot-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-2); }
.table-foot-row .table-foot { margin-top: 0; }

/* --- Dono do mercado (drawer do mercado) -------------------------------------- */
.owner-box { display: flex; flex-direction: column; gap: var(--space-2); }

/* --- Atividade ----------------------------------------------------------------- */
.activity__icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-full); background: var(--color-bg-subtle); color: var(--color-text-secondary); flex: none; }
.activity__icon svg { width: 16px; height: 16px; }
.activity__actor { font-weight: var(--weight-medium); color: var(--color-text); }
.activity__sep { color: var(--color-text-tertiary); }
.activity__target { color: var(--color-text-secondary); text-decoration: underline; text-underline-offset: 2px; } /* sublinhado: o link não depende só da cor */
a.activity__target:hover { color: var(--color-text); }

/* --- Visão geral -------------------------------------------------------------- */
.attention-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-3); }
.attention-card { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); }
.attention-card__top { display: flex; align-items: center; gap: var(--space-2); }
.attention-card__icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-md); background: var(--color-bg-subtle); color: var(--color-text-tertiary); }
.attention-card__icon svg { width: 16px; height: 16px; }
.attention-card__label { font-size: var(--text-sm); color: var(--color-text-secondary); }
.attention-card__go { width: 14px; height: 14px; margin-left: auto; color: var(--color-text-tertiary); opacity: 0; transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.attention-card:hover .attention-card__go, .attention-card:focus-visible .attention-card__go { opacity: 1; transform: translate(1px, -1px); }
.attention-card__hint { display: flex; align-items: center; gap: var(--space-1); font-size: var(--text-xs); color: var(--color-text-tertiary); }
.attention-card--accent .attention-card__icon { background: var(--color-accent-subtle); color: var(--color-accent-text); }
.attention-card--warning .attention-card__icon { background: var(--color-warning-bg); color: var(--color-warning-fg); }
.attention-card--danger .attention-card__icon { background: var(--color-danger-bg); color: var(--color-danger-fg); }
.attention-card--danger .stat__value { color: var(--color-danger-fg); }

/* --- Folha de atalhos ---------------------------------------------------------- */
.shortcuts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-5) var(--space-8); }
.shortcuts-grid__title { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-text-tertiary); margin-bottom: var(--space-2); }
.shortcuts-grid__list { margin: 0; display: grid; gap: var(--space-1); }
.shortcuts-grid__list div { display: flex; align-items: center; justify-content: space-between; gap: var(--inline-md); min-height: var(--control-sm); font-size: var(--text-sm); }
.shortcuts-grid__list div + div { border-top: 1px solid var(--color-border); padding-top: var(--space-1); }
.shortcuts-grid__list dd { margin: 0; display: flex; gap: var(--space-1); }

/* --- Uso do app: gráficos de linha (spec 015, fase D) ------------------------------
   Uma série por gráfico, no azul do DS. Validado com a skill dataviz: o azul 600
   passa de 3:1 no claro; no escuro ele dá 2,9:1, então a série sobe para o 500. */
.usage { --usage-series: var(--color-accent); }
:root[data-theme="dark"] .usage { --usage-series: var(--blue-500); }
.usage [aria-busy="true"] { opacity: 0.6; transition: opacity 0.15s; }
.usage-chart-wrap { position: relative; margin-top: var(--space-4); border-radius: var(--radius-md); }
.usage-chart { display: block; width: 100%; height: auto; }
.usage-chart__grid { stroke: var(--color-border); stroke-width: 1; }
.usage-chart__axis { fill: var(--color-text-tertiary); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.usage-chart__area { fill: var(--usage-series); opacity: 0.1; }
.usage-chart__line { fill: none; stroke: var(--usage-series); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.usage-chart__dot, .usage-chart__hover { fill: var(--usage-series); stroke: var(--color-surface); stroke-width: 2; }
.usage-chart__cross { stroke: var(--color-border-strong); stroke-width: 1; }
.usage-chart__cross, .usage-chart__hover { opacity: 0; }
.usage-chart-wrap.is-active .usage-chart__cross, .usage-chart-wrap.is-active .usage-chart__hover { opacity: 1; }
.usage-tip {
  position: absolute; top: var(--space-1); left: var(--tip-x, 50%); transform: translateX(-50%); z-index: 1;
  display: none; flex-direction: column; gap: var(--space-0-5); padding: var(--space-2) var(--space-3);
  background: var(--color-surface-raised); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); pointer-events: none; white-space: nowrap;
}
.usage-chart-wrap.is-active .usage-tip { display: flex; }
.usage-tip__value { font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--color-text); }
.usage-tip__day { font-size: var(--text-xs); color: var(--color-text-secondary); }
.usage-table summary { cursor: pointer; padding-block: var(--space-2); }
@media (forced-colors: active) {
  .usage-chart__line { stroke: CanvasText; }
  .usage-chart__area, .usage-chart__dot, .usage-chart__hover { fill: CanvasText; }
}

/* --- Seleção e ações em lote (spec 015, fase D) --------------------------------- */
.table__check { width: 40px; }
.table tbody tr.is-selected { background: var(--color-accent-subtle); }
.bulk-bar {
  position: sticky; top: calc(var(--topbar-height) + var(--space-2)); z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3);
  margin-block: var(--space-3); padding: var(--space-2) var(--space-3);
  background: var(--color-surface-raised); border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
}
.bulk-bar__actions, .bulk-bar__progress { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.bulk-bar__progress { color: var(--color-text-secondary); font-size: var(--text-sm); }
