:root {
  --canvas: #f3efe3;
  --surface: #fcfaf4;
  --ink: #14251d;
  --muted: #5f6b64;
  --line: #e0dbcb;
  --forest: #1e5b47;
  --forest-dark: #0f3528;
  --lime: #d9e87e;
  --cream: #fcfaf4;
  --danger: #a33d35;
  --success: #2e6b4f;
}

/* Histórico de preços por produto e mercado */
.product-history-button {
  max-width: 100%;
  display: grid;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.product-history-button small {
  color: var(--forest);
  font-family: "Spline Sans Mono", monospace;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.product-history-button:hover .item-result-name,
.product-history-button:focus-visible .item-result-name {
  color: var(--forest);
  text-decoration: underline;
  text-decoration-color: var(--lime);
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
}

.product-history-button:focus-visible {
  outline: 3px solid rgba(30, 91, 71, 0.2);
  outline-offset: 5px;
  border-radius: 4px;
}

.item-results-table tr.is-selected-product td {
  background: rgba(217, 232, 126, 0.16);
}

.item-results-table tr.is-selected-product td:first-child {
  box-shadow: inset 4px 0 0 var(--forest);
}

.product-price-panel {
  margin: 26px 0;
  padding: 30px 32px 26px;
  scroll-margin-top: 28px;
  overflow: hidden;
  border: 1px solid rgba(30, 91, 71, 0.2);
  border-radius: 24px;
  background:
    radial-gradient(circle at 95% 0, rgba(217, 232, 126, 0.28), transparent 18rem),
    var(--surface);
  box-shadow: 0 18px 55px rgba(15, 53, 40, 0.09);
}

.product-price-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.product-price-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 18px;
}

.product-price-image {
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--forest);
  font-family: "Newsreader", Georgia, serif;
  font-size: 28px;
}

.product-price-image img {
  width: 100%;
  height: 100%;
  padding: 8px;
  object-fit: contain;
}

.product-price-image-placeholder {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(30, 91, 71, 0.16);
  border-top-color: var(--forest);
  border-radius: 50%;
  animation: price-spin 0.8s linear infinite;
}

@keyframes price-spin {
  to { transform: rotate(360deg); }
}

.product-price-identity h2 {
  margin: 2px 0 7px;
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 500;
  line-height: 1.05;
}

.product-price-identity p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.product-price-close,
.product-price-reset {
  min-height: 38px;
  flex: 0 0 auto;
  padding: 0 15px;
  border: 1px solid #c8c3b4;
  border-radius: 999px;
  background: rgba(252, 250, 244, 0.85);
  color: var(--forest-dark);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.product-price-close:hover,
.product-price-reset:hover {
  border-color: var(--forest);
  background: #fff;
}

.product-price-loading,
.product-price-empty,
.product-price-error {
  padding: 34px 20px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}

.product-price-error {
  border-color: rgba(163, 61, 53, 0.28);
  background: rgba(163, 61, 53, 0.05);
  color: var(--danger);
}

.product-price-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.price-legend-item {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.55);
  text-align: left;
  cursor: pointer;
  transition: opacity 180ms ease, border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

.price-legend-item:hover,
.price-legend-item:focus-visible,
.price-legend-item.is-focused {
  border-color: var(--forest);
  background: #fff;
  transform: translateY(-1px);
}

.price-legend-item:focus-visible {
  outline: 3px solid rgba(30, 91, 71, 0.17);
  outline-offset: 2px;
}

.price-legend-item.is-muted {
  opacity: 0.18;
}

.price-legend-swatch {
  width: 31px;
  height: 3px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--series-color);
}

.price-legend-item:nth-child(2) .price-legend-swatch {
  background: repeating-linear-gradient(90deg, var(--series-color) 0 8px, transparent 8px 12px);
}

.price-legend-item:nth-child(3) .price-legend-swatch {
  background: repeating-linear-gradient(90deg, var(--series-color) 0 3px, transparent 3px 7px);
}

.price-legend-item:nth-child(4) .price-legend-swatch {
  height: 5px;
  border-top: 2px solid var(--series-color);
  border-bottom: 1px solid var(--series-color);
  border-radius: 0;
  background: none;
}

.price-legend-item:nth-child(5) .price-legend-swatch {
  background: repeating-linear-gradient(90deg, var(--series-color) 0 6px, transparent 6px 12px);
}

.price-legend-item > span:last-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.price-legend-item strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.price-legend-item small {
  color: var(--muted);
  font-size: 10px;
}

.product-price-chart-shell {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.66);
  scrollbar-color: rgba(30, 91, 71, 0.28) transparent;
}

#product-price-chart {
  min-width: 640px;
}

.product-price-svg {
  width: 100%;
  height: auto;
  display: block;
}

.price-grid-line {
  stroke: #e7e2d5;
  stroke-width: 1;
}

.price-axis-line,
.price-axis-tick {
  stroke: #a9aea8;
  stroke-width: 1;
}

.price-axis-label,
.price-unit-label,
.price-line-label {
  font-family: "Spline Sans Mono", monospace;
  font-size: 11px;
}

.price-axis-label {
  fill: #667069;
}

.price-unit-label {
  fill: var(--forest);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
}

.price-line-label {
  font-size: 12px;
  font-weight: 800;
  transition: opacity 180ms ease;
}

.price-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  transition: opacity 180ms ease, stroke-width 180ms ease;
}

.price-line-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 18;
  pointer-events: stroke;
  cursor: pointer;
}

.price-line-hit:focus-visible {
  outline: none;
  stroke: rgba(30, 91, 71, 0.13);
}

.price-point {
  cursor: pointer;
  transition: opacity 180ms ease, r 180ms ease;
}

.price-point:hover,
.price-point:focus {
  r: 7;
  outline: none;
}

