/* Watch Vault — design escuro, foto como protagonista, sem framework de CSS. */

* {
  box-sizing: border-box;
}

:root {
  --color-bg: #0b0b0d;
  --color-bg-elevated: #1c1c20;
  --color-surface: #17171b;
  --color-border: rgba(255, 255, 255, 0.09);
  --color-border-strong: rgba(255, 255, 255, 0.22);
  --color-accent: #c9a24b;
  --color-text: #f2f0ea;
  --color-text-muted: #9b978c;
  --color-warning: #b8873a;
  --color-danger: #c0483f;
  --color-success: #7fb894;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  --tabbar-height: 64px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h2 {
  font-size: 1.1rem;
  font-weight: 800;
  margin: var(--sp-5) 0 var(--sp-3);
}

h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin: var(--sp-3) 0 6px;
}

button,
input,
select,
textarea {
  font-family: inherit;
  color: inherit;
}

a {
  color: var(--color-accent);
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------- */
/* Shell                                                                   */
/* ---------------------------------------------------------------------- */

#app {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--sp-4) + env(safe-area-inset-top)) var(--sp-4)
    calc(var(--tabbar-height) + var(--sp-6) + env(safe-area-inset-bottom));
}

.screen {
  max-width: 640px;
  margin: 0 auto;
}

.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.screen-header h1 {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.screen-header--detalhe {
  justify-content: flex-start;
}

.screen-header--detalhe h1 {
  font-size: 1.2rem;
}

.back-btn {
  all: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-left: -10px;
  color: var(--color-text);
  cursor: pointer;
  flex-shrink: 0;
}

.back-btn svg {
  width: 24px;
  height: 24px;
}

/* ---------------------------------------------------------------------- */
/* Botões e links                                                         */
/* ---------------------------------------------------------------------- */

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 700;
  min-height: 44px;
  cursor: pointer;
  background: var(--color-surface);
  color: var(--color-text);
  transition: transform 0.05s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
}

.btn--primary {
  background: var(--color-accent);
  color: #1a1408;
  border-color: var(--color-accent);
}

.btn--secondary {
  background: transparent;
  border-color: var(--color-border-strong);
}

.btn--danger {
  background: transparent;
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.btn--block {
  width: 100%;
  display: block;
  margin-top: var(--sp-2);
}

.btn--small {
  padding: 8px 14px;
  min-height: 40px;
  font-size: 0.85rem;
}

.link-btn {
  all: unset;
  color: var(--color-accent);
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
}

.link-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.link-btn--muted {
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.8rem;
  min-height: 44px;
}

/* ---------------------------------------------------------------------- */
/* Formulários                                                            */
/* ---------------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--sp-4);
}

.field > span {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input,
select,
textarea {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 1rem;
  min-height: 44px;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.field--radio-group {
  border: none;
  padding: 0;
  margin: 0 0 var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.field--radio-group legend {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0;
  margin-bottom: 4px;
}

.radio-option,
.checkbox-option {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 12px 14px;
  min-height: 44px;
  font-size: 0.95rem;
}

.radio-option input,
.checkbox-option input {
  width: 20px;
  height: 20px;
  min-height: auto;
  flex-shrink: 0;
  accent-color: var(--color-accent);
}

.checkbox-option {
  margin-bottom: var(--sp-4);
}

.field-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin: calc(var(--sp-4) * -1 + 4px) 0 var(--sp-4);
}

/* FASE 7E: aviso dentro de uma seção, não de um campo. Cor de AVISO e não de
   erro: peça sem número de série não é defeito de preenchimento, é um limite do
   que o dossiê consegue provar. Fundo com transparência para não competir com a
   faixa de sem conexão, que é sólida e fica no topo. */
.field-warning {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--color-warning);
  border-left: 3px solid var(--color-warning);
  background: color-mix(in srgb, var(--color-warning) 10%, transparent);
  padding: var(--sp-2) var(--sp-3);
  margin: 0 0 var(--sp-3);
}

.auth-error {
  color: var(--color-danger);
  font-size: 0.875rem;
  margin: -4px 0 var(--sp-3);
}

