:root {
  color-scheme: light;
  --bg: #f3f7f6;
  --surface: #ffffff;
  --ink: #192026;
  --muted: #66717c;
  --line: #dbe5e2;
  --green: #0f7c63;
  --green-soft: #dff3ed;
  --red: #c94141;
  --red-soft: #f8e1df;
  --amber: #a86900;
  --amber-soft: #f6ebd4;
  --gold: #d4ae4f;
  --gold-soft: #fbf3dc;
  --blue: #587581;
  --blue-soft: #edf4f5;
  --ice: #eaf6f8;
  --shadow: 0 18px 48px rgba(22, 42, 48, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, #edf6f7 0, var(--bg) 360px),
    var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

button {
  min-height: 42px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: #aab7b0;
}

.primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.app-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  padding: 24px;
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-logo {
  width: 64px;
  height: 52px;
  border: 1px solid rgba(236, 204, 96, 0.32);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
  padding: 4px;
  box-shadow: 0 10px 26px rgba(126, 100, 29, 0.12);
}

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

h1 {
  font-size: 19px;
  line-height: 1.2;
}

h2 {
  font-size: 28px;
}

h3 {
  font-size: 18px;
}

p,
label,
th,
td,
.metric span {
  color: var(--muted);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.compact {
  display: grid;
  gap: 14px;
  padding: 16px;
  box-shadow: none;
}

.import-panel {
  position: sticky;
  top: 16px;
}

.hidden-meta-fields {
  display: none;
}

.smart-import-head {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.smart-import-head strong {
  display: block;
  font-size: 16px;
}

.smart-import-head p {
  margin-top: 3px;
  font-size: 12px;
}

.import-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
}

.step-index {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.auto-meta-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auto-meta-preview span {
  display: grid;
  gap: 2px;
  min-height: 48px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--muted);
  font-size: 12px;
}

.auto-meta-preview strong {
  color: var(--ink);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.step-fields {
  display: grid;
  gap: 10px;
}

label {
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
}

textarea {
  width: 100%;
  min-height: 170px;
  padding: 11px;
  resize: vertical;
  line-height: 1.5;
}

.input-example {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
  color: #6a7480;
  font-size: 12px;
}

.input-example strong,
.input-example span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f2f6f4;
}

.input-example strong {
  color: var(--green);
  background: var(--green-soft);
}

.image-import {
  display: grid;
  gap: 9px;
  border: 1px dashed #a9c5bd;
  border-radius: 8px;
  background: #f7fbfa;
  padding: 10px;
}

.image-import.dragging {
  border-color: var(--green);
  background: #ecf8f4;
}

.image-import span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.image-import img {
  width: 100%;
  max-height: 140px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.recognition-review {
  position: fixed;
  inset: 28px;
  z-index: 20;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  width: min(1180px, calc(100vw - 56px));
  max-height: calc(100vh - 56px);
  margin: auto;
  padding: 18px;
  border: 1px solid #cbdad6;
  border-radius: 8px;
  background: #fbfdfc;
  box-shadow: 0 26px 70px rgba(20, 36, 42, 0.25);
}

.recognition-review[hidden] {
  display: none;
}

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

.review-heading strong {
  font-size: 15px;
}

.review-heading span {
  color: var(--muted);
  font-size: 12px;
}

.review-table-wrap {
  max-height: none;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.review-table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
  font-size: 12px;
}

.review-table th,
.review-table td {
  padding: 7px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.review-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f8f7;
  color: var(--muted);
  font-weight: 800;
}

.review-table input,
.review-table select {
  min-height: 34px;
  padding: 0 8px;
  font-size: 12px;
}

.review-table .review-date {
  width: 126px;
}

.review-table .review-maker {
  width: 118px;
}

.review-table .review-category {
  width: 96px;
}

.review-table .review-product {
  width: 180px;
}

.review-table .review-price {
  width: 88px;
}

.quote-type {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #7b5b16;
  font-weight: 800;
  white-space: nowrap;
}

.review-table .text-button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--red);
  background: #fff;
}

.review-actions {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  max-width: 520px;
  margin-left: auto;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quote-query-launcher {
  position: fixed;
  left: 24px;
  bottom: 112px;
  z-index: 8;
  width: 292px;
  margin-top: 14px;
  border-color: var(--gold);
  background: var(--gold-soft);
  color: #6b4b0e;
  font-weight: 900;
}

.quote-query-panel {
  position: fixed;
  inset: 40px;
  z-index: 22;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  width: min(1240px, calc(100vw - 80px));
  max-height: calc(100vh - 80px);
  margin: auto;
  padding: 18px;
  box-shadow: 0 26px 70px rgba(20, 36, 42, 0.25);
}

.quote-query-panel[hidden] {
  display: none;
}

.query-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  grid-column: 1;
}

.query-heading strong {
  font-size: 16px;
}

.query-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.query-close {
  justify-self: end;
  min-height: 36px;
}

.quote-query-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 14px;
  grid-column: 1 / -1;
  min-height: 0;
}

.quote-query-browser {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}

.query-field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.query-field input {
  min-width: 0;
}

.quote-query-list {
  display: grid;
  gap: 8px;
  align-content: start;
  overflow: auto;
}

.quote-query-item {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.quote-query-item.active {
  border-color: var(--green);
  box-shadow: 0 12px 24px rgba(15, 124, 99, 0.12);
}

.quote-query-item strong {
  font-size: 14px;
}

.quote-query-item span {
  color: var(--muted);
  font-size: 12px;
}

.quote-query-price {
  color: var(--green);
  font-weight: 900;
}

.quote-sheet-select {
  display: grid;
  gap: 5px;
  padding: 0;
  min-height: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  box-shadow: none;
}

.quote-sheet-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.quote-sheet-actions button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.danger-button {
  border-color: rgba(190, 64, 64, 0.35);
  background: #fff6f3;
  color: #a33a2d;
}

.quote-sheet-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.quote-sheet-meta b {
  color: var(--ink);
}

.quote-sheet-summary {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.quote-sheet-lines {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding: 8px;
  max-height: 240px;
  overflow: auto;
  border-radius: 8px;
  background: var(--surface);
}

.quote-sheet-line {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 12px;
  align-items: center;
  font-size: 12px;
}

.quote-sheet-line span:first-child {
  color: var(--ink);
  font-weight: 800;
}

.quote-sheet-more {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.quote-sheet-detail {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.quote-detail-empty {
  display: grid;
  place-items: center;
  min-height: 280px;
  color: var(--muted);
  text-align: center;
}

.quote-detail-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.quote-detail-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quote-detail-title strong {
  font-size: 18px;
}

.quote-detail-fields {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 190px;
  gap: 10px;
}

.quote-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.quote-detail-table th,
.quote-detail-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.quote-detail-table input,
.quote-detail-table select {
  min-height: 34px;
  padding: 0 8px;
  font-size: 13px;
}

.quote-detail-product {
  min-width: 220px;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 30%);
  gap: 12px;
  margin-bottom: 12px;
  min-height: 224px;
  overflow: hidden;
  border: 1px solid rgba(185, 211, 212, 0.9);
  border-radius: 8px;
  background: linear-gradient(135deg, #f7fcfb 0%, #ffffff 48%, #eef7f5 100%);
  box-shadow: var(--shadow);
}

.hero-copy {
  display: grid;
  grid-template-columns: 158px minmax(0, 1fr);
  justify-items: stretch;
  align-content: center;
  align-items: center;
  gap: 20px;
  padding: 18px 22px;
  min-width: 0;
}

.hero-logo {
  justify-self: center;
  align-self: center;
  width: 158px;
  height: auto;
  max-height: none;
  margin: 0;
  object-fit: contain;
  object-position: center;
  filter: saturate(1.2) contrast(1.08);
}

.hero-copy-stack {
  display: grid;
  gap: 7px;
  align-content: center;
  justify-self: stretch;
  min-width: 0;
}

.eyebrow {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.hero-copy h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.12;
}

.hero-copy p {
  max-width: 520px;
  margin: 0;
}

.market-summary {
  display: block;
  color: #20352f;
  font-size: 14px;
  line-height: 1.45;
}

.filters {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 0.8fr) minmax(0, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.filters select,
.filters input {
  min-width: 0;
}

.hero-media {
  position: relative;
  min-height: 224px;
  overflow: hidden;
  background: #edf6f5;
  border-left: 1px solid rgba(185, 211, 212, 0.72);
}

.hero-media img {
  width: 100%;
  height: 100%;
  min-height: 224px;
  object-fit: cover;
  object-position: center;
  display: block;
}

.hero-media::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(246, 252, 251, 0.46), rgba(246, 252, 251, 0.04) 48%, rgba(246, 252, 251, 0.16));
}

.hero-media span {
  position: absolute;
  right: 14px;
  bottom: 14px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #24515c;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(18, 54, 62, 0.1);
  opacity: 0.86;
}

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

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  min-height: 96px;
  padding: 12px 14px;
  position: relative;
  overflow: hidden;
}

.metric::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 27px;
  line-height: 1;
}

.metric small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.85fr);
  gap: 14px;
  margin-bottom: 14px;
}

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

