:root {
  color-scheme: dark;
  --bg: #1c252b;
  --ink: #ffffff;
  --muted: rgba(255,255,255,.68);
  --line: rgba(218,228,215,.18);
  --panel: rgba(255,255,255,.06);
  --panel-strong: rgba(255,255,255,.09);
  --accent: #cffc54;
  --accent-2: #ff5c00;
  --accent-3: #d6daf3;
  --soft: rgba(218,228,215,.1);
  --shadow: 0 24px 80px rgba(0,0,0,.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 18% 8%, rgba(207,252,84,.16), transparent 28rem),
    radial-gradient(circle at 84% 12%, rgba(214,218,243,.14), transparent 24rem),
    linear-gradient(135deg, #162027 0%, var(--bg) 48%, #11181d 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.topbar,
.status-row,
.panel-heading,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 2px;
  font-size: 1.55rem;
}

h3 {
  margin-bottom: 0;
  font-size: 1.02rem;
}

.muted,
.empty-state p {
  color: var(--muted);
}

.upload-button,
.file-input::file-selector-button,
.ghost-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}

.upload-button,
.file-input::file-selector-button {
  background: var(--accent);
  color: #1c252b;
}

.file-input {
  max-width: 320px;
  color: var(--muted);
  font-weight: 700;
}

.file-input::file-selector-button {
  margin-right: 10px;
}

.ghost-button {
  background: rgba(255,255,255,.04);
  border-color: var(--line);
  color: var(--ink);
}

.status-message {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.status-message.error {
  color: #ff9c75;
}

.empty-state {
  margin-top: 24px;
  min-height: 58vh;
  display: grid;
  align-items: center;
  border: 1px dashed rgba(218,228,215,.28);
  border-radius: 24px;
  padding: clamp(24px, 7vw, 72px);
  background:
    linear-gradient(135deg, rgba(207,252,84,.12), rgba(214,218,243,.08)),
    rgba(255,255,255,.055);
}

.empty-state h2 {
  max-width: 640px;
  font-size: clamp(2rem, 6vw, 4.3rem);
  line-height: 1;
}

.empty-state p {
  max-width: 620px;
  font-size: 1.05rem;
  line-height: 1.65;
}

.dashboard {
  display: grid;
  gap: 18px;
  padding-top: 22px;
}

.hidden {
  display: none;
}

.kpi-grid,
.chart-grid,
.controls {
  display: grid;
  gap: 14px;
}

.kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi-card,
.panel {
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.kpi-card {
  padding: 18px;
}

.kpi-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.35rem, 2.5vw, 2.1rem);
  line-height: 1;
}

.kpi-card span {
  color: var(--muted);
  font-size: 0.86rem;
}

.controls {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  align-items: end;
  background: rgba(255,255,255,.055);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}

.controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.controls select,
.controls input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 10px;
  background: rgba(12,18,22,.72);
  color: var(--ink);
}

.chart-grid {
  grid-template-columns: 1.25fr 0.9fr;
}

.wide {
  grid-row: span 2;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-heading {
  margin-bottom: 14px;
}

canvas {
  display: block;
  width: 100%;
  background: rgba(12,18,22,.42);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.profile-list {
  display: grid;
  gap: 10px;
  max-height: 292px;
  overflow: auto;
}

.profile-item {
  display: grid;
  gap: 7px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.profile-item:last-child {
  border-bottom: 0;
}

.profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  font-weight: 800;
}

.profile-row span:last-child {
  color: var(--muted);
  font-size: 0.76rem;
}

.bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(218,228,215,.14);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent-2);
}

.table-panel {
  padding-bottom: 12px;
}

.table-wrap {
  max-height: 430px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  min-width: 120px;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #11181d;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

td {
  color: rgba(255,255,255,.86);
  word-break: break-word;
}

@media (max-width: 980px) {
  .topbar,
  .status-row,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .kpi-grid,
  .chart-grid,
  .controls {
    grid-template-columns: 1fr 1fr;
  }

  .wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1440px);
    padding-top: 16px;
  }

  .kpi-grid,
  .chart-grid,
  .controls {
    grid-template-columns: 1fr;
  }

  .file-input,
  .file-input::file-selector-button,
  .ghost-button {
    width: 100%;
  }
}
