:root {
  --bg: #f4efe6;
  --bg-2: #f8f7f2;
  --panel: rgba(255, 255, 255, 0.8);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --ink: #1d2433;
  --muted: #64708a;
  --line: rgba(28, 39, 58, 0.12);
  --accent: #106c74;
  --accent-2: #d86d45;
  --accent-3: #23405b;
  --success: #1f7a57;
  --warning: #c9752b;
  --danger: #b6504d;
  --neutral: #5f6e85;
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --shadow: 0 24px 60px rgba(31, 42, 69, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI Variable Display", "Bahnschrift", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(223, 126, 86, 0.28), transparent 34%),
    radial-gradient(circle at top right, rgba(16, 108, 116, 0.24), transparent 30%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
  opacity: 0.35;
}

body::before {
  width: 220px;
  height: 220px;
  right: 6%;
  top: 16%;
  background: rgba(16, 108, 116, 0.42);
}

body::after {
  width: 280px;
  height: 280px;
  left: 4%;
  bottom: 10%;
  background: rgba(216, 109, 69, 0.35);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1540px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 36px 0 72px;
}

.panel {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-lg);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
  gap: 22px;
  align-items: stretch;
}

.hero-copy,
.upload-card,
.controls,
.trend-panel,
.insight-panel,
.dual-grid > .panel,
.footer-note,
.panel:last-child {
  padding: 28px;
}

.eyebrow,
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-copy h1,
.upload-card h2,
.controls h2,
.section-header h2 {
  margin: 14px 0 0;
  font-family: "Cambria", "Georgia", serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero-copy h1 {
  font-size: clamp(2.65rem, 4vw, 4.2rem);
  line-height: 1;
}

.hero-text {
  max-width: 60ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.7;
}

.hero-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.highlight-pill {
  padding: 10px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(16, 108, 116, 0.1), rgba(216, 109, 69, 0.12));
  border: 1px solid rgba(16, 108, 116, 0.12);
  font-weight: 600;
}

.hero-footnote {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.7;
}

.upload-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(250, 247, 241, 0.8)),
    radial-gradient(circle at top right, rgba(16, 108, 116, 0.11), transparent 32%);
}

.upload-head,
.controls-head,
.granularity-row,
.upload-actions,
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.upload-head {
  align-items: flex-start;
}

.status-dot {
  width: 14px;
  height: 14px;
  margin-top: 10px;
  border-radius: 50%;
  background: rgba(100, 112, 138, 0.35);
  box-shadow: 0 0 0 8px rgba(100, 112, 138, 0.08);
}

.status-dot.ready {
  background: var(--success);
  box-shadow: 0 0 0 8px rgba(31, 122, 87, 0.12);
}

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

.ingest-card {
  position: relative;
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 176px;
  padding: 20px;
  border-radius: 24px;
  border: 1.5px dashed rgba(16, 108, 116, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(16, 108, 116, 0.04));
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.ingest-card.primary {
  background: linear-gradient(180deg, rgba(16, 108, 116, 0.08), rgba(255, 255, 255, 0.88));
}

.ingest-card:hover {
  transform: translateY(-2px);
  border-color: rgba(216, 109, 69, 0.45);
  box-shadow: 0 18px 30px rgba(35, 64, 91, 0.08);
}

.ingest-card input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(16, 108, 116, 0.12);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
}

.upload-badge.subtle {
  background: rgba(35, 64, 91, 0.08);
  color: var(--accent-3);
}

.file-pill {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(35, 64, 91, 0.08);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
  word-break: break-word;
}

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

.meta-block {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(35, 64, 91, 0.08);
}

.meta-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.meta-value {
  font-weight: 700;
  line-height: 1.5;
}

.button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.button-chip {
  padding: 10px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid transparent;
  font-size: 0.95rem;
}

.button-chip:hover,
.button-chip.active {
  border-color: rgba(16, 108, 116, 0.26);
  color: var(--accent);
}

.helper-text,
.section-meta,
.footer-note {
  color: var(--muted);
  line-height: 1.6;
}

.controls {
  margin-top: 22px;
}

.filter-badge {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(16, 108, 116, 0.1);
  color: var(--accent);
  font-weight: 700;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.quick-tools-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
  align-items: end;
}

.tool-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  min-width: 0;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid rgba(35, 64, 91, 0.12);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font: inherit;
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(16, 108, 116, 0.16);
  border-color: rgba(16, 108, 116, 0.34);
}

.granularity-row {
  margin-top: 18px;
  align-items: center;
}