.product-card {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 112px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(22, 42, 48, 0.08);
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.product-card:hover,
.product-card:focus-visible {
  transform: translateY(-2px);
  border-color: #8bc3b6;
  box-shadow: 0 16px 36px rgba(22, 42, 48, 0.13);
  outline: none;
}

.product-card img {
  width: 104px;
  height: 112px;
  object-fit: cover;
  display: block;
}

.product-card:nth-child(1) img {
  object-position: center;
}

.product-card:nth-child(2) img {
  object-position: center;
}

.product-card:nth-child(3) img {
  object-position: center;
}

.product-card strong {
  display: block;
  font-size: 18px;
}

.product-card span {
  color: var(--muted);
  font-size: 13px;
}

.product-card.empty-category {
  opacity: 0.48;
  filter: grayscale(0.85);
}

.product-card.active-category {
  border-color: var(--green);
  box-shadow: 0 16px 38px rgba(15, 124, 99, 0.16);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding: 16px 16px 0;
}

.panel-heading select {
  max-width: 270px;
}

.chart-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
  min-width: 280px;
}

.chart-actions select {
  width: 100%;
  max-width: 270px;
}

.date-range-filter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: min(360px, 100%);
}

.date-range-filter span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.date-range-filter input {
  min-height: 36px;
  padding: 0 9px;
  font-size: 13px;
}

