* { box-sizing: border-box; }
body {
  margin: 0; font: 14px/1.45 system-ui, sans-serif;
  background: #0e1420; color: #dbe4f0;
}
header {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px;
  padding: 14px 22px; background: #131c2c; border-bottom: 1px solid #223049;
}
h1 { font-size: 18px; margin: 0; color: #ffd76e; }
header .meta { display: flex; align-items: center; gap: 18px; margin-left: auto; }
#fetched { color: #8fa3bd; font-size: 12px; }
.datetag {
  color: #ffd76e; font-weight: 700; background: #2b3c58;
  padding: 2px 8px; border-radius: 8px; margin-right: 4px;
}
.tab {
  background: none; border: none; color: #8fa3bd; cursor: pointer;
  padding: 6px 10px; font-size: 13px; border-bottom: 2px solid transparent;
}
.tab.active { color: #ffd76e; border-bottom-color: #ffd76e; }
.lang { margin-left: 14px; padding-left: 14px; border-left: 1px solid #223049; }
.langbtn { font-size: 0.8em; padding: 4px 6px; }

.layout { display: flex; gap: 18px; padding: 18px 22px; align-items: flex-start; }
.layout[hidden] { display: none; }
aside { width: 265px; flex: none; }
main { flex: 1; min-width: 0; }

.panel {
  background: #131c2c; border: 1px solid #223049; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 14px;
}
.panel h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #8fa3bd; margin: 0 0 10px; }
.panel label { display: block; margin-bottom: 9px; color: #b9c7da; font-size: 13px; }
.panel input[type="number"], .panel select, .prices-bar input, .prices-bar select {
  width: 100%; margin-top: 3px; padding: 6px 8px; border-radius: 6px;
  border: 1px solid #2b3c58; background: #0e1420; color: #dbe4f0; font: inherit;
}
.panel label.chk { display: flex; gap: 8px; align-items: flex-start; }
.panel label.chk input { margin-top: 3px; }
.panel fieldset { border: 1px solid #2b3c58; border-radius: 6px; margin: 10px 0 0; }
.panel legend { color: #8fa3bd; font-size: 12px; padding: 0 6px; }
.panel summary { cursor: pointer; }
.panel summary h2 { display: inline; }
.hint { color: #7b8ca3; font-size: 11.5px; }
.err { padding: 40px; color: #ff8080; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card {
  background: linear-gradient(160deg, #16233a, #131c2c); border: 1px solid #2b3c58;
  border-radius: 12px; padding: 14px 16px; position: relative;
}
.card .rank { position: absolute; top: 10px; right: 14px; color: #ffd76e; font-weight: 700; }
.card .big { font-size: 21px; font-weight: 700; color: #7ee787; }
.card .mid { color: #b9c7da; margin: 2px 0 8px; }
.card .spot { font-weight: 600; }

.tablewrap { overflow-x: auto; border: 1px solid #223049; border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th, td { padding: 7px 9px; text-align: left; white-space: nowrap; border-bottom: 1px solid #1c2940; }
th { background: #16233a; color: #8fa3bd; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; cursor: pointer; position: sticky; top: 0; }
tbody tr:hover { background: #16233a55; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: #7ee787; } .neg { color: #ff8080; }
td:last-child { white-space: normal; }
.pill { background: #2b3c58; border-radius: 8px; padding: 0 6px; font-size: 10px; color: #ffd76e; }

tr.strat { cursor: pointer; }
tr.strat .caret { display: inline-block; color: #8fa3bd; transition: transform .12s; }
tr.strat.open .caret { transform: rotate(90deg); color: #ffd76e; }
tr.detail td { padding: 0 9px 10px 26px; border-bottom: 1px solid #2b3c58; }
table.inner { width: auto; min-width: 620px; background: #0e1420; }
table.inner th { position: static; }
table.inner a { color: #7db3ff; text-decoration: none; }
table.inner a:hover { text-decoration: underline; }

.prices-bar { display: flex; gap: 10px; margin-bottom: 12px; }
.prices-bar input { max-width: 240px; }
.prices-bar select { max-width: 200px; }
.btn, #csvBtn {
  padding: 6px 12px; border-radius: 6px; border: 1px solid #2b3c58; cursor: pointer;
  background: #16233a; color: #dbe4f0; font-size: 13px; text-decoration: none; white-space: nowrap;
}
#csvBtn:hover, .btn:hover { border-color: #ffd76e; }

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  aside { width: 100%; }
}
