:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e3e6ec;
  --ink: #1a1d23;
  --muted: #5b6472;
  --accent: #1f5f8b;
  --accent-soft: #e6f0f6;
  --good: #2d7a4b;
  --warn: #b9842a;
  --bad: #b14848;
  --shadow: 0 1px 2px rgba(20, 25, 35, 0.04), 0 4px 12px rgba(20, 25, 35, 0.04);
  --radius: 10px;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header.site {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}
header.site .brand {
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
header.site .brand small {
  color: var(--muted);
  font-weight: 400;
  margin-left: 8px;
  white-space: nowrap;
}
header.site nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 0;
  margin-left: auto;
}
header.site nav a {
  margin-left: 18px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}
header.site #user-chip {
  white-space: nowrap;
  margin-left: 18px;
}

.dropzone {
  border: 1.5px dashed #d4d8e0;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  background: #fafbfc;
  transition: border-color 0.15s ease, background 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 260px;
}
.dropzone:hover { border-color: #aab2bf; }
.dropzone.drag { border-color: var(--accent); background: #eef4f9; }
.dz-link { color: var(--accent); text-decoration: underline; }
.dz-file { font-weight: 600; color: #2a2f36; }

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px;
}

h1 { font-size: 28px; margin: 0 0 4px 0; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 28px 0 12px 0; letter-spacing: -0.01em; }
.subtitle { color: var(--muted); margin: 0 0 24px 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.kpi .label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kpi .value {
  font-size: 26px;
  font-weight: 600;
  margin-top: 6px;
  letter-spacing: -0.01em;
}
.kpi .delta {
  font-size: 12px;
  margin-top: 4px;
  color: var(--muted);
}
.kpi .delta.good { color: var(--good); }
.kpi .delta.bad { color: var(--bad); }

.metric-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.metric-table th, .metric-table td {
  text-align: right;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.metric-table th:first-child, .metric-table td:first-child {
  text-align: left;
}
.metric-table thead th {
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--border);
}
.metric-table td.muted { color: var(--muted); }

.progress {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
}
.progress > span.good { background: var(--good); }
.progress > span.warn { background: var(--warn); }

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.chart-card h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}
.chart-card canvas { max-height: 220px; }

.callout {
  background: var(--accent-soft);
  border: 1px solid #cfe1ec;
  color: #163d57;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 16px 0;
  font-size: 14px;
}

.empty {
  color: var(--muted);
  font-style: italic;
  padding: 16px 0;
}

.btn {
  display: inline-block;
  padding: 10px 18px;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
}
.btn:hover { text-decoration: none; opacity: 0.92; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--border); }

.center-stage {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.center-stage .card { max-width: 480px; }
