:root {
  --bg: #121212;
  --surface: #1e1e1e;
  --surface-2: #262626;
  --text: #e8e8e8;
  --text-dim: #9a9a9a;
  --accent: #22c55e;
  --accent-dim: #16532f;
  --danger: #ef4444;
  --warning: #f59e0b;
  --border: #333;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding-bottom: 76px;
  min-height: 100vh;
}

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

h1, h2, h3 { margin: 0 0 12px 0; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.1rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  border-bottom: 1px solid var(--border);
}

.card {
  background: var(--surface);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}

.pill {
  display: inline-block;
  background: var(--accent-dim);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .85rem;
}

.pill.warn { background: #4d3a12; color: var(--warning); }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: .85rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.field input[type=number],
.field input[type=text],
.field input[type=date],
.field input[type=password],
.field textarea,
.field select {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
}
.field textarea { min-height: 80px; resize: vertical; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.toggle-group { display: flex; gap: 10px; }
.toggle-btn {
  flex: 1;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 16px;
  font-weight: 600;
}
.toggle-btn.active.yes { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.toggle-btn.active.no { background: #4d1a1a; color: var(--danger); border-color: var(--danger); }

button, .btn {
  display: block;
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #04220f;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
button.secondary, .btn.secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
button:active { opacity: .8; }

.rpe-scale { display: flex; gap: 4px; flex-wrap: wrap; }
.rpe-btn {
  width: 30px; height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 14px;
}
.rpe-btn.active { background: var(--accent); color: #04220f; border-color: var(--accent); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.stat .value { font-size: 1.4rem; font-weight: 700; }
.stat .label { font-size: .75rem; color: var(--text-dim); }

.nav-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-bar a {
  flex: 1;
  text-align: center;
  padding: 12px 4px 8px;
  color: var(--text-dim);
  font-size: .72rem;
  font-weight: 600;
}
.nav-bar a.active { color: var(--accent); }
.nav-bar .icon { display: block; font-size: 1.3rem; margin-bottom: 2px; }

.list-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.list-item:last-child { border-bottom: none; }

.muted { color: var(--text-dim); font-size: .85rem; }

canvas { max-width: 100%; }

.status-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 8px;
}
.status-dot.ok { background: var(--accent); }
.status-dot.bad { background: var(--danger); }

.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-box { width: 100%; max-width: 360px; }
.error-msg { color: var(--danger); margin-top: 10px; font-size: .9rem; }
