:root{color-scheme:light;--bg:#F5F5F7;--text:#1D1D1F;--muted:#6E6E73;--line:#D2D2D7;--blue:#0071E3;--green:#34A853}
*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;background:var(--bg);color:var(--text);font:15px/1.5 -apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",sans-serif;-webkit-font-smoothing:antialiased}
button,input{font:inherit;color:inherit}
button{cursor:pointer;touch-action:manipulation}
button:disabled{cursor:default}
button:focus-visible,input:focus-visible,a:focus-visible{outline:3px solid var(--blue);outline-offset:3px}
nav{height:64px;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 max(16px,calc((100% - 720px)/2));background:rgba(255,255,255,.85);border-bottom:1px solid var(--line);backdrop-filter:blur(20px);position:sticky;top:0;z-index:1}
/* Navigation and save status match the Ausgaben tracker. */
.brand{display:flex;align-items:center;gap:10px;font-size:17px;font-weight:600;letter-spacing:-.2px;white-space:nowrap}
.back{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;margin-left:-8px;border-radius:50%;color:#0066CC;text-decoration:none;transition:background .15s}.back:hover{background:#E8E8ED}.back:active{background:var(--line)}
.pill{height:36px;padding:0 18px;border-radius:980px;border:none;font-size:14px;font-weight:500;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.pill.gray{background:#E8E8ED;color:var(--text)}
.pill.warn{background:#FFF1DC;color:#8A4500}
.sync-icon{display:inline-flex}
.sync-dot{width:8px;height:8px;border-radius:4px;display:inline-block;background:#FF9F0A}
@media (max-width:640px){.brand>svg{display:none}#sync .t{display:none}}
main{max-width:720px;margin:auto;padding:36px 16px 60px;display:flex;flex-direction:column;gap:20px}
h1{font-size:clamp(26px,5vw,34px);letter-spacing:-.8px;line-height:1.2;margin:0 0 8px}
header p{margin:0;color:var(--muted);font-size:14px}
.card{background:white;border-radius:18px;padding:24px}
h2{font-size:20px;letter-spacing:-.3px;margin:0}
.entry-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:18px;font-weight:600;font-size:17px}
input[type=date]{border:1px solid var(--line);border-radius:10px;padding:9px 10px;background:white;min-width:0;max-width:100%}
.dot{display:inline-block;width:10px;height:10px;border-radius:50%;flex-shrink:0}
.done{background:var(--green)}.missed{background:none;box-shadow:inset 0 0 0 1.5px var(--line)}
.note{font-size:12px;color:var(--muted);margin:14px 0 0}
.month-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:22px;gap:12px}
.arrow{width:40px;height:40px;border:0;border-radius:50%;background:var(--bg);font-size:28px;line-height:1}
.arrow:disabled{opacity:.25}
.weekdays,.calendar{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));text-align:center;gap:6px}
.weekdays{color:var(--muted);font-size:12px;margin-bottom:10px}
.day{display:flex;align-items:center;flex-direction:column;justify-content:center;gap:8px;min-height:60px;padding:7px 0;border:1px solid transparent;background:none;border-radius:12px;font-size:14px;font-variant-numeric:tabular-nums}
.day:hover:not(:disabled){background:var(--bg)}
.day[aria-current=date] .number{font-weight:700;color:var(--blue)}
.day:disabled{color:#9E9EA3}
.day:disabled .dot{background:none;border:1px solid #E8E8ED}
.legend{display:flex;justify-content:center;flex-wrap:wrap;gap:18px;font-size:12px;color:var(--muted);margin-top:20px}
.legend span,.breakdown span{display:flex;align-items:center;gap:6px}
.stats-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.ranges{display:flex;background:#EEEEF0;border-radius:9px;padding:3px}
.ranges button{border:0;background:none;padding:7px 12px;border-radius:7px;font-size:12px;min-height:34px}
.ranges button[aria-pressed=true]{background:white;box-shadow:0 1px 3px #0002;font-weight:600}
.headline{margin:24px 0 16px;line-height:1.4}
.headline strong{display:block;font-size:clamp(25px,6vw,34px);letter-spacing:-.7px}
.headline>span{color:var(--muted);font-size:14px}
.breakdown{display:flex;flex-wrap:wrap;gap:12px 20px;font-size:13px;color:var(--muted)}
.breakdown b{color:var(--text)}
#error{max-width:720px;margin:32px auto;padding:0 16px;color:#D70015}
/* Habit list: the circle ticks the day, the rest of the row opens the calendar. */
.progress{margin:-6px 0 8px;font-size:13px;color:var(--muted)}
.progress.complete{color:#248A3D;font-weight:600}
.progress:empty{display:none}
.habits{list-style:none;margin:0;padding:0}
.habits li{display:flex;align-items:center;gap:14px;border-top:1px solid var(--line)}
.habits li:first-child{border-top:0}
.check{flex-shrink:0;width:44px;height:44px;margin:8px 0;border:2px solid var(--line);border-radius:50%;background:none;display:inline-flex;align-items:center;justify-content:center;color:transparent;transition:background .15s,border-color .15s,color .15s,transform .1s}
.check:hover{border-color:var(--green)}
.check:active{transform:scale(.92)}
.check[aria-pressed=true]{background:var(--green);border-color:var(--green);color:white}
.open{flex:1;min-width:0;display:flex;align-items:center;gap:10px;padding:12px 0;color:inherit;text-decoration:none}
.open>span{flex:1;min-width:0;display:flex;flex-direction:column}
.open .name{font-size:16px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.open .meta{font-size:12px;color:var(--muted)}
.open svg{color:var(--muted);flex-shrink:0}
.open:hover .name{color:var(--blue)}
.empty{margin:4px 0 0;color:var(--muted);font-size:14px}
.add{display:flex;gap:8px;margin-top:16px}
input[type=text]{flex:1;min-width:0;border:1px solid var(--line);border-radius:10px;padding:10px 12px;background:white;font-size:16px}
.add button{border:0;border-radius:10px;padding:0 16px;min-height:44px;background:var(--blue);color:white;font-weight:600;white-space:nowrap}
.add button:hover{background:#0077ED}
.danger{margin-top:16px;border:0;background:none;padding:8px 0;color:#D70015;font-weight:500}
.center{text-align:center}
.day[aria-pressed=true]{background:#EAF6EC}
.day[aria-pressed=true]:hover{background:#DDF0E1}
@media(max-width:420px){.card{padding:20px 16px}.entry-head{font-size:15px;gap:8px}.calendar{gap:3px}.day{min-height:54px}.stats-head{align-items:flex-start;flex-direction:column}}
/* Dunkel */
:root[data-theme=dark]{--bg:#000;--text:#F5F5F7;--muted:#98989D;--line:#38383A;--blue:#0A84FF;--green:#30D158}
[data-theme=dark] nav{background:rgba(22,22,23,.85)}
[data-theme=dark] .back{color:#2997FF}
[data-theme=dark] .back:hover,[data-theme=dark] .pill.gray,[data-theme=dark] .ranges{background:#2C2C2E}
[data-theme=dark] .pill.warn{background:#3D2A0F;color:#FFB340}
[data-theme=dark] .card,[data-theme=dark] input[type=date],[data-theme=dark] input[type=text]{background:#1C1C1E}
[data-theme=dark] .progress.complete{color:#30D158}
[data-theme=dark] .check[aria-pressed=true]{color:#000}
[data-theme=dark] .day[aria-pressed=true]{background:#123A1E}
[data-theme=dark] .day[aria-pressed=true]:hover{background:#18492A}
[data-theme=dark] .danger{color:#FF453A}
[data-theme=dark] .arrow,[data-theme=dark] .day:hover:not(:disabled){background:#2C2C2E}
[data-theme=dark] .day:disabled{color:#636366}
[data-theme=dark] .day:disabled .dot{border-color:#3A3A3C}
[data-theme=dark] .ranges button[aria-pressed=true]{background:#636366}
[data-theme=dark] #error{color:#FF453A}
