*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #1f2937;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --yellow: #f59e0b;
  --blue: #3b82f6;
  --green: #10b981;
  --red: #ef4444;
  --purple: #8b5cf6;
  --accent: #6366f1;
  --radius: 10px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
header h1 { font-size: 18px; font-weight: 600; }
header .subtitle { color: var(--muted); font-size: 13px; margin-left: auto; }

/* ── Layout ── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Upload ── */
#drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
#drop-zone:hover,
#drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.06);
}
#drop-zone .drop-icon { font-size: 32px; margin-bottom: 8px; }
#drop-zone p { color: var(--muted); font-size: 13px; }
#drop-zone strong { color: var(--text); }
#file-input { display: none; }
.btn-link { color: var(--accent); cursor: pointer; text-decoration: underline; }

/* ── File list ── */
#file-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
}
.file-item .file-name { flex: 1; }
.file-item .file-meta { color: var(--muted); font-size: 12px; }
.file-item .badge {
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
}
.file-item .btn-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
}
.file-item .btn-remove:hover { color: var(--red); }

#status-summary {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 13px;
  display: none;
  align-items: center;
  gap: 10px;
}
#status-summary.show { display: flex; }
#status-summary .info { color: var(--muted); }

/* ── Visibility ── */
.section-hidden { display: none !important; }

/* ── Controls row ── */
.controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.controls-row label { color: var(--muted); font-size: 13px; white-space: nowrap; }

select,
input[type="number"],
input[type="date"] {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
}
select:focus,
input:focus { border-color: var(--accent); }
input[type="date"] { color-scheme: dark; }

.nav-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}
.nav-btn:hover { background: var(--border); }

.divider { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

/* ── Stats strip ── */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.stat-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}
.stat-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 18px; font-weight: 700; margin-top: 2px; }
.stat-unit { font-size: 11px; color: var(--muted); }
.c-yellow { color: var(--yellow); }
.c-blue   { color: var(--blue); }
.c-green  { color: var(--green); }
.c-red    { color: var(--red); }
.c-purple { color: var(--purple); }

/* ── Chart ── */
.chart-wrap { position: relative; height: 320px; }

/* ── Battery calc inputs ── */
.inputs-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: flex-end;
}
.input-group { display: flex; flex-direction: column; gap: 4px; }
.input-group label { font-size: 12px; color: var(--muted); }
.input-group input,
.input-group select { width: 120px; }

/* ── Recommendation box ── */
#recommendation {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 13px;
  display: none;
}
#recommendation strong { color: var(--green); font-size: 15px; }

/* ── Results table ── */
.table-wrap { overflow-x: auto; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  background: var(--surface2);
  color: var(--muted);
  padding: 8px 12px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
th:first-child,
td:first-child { text-align: left; }
td {
  padding: 8px 12px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: none; }
tr.recommended td { background: rgba(16, 185, 129, 0.08); }
tr.recommended td:first-child { border-left: 3px solid var(--green); }
tr:hover td { background: var(--surface2); }
td.c-yellow, td.c-green, td.c-blue, td.c-red { font-weight: 600; }

/* ── Notes ── */
.note {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 12px;
}
.error-msg { color: var(--red); font-size: 13px; padding: 8px 0; display: none; }

/* ── Responsive ── */
@media (max-width: 600px) {
  header { padding: 12px 16px; }
  header .subtitle { display: none; }
  main { padding: 12px; gap: 12px; }
  .card { padding: 14px; }
  .chart-wrap { height: 240px; }
}
