:root {
  color-scheme: light;
  font: 15px Inter, sans-serif;
  --page: #fff;
  --paper: #fff;
  --sidebar: #fff;
  --ink: #111;
  --muted: #454545;
  --border: #d7d7d7;
  --active: #151515;
  --subtle: #f2f2f2;
  --price-up: #087443;
  --price-down: #bc2735;
  color: var(--ink);
  background: var(--page);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
a { color: var(--ink); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid #111; outline-offset: 3px; }
button:disabled { cursor: default; opacity: .5; }
h1, h2, h3, p { margin: 0; }
svg { vertical-align: middle; }
[data-icon] { display: inline-flex; align-items: center; flex: none; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }

.sidebar { position: fixed; inset: 0 auto 0 0; width: 220px; padding: 28px 17px 20px; display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--border); z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; margin: 0 9px 42px; color: var(--ink); text-decoration: none; width: fit-content; }
.brand-mark { width: 42px; height: 42px; justify-content: center; border-radius: 11px; color: #fff; background: #151515; }
.brand-mark svg { width: 23px; height: 23px; }
.brand strong { display: block; font-size: 22px; line-height: 1.15; font-weight: 800; }
.brand small { display: block; margin-top: 4px; color: #454545; font-size: 9px; letter-spacing: .19em; font-weight: 750; }
nav { display: grid; gap: 5px; }
nav a { display: flex; align-items: center; gap: 11px; min-height: 43px; padding: 0 13px; color: #171717; font-size: 13px; font-weight: 650; text-decoration: none; border-radius: 8px; }
nav a:hover { background: #f2f2f2; }
nav a[aria-current="page"] { background: var(--active); color: #fff; font-weight: 750; }
.sidebar-footer { display: flex; gap: 8px; align-items: center; margin-top: auto; padding: 16px 8px 3px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.sidebar-footer .icon { width: 15px; height: 15px; }
.shell { margin-left: 220px; }
.topbar { min-height: 69px; padding: 10px 34px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); background: #fff; }
.breadcrumb, .top-actions, .today { display: flex; align-items: center; gap: 9px; }
.breadcrumb { color: var(--muted); font-size: 12px; }
.breadcrumb strong { font-weight: 650; color: var(--ink); }
.breadcrumb .icon { width: 13px; height: 13px; }
.today { color: #333; font-size: 12px; font-weight: 550; white-space: nowrap; }
.today .icon { width: 16px; height: 16px; }
.button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--border); border-radius: 7px; padding: 0 12px; background: var(--paper); font-size: 12px; font-weight: 650; }
.button:not(:disabled):hover { background: var(--subtle); }
.icon-button { width: 36px; padding: 0; }
.icon-button .icon { width: 16px; height: 16px; }
.content { max-width: 1530px; margin-inline: auto; padding: 25px 34px 0; }
.notice { margin-bottom: 14px; border: 1px solid #bdbdbd; border-radius: 7px; padding: 10px 14px; background: #f4f4f4; color: #111; font-size: 13px; }
.page-title { padding: 6px 0 18px; border-bottom: 1px solid var(--border); }
.page-title h1 { font-size: clamp(26px, 4vw, 42px); line-height: 1.13; font-weight: 800; letter-spacing: -.035em; }
.page-title p { margin-top: 7px; color: var(--muted); font-size: 14px; font-weight: 550; }
.region-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
#market-region { margin-bottom: 12px; }
.region-buttons button { min-height: 40px; padding: 6px 11px; border: 1px solid #bdbdbd; border-radius: 5px; background: #fff; font-size: 13px; font-weight: 700; text-align: left; }
.region-buttons button:hover { border-color: var(--ink); }
.region-buttons button[aria-pressed="true"] { border-color: var(--active); background: var(--active); color: #fff; }
.region-field { flex: 1 1 100%; }
.section { margin-top: 27px; }
.section-heading { display: flex; justify-content: space-between; gap: 13px; align-items: flex-end; margin-bottom: 13px; }
.section h2 { font-size: 25px; line-height: 1.25; font-weight: 800; letter-spacing: -.025em; }
.section-heading p, .chart-heading p { font-size: 12px; line-height: 1.55; color: var(--muted); margin-top: 4px; }
.market-cards { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.market-card { display: block; min-width: 0; width: 100%; border: 1px solid var(--border); border-radius: 11px; padding: 16px 16px 13px; text-align: left; background: var(--paper); }
.market-card:hover { border-color: #111; }
.market-card-header { display: flex; align-items: center; gap: 10px; }
.crop-icon { width: 38px; height: 38px; border-radius: 9px; justify-content: center; background: #f2f2f2; color: #151515; }
.market-card strong { display: block; font-size: 14px; }
.market-card small { display: block; color: var(--muted); margin-top: 3px; font-size: 10px; }
.card-arrow { margin-left: auto; align-self: flex-start; color: #444; }
.card-arrow .icon { width: 15px; height: 15px; }
.price-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px; margin-top: 13px; }
.price-value { font-size: clamp(18px,2.15vw,31px); font-weight: 800; letter-spacing: -.052em; font-variant-numeric: tabular-nums; }
.price-unit { font-size: 10px; color: var(--muted); font-weight: 550; }
.card-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 5px; margin-top: 8px; min-height: 23px; }
.card-date { font-size: 10px; color: var(--muted); }
.change { display: inline-block; border-radius: 5px; padding: 4px 6px; background: #f2f2f2; color: #292929; font-size: 10px; font-weight: 650; }
.price-up { color: var(--price-up); }
.price-down { color: var(--price-down); }
.change.price-up { background: #e9f7ee; }
.change.price-down { background: #fff0f1; }
.panel { background: var(--paper); border: 1px solid var(--border); border-radius: 11px;  }
.crop-controls, .period-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; padding: 3px; background: #f2f2f2; border-radius: 8px; }
.crop-controls button, .period-controls button { border: 0; background: transparent; min-height: 30px; border-radius: 6px; padding: 0 10px; white-space: nowrap; color: #242424; font-size: 11px; font-weight: 650; }
.crop-controls button[aria-pressed="true"], .period-controls button[aria-pressed="true"] { background: var(--active); color: #fff; }
.chart-panel { padding: 16px 18px 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; padding-bottom: 15px; border-bottom: 1px solid var(--border); }
.filters label, .news-heading label, .region-field { display: grid; gap: 5px; color: #242424; font-size: 11px; font-weight: 650; }
.filters select, .news-heading input { min-height: 35px; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; background: #fff; font-size: 12px; min-width: 0; }
.filters select { max-width: 270px; min-width: 135px; }
.chart-heading { display: flex; justify-content: space-between; gap: 12px; align-items: start; margin-top: 15px; }
.chart-heading h3, .table-heading h3 { font-weight: 700; font-size: 15px; }
.chart { position: relative; margin: 11px 0 2px; min-height: 234px; }
.chart-empty { min-height: 230px; display: grid; place-items: center; padding: 25px; color: var(--muted); font-size: 13px; text-align: center; }
.price-chart { display: block; width: 100%; overflow: visible; touch-action: pan-y; cursor: crosshair; }
.price-chart text { fill: #333; font: 600 11px Inter, sans-serif; }
.price-chart .gridline { stroke: #d7d7d7; stroke-dasharray: 4 4; }
.price-chart .crosshair { stroke: #666; stroke-dasharray: 3 4; }
.price-chart .trend-line { stroke: currentColor; }
.price-chart .trend-line.price-flat { color: #666; }
.chart-tooltip { position: absolute; z-index: 1; pointer-events: none; background: #151515; color: #fff; font-size: 11px; font-weight: 550; white-space: nowrap; padding: 7px 10px; border-radius: 6px; transform: translateX(-50%); }
.chart-stats { display: flex; flex-wrap: wrap; gap: 10px 22px; border-top: 1px solid var(--border); padding-top: 11px; font-size: 11px; color: var(--muted); }
.chart-stats b { color: var(--ink); margin-left: 3px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; font-weight: 650; }
.history-table, .news-panel { margin-top: 15px; overflow: hidden; }
.table-heading, .pagination { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 13px 16px; }
.table-heading span, .pagination span { color: var(--muted); font-size: 11px; }
.news-heading { flex-wrap: wrap; }
#news-price { color: var(--muted); font-size: 12px; margin-top: 5px; }
.news-content { border-top: 1px solid var(--border); padding: 12px 16px; color: var(--muted); font-size: 12px; }
.news-content article { display: grid; gap: 4px; padding: 9px 0; line-height: 1.45; }
.news-content article:first-child { padding-top: 0; }
.news-content article + article { border-top: 1px solid var(--border); }
.news-content a { width: fit-content; color: var(--ink); font-size: 14px; font-weight: 750; text-decoration: none; }
.news-content a:hover { color: #444; }
.news-content small { font-size: 11px; }
.text-button { background: transparent; border: 0; color: var(--ink); padding: 0; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 12px; }
thead { background: #f2f2f2; color: #202020; text-align: left; }
th, td { padding: 10px 15px; border-top: 1px solid var(--border); }
td { font-variant-numeric: tabular-nums; vertical-align: top; }
td small { display: block; margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; white-space: pre-wrap; }
.pagination { justify-content: flex-end; border-top: 1px solid var(--border); }
footer { padding: 18px 0 20px; font-size: 11px; color: var(--muted); }
.subpage { margin-top: 3px; }
.subpage .section-heading { align-items: center; }
.subpage h2 { font-size: 35px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 9px; }
.dialog-heading h2 { font: 600 25px var(--heading); }

@media (max-width: 1100px) {
  .sidebar { width: 180px; padding-inline: 12px; }
  .shell { margin-left: 180px; }
  .topbar, .content { padding-inline: 23px; }
}
@media (max-width: 830px) {
  .sidebar { position: static; width: auto; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 16px; border: 0; border-bottom: 1px solid var(--border); }
  .brand { margin: 0; gap: 7px; flex-shrink: 0; }
  .brand-mark { width: 34px; height: 34px; }
  .brand strong { font-size: 19px; }
  .brand small { font-size: 8px; margin-top: 1px; }
  nav { display: flex; flex-wrap: wrap; justify-content: flex-end; }
  nav a { min-height: 34px; padding-inline: 7px; font-size: 11px; gap: 5px; }
  nav .icon { width: 14px; height: 14px; }
  .sidebar-footer { display: none; }
  .shell { margin-left: 0; }
  .topbar { min-height: 48px; }
  .content { padding-top: 17px; }
}
@media (max-width: 570px) {
  .sidebar { display: block; padding-bottom: 5px; }
  nav { margin-top: 8px; justify-content: flex-start; gap: 8px; }
  nav a { padding-inline: 9px; gap: 5px; }
  .topbar, .content { padding-inline: 12px; }
  .section { margin-top: 20px; }
  .section h2 { font-size: 23px; }
  .section-heading { flex-wrap: wrap; align-items: start; }
  .market-cards { grid-template-columns: 1fr; gap: 8px; }
  .market-card { padding: 11px 12px; display: grid; grid-template-columns: minmax(120px,1fr) max-content; gap: 4px; align-items: center; }
  .card-arrow { display: none; }
  .price-line, .card-foot { margin: 0; justify-content: flex-end; }
  .card-foot { grid-column: 1 / -1; }
  .price-value { font-size: 20px; }
  .chart-panel { padding: 12px 10px; }
  .chart-heading { flex-wrap: wrap; }
  .filters label { flex: 1 1 120px; }
  .filters select { width: 100%; min-width: 0; max-width: none; }
  th, td { padding: 8px; }
}
