:root {
  --ink: #332d23;
  --muted: #786f60;
  --paper: #fffdf7;
  --cream: #f6f1e5;
  --sun: #edc64a;
  --leaf: #4d6241;
  --line: #e6ddcb;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: radial-gradient(ellipse at 90% 0, #f8eabb 0, transparent 36%), var(--cream); font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
button { color: inherit; }
a { color: var(--leaf); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #9dac76; outline-offset: 4px; }
.analytics-shell { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0 24px; }
.page-header, .header-brand, .header-links, .settings-nav, .section-heading, .analytics-toolbar, .toolbar-controls, .report-context { display: flex; align-items: center; }
.page-header { justify-content: space-between; gap: 20px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.header-brand { gap: 12px; font-weight: 800; font-size: .92rem; }
.header-brand img { width: 52px; height: 52px; object-fit: contain; }
.private-label { display: block; margin-top: 3px; color: var(--muted); font-size: .7rem; letter-spacing: .09em; font-weight: 600; text-transform: uppercase; }
.header-links { gap: 18px; font-size: .78rem; }
.header-links a { text-decoration: none; font-weight: 700; }
.header-links button { border: 0; background: transparent; color: var(--muted); padding: 8px; }
.settings-nav { display: inline-flex; gap: 5px; background: #eae3d4; padding: 5px; margin: 22px 0 0; border-radius: 100px; }
.settings-nav a { padding: 10px 20px; color: var(--muted); text-decoration: none; border-radius: 100px; font-size: .84rem; font-weight: 750; }
.settings-nav a[aria-current] { background: var(--paper); color: var(--ink); box-shadow: 0 2px 8px #332d230b; }
.analytics-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 36px 0 28px; }
.eyebrow { color: var(--leaf); text-transform: uppercase; font-size: .65rem; font-weight: 850; letter-spacing: .14em; margin: 0 0 10px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; letter-spacing: -.035em; }
h1 { font-size: clamp(2.7rem, 6vw, 4.5rem); line-height: 1; margin-bottom: 14px; }
h2 { font-size: 1.8rem; margin-bottom: 0; }
h3 { font-size: 1rem; margin: 28px 0 14px; }
.heading-copy { max-width: 540px; font-size: .93rem; line-height: 1.65; color: var(--muted); margin-bottom: 0; }
.heading-flower { width: 125px; color: var(--leaf); transform: rotate(10deg); margin-right: 30px; flex-shrink: 0; }
.heading-flower svg { width: 100%; display: block; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 22px; padding: 26px; box-shadow: 0 7px 24px #463b1c04; }
.access-needed { max-width: 620px; padding: 32px; }
.access-needed p { margin: 14px 0 24px; color: var(--muted); line-height: 1.6; }
.primary-button, .outline-button { display: inline-flex; justify-content: center; align-items: center; border-radius: 100px; padding: 10px 17px; border: 1px solid var(--line); text-decoration: none; font-size: .8rem; font-weight: 750; }
.primary-button { background: var(--leaf); color: #fffdf7; border-color: var(--leaf); }
.outline-button { background: var(--paper); }
.analytics-toolbar { justify-content: space-between; gap: 18px; flex-wrap: wrap; padding-bottom: 20px; }
.range-buttons { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 100px; background: #fffcf280; }
.range-buttons button { border: 0; padding: 10px 16px; border-radius: 100px; background: transparent; font-size: .8rem; font-weight: 750; white-space: nowrap; }
.range-buttons button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.toolbar-controls { gap: 10px; font-size: .75rem; color: var(--muted); }
select { border: 1px solid var(--line); border-radius: 100px; padding: 9px 28px 9px 12px; background: var(--paper); color: var(--ink); font-size: .8rem; }
.analytics-status { font-size: .85rem; color: var(--muted); line-height: 1.5; }
.analytics-status.error { background: #f6e5df; border: 1px solid #dbb6a5; color: #84472e; padding: 14px; border-radius: 12px; }
.report-context { justify-content: space-between; gap: 10px; color: var(--muted); font-size: .72rem; padding: 0 2px 14px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 26px; }
.metric-card { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.metric-card:nth-child(1) { background: #f4d875; border-color: #dfbf5a; }
.metric-card:nth-child(2) { background: #e5eadb; border-color: #ced7be; }
.metric-label { font-size: .73rem; font-weight: 750; color: #5b5446; margin-bottom: 12px; }
.metric-value { font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.8rem, 3.2vw, 2.7rem); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.metric-card:nth-child(n+5) { padding: 17px 22px; }
.metric-card:nth-child(n+5) .metric-value { font-size: 1.85rem; }
.metric-help { color: var(--muted); font-size: .63rem; margin-top: 8px; line-height: 1.4; }
.section-heading { justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 20px; }
.section-heading .eyebrow { margin-bottom: 7px; }
.section-heading .small-note { margin-bottom: 0; }
.metric-picker { display: flex; align-items: center; gap: 9px; font-size: .75rem; color: var(--muted); flex-shrink: 0; }
.chart-wrap { width: 100%; overflow: hidden; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg text { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; fill: var(--muted); }
.chart-note, .small-note { color: var(--muted); font-size: .73rem; line-height: 1.65; }
.chart-note { margin: 8px 0 0; }
.insight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 22px 0 36px; align-items: start; }
.source-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 20px 0; }
.source-label { font-size: .82rem; font-weight: 750; }
.source-value { font-size: .8rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.source-track { grid-column: 1 / -1; height: 8px; background: #eee9dd; border-radius: 100px; overflow: hidden; }
.source-fill { height: 100%; background: var(--leaf); border-radius: 100px; }
.source-row:nth-child(2n) .source-fill { background: #b89c4e; }
.source-detail { grid-column: 1 / -1; font-size: .67rem; color: var(--muted); }
.popular-row { display: flex; width: 100%; text-align: left; align-items: center; gap: 12px; border: 0; border-bottom: 1px solid var(--line); padding: 18px 0; background: transparent; }
.popular-row:last-child { border-bottom: 0; }
.rank-circle { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: #f5e6ad; color: #796323; font-size: .8rem; font-weight: 850; flex-shrink: 0; }
.popular-name { flex: 1; min-width: 0; font-size: .8rem; font-weight: 750; line-height: 1.4; overflow-wrap: anywhere; }
.popular-total { font-size: .75rem; white-space: nowrap; color: var(--muted); }
.popular-row:hover .popular-name { color: var(--leaf); text-decoration: underline; }
.item-search { font-size: .68rem; color: var(--muted); display: flex; flex-direction: column; gap: 7px; min-width: 220px; }
.item-search input { background: var(--paper); color: var(--ink); border: 1px solid var(--line); padding: 10px 13px; border-radius: 100px; font-size: .78rem; width: 100%; }
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.product-card { display: flex; flex-direction: column; text-align: left; padding: 20px; border: 1px solid var(--line); background: var(--paper); border-radius: 20px; min-width: 0; transition: transform .15s ease, box-shadow .15s ease; }
.product-card:hover { transform: translateY(-3px); box-shadow: 0 12px 24px #463b1c10; }
.product-heading { display: flex; align-items: center; gap: 12px; margin: 14px 0 18px; }
.product-image { width: 56px; height: 70px; object-fit: contain; background: #f8f4e9; border-radius: 9px; flex-shrink: 0; }
.product-heading > span:last-child { min-width: 0; }
.product-name { display: block; font-size: .84rem; font-weight: 800; line-height: 1.45; overflow-wrap: anywhere; }
.product-section { display: block; font-size: .61rem; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .06em; }
.product-rank { font-size: .67rem; color: var(--leaf); font-weight: 800; }
.product-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 10px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.product-stat-value { font-size: 1.35rem; font-family: Georgia, "Times New Roman", serif; letter-spacing: -.03em; }
.product-stat-label { display: block; font-size: .65rem; color: var(--muted); margin-top: 4px; }
.product-card-footer { display: flex; justify-content: space-between; gap: 8px; margin-top: 20px; font-size: .67rem; color: var(--leaf); }
.empty-notice { background: #e9eedf; border: 1px solid #d4ddc5; padding: 22px; border-radius: 18px; margin-bottom: 18px; }
.empty-notice p { font-size: .82rem; color: var(--muted); margin: 8px 0 0; line-height: 1.6; }
.empty-text { color: var(--muted); font-size: .85rem; padding: 20px 0; line-height: 1.6; }
.counting-notes { margin-top: 30px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; font-size: .78rem; color: var(--muted); line-height: 1.7; }
.counting-notes summary { cursor: pointer; color: var(--ink); font-weight: 750; }
.counting-notes p { margin: 14px 0 0; }
.analytics-footer { color: var(--muted); font-size: .68rem; margin-top: 30px; text-align: center; }
.loading-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.loading-cards div { height: 145px; border-radius: 18px; background: linear-gradient(100deg, #e8e1d3, #f9f6ed, #e8e1d3); background-size: 200% 100%; animation: loading-shimmer 1.6s infinite; }
@keyframes loading-shimmer { to { background-position: -200% 0; } }
.item-dialog { width: min(950px, calc(100% - 32px)); max-height: 90vh; padding: 28px; border: 1px solid var(--line); border-radius: 24px; background: var(--paper); color: var(--ink); box-shadow: 0 24px 100px #332d2333; }
.item-dialog::backdrop { background: #282d22a6; backdrop-filter: blur(5px); }
.dialog-header { display: flex; justify-content: space-between; align-items: start; gap: 18px; margin-bottom: 14px; }
.dialog-header h2 { font-size: 2rem; overflow-wrap: anywhere; }
.dialog-close { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--cream); font-size: 1.4rem; flex-shrink: 0; }
.detail-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 22px 0; }
.detail-metric { padding: 16px; background: var(--cream); border: 1px solid var(--line); border-radius: 14px; }
.detail-metric strong { font-family: Georgia, "Times New Roman", serif; display: block; font-size: 1.8rem; font-weight: 500; }
.detail-metric span { display: block; font-size: .68rem; color: var(--muted); margin-top: 6px; }
.history-table-wrap { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; margin-top: 18px; }
.chart-data { margin-top: 16px; font-size: .73rem; color: var(--muted); }
.chart-data summary { cursor: pointer; font-weight: 750; }
.overview-history { min-width: 540px; }
table { width: 100%; border-collapse: collapse; font-size: .76rem; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
th { position: sticky; top: 0; background: var(--cream); color: var(--muted); font-weight: 750; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 1000px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-toolbar { align-items: start; }
  .heading-flower { margin-right: 0; }
}
@media (max-width: 650px) {
  .analytics-shell { width: calc(100% - 28px); padding-top: 16px; }
  .page-header { gap: 12px; padding-bottom: 14px; }
  .header-brand { font-size: .8rem; gap: 8px; }
  .header-brand img { width: 38px; height: 38px; }
  .header-links { gap: 6px; flex-direction: column; align-items: end; font-size: .65rem; }
  .private-label { font-size: .59rem; }
  .analytics-heading { padding-top: 28px; gap: 14px; }
  .heading-flower { width: 72px; }
  .heading-copy { font-size: .79rem; }
  .eyebrow { font-size: .57rem; line-height: 1.6; }
  .settings-nav { margin-top: 16px; }
  .range-buttons { width: 100%; justify-content: space-between; gap: 0; }
  .range-buttons button { flex: 1; min-width: 0; min-height: 40px; padding: 10px 5px; font-size: .68rem; }
  .toolbar-controls { width: 100%; justify-content: flex-end; }
  .report-context { align-items: start; flex-direction: column; font-size: .66rem; }
  .metric-grid { gap: 8px; }
  .metric-card, .metric-card:nth-child(n+5) { padding: 15px; border-radius: 14px; }
  .metric-label { font-size: .68rem; }
  .metric-help { font-size: .59rem; }
  .metric-value { font-size: 2rem; }
  .metric-card:nth-child(n+5) .metric-value { font-size: 1.6rem; }
  .panel { padding: 18px; border-radius: 18px; }
  h2 { font-size: 1.5rem; }
  .section-heading { align-items: start; flex-direction: column; gap: 14px; }
  .insight-grid, .product-grid { grid-template-columns: 1fr; }
  .insight-grid { gap: 14px; }
  .item-search { width: 100%; }
  .product-card { padding: 18px; }
  .item-dialog { width: calc(100% - 14px); padding: 18px; border-radius: 18px; }
  .dialog-header h2 { font-size: 1.5rem; }
  .detail-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .loading-cards { grid-template-columns: repeat(2, 1fr); }
  .history-table-wrap th, .history-table-wrap td { padding: 10px 8px; font-size: .67rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
