:root {
  --navy: #10263f;
  --orange: #ee4d2d;
  --teal: #087f7a;
  --ink: #17202a;
  --muted: #5d6670;
  --line: #d7dce1;
  --surface: #ffffff;
  --canvas: #eef1f3;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(16, 38, 63, 0.08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums; }
button, input { font: inherit; }
.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.app-header { background: var(--navy); color: white; border-bottom: 1px solid rgba(255,255,255,.16); }
.header-row { height: 68px; display: flex; align-items: center; justify-content: space-between; }
.brand { color: white; text-decoration: none; display: inline-flex; align-items: center; gap: 11px; font-weight: 750; letter-spacing: -.02em; }
.brand svg { width: 28px; height: 28px; color: var(--orange); }
.header-label { color: white; font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }

.search-section { background: var(--navy); color: white; padding: 52px 0 58px; }
.search-layout { display: grid; grid-template-columns: .9fr 1.1fr; gap: 70px; align-items: end; }
.eyebrow { margin: 0 0 12px; color: var(--orange); font-size: .72rem; font-weight: 800; letter-spacing: .14em; }
.eyebrow.dark { color: var(--teal); }
h1 { max-width: 520px; margin: 0; font-size: clamp(2rem, 4vw, 3.35rem); line-height: 1.02; letter-spacing: -.045em; }
.search-form { background: white; color: var(--ink); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); }
.search-form label { display: block; margin-bottom: 8px; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.search-control { display: flex; gap: 10px; }
.search-control input { min-width: 0; flex: 1; height: 48px; border: 1px solid #aeb6bf; border-radius: 8px; padding: 0 14px; color: var(--ink); background: white; outline: none; }
.search-control input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(8,127,122,.18); }
.search-control button { height: 48px; border: 0; border-radius: 8px; padding: 0 18px; background: var(--orange); color: white; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.search-control button:hover { background: #d94326; }
.search-control button:disabled { cursor: wait; opacity: .68; }
.search-control button:focus-visible { outline: 3px solid white; box-shadow: 0 0 0 5px var(--orange); }
.search-control button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.field-note { margin: 9px 0 0; color: var(--muted); font-size: .78rem; }

.dashboard { padding: 40px 0 64px; }
.status { min-height: 180px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); font-weight: 650; }
.status.error { color: #a52d1d; border-color: #a52d1d; }
.result-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 22px; }
.result-heading h2 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.5rem); letter-spacing: -.035em; text-transform: capitalize; }
.capture-meta { text-align: right; }
.capture-meta span { display: block; margin-bottom: 5px; color: var(--muted); font-size: .72rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.capture-meta strong { font-size: .9rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.kpi-card { min-height: 128px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.kpi-card.primary { background: var(--orange); border-color: var(--orange); color: white; }
.kpi-label { margin: 0 0 20px; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.primary .kpi-label, .primary .kpi-detail { color: white; }
.kpi-value { margin: 0; font-size: clamp(1.6rem, 2.8vw, 2.25rem); font-weight: 820; line-height: 1; letter-spacing: -.035em; }
.kpi-detail { margin: 8px 0 0; color: var(--muted); font-size: .75rem; }
.decision-panel { margin-bottom: 14px; }
.decision-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.decision-item { min-height: 112px; padding: 18px; background: white; }
.decision-item strong { display: block; margin-bottom: 8px; color: var(--navy); font-size: .82rem; }
.decision-item p { margin: 0; color: var(--ink); font-size: .82rem; line-height: 1.55; }
.chart-guide-note { margin: 0 0 14px; padding: 11px 14px; border-radius: 8px; background: var(--navy); color: white; font-size: .76rem; line-height: 1.45; }
.chart-guide-note strong { color: white; }

.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.panel { min-width: 0; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-wide { grid-column: span 2; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.panel-heading h3 { margin: 0 0 5px; font-size: 1rem; letter-spacing: -.01em; }
.panel-heading p { margin: 0; color: var(--muted); font-size: .8rem; }
.unit-label { color: var(--teal); font-size: .66rem; font-weight: 850; letter-spacing: .1em; white-space: nowrap; }
.chart { min-height: 260px; width: 100%; }
.chart-tall { min-height: 320px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.axis-label { fill: var(--muted); font-size: 11px; }
.axis-title { fill: var(--ink); font-size: 11px; font-weight: 750; letter-spacing: .02em; }
.grid-line { stroke: var(--line); stroke-width: 1; }
.bar-orange { fill: var(--orange); }
.point { fill: var(--teal); stroke: white; stroke-width: 1.5; opacity: .88; }
.pareto-line { fill: none; stroke: var(--teal); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.pareto-point { fill: var(--teal); stroke: white; stroke-width: 1.5; }
.interactive-mark { cursor: crosshair; transition: opacity .15s ease, filter .15s ease; }
.interactive-mark:hover, .interactive-mark:focus { opacity: 1; filter: brightness(.82); outline: none; }
.chart-empty { min-height: inherit; display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.chart-insight { margin: 18px 0 0; padding-top: 13px; border-top: 1px solid var(--line); color: var(--ink); font-size: .78rem; line-height: 1.5; }
.chart-insight:empty { display: none; }
.chart-insight.error, .ai-conclusion-text.error { color: #a52d1d; }
.data-scope-note { margin: 10px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.caption-row { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 12px; padding: 7px 0; }
.caption-row + .caption-row { border-top: 1px solid var(--line); }
.caption-row strong { color: var(--navy); font-size: .7rem; letter-spacing: .045em; text-transform: uppercase; }
.caption-row span { color: var(--ink); }

.h-bars { display: grid; gap: 14px; align-content: start; }
.panel-wide .h-bars { max-width: 900px; }
.h-bar-row { display: grid; grid-template-columns: minmax(105px, 1.2fr) 2.4fr 90px; align-items: center; gap: 10px; }
.h-bar-label { overflow: hidden; color: var(--ink); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.h-bar-track { height: 10px; background: var(--line); border-radius: 2px; overflow: hidden; }
.h-bar-fill { height: 100%; min-width: 2px; background: var(--teal); }
.h-bar-row[data-tooltip] { cursor: help; }
.h-bar-value { text-align: right; font-size: .76rem; font-weight: 800; }

.discount-layout { height: 260px; display: grid; grid-template-columns: 160px 1fr; align-items: center; gap: 24px; }
.donut { position: relative; width: 156px; height: 156px; border-radius: 50%; }
.donut::after { content: ""; position: absolute; inset: 34px; border-radius: 50%; background: white; }
.donut-center { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; text-align: center; font-size: .72rem; font-weight: 750; }
.donut-center strong { font-size: 1.55rem; line-height: 1; }
.legend { display: grid; gap: 12px; }
.legend-row { display: flex; justify-content: space-between; gap: 10px; padding-bottom: 9px; border-bottom: 1px solid var(--line); font-size: .78rem; }
.legend-row strong { color: var(--navy); }

.product-panel { margin-top: 14px; }
.weakness-panel { margin-top: 14px; }
.weakness-heading { align-items: center; }
.secondary-button { min-height: 40px; border: 1px solid var(--navy); border-radius: 8px; padding: 0 14px; background: var(--navy); color: white; font-weight: 780; cursor: pointer; transition: background-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.secondary-button:hover { background: var(--teal); border-color: var(--teal); transform: translateY(-1px); box-shadow: 0 6px 15px rgba(16,38,63,.16); }
.secondary-button:disabled { cursor: wait; opacity: .65; transform: none; box-shadow: none; }
.secondary-button:focus-visible { outline: 3px solid rgba(8,127,122,.28); outline-offset: 2px; }
.inline-status { min-height: 20px; margin: -12px 0 16px; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.inline-status.error { color: #a52d1d; }
.weakness-scope { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--line); }
.weakness-scope > div { min-height: 82px; padding: 13px 15px; background: white; }
.weakness-scope strong { display: block; margin-bottom: 6px; color: var(--navy); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.weakness-scope span { display: block; color: var(--ink); font-size: .75rem; line-height: 1.5; }
.weakness-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 24px; }
.weakness-stat { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.weakness-stat strong { display: block; color: var(--navy); font-size: 1.28rem; letter-spacing: -.025em; }
.weakness-stat span { display: block; margin-top: 5px; color: var(--muted); font-size: .7rem; font-weight: 750; line-height: 1.35; text-transform: uppercase; letter-spacing: .05em; }
.weakness-layout { display: grid; grid-template-columns: minmax(280px, .72fr) minmax(0, 1.28fr); gap: 30px; align-items: start; }
.weakness-layout h4, .product-analysis-heading h4 { margin: 0 0 16px; color: var(--navy); font-size: .82rem; }
.weakness-chart { min-height: 320px; }
.complaint-bars { display: grid; gap: 18px; }
.complaint-row { cursor: help; }
.complaint-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.complaint-heading span { color: var(--ink); font-size: .78rem; font-weight: 700; }
.complaint-heading strong { color: var(--navy); font-size: .76rem; white-space: nowrap; }
.complaint-track { height: 10px; overflow: hidden; border-radius: 2px; background: var(--line); }
.complaint-fill { height: 100%; min-width: 2px; background: var(--teal); }
.complaint-row p { margin: 6px 0 0; color: var(--muted); font-size: .68rem; }
.weakness-method { margin: 14px 0 0; padding: 13px 14px; border-radius: 8px; background: var(--navy); color: white; font-size: .73rem; line-height: 1.55; }
.product-analysis-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.product-analysis-list { display: grid; gap: 12px; }
.product-analysis-card { display: grid; grid-template-columns: 132px minmax(0, 1fr); min-height: 148px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: white; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.product-analysis-card:hover { transform: translateY(-2px); border-color: #aeb6bf; box-shadow: 0 10px 24px rgba(16,38,63,.12); }
.product-image-wrap { position: relative; min-height: 148px; overflow: hidden; background: var(--navy); }
.product-image { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .28s ease, opacity .2s ease; }
.product-analysis-card:hover .product-image { transform: scale(1.025); }
.product-image-fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; color: white; font-size: .7rem; font-weight: 750; text-align: center; }
.product-analysis-body { min-width: 0; padding: 14px 16px; }
.product-card-title { display: -webkit-box; overflow: hidden; margin: 0; color: var(--navy); font-size: .86rem; font-weight: 800; line-height: 1.4; text-decoration: none; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.product-card-title:hover { color: var(--teal); text-decoration: underline; text-underline-offset: 2px; }
.product-card-shop { margin: 4px 0 10px; color: var(--muted); font-size: .72rem; }
.product-card-metrics { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 0 0 10px; color: var(--ink); font-size: .72rem; }
.product-card-metrics strong { color: var(--navy); }
.weakness-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.weakness-tag { display: inline-flex; align-items: center; min-height: 24px; border-radius: 5px; padding: 3px 7px; background: var(--teal); color: white; font-size: .65rem; font-weight: 750; }
.weakness-tag:first-child { background: var(--orange); }
.weakness-empty-tag { background: var(--navy); }
.review-excerpt { margin: 0; color: var(--ink); font-size: .72rem; line-height: 1.48; }
.review-excerpt strong { color: var(--navy); }
.weakness-empty { min-height: 140px; display: grid; place-items: center; border: 1px dashed #aeb6bf; border-radius: 10px; color: var(--muted); font-size: .8rem; text-align: center; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th { padding: 0 14px 12px; color: var(--muted); text-align: left; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
td { padding: 14px; border-top: 1px solid var(--line); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; text-align: right; }
.product-name { max-width: 580px; font-weight: 680; line-height: 1.35; }
.method-note { margin: 18px 2px 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.ai-conclusion-panel { margin-top: 14px; background: var(--navy); color: white; }
.ai-conclusion-panel .panel-heading { border-color: rgba(255,255,255,.24); }
.ai-conclusion-panel h3, .ai-conclusion-panel .panel-heading p { color: white; }
.ai-conclusion-panel .unit-label { border-color: var(--teal); background: var(--teal); color: white; }
.ai-conclusion-text { margin: 0; color: white; font-size: .94rem; line-height: 1.7; white-space: pre-line; }
.ai-conclusion-text.error { color: white; }
.ai-outlook-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; margin-top: 24px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.24); }
.ai-outlook-grid h4 { margin: 0 0 10px; color: white; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }
.ai-outlook-list { display: grid; gap: 14px; margin: 0; padding: 0; color: white; font-size: .8rem; line-height: 1.5; list-style: none; }
.ai-outlook-list li { display: grid; gap: 4px; padding: 13px; border: 1px solid rgba(255,255,255,.24); border-radius: 8px; }
.ai-outlook-list strong { font-size: .86rem; }
.ai-outlook-list span { color: rgba(255,255,255,.88); }
.ai-outlook-list b { color: white; }
.source-panel { margin-top: 14px; }
.source-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.source-row { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); font-size: .76rem; line-height: 1.4; }
.source-row strong { color: var(--navy); }
.source-row p { margin: 0 0 5px; color: var(--ink); }
.source-row details { color: var(--muted); }
.source-row summary { cursor: pointer; }
.source-row code { display: block; margin-top: 6px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.limitation-panel { margin-top: 14px; }
.limitation-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 28px; margin: 0; padding: 0 0 0 18px; color: var(--ink); font-size: .8rem; line-height: 1.5; }
.chart-tooltip { position: fixed; z-index: 20; width: min(280px, calc(100vw - 24px)); padding: 10px 12px; border-radius: 7px; background: var(--navy); color: white; box-shadow: 0 10px 28px rgba(16,38,63,.28); font-size: .75rem; line-height: 1.5; pointer-events: none; white-space: pre-line; }

@media (max-width: 820px) {
  .search-layout { grid-template-columns: 1fr; gap: 30px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .decision-grid { grid-template-columns: 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
  .panel-wide { grid-column: auto; }
  .header-label { display: none; }
  .weakness-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .weakness-scope { grid-template-columns: 1fr; }
  .weakness-layout { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .shell { width: min(100% - 24px, 1180px); }
  .search-section { padding: 36px 0 42px; }
  .search-form { padding: 14px; }
  .search-control { flex-direction: column; }
  .search-control button { justify-content: center; }
  .result-heading { align-items: start; flex-direction: column; }
  .capture-meta { text-align: left; }
  .kpi-grid { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
  .panel-heading { flex-direction: column; }
  .discount-layout { height: auto; grid-template-columns: 1fr; justify-items: center; }
  .legend { width: 100%; }
  .h-bar-row { grid-template-columns: 90px 1fr 76px; }
  .source-grid { grid-template-columns: 1fr; }
  .ai-outlook-grid { grid-template-columns: 1fr; }
  .source-row { grid-template-columns: 1fr; gap: 3px; }
  .caption-row { grid-template-columns: 1fr; gap: 2px; }
  .limitation-list { grid-template-columns: 1fr; }
  .product-analysis-card { grid-template-columns: 104px minmax(0, 1fr); }
  .product-image-wrap { min-height: 132px; }
  table { min-width: 720px; }
}
@media (max-width: 390px) {
  .weakness-summary { grid-template-columns: 1fr; }
  .product-analysis-card { grid-template-columns: 92px minmax(0, 1fr); }
  .product-analysis-body { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
