:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f9fafc;
  --text: #172033;
  --muted: #687388;
  --line: #e4e9f1;
  --accent: #ef7d20;
  --accent-2: #245a9c;
  --success: #1f8f5f;
  --success-soft: #eaf8f1;
  --danger: #c94646;
  --danger-soft: #fff0f0;
  --warning: #b7791f;
  --warning-soft: #fff8e7;
  --shadow: 0 18px 45px rgba(25, 40, 70, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

.login-view {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-view::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("logo-viapeg.png") center center / min(920px, 88vw) no-repeat;
  opacity: 0.20;
  pointer-events: auto;
}

.login-view::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(239, 125, 32, 0.05), transparent 35%),
    radial-gradient(circle at 85% 80%, rgba(36, 90, 156, 0.06), transparent 40%);
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.50);
  border: 1px solid rgba(255, 255, 255, 0.70);
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(2px);
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  font-size: 24px;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  color: var(--accent-2);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.muted {
  color: var(--muted);
  line-height: 1.55;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.login-form label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: #42506a;
}

.login-form input {
  width: 100%;
  border: 1px solid rgba(205, 214, 229, 0.85);
  border-radius: 12px;
  padding: 13px 14px;
  outline: none;
  background: rgba(255, 255, 255, 0.48);
  backdrop-filter: blur(1px);
}

.login-form input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(36, 90, 156, 0.10);
}

.primary-btn,
.secondary-btn {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}

.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  padding: 13px 16px;
  background: rgba(36, 90, 156, 0.90);
  color: white;
  font-weight: 800;
  backdrop-filter: blur(1px);
}

.secondary-btn {
  padding: 10px 14px;
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
  font-weight: 700;
}

.error-text {
  margin: 0;
  font-size: 13px;
  color: var(--danger);
}

.dashboard {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px clamp(18px, 4vw, 44px);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  font-size: clamp(21px, 3vw, 30px);
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.content {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 26px clamp(16px, 4vw, 44px) 48px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.summary-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 8px 25px rgba(25, 40, 70, .04);
}

.summary-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.summary-value {
  display: block;
  margin-top: 7px;
  font-size: 27px;
  font-weight: 850;
  letter-spacing: -0.03em;
}

.summary-sub {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.panel {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 25px rgba(25, 40, 70, .04);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.refresh-label {
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
}

.price-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.price-table th,
.price-table td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.price-table th {
  position: sticky;
  top: 0;
  background: var(--surface-soft);
  color: #48566f;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.price-table tbody tr:last-child td {
  border-bottom: 0;
}

.product-name {
  min-width: 220px;
  font-weight: 800;
}

.price-cell {
  white-space: nowrap;
}

.price-main {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.best-price {
  background: var(--success-soft);
}

.best-price .price-main {
  color: var(--success);
}

.best-badge {
  display: inline-flex;
  margin-left: 7px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--success);
  color: white;
  font-size: 10px;
  font-weight: 800;
}

.no-price {
  color: #a1a9b7;
}

.unit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.unit-card {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-soft);
}

.unit-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.unit-name {
  font-size: 17px;
  font-weight: 850;
}

.unit-supplier {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.status.ok {
  color: var(--success);
  background: var(--success-soft);
}

.status.error {
  color: var(--danger);
  background: var(--danger-soft);
}

.status.unknown {
  color: var(--warning);
  background: var(--warning-soft);
}

.unit-meta {
  display: grid;
  gap: 7px;
  margin-top: 15px;
  color: #59667c;
  font-size: 12px;
}

.error-box {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #ffd3d3;
}

@media (max-width: 1050px) {
  .summary-grid,
  .unit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 650px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-grid,
  .unit-grid {
    grid-template-columns: 1fr;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }
}


.view-tabs {
  display: flex;
  gap: 8px;
  padding: 12px clamp(18px, 4vw, 44px) 0;
  background: var(--bg);
}

.view-tab {
  border: 1px solid var(--line);
  background: white;
  color: var(--muted);
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 800;
  cursor: pointer;
}

.view-tab.active {
  background: var(--accent-2);
  color: white;
  border-color: var(--accent-2);
}

.history-header {
  align-items: end;
}

.history-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.history-filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.history-filters select {
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  font-weight: 700;
}

.history-chart-wrap {
  position: relative;
  height: 430px;
  padding: 22px;
}

.history-empty {
  position: absolute;
  inset: 22px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: var(--surface-soft);
}

.history-date {
  white-space: nowrap;
  font-weight: 800;
}

@media (max-width: 650px) {
  .view-tabs {
    overflow-x: auto;
  }

  .history-header {
    align-items: flex-start;
  }

  .history-filters {
    width: 100%;
  }

  .history-filters label,
  .history-filters select {
    width: 100%;
  }

  .history-chart-wrap {
    height: 340px;
    padding: 8px;
  }
}


.header-with-photo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.photo-chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent-2);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.photo-chip:disabled {
  opacity: .45;
  cursor: not-allowed;
}


.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .16);
  pointer-events: none;
}

.modal-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(68vw, 980px);
  min-width: 520px;
  max-width: 95vw;
  height: auto;
  max-height: 94vh;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
  display: grid;
  grid-template-rows: auto minmax(0, auto);
  pointer-events: auto;
}