.product-price-tooltip {
  width: 180px;
  position: absolute;
  z-index: 4;
  display: grid;
  gap: 3px;
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--forest-dark);
  box-shadow: 0 12px 28px rgba(15, 53, 40, 0.2);
  color: #fff;
  font-size: 11px;
  pointer-events: none;
}

.product-price-tooltip strong,
.product-price-tooltip span,
.product-price-tooltip b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-price-tooltip span {
  color: rgba(255, 255, 255, 0.7);
}

.product-price-tooltip b {
  color: var(--lime);
  font-size: 14px;
}

.product-price-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 14px;
}

.product-price-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

@media (max-width: 700px) {
  .product-price-panel {
    margin: 20px 0;
    padding: 21px 18px 19px;
    border-radius: 20px;
  }

  .product-price-header {
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 19px;
  }

  .product-price-identity {
    align-items: flex-start;
    gap: 12px;
  }

  .product-price-image {
    width: 57px;
    height: 57px;
    border-radius: 14px;
  }

  .product-price-identity h2 {
    margin-top: 0;
    font-size: 24px;
  }

  .product-price-close {
    min-height: 34px;
    padding: 0 11px;
    font-size: 11px;
  }

  .product-price-legend {
    grid-template-columns: 1fr;
  }

  .product-price-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-price-image-placeholder {
    animation: none;
  }

  .price-legend-item,
  .price-line,
  .price-line-label,
  .price-point {
    transition: none;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--canvas);
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 84% -8%, rgba(217, 232, 126, 0.34), transparent 30rem),
    linear-gradient(rgba(252, 250, 244, 0.18) 1px, transparent 1px),
    var(--canvas);
  background-size: auto, 100% 28px, auto;
  color: var(--ink);
  font-family: "Schibsted Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: 36px;
}

.topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(24, 48, 40, 0.12);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--forest);
  color: var(--cream);
  font-weight: 600;
  letter-spacing: -0.04em;
}

.brand-receipt {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
}

.brand-receipt path {
  fill: var(--forest-dark);
}

.brand-receipt rect {
  fill: var(--cream);
}

.brand-receipt rect:nth-of-type(2) {
  opacity: 0.48;
}

.brand-receipt .receipt-total-line {
  fill: var(--lime);
  opacity: 1;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
}

.brand-lockup strong {
  font-family: "Newsreader", Georgia, serif;
  font-size: 18px;
  font-weight: 600;
}

.brand-lockup small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.live-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.live-status span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3d9d6d;
  box-shadow: 0 0 0 4px rgba(61, 157, 109, 0.12);
}

.tabs {
  display: flex;
  gap: 4px;
  margin: 24px 0 36px;
}

.tabs button {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 550;
}

.tabs button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.45);
}

.tabs button[aria-selected="true"] {
  background: var(--ink);
  color: var(--cream);
}

.tabs button:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.text-button:focus-visible,
.drop-zone:focus-within {
  outline: 3px solid rgba(71, 125, 175, 0.35);
  outline-offset: 3px;
}

.page-panel {
  animation: reveal 220ms ease-out;
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 30px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--forest);
  font-family: "Spline Sans Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.page-heading h1 {
  max-width: 650px;
  margin: 0;
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(38px, 5.4vw, 64px);
  line-height: 1;
  letter-spacing: -0.025em;
  font-weight: 500;
}

.page-heading > div > p:last-child {
  max-width: 580px;
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.secondary-button,
.primary-button {
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 600;
}

.secondary-button {
  flex: 0 0 auto;
  padding: 11px 16px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
}

.secondary-button:hover {
  background: var(--surface);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  min-height: 156px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px;
  border: 1px solid rgba(24, 48, 40, 0.11);
  border-radius: 20px;
  background: rgba(252, 250, 244, 0.88);
  box-shadow: 0 18px 38px -30px rgba(15, 53, 40, 0.35);
}

.stat-card > span,
.stat-card small {
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  margin: auto 0 8px;
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1;
  letter-spacing: -0.025em;
  font-weight: 500;
}

.accent-card {
  background: var(--forest);
  color: var(--cream);
  border-color: transparent;
}

.accent-card > span,
.accent-card small {
  color: rgba(255, 253, 247, 0.68);
}

.chart-section,
.recent-section {
  border: 1px solid rgba(24, 48, 40, 0.11);
  border-radius: 20px;
  background: rgba(252, 250, 244, 0.9);
  box-shadow: 0 18px 38px -30px rgba(15, 53, 40, 0.35);
}

.chart-section {
  padding: 24px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.section-heading h2 {
  margin: 0;
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -0.02em;
  font-weight: 500;
}

.section-meta {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.category-chart {
  display: grid;
  grid-template-columns: minmax(300px, 1.35fr) minmax(260px, 0.65fr);
  align-items: center;
  gap: 28px;
}

.donut-stage {
  min-width: 0;
  display: grid;
  place-items: center;
}

.donut-svg {
  width: min(100%, 460px);
  height: auto;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 18px 20px rgba(15, 53, 40, 0.1));
}

.donut-track {
  fill: none;
  stroke: #ebe6d8;
  stroke-width: 34;
}

.donut-segment {
  fill: none;
  stroke-width: 34;
  stroke-linecap: butt;
  transition: stroke-width 160ms ease, filter 160ms ease;
}

.donut-segment:hover {
  stroke-width: 39;
  filter: brightness(1.04);
}

.donut-center-kicker,
.donut-center-value,
.donut-center-detail {
  text-anchor: middle;
}

.donut-center-kicker {
  fill: var(--muted);
  font-family: "Spline Sans Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
}

.donut-center-value {
  fill: var(--ink);
  font-family: "Newsreader", Georgia, serif;
  font-size: 26px;
  font-weight: 600;
}

.donut-center-detail {
  fill: var(--muted);
  font-size: 10px;
}

.pie-stage {
  min-width: 0;
  display: grid;
  place-items: center;
}

.pie-svg {
  width: min(100%, 560px);
  height: auto;
  display: block;
  overflow: visible;
}

.pie-face {
  stroke: rgba(255, 253, 247, 0.82);
  stroke-width: 2;
  stroke-linejoin: round;
}

.pie-shine {
  pointer-events: none;
}

.pie-percentage {
  fill: var(--cream);
  stroke: rgba(24, 48, 40, 0.5);
  stroke-width: 3px;
  paint-order: stroke fill;
  text-anchor: middle;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.category-legend {
  margin: 0;
  padding: 0;
  list-style: none;
}

.category-legend-row {
  display: grid;
  grid-template-columns: 11px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
  padding: 11px 12px;
  border: 1px solid rgba(224, 219, 203, 0.9);
  border-radius: 13px;
  background: rgba(248, 245, 236, 0.75);
  font-variant-numeric: tabular-nums;
}

.category-legend-row:last-child {
  margin-bottom: 0;
}

.category-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 3px;
}

.category-legend-name,
.category-legend-value,
.category-legend-name strong,
.category-legend-name small,
.category-legend-value strong,
.category-legend-value small {
  display: block;
}

.category-legend-name {
  min-width: 0;
}

.category-legend-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 550;
}

.category-legend-value {
  text-align: right;
}

.category-legend-value strong {
  font-size: 13px;
  font-weight: 600;
}

.category-legend-name small,
.category-legend-value small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.empty-chart {
  grid-column: 1 / -1;
  margin: 24px 0;
  color: var(--muted);
  text-align: center;
}

.dashboard-split {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 20px;
  margin-top: 20px;
}

.compact-heading {
  align-items: start;
}

.weekly-chart {
  min-width: 0;
}

.weekly-histogram {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  grid-template-rows: 250px auto;
  column-gap: 10px;
  row-gap: 10px;
}

.weekly-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-bottom: 1px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.weekly-plot {
  min-width: 0;
  position: relative;
  border-bottom: 1px solid rgba(24, 48, 40, 0.22);
}

.weekly-gridlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(24, 48, 40, 0.10) 0 1px, transparent 1px 25%);
  pointer-events: none;
}

