:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --success: #34d399;
  --danger: #f87171;
  --text: #f8fafc;
  --muted: #94a3b8;
  --border: #334155;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 1.5rem;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
}

/* Landing Section */
.hero-container {
  min-height: 80vh;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.hero-content {
  max-width: 720px;
}

.hero-content h1 {
  font-size: 2.5rem;
  margin-top: 1rem;
}

.hero-subtitle {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.feature-pills {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.feature-pills span {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.85rem;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.btn-large {
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
}

/* Auth Cards & Modals */
.auth-overlay, .modal-overlay {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 75vh;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
}

.auth-card, .modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.auth-subtitle {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: -0.5rem;
  margin-bottom: 1.5rem;
}

.modal-description {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.input-group {
  text-align: left;
  margin-bottom: 1.25rem;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  width: 100%;
  padding-right: 4rem;
}

.input-group input {
  width: 100%;
  padding: 0.65rem;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  box-sizing: border-box;
}

.input-group input:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
}

.toggle-password-btn {
  position: absolute;
  right: 0.5rem;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.toggle-password-btn:hover {
  color: var(--primary);
}

.auth-links {
  text-align: right;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
}

.auth-switch {
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
}

.link-btn.highlight {
  font-weight: 600;
  text-decoration: underline;
}

.link-btn:hover {
  color: var(--primary-hover);
}

.auth-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.auth-success {
  color: var(--success);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* Header & Logos */
header {
  text-align: center;
  margin-bottom: 2rem;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.user-greeting {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
}

.brand-logo {
  width: 84px;
  height: 84px;
  display: inline-block;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
}

.brand-logo-small {
  width: 48px;
  height: 48px;
  display: inline-block;
}

header p {
  color: var(--muted);
}

/* Metrics & Charts Grid */
.metrics-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.metrics-header-bar h2 {
  margin: 0;
  font-size: 1.3rem;
}

.highlight-name {
  color: var(--primary);
  font-weight: 600;
}

.upload-card, .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.5rem;
}

.chart-box {
  height: 380px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.chart-box h3 {
  margin-top: 0;
  font-size: 1rem;
  color: #e2e8f0;
}

.chart-box canvas {
  flex-grow: 1;
  max-height: 310px;
}

/* Gauge Meter Centering */
.gauge-center {
  align-items: center;
  justify-content: center;
}

.gauge-value {
  position: absolute;
  bottom: 35px;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--primary);
}

/* Correlation Matrix Heatmap */
.matrix-grid-wrapper {
  overflow: auto;
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.matrix-table {
  border-collapse: collapse;
  margin: auto;
  font-size: 0.8rem;
}

.matrix-table th, .matrix-table td {
  padding: 0.5rem 0.75rem;
  text-align: center;
  border: 1px solid #334155;
}

.matrix-table th {
  background: #0f172a;
  color: var(--muted);
  font-weight: 600;
}

/* Buttons */
.btn-primary {
  background-color: var(--primary);
  color: #000;
  font-weight: 600;
  border: none;
  padding: 0.65rem 1.25rem;
  border-radius: 6px;
  cursor: pointer;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.full-width {
  width: 100%;
}

/* Table */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}