.modal-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 16px 9px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.draggable-header {
  cursor: move;
  user-select: none;
  touch-action: none;
}

.drag-hint {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}


.photo-tool {
  min-width: 38px;
  padding-inline: 10px;
  font-size: 18px;
  line-height: 1;
}

.zoom-label {
  min-width: 52px;
  text-align: center;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
}

.photo-toolbar-hint {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.modal-body,
.photo-viewport {
  position: relative;
  min-height: 0;
  padding: 0;
  overflow: auto;
  background: #e9eef5;
  cursor: grab;
  overscroll-behavior: contain;
}

.photo-viewport {
  height: auto;
  max-height: calc(94vh - 92px);
}

.photo-viewport.dragging {
  cursor: grabbing;
  user-select: none;
}

.photo-canvas {
  min-width: 100%;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 6px;
}

.modal-body img,
.photo-viewport img {
  display: block;
  width: auto;
  max-width: none;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 4px 20px rgba(15, 23, 42, .08);
  user-select: none;
  pointer-events: none;
}

.modal-close {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--accent-2);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.modal-close:hover {
  background: #dfe8fb;
}

@media (max-width: 700px) {
  .modal-card {
    left: 1vw !important;
    top: 2.5vh !important;
    transform: none !important;
    width: 98vw;
    min-width: 0;
    height: 92vh;
  }

  .modal-header {
    padding: 14px 14px 10px;
  }

  .photo-toolbar {
    overflow-x: auto;
  }

  .photo-toolbar-hint,
  .drag-hint {
    display: none;
  }
}


/* =========================================================
   NOVA ORGANIZAÇÃO DO PAINEL
   ========================================================= */
.tabs-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px clamp(18px, 4vw, 44px) 0;
  background: var(--bg);
}

.tabs-shell .view-tabs {
  padding: 0;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

.system-indicator {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 850;
  cursor: pointer;
  background: white;
}

.system-indicator-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 13px;
}

