:root {
  --bg: #0c0e12;
  --bg-elev: #141820;
  --bg-panel: #171b22;
  --line: rgba(226, 184, 106, 0.16);
  --line-strong: rgba(226, 184, 106, 0.38);
  --text: #f6f1e6;
  --muted: #a39b90;
  --amber: #e8b84a;
  --amber-hot: #ffd27a;
  --amber-dim: rgba(232, 184, 74, 0.14);
  --green: #3dd68c;
  --red: #ff6b6b;
  --blue: #6ec8ff;
  --copper: #d4925c;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --font-display: "Oswald", "Arial Narrow", sans-serif;
  --font-body: "Manrope", sans-serif;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #e7ece8;
  --bg-elev: #f4f7f4;
  --bg-panel: #ffffff;
  --line: rgba(28, 36, 32, 0.1);
  --line-strong: rgba(176, 122, 42, 0.45);
  --text: #161a16;
  --muted: #5c655e;
  --amber: #c48a22;
  --amber-hot: #8a5a10;
  --amber-dim: rgba(196, 138, 34, 0.14);
  --green: #1a8a56;
  --red: #c43c3c;
  --blue: #1f6fad;
  --copper: #a86a32;
  --shadow: 0 16px 40px rgba(28, 36, 32, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; }

body {
  font-family: var(--font-body);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1, "onum" 0;
  background:
    radial-gradient(1100px 520px at 8% -12%, rgba(232, 184, 74, 0.2), transparent 55%),
    radial-gradient(800px 420px at 100% 0%, rgba(110, 200, 255, 0.08), transparent 50%),
    linear-gradient(180deg, #12151b 0%, var(--bg) 42%, #08090c 100%);
  background-attachment: fixed;
}

html[data-theme="light"] body {
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(196, 138, 34, 0.16), transparent 55%),
    linear-gradient(180deg, #f3f6f2 0%, var(--bg) 46%, #dce3dc 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.45;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

button, input, select {
  font: inherit;
  color: inherit;
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1, "onum" 0;
}

button { cursor: pointer; }

.num { text-align: right; }

.app, .shell {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 22px 48px;
}

.top, .topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 8px;
  animation: rise 0.45s ease both;
}

.brand, .mark {
  margin: 0;
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 0.9;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}

.role, .sub { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.filters { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }

.filters label, .login label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

input, select {
  appearance: none;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}

input:focus, select:focus { border-color: var(--amber); }

.ghost, .theme-btn {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--text);
}

.nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 16px;
  animation: rise 0.45s ease 0.05s both;
}

.nav button, .nav-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  white-space: nowrap;
}

.nav button:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }

.nav button.on, .nav button.active {
  color: #1a1408;
  background: linear-gradient(135deg, #ffe7a8, var(--amber));
  box-shadow: 0 8px 22px rgba(232, 184, 74, 0.32);
  font-weight: 700;
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 42%), var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
  animation: rise 0.45s ease 0.08s both;
}

.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.panel-head p { margin: 0; color: var(--muted); font-size: 13px; }

.panel h2, .panel-head h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 22px;
  font-weight: 600;
}

.kpis, .kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 4px;
}

.kpi {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 14px 14px 16px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

html[data-theme="light"] .kpi { background: rgba(20, 24, 20, 0.03); }

.kpi::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -36px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 184, 74, 0.2), transparent 70%);
  pointer-events: none;
}

.kpi span, .kpi .label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kpi b, .kpi .value {
  display: block;
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: 0.02em;
  line-height: 1;
  font-weight: 600;
}

.kpi em, .kpi .meta {
  display: block;
  margin-top: 8px;
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
}

.good, .good-text { color: var(--green); }
.bad, .bad-text { color: var(--red); }
.warn { color: var(--amber-hot); }

.decision-brief {
  display: flex;
  flex-wrap: wrap;
  margin: 14px 0 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.decision-note {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 14px;
  border-right: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  font-size: 13px;
}

.decision-note.good { border-left-color: var(--green); }
.decision-note.warn { border-left-color: var(--amber); }
.decision-note.bad { border-left-color: var(--red); }
.decision-note b { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.decision-note span { color: var(--muted); }

.strip {
  background: linear-gradient(90deg, rgba(232, 184, 74, 0.16), rgba(232, 184, 74, 0.04));
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--amber);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.strip strong {
  display: block;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber-hot);
  font-size: 13px;
  margin-bottom: 4px;
}

.strip p { margin: 0; }

.table-wrap {
  margin-top: 8px;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
}

table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 860px; }

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  white-space: nowrap;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-panel);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

th.num { text-align: right; }

th.group {
  text-align: center;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
}

.sec-bud { background-color: rgba(232, 184, 74, 0.2); }
.sec-lead { background-color: rgba(110, 200, 255, 0.16); }
.sec-deal { background-color: rgba(61, 214, 140, 0.15); }
.sec-con { background-color: rgba(212, 146, 92, 0.18); }

thead th.sec-bud { background: linear-gradient(rgba(232, 184, 74, 0.34), rgba(232, 184, 74, 0.34)), var(--bg-panel); }
thead th.sec-lead { background: linear-gradient(rgba(110, 200, 255, 0.28), rgba(110, 200, 255, 0.28)), var(--bg-panel); }
thead th.sec-deal { background: linear-gradient(rgba(61, 214, 140, 0.26), rgba(61, 214, 140, 0.26)), var(--bg-panel); }
thead th.sec-con { background: linear-gradient(rgba(212, 146, 92, 0.3), rgba(212, 146, 92, 0.3)), var(--bg-panel); }