.weekly-bars,
.weekly-labels {
  --week-count: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(var(--week-count), minmax(0, 1fr));
  gap: clamp(6px, 2vw, 16px);
}

.weekly-bars {
  position: absolute;
  inset: 0;
  align-items: end;
  padding: 28px clamp(5px, 1vw, 10px) 0;
}

.weekly-column {
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: end;
  justify-content: center;
}

.weekly-stack {
  width: min(100%, 66px);
  min-height: 2px;
  position: relative;
}

.weekly-total {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 5px);
  transform: translateX(-50%);
  white-space: nowrap;
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.weekly-bar {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column-reverse;
  overflow: hidden;
  border-radius: 6px 6px 2px 2px;
  background: #e4e6e0;
  box-shadow: 0 8px 14px rgba(24, 48, 40, 0.10);
}

.weekly-segment {
  width: 100%;
  min-height: 1px;
  border-top: 1px solid rgba(255, 253, 247, 0.55);
}

.weekly-labels {
  padding: 0 clamp(5px, 1vw, 10px);
}

.weekly-label {
  min-width: 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.weekly-label strong,
.weekly-label small {
  display: block;
}

.weekly-label strong {
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.weekly-label small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.weekly-label-spacer {
  min-height: 1px;
}

.product-ranking {
  margin: 0;
  padding: 0;
  list-style: none;
}

.product-ranking li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.product-ranking li:last-child {
  border-bottom: 0;
}

.rank-number {
  color: var(--forest);
  font-family: "Spline Sans Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.product-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.product-name small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.product-ranking strong {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.recent-section {
  margin-top: 20px;
  overflow: hidden;
}

.recent-section .section-heading {
  padding: 24px 24px 0;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  text-align: left;
  font-size: 12px;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 500;
}

td:last-child,
th:last-child {
  text-align: right;
}

.notice {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 13px;
}

.notice strong {
  font-weight: 650;
}

.error-notice {
  margin-bottom: 18px;
  background: #f8e8e4;
  color: var(--danger);
  border: 1px solid #e9c5bf;
}

.success-notice {
  background: #e7f3eb;
  color: var(--success);
  border: 1px solid #c4dfcd;
}

.loading-state {
  min-height: 360px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(251, 250, 246, 0.72);
}

.search-page {
  max-width: 1180px;
  margin: 0 auto;
}

.search-heading {
  align-items: start;
  margin-bottom: 24px;
}

.item-search {
  margin-bottom: 18px;
}

.item-search > label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.item-search-control {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(251, 250, 246, 0.88);
  box-shadow: 0 12px 30px rgba(35, 51, 44, 0.04);
}

.item-search-control:focus-within {
  border-color: rgba(57, 117, 95, 0.55);
  box-shadow: 0 0 0 4px rgba(57, 117, 95, 0.1);
}

.search-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 2px solid var(--forest);
  border-radius: 50%;
  position: relative;
}

.search-icon::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 2px;
  right: -6px;
  bottom: -3px;
  border-radius: 2px;
  background: var(--forest);
  transform: rotate(45deg);
}

.item-search-control input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.item-search-control input::placeholder {
  color: #89958f;
}

.clear-search {
  border: 0;
  padding: 8px 4px;
  background: transparent;
  color: var(--forest);
  cursor: pointer;
  font-weight: 650;
}

.search-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.search-stats article {
  min-height: 108px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  border: 1px solid rgba(24, 48, 40, 0.11);
  border-radius: 16px;
  background: rgba(251, 250, 246, 0.78);
}