.system-indicator.ok { color: #157a50; border-color: #bde7d3; background: #f0fbf5; }
.system-indicator.ok .system-indicator-icon { color: white; background: #1f9d68; }
.system-indicator.error { color: #b42318; border-color: #ffd0cc; background: #fff4f2; }
.system-indicator.error .system-indicator-icon { color: white; background: #d94a40; }
.system-indicator.unknown { color: #7a5b12; background: #fff9e8; }

.panel-description {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.unit-error {
  margin-top: 6px;
  padding: 8px 9px;
  border-radius: 9px;
  background: var(--danger-soft);
  color: var(--danger);
  line-height: 1.4;
}

/* Comparativos */
.comparison-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.compare-action-card {
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 18px;
  background: var(--surface-soft);
}

.compare-action-title {
  display: inline-block;
  padding: 6px 10px;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 900;
  border-radius: 7px;
  letter-spacing: .02em;
}

.supplier-card-vibra .compare-action-title { background: #8bd04d; color: #10220a; }
.supplier-card-raizen .compare-action-title { background: #ffd500; color: #3c3200; }
.supplier-card-ipiranga .compare-action-title { background: #26b7df; color: #063748; }

.compare-action-sub { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.compare-action-buttons { display: flex; flex-wrap: wrap; gap: 9px; }
.compare-pair-btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: white;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}
.compare-pair-btn:hover:not(:disabled) { border-color: var(--accent-2); color: var(--accent-2); }
.compare-pair-btn:disabled { opacity: .42; cursor: not-allowed; }
.compare-awaiting { margin-top: 10px; font-size: 11px; color: var(--muted); line-height: 1.4; }

.compare-result-header { align-items: center; }
.compare-copy-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.compact-btn { padding: 10px 14px; }
.whatsapp-btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: #1fa855;
  color: white;
  font-weight: 850;
  cursor: pointer;
}

.compare-table { width: 100%; border-collapse: collapse; min-width: 650px; }
.compare-table th, .compare-table td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.compare-table th:first-child, .compare-table td:first-child { text-align: left; }
.compare-table th { background: var(--surface-soft); color: #46536a; font-size: 12px; }
.compare-product { font-weight: 850; }
.diff-negative { color: #c52727; font-weight: 850; }
.diff-positive { color: #16794f; font-weight: 850; }
.diff-zero { color: #59667c; font-weight: 850; }

.copy-preview-wrap { padding: 18px; border-top: 1px solid var(--line); }
.copy-preview-label { margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 850; text-transform: uppercase; }
.copy-preview { margin: 0; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; line-height: 1.6; }

/* Formato antiga */
.old-format-wrap { overflow-x: auto; padding: 18px; }
.old-format-table { width: max-content; min-width: 720px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 13px; color: #111; background: white; }
.old-format-table th, .old-format-table td { border: 1px solid #1f1f1f; height: 25px; padding: 3px 7px; }
.old-format-table .old-section th { font-weight: 800; text-align: center; }
.old-format-table .old-section th:first-child { min-width: 185px; text-align: left; }
.old-supplier-vibra th { background: #8bd04d; }
.old-supplier-raizen th { background: #ffc400; }
.old-supplier-ipiranga th { background: #20b7df; }
.old-product { min-width: 185px; text-align: left; text-transform: uppercase; }
.old-price { min-width: 82px; text-align: right; font-variant-numeric: tabular-nums; }
.old-up { background: #f8d7da; color: #7a1f27; }
.old-down { background: #d9f3df; color: #1e6b37; }
.old-spacer td { height: 9px; border-left: 0; border-right: 0; background: #f6f7fa; }
.old-format-note { margin: 12px 0 0; padding: 12px; border-radius: 10px; background: #eefaff; border: 1px solid #b8e7f5; color: #25586a; font-size: 12px; font-weight: 700; }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2000;
  padding: 12px 16px;
  border-radius: 12px;
  background: #172033;
  color: white;
  box-shadow: 0 12px 40px rgba(0,0,0,.2);
  font-weight: 750;
  font-size: 13px;
}

@media (max-width: 900px) {
  .comparison-actions { grid-template-columns: 1fr; }
  .tabs-shell { align-items: flex-start; flex-direction: column; }
  .system-indicator { align-self: flex-start; }
}

@media (max-width: 650px) {
  .system-indicator-text { display: none; }
  .compare-result-header { align-items: flex-start; }
}


/* Comparativo simplificado: somente VIBRA e RAÍZEN */
.comparison-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compare-result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.comparison-image-area {
  background: #ffffff;
}

.comparison-image-area .compare-result-header {
  background: #ffffff;
}

.comparison-image-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 760px) {
  .comparison-actions {
    grid-template-columns: 1fr;
  }

  .compare-result-actions {
    justify-content: stretch;
  }

  .compare-result-actions button {
    flex: 1;
  }
}


/* Cartão que é convertido em PNG pelo próprio HTML */
.comparison-image-area {
  background: #ffffff;
  border-top: 5px solid var(--accent-2);
}

.comparison-image-area .compare-result-header {
  padding-top: 22px;
  padding-bottom: 18px;
}

.comparison-image-area .compare-table th {
  background: #f3f6fb;
}

.comparison-image-area .compare-table td {
  background: #ffffff;
}

.comparison-image-area .compare-product {
  font-size: 15px;
}


/* Comparativo compacto + seleção de itens para exportação */
.compare-export-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.compare-export-products {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: #46536a;
  font-size: 12px;
}

.compare-export-label {
  font-weight: 850;
  color: var(--text);
}

.compare-export-products label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  cursor: pointer;
}

.compare-export-check {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-2);
}

.compare-result-actions {
  padding: 0;
  border: 0;
  background: transparent;
  flex: 0 0 auto;
}

#comparisonResultPanel {
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}

.comparison-image-area {
  width: min(720px, calc(100% - 24px));
  margin: 14px auto 0;
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent-2);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(25, 40, 70, .07);
}

.comparison-image-area .compare-result-header {
  padding: 13px 16px 10px;
}

.comparison-image-area .compare-result-header h2 {
  font-size: 19px;
  margin-bottom: 0;
}

.comparison-image-area .compare-result-header .eyebrow {
  margin-bottom: 3px;
  font-size: 10px;
}

.comparison-image-subtitle {
  margin-top: 3px;
  font-size: 10px;
}

.comparison-image-area .table-wrap {
  overflow: visible;
}

.comparison-image-area .compare-table {
  min-width: 0;
  table-layout: fixed;
}

.comparison-image-area .compare-table th,
.comparison-image-area .compare-table td {
  padding: 7px 9px;
  font-size: 11.5px;
}

.comparison-image-area .compare-table th:first-child,
.comparison-image-area .compare-table td:first-child {
  width: 32%;
}

.comparison-image-area .compare-product {
  font-size: 12px;
  line-height: 1.2;
}

.comparison-image-area .best-badge {
  font-size: 8px;
}

@media (max-width: 850px) {
  .compare-export-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .compare-result-actions {
    width: 100%;
  }
}

@media (max-width: 650px) {
  .comparison-image-area {
    width: 100%;
    margin-top: 10px;
  }

  .comparison-image-area .compare-table th,
  .comparison-image-area .compare-table td {
    padding: 6px 6px;
    font-size: 10.5px;
  }
}


/* Alinhamento do cartão conforme o fornecedor que vai receber */
#comparisonResultPanel.comparison-recipient-vibra .comparison-image-area,
#comparisonResultPanel.comparison-recipient-raizen .comparison-image-area {
  width: calc(50% - 28px);
  max-width: 720px;
}

#comparisonResultPanel.comparison-recipient-vibra .comparison-image-area {
  margin-left: 4px;
  margin-right: auto;
}

#comparisonResultPanel.comparison-recipient-raizen .comparison-image-area {
  margin-left: auto;
  margin-right: 4px;
}

@media (max-width: 980px) {
  #comparisonResultPanel.comparison-recipient-vibra .comparison-image-area,
  #comparisonResultPanel.comparison-recipient-raizen .comparison-image-area {
    width: min(720px, calc(100% - 24px));
    margin-left: auto;
    margin-right: auto;
  }
}


/* Logo oficial ViaPeg no login */
.brand-logo {
  display: none;
}

.brand-logo img {
  display: none;
}


/* Login translúcido */
.login-card h1,
.login-card .eyebrow,
.login-card .muted,
.login-card label {
  position: relative;
  z-index: 1;
}


/* =========================================================
   TIPOGRAFIA MAIS LEVE NO PAINEL
   ========================================================= */
.dashboard .eyebrow {
  font-weight: 700;
}

.dashboard h1,
.dashboard h2 {
  font-weight: 700;
}

.dashboard .view-tab {
  font-weight: 650;
}

.dashboard .price-table th {
  font-weight: 600;
}

.dashboard .product-name {
  font-weight: 650;
}

.dashboard .price-main {
  font-weight: 650;
}

.dashboard .best-badge {
  font-weight: 700;
}

.dashboard .photo-chip {
  font-weight: 650;
}

.dashboard .system-indicator {
  font-weight: 700;
}

.dashboard .compare-action-title,
.dashboard .compare-pair-btn,
.dashboard .compare-product,
.dashboard .diff-negative,
.dashboard .diff-positive,
.dashboard .diff-zero,
.dashboard .compare-export-label {
  font-weight: 700;
}

.dashboard .primary-btn,
.dashboard .secondary-btn {
  font-weight: 700;
}


/* =========================================================
   PREÇOS ATUAIS - PREFERÊNCIAS POR USUÁRIO
   ========================================================= */
.current-price-header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.current-drag-tip {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.current-decimals-control {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.current-decimals-control select {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 9px;
  background: white;
  color: var(--text);
  outline: none;
  font-weight: 650;
}

#comparisonBody tr[data-category-key] {
  cursor: grab;
  transition: opacity .15s ease, transform .15s ease, box-shadow .15s ease;
}

#comparisonBody tr[data-category-key]:active {
  cursor: grabbing;
}

.current-draggable-product {
  display: flex;
  align-items: center;
  gap: 8px;
}

.current-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #98a3b6;
  font-size: 16px;
  letter-spacing: -4px;
  width: 14px;
  user-select: none;
}

#comparisonBody tr.current-row-dragging {
  opacity: .45;
  box-shadow: 0 8px 18px rgba(25, 40, 70, .12);
}

@media (max-width: 760px) {
  .current-price-header-tools {
    width: 100%;
    justify-content: flex-start;
  }

  .current-drag-tip {
    width: 100%;
  }
}


/* =========================================================
   HISTÓRICO DE FOTOS
   ========================================================= */
.photo-history-grid {
  display: grid;
  gap: 12px;
  padding: 16px 18px 20px;
}

.photo-history-day {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  overflow: hidden;
}

.photo-history-date {
  padding: 9px 13px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: #f1f4f9;
  border-bottom: 1px solid var(--line);
}

.photo-history-units {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

.photo-history-btn {
  display: grid;
  gap: 2px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  padding: 9px 10px;
  color: var(--text);
  cursor: pointer;
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}

.photo-history-btn:hover {
  transform: translateY(-1px);
  border-color: #b9c9df;
  box-shadow: 0 5px 14px rgba(25, 40, 70, .07);
}

.photo-history-unit {
  font-size: 13px;
  font-weight: 700;
}

.photo-history-supplier {
  font-size: 10px;
  color: var(--muted);
}

.photo-history-open {
  margin-top: 4px;
  font-size: 10px;
  font-weight: 650;
  color: var(--accent-2);
}

.photo-history-empty {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

/* Foto sobre a data no Formato antiga */
.old-date-photo-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-height: 22px;
}

.old-photo-btn {
  border: 1px solid rgba(0, 0, 0, .28);
  border-radius: 5px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, .85);
  color: #12345f;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.old-photo-btn:hover {
  background: #fff;
}

.old-photo-placeholder {
  visibility: hidden;
  border: 1px solid transparent;
  padding: 2px 6px;
  font-size: 9px;
}

@media (max-width: 900px) {
  .photo-history-units {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .photo-history-units {
    grid-template-columns: 1fr;
  }

  .old-date-photo-header {
    flex-direction: column;
    gap: 2px;
    justify-content: center;
  }
}


/* Ações da foto */
.photo-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.photo-save-btn {
  padding: 8px 11px;
  font-size: 12px;
  white-space: nowrap;
}

.photo-viewport img {
  pointer-events: auto;
}


/* =========================================================
   HISTÓRICO DE FOTOS - DIAS RECOLHÍVEIS
   ========================================================= */
.photo-history-day {
  overflow: hidden;
}

.photo-history-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 13px;
  background: #f1f4f9;
  border-bottom: 0;
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.photo-history-summary::-webkit-details-marker {
  display: none;
}

.photo-history-summary .photo-history-date {
  flex: 1;
  padding: 0;
  background: transparent;
  border: 0;
  font-size: 13px;
  font-weight: 700;
}

.photo-history-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.photo-history-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: var(--accent-2);
  font-size: 18px;
  transition: transform .18s ease;
}

.photo-history-day[open] .photo-history-summary {
  border-bottom: 1px solid var(--line);
}

.photo-history-day[open] .photo-history-chevron {
  transform: rotate(180deg);
}

.photo-history-day:not([open]) .photo-history-units {
  display: none;
}


/* =========================================================
   HISTÓRICO DE FOTOS - SELETOR DE DATA
   ========================================================= */
.photo-history-panel-header {
  align-items: flex-end;
}

.photo-history-date-filter {
  display: grid;
  gap: 5px;
  min-width: 150px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.photo-history-date-filter select {
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  outline: none;
  font-weight: 650;
}

.photo-history-selected-day {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  overflow: hidden;
}

.photo-history-selected-date {
  padding: 10px 14px;
  background: #f1f4f9;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

/* Desativa visual antigo recolhível nesta versão */
.photo-history-summary {
  display: none !important;
}

@media (max-width: 700px) {
  .photo-history-panel-header {
    align-items: flex-start;
  }

  .photo-history-date-filter {
    width: 100%;
  }

  .photo-history-date-filter select {
    width: 100%;
  }
}


/* =========================================================
   HISTÓRICO DE FOTOS - DROPDOWN DE DATA COM 10 ITENS
   ========================================================= */
.photo-history-panel {
  overflow: visible;
}

.photo-history-date-filter {
  position: relative;
  min-width: 170px;
}

.photo-history-date-label {
  display: block;
  margin-bottom: 5px;
}

.photo-history-date-picker {
  position: relative;
  min-width: 170px;
}

.photo-history-date-button {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 11px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

.photo-history-date-button:disabled {
  cursor: default;
  opacity: .55;
}

.photo-history-date-arrow {
  color: var(--accent-2);
  font-size: 17px;
  transition: transform .16s ease;
}

.photo-history-date-button[aria-expanded="true"] .photo-history-date-arrow {
  transform: rotate(180deg);
}

.photo-history-date-dropdown {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  z-index: 100;
  width: 100%;
  min-width: 170px;
  max-height: 360px; /* 10 datas de aproximadamente 36px */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px;
  border: 1px solid #ccd6e4;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(25, 40, 70, .16);
  scrollbar-width: thin;
}

.photo-history-date-option {
  width: 100%;
  height: 36px;
  display: flex;
  align-items: center;
  border: 0;
  border-radius: 7px;
  padding: 0 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  white-space: nowrap;
}

.photo-history-date-option:hover {
  background: #eef4fb;
}

.photo-history-date-option.active {
  background: var(--accent-2);
  color: #fff;
}

.photo-history-date-dropdown::-webkit-scrollbar {
  width: 8px;
}

.photo-history-date-dropdown::-webkit-scrollbar-thumb {
  background: #bcc8d8;
  border-radius: 999px;
}

.photo-history-date-dropdown::-webkit-scrollbar-track {
  background: #f3f5f8;
}

/* O select nativo da versão anterior não é mais usado. */
.photo-history-date-filter select {
  display: none !important;
}

@media (max-width: 700px) {
  .photo-history-date-picker,
  .photo-history-date-filter {
    width: 100%;
  }
}


/* =========================================================
   PREÇOS ATUAIS - ÚLTIMOS 7 PREÇOS AO PASSAR O MOUSE
   ========================================================= */
.price-history-trigger {
  cursor: help;
}

.price-history-trigger.history-open {
  outline: 2px solid rgba(36, 90, 156, .18);
  outline-offset: -2px;
}

.price-history-tooltip {
  position: fixed;
  z-index: 5000;
  width: 270px;
  max-width: calc(100vw - 16px);
  overflow: hidden;
  border: 1px solid #d6dfeb;
  border-radius: 13px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 14px 34px rgba(25, 40, 70, .20);
  pointer-events: none;
}

.price-history-tooltip-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px 9px;
  border-bottom: 1px solid var(--line);
  background: #f7f9fc;
}

.price-history-tooltip-title {
  font-size: 13px;
  font-weight: 750;
}

.price-history-tooltip-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.price-history-tooltip-count {
  flex: 0 0 auto;
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 700;
}

.price-history-tooltip-list {
  display: grid;
}

.price-history-tooltip-row {
  display: grid;
  grid-template-columns: 1fr 22px auto;
  align-items: center;
  gap: 5px;
  min-height: 33px;
  padding: 0 11px;
  border-bottom: 1px solid #edf0f5;
  font-variant-numeric: tabular-nums;
}

.price-history-tooltip-row:last-child {
  border-bottom: 0;
}

.price-history-tooltip-date {
  color: #56647a;
  font-size: 11px;
}

.price-history-tooltip-trend {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.price-history-tooltip-price {
  font-size: 11px;
  font-weight: 700;
}

.price-history-tooltip-row.up .price-history-tooltip-trend,
.price-history-tooltip-row.up .price-history-tooltip-price {
  color: #b83535;
}

.price-history-tooltip-row.down .price-history-tooltip-trend,
.price-history-tooltip-row.down .price-history-tooltip-price {
  color: #188659;
}

.price-history-tooltip-row.same .price-history-tooltip-trend {
  color: #98a3b6;
}

@media (max-width: 700px) {
  .price-history-tooltip {
    width: min(300px, calc(100vw - 20px));
  }
}


/* =========================================================
   PREÇOS ATUAIS - LIGA/DESLIGA HISTÓRICO POR USUÁRIO
   ========================================================= */
.current-history-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 31px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: #536178;
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.current-history-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent-2);
  cursor: pointer;
}

.current-history-toggle:hover {
  border-color: #bcc9da;
  background: #fafcff;
}

.price-history-disabled .price-history-trigger {
  cursor: default;
}

@media (max-width: 760px) {
  .current-history-toggle {
    margin-left: 0;
  }
}


/* =========================================================
   COMPRA ASSISTIDA - PRIMEIRA TELA / PREVIEW
   ========================================================= */
.purchase-tab {
  position: relative;
}

.purchase-tab::after {
  content: "NOVO";
  margin-left: 7px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(239, 125, 32, .12);
  color: var(--accent);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: .05em;
  vertical-align: middle;
}

.purchase-hero-panel {
  border-color: rgba(36, 90, 156, .18);
  background:
    linear-gradient(135deg, rgba(36, 90, 156, .055), rgba(239, 125, 32, .035)),
    #fff;
}

.purchase-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.purchase-description {
  max-width: 760px;
  margin-top: 8px;
}

.purchase-safe-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid rgba(31, 143, 95, .20);
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 11px;
  font-weight: 800;
}

.purchase-safe-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(31, 143, 95, .10);
}

.purchase-unit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.purchase-unit-card {
  display: grid;
  gap: 8px;
  min-height: 128px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.purchase-unit-card:hover {
  transform: translateY(-2px);
  border-color: #c7d3e4;
  box-shadow: 0 10px 26px rgba(25, 40, 70, .08);
}

.purchase-unit-card.active {
  border-color: rgba(36, 90, 156, .65);
  box-shadow: 0 0 0 3px rgba(36, 90, 156, .09);
  background: #fbfdff;
}

.purchase-unit-name {
  font-size: 18px;
  font-weight: 850;
  letter-spacing: -.02em;
}

.purchase-unit-supplier {
  width: max-content;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .06em;
}

.purchase-unit-supplier.vibra {
  background: #eaf6ef;
  color: #187646;
}

.purchase-unit-supplier.raizen {
  background: #fff4d7;
  color: #9a6811;
}

.purchase-unit-rule {
  align-self: end;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.purchase-ipiranga-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 11px;
  background: #f2f8fb;
  color: #536579;
  font-size: 11px;
}

.purchase-ipiranga-note strong {
  color: #1686a4;
  letter-spacing: .05em;
}

.purchase-order-header {
  align-items: flex-end;
}

.purchase-date-field {
  display: grid;
  gap: 5px;
  min-width: 180px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.purchase-date-field input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
  outline: none;
  font-weight: 700;
}

.purchase-current-info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 17px;
  margin-bottom: 16px;
}

.purchase-current-info > div {
  display: grid;
  gap: 4px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.purchase-info-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.purchase-current-info strong {
  font-size: 12px;
}

.purchase-table-wrap {
  margin-top: 4px;
}

.purchase-table {
  width: 100%;
  min-width: 800px;
  border-collapse: collapse;
}

.purchase-table th,
.purchase-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-size: 12px;
}

.purchase-table th {
  background: #f6f8fb;
  color: #536079;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.purchase-table th:first-child,
.purchase-table td:first-child {
  text-align: left;
}

.purchase-product-name {
  font-weight: 800;
}

.purchase-current-price {
  color: var(--accent-2);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.purchase-qty-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.purchase-qty-input {
  width: 94px;
  border: 1px solid #ccd6e4;
  border-radius: 9px;
  padding: 8px 9px;
  outline: none;
  text-align: right;
  font-weight: 800;
}

.purchase-qty-input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(36, 90, 156, .08);
}

.purchase-liters,
.purchase-line-total {
  font-variant-numeric: tabular-nums;
}

.purchase-line-total {
  font-weight: 800;
}

.purchase-empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.purchase-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
}

.purchase-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
}

.purchase-totals > div {
  display: grid;
  gap: 3px;
}

.purchase-totals span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.purchase-totals strong {
  font-size: 15px;
}

.purchase-total-money strong {
  color: var(--accent-2);
  font-size: 19px;
}

.purchase-review-btn {
  min-width: 180px;
}

.purchase-review-btn:disabled,
.purchase-review-actions .primary-btn:disabled {
  cursor: not-allowed;
  opacity: .45;
  transform: none;
}

.purchase-review-panel {
  border-color: rgba(36, 90, 156, .23);
}

.purchase-review-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.purchase-preview-only {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .06em;
}

.purchase-review-content {
  margin-top: 18px;
}

.purchase-review-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.purchase-review-summary > div {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border-radius: 11px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.purchase-review-summary span,
.purchase-review-line span {
  color: var(--muted);
  font-size: 10px;
}

.purchase-review-lines {
  display: grid;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.purchase-review-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}

.purchase-review-line:last-child {
  border-bottom: 0;
}

.purchase-review-line > div {
  display: grid;
  gap: 3px;
}

.purchase-review-price {
  text-align: right;
}

.purchase-review-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 13px 14px;
  border-radius: 12px;
  background: #eef4fb;
}

.purchase-review-total span {
  color: #536579;
  font-size: 11px;
  font-weight: 700;
}

.purchase-review-total strong {
  color: var(--accent-2);
  font-size: 20px;
}

.purchase-warning-box {
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid #f0dfab;
  border-radius: 11px;
  background: var(--warning-soft);
  color: #715522;
  font-size: 11px;
  line-height: 1.45;
}

.purchase-review-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

@media (max-width: 1050px) {
  .purchase-unit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .purchase-current-info {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .purchase-hero,
  .purchase-footer,
  .purchase-order-header,
  .purchase-review-head {
    align-items: stretch;
    flex-direction: column;
  }

  .purchase-unit-grid,
  .purchase-review-summary {
    grid-template-columns: 1fr;
  }

  .purchase-date-field,
  .purchase-review-btn {
    width: 100%;
  }

  .purchase-ipiranga-note {
    align-items: flex-start;
    flex-direction: column;
  }

  .purchase-review-actions {
    flex-direction: column-reverse;
  }

  .purchase-review-actions button {
    width: 100%;
  }
}


/* =========================================================
   COMPRA ASSISTIDA - PRAZOS + LITROS + LIMITES
   ========================================================= */
.purchase-header-fields {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.purchase-date-field select {
  min-width: 135px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
  outline: none;
  font-weight: 700;
}

.purchase-term-notice {
  margin: -4px 0 15px;
  padding: 10px 12px;
  border: 1px solid #d9e4f1;
  border-radius: 11px;
  background: #f5f9fe;
  color: #4c6078;
  font-size: 11px;
  line-height: 1.45;
}

.purchase-term-notice strong {
  color: var(--accent-2);
}

.purchase-row-term {
  min-width: 102px;
  border: 1px solid #ccd6e4;
  border-radius: 8px;
  padding: 7px 8px;
  background: #fff;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.purchase-global-term-label {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 9px;
  border-radius: 8px;
  background: #eef4fb;
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 800;
}

.purchase-liters-input {
  width: 118px;
}

.purchase-volume-feedback {
  min-height: 15px;
  margin-top: 4px;
  font-size: 9px;
  font-weight: 700;
  text-align: right;
}

.purchase-volume-feedback.error {
  color: #b83535;
}

.purchase-volume-feedback.warning {
  color: #a56a11;
}

.purchase-volume-feedback.ok {
  color: #188659;
}

.purchase-qty-input.invalid {
  border-color: #d85a5a;
  box-shadow: 0 0 0 3px rgba(216, 90, 90, .08);
}

.purchase-rule-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 9px;
  font-weight: 800;
}

.purchase-rule-pill.known {
  background: #edf7f1;
  color: #187646;
}

.purchase-rule-pill.dynamic {
  background: #fff6df;
  color: #946719;
}

.purchase-price-pending {
  color: #a56a11;
  font-size: 10px;
  font-weight: 800;
}

.purchase-table {
  min-width: 980px;
}

@media (max-width: 700px) {
  .purchase-header-fields {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }
}


/* =========================================================
   MINHA CONTA / LOGIN POR USUÁRIO OU E-MAIL
   ========================================================= */
.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.account-btn-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.account-btn strong {
  color: var(--accent-2);
  font-size: 12px;
}

.account-modal-backdrop {
  pointer-events: auto;
}

.account-modal-card {
  width: min(620px, calc(100vw - 32px));
  min-width: 0;
  max-height: calc(100vh - 32px);
}

.account-modal-header {
  padding: 18px 20px 14px;
}

.account-modal-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.account-modal-body {
  padding: 20px;
  overflow: auto;
  background: #fff;
}

.account-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.account-info-grid label,
.account-password-form label {
  display: grid;
  gap: 7px;
  color: #42506a;
  font-size: 13px;
  font-weight: 750;
}

.account-email-field {
  grid-column: 1 / -1;
}

.account-info-grid input,
.account-password-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 13px;
  outline: none;
  background: #fff;
  color: var(--text);
}

.account-info-grid input[readonly] {
  background: var(--surface-soft);
  color: #536078;
}

.account-password-form input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(36, 90, 156, .10);
}

.account-divider {
  height: 1px;
  margin: 20px 0;
  background: var(--line);
}

.account-password-form {
  display: grid;
  gap: 14px;
}

.account-password-form h3 {
  margin: 0;
  font-size: 18px;
}

.account-message {
  margin: 0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 750;
}

.account-message.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.account-message.success {
  background: var(--success-soft);
  color: var(--success);
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .topbar-actions > button {
    flex: 1 1 auto;
  }

  .account-info-grid {
    grid-template-columns: 1fr;
  }

  .account-email-field {
    grid-column: auto;
  }

  .account-modal-card {
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: calc(100vw - 24px);
    height: auto;
    max-height: calc(100vh - 24px);
  }
}
/* =========================================================
   MOBILE 2026 - VISUALIZAÇÃO OTIMIZADA PARA TELEFONE
   ========================================================= */
@media (max-width: 700px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

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

  button,
  input,
  select {
    min-height: 44px;
  }

  .login-view {
    min-height: 100dvh;
    padding: 16px;
  }

  .login-card {
    width: 100%;
    padding: 22px 18px;
    border-radius: 18px;
  }

  .login-card h1 {
    font-size: 26px;
  }

  .topbar {
    position: relative;
    gap: 10px;
    padding: 13px 12px 12px;
  }

  .topbar .eyebrow {
    margin-bottom: 3px;
    font-size: 9px;
  }

  .topbar h1 {
    font-size: 19px;
    line-height: 1.18;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
  }

  .topbar-actions > button {
    width: 100%;
    min-width: 0;
    padding: 8px 6px;
    font-size: 11px;
    border-radius: 10px;
  }

  .account-btn {
    justify-content: center;
    gap: 4px;
  }

  .account-btn-label {
    display: none;
  }

  .account-btn strong {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
  }

  .tabs-shell {
    gap: 8px;
    padding: 8px 10px 0;
  }

  .tabs-shell .view-tabs {
    width: 100%;
    display: flex;
    gap: 6px;
    padding: 0 0 4px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .tabs-shell .view-tabs::-webkit-scrollbar {
    display: none;
  }

  .view-tab {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 11px;
    border-radius: 10px;
    font-size: 11px;
    white-space: nowrap;
    scroll-snap-align: start;
  }

  .purchase-tab::after {
    display: none;
  }

  .system-indicator {
    align-self: stretch;
    justify-content: center;
    min-height: 38px;
    padding: 6px 10px;
    font-size: 11px;
  }

  .system-indicator-text {
    display: inline !important;
  }

  .content {
    padding: 10px 9px 28px;
  }

  .panel {
    margin-top: 10px;
    border-radius: 14px;
  }

  .panel-header {
    gap: 10px;
    padding: 14px 13px;
  }

  .panel-header h2 {
    font-size: 18px;
  }

  .panel-description {
    font-size: 12px;
    line-height: 1.45;
  }

  .current-price-header-tools {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 7px;
  }

  .current-drag-tip {
    display: none;
  }

  .current-decimals-control,
  .current-history-toggle {
    width: 100%;
    justify-content: space-between;
  }

  .current-decimals-control select {
    min-width: 112px;
  }

  .refresh-label {
    padding: 2px 0;
    font-size: 10px;
  }

  /* Preços atuais: no celular, cada combustível vira um cartão legível. */
  #currentView > .panel:first-child .table-wrap {
    overflow: visible;
    padding: 0 10px 12px;
  }

  #currentView > .panel:first-child .price-table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  #currentView > .panel:first-child .price-table thead {
    display: none;
  }

  #currentView > .panel:first-child .price-table tbody {
    display: grid;
    gap: 9px;
    width: 100%;
  }

  #currentView > .panel:first-child .price-table tbody tr {
    display: grid;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 13px;
    overflow: hidden;
    background: #fff;
    cursor: default;
    box-shadow: 0 3px 12px rgba(25, 40, 70, .035);
  }

  #currentView > .panel:first-child .price-table td {
    width: 100%;
    min-width: 0;
    padding: 10px 11px;
    border-bottom: 1px solid var(--line);
  }

  #currentView > .panel:first-child .price-table tbody tr td:last-child {
    border-bottom: 0;
  }

  #currentView > .panel:first-child .product-name {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
    background: var(--surface-soft);
    font-size: 13px;
    line-height: 1.25;
  }

  #currentView > .panel:first-child .current-drag-handle {
    display: none;
  }

  #currentView > .panel:first-child .price-cell {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    min-height: 43px;
    white-space: normal;
  }

  #currentView > .panel:first-child .price-cell::before {
    content: attr(data-mobile-label);
    flex: 1 1 auto;
    min-width: 0;
    margin-right: auto;
    color: var(--muted);
    font-size: 10px;
    font-weight: 750;
    line-height: 1.25;
    text-transform: uppercase;
  }

  #currentView > .panel:first-child .price-main {
    flex: 0 0 auto;
    font-size: 15px;
  }

  #currentView > .panel:first-child .best-badge {
    flex: 0 0 auto;
    margin-left: 2px;
    padding: 3px 5px;
    font-size: 8px;
  }

  #currentView > .panel:first-child .best-price {
    background: var(--success-soft);
  }

  .comparison-actions {
    gap: 10px;
    padding: 0;
  }

  .compare-action-card {
    padding: 14px;
  }

  .compare-pair-btn {
    min-height: 42px;
    padding: 9px 10px;
    font-size: 11px;
  }

  .compare-export-bar {
    padding: 10px;
  }

  .compare-export-products {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 7px 10px;
  }

  .compare-export-label {
    grid-column: 1 / -1;
  }

  .compare-result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }

  .compare-result-actions button {
    width: 100%;
    min-width: 0;
    padding: 9px 7px;
    font-size: 11px;
  }

  .summary-card,
  .unit-card,
  .purchase-unit-card {
    border-radius: 13px;
  }

  .summary-card,
  .unit-card {
    padding: 14px;
  }

  .purchase-unit-card {
    padding: 14px;
  }

  .history-chart-wrap {
    height: 300px;
  }

  .history-filters select,
  .history-filters input {
    width: 100%;
  }

  .purchase-table-wrap,
  .old-format-wrap {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .purchase-table {
    min-width: 820px;
  }

  .old-format-table {
    min-width: 680px;
  }

  .toast {
    left: 10px;
    right: 10px;
    bottom: 10px;
    text-align: center;
  }

  .account-modal-card {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }
}

@media (max-width: 380px) {
  .topbar-actions > button,
  .view-tab {
    font-size: 10px;
  }

  .compare-export-products {
    grid-template-columns: 1fr;
  }

  .compare-export-label {
    grid-column: auto;
  }
}
