:root {
  --bg: #fff;
  --paper: #fff;
  --text: #2c2c2c;
  --muted: #6b6560;
  --line: #e8e4de;
  --gold: #b8975a;
  --gold-light: #d4b87a;
  --burgundy: #8c3d42;
  --teal: #3d6b6b;
  --head: #1a1a1a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
}

a { color: inherit; text-decoration: none; }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.page-head-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.page-title { margin-bottom: 0; min-width: 0; }

.page-title h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--head);
  margin: 0;
  line-height: 1.2;
}

.page-title p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.page-head #auth-slot {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.logo.brand-name {
  display: inline-block;
  perspective: 900px;
  flex-shrink: 0;
}

.logo-switch {
  position: relative;
  display: inline-block;
  width: 240px;
  height: 119px;
  transform-style: preserve-3d;
  animation: logoRotate 6s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

.logo-switch img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.logo-default {
  transform: rotateY(0deg);
}

.logo-alt {
  transform: rotateY(180deg);
}

@keyframes logoRotate {
  0%, 35%   { transform: rotateY(0deg); }
  50%, 85%  { transform: rotateY(180deg); }
  100%      { transform: rotateY(360deg); }
}

@media (max-width: 720px) {
  .logo-switch {
    width: 160px;
    height: 79px;
  }
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.filter label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter select {
  min-width: 130px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}

.filter select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(184, 151, 90, 0.2);
}

.filter select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.filter--wide select {
  min-width: 220px;
  max-width: 320px;
}

.filter-reset {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8fafc;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  margin-left: auto;
}

.filter-reset:hover {
  border-color: var(--gold);
  color: var(--head);
}

.season-picks {
  align-items: center;
}

.season-picks__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 4px;
}

.season-picks__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.season-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.season-pick input {
  width: 15px;
  height: 15px;
  accent-color: var(--gold);
  cursor: pointer;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(203px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.kpi {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 34px 25px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.kpi dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.kpi dd {
  font-size: 22px;
  color: var(--head);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.kpi .chg { font-size: 11px; margin-top: 4px; color: var(--muted); }
.kpi .chg.up { color: #2d6a4f; }
.kpi .chg.dn { color: #9b2335; }

.kpi-lead {
  border-color: rgba(166, 124, 58, 0.35);
  background: linear-gradient(180deg, #fffdf8 0%, var(--paper) 100%);
}
.kpi-lead dd {
  font-size: 26px;
}
.kpi-sep {
  color: var(--muted);
  font-weight: 400;
  margin: 0 2px;
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.row3 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.charts-row3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 800px) {
  .row2, .row3 { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .charts-row3 { grid-template-columns: 1fr; }
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.card h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--head);
}

.card .sub {
  font-size: 12px;
  color: var(--muted);
  margin: 2px 0 12px;
}

.chart {
  position: relative;
  height: 280px;
  padding: 4px 0 0;
}

.chart.h320 { height: 340px; }

.card:has(.chart) {
  padding-bottom: 12px;
}

.card:has(.chart) .sub {
  margin-bottom: 4px;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

@media (max-width: 700px) {
  .home-grid { grid-template-columns: 1fr; }
}

.home-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  display: block;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.home-card:hover { border-color: var(--gold-light); }

.home-card h2 {
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: 400;
  margin-bottom: 6px;
}

.home-card p { font-size: 13px; color: var(--muted); }
.home-card .go { margin-top: 14px; font-size: 12px; color: var(--gold); }

.home-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin: 20px 0 28px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.home-stats div span {
  display: block;
  font-size: 22px;
  font-family: Georgia, serif;
  color: var(--head);
}

.home-stats div label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }
td.up { color: #2d6a4f; font-weight: 600; }
td.dn { color: #9b2335; font-weight: 600; }

.foot { margin-top: 28px; font-size: 11px; color: var(--muted); }

.auth-locked .page-head,
.auth-locked main {
  pointer-events: none;
  user-select: none;
  filter: blur(6px);
}

html.report-loading main,
html.report-loading .page-head {
  pointer-events: none;
  opacity: 0.35;
}

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(6px);
  transition: opacity 0.25s ease;
}

.page-loader--out {
  opacity: 0;
  pointer-events: none;
}

.page-loader-card {
  min-width: 220px;
  padding: 28px 32px;
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(26, 26, 26, 0.1);
}

.page-loader-spin {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border: 3px solid rgba(184, 151, 90, 0.25);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: pageLoaderSpin 0.75s linear infinite;
}

.page-loader-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--head);
  margin: 0 0 4px;
}

.page-loader-sub {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

@keyframes pageLoaderSpin {
  to { transform: rotate(360deg); }
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(26, 26, 26, 0.45);
  backdrop-filter: blur(4px);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px 28px 24px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.12);
}

.login-card h2 {
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  color: var(--head);
  margin-bottom: 4px;
}

.login-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 22px;
}

.login-field {
  display: block;
  margin-bottom: 14px;
}

.login-field span {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 4px;
}

.login-field input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}

.login-field input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(184, 151, 90, 0.2);
}

.login-error {
  min-height: 18px;
  font-size: 12px;
  color: #9b2335;
  margin-bottom: 8px;
}

.login-submit {
  width: 100%;
  height: 42px;
  margin-top: 4px;
  border: none;
  border-radius: 6px;
  background: var(--gold);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.login-submit:hover {
  background: var(--gold-light);
  color: var(--head);
}

.auth-logout {
  height: 34px;
  padding: 0 12px;
  margin-left: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8fafc;
  font-size: 12px;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
}

.auth-logout:hover {
  border-color: var(--gold);
  color: var(--head);
}

.auth-import {
  height: 34px;
  padding: 0 12px;
  margin-right: 8px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  background: rgba(184, 151, 90, 0.12);
  font-size: 12px;
  font-family: inherit;
  color: var(--head);
  cursor: pointer;
}

.auth-import:hover {
  background: var(--gold);
  color: #fff;
}

.import-card { max-width: 440px; }

.import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.import-actions .login-submit {
  width: auto;
  flex: 1;
  min-width: 120px;
  margin-top: 0;
}

.import-actions .auth-logout {
  height: 42px;
}
