:root {
  --bg: #f3f6f9;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #5b667a;
  --line: #dde3ec;
  --accent: #0ea5e9;
  --ok: #0a9f6a;
  --warn: #e76700;
  --bad: #d13232;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: radial-gradient(circle at top right, #e9f6ff 0%, var(--bg) 50%);
  color: var(--text);
}

.container {
  width: min(1180px, 94vw);
  margin: 24px auto 40px;
}

.hero {
  background: linear-gradient(130deg, #083b66, #0a6294);
  color: #fff;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 16px 32px rgba(8, 59, 102, 0.24);
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(1.3rem, 2.3vw, 2rem);
}

h2 {
  margin: 6px 0 10px;
  font-size: 1.05rem;
}

.muted { color: var(--muted); }
.hero .muted { color: rgba(255, 255, 255, 0.92); }

.date-form {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.date-form input,
.date-form button {
  font: inherit;
  border-radius: 8px;
  border: 1px solid #b8d2ea;
  padding: 7px 10px;
}

.date-form button {
  background: #fff;
  cursor: pointer;
}

.quick-nav {
  display: inline-flex;
  gap: 8px;
  margin-left: 2px;
}

.quick-nav button {
  border-radius: 8px;
  border: 1px solid #b8d2ea;
  background: #f8fbff;
  cursor: pointer;
  padding: 7px 10px;
}

.quick-nav button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.cards {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.kpi { font-size: 1.5rem; font-weight: 700; margin-top: 6px; }
.kpi.ok { color: var(--ok); }
.kpi.warn { color: var(--warn); }
.kpi.bad { color: var(--bad); }

.panel {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.bars {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 4px;
  height: 230px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  padding-top: 20px;
}

.bar {
  background: linear-gradient(180deg, #7dd3fc, var(--accent));
  border-radius: 6px 6px 0 0;
  position: relative;
  min-height: 4px;
}

.bar-price {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  transform: translateX(-50%);
  font-size: 0.62rem;
  color: #334155;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

.bar.current::before {
  content: "▼";
  position: absolute;
  left: 50%;
  top: -34px;
  transform: translateX(-50%);
  color: #111827;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  background: #ffffff;
  border-radius: 10px;
  padding: 1px 4px;
  border: 1px solid #dbe5ef;
}

.bar:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 6px 8px;
  border-radius: 6px;
  white-space: nowrap;
  font-size: 0.75rem;
  z-index: 2;
}

.bar-labels {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 4px;
  margin-top: 6px;
}

.bar-label {
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.2;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 0.93rem;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
}

.primary-col {
  background: #f3f9ff;
}

.current-marker {
  color: #111827;
  font-weight: 700;
  margin-right: 6px;
}

.delta-up { color: #b91c1c; font-weight: 700; }
.delta-down { color: #166534; font-weight: 700; }

.info-table {
  margin-top: 10px;
}

.foot {
  margin-top: 12px;
  font-size: 0.88rem;
  color: var(--muted);
}

.error {
  background: #fff2f2;
  border: 1px solid #ffd1d1;
  color: #8f1e1e;
  padding: 14px;
  border-radius: 10px;
  margin-top: 14px;
}

@media (max-width: 920px) {
  .cards { grid-template-columns: 1fr; }
  .bars { height: 170px; }
  .bar-label { font-size: 0.62rem; }
  table { font-size: 0.86rem; }
}
