:root {
  --bg: #f5f6f4;
  --surface: #ffffff;
  --ink: #1a2420;
  --muted: #62716a;
  --line: #dde3df;
  --accent: #2c6e63;
  --accent-ink: #ffffff;
  --warn: #9c3e2e;
  --warn-soft: #f6e6e1;
  --good: #2c6e63;
  --good-soft: #e1ece8;
  --mid-soft: #fbeecd;
  --mid: #8a6416;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101815;
    --surface: #172420;
    --ink: #e7efe9;
    --muted: #93a89d;
    --line: #2b3a34;
    --accent: #74c3ab;
    --accent-ink: #0d1a16;
    --warn: #e2937a;
    --warn-soft: #3a241d;
    --good: #74c3ab;
    --good-soft: #1c332a;
    --mid-soft: #3a301a;
    --mid: #e0bd6f;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

.shell { max-width: 640px; margin: 0 auto; padding: 20px 16px 100px; }

nav.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}
nav.tabbar a {
  color: var(--muted); text-decoration: none; font-size: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 10px;
}
nav.tabbar a.active { color: var(--accent); font-weight: 600; }
nav.tabbar .icon { font-size: 20px; }

h1 { font-size: 22px; margin: 4px 0 20px; }
h2 { font-size: 16px; margin: 0 0 10px; }

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

.row { display: flex; justify-content: space-between; align-items: baseline; }
.muted { color: var(--muted); font-size: 13px; }

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

.badge {
  display: inline-block; font-size: 12.5px; padding: 3px 10px; border-radius: 999px; font-weight: 600;
}
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.mid { background: var(--mid-soft); color: var(--mid); }
.badge.low { background: var(--warn-soft); color: var(--warn); }

.warning {
  background: var(--warn-soft); color: var(--warn); border-radius: var(--radius);
  padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px;
}

form { display: flex; flex-direction: column; gap: 12px; }
label { font-size: 13.5px; color: var(--muted); display: block; margin-bottom: 4px; }
input, select {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 15px;
}
button {
  background: var(--accent); color: var(--accent-ink); border: none; border-radius: 8px;
  padding: 12px; font-size: 15px; font-weight: 600; cursor: pointer;
}
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

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

.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; opacity: 0; transition: opacity 0.2s; pointer-events: none; z-index: 100;
}
.toast.show { opacity: 1; }
