:root {
  color-scheme: dark;
  color: #eef2ff;
  background: #0d1222;
  font-family: Inter, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background: radial-gradient(circle at top, rgba(79, 140, 255, 0.15), transparent 35%), #0d1222;
  padding: 16px;
}

.app-shell {
  width: min(1120px, 100%);
  background: #12172d;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, #4f8cff, #7ad0ff);
  color: #0c1223;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.brand p {
  margin: 8px 0 0;
  color: #abb1c5;
  max-width: 620px;
  line-height: 1.5;
}

.profile-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 220px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 16px;
}

.avatar {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(135deg, #7ad0ff, #4f8cff);
  color: #0c1223;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.1rem;
}

.profile-name,
.profile-details {
  margin: 0;
  line-height: 1.4;
}

.profile-details {
  color: #a5adc6;
  font-size: 0.96rem;
}

.main-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.nav-button,
.action-grid button,
.page-back,
.card form button,
.card-header button {
  appearance: none;
  border: none;
  border-radius: 16px;
  background: rgba(79, 140, 255, 0.16);
  color: #eef2ff;
  padding: 14px 18px;
  font-size: 0.98rem;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
}

.nav-button.active,
.card form button:hover,
.card-header button:hover,
.page-back:hover,
.action-grid button:hover {
  background: linear-gradient(135deg, #4f8cff, #7ad0ff);
  transform: translateY(-1px);
}

.page-back {
  align-self: center;
}

main {
  display: grid;
  gap: 24px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.dashboard-grid,
.page-grid,
.graphs-grid {
  display: grid;
  gap: 20px;
}

.dashboard-grid {
  grid-template-columns: 1.3fr 0.9fr;
}

.page-grid {
  grid-template-columns: 1.2fr 0.9fr;
}

.graphs-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 24px;
}

.card h2,
.card h3 {
  margin-top: 0;
}

label {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  color: #e7ebff;
  font-weight: 500;
}

input[type="text"],
input[type="number"],
select,
textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px 16px;
  color: #eef2ff;
  font-size: 1rem;
  width: 100%;
}

textarea {
  resize: vertical;
}

.split-row {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
}

.run-inputs {
  display: flex;
  gap: 10px;
  align-items: center;
}

.run-inputs input {
  flex: 1;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.summary-card .summary-list {
  display: grid;
  gap: 18px;
}

.summary-card h3 {
  margin-bottom: 8px;
}

.summary-card p {
  margin: 0;
  color: #b5becf;
  line-height: 1.6;
}

.history-card .history-list,
.ai-card .weakness-list,
.output-card .ai-output {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.history-item,
.weak-item {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.history-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.history-item p {
  margin: 6px 0 0;
  color: #cbd2e4;
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.ai-output {
  min-height: 220px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: #e9edf7;
  white-space: pre-wrap;
  line-height: 1.7;
}

.chart-card canvas {
  width: 100%;
  height: 280px;
  border-radius: 18px;
  background: #101523;
  display: block;
}

.empty-state {
  color: #8f97b5;
}

@media (max-width: 860px) {
  .dashboard-grid,
  .page-grid {
    grid-template-columns: 1fr;
  }

  .split-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar,
  .main-nav,
  .action-grid {
    display: grid;
  }

  .main-nav {
    grid-template-columns: 1fr;
  }

  .nav-button,
  .action-grid button,
  .page-back {
    width: 100%;
  }
}