.search-stats span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-stats strong {
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(28px, 3.4vw, 38px);
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.search-results {
  overflow: hidden;
  border: 1px solid rgba(24, 48, 40, 0.11);
  border-radius: 20px;
  background: rgba(251, 250, 246, 0.78);
  box-shadow: 0 12px 30px rgba(35, 51, 44, 0.04);
}

.search-results .section-heading {
  padding: 24px 24px 0;
}

.search-empty {
  padding: 60px 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}

.item-results-table td:first-child {
  min-width: 260px;
  white-space: normal;
}

.item-results-table td:first-child small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.item-result-name {
  font-weight: 650;
}

.upload-page {
  max-width: 980px;
  margin: 0 auto;
}

.upload-heading {
  align-items: start;
}

.upload-methods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(251, 250, 246, 0.62);
}

.upload-methods button {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 3px;
  padding: 14px 16px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.upload-methods button[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 7px 18px rgba(35, 51, 44, 0.08);
}

.upload-methods strong {
  font-size: 14px;
  font-weight: 650;
}

.upload-methods small {
  color: inherit;
  font-size: 11px;
}

.upload-methods button:focus-visible,
.url-entry-card textarea:focus-visible {
  outline: 3px solid rgba(71, 125, 175, 0.35);
  outline-offset: 2px;
}

.upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 22px;
}

.url-upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 22px;
}

.url-entry-card {
  min-height: 380px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(251, 250, 246, 0.78);
  box-shadow: 0 12px 30px rgba(35, 51, 44, 0.04);
}

.url-entry-card label {
  display: block;
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 620;
  letter-spacing: -0.02em;
}

.qr-intro {
  display: grid;
  gap: 16px;
  margin: 10px 0 18px;
  padding: 18px;
  border: 1px solid rgba(57, 117, 95, 0.22);
  border-radius: 17px;
  background: rgba(57, 117, 95, 0.07);
}

.qr-intro > div:first-child {
  display: grid;
  gap: 4px;
}

.qr-intro strong {
  font-size: 16px;
}

.qr-intro span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.qr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.qr-primary-button,
.qr-secondary-button {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 11px;
  font: 650 12px/1 "Schibsted Grotesk", sans-serif;
  cursor: pointer;
}

.qr-primary-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--forest);
  background: var(--forest);
  color: #fffdf7;
}

.qr-primary-button svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.qr-primary-button:disabled {
  cursor: progress;
  opacity: 0.72;
}

.qr-secondary-button {
  border: 1px solid rgba(57, 117, 95, 0.3);
  background: var(--surface);
  color: var(--forest);
}

.qr-primary-button:focus-visible,
.qr-secondary-button:focus-visible,
.qr-stop-button:focus-visible {
  outline: 3px solid rgba(71, 125, 175, 0.35);
  outline-offset: 2px;
}

.qr-scanner-shell {
  margin: 0 0 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #111814;
  overflow: hidden;
}

#qr-reader {
  width: 100%;
  min-height: 260px;
  border: 0 !important;
  border-radius: 12px;
  overflow: hidden;
  background: #0b100d;
  color: #fff;
}

#qr-reader video,
#qr-reader img,
#qr-reader canvas {
  border-radius: 12px;
}

.qr-stop-button {
  display: block;
  margin: 10px auto 2px;
  color: #fffdf7;
}

.qr-status {
  margin: 0 0 16px;
  padding: 11px 13px;
  border-radius: 11px;
  font-size: 12px;
  line-height: 1.5;
}

.qr-status.is-info {
  background: rgba(71, 125, 175, 0.1);
  color: #315f88;
}

.qr-status.is-success {
  background: rgba(57, 117, 95, 0.1);
  color: var(--forest);
}

.qr-status.is-error {
  background: rgba(201, 109, 97, 0.1);
  color: var(--danger);
}

.method-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.method-divider::before,
.method-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.url-entry-card textarea {
  width: 100%;
  min-height: 154px;
  resize: vertical;
  padding: 15px 16px;
  border: 1px solid #b7c0b9;
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font: 13px/1.55 "Spline Sans Mono", "SFMono-Regular", Consolas, monospace;
  overflow-wrap: anywhere;
}

.url-entry-card textarea[aria-invalid="true"] {
  border-color: #c96d61;
  box-shadow: 0 0 0 3px rgba(201, 109, 97, 0.12);
}

.field-help,
.field-error {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.55;
}

.field-help {
  color: var(--muted);
}

.field-error {
  color: var(--danger);
  font-weight: 600;
}

.url-benefits {
  display: grid;
  gap: 9px;
  margin-top: 24px;
}

.url-benefits span {
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(255, 253, 247, 0.78);
  font-size: 12px;
}

.url-benefits span::before {
  content: "✓";
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(223, 237, 154, 0.14);
  color: var(--lime);
  font-size: 11px;
}

.drop-zone {
  min-height: 520px;
  padding: 18px;
  border: 1.5px dashed #9ead9f;
  border-radius: 22px;
  background: rgba(251, 250, 246, 0.62);
  transition: border-color 160ms ease, background 160ms ease;
}

.drop-zone.is-empty {
  display: grid;
  place-items: center;
}

.drop-zone:hover {
  border-color: var(--forest);
  background: rgba(251, 250, 246, 0.92);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.drop-copy {
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 30px;
  text-align: center;
}

.drop-copy::before {
  content: "+";
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--lime);
  color: var(--forest-dark);
  font-size: 27px;
  font-weight: 350;
}

.drop-copy strong {
  font-size: 17px;
  font-weight: 600;
}

.drop-copy small {
  color: var(--muted);
}

.receipt-previews {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-items: start;
  gap: 14px;
}

.receipt-preview-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(35, 51, 44, 0.06);
}

.receipt-preview-card > img {
  width: 100%;
  height: 230px;
  display: block;
}

.receipt-preview-card > img {
  object-fit: contain;
  background: #20231f;
}

.preview-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
}

.preview-meta > span {
  min-width: 0;
}