.segmented-control {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5faf8;
}

.segmented-control button {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.segmented-control button.active {
  background: var(--green);
  color: #fff;
}

.chart-panel canvas {
  display: block;
  width: 100%;
  height: 340px;
  padding: 10px 16px 16px;
}

.forecast-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.forecast-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.forecast-thumb {
  width: 82px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
  object-fit: cover;
}

.forecast-card strong {
  display: block;
  margin-bottom: 6px;
}

.forecast-copy {
  min-width: 0;
}

.forecast-card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.pill.up {
  background: var(--red-soft);
  color: var(--red);
}

.pill.down {
  background: var(--green-soft);
  color: var(--green);
}

.pill.flat {
  background: var(--green-soft);
  color: var(--green);
}

.pill.watch {
  background: var(--amber-soft);
  color: var(--amber);
}

.pill.alert {
  background: var(--red-soft);
  color: var(--red);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.table-panel {
  overflow: hidden;
}

.table-wrap {
  overflow: auto;
  max-height: 52vh;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4faf9;
  font-size: 13px;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.active-row {
  background: #f0f6f2;
}

.product-cell {
  display: flex;
  align-items: center;
}

.product-thumb {
  width: 58px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
  object-fit: cover;
  display: block;
}

.product-thumb.logo-fallback {
  object-fit: contain;
  padding: 5px;
}

.price-up {
  color: var(--red);
  font-weight: 800;
}

.price-down {
  color: var(--green);
  font-weight: 800;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 160px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  color: var(--ink);
}

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

  .workspace {
    order: 1;
  }

  .sidebar {
    order: 2;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .hero-panel,
  .analysis-grid,
  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

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

  .panel-heading {
    display: grid;
  }

  .chart-actions {
    justify-items: stretch;
  }
}

@media (max-width: 620px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .analysis-grid,
  .metrics,
  .product-strip,
  .button-row {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    grid-template-columns: 154px minmax(0, 1fr);
    padding: 18px;
  }

  .hero-logo {
    width: 154px;
    max-width: 100%;
    height: auto;
  }

  .hero-copy h2 {
    font-size: 26px;
  }

  .hero-media,
  .hero-media img {
    min-height: 180px;
  }

  .hero-media {
    order: -1;
    border-left: 0;
    border-bottom: 1px solid rgba(185, 211, 212, 0.72);
  }

  .panel-heading {
    flex-direction: column;
  }

  .quote-query-launcher {
    left: 16px;
    right: 16px;
    bottom: 84px;
    width: auto;
  }

  .quote-query-panel {
    inset: 16px;
    width: auto;
    max-height: calc(100vh - 32px);
    grid-template-columns: 1fr;
  }

  .query-heading {
    grid-column: 1;
  }

  .query-close {
    justify-self: stretch;
  }

  .quote-query-shell,
  .quote-detail-fields {
    grid-template-columns: 1fr;
  }

  .quote-query-browser {
    max-height: 260px;
  }
}