.watch-form {
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------------- */
/* Estados: carregando / vazio / erro                                     */
/* ---------------------------------------------------------------------- */

.state {
  text-align: center;
  padding: var(--sp-6) var(--sp-4);
  color: var(--color-text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
}

.state__details {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: -8px;
  word-break: break-word;
}

/* ---------------------------------------------------------------------- */
/* Grid de relógios e card                                                */
/* ---------------------------------------------------------------------- */

.watch-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

@media (min-width: 640px) {
  .watch-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 900px) {
  .watch-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.watch-card {
  background: var(--color-surface);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
}

.watch-card__open {
  all: unset;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  box-sizing: border-box;
  width: 100%;
}

.watch-card__photo {
  aspect-ratio: 1 / 1;
  background: var(--color-bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.watch-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.watch-card__photo--empty {
  color: var(--color-text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.watch-card__info {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.watch-card__brand {
  font-weight: 800;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-card__model {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-card__reference {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.watch-card__action {
  margin: 0 12px 12px;
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  background: none;
  border-radius: 8px;
  padding: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  min-height: 40px;
  cursor: pointer;
}

/* ---------------------------------------------------------------------- */
/* Selos (badges)                                                         */
/* ---------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge--warning {
  background: rgba(184, 135, 58, 0.16);
  color: var(--color-warning);
}

.badge--neutral {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-muted);
  text-transform: none;
  font-weight: 600;
  flex-shrink: 0;
}

.badge--confidence-alto {
  background: rgba(127, 184, 148, 0.16);
  color: var(--color-success);
}

.badge--confidence-medio {
  background: rgba(184, 135, 58, 0.16);
  color: var(--color-warning);
}

.badge--confidence-baixo {
  background: rgba(192, 72, 63, 0.16);
  color: #d98a83;
}

.badge--source-catalog {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-muted);
}

.badge--source-observed {
  background: rgba(201, 162, 75, 0.18);
  color: var(--color-accent);
}

/* ---------------------------------------------------------------------- */
/* Tela de login                                                          */
/* ---------------------------------------------------------------------- */

.auth-screen {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 420px;
  margin: 0 auto;
}

.auth-brand {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--color-accent);
  margin: 0 0 var(--sp-4);
}

.auth-screen h1 {
  font-size: 1.75rem;
  font-weight: 900;
  margin: 0 0 var(--sp-2);
}

.auth-hint {
  color: var(--color-text-muted);
  margin: 0 0 var(--sp-5);
  line-height: 1.5;
}

.auth-form {
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------------- */
/* Tab bar                                                                */
/* ---------------------------------------------------------------------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  z-index: 40;
}

.tabbar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--color-text-muted);
  text-decoration: none;
  min-height: 44px;
}

.tabbar__icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

.tabbar__label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.tabbar__item.is-active {
  color: var(--color-accent);
}

/* ---------------------------------------------------------------------- */
/* Overlays / diálogos                                                    */
/* ---------------------------------------------------------------------- */

.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}

.overlay-sheet {
  background: var(--color-surface);
  width: 100%;
  max-width: 560px;
  border-radius: 20px 20px 0 0;
  padding: var(--sp-5);
  padding-bottom: calc(var(--sp-6) + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.45);
  max-height: 85vh;
  overflow-y: auto;
}

.overlay-sheet h3 {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0 0 var(--sp-3);
}

.overlay-sheet p {
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: var(--sp-4);
}

.overlay-form {
  display: flex;
  flex-direction: column;
}

.overlay-actions {
  display: flex;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}

.overlay-actions .btn {
  flex: 1;
  margin-top: 0;
}

/* ---------------------------------------------------------------------- */
/* Fotos: input escondido, fila de pendentes, galeria                     */
/* ---------------------------------------------------------------------- */

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

.photos-section,
.add-photos-section {
  margin-bottom: var(--sp-3);
}

.pending-photos {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin: var(--sp-3) 0;
}

.pending-photo {
  display: flex;
  gap: var(--sp-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 10px;
  position: relative;
  align-items: flex-start;
}

.pending-photo__thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--color-bg);
}

.pending-photo__meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding-right: 28px;
}

.pending-photo__kind-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.pending-photo__kind-label select {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 0.85rem;
  flex: 1;
}

.pending-photo__status {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.pending-photo--done .pending-photo__status {
  color: var(--color-success);
}

.pending-photo--error .pending-photo__status {
  color: var(--color-danger);
}

.pending-photo__remove {
  all: unset;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
}

.progress-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  transition: width 0.15s ease;
}

.gallery-section {
  margin-bottom: var(--sp-4);
}

.gallery-group {
  margin-bottom: var(--sp-4);
}

.gallery-group__label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin: 0 0 8px;
}

.gallery-strip {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding-bottom: 4px;
}

.gallery-thumb {
  position: relative;
  flex-shrink: 0;
  width: 88px;
  height: 88px;
}

.gallery-thumb__open {
  all: unset;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: var(--color-bg-elevated);
  cursor: pointer;
}

.gallery-thumb__open img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-thumb__remove {
  all: unset;
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}

/* ---------------------------------------------------------------------- */
/* Análises (IA)                                                          */
/* ---------------------------------------------------------------------- */

.analysis-section {
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--color-border);
}

.analysis-section h2 {
  margin-top: 0;
  margin-bottom: 4px;
}

.analysis-triggers {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}

.analysis-history {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.analysis-entry {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: var(--sp-4);
}

.analysis-entry__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
  flex-wrap: wrap;
}

.analysis-entry__title {
  font-weight: 800;
  font-size: 0.95rem;
}

.analysis-entry__meta {
  font-size: 0.68rem;
  color: var(--color-text-muted);
}

.analysis-body ul {
  margin: 0;
  padding-left: 1.2em;
  font-size: 0.9rem;
  line-height: 1.55;
}

.analysis-hint {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-top: var(--sp-3);
}

.analysis-warning {
  font-size: 0.78rem;
  color: var(--color-warning);
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px dashed var(--color-border);
}

.analysis-calibre {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 600;
  margin: var(--sp-2) 0;
}

.candidate-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.candidate {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: var(--sp-3);
}

.candidate__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.candidate__name {
  font-weight: 700;
  font-size: 0.9rem;
}

.candidate__reference,
.candidate__notes {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.checklist__item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.88rem;
  line-height: 1.45;
}

.analysis-price-range {
  font-size: 1.4rem;
  font-weight: 900;
}

.analysis-price-meta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.analysis-price-none {
  font-style: italic;
  color: var(--color-text-muted);
}

/* ---------------------------------------------------------------------- */
/* Zona de risco                                                          */
/* ---------------------------------------------------------------------- */

.danger-zone {
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--color-border);
}

/* ---------------------------------------------------------------------- */
/* FASE 1 — dois acionadores de foto (câmera e galeria) e nota de PIN      */
/* ---------------------------------------------------------------------- */

.photo-source-row {
  display: flex;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}

.photo-source-btn {
  flex: 1;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.9rem;
}

.auth-reset-note {
  margin-top: var(--sp-4);
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* ------------------------------------------------------------------------ */
/* Bloco de identificação (src/ui/identify.js)                              */
/* ------------------------------------------------------------------------ */

.identify-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.identify-block h2 {
  margin-top: 0;
  margin-bottom: var(--sp-2);
  font-size: 1rem;
}

.identify-block__notice {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0 0 var(--sp-3);
}

.identify-form__legend {
  font-size: 0.8rem;
  font-weight: 700;
  margin: 0 0 var(--sp-3);
}

.identify-missing__title {
  font-size: 0.8rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.identify-missing {
  margin: 0 0 var(--sp-4);
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.identify-candidates {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.identify-candidate {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: var(--sp-3);
}

.identify-candidate__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.identify-candidate__name {
  font-weight: 800;
  font-size: 0.95rem;
}

.identify-candidate__ref {
  font-size: 0.8rem;
  margin: 0 0 2px;
}

.identify-candidate__meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin: 0 0 var(--sp-2);
}

/* ---------------------------------------------------------------------- */
/* FASE 2B — resultado ao vivo, ficha rica, preço com fontes, coerência   */
/* ---------------------------------------------------------------------- */

.analysis-live:empty {
  display: none;
}

.analysis-entry--live {
  border-color: var(--color-accent);
}

/* Ficha: lista de campos de catálogo */
.spec-list {
  margin: var(--sp-3) 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px var(--sp-3);
}

.spec-list dt {
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

.spec-list dd {
  margin: 0;
  font-size: 0.9rem;
}

.spec-origin {
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

/* Sinais de alerta e coerência: item em bloco com pares rótulo/valor */
.checklist__item--block {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--color-border);
}

.kv {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

.kv__k {
  color: var(--color-text-muted);
}

.divergence-list {
  margin: 6px 0 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
}

/* Preço: mercado, amostras com links */
.analysis-price-market {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.price-sources {
  margin: 6px 0 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

.price-sources a {
  color: var(--color-accent);
  word-break: break-word;
}

.price-source-meta {
  color: var(--color-text-muted);
}

/* 7A: dominio resolvido pelo servidor. Fica ao lado do nome escrito pelo modelo
   porque so ele tem lastro. */
.price-source-domain {
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

/* Divergencia entre nome da loja e dominio, ou dominio nao confirmado. Aviso,
   nunca veredito: a amostra continua valendo. */
.price-source-warn {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(184, 135, 58, 0.14);
  color: var(--color-warning);
  font-size: 0.78rem;
}

.analysis-search-suggestions,
.analysis-aviso {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: var(--sp-2);
}

/* 7B: conteiner do widget de Search Suggestions do Google. O conteudo vive num
   shadow root, entao NADA daqui atravessa para dentro dele, e e assim que tem de
   ser: os termos da API proibem modificar as Search Suggestions, inclusive a
   aparencia. Aqui so posicionamento e rolagem no eixo x, que sao do conteiner. */
.analysis-search-widget {
  margin-top: var(--sp-1);
  overflow-x: auto;
}

/* Preço por link: textarea de URLs */
.price-link-form {
  margin: var(--sp-3) 0;
  padding: var(--sp-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
}

.price-link-form textarea {
  width: 100%;
  font-family: inherit;
}

.identify-slot {
  margin-top: var(--sp-2);
}

.price-discarded {
  margin: 6px 0 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  word-break: break-word;
}

/* Instrumentos de versão (FASE 2C) */
.versao-app {
  margin: var(--sp-3) 0 var(--sp-2);
  text-align: center;
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

/* FASE 7D: faixa global de sem conexão. Fica no TOPO, ao contrário da
   .update-bar, que fica embaixo — as duas podem aparecer juntas e não devem
   disputar o mesmo espaço. Cor de aviso, não de erro: estar sem rede não é
   defeito do app. */
.offline-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 70;
  margin: 0;
  padding: 10px var(--sp-3);
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  font-size: 0.85rem;
  text-align: center;
  color: var(--color-bg);
  background: var(--color-warning);
}

/* Empurra o app para baixo enquanto a faixa está visível, para ela não cobrir
   cabeçalho nem botão de voltar. A classe entra e sai em src/app.js. */
body.com-faixa-offline {
  padding-top: calc(38px + env(safe-area-inset-top, 0px));
}

.update-bar {
  position: fixed;
  left: var(--sp-3);
  right: var(--sp-3);
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  padding: 12px var(--sp-3);
  font: inherit;
  font-size: 0.85rem;
  text-align: center;
  color: inherit;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

/* --- Perfil e painel de gastos (Bloco 2) --------------------------------- */

.perfil-section {
  margin-bottom: var(--sp-6);
}

.perfil-section h2 {
  font-size: 18px;
  margin-bottom: var(--sp-3);
}

.perfil-section h3 {
  font-size: 15px;
  margin: var(--sp-4) 0 var(--sp-2);
}

.perfil-email {
  font-size: 16px;
  margin-bottom: var(--sp-2);
}

.perfil-nota,
.perfil-buscas {
  color: var(--color-text-muted);
  font-size: 13px;
  margin: var(--sp-2) 0;
}

.perfil-modo {
  color: var(--color-accent);
  font-size: 14px;
  margin: var(--sp-2) 0;
}

.perfil-cards {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin: var(--sp-3) 0;
}

.perfil-card {
  flex: 1 1 140px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.perfil-card__title {
  color: var(--color-text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.perfil-card__value {
  font-size: 20px;
}

.perfil-card__meta {
  color: var(--color-text-muted);
  font-size: 12px;
}

/* Tabela larga rola dentro do próprio contêiner — a página nunca rola na
   horizontal. */
.table-scroll {
  overflow-x: auto;
  margin: var(--sp-2) 0 var(--sp-4);
  border: 1px solid var(--color-border);
  border-radius: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 480px;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.data-table th {
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 12px;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* --- Relatório da coleção (FASE B3) --------------------------------------- */

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

.relatorio-gerado {
  color: var(--color-text-muted);
  font-size: 13px;
  margin: 0 0 var(--sp-4);
}

.relatorio-cards .perfil-card__value {
  font-size: 17px;
  white-space: nowrap;
}

.relatorio-avisos {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin: 0 0 var(--sp-4);
}

.relatorio-avisos p {
  color: var(--color-text-muted);
  font-size: 12px;
}

/* Ações do relatório em barra própria no corpo — no cabeçalho disputavam
   espaço com o título e sumiam no celular. */
.relatorio-acoes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin: var(--sp-3) 0;
}

.relatorio-acoes .btn {
  flex: 1 1 140px;
}

/* Região de rolagem focável: teclado rola a tabela larga sem mouse. */
.table-scroll:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.data-table .cell-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table .cell-main {
  display: block;
}

.data-table .cell-sub {
  display: block;
  margin-top: 2px;
  color: var(--color-text-muted);
  font-size: 11px;
}

.data-table .cell-peca {
  white-space: normal;
  min-width: 150px;
}

.data-table .cell-peca a {
  color: var(--color-text);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-underline-offset: 2px;
}

.data-table .cell-main.is-pos {
  color: var(--color-success);
}

.data-table .cell-main.is-neg {
  color: var(--color-danger);
}

.selo {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 8px;
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  color: var(--color-text-muted);
  font-size: 11px;
}

.selo--warn {
  color: var(--color-warning);
  border-color: var(--color-warning);
}

.data-table tfoot th,
.data-table tfoot td {
  border-top: 1px solid var(--color-border-strong);
  border-bottom: none;
}

.data-table tfoot th {
  color: var(--color-text);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.data-table tfoot .cell-main {
  font-weight: 600;
}

.data-table .tfoot-aviso td {
  border-top: none;
  color: var(--color-text-muted);
  font-size: 12px;
  white-space: normal;
}

/* --- Serviço, documentos e registros (Bloco 4 / FASE 3B) ------------------ */

.servico-section,
.documentos-section,
.dossie-section {
  margin-bottom: var(--sp-6);
}

.registro-list {
  list-style: none;
  padding: 0;
  margin: var(--sp-3) 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.registro-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: var(--sp-3);
}

.registro-item__head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.registro-item__meta {
  color: var(--color-text-muted);
  font-size: 13px;
  flex: 1;
}

.registro-item__nota {
  color: var(--color-text-muted);
  font-size: 13px;
  margin-top: var(--sp-1);
}

.registro-item__remove {
  background: none;
  border: none;
  color: var(--color-danger);
  font-size: 20px;
  line-height: 1;
  padding: var(--sp-2);
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
}

.registro-form {
  margin-top: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

/* --- Busca, filtro e exportação da Coleção -------------------------------- */

.filter-row {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}

.field--inline {
  flex: 1 1 140px;
}

.export-wrap {
  margin-bottom: var(--sp-3);
}

.export-form {
  margin-top: var(--sp-2);
  padding: var(--sp-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.export-form__row {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.offline-banner {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-warning);
  color: var(--color-warning);
  border-radius: 12px;
  padding: var(--sp-3);
  font-size: 13px;
  margin-bottom: var(--sp-3);
}

.screen-header__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* --- Dossiê (FASE 3B.3): nó print-only + folha A4 ------------------------- */

#dossie-print,
#relatorio-print {
  display: none;
}

@media print {
  @page {
    size: A4;
    margin: 14mm;
  }

  /* Um nó print-only por vez: quem imprime remove o do outro antes de gerar. */
  body > *:not(#dossie-print):not(#relatorio-print) {
    display: none !important;
  }

  body {
    background: #fff;
  }

  #dossie-print {
    display: block;
    color: #000;
    background: #fff;
    font-size: 11pt;
    line-height: 1.45;
  }

  #dossie-print h1 {
    font-size: 20pt;
    margin: 0 0 4pt;
  }

  #dossie-print .dossie-sub {
    color: #444;
    font-size: 10pt;
    margin: 0 0 10pt;
  }

  #dossie-print h2 {
    font-size: 13pt;
    margin: 14pt 0 6pt;
    padding-bottom: 2pt;
    border-bottom: 1pt solid #999;
  }

  #dossie-print h3 {
    font-size: 11pt;
    margin: 8pt 0 4pt;
  }

  #dossie-print .dossie-fotos {
    display: flex;
    gap: 8pt;
    flex-wrap: wrap;
    margin: 6pt 0;
  }

  #dossie-print .dossie-fotos img {
    width: 46%;
    max-height: 65mm;
    object-fit: contain;
    border: 1pt solid #ccc;
  }

  #dossie-print dl {
    display: grid;
    grid-template-columns: 40mm 1fr;
    gap: 2pt 8pt;
    margin: 4pt 0;
  }

  #dossie-print dt {
    color: #444;
  }

  #dossie-print dd {
    margin: 0;
  }

  #dossie-print ul {
    margin: 4pt 0 4pt 14pt;
    padding: 0;
  }

  #dossie-print section {
    break-inside: avoid;
  }

  #dossie-print a {
    color: #000;
    text-decoration: none;
  }

  /* No papel, o link vale pela URL visível. */
  #dossie-print .dossie-fontes a::after {
    content: " — " attr(href);
    font-size: 8pt;
    color: #555;
    word-break: break-all;
  }

  #dossie-print .dossie-rodape {
    margin-top: 16pt;
    padding-top: 8pt;
    border-top: 1pt solid #999;
    font-size: 8.5pt;
    color: #333;
  }

  /* Relatório da coleção (FASE B4): nó print-only temporário. A regra @page
     paisagem NÃO vive aqui — relatorio.js injeta um <style> só durante esta
     impressão, para o dossiê individual continuar retrato. O id vence as
     regras de tela da .data-table (cores do tema, sticky) sem !important. */

  #relatorio-print {
    display: block;
    color: #000;
    background: #fff;
    font-size: 9pt;
    line-height: 1.4;
  }

  #relatorio-print h1 {
    font-size: 16pt;
    margin: 0 0 2pt;
  }

  #relatorio-print .relatorio-print-sub {
    color: #444;
    font-size: 9pt;
    margin: 0 0 8pt;
  }

  #relatorio-print table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    color: #000;
    font-size: 9pt;
  }

  /* Cabeçalho repetido em toda página; nada de sticky no papel. */
  #relatorio-print thead {
    display: table-header-group;
  }

  #relatorio-print tr {
    break-inside: avoid;
  }

  #relatorio-print th,
  #relatorio-print td {
    background: #fff;
    color: #000;
    border: none;
    border-bottom: 0.5pt solid #999;
    padding: 3pt 4pt;
    text-align: left;
    vertical-align: top;
  }

  #relatorio-print thead th {
    position: static;
    border-bottom: 1pt solid #000;
  }

  #relatorio-print .cell-num {
    text-align: right;
  }

  #relatorio-print .cell-main {
    display: block;
    color: #000;
  }

  #relatorio-print .cell-sub {
    display: block;
    font-size: 7.5pt;
    color: #555;
  }

  #relatorio-print .selo {
    display: inline-block;
    font-size: 7pt;
    color: #333;
    background: none;
    border: 0.5pt solid #999;
    border-radius: 2pt;
    padding: 0 2pt;
  }

  #relatorio-print tfoot {
    border-top: 1.5pt solid #000;
  }

  #relatorio-print tfoot th,
  #relatorio-print tfoot td {
    font-weight: 600;
  }

  #relatorio-print .tfoot-aviso td {
    font-weight: 400;
    font-size: 7.5pt;
    color: #555;
  }

  #relatorio-print a {
    color: #000;
    text-decoration: none;
  }

  #relatorio-print .relatorio-print-rodape {
    margin-top: 10pt;
    padding-top: 6pt;
    border-top: 1pt solid #999;
    font-size: 8pt;
    color: #333;
  }

  #relatorio-print .relatorio-print-rodape p {
    margin: 0 0 2pt;
  }
}

/* --- Desejos: faixa, sparkline e alvo (Bloco 5 / FASE 3A) ----------------- */

.desejo-extra {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-1);
  margin-top: var(--sp-2);
}

.desejo-extra__faixa {
  font-size: 13px;
}

.desejo-extra__meta {
  color: var(--color-text-muted);
  font-size: 12px;
}

.sparkline {
  width: 120px;
  height: 28px;
  color: var(--color-accent);
}

.badge--alvo {
  background: rgba(201, 162, 75, 0.15);
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
}