.preview-meta strong,
.preview-meta small {
  display: block;
}

.preview-meta strong {
  font-size: 12px;
  font-weight: 600;
}

.preview-meta small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
}

.preview-actions button {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--cream);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
}

.preview-actions button:hover:not(:disabled) {
  border-color: var(--forest);
}

.preview-actions button:disabled {
  opacity: 0.3;
}

.upload-summary {
  min-height: 330px;
  align-self: start;
  padding: 24px;
  border-radius: 20px;
  background: var(--forest);
  color: var(--cream);
}

.upload-summary .eyebrow {
  color: var(--lime);
}

.upload-summary h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: "Newsreader", Georgia, serif;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 500;
}

.upload-summary > p:not(.eyebrow) {
  margin: 12px 0 0;
  color: rgba(255, 253, 247, 0.66);
  font-size: 13px;
  line-height: 1.55;
}

.upload-summary-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.text-button {
  padding: 0;
  border: 0;
  border-bottom: 1px solid rgba(255, 253, 247, 0.4);
  background: transparent;
  color: var(--cream);
  cursor: pointer;
  font-size: 12px;
}

.primary-button {
  width: 100%;
  margin-top: 30px;
  padding: 14px 18px;
  background: var(--lime);
  color: var(--forest-dark);
}

.primary-button:hover:not(:disabled) {
  background: #e5eeaf;
}

