:root { --forest: #073d27; --accent: #168b79; --ink: #18372d; --muted: #657a70; --line: #dde7df; --soft: #f1f6f1; --bad: #a23a2a; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #f5f7f1; color: var(--ink); font: 16px/1.5 system-ui, "Segoe UI", sans-serif; padding-bottom: env(safe-area-inset-bottom); }
header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--forest); color: white; }
header h1 { flex: 1; margin: 0; font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
header select { width: auto; background: transparent; color: white; border: 1px solid #ffffff55; border-radius: 8px; padding: 6px; }
header select option { color: var(--ink); }
button.icon { background: transparent; color: white; border: 0; font-size: 22px; padding: 4px 8px; }
section { max-width: 560px; margin: auto; padding: 12px 14px 32px; }
#notice { max-width: 560px; margin: 8px auto 0; padding: 0 16px; min-height: 22px; font-size: 14px; color: #855824; }
#notice.error { color: var(--bad); }
.card { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 17px; margin: 0 0 10px; color: var(--forest); }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
label { display: block; margin-top: 12px; font-size: 13px; color: var(--muted); }
label span { display: block; margin-bottom: 4px; }
input, select { width: 100%; font: inherit; color: var(--ink); padding: 11px 12px; border: 1px solid #cbdacf; border-radius: 10px; background: white; }
button { font: inherit; border: 1px solid #cbdacf; background: white; color: var(--ink); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
button:disabled { opacity: .45; }
button.primary { background: var(--forest); color: white; border-color: var(--forest); font-weight: 600; }
button.big { width: 100%; margin-top: 16px; padding: 16px; font-size: 18px; }
button.text { border: 0; background: none; color: var(--muted); text-decoration: underline; padding: 8px 0; }
.row { display: flex; gap: 10px; }
.row > button { flex: 1; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0 10px; }
details { margin-top: 12px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
label.check input { width: auto; }
body.field .admin-only { display: none !important; }
summary { color: var(--accent); font-size: 14px; cursor: pointer; }
.device-card { display: block; width: 100%; text-align: left; margin-bottom: 10px; padding: 14px 16px; }
.device-card strong { display: block; font-size: 17px; }
.device-card small { color: var(--muted); }
.pill { display: inline-block; margin-left: 8px; padding: 2px 10px; border-radius: 20px; font-size: 12px; background: var(--soft); color: var(--muted); vertical-align: middle; }
.pill.on { background: #e1f2e6; color: var(--forest); }
.progress { height: 6px; background: var(--soft); border-radius: 6px; margin-top: 14px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 30%; background: var(--accent); animation: slide 1.2s infinite ease-in-out; }
@keyframes slide { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }
.result { text-align: center; border-color: #b9dcc4; background: #f3faf5; }
.result .analyte { color: var(--muted); font-size: 15px; }
.result .value { font-size: 44px; font-weight: 700; color: var(--forest); line-height: 1.15; margin: 6px 0; }
.result .value small { font-size: 18px; font-weight: 500; color: var(--muted); }
.result .level { display: inline-block; padding: 4px 14px; border-radius: 20px; background: var(--forest); color: white; font-weight: 600; }
.result .flags { color: var(--bad); font-size: 14px; margin-top: 10px; }
.history-item { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.history-item:first-child { border-top: 0; }
.history-item b { color: var(--forest); }
.history-item button { padding: 4px 10px; font-size: 13px; border-radius: 8px; white-space: nowrap; }
dialog { border: 0; border-radius: 16px; padding: 18px; width: min(92vw, 420px); }
dialog::backdrop { background: #0006; }
@media (prefers-reduced-motion: reduce) { .progress span { animation: none; width: 100%; } }
