:root {
  color-scheme: dark;
  --bg: #0f1218;
  --bg-soft: #151a24;
  --bg-card: #1b2230;
  --bg-card-strong: #212a3b;
  --text: #f2f5fb;
  --text-muted: #a9b4c8;
  --accent: #4da3ff;
  --accent-strong: #2f7ddd;
  --accent-soft: rgba(77, 163, 255, 0.18);
  --success: #33d17a;
  --warning: #ffb86b;
  --danger: #ff6b6b;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --font: "Space Grotesk", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(circle at top left, #1f2c44 0%, #0f1218 45%, #0b0d12 100%);
  color: var(--text);
  min-height: 100vh;
}

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: rgba(15, 18, 24, 0.9);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3c7ce8 0%, #63d2ff 100%);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #0c111b;
  box-shadow: var(--shadow);
}

.brand-title {
  font-size: 18px;
  font-weight: 600;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-item {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 10px 14px;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-item:hover {
  background: rgba(77, 163, 255, 0.08);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.sidebar-meta {
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 10px 12px;
}

.meta-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.meta-value {
  font-size: 14px;
  margin-top: 4px;
}

.main {
  padding: 28px 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.clan-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.clan-title h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
}

#clan-tag {
  color: var(--text-muted);
  font-size: 14px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-card);
}

.action-button {
  background: var(--accent);
  border: none;
  color: #0b0e15;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
}

.action-button:hover {
  transform: translateY(-1px);
}

.view {
  display: none;
  animation: fadeIn 0.4s ease;
}

.view.active {
  display: block;
}

.overview-grid.view.active {
  display: grid;
  grid-template-columns: 1fr;
}

.overview-grid {
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.card-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.stat {
  background: var(--bg-card-strong);
  border-radius: 14px;
  padding: 12px 14px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-value {
  font-size: 20px;
  margin-top: 8px;
  font-family: var(--font-mono);
}

.notification-list {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

.filters {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 16px;
  align-items: end;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.field input,
.field select {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--bg-soft);
  color: var(--text);
  padding: 8px 10px;
  font-family: var(--font);
}

.hint {
  color: var(--text-muted);
  font-size: 12px;
}

.ghost-button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.table-wrap {
  overflow: auto;
}

.sim-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.sim-progress {
  display: grid;
  gap: 6px;
  background: var(--bg-soft);
  padding: 10px 12px;
  border-radius: 12px;
}

.sim-progress[aria-hidden="true"] {
  display: none;
}

.sim-progress-label {
  font-size: 12px;
  color: var(--text-muted);
}

.sim-progress-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.sim-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #7bd7ff);
  transition: width 0.15s ease;
}

.sim-summary {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.6;
  background: var(--bg-soft);
  padding: 10px 12px;
  border-radius: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.data-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.data-table tbody tr:hover {
  background: rgba(77, 163, 255, 0.08);
}

.data-table .link-cell {
  color: var(--accent);
  cursor: pointer;
}

.warn-row {
  background: rgba(255, 184, 107, 0.12);
}

.compare-summary {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 16px;
}

.compare-card {
  background: var(--bg-card-strong);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-muted);
}

.compare-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 12, 0.7);
  display: none;
  place-items: center;
  padding: 20px;
  z-index: 1000;
}

.modal[aria-hidden="false"] {
  display: grid;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 20px;
  width: min(1100px, 95vw);
  max-height: 90vh;
  overflow: auto;
  padding: 22px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  border: none;
  background: var(--bg-soft);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.modal-header h2 {
  margin: 0 0 6px;
}

.modal-body {
  margin-top: 10px;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.modal-actions .hint {
  margin: 0;
}

.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.skill-card {
  background: var(--bg-card-strong);
  border-radius: 14px;
  padding: 10px;
  text-align: center;
  font-size: 12px;
}

.skill-card img {
  width: 32px;
  height: 32px;
  margin-bottom: 6px;
}

.player-footer {
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.split-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.market-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 16px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

.modal-content.modal-wide {
  width: min(1200px, 96vw);
}

.filters.filters-stack {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.field-wide {
  grid-column: 1 / -1;
}

.skill-dropdown {
  position: relative;
  width: 100%;
}

.skill-dropdown .ghost-button {
  width: 100%;
  text-align: left;
}

.skill-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px;
  display: none;
  z-index: 10;
  box-shadow: var(--shadow);
}

.skill-dropdown.open .skill-menu {
  display: grid;
  gap: 8px;
}

.skill-option {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
}

.skill-option input {
  accent-color: var(--accent);
}

.chart-card {
  background: var(--bg-card-strong);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.chart-wrap {
  background: rgba(8, 11, 18, 0.5);
  border-radius: 12px;
  padding: 12px;
}

.chart-legend {
  display: flex;
  flex-wrap: nowrap;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
  overflow-x: auto;
  padding-bottom: 4px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
}

.chart-axis {
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 1;
}

.chart-grid {
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 1;
}

.chart-label {
  fill: var(--text-muted);
  font-size: 11px;
}
