:root{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--bg:#f4f3f0;--surface-1:#fcfcfb;--surface-2:#efeee9;--border:#dddcd6;--text-primary:#0b0b0b;--text-secondary:#52514e;--text-muted:#7a7974;--grid:#e6e5e0;--series-1:#2a78d6;--series-1-fill:#2a78d629;--series-2:#eb6834;--series-3:#1baf7a;--dose:#52514e;--usable:#1baf7a14;--accent:#2a78d6;--accent-ink:#fff;--warn-bg:#fff4dc;--warn-ink:#6b4a00;--danger:#c43c3b}@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--bg:#111110;--surface-1:#1a1a19;--surface-2:#252523;--border:#34342f;--text-primary:#fff;--text-secondary:#c3c2b7;--text-muted:#8d8c84;--grid:#2b2b28;--series-1:#3987e5;--series-1-fill:#3987e538;--series-2:#d95926;--series-3:#199e70;--dose:#c3c2b7;--usable:#199e701a;--accent:#3987e5;--warn-bg:#3a2e10;--warn-ink:#f5d58a;--danger:#e66767}}*{box-sizing:border-box}html,body{background:var(--bg);color:var(--text-primary);margin:0}body{-webkit-tap-highlight-color:transparent;font:16px/1.4 system-ui,-apple-system,Segoe UI,Roboto,sans-serif;overflow-x:hidden}button,input,select{font:inherit;color:inherit}.app{flex-direction:column;min-height:100dvh;display:flex}main{padding-bottom:calc(64px + env(safe-area-inset-bottom));flex:1}.page{flex-direction:column;gap:12px;max-width:640px;margin:0 auto;padding:16px;display:flex}.tabs{background:var(--surface-1);border-top:1px solid var(--border);padding-bottom:env(safe-area-inset-bottom);z-index:5;grid-template-columns:repeat(4,1fr);display:grid;position:fixed;bottom:0;left:0;right:0}.tabs button{color:var(--text-muted);background:0 0;border:0;padding:14px 0;font-size:14px}.tabs button.on{color:var(--accent);font-weight:600}.card{background:var(--surface-1);border:1px solid var(--border);border-radius:14px;padding:12px}.card-title{color:var(--text-secondary);margin-bottom:8px;font-size:13px;font-weight:600}.chart-card{padding:8px 6px 10px}.muted{color:var(--text-muted)}.small{font-size:13px}.error{color:var(--danger)}.status{text-align:center;padding:8px 0 4px}.big-number{letter-spacing:-2px;font-variant-numeric:tabular-nums;font-size:72px;font-weight:700;line-height:1}.big-number .unit{color:var(--text-secondary);margin-left:2px;font-size:32px}.status-note{color:var(--text-secondary);margin:6px 0 4px;font-size:18px}.actions{grid-template-columns:1fr 1fr;gap:10px;display:grid}button.big{border:1px solid var(--border);background:var(--surface-1);border-radius:12px;min-height:52px;padding:0 12px;font-size:17px;font-weight:600}button.primary{background:var(--accent);color:var(--accent-ink);border-color:#0000}button.full{width:100%}button:disabled{opacity:.5}button.icon{color:var(--text-muted);background:0 0;border:0;padding:6px 10px;font-size:16px}button.link{text-align:left;background:0 0;border:0;padding:0;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.energy-row{grid-template-columns:repeat(5,1fr);gap:8px;display:grid}.energy-btn{border:1px solid var(--border);background:var(--surface-2);border-radius:12px;height:56px;font-size:22px;font-weight:700}.energy-btn:active{background:var(--series-2);color:#fff}.energy-scale{justify-content:space-between;margin-top:4px;font-size:12px;display:flex}.log{margin:0;padding:0;list-style:none}.log li{border-top:1px solid var(--grid);align-items:center;gap:10px;padding:6px 0;display:flex}.log li:first-child{border-top:0}.log li>:nth-child(2){overflow-wrap:anywhere;flex:1;min-width:0}.log-time{font-variant-numeric:tabular-nums;color:var(--text-muted);font-size:14px}.chart{width:100%;position:relative}.chart svg{-webkit-user-select:none;user-select:none;display:block}.grid{stroke:var(--grid);stroke-width:1px}.tick{fill:var(--text-muted);font-variant-numeric:tabular-nums;font-size:10px}.dose-label{fill:var(--text-secondary)}.level-line{fill:none;stroke:var(--series-1);stroke-width:2px;stroke-linejoin:round}.level-line.future{stroke-dasharray:4 3;opacity:.8}.level-fill{fill:var(--series-1-fill)}.level-fill.future{opacity:.5}.threshold{stroke:var(--text-secondary);stroke-width:1px;stroke-dasharray:2 3}.usable{fill:var(--usable)}.now{stroke:var(--text-primary);stroke-width:1.5px}.crosshair{stroke:var(--text-muted);stroke-width:1px}.hover-dot{fill:var(--series-1);stroke:var(--surface-1);stroke-width:2px}.dose-mark{fill:var(--dose)}.dose-mark.food{fill:var(--surface-1);stroke:var(--dose);stroke-width:1.5px}.dose-label{paint-order:stroke;stroke:var(--surface-1);stroke-width:3px;font-weight:600}.caf-mark{fill:var(--series-3)}.caf-mark.planned{fill:var(--surface-1);stroke:var(--series-3);stroke-width:1.5px}.dose-mark.planned{fill:var(--surface-1);stroke:var(--dose);stroke-width:1.2px;stroke-dasharray:2 1.5}.dose-label.planned{fill:var(--text-muted)}.caf-line{fill:none;stroke:var(--series-3);stroke-width:1.4px;stroke-linejoin:round;opacity:.85}.caf-line.future{stroke-dasharray:3 3;opacity:.7}.caf-fill{fill:var(--series-3);opacity:.06}.caf-tick{fill:var(--series-3);opacity:.8}.strip{fill:var(--surface-2);opacity:.6}.energy-dot{fill:var(--series-2);stroke:var(--surface-1);stroke-width:1.5px}.tooltip{text-align:center;pointer-events:none;background:var(--surface-2);border:1px solid var(--border);width:160px;color:var(--text-primary);border-radius:8px;padding:3px 6px;font-size:12px;position:absolute;top:0}.legend{color:var(--text-secondary);flex-wrap:wrap;gap:4px 12px;padding:6px 6px 0;font-size:11px;display:flex}.legend span{align-items:center;gap:5px;display:inline-flex}.sw{border-radius:2px;width:12px;height:8px;display:inline-block}.sw.level{background:var(--series-1);height:3px}.sw.threshold{border-top:1px dashed var(--text-secondary);height:0}.sw.dose{border-left:5px solid #0000;border-right:5px solid #0000;border-bottom:8px solid var(--dose);border-radius:0;width:0;height:0}.sw.caf{background:var(--series-3);border-radius:1px;width:7px;height:7px;transform:rotate(45deg)}.sw.caf-line{background:var(--series-3);opacity:.85;height:2px}.sw.energy{background:var(--series-2);border-radius:50%;width:8px;height:8px}.sheet-backdrop{z-index:10;background:#00000073;justify-content:center;align-items:flex-end;display:flex;position:fixed;inset:0}.sheet{background:var(--surface-1);width:100%;max-width:640px;max-height:90dvh;padding:12px 16px calc(20px + env(safe-area-inset-bottom));border-radius:18px 18px 0 0;flex-direction:column;gap:12px;display:flex;overflow-y:auto}.sheet-head{justify-content:space-between;align-items:center;display:flex}.sheet-head h2{margin:0;font-size:20px}.chips{flex-wrap:wrap;gap:8px;display:flex}.chip{border:1px solid var(--border);background:var(--surface-2);border-radius:22px;min-height:44px;padding:0 16px;font-weight:600}.chip.on{background:var(--accent);color:var(--accent-ink);border-color:#0000}.field{color:var(--text-secondary);flex-direction:column;gap:4px;min-width:0;font-size:13px;display:flex}.field input,.field select{border:1px solid var(--border);background:var(--surface-2);min-height:44px;color:var(--text-primary);border-radius:10px;width:100%;min-width:0;padding:0 10px;font-size:16px}.toggle{align-items:center;gap:10px;min-height:44px;display:flex}.toggle input{width:22px;height:22px}.row{gap:10px;display:flex}.grow{flex:1}.preset-list{flex-direction:column;gap:8px;display:flex}.warn{background:var(--warn-bg);color:var(--warn-ink);border-radius:10px;margin:0;padding:10px 12px;font-size:14px}.toast{left:50%;bottom:calc(76px + env(safe-area-inset-bottom));background:var(--text-primary);color:var(--surface-1);z-index:20;border-radius:20px;max-width:calc(100vw - 32px);padding:10px 16px;font-size:14px;position:fixed;transform:translate(-50%)}.pager{justify-content:space-between;align-items:center;display:flex}.pager-label{text-align:center}button.big-arrow{color:var(--text-primary);min-height:44px;padding:2px 18px;font-size:34px;line-height:1}button.big-arrow:disabled{opacity:.25}.day-card{padding:8px 6px 4px}.day-card.future{opacity:.5;padding:8px 10px}.day-head{justify-content:space-between;align-items:baseline;gap:8px;padding:0 6px 2px;font-size:14px;display:flex}.day-stats{color:var(--text-secondary);font-variant-numeric:tabular-nums;gap:10px;font-size:12px;display:flex}.toolbar{flex-wrap:wrap;justify-content:space-between;gap:8px;display:flex}.seg{border:1px solid var(--border);border-radius:10px;display:inline-flex;overflow:hidden}.seg button{background:var(--surface-1);border:0;min-height:40px;padding:8px 12px;font-size:14px}.seg button+button{border-left:1px solid var(--border)}.seg button.on{background:var(--accent);color:var(--accent-ink)}.trend-title{justify-content:space-between;display:flex}.trend-line{fill:none;stroke:var(--series-1);stroke-width:2px;stroke-linejoin:round}.trend-dot{fill:var(--series-1)}.table-wrap{padding:0;overflow-x:auto}table.data{border-collapse:collapse;font-variant-numeric:tabular-nums;width:100%;font-size:14px}table.data th,table.data td{text-align:right;border-bottom:1px solid var(--grid);padding:8px 10px}table.data th:first-child,table.data td:first-child{text-align:left}table.data th{color:var(--text-secondary);font-size:12px;font-weight:600}.form{flex-direction:column;gap:10px;display:flex}.form p{margin:0}code{font-size:.9em}.next-alert{background:var(--surface-2);max-width:420px;color:var(--text-secondary);text-align:left;border-radius:10px;margin:10px auto 0;padding:8px 12px}.plan{margin:0 0 6px;padding:0;list-style:none}.plan li{border-top:1px solid var(--grid);align-items:center;gap:10px;padding:6px 0;display:flex}.plan li:first-child{border-top:0}.plan .grow{flex:1}.caf-plan p{margin:4px 0 0}.login{justify-content:center;min-height:100dvh}