.upload-notice {
  margin-top: 18px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid rgba(24, 48, 40, 0.12);
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 840px) {
  .stats-grid,
  .dashboard-split {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .accent-card {
    grid-column: 1 / -1;
  }

  .upload-layout,
  .url-upload-layout {
    grid-template-columns: 1fr;
  }

  .search-stats {
    grid-template-columns: 1fr 1fr;
  }

  .search-stats article:first-child {
    grid-column: 1 / -1;
  }

  .category-chart {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .pie-svg {
    width: min(100%, 520px);
  }

  .drop-zone {
    min-height: 380px;
  }

  .upload-methods button {
    padding: 12px;
  }

  .upload-methods small {
    display: none;
  }

  .url-entry-card {
    min-height: 0;
    padding: 20px;
  }

  #qr-reader {
    min-height: 220px;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 24px, 1180px);
  }

  .topbar {
    min-height: 72px;
  }

  .live-status {
    font-size: 0;
  }

  .tabs {
    margin: 18px 0 28px;
    gap: 2px;
  }

  .qr-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .qr-primary-button,
  .qr-secondary-button {
    justify-content: center;
  }

  .tabs button {
    flex: 1;
    padding: 9px 8px;
    font-size: 12px;
  }

  .page-heading {
    align-items: start;
    flex-direction: column;
  }

  .page-heading h1 {
    font-size: 40px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .search-stats {
    grid-template-columns: 1fr;
  }

  .search-stats article:first-child {
    grid-column: auto;
  }

  .search-results .section-heading {
    padding: 18px 18px 0;
  }

  .accent-card {
    grid-column: auto;
  }

  .stat-card {
    min-height: 132px;
  }

  .chart-section {
    padding: 18px;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    margin-bottom: 20px;
  }

  .section-meta {
    text-align: left;
  }

  .pie-svg {
    width: 100%;
  }

  .weekly-histogram {
    grid-template-columns: 42px minmax(0, 1fr);
    grid-template-rows: 230px auto;
    column-gap: 7px;
  }

  .weekly-bars,
  .weekly-labels {
    gap: 5px;
  }

  .weekly-total {
    font-size: 9px;
  }

  .recent-section {
    padding-bottom: 6px;
  }

  .recent-section .section-heading {
    padding: 18px 18px 0;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  tr {
    padding: 12px 18px;
    border-top: 1px solid var(--line);
  }

  td {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 4px 0;
    border: 0;
    text-align: right;
    white-space: normal;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    text-align: left;
  }

  td:last-child {
    text-align: right;
  }

  .item-results-table td:first-child {
    min-width: 0;
  }

  .drop-zone {
    min-height: 330px;
    padding: 12px;
  }

  .receipt-previews {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .receipt-preview-card > img {
    height: 180px;
  }

  footer {
    flex-direction: column;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.login-shell {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(440px, 560px);
  background: var(--canvas);
}

.login-story {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 54px;
  padding: clamp(38px, 5vw, 64px);
  background:
    radial-gradient(circle at 92% 6%, rgba(217, 232, 126, 0.18), transparent 23rem),
    var(--forest-dark);
  color: var(--cream);
}

.login-story::after {
  content: "";
  width: 26rem;
  height: 26rem;
  position: absolute;
  right: -14rem;
  bottom: -15rem;
  border: 1px solid rgba(217, 232, 126, 0.16);
  border-radius: 50%;
  box-shadow: 0 0 0 4rem rgba(217, 232, 126, 0.025), 0 0 0 8rem rgba(217, 232, 126, 0.018);
  pointer-events: none;
}

.login-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 13px;
}

.login-brand .brand-receipt {
  width: 44px;
  height: 44px;
}

.login-story .brand-receipt path {
  fill: var(--cream);
}

.login-story .brand-receipt rect {
  fill: var(--forest-dark);
}

.login-story .brand-receipt .receipt-total-line {
  fill: var(--lime);
}

.login-brand strong,
.login-brand small {
  display: block;
}

.login-brand strong {
  font-family: "Newsreader", Georgia, serif;
  font-size: 22px;
  font-weight: 600;
}

.login-brand small {
  margin-top: 2px;
  color: #9db3a4;
  font-family: "Spline Sans Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.login-promise {
  max-width: 660px;
  position: relative;
  z-index: 1;
  animation: reveal 420ms ease-out;
}

.login-promise .eyebrow {
  color: var(--lime);
}

.login-promise h1 {
  max-width: 660px;
  margin: 0;
  color: var(--cream);
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(48px, 6.1vw, 76px);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 0.98;
}

.login-promise > p:not(.eyebrow) {
  max-width: 600px;
  margin: 24px 0 0;
  color: #b9c8bd;
  font-size: clamp(16px, 1.5vw, 19px);
  line-height: 1.6;
}

.benefit-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.benefit-chips span,
.login-trust {
  font-family: "Spline Sans Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
}

.benefit-chips span {
  padding: 7px 11px;
  border: 1px solid rgba(252, 250, 244, 0.2);
  border-radius: 999px;
  color: #a9bcae;
}

.receipt-sample {
  width: min(310px, 72%);
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  padding: 22px 24px 30px;
  transform: rotate(-1.8deg);
  border-radius: 17px 17px 3px 3px;
  background: var(--cream);
  box-shadow: 0 26px 46px -24px rgba(0, 0, 0, 0.58);
  color: #3c4a42;
  font: 11px/1.35 "Spline Sans Mono", monospace;
}

.receipt-sample::after {
  content: "";
  height: 12px;
  position: absolute;
  right: 0;
  bottom: -10px;
  left: 0;
  background: linear-gradient(135deg, var(--cream) 7px, transparent 0) 0 0 / 14px 12px repeat-x;
}

.receipt-sample > span:not(.receipt-store) {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.receipt-sample em {
  overflow: hidden;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receipt-sample strong {
  white-space: nowrap;
}

.receipt-store {
  margin-bottom: 4px;
  color: #7c8a80;
  font-size: 9px;
  letter-spacing: 0.12em;
}

.receipt-sample-total {
  margin-top: 3px;
  padding-top: 10px;
  border-top: 1px dashed #c9c4b2;
  color: var(--ink);
  font-weight: 600;
}

.receipt-sample-total strong {
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--lime);
}

.login-panel {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding: clamp(32px, 5vw, 64px);
}

.login-card {
  width: 100%;
  padding: clamp(30px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(252, 250, 244, 0.96);
  box-shadow: 0 24px 54px -38px rgba(15, 53, 40, 0.5);
}

.login-lock {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--forest);
  font: 600 10px/1 "Spline Sans Mono", monospace;
  letter-spacing: 0.18em;
}

.login-lock span {
  width: 12px;
  height: 9px;
  position: relative;
  display: inline-block;
  border: 1.4px solid currentColor;
  border-radius: 2px;
}

.login-lock span::before {
  content: "";
  width: 6px;
  height: 6px;
  position: absolute;
  left: 1.6px;
  top: -6px;
  border: 1.4px solid currentColor;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
}

.login-card h2 {
  margin: 0;
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(34px, 4vw, 43px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.login-card > p {
  margin: 13px 0 26px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 9px;
}

.login-form label {
  font-size: 13px;
  font-weight: 600;
}

.login-form input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1.5px solid #c9c4b2;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
}

.login-form input:focus {
  border-color: var(--forest);
  outline: 3px solid rgba(30, 91, 71, 0.14);
}

.login-form .primary-button {
  min-height: 54px;
  margin-top: 7px;
  background: var(--lime);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.login-form .primary-button:hover:not(:disabled) {
  background: #cfe05f;
}

.bot-field {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

.login-message {
  margin: 6px 0 0;
  padding: 14px 15px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
}

.success-message {
  border-color: #bfd8c6;
  background: #e2ede4;
  color: #24523c;
}

.error-message {
  border-color: #e5c1bb;
  background: #f6e4e1;
  color: var(--danger);
}

.login-footnote {
  display: block;
  margin-top: 20px;
  color: #7c867f;
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

.login-trust {
  display: flex;
  justify-content: center;
  gap: 12px;
  color: #8a9289;
}

.login-trust i {
  font-style: normal;
}

.account-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-email {
  max-width: 260px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-area .text-button {
  border-bottom-color: rgba(30, 91, 71, 0.35);
  color: var(--forest);
}

@media (max-width: 980px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-story {
    min-height: auto;
    gap: 32px;
    padding: 30px clamp(24px, 7vw, 54px) 38px;
  }

  .login-promise h1 {
    max-width: 720px;
    font-size: clamp(44px, 9vw, 66px);
  }

  .receipt-sample {
    display: none;
  }

  .login-panel {
    min-height: auto;
    padding: 30px clamp(20px, 7vw, 54px) 38px;
  }

  .login-card {
    max-width: 560px;
    margin: 0 auto;
  }
}

@media (max-width: 640px) {
  .account-email {
    max-width: 130px;
  }

  .login-story {
    gap: 28px;
    padding: 24px 22px 30px;
  }

  .login-brand .brand-receipt {
    width: 38px;
    height: 38px;
  }

  .login-brand strong {
    font-size: 19px;
  }

  .login-promise h1 {
    font-size: clamp(40px, 12vw, 54px);
  }

  .login-promise > p:not(.eyebrow) {
    margin-top: 16px;
    font-size: 15px;
  }

  .benefit-chips {
    margin-top: 20px;
  }

  .benefit-chips span:nth-child(3) {
    display: none;
  }

  .login-panel {
    padding: 22px 16px 30px;
  }

  .login-card {
    padding: 28px 22px;
  }

  .login-trust {
    gap: 7px;
    font-size: 8px;
  }
}

/* Área autenticada — direção visual do painel */
.app-shell {
  width: min(1280px, 100%);
  padding-bottom: 0;
  background: var(--canvas);
}

.topbar {
  min-height: 82px;
  padding: 0 50px;
  background: #f8f5ec;
}

.topbar .brand-receipt {
  width: 36px;
  height: 36px;
}

.tabs {
  margin: 0;
  padding: 5px;
  border-radius: 999px;
  background: #efeada;
}

.tabs button {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 20px;
}

.tabs svg {
  width: 18px;
  height: 18px;
  display: none;
  flex: 0 0 auto;
}

.tabs button[data-tab="overview"] svg rect {
  fill: currentColor;
}

.tabs button[data-tab="search"] svg,
.tabs button[data-tab="upload"] svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-content {
  padding: 44px 50px 50px;
}

.stats-grid {
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 18px;
}

.stat-card {
  min-height: 164px;
  padding: 28px;
  border-radius: 22px;
}

.stat-card > span {
  font-family: "Spline Sans Mono", monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.accent-card {
  position: relative;
  overflow: hidden;
  background: var(--forest-dark);
}

.accent-card::after {
  content: "";
  width: 160px;
  height: 160px;
  position: absolute;
  right: -36px;
  top: -42px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 232, 126, 0.18), transparent 68%);
  pointer-events: none;
}

.category-section,
.dashboard-split,
.recent-section,
.search-results {
  border-radius: 22px;
}

.category-chart {
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 44px;
}

.donut-svg {
  width: min(100%, 240px);
}

.donut-center-value {
  font-family: "Schibsted Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 700;
}

.donut-center-detail {
  font-family: "Newsreader", Georgia, serif;
  font-size: 26px;
  font-weight: 500;
}

.category-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 34px;
}

.category-legend-row {
  margin: 0;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid #eee9db;
  border-radius: 0;
  background: transparent;
}

.category-dot {
  border-radius: 3px;
}

.dashboard-split {
  grid-template-columns: 1.5fr 1fr;
  gap: 18px;
}

.weekly-histogram {
  grid-template-rows: 210px auto;
}

.product-ranking li {
  padding: 13px 0;
}

.rank-number {
  font-family: "Newsreader", Georgia, serif;
  font-size: 20px;
  font-weight: 500;
}

.recent-section .section-heading {
  padding: 28px 32px 0;
}

.recent-section th:first-child,
.recent-section td:first-child {
  font-family: "Spline Sans Mono", monospace;
  color: var(--forest);
}

footer {
  justify-content: center;
  font-family: "Spline Sans Mono", monospace;
  letter-spacing: 0.08em;
}

footer span:last-child::before {
  content: "·";
  margin-right: 20px;
}

@media (max-width: 1080px) {
  .topbar {
    padding: 0 28px;
  }

  .brand-lockup small {
    display: none;
  }

  .tabs button {
    padding: 0 14px;
  }

  .app-content {
    padding-right: 28px;
    padding-left: 28px;
  }

  .category-chart {
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 28px;
  }

  .category-legend {
    column-gap: 24px;
  }
}

@media (max-width: 900px) {
  body {
    background: var(--canvas);
  }

  .app-shell {
    width: 100%;
  }

  .topbar {
    min-height: 64px;
    padding: 0 20px;
  }

  .topbar .brand-receipt {
    width: 30px;
    height: 30px;
  }

  .brand-lockup {
    gap: 9px;
  }

  .brand-lockup strong {
    font-size: 16px;
    line-height: 1;
  }

  .tabs {
    min-height: 76px;
    position: fixed;
    z-index: 50;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 0;
    padding: 9px 14px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: rgba(252, 250, 244, 0.96);
    box-shadow: 0 -10px 30px rgba(15, 53, 40, 0.08);
    backdrop-filter: blur(10px);
  }

  .tabs button {
    min-width: 0;
    min-height: 55px;
    flex-direction: column;
    gap: 4px;
    padding: 7px 4px;
    border-radius: 14px;
    font-size: 10px;
    line-height: 1.1;
  }

  .tabs svg {
    display: block;
  }

  .tabs button[aria-selected="true"] {
    background: var(--forest-dark);
  }

  .tabs button[data-tab="overview"][aria-selected="true"] svg rect:first-child {
    fill: var(--lime);
  }

  .app-content {
    padding: 28px 24px calc(104px + env(safe-area-inset-bottom));
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .accent-card {
    grid-column: 1 / -1;
  }

  .stat-card {
    min-height: 132px;
    padding: 19px;
  }

  .accent-card {
    min-height: 148px;
    padding: 22px;
  }

  .stat-card strong {
    font-size: 29px;
  }

  .accent-card strong {
    font-size: 42px;
  }

  .category-chart {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .donut-svg {
    width: min(100%, 190px);
  }

  .category-legend {
    grid-template-columns: 1fr;
  }

  .dashboard-split {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

@media (max-width: 620px) {
  .topbar {
    padding: 0 18px;
  }

  .account-area {
    gap: 8px;
  }

  .account-area .text-button {
    min-height: 32px;
    padding: 0 11px;
    border: 1.5px solid #c9c4b2;
    border-radius: 10px;
    font-size: 12px;
    text-decoration: none;
  }

  .account-email {
    max-width: 90px;
    font-family: "Spline Sans Mono", monospace;
    font-size: 10px;
  }

  .app-content {
    padding: 22px 20px calc(100px + env(safe-area-inset-bottom));
  }

  #overview-panel .page-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 22px;
  }

  #overview-panel .page-heading > div > p:last-child {
    display: none;
  }

  #overview-panel .page-heading h1 {
    font-size: 32px;
    line-height: 1.04;
  }

  #overview-panel .secondary-button {
    padding: 10px 12px;
    font-size: 12px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .accent-card {
    grid-column: 1 / -1;
  }

  .stat-card > span {
    font-size: 8.5px;
    letter-spacing: 0.11em;
  }

  .stat-card small {
    font-size: 11px;
  }

  .category-section,
  .chart-section {
    padding: 22px;
  }

  .category-section .section-meta,
  .dashboard-split .section-meta {
    display: none;
  }

  .category-legend-row {
    padding: 10px 0;
  }

  .weekly-histogram {
    grid-template-rows: 180px auto;
  }

  .recent-section {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .recent-section .section-heading {
    padding: 0;
  }

  .recent-section tbody {
    display: grid;
    gap: 12px;
  }

  .recent-section tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
  }

  .recent-section td {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 3px;
    padding: 0;
    text-align: left;
    white-space: normal;
  }

  .recent-section td::before {
    font-family: "Spline Sans Mono", monospace;
    font-size: 8px;
    letter-spacing: 0.11em;
    text-transform: uppercase;
  }

  .recent-section td:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
    justify-content: center;
  }

  .recent-section td:nth-child(6) {
    grid-column: 2;
    grid-row: 1;
    align-items: flex-end;
    justify-content: center;
    font-family: "Newsreader", Georgia, serif;
    font-size: 21px;
  }

  .recent-section td:nth-child(1)::before,
  .recent-section td:nth-child(6)::before {
    display: none;
  }

  .recent-section td:nth-child(2) { grid-column: 1; grid-row: 2; }
  .recent-section td:nth-child(3) { grid-column: 2; grid-row: 2; }
  .recent-section td:nth-child(4) { grid-column: 1; grid-row: 3; }
  .recent-section td:nth-child(5) { grid-column: 2; grid-row: 3; }

  footer {
    display: none;
  }
}


/* Product taxonomy: detailed subcategories */
.subcategory-highlights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.subcategory-card {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid rgba(57, 117, 95, 0.13);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(226, 236, 217, 0.38));
}
.subcategory-card > span { min-width: 0; display: grid; gap: 2px; }
.subcategory-card > span:last-child { justify-items: end; text-align: right; }
.subcategory-card strong { overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.subcategory-card small { color: var(--muted); font-size: 9px; letter-spacing: 0.04em; text-transform: uppercase; }
.subcategory-card .subcategory-rank {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--forest);
  color: white;
  font-family: monospace;
  font-size: 9px;
  font-weight: 800;
}
.search-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.search-filter-row label { color: var(--muted); font-size: 11px; font-weight: 700; }
.search-filter-row select {
  min-height: 40px;
  max-width: min(100%, 360px);
  padding: 0 36px 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(251, 250, 246, 0.88);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.search-filter-row select:focus { border-color: rgba(57, 117, 95, 0.55); outline: 3px solid rgba(57, 117, 95, 0.1); }
.search-filter-row button { border: 0; background: transparent; color: var(--forest); cursor: pointer; font: inherit; font-size: 11px; font-weight: 700; }
.category-path { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.subcategory-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid rgba(57, 117, 95, 0.18);
  border-radius: 999px;
  background: rgba(216, 231, 198, 0.45);
  color: var(--forest);
  font-size: 10px;
  font-weight: 750;
}
@media (max-width: 840px) {
  .subcategory-highlights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .subcategory-highlights { grid-template-columns: 1fr; }
  .search-filter-row { align-items: flex-start; flex-direction: column; }
  .search-filter-row select { width: 100%; max-width: none; }
}
/* Interactive category drilldown */
.donut-segment { cursor: pointer; }
.donut-segment:focus-visible {
  stroke-width: 40;
  outline: none;
  filter: drop-shadow(0 0 4px rgba(24, 48, 40, .35));
}
.donut-segment.is-active { stroke-width: 40; filter: brightness(1.04); }
.category-legend-row {
  display: block;
  overflow: hidden;
  padding: 0;
  transition: border-color 160ms ease, background 160ms ease;
}
.category-legend-row.is-expanded {
  grid-column: 1 / -1;
  border-color: rgba(57, 117, 95, .24);
  background: rgba(243, 246, 235, .78);
}
.category-legend-button {
  width: 100%;
  display: grid;
  grid-template-columns: 11px minmax(0, 1fr) auto 22px;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.category-legend-button:hover { background: rgba(57, 117, 95, .055); }
.category-legend-button:focus-visible {
  outline: 3px solid rgba(57, 117, 95, .18);
  outline-offset: -3px;
}
.category-legend-button:disabled { cursor: default; }
.category-chevron {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(57, 117, 95, .09);
  color: var(--forest);
  font-size: 16px;
  line-height: 1;
  transition: transform 160ms ease, background 160ms ease;
}
.is-expanded .category-chevron { background: var(--forest); color: white; transform: rotate(180deg); }
.category-drilldown {
  margin: 0 12px 12px;
  padding: 17px 4px 4px;
  border-top: 1px solid rgba(57, 117, 95, .14);
}
.category-drilldown-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.category-drilldown-heading span { color: var(--ink); font-size: 12px; font-weight: 750; }
.category-drilldown-heading small { color: var(--muted); font-size: 10px; }
.subcategory-bars { display: grid; gap: 11px; }
.subcategory-bar-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.15fr) minmax(150px, 2fr) minmax(120px, .8fr);
  align-items: center;
  gap: 13px;
  font-variant-numeric: tabular-nums;
}
.subcategory-bar-row > strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subcategory-bar-row > span:last-child { display: grid; justify-items: end; text-align: right; }
.subcategory-bar-row > span:last-child strong { font-size: 11px; }
.subcategory-bar-row > span:last-child small { color: var(--muted); font-size: 9px; }
.subcategory-bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(57, 117, 95, .1);
}
.subcategory-bar-track > span {
  display: block;
  min-width: 3px;
  height: 100%;
  border-radius: inherit;
  opacity: .82;
}
@media (max-width: 620px) {
  .category-legend-row.is-expanded { grid-column: auto; }
  .category-drilldown { margin: 0 10px 10px; padding: 15px 2px 5px; }
  .subcategory-bar-row { grid-template-columns: minmax(0, 1fr) auto; gap: 7px 12px; }
  .subcategory-bar-row > strong { white-space: normal; }
  .subcategory-bar-track { grid-column: 1 / -1; grid-row: 2; }
  .subcategory-bar-row > span:last-child { grid-column: 2; grid-row: 1; }
  .subcategory-bar-row > span:last-child small { display: none; }
}