tbody tr:nth-child(even) td { background-image: linear-gradient(rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.035)); }

tbody tr:hover td { box-shadow: inset 0 0 0 999px rgba(232, 184, 74, 0.08); }

.row-hit { cursor: pointer; }
.row-hit td:first-child { font-weight: 700; }
.row-hit:hover td:first-child { color: var(--amber-hot); }

td:first-child, th:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  background-color: var(--bg-panel);
}

.grid-extra { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }

tfoot td { font-weight: 700; border-top: 2px solid var(--line-strong); }

.note, .hint, .muted { color: var(--muted); }
.note { font-size: 12px; margin: 10px 0 0; }

.hour-track { display: inline-block; width: 72px; height: 8px; margin-right: 8px; border-radius: 4px; background: rgba(128, 128, 128, 0.28); vertical-align: middle; }
.hour-track i { display: block; height: 100%; border-radius: 4px; background: var(--green); }
.hour-track.warn i { background: var(--amber); }
.hour-track.bad i { background: var(--red); }

.bars { display: flex; height: 16px; border-radius: 6px; overflow: hidden; margin: 8px 0; background: rgba(0, 0, 0, 0.25); }
.bars i { display: block; height: 100%; }
.b1 { background: var(--green); }
.b2 { background: #8fb56a; }
.b3 { background: var(--amber); }
.b4 { background: var(--copper); }
.b5 { background: var(--red); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }

.season-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.month-bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; align-items: end; height: 140px; }
.month-bars div { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.month-bars b { display: block; width: 100%; border-radius: 4px 4px 0 0; background: rgba(110, 200, 255, 0.35); min-height: 2px; }
.month-bars .hot b { background: var(--amber); box-shadow: 0 0 16px rgba(232, 184, 74, 0.45); }
.month-bars span { font-size: 10px; color: var(--muted); }

.split { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 14px; }

.drawer-root {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(8, 9, 12, 0.58);
  display: flex;
  justify-content: flex-end;
}

.drawer {
  width: min(760px, 100%);
  height: 100%;
  overflow: auto;
  background: var(--bg-panel);
  border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  padding: 22px 24px 48px;
  animation: slide-in 0.28s ease;
}

.drawer-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.drawer-kicker { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); }
.drawer-head h2 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 34px;
}
.drawer-head p { margin: 4px 0 0; color: var(--muted); }
.drawer-close { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 8px 14px; }

.verdict { border-radius: 14px; padding: 12px 14px; font-weight: 700; margin: 14px 0; }
.verdict-below { background: rgba(255, 107, 107, 0.14); color: var(--red); }
.verdict-above { background: rgba(61, 214, 140, 0.14); color: var(--green); }
.verdict-ok { background: var(--amber-dim); }

.insight-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.insight-kpis span { display: block; color: var(--muted); font-size: 12px; }
.insight-kpis strong {
  display: block;
  font-family: var(--font-display);
  font-size: 28px;
  margin-top: 4px;
  font-weight: 600;
}

.year-chart { width: 100%; height: auto; margin-top: 8px; }
.chart-bar { fill: rgba(232, 184, 74, 0.35); }
.chart-bar.is-now { fill: var(--amber); }
.chart-tick { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.chart-tick.is-now { fill: var(--amber-hot); font-weight: 700; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.login form {
  width: min(440px, 100%);
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.primary {
  background: linear-gradient(135deg, #ffe7a8, var(--amber));
  color: #1a1408;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
}

.err { color: var(--red); min-height: 1.2em; margin: 0; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes slide-in {
  from { transform: translateX(28px); opacity: 0.4; }
}

.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-top: 8px; }
.swatch { display: inline-block; width: 18px; height: 3px; margin-right: 6px; vertical-align: middle; }
.swatch.gold { background: #e8b84a; }
.swatch.mute { background: #8d8680; }
.swatch.cold { background: #6ec8ff; }
.stay-chart { margin-top: 4px; }

.portrait { display: grid; grid-template-columns: 240px 1fr; gap: 18px; align-items: start; }
.portrait-card {
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 14px 14px 8px;
  background: rgba(232, 184, 74, 0.08);
}
.portrait-card p { margin: 6px 0; }
.who { font-size: 16px; margin: 8px 0 12px; }
.seg { display: grid; grid-template-columns: 130px 1fr 42px; gap: 8px; align-items: center; margin: 8px 0; }
.seg b { display: block; height: 10px; border-radius: 6px; background: linear-gradient(90deg, #c9842a, #e8b84a); }
.seg em { font-style: normal; text-align: right; }

.offer { display: grid; grid-template-columns: 1.5fr 0.7fr 0.7fr 92px; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.offer b { display: block; }
.offer span, .offer p { color: var(--muted); margin: 2px 0 0; font-size: 13px; }
.offer-head { display: grid; grid-template-columns: 1.5fr 0.7fr 0.7fr 92px; gap: 12px; color: var(--muted); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.offer-meter i { display: block; height: 8px; border-radius: 6px; background: var(--copper); }
.offer-meter.nights i { background: var(--green); }
.offer-meter em { display: block; margin-top: 4px; font-style: normal; font-size: 12px; color: var(--muted); }

@media (max-width: 980px) {
  .kpis, .kpi-grid, .season-grid, .split, .insight-kpis, .portrait, .offer, .offer-head { grid-template-columns: 1fr; }
  .brand, .mark { font-size: 32px; }
}

@media (max-width: 640px) {
  .kpis, .insight-kpis, .season-grid, .split { grid-template-columns: 1fr; }
  .app, .shell { padding: 14px 12px 32px; }
}