.segmented {
  display: inline-flex;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.segmented-button {
  min-width: 88px;
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.segmented-button.active {
  color: white;
  background: linear-gradient(135deg, var(--accent-3), var(--accent));
  box-shadow: 0 12px 24px rgba(16, 108, 116, 0.2);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 22px;
  margin-top: 22px;
}

.forecast-grid,
.action-list,
.decision-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

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

.forecast-card,
.action-card,
.record-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
}

.forecast-label,
.action-kicker,
.record-kicker {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.forecast-value {
  margin-top: 10px;
  font-size: 1.5rem;
  font-weight: 800;
}

.forecast-meta,
.action-meta,
.record-meta,
.record-subtext {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.action-list,
.decision-list {
  grid-template-columns: 1fr;
}

.action-card {
  display: grid;
  gap: 8px;
}

.priority-card,
.clearance-card {
  border-style: solid;
}

.priority-card {
  background: linear-gradient(180deg, rgba(16, 108, 116, 0.06), rgba(255, 255, 255, 0.88));
}

.clearance-card {
  background: linear-gradient(180deg, rgba(201, 117, 43, 0.05), rgba(255, 255, 255, 0.88));
}

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

.action-title strong {
  font-size: 1rem;
}

.summary-card {
  padding: 20px;
  border-radius: 24px;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.summary-card .label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.summary-card .value {
  margin-top: 12px;
  font-size: clamp(1.7rem, 2vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.summary-card .subtext {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.main-grid,
.dual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(420px, 0.95fr);
  gap: 22px;
  margin-top: 22px;
}

.trend-chart {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 16px;
}

.chart-footer,
.inventory-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.legend-pill {
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.legend-pill strong {
  color: var(--ink);
}

.breakdown-grid,
.spotlight-grid {
  display: grid;
  gap: 14px;
}

.breakdown-grid {
  margin-top: 12px;
}

.breakdown-card,
.spotlight-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
}

.breakdown-card h3,
.spotlight-card h3 {
  margin: 0;
  font-size: 1rem;
}

.breakdown-item {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(35, 64, 91, 0.08);
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.spotlight-grid {
  margin-top: 18px;
}

.spotlight-value {
  margin-top: 10px;
  font-size: 1.35rem;
  font-weight: 800;
}

.spotlight-meta {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.product-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(0, 1.1fr);
  gap: 20px;
  margin-top: 16px;
}

.rank-bars {
  display: grid;
  gap: 12px;
}

.rank-bar {
  display: grid;
  gap: 8px;
}

.rank-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rank-title {
  min-width: 0;
}

.rank-title strong {
  display: block;
  font-size: 1rem;
}

.rank-caption {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(35, 64, 91, 0.08);
}

.rank-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), #f2b36d);
}

.table-wrap {
  overflow: auto;
}

.mobile-card-list {
  display: none;
  gap: 12px;
  margin-top: 16px;
}

.data-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

.data-table-wide {
  min-width: 860px;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(35, 64, 91, 0.08);
  text-align: left;
  vertical-align: top;
}

.data-table thead th {
  position: sticky;
  top: 0;
  background: rgba(248, 247, 242, 0.96);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.54);
}

.product-cell {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.product-thumb {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(35, 64, 91, 0.08);
  background: rgba(255, 255, 255, 0.8);
}

.product-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.product-title-row strong {
  min-width: 0;
}

.product-subtitle,
.cell-note,
.table-hint {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.mini-link {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(16, 108, 116, 0.08);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.mini-link:hover {
  background: rgba(16, 108, 116, 0.14);
}

.record-card {
  display: grid;
  gap: 10px;
}

.record-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.record-title {
  font-size: 1rem;
  font-weight: 800;
}

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

.record-item {
  display: grid;
  gap: 4px;
}

.record-item span {
  color: var(--muted);
  font-size: 0.82rem;
}

.record-item strong {
  font-size: 0.96rem;
  line-height: 1.4;
}

.chip,
.recommendation {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(35, 64, 91, 0.08);
  color: var(--accent-3);
  font-size: 0.82rem;
  font-weight: 700;
}

.chip.success,
.recommendation.tone-success {
  background: rgba(31, 122, 87, 0.1);
  color: var(--success);
}

.chip.abc-a,
.recommendation.abc-a {
  background: rgba(16, 108, 116, 0.12);
  color: var(--accent);
}

.chip.abc-b,
.recommendation.abc-b {
  background: rgba(201, 117, 43, 0.12);
  color: var(--warning);
}

.chip.abc-c,
.recommendation.abc-c {
  background: rgba(95, 110, 133, 0.12);
  color: var(--neutral);
}

.chip.warning,
.recommendation.tone-warning {
  background: rgba(201, 117, 43, 0.12);
  color: var(--warning);
}

.chip.danger,
.recommendation.tone-danger {
  background: rgba(182, 80, 77, 0.12);
  color: var(--danger);
}

.chip.neutral,
.recommendation.tone-neutral {
  background: rgba(95, 110, 133, 0.12);
  color: var(--neutral);
}

.empty-state {
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
  padding: 28px 18px;
  border-radius: 20px;
  border: 1px dashed rgba(16, 108, 116, 0.18);
  color: var(--muted);
}

.empty-state-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: rgba(16, 108, 116, 0.1);
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: 800;
}

.footer-note {
  margin-top: 22px;
  padding: 20px 24px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.72);
}

@media (max-width: 1440px) {
  .control-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

@media (max-width: 1280px) {
  .hero,
  .ops-grid,
  .main-grid,
  .dual-grid,
  .product-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 860px) {
  .shell {
    width: min(100vw - 20px, 100%);
    padding-top: 20px;
  }

  .hero-copy,
  .upload-card,
  .controls,
  .trend-panel,
  .insight-panel,
  .dual-grid > .panel,
  .panel:last-child {
    padding: 22px;
  }

  .summary-grid,
  .control-grid,
  .meta-grid,
  .quick-tools-grid,
  .forecast-grid {
    grid-template-columns: 1fr;
  }

  .controls-head,
  .granularity-row,
  .section-header,
  .upload-actions,
  .upload-head {
    flex-direction: column;
    align-items: stretch;
  }

  .quick-range {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .segmented {
    width: 100%;
    justify-content: space-between;
  }

  .segmented-button {
    flex: 1;
  }

  .product-cell {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .product-thumb {
    width: 44px;
    height: 44px;
  }

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

@media (max-width: 580px) {
  .hero-copy h1 {
    font-size: 2.3rem;
  }

  .button {
    width: 100%;
    text-align: center;
  }

  .data-table {
    min-width: 560px;
  }

  .data-table-wide {
    min-width: 760px;
  }
}

@media (max-width: 1080px) {
  .desktop-table {
    display: none;
  }

  .mobile-card-list {
    display: grid;
  }

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