:root {
  --bg: #0f1720;
  --surface: #1a2430;
  --surface-2: #232f3d;
  --border: #34414f;
  --text: #e8edf3;
  --muted: #93a3b5;
  --accent: #4fb0ff;
  --good: #3ecf8e;
  --warn: #f5a623;
  --bad: #f4694a;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-2: #eef1f5;
    --border: #dce2e9;
    --text: #1c2733;
    --muted: #5b6b7c;
    --accent: #1971c2;
    --good: #16794f;
    --warn: #a15c00;
    --bad: #c62828;
  }
}
:root[data-theme="light"] {
  --bg: #f4f6f9; --surface: #ffffff; --surface-2: #eef1f5; --border: #dce2e9;
  --text: #1c2733; --muted: #5b6b7c; --accent: #1971c2; --good: #16794f; --warn: #a15c00; --bad: #c62828;
}
:root[data-theme="dark"] {
  --bg: #0f1720; --surface: #1a2430; --surface-2: #232f3d; --border: #34414f;
  --text: #e8edf3; --muted: #93a3b5; --accent: #4fb0ff; --good: #3ecf8e; --warn: #f5a623; --bad: #f4694a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

nav.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
}
nav.sidebar h1 {
  font-size: 15px;
  margin: 0 8px 20px;
  color: var(--muted);
  font-weight: 600;
}
nav.sidebar a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 4px;
}
nav.sidebar a:hover { background: var(--surface-2); }
nav.sidebar a.active { background: var(--accent); color: #06121d; font-weight: 600; }

main {
  flex: 1;
  padding: 28px 36px;
  max-width: 1100px;
  overflow-x: auto;
}

h2 { margin-top: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.stat {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 16px;
}
.stat .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

button, .btn {
  background: var(--accent);
  color: #06121d;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
button.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
button:disabled { opacity: .5; cursor: not-allowed; }

input[type="date"], input[type="number"], input[type="file"], select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}

label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.table-wrap { overflow-x: auto; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.good { background: rgba(62,207,142,.15); color: var(--good); }
.pill.warn { background: rgba(245,166,35,.15); color: var(--warn); }
.pill.bad { background: rgba(244,105,74,.15); color: var(--bad); }

.filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 16px; }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
}
.dropzone.drag { border-color: var(--accent); color: var(--accent); }

.msg { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.msg.error { background: rgba(244,105,74,.15); color: var(--bad); }
.msg.success { background: rgba(62,207,142,.15); color: var(--good); }

.editable { background: transparent; border: 1px solid transparent; color: var(--text); width: 70px; padding: 2px 6px; border-radius: 4px; }
.editable:focus { border-color: var(--accent); outline: none; background: var(--surface-2); }

canvas { max-width: 100%; }
