:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --sidebar-bg: #f1f5f9;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #667eea;
  --primary-dark: #5a67d8;
  --accent: #764ba2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
}

.sidebar-hero {
  text-align: center;
}

.sidebar-hero h2 {
  margin: 0.5rem 0 1rem;
}

.info-box {
  background: #dbeafe;
  color: #1e3a8a;
  padding: 1rem;
  border-radius: 10px;
  font-size: 0.92rem;
}

.info-box ul {
  padding-left: 1.2rem;
  margin: 0.5rem 0 0;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.main {
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.header {
  text-align: center;
  margin-bottom: 2rem;
}

.main-header {
  font-size: 2.4rem;
  margin: 0;
  color: var(--text);
}

.subtitle {
  color: var(--muted);
  font-size: 1.1rem;
  margin-top: 0.5rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.card h3 {
  margin-top: 0;
}

.control {
  margin-bottom: 1.2rem;
}

.control-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.control .val {
  color: var(--primary);
  font-weight: 700;
}

.control input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

.control select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 1rem;
  background: #fff;
}

.control small {
  display: block;
  color: var(--muted);
  margin-top: 0.2rem;
}

.btn-primary {
  width: 100%;
  padding: 0.85rem 1.2rem;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.btn-primary:hover {
  opacity: 0.94;
}

.btn-primary:active {
  transform: scale(0.99);
}

.btn-secondary {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #f3f4f6;
}

.chart-wrap {
  position: relative;
  height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bar-wrap {
  position: relative;
  height: 260px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.metric-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  padding: 1.4rem;
  border-radius: 14px;
  text-align: center;
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.22);
}

.metric-label {
  display: block;
  font-size: 0.95rem;
  opacity: 0.92;
  margin-bottom: 0.35rem;
}

.metric-value {
  font-size: 2rem;
}

.insight-card {
  padding: 0.95rem 1.1rem;
  border-radius: 10px;
  margin: 0.6rem 0;
  color: var(--text);
  font-weight: 500;
}

.success-card {
  background-color: #d1fae5;
  border-left: 4px solid #10b981;
}

.warning-card {
  background-color: #fef3c7;
  border-left: 4px solid #f59e0b;
}

.rec-list {
  padding-left: 1.25rem;
}

.table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  background: #f9fafb;
  font-weight: 600;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.hidden {
  display: none;
}

.mt-1 {
  margin-top: 1rem;
}

.status-note {
  font-size: 0.85rem;
  color: #065f46;
  margin-top: 0.5rem;
}

.footer {
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer a {
  color: var(--primary);
  text-decoration: none;
}

@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .grid-2, .metrics-grid {
    grid-template-columns: 1fr;
  }
  .main {
    padding: 1.25rem;
  }
}
