/* Gloed design — tokens and screens mirror "Habit Tracker Gloed.dc.html". */

/* ---------- Themes: hue (--h), chroma factor (--k) and accents ---------- */
body { --h: 60; --k: 1; --acc: #e8913a; --accA: #ffc27a; --accB: #d9731f; }
body[data-theme="oceaan"] { --h: 200; --k: 1; --acc: #2bb3b1; --accA: #7fe3d8; --accB: #16868f; }
body[data-theme="bos"] { --h: 145; --k: 0.9; --acc: #5fae5a; --accA: #a8dd8a; --accB: #3a8342; }
body[data-theme="lavendel"] { --h: 295; --k: 1; --acc: #9b7be0; --accA: #c9b0ff; --accB: #6f52c4; }
body[data-theme="roos"] { --h: 10; --k: 1; --acc: #e0607e; --accA: #ffa3b5; --accB: #bf3a5e; }
body[data-theme="maan"] { --h: 255; --k: 0.35; --acc: #8e98ad; --accA: #d3d9e4; --accB: #636d84; }

/* ---------- Light mode ---------- */
body {
  --text: oklch(0.28 calc(0.06 * var(--k)) var(--h));
  --muted: oklch(0.5 calc(0.06 * var(--k)) var(--h));
  --hair: oklch(0.28 calc(0.06 * var(--k)) var(--h) / 0.08);
  --ringc: oklch(0.28 calc(0.06 * var(--k)) var(--h) / 0.3);
  --track: oklch(0.28 calc(0.06 * var(--k)) var(--h) / 0.08);
  --doneName: oklch(0.72 calc(0.04 * var(--k)) var(--h));
  --card: #ffffff;
  --cardShadow: 0 1px 3px oklch(0.28 calc(0.06 * var(--k)) var(--h) / 0.06);
  --mix: #ffffff;
  --seg: oklch(0.28 calc(0.06 * var(--k)) var(--h) / 0.06);
  --segOn: #ffffff;
  --nav: rgba(255, 255, 255, 0.92);
  --navShadow: 0 2px 10px oklch(0.28 calc(0.06 * var(--k)) var(--h) / 0.07);
  --navOn: var(--accB);
  --navOff: oklch(0.68 calc(0.04 * var(--k)) var(--h));
  --fabFg: #ffffff;
  --accent: var(--accB);
  --bgRing: #ffffff;
  --catInk: 80%;
  --top: oklch(0.89 calc(0.07 * var(--k)) var(--h));
  color-scheme: light;
  --catBg: 14%;
  --pageEnd: oklch(0.99 calc(0.006 * var(--k)) var(--h));
  /* A warm glow from the top, over the page's vertical fade. */
  --grad:
    radial-gradient(140% 55% at 50% 0%, oklch(0.86 calc(0.09 * var(--k)) var(--h) / 0.55) 0%, transparent 72%),
    linear-gradient(180deg, oklch(0.93 calc(0.05 * var(--k)) var(--h)) 0%, oklch(0.97 calc(0.02 * var(--k)) var(--h)) 40%, oklch(0.99 calc(0.006 * var(--k)) var(--h)) 100%);
}

/* ---------- Dark mode ---------- */
/* Dark: chosen, or "Systeem" on a device set to dark. Both blocks are the same tokens. */
body[data-appearance="dark"] {
  --text: oklch(0.93 calc(0.035 * var(--k)) var(--h));
  --muted: oklch(0.7 calc(0.05 * var(--k)) var(--h));
  --hair: oklch(0.93 calc(0.035 * var(--k)) var(--h) / 0.08);
  --ringc: oklch(0.93 calc(0.035 * var(--k)) var(--h) / 0.4);
  --track: oklch(0.93 calc(0.035 * var(--k)) var(--h) / 0.09);
  --doneName: oklch(0.52 calc(0.04 * var(--k)) var(--h));
  --card: oklch(0.93 calc(0.035 * var(--k)) var(--h) / 0.06);
  --cardShadow: none;
  --mix: oklch(0.16 calc(0.03 * var(--k)) var(--h));
  --seg: oklch(0.93 calc(0.035 * var(--k)) var(--h) / 0.08);
  --segOn: oklch(0.93 calc(0.035 * var(--k)) var(--h) / 0.16);
  --nav: oklch(0.2 calc(0.035 * var(--k)) var(--h) / 0.9);
  --navShadow: inset 0 0 0 1px oklch(0.93 calc(0.035 * var(--k)) var(--h) / 0.06);
  --navOn: var(--accA);
  --navOff: oklch(0.58 calc(0.04 * var(--k)) var(--h));
  --fabFg: oklch(0.16 calc(0.03 * var(--k)) var(--h));
  --accent: var(--accA);
  --bgRing: oklch(0.2 calc(0.03 * var(--k)) var(--h));
  --catInk: 100%;
  --catBg: 16%;
  --pageEnd: oklch(0.13 calc(0.02 * var(--k)) var(--h));
  /* A warm glow from the top, over a fade that ends deep brown rather than black. */
  --grad:
    radial-gradient(140% 55% at 50% 0%, oklch(0.42 calc(0.11 * var(--k)) var(--h) / 0.6) 0%, transparent 72%),
    linear-gradient(180deg, oklch(0.27 calc(0.065 * var(--k)) var(--h)) 0%, oklch(0.17 calc(0.038 * var(--k)) var(--h)) 50%, oklch(0.13 calc(0.02 * var(--k)) var(--h)) 100%);
  --sheet: oklch(0.2 calc(0.03 * var(--k)) var(--h));
  /* Solid colour behind the Android status bar (see bridge/appearance_controller.js). */
  --top: oklch(0.36 calc(0.095 * var(--k)) var(--h));
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  body[data-appearance="system"] {
    --text: oklch(0.93 calc(0.035 * var(--k)) var(--h));
    --muted: oklch(0.7 calc(0.05 * var(--k)) var(--h));
    --hair: oklch(0.93 calc(0.035 * var(--k)) var(--h) / 0.08);
    --ringc: oklch(0.93 calc(0.035 * var(--k)) var(--h) / 0.4);
    --track: oklch(0.93 calc(0.035 * var(--k)) var(--h) / 0.09);
    --doneName: oklch(0.52 calc(0.04 * var(--k)) var(--h));
    --card: oklch(0.93 calc(0.035 * var(--k)) var(--h) / 0.06);
    --cardShadow: none;
    --mix: oklch(0.16 calc(0.03 * var(--k)) var(--h));
    --seg: oklch(0.93 calc(0.035 * var(--k)) var(--h) / 0.08);
    --segOn: oklch(0.93 calc(0.035 * var(--k)) var(--h) / 0.16);
    --nav: oklch(0.2 calc(0.035 * var(--k)) var(--h) / 0.9);
    --navShadow: inset 0 0 0 1px oklch(0.93 calc(0.035 * var(--k)) var(--h) / 0.06);
    --navOn: var(--accA);
    --navOff: oklch(0.58 calc(0.04 * var(--k)) var(--h));
    --fabFg: oklch(0.16 calc(0.03 * var(--k)) var(--h));
    --accent: var(--accA);
    --bgRing: oklch(0.2 calc(0.03 * var(--k)) var(--h));
    --catInk: 100%;
    --catBg: 16%;
    --pageEnd: oklch(0.13 calc(0.02 * var(--k)) var(--h));
    /* A warm glow from the top, over a fade that ends deep brown rather than black. */
    --grad:
      radial-gradient(140% 55% at 50% 0%, oklch(0.42 calc(0.11 * var(--k)) var(--h) / 0.6) 0%, transparent 72%),
      linear-gradient(180deg, oklch(0.27 calc(0.065 * var(--k)) var(--h)) 0%, oklch(0.17 calc(0.038 * var(--k)) var(--h)) 50%, oklch(0.13 calc(0.02 * var(--k)) var(--h)) 100%);
    --sheet: oklch(0.2 calc(0.03 * var(--k)) var(--h));
    /* Solid colour behind the Android status bar (see bridge/appearance_controller.js). */
    --top: oklch(0.36 calc(0.095 * var(--k)) var(--h));
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
/* No rubber band past the page edge: the overscroll area would show the plain page
   colour (near black) instead of the gradient. Also keeps the app's nav from flexing. */
html, body { overscroll-behavior: none; }
body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--pageEnd);
  background-image: var(--grad);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Outfit", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font-family: "Outfit", sans-serif; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
form { margin: 0; }
h1, h2, p { margin: 0; }
.scr, .strip, .cats { scrollbar-width: none; }
.scr::-webkit-scrollbar, .strip::-webkit-scrollbar, .cats::-webkit-scrollbar { width: 0; height: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.grad-text { background: linear-gradient(90deg, var(--accB), var(--accA)); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 600; }

@keyframes gl-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes gl-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes gl-strip { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.gloed-shell {
  max-width: 412px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(18px + env(safe-area-inset-top)) 20px calc(120px + env(safe-area-inset-bottom));
  animation: gl-in .25s ease both;
}

.page-title { font-size: 26px; font-weight: 600; margin-top: 6px; }
.page-sub { font-size: 14px; color: var(--muted); margin-top: 2px; }

.flash {
  position: fixed; z-index: 50; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  width: min(380px, calc(100% - 32px)); padding: 12px 16px; border-radius: 16px;
  background: var(--nav); box-shadow: var(--navShadow); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  font-size: 14px; animation: gl-in .25s ease both;
}

/* ---------- Bottom navigation ---------- */
/* Content scrolls under the nav; this fades it into the page's bottom colour so it
   recedes instead of showing sharply around and below the bar. */
.nav-fade {
  position: fixed; z-index: 9; left: 0; right: 0; bottom: 0; pointer-events: none;
  height: calc(118px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, color-mix(in srgb, var(--pageEnd) 0%, transparent) 0%, color-mix(in srgb, var(--pageEnd) 85%, transparent) 55%, var(--pageEnd) 100%);
}
.bottom-nav {
  position: fixed; z-index: 10;
  left: max(16px, calc(50% - 190px)); right: max(16px, calc(50% - 190px));
  bottom: calc(16px + env(safe-area-inset-bottom));
  height: 68px; border-radius: 34px;
  background: var(--nav); box-shadow: var(--navShadow);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: grid; grid-template-columns: 1fr 1fr 76px 1fr 1fr; align-items: center;
}
.nav-item {
  position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--navOff); transition: color .15s;
}
.nav-item i { font-size: 22px; }
.nav-item span { font-size: 10.5px; font-weight: 500; }
.nav-item::after { content: ""; position: absolute; bottom: 7px; width: 4px; height: 4px; border-radius: 50%; background: var(--navOn); opacity: 0; }
.nav-item.on { color: var(--navOn); }
.nav-item.on::after { opacity: 1; }
.nav-fab { display: flex; justify-content: center; }
.nav-fab a { width: 50px; height: 50px; border-radius: 18px; background: var(--text); color: var(--fabFg); display: flex; align-items: center; justify-content: center; }
.nav-fab i { font-size: 22px; }

/* ---------- Today ---------- */
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: none; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.icon-btn i { font-size: 17px; }
.day-title { display: block; border: none; background: transparent; color: var(--text); text-align: center; padding: 4px 10px; }
.day-title h1 { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 22px; font-weight: 600; }
.day-title h1 i { font-size: 14px; color: var(--muted); transition: transform .2s; }
.strip-open .day-title h1 i { transform: rotate(180deg); }
.day-title span { display: block; font-size: 14px; color: var(--muted); margin-top: 2px; }

.strip { display: none; }
.strip-open .strip { position: relative; display: flex; gap: 6px; overflow-x: auto; margin: 18px -20px 0; padding: 0 20px; }
.strip-anim .strip { animation: gl-strip .2s ease both; }
/* Frame updates (another day) swap content in place; replaying the page entrance there reads as a glitch. */
turbo-frame .gloed-shell { animation: none; }
.strip a { flex: none; width: 50px; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 0 9px; border-radius: 25px; color: var(--muted); transition: background .15s; }
.strip a.on { background: var(--segOn); color: var(--text); }
.strip .wd { font-size: 11.5px; opacity: .75; }
.strip .num { font-size: 16px; font-weight: 600; }
.strip a.today:not(.on) .num { color: var(--accent); }
.strip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--track); }
.strip .dot.part { background: color-mix(in srgb, var(--acc) 45%, transparent); }
.strip .dot.full { background: var(--acc); }

.ring { position: relative; width: 188px; height: 188px; margin: 26px auto 30px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-label b { font-size: 46px; font-weight: 300; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.ring-label span { font-size: 14px; color: var(--muted); margin-top: 6px; }

.zen { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 30px 0 34px; animation: gl-in .5s ease both; }
.zen-art { position: relative; width: 200px; height: 200px; display: flex; align-items: center; justify-content: center; }
.zen-art::before { content: ""; position: absolute; inset: -10px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--acc) 30%, transparent) 0%, transparent 66%); }
.zen-art svg { position: relative; width: 132px; height: 132px; }
.zen h2 { font-size: 24px; font-weight: 500; letter-spacing: -0.01em; margin-top: 8px; }
.zen p { font-size: 15px; color: var(--muted); margin-top: 6px; }

.habits-list .done-hidden, .habits-stack .done-hidden { display: none; }
.today:has(#peek:checked) .done-hidden { display: block; }
.habit-btn { width: 100%; border: none; font-family: "Outfit", sans-serif; color: var(--text); text-align: left; }

/* List view */
.row { display: flex; align-items: center; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--hair); background: transparent; }
.row .check { position: relative; width: 28px; height: 28px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; transition: background-color .3s ease; }
.row .check svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.row .check .check-track { fill: transparent; stroke: var(--ringc); stroke-width: 1.5; transition: fill .3s ease, stroke .3s ease; }
.row .check .check-arc { fill: none; stroke: var(--acc); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 100; opacity: 0; transition: stroke-dashoffset .5s cubic-bezier(.3, .7, .3, 1), opacity .2s; }
.row .check.started .check-track { fill: color-mix(in srgb, var(--acc) 14%, transparent); stroke: color-mix(in srgb, var(--acc) 35%, transparent); }
.row .check.started .check-arc { opacity: 1; }
.row .check i { position: relative; }
.row .check i { font-size: 13px; color: #fff; opacity: 0; }
.row.done .check { background: var(--acc); }
.row.done .check svg { opacity: 0; transition: opacity .3s ease; }
.row.done .check i { opacity: 1; }
.habit-main { flex: 1; min-width: 0; }
.habit-name { font-size: 17px; }
.done .habit-name { color: var(--doneName); text-decoration: line-through; }
.row .habit-slot { font-size: 13px; color: var(--muted); margin-top: 2px; }
.row .count { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Cards and tint views */
.habits-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.card-row { position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; padding: 16px 16px 18px; border-radius: 20px; background: var(--card); box-shadow: var(--cardShadow); transition: opacity .2s; }
.card-row.done { opacity: .55; }
.card-row > i { font-size: 26px; color: var(--c); flex: none; }
.card-row .habit-slot { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.card-row .tally { text-align: right; flex: none; }
.card-row .tally b { display: block; font-size: 18px; font-weight: 600; color: var(--c); font-variant-numeric: tabular-nums; }
.card-row .tally span { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.card-row .bar { position: absolute; left: 0; bottom: 0; height: 3px; width: var(--p); background: var(--c); border-radius: 0 2px 2px 0; transition: width .3s; }

.tint-row { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 22px; background: color-mix(in srgb, var(--c) 15%, var(--mix)); transition: background .2s; }
.tint-row.done { background: color-mix(in srgb, var(--c) 30%, var(--mix)); }
.tint-row .tint-icon { width: 42px; height: 42px; border-radius: 50%; background: var(--c); display: flex; align-items: center; justify-content: center; flex: none; }
.tint-row .tint-icon i { font-size: 20px; color: #fff; }
.tint-row .habit-name { font-size: 16px; font-weight: 600; }
.tint-row.done .habit-name { color: var(--text); text-decoration: none; }
.tint-row .habit-slot { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.tint-check { flex: none; min-width: 42px; height: 42px; box-sizing: border-box; border-radius: 21px; display: flex; align-items: center; justify-content: center; gap: 4px; border: 2px solid var(--c); color: var(--c); }
.tint-check.multi { padding: 0 10px; }
.tint-check i { font-size: 16px; }
.tint-check span { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tint-row.done .tint-check { background: var(--c); color: #fff; border: none; }

/* Weekly habits: "Deze week", one pip per day needed (and extra days beyond it). */
.week-head { font-size: 14px; color: var(--muted); margin: 28px 0 2px; }
.pips { display: flex; gap: 5px; flex: none; }
.pips span { width: 9px; height: 9px; border-radius: 50%; background: var(--track); transition: background .2s; }
.pips span.on { background: var(--acc); }
.pips span.extra { background: var(--accB); }
/* Cards and Kleur colour their pips like the rest of the habit. */
.card-row .pips span.on, .tint-row .pips span.on { background: var(--c); }
.card-row .pips span.extra, .tint-row .pips span.extra { background: color-mix(in srgb, var(--c) 60%, var(--text)); }
.tint-row .pips span:not(.on, .extra) { background: color-mix(in srgb, var(--c) 30%, var(--mix)); }

.peek { display: flex; justify-content: center; margin-top: 18px; }
.peek label { display: flex; align-items: center; gap: 8px; background: var(--seg); color: var(--muted); font-size: 14px; padding: 10px 16px; border-radius: 20px; cursor: pointer; }
.peek label i { font-size: 16px; }
.peek input { display: none; }
.peek label span { display: contents; }
.peek .when-open, .today:has(#peek:checked) .peek .when-closed { display: none; }
.today:has(#peek:checked) .peek .when-open { display: contents; }

.empty { text-align: center; color: var(--muted); font-size: 15px; padding: 10px 0; }

/* ---------- Overview ---------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 140px; margin: 26px 0 8px; }
.bars > button { border: none; background: transparent; padding: 0; color: inherit; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; height: 100%; }
.bars i { width: 100%; max-width: 30px; border-radius: 8px; background: color-mix(in srgb, var(--acc) 55%, transparent); transition: height .3s; }
.bars span { font-size: 12.5px; color: var(--muted); }
/* The highlight fades in and out (a gradient cannot transition, its opacity can). */
.bars i { position: relative; overflow: hidden; }
.bars i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, var(--accA), var(--accB)); opacity: 0; transition: opacity .35s ease; }
.bars .on i::after { opacity: 1; }
.bars span { transition: color .3s ease; }
.bars .on span { color: var(--text); font-weight: 600; }
.per-habit .unit { font-weight: 400; font-size: 13px; }
.section-title { font-size: 16px; font-weight: 600; margin: 34px 0 4px; }
.per-habit { padding: 14px 0; border-bottom: 1px solid var(--hair); }
.per-habit > div:first-child { display: flex; align-items: baseline; gap: 10px; }
.per-habit .name { flex: 1; min-width: 0; font-size: 16px; }
.per-habit .pct { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.per-habit .track { height: 5px; border-radius: 3px; background: var(--track); margin-top: 10px; overflow: hidden; }
.per-habit .track i { display: block; height: 100%; border-radius: 3px; background: var(--c); }

/* ---------- Widgets ---------- */
.widget-card { background: var(--card); box-shadow: var(--cardShadow); border-radius: 24px; }
.quick { padding: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick-btn { display: flex; align-items: center; gap: 10px; padding: 13px 12px; border-radius: 16px; min-height: 62px; background: var(--seg); }
.quick-btn.done { background: color-mix(in srgb, var(--c) 26%, var(--mix)); }
.quick-btn .dot-icon { width: 30px; height: 30px; border-radius: 50%; background: var(--c); display: flex; align-items: center; justify-content: center; flex: none; }
.quick-btn .dot-icon i { font-size: 15px; color: #fff; }
.quick-btn span { font-size: 14px; font-weight: 500; line-height: 1.2; }
.widget-caption { display: flex; align-items: center; justify-content: space-between; margin: 12px 4px 30px; }
.widget-caption span { font-size: 14px; color: var(--muted); }
.pill-btn { border: none; background: var(--seg); color: var(--text); font-size: 14px; font-weight: 500; padding: 9px 16px; border-radius: 18px; }
.status { padding: 10px 18px; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; }
.status-row .name { flex: 1; min-width: 0; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-row .cells { display: flex; gap: 4px; flex: none; }
.status-row .cells i { width: 18px; height: 18px; border-radius: 5px; background: color-mix(in srgb, var(--c) 16%, var(--mix)); }
.status-row .cells i.part { background: color-mix(in srgb, var(--c) 40%, var(--mix)); }
.status-row .cells i.full { background: var(--c); }
.status-row .cells i.off { background: transparent; box-shadow: inset 0 0 0 1.5px var(--track); }
.popover { margin: auto; border: none; border-radius: 20px; padding: 18px 20px; max-width: 300px; background: var(--mix); color: var(--text); box-shadow: 0 10px 40px rgba(0, 0, 0, .35); font-size: 15px; line-height: 1.45; text-align: center; }
.popover::backdrop { background: rgba(0, 0, 0, .35); }

/* ---------- Settings ---------- */
.settings-card { display: block; background: var(--card); box-shadow: var(--cardShadow); border-radius: 22px; padding: 4px 18px; margin-top: 22px; }
.manage-card { padding-top: 0; padding-bottom: 0; }
.manage-card + .settings-card { margin-top: 14px; }
.manage-card .count { font-size: 16px; font-variant-numeric: tabular-nums; }
.set-row { display: flex; align-items: center; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--hair); width: 100%; background: transparent; border-top: 0; border-left: 0; border-right: 0; color: var(--text); text-align: left; font-size: 16px; }
.set-row:last-child { border-bottom: none; }
.set-row > i:first-child { font-size: 22px; color: var(--muted); }
.set-row .label { flex: 1; min-width: 0; font-size: 16px; }
.set-row .label small { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.set-row .caret { font-size: 17px; color: var(--muted); }
.set-block { padding: 15px 0; border-bottom: 1px solid var(--hair); }
.set-block .set-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; font-size: 16px; }
.set-block .set-head i { font-size: 22px; color: var(--muted); }
.switch { width: 46px; height: 28px; border-radius: 14px; border: none; position: relative; flex: none; padding: 0; background: var(--track); transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch.on { background: var(--acc); }
.switch.on::after { left: 21px; }
.themes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.theme-opt { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0 10px; border-radius: 16px; border: none; background: transparent; color: var(--text); font-size: 13px; }
.theme-opt.on { background: var(--segOn); box-shadow: inset 0 0 0 1px var(--hair); }
.theme-opt .swatch { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(145deg, var(--sA), var(--sB)); }
.theme-opt .logo-tile { width: 40px; height: 40px; border-radius: 11px; }
.theme-opt.on .logo-tile { box-shadow: 0 0 0 3px var(--bgRing), 0 0 0 5px var(--acc); }
.theme-opt.on .swatch { box-shadow: 0 0 0 3px var(--bgRing), 0 0 0 5px var(--s); }
.segmented { display: flex; gap: 3px; background: var(--seg); border-radius: 12px; padding: 3px; }
.segmented form { flex: 1; }
.segmented button { width: 100%; height: 38px; border: none; border-radius: 9px; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 14px; font-weight: 500; background: transparent; color: var(--muted); }
.segmented button.on { background: var(--segOn); color: var(--text); }
.segmented i { font-size: 15px; }

/* ---------- Full-screen flows (new habit, onboarding) ---------- */
.flow {
  max-width: 412px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
  animation: gl-fade .2s ease both;
}
.flow form { flex: 1; display: flex; flex-direction: column; }
.flow-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 0; }
.flow-top .icon-btn { color: var(--text); }
.flow-top .icon-btn i { font-size: 20px; }
.flow-top .spacer { width: 44px; }
.dots { display: flex; gap: 6px; }
.dots span { height: 6px; width: 6px; border-radius: 3px; background: var(--track); transition: all .25s; }
.dots span.past { background: var(--text); }
.dots span.on { width: 22px; background: var(--text); }
.flow h2 { font-size: 26px; font-weight: 400; line-height: 1.3; letter-spacing: -0.015em; text-align: center; text-wrap: pretty; }
.step { flex: 1; display: flex; flex-direction: column; animation: gl-in .3s ease both; }
.step-cat { justify-content: center; gap: 30px; padding-bottom: 80px; }
.cats { display: flex; gap: 12px; overflow-x: auto; padding: 4px 28px; scroll-snap-type: x mandatory; scroll-padding: 0 28px; }
.cat { flex: none; scroll-snap-align: start; width: 150px; height: 130px; border-radius: 26px; border: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; transition: transform .15s, box-shadow .15s; color: color-mix(in srgb, var(--c) var(--catInk), var(--text)); background: color-mix(in srgb, var(--c) var(--catBg), var(--mix)); }
.cat.picked { box-shadow: inset 0 0 0 2px var(--c); transform: scale(0.97); }
.cat i { font-size: 36px; }
.cat span { font-size: 18px; font-weight: 500; }
.hint { text-align: center; font-size: 14px; color: var(--muted); }
.step-name { padding: 34px 28px 0; }
.badge-wrap { display: flex; justify-content: center; margin-bottom: 20px; }
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 18px; font-size: 14px; font-weight: 500; color: color-mix(in srgb, var(--c) var(--catInk), var(--text)); background: color-mix(in srgb, var(--c) 16%, var(--mix)); }
.badge i { font-size: 16px; }
.name-input { margin-top: 28px; width: 100%; padding: 17px 18px; border-radius: 18px; border: none; outline: none; background: var(--seg); color: var(--text); font-size: 18px; }
.name-input::placeholder { color: var(--muted); opacity: .7; }
.name-count { text-align: right; font-size: 13px; color: var(--muted); margin: 8px 4px 0; font-variant-numeric: tabular-nums; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.chips button { border: none; background: transparent; box-shadow: inset 0 0 0 1px var(--hair); color: var(--text); font-size: 14px; padding: 9px 14px; border-radius: 18px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.round-btn { width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--seg); color: var(--text); display: flex; align-items: center; justify-content: center; }
.round-btn i { font-size: 15px; }
.stepper output { min-width: 34px; text-align: center; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.grow { flex: 1; }
.next-wrap { display: flex; justify-content: center; padding-bottom: 44px; }
.next-btn { width: 60px; height: 60px; border-radius: 50%; border: none; display: flex; align-items: center; justify-content: center; background: var(--seg); color: var(--muted); cursor: default; transition: opacity .2s; }
.next-btn.ready { background: var(--text); color: var(--fabFg); cursor: pointer; }
.next-btn i { font-size: 20px; }
.step-rem { align-items: center; padding: 30px 28px 0; }
.bell { position: relative; width: 96px; height: 96px; display: flex; align-items: center; justify-content: center; margin-bottom: 22px; }
.bell::before { content: ""; position: absolute; inset: -18px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--acc) 26%, transparent) 0%, rgba(232, 145, 58, 0) 66%); }
.bell i { position: relative; font-size: 52px; color: var(--acc); }
.step-rem p { font-size: 15px; color: var(--muted); text-align: center; margin-top: 12px; line-height: 1.45; text-wrap: pretty; }
.step-rem p b { color: var(--text); font-weight: 400; }
.wheel { display: flex; align-items: center; gap: 10px; margin-top: 34px; }
.wheel-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wheel-col button { border: none; background: transparent; font-size: 26px; font-weight: 300; color: var(--muted); opacity: .6; padding: 6px 0; font-variant-numeric: tabular-nums; }
.wheel-col output { width: 92px; padding: 12px 0; border-radius: 20px; background: color-mix(in srgb, var(--acc) 18%, transparent); text-align: center; font-size: 40px; font-weight: 400; font-variant-numeric: tabular-nums; }
.primary { width: 100%; height: 56px; border-radius: 28px; border: none; background: var(--text); color: var(--fabFg); font-size: 17px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 10px; }
.text-link { margin: 14px 0 36px; border: none; background: transparent; font-size: 15px; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; padding: 8px; }

/* Onboarding */
.splash { flex: 1; border: none; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text); padding: 0 0 40px; animation: gl-fade .6s ease both; }
.glow { position: relative; display: flex; align-items: center; justify-content: center; }
.splash .glow { width: 200px; height: 200px; }
.glow::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--acc) 32%, transparent) 0%, rgba(232, 145, 58, 0) 68%); }
.glow svg { position: relative; }
.splash .glow svg { width: 120px; height: 120px; }
.splash strong { font-size: 20px; font-weight: 500; letter-spacing: -0.01em; }
.onb-top { display: flex; justify-content: flex-end; padding: 14px 18px 0; }
.onb-top button { border: none; background: transparent; font-size: 15px; color: var(--muted); padding: 10px 6px; }
.onb-body { flex: 1; display: flex; flex-direction: column; padding: 0 28px; min-height: 0; }
.onb-step { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 34px; animation: gl-in .35s ease both; }
.onb-step h2 { font-size: 28px; color: var(--muted); text-align: left; }
.onb-enso { width: 132px; height: 132px; }
.onb-enso::before { inset: -20px; background: radial-gradient(circle, color-mix(in srgb, var(--acc) 24%, transparent) 0%, rgba(232, 145, 58, 0) 66%); }
.onb-enso svg { width: 104px; height: 104px; }
.onb-stack { position: relative; height: 236px; }
.onb-stack .mini { position: absolute; height: 60px; border-radius: 20px; background: color-mix(in srgb, var(--c) 20%, var(--mix)); display: flex; align-items: flex-start; gap: 10px; padding: 13px 16px; font-size: 15.5px; }
.onb-stack .mini .ic { width: 26px; height: 26px; border-radius: 8px; background: var(--c); display: flex; align-items: center; justify-content: center; }
.onb-stack .mini .ic i { font-size: 15px; color: #fff; }
.onb-stack .front { position: absolute; top: 78px; left: 0; right: 0; border-radius: 24px; background: color-mix(in srgb, #ff8a5c 20%, var(--mix)); padding: 16px 16px 18px; box-shadow: 0 -6px 20px rgba(0, 0, 0, .12); }
.onb-stack .front-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.onb-stack .front-head .ic { width: 40px; height: 40px; border-radius: 12px; background: #ff8a5c; display: flex; align-items: center; justify-content: center; }
.onb-stack .front-head .ic i { font-size: 22px; color: #fff; }
.onb-stack .front-head b { display: block; font-size: 17px; font-weight: 500; }
.onb-stack .front-head span { font-size: 13px; color: var(--muted); }
.onb-days { display: flex; justify-content: space-between; }
.onb-days > div { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.onb-days span { font-size: 11.5px; color: var(--muted); }
.onb-days b { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 400; border: 1.5px solid var(--ringc); color: var(--muted); }
.onb-days b.full { background: #ff8a5c; color: #fff; border-color: #ff8a5c; }
.onb-days b.now { border-color: #ff8a5c; color: var(--text); }
.onb-grids { display: flex; flex-direction: column; gap: 10px; }
.onb-grid { border-radius: 18px; padding: 12px 14px 14px; background: var(--card); box-shadow: var(--cardShadow); }
.onb-grid-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; font-size: 14px; }
.onb-grid-head .ic { width: 22px; height: 22px; border-radius: 7px; background: var(--c); display: flex; align-items: center; justify-content: center; }
.onb-grid-head .ic i { font-size: 12px; color: #fff; }
.onb-cells { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; }
.onb-cells i { aspect-ratio: 1; border-radius: 3px; background: color-mix(in srgb, var(--c) 14%, var(--mix)); }
.onb-cells i.on { background: var(--c); }
.onb-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 28px 40px; }
.onb-next { width: 56px; height: 56px; border-radius: 50%; border: none; background: var(--text); color: var(--fabFg); display: flex; align-items: center; justify-content: center; }
.onb-next i { font-size: 20px; }
.onb-begin { width: auto; padding: 0 26px; }
.onb-begin i { font-size: 17px; }

/* ---------- Auth ---------- */
.auth-page { min-height: 100dvh; animation: gl-fade .3s ease both; }
.auth-panel { padding: calc(64px + env(safe-area-inset-top)) 28px 40px; }
.auth { display: block; width: 100%; max-width: 380px; margin: 0 auto; }
.auth > * { animation: gl-fade .2s ease both; }
.auth-logo svg { width: 56px; height: 56px; display: block; margin-bottom: 26px; }
.auth-title { font-size: 30px; font-weight: 500; letter-spacing: -0.015em; line-height: 1.2; }
.auth-sub { font-size: 15px; color: var(--muted); margin-top: 8px; line-height: 1.45; }
.auth-tabs { margin-top: 26px; }
.auth-tabs a { flex: 1; height: 40px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 14.5px; font-weight: 500; color: var(--muted); }
.auth-tabs a.on { background: var(--segOn); color: var(--text); }
.auth-form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.auth .field { display: flex; flex-direction: column; gap: 6px; }
.auth .field > span { font-size: 13px; color: var(--muted); }
.auth .field input { height: 52px; width: 100%; padding: 0 16px; border-radius: 16px; border: none; outline: none; background: var(--seg); color: var(--text); font-size: 16px; -webkit-user-select: text; user-select: text; }
.auth .field input:focus { box-shadow: inset 0 0 0 1.5px var(--acc); }
.reveal { position: relative; }
.reveal input { padding-right: 52px !important; }
.reveal button { position: absolute; right: 4px; top: 4px; width: 44px; height: 44px; border-radius: 50%; border: none; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.reveal button i { font-size: 19px; }
.auth-forgot { display: flex; justify-content: flex-end; margin-top: -4px; }
.auth-forgot a { color: var(--accent); font-size: 14px; padding: 6px 0; }
.auth-error { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: #ff4f7b; }
.auth-error i { font-size: 16px; }
.auth-form .primary { margin-top: 8px; height: 54px; border-radius: 27px; font-size: 16.5px; cursor: pointer; }
.auth-back { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; padding: 6px 0; color: var(--muted); font-size: 14.5px; }
.auth-back i { font-size: 13px; }
.auth-terms { font-size: 12.5px; color: var(--muted); margin-top: 16px; line-height: 1.45; text-align: center; }
.auth-sent { display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; background: color-mix(in srgb, var(--acc) 18%, transparent); margin-top: 26px; }
.auth-sent i { font-size: 30px; color: var(--acc); }

.onb-step-days h2 { font-weight: 500; }

/* ---------- Habits list (Gewoontes beheren) ---------- */
.gloed-shell.no-nav { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -8px; }
.page-head .icon-btn { color: var(--text); }
.page-head .icon-btn i { font-size: 20px; }
.page-head h1 { font-size: 22px; font-weight: 600; }
.page-head .spacer { width: 44px; }
.page-intro { font-size: 15px; line-height: 1.45; color: var(--muted); margin: 22px 0 8px; }
.manage-list { margin: 0 -9px; }
.manage-row { display: flex; align-items: center; gap: 4px; padding: 0 9px 0 0; border-bottom: 1px solid var(--hair); background: transparent; transition: background .15s, box-shadow .15s; touch-action: pan-y; }
.manage-row.dragging { position: relative; z-index: 2; background: var(--mix); border-radius: 16px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
.manage-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 15px 0; }
.manage-icon { width: 34px; height: 34px; border-radius: 50%; background: var(--c); display: flex; align-items: center; justify-content: center; flex: none; }
.manage-icon i { font-size: 17px; color: #fff; }
.manage-main .habit-slot { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.grip { width: 40px; height: 48px; flex: none; border: none; background: transparent; color: var(--muted); opacity: .7; display: flex; align-items: center; justify-content: center; touch-action: none; cursor: grab; transition: opacity .15s, color .15s; }
.grip i { font-size: 20px; }
.grip:hover, .dragging .grip { opacity: 1; color: var(--text); }
.dragging .grip { cursor: grabbing; }
.wide-btn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 46px; margin-top: 20px; border-radius: 23px; background: var(--seg); color: var(--text); font-size: 16px; font-weight: 500; }
.wide-btn i { font-size: 17px; }

/* ---------- Edit sheet ---------- */
body { --sheet: oklch(0.985 calc(0.01 * var(--k)) var(--h)); }
body.sheet-lock { overflow: hidden; }
.habit-btn { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.sheet-layer { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); animation: gl-fade .2s ease both; }
.sheet {
  position: relative; width: 100%; max-width: 412px; max-height: 92dvh; overflow-y: auto;
  background: var(--sheet); border-radius: 28px 28px 0 0;
  padding: 10px 22px calc(24px + env(safe-area-inset-bottom));
  animation: gl-sheet .28s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes gl-sheet { from { transform: translateY(100%); } to { transform: none; } }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--track); margin: 0 auto 16px; }
.sheet-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.sheet-head h2 { flex: 1; font-size: 20px; font-weight: 600; text-align: left; }
.sheet-title { flex: 1; min-width: 0; }
.sheet-title h2 { font-size: 19px; }
.sheet-streak { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); margin-top: 3px; }
.sheet-streak i { font-size: 14px; color: var(--track); }
.sheet-streak.on i { color: var(--acc); }
.sheet-actions { display: flex; flex-direction: column; }
.sheet-actions .primary { margin-top: 26px; height: 54px; }
.sheet-actions .danger-link { margin-top: 8px; height: 48px; font-size: 15px; }
.sheet-actions .secondary { display: none; }
@media (max-width: 1023px) { .sheet-actions > .danger-link:first-child { margin-top: 22px; } }
.sheet-confirm { padding: 22px 0 4px; animation: gl-in .2s ease both; }
.sheet-confirm[hidden] { display: none; }
.sheet-confirm h3 { font-size: 22px; font-weight: 500; line-height: 1.3; }
.sheet-confirm p { font-size: 15px; color: var(--muted); margin-top: 8px; line-height: 1.45; }
.sheet-confirm .sheet-delete .primary { width: 100%; margin-top: 26px; }
.sheet-confirm .secondary { display: block; margin-top: 8px; height: 48px; border: none; background: transparent; color: var(--muted); font-size: 15px; cursor: pointer; }
.sheet-head .icon-btn { color: var(--muted); margin-right: -10px; }
.sheet-head .icon-btn i { font-size: 20px; }
.sheet-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--c); display: flex; align-items: center; justify-content: center; transition: background .2s; }
.sheet-icon i { font-size: 18px; color: #fff; }
.sheet .name-input { margin-top: 0; font-size: 17px; }
.sheet-row { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }
.sheet-row .label, .sheet-label { font-size: 16px; }
.sheet-label { margin: 22px 0 10px; }
.segmented.choice label { flex: 1; }
.segmented.choice input { position: absolute; opacity: 0; pointer-events: none; }
.segmented.choice span { display: flex; align-items: center; justify-content: center; height: 36px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--muted); cursor: pointer; }
.segmented.choice input:checked + span { background: var(--segOn); color: var(--text); }
.segmented.choice input:focus-visible + span { outline: 2px solid var(--acc); }

/* Frequency (habits/_frequency): the chosen radio shows its own parts. */
.freq > .segmented { margin-top: 22px; }
.freq .segmented.choice span { font-size: 13.5px; }
.day-chips { display: none; justify-content: space-between; gap: 6px; margin-top: 14px; }
.freq:has(input[value="days"]:checked) .day-chips { display: flex; }
.day-chips label { position: relative; }
.day-chips input { position: absolute; opacity: 0; pointer-events: none; }
.day-chips span { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 500; background: var(--seg); color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.day-chips input:checked + span { background: var(--text); color: var(--fabFg); }
.day-chips input:focus-visible + span { outline: 2px solid var(--acc); }
.freq-target { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.freq-target .label { font-size: 16px; }
.freq-target .label small { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.freq-target.weekly-target, .freq:has(input[value="week"]:checked) .daily-target { display: none; }
.freq:has(input[value="week"]:checked) .weekly-target { display: flex; }
.manual-row { display: flex; align-items: center; gap: 12px; margin-top: 20px; }
.manual-row .label { flex: 1; min-width: 0; font-size: 16px; }
.manual-row .label small { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.unit-input { display: none; margin-top: 12px; width: 100%; padding: 13px 16px; border-radius: 14px; border: none; outline: none; background: var(--seg); color: var(--text); font-size: 15px; animation: gl-in .2s ease both; }
.freq:has(.manual-row .switch-input:checked) .unit-input { display: block; }
.freq:has(input[value="week"]:checked) :is(.manual-row, .unit-input) { display: none; }
.swatches { display: flex; justify-content: space-between; padding: 4px; }
.swatches label { width: 30px; height: 30px; border-radius: 50%; background: var(--s); cursor: pointer; transition: box-shadow .15s; }
.swatches input { position: absolute; opacity: 0; pointer-events: none; }
.swatches label:has(input:checked) { box-shadow: 0 0 0 3px var(--sheet), 0 0 0 5px var(--s); }
.swatches label:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 6px; }
.sheet .primary { margin-top: 24px; cursor: pointer; }
.danger-link { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 14px; padding: 10px; border: none; background: transparent; color: #ff5f7e; font-size: 16px; font-weight: 500; }
.danger-link i { font-size: 18px; }
.switch-input { position: absolute; opacity: 0; pointer-events: none; }
label.switch { cursor: pointer; }
.switch-input:checked + .switch { background: var(--acc); }
.switch-input:checked + .switch::after { left: 21px; }
.switch-input:focus-visible + .switch { outline: 2px solid var(--text); outline-offset: 2px; }
.reminder-row { gap: 12px; margin-top: 22px; }
.reminder-row .label { flex: 1; }
.reminder-time { display: flex; align-items: center; gap: 2px; }
.reminder-time[hidden] { display: none; }
.reminder-time button { width: 36px; height: 36px; border-radius: 50%; border: none; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.reminder-time button i { font-size: 14px; }
.reminder-time output { font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; min-width: 50px; text-align: center; }

/* ---------- Widgets carousel ---------- */
.carousel { margin: 22px -20px 0; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; min-width: 0; box-sizing: border-box; padding: 0 20px; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; text-align: center; }
.slide h2 { font-size: 22px; font-weight: 500; margin: 8px 0 22px; }
.slide-preview { width: 100%; min-width: 0; min-height: 210px; display: flex; align-items: center; text-align: left; }
.slide-preview > * { width: 100%; }
.slide p { font-size: 15px; line-height: 1.45; color: var(--muted); margin: 24px 10px 0; text-wrap: pretty; }
.add-btn { margin-top: 22px; height: 44px; padding: 0 22px; border: none; border-radius: 22px; background: var(--text); color: var(--fabFg); font-size: 15px; font-weight: 500; }
.carousel-dots { justify-content: center; margin-top: 26px; }
.carousel-dots { gap: 0; }
.carousel-dots button { display: flex; align-items: center; justify-content: center; height: 24px; padding: 0 3px; border: none; background: transparent; }
.carousel-dots button::after { content: ""; width: 6px; height: 6px; border-radius: 3px; background: var(--track); transition: all .25s; }
.carousel-dots button.on::after { width: 22px; background: var(--text); }
.peek-toggle { display: none; }

/* ---------- Confirm dialog ---------- */
.confirm-dialog { width: min(320px, calc(100% - 48px)); margin: auto; padding: 22px 20px 16px; border: none; border-radius: 24px; background: var(--sheet); color: var(--text); box-shadow: 0 16px 48px rgba(0, 0, 0, .4); }
.confirm-dialog::backdrop { background: rgba(0, 0, 0, .55); }
.confirm-dialog[open] { animation: gl-in .2s ease both; }
.confirm-dialog p { font-size: 17px; font-weight: 500; text-align: center; line-height: 1.4; }
.confirm-actions { display: flex; gap: 10px; margin-top: 20px; }
.confirm-actions button { flex: 1; height: 46px; border: none; border-radius: 23px; font-size: 15px; font-weight: 500; }
.confirm-cancel { background: var(--seg); color: var(--text); }
.confirm-ok { background: #ff5f7e; color: #fff; }
.confirm-dialog.neutral .confirm-ok { background: var(--text); color: var(--fabFg); }

/* ---------- Raster widget (one habit, 20 weeks) ---------- */
.grid-preview { flex-direction: column; align-items: stretch; gap: 14px; }
.grid-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -20px; padding: 0 20px; scrollbar-width: none; }
.grid-chips button { flex: none; }
.grid-chips button { transition: background-color .2s, color .2s, box-shadow .2s, transform .14s cubic-bezier(.3, .7, .4, 1); }
.grid-chips button.on { background: var(--c); color: #fff; font-weight: 500; box-shadow: none; }
.grid-widget { padding: 14px 14px 16px; border-radius: 22px; }
.grid-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 15px; font-weight: 500; }
.grid-icon { width: 26px; height: 26px; border-radius: 8px; background: var(--c); display: flex; align-items: center; justify-content: center; }
.grid-icon i { font-size: 14px; color: #fff; }
.grid-cells { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; }
.grid-cells i { aspect-ratio: 1; border-radius: 3px; background: color-mix(in srgb, var(--c) 14%, var(--mix)); }
.grid-cells i.part { background: color-mix(in srgb, var(--c) 45%, var(--mix)); }
.grid-cells i.full { background: var(--c); }

/* ---------- Motion ---------- */
@keyframes check-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes gl-sheet-out { to { transform: translateY(100%); } }
@keyframes gl-fade-out { to { opacity: 0; } }

/* Press feedback on everything tappable. */
.habit-btn, .quick-btn, .round-btn, .nav-fab a, .primary, .pill-btn, .add-btn, .wide-btn, .cat, .theme-opt,
.next-btn, .onb-next, .chips button, .segmented button, .manage-main, .icon-btn, .strip a, .bars > button, .switch {
  transition: transform .14s cubic-bezier(.3, .7, .4, 1), background-color .2s, box-shadow .2s, opacity .2s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.habit-btn:active, .quick-btn:active, .round-btn:active, .nav-fab a:active, .primary:active, .pill-btn:active,
.add-btn:active, .wide-btn:active, .cat:active, .theme-opt:active, .next-btn.ready:active, .onb-next:active,
.chips button:active, .manage-main:active, .icon-btn:active, .strip a:active { transform: scale(.96); }
.habit-btn:active { transform: scale(.985); }

/* A habit that just got done pops its check; progress changes glide (morphed streams keep the elements). */
.row.done .check { animation: check-pop .32s cubic-bezier(.3, .7, .4, 1.4); }
.tint-row.done .tint-check { animation: check-pop .32s cubic-bezier(.3, .7, .4, 1.4); }
.row .check i { transition: opacity .2s; }
.row .habit-name, .card-row .habit-name { transition: color .25s; }
.quick-btn { transition: background-color .25s, transform .14s cubic-bezier(.3, .7, .4, 1); }
.status-row .cells i, .grid-cells i, .strip .dot { transition: background-color .3s; }
.per-habit .track i { transition: width .45s cubic-bezier(.3, .7, .4, 1); }
.bars i { transition: height .45s cubic-bezier(.3, .7, .4, 1), background-color .2s; }

/* Nav: the active tab lifts a little. */
.nav-item i { transition: transform .2s cubic-bezier(.3, .7, .4, 1.4); }
.nav-item.on i { transform: translateY(-1px) scale(1.06); }

/* Overview panels and the Raster preview cross-fade when switched. */
.grid-habit:not([hidden]) { animation: gl-fade .22s ease both; }
/* The Overview day detail folds open and shut (grid rows 0fr ↔ 1fr animate its height). */
.day-detail { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .4s cubic-bezier(.3, .7, .3, 1), opacity .3s ease; }
.day-detail > div { min-height: 0; overflow: hidden; }
.day-detail.open { grid-template-rows: 1fr; opacity: 1; }

/* Sheet and toast leave as smoothly as they arrive. */
.sheet-layer.closing .sheet { animation: gl-sheet-out .2s ease-in both; }
.sheet-layer.closing .sheet-backdrop { animation: gl-fade-out .2s ease both; }
.flash.leaving { animation: gl-fade-out .25s ease both; }

/* Dragging a habit lifts it. */
.manage-row.dragging { transform-origin: center; scale: 1.02; transition: scale .15s, box-shadow .15s; }

/* Android app: no rubber-band stretch that drags the fixed nav along with the page. */
/* In the Android app a screen change is native; a page fading in on top of it reads as a flash. */
body[data-native] .gloed-shell, body[data-native] .flow, body[data-native] .auth-page { animation: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Account (Settings, Over, delete) ---------- */
.settings-card + .settings-card { margin-top: 14px; }
.set-form { display: block; }
.set-form .set-row { cursor: pointer; font-family: "Outfit", sans-serif; }
.set-form:last-child .set-row { border-bottom: 1px solid var(--hair); }
.danger-row, .danger-row > i:first-child { color: #ff5f7e; }
.account-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.account-tiles .account-tile { margin: 0; padding: 14px 16px; display: flex; align-items: center; gap: 12px; color: var(--text); transition: transform .15s; }
.account-tile:active { transform: scale(.98); }
.account-tile > i { font-size: 22px; flex: none; }
.account-tile .label { font-size: 15.5px; font-weight: 500; line-height: 1.25; }
.account-tile .label small { display: block; margin-top: 3px; font-size: 13px; font-weight: 400; color: var(--muted); }
.account-tile.danger-row .label { color: #ff5f7e; }
.about-brand { display: flex; align-items: center; gap: 14px; }
.about-logo { width: 52px; height: 52px; border-radius: 14px; }
.about-brand strong { display: block; font-size: 18px; font-weight: 600; }
.about-brand span { font-size: 14px; color: var(--muted); }
.about-intro { font-size: 15px; color: var(--muted); margin: 14px 0 6px; line-height: 1.45; }
.about-list { margin: 8px 0 22px; }
.about-list > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--hair); font-size: 15px; }
.about-list dt { color: var(--muted); }
.about-list dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.sheet-text { font-size: 15px; color: var(--muted); line-height: 1.5; margin-bottom: 12px; }
.sheet-text a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.primary.danger { background: #ff5f7e; color: #fff; margin-top: 22px; cursor: pointer; }

/* ---------- Overzicht blocks ---------- */
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.title-row .page-title { margin-top: 0; }
.pill-btn.with-icon { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; font-size: 13.5px; flex: none; }
.pill-btn.with-icon i { font-size: 15px; }
.pill-btn.dark { background: var(--text); color: var(--fabFg); height: 46px; padding: 0 26px; border-radius: 23px; font-size: 15px; }
.ov-blocks { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.ov-card { background: var(--card); box-shadow: var(--cardShadow); border-radius: 22px; padding: 18px 20px 20px; min-width: 0; animation: gl-in .25s ease both; }
.ov-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ov-head h2 { font-size: 16px; font-weight: 600; }
.ov-head > span, .ov-head > a { font-size: 13px; color: var(--muted); white-space: nowrap; }
.ov-link { display: flex; align-items: center; gap: 4px; }
.ov-link i { font-size: 11px; }
.ov-card .bars { height: 130px; margin: 18px 0 0; }
.ov-card .day-detail .per-habit:last-child { border-bottom: none; }
.ov-sub { font-size: 14px; font-weight: 600; margin-top: 18px; }
.ov-note { font-size: 14px; margin-top: 14px; }
.bars.static > div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.bars.static small { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bars.static i { background: color-mix(in srgb, var(--acc) 45%, transparent); }
.ov-empty { padding: 40px 0; }

/* 7 dagen: one row per habit, a cell per day. */
.wk-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 0; color: var(--text); }
.wk-top { align-items: flex-end; margin-top: 16px; padding-bottom: 4px; }
.wk-name { flex: 1; min-width: 0; }
.wk-name div { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-name small { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-cells { display: flex; gap: 4px; flex: none; }
.wk-cells > div { width: 24px; flex: none; }
.wk-day { text-align: center; }
.wk-day small { display: block; font-size: 11px; color: var(--muted); }
.wk-day b { display: block; font-size: 13px; font-weight: 600; margin-top: 2px; }
.wk-day b.today { color: var(--accent); }
.wk-count { width: 34px; flex: none; text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wk-cell { aspect-ratio: 1; border-radius: 30%; display: flex; align-items: center; justify-content: center; background: var(--track); transition: background .2s; }
.wk-cell.f { background: var(--c); }
.wk-cell.p { background: color-mix(in srgb, var(--c) 35%, var(--mix)); }
.wk-cell.x { background: transparent; box-shadow: inset 0 0 0 1.5px var(--track); }
.wk-cell i { font-size: 11px; color: #fff; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 12px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; background: var(--track); }
.legend i.f { background: var(--acc); }
.legend i.p { background: color-mix(in srgb, var(--acc) 35%, var(--mix)); }
.legend i.x { background: transparent; box-shadow: inset 0 0 0 1.5px var(--track); }

/* Jaar: habit chips, month labels and the 53-week grid. */
.chips-scroll { display: flex; gap: 6px; overflow-x: auto; margin: 14px -20px 0; padding: 0 20px; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }
.habit-chip { flex: none; display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 17px; font-size: 13.5px; font-weight: 500; white-space: nowrap; background: var(--seg); color: var(--muted); transition: background .15s, color .15s; }
.habit-chip span { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.habit-chip.on { background: var(--text); color: var(--fabFg); }
.year-months { display: grid; grid-template-columns: repeat(53, minmax(0, 1fr)); gap: 2px; margin-top: 18px; font-size: 11px; color: var(--muted); height: 14px; }
.year-months div { white-space: nowrap; }
.year-grid { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; margin-top: 6px; }
.year-grid i { aspect-ratio: 1; border-radius: 2px; background: color-mix(in srgb, var(--c) 12%, var(--mix)); }
.year-grid i.p { background: color-mix(in srgb, var(--c) 45%, var(--mix)); }
.year-grid i.f { background: var(--c); }
.year-grid i.x { background: transparent; }
#year-block .year-grid { animation: gl-fade .22s ease both; }
.ov-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.ov-stats b { display: block; font-size: 26px; font-weight: 300; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.ov-stats span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 5px; }

/* Reeksen */
.streak-list { margin-top: 6px; }
.streak-row { display: block; padding: 12px 0; border-bottom: 1px solid var(--hair); color: var(--text); }
.streak-row:last-child { border-bottom: none; }
.streak-top, .streak-bottom { display: flex; align-items: center; gap: 10px; }
.streak-top .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.streak-top .name { flex: 1; min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.streak { display: flex; align-items: center; gap: 4px; font-size: 13.5px; }
.streak i { font-size: 14px; color: var(--track); }
.streak.on i { color: var(--acc); }
.streak-bottom { margin-top: 8px; }
.streak-bottom .track { flex: 1; height: 5px; border-radius: 3px; background: var(--track); overflow: hidden; }
.streak-bottom .track i { display: block; height: 100%; border-radius: 3px; background: var(--c); }
.streak-bottom span { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Habit detail ---------- */
.detail-head { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.detail-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--c); display: flex; align-items: center; justify-content: center; flex: none; }
.detail-icon i { font-size: 22px; color: #fff; }
.detail-head h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.detail-head p { font-size: 14px; color: var(--muted); margin-top: 2px; }
.detail-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 30px; }
.detail-stats b { display: block; font-size: 34px; font-weight: 300; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.detail-stats span { display: block; font-size: 13px; color: var(--muted); margin-top: 6px; }
.detail-best { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-top: 22px; }
.detail-best i { font-size: 17px; color: var(--acc); }
.detail .section-title { margin: 34px 0 12px; }
.detail .year-grid { grid-auto-columns: 1fr; margin-top: 0; }
.year-ends { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-top: 8px; }

/* ---------- Full-screen sheet (Overzicht aanpassen) ---------- */
.page-layer .sheet-backdrop { display: none; }
.page-sheet { position: fixed; inset: 0; max-width: none; max-height: none; border-radius: 0; background: var(--grad); background-color: var(--pageEnd); padding: calc(12px + env(safe-area-inset-top)) 20px calc(40px + env(safe-area-inset-bottom)); overflow-y: auto; animation: gl-fade .2s ease both; }
.page-sheet > * { max-width: 412px; margin-left: auto; margin-right: auto; }
.page-sheet .page-head h2 { font-size: 18px; font-weight: 600; white-space: nowrap; }
.page-sheet .page-head .close { visibility: hidden; }
.page-sheet .page-intro { margin-top: 14px; font-size: 14px; }
.page-layer.closing .page-sheet { animation: gl-fade-out .2s ease both; }
.block-row { min-height: 72px; gap: 12px; }
.block-icon { position: relative; width: 40px; height: 40px; border-radius: 12px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--seg); color: var(--muted); transition: background .2s, color .2s; }
.block-icon i { font-size: 19px; }
.block-icon .on, .block-row:has(.switch-input:checked) .block-icon .off { display: none; }
.block-row:has(.switch-input:checked) .block-icon .on { display: block; }
.block-row:has(.switch-input:checked) .block-icon { background: color-mix(in srgb, var(--acc) 18%, transparent); color: var(--acc); }
.block-row .habit-name { font-size: 16px; }
.block-row .habit-slot { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-foot { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 20px; }
.text-btn { height: 46px; padding: 0 18px; border-radius: 23px; border: none; background: transparent; color: var(--muted); font-size: 14.5px; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.text-btn i { font-size: 16px; }

/* Parts that only exist in one layout. */
.side-brand, .side-only { display: none; }
@media (max-width: 1023px) { .desktop-only { display: none !important; } }
@media (min-width: 1024px) { .mobile-only, .mobile-intro { display: none !important; } }

/* ---------- Instellingen groups ---------- */
.settings-group { display: contents; }
.group-title { display: none; font-size: 13px; color: var(--muted); padding: 12px 0 4px; }
.settings-groups .settings-group:not(:last-child) > :last-child { border-bottom: 1px solid var(--hair); }
.logout-form { margin-top: 18px; display: flex; justify-content: center; }
.logout-btn { height: 42px; padding: 0 20px; border-radius: 21px; border: none; background: var(--seg); color: #ff4f7b; font-size: 15px; font-weight: 500; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.logout-btn i { font-size: 17px; }
.advanced { margin-top: 18px; }
.advanced summary { list-style: none; width: max-content; margin: 0 auto; padding: 8px 12px; display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); cursor: pointer; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary i { font-size: 12px; transition: transform .2s; }
.advanced[open] summary i { transform: rotate(180deg); }
.advanced .account-tiles { margin-top: 8px; animation: gl-strip .2s ease both; }

/* ---------- Desktop (Habit Tracker Gloed Desktop) ----------
   From 1024px: the bottom bar becomes a sidebar, pages widen, sheets become dialogs. */
.side-brand-row { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.side-brand-row svg { width: 30px; height: 30px; flex: none; }
.row-edit { width: 36px; height: 36px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; color: var(--muted); transition: color .15s; }
.row-edit:hover { color: var(--text); }
.row-edit i { font-size: 17px; }
.today-week .bars { height: 90px; margin: 0; }
.today-week .bars > div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; height: 100%; }
.today-week .week-head { margin: 40px 0 14px; }
.habit-cols, .habit-cells { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.9fr) minmax(0, 1.3fr); gap: 16px; align-items: center; }
/* Desktop "Nieuwe gewoonte": the categories as an even grid of small tiles, like the phone's cards. */
.cat-chips { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.cat-chips label { position: relative; }
.cat-chips input { position: absolute; opacity: 0; pointer-events: none; }
.cat-chips span { height: 82px; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; color: color-mix(in srgb, var(--c) var(--catInk), var(--text)); background: color-mix(in srgb, var(--c) 10%, var(--mix)); transition: background .15s, box-shadow .15s, transform .14s cubic-bezier(.3, .7, .4, 1); }
.cat-chips span i { font-size: 24px; }
.cat-chips span:hover { background: color-mix(in srgb, var(--c) 18%, var(--mix)); }
.cat-chips label:active span { transform: scale(.96); }
.cat-chips input:checked + span { background: color-mix(in srgb, var(--c) 24%, var(--mix)); box-shadow: inset 0 0 0 2px var(--c); }
.cat-chips input:focus-visible + span { outline: 2px solid var(--acc); }
.dialog-label { font-size: 14px; color: var(--muted); margin: 20px 0 10px; }
.new-dialog .name-input { margin-top: 0; padding: 14px 16px; border-radius: 14px; font-size: 16px; }
.new-dialog .chips { margin-top: 10px; }
.new-dialog .chips[hidden] { display: none; }
.new-dialog .chips button { font-size: 13.5px; padding: 8px 13px; border-radius: 17px; cursor: pointer; }
.new-dialog .primary { margin-top: 28px; height: 50px; border-radius: 25px; font-size: 16px; cursor: pointer; }

@media (min-width: 1024px) {
  /* Sidebar */
  .nav-fade { display: none; }
  .bottom-nav {
    left: 0; right: auto; top: 0; bottom: 0; width: 232px; height: auto; border-radius: 0;
    background: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
    display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 44px 18px 28px; /* brand level with the page title */
  }
  .bottom-nav .side-brand { display: flex; align-items: center; gap: 10px; padding: 0 10px; margin-bottom: 28px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
  .bottom-nav .side-brand svg { width: 30px; height: 30px; }
  .bottom-nav .side-only { display: flex; }
  .bottom-nav .bar-only, .bottom-nav .nav-fab { display: none; }
  .nav-item { flex-direction: row; justify-content: flex-start; gap: 12px; height: 44px; padding: 0 14px; border-radius: 12px; color: var(--muted); transition: background .15s, color .15s; }
  .nav-item:hover { background: var(--seg); }
  .nav-item i { font-size: 19px; }
  .nav-item span { font-size: 15px; }
  .nav-item::after { display: none; }
  .nav-item.on { background: var(--seg); color: var(--text); }
  .nav-item.on i { transform: none; }
  .side-new { order: 99; margin-top: auto; height: 46px; border-radius: 23px; background: var(--text); color: var(--fabFg); font-size: 15px; font-weight: 500; align-items: center; justify-content: center; gap: 8px; }
  .side-new i { font-size: 16px; }

  /* Pages */
  .gloed-shell, .gloed-shell.no-nav { max-width: none; margin: 0 0 0 232px; padding: 40px 56px 60px 32px; }
  .gloed-shell > * { max-width: 1120px; }
  .page-title { font-size: 34px; letter-spacing: -0.02em; line-height: 1.1; margin-top: 0; }
  .page-sub { font-size: 15px; margin-top: 6px; }
  .title-row { align-items: flex-end; margin-top: 0; }

  /* Vandaag: title left, day buttons right; list and a sticky side column */
  .today .day-head { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
  .today .day-title { order: -1; flex: 1; text-align: left; padding: 0; cursor: pointer; }
  .today .day-title h1 { justify-content: flex-start; font-size: 34px; letter-spacing: -0.02em; line-height: 1.1; }
  .today .day-title h1 { width: max-content; }
  .today .day-title h1 i { font-size: 16px; }
  .today .day-title span { display: block; font-size: 15px; margin-top: 6px; }
  .today .day-head .icon-btn { width: 40px; height: 40px; background: var(--seg); color: var(--text); }
  .today .day-head .icon-btn i { font-size: 16px; }
  .go-today { order: -1; height: 40px; padding: 0 16px; border-radius: 20px; display: flex; align-items: center; }
  /* The days as a row under the title, two weeks back to a week ahead; opened from the title. */
  .today .strip { display: none; }
  .strip-open .today .strip { display: flex; gap: 6px; overflow-x: auto; margin: 26px 0 0; padding: 2px 0;
    mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent); }
  .today .strip a { width: 54px; padding: 11px 0 10px; }
  .today .strip a:not(.on):hover { background: var(--seg); color: var(--text); }
  #today-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 280px); column-gap: 64px; margin-top: 28px; align-items: start; }
  .today-side { grid-column: 2; grid-row: 1; position: sticky; top: 40px; }
  .today-main { grid-column: 1; grid-row: 1; }
  .today-side .ring { width: 200px; height: 200px; margin: 0; }
  .today-side .zen { align-items: flex-start; text-align: left; padding: 0; }
  .today-side .zen-art { width: 120px; height: 120px; }
  .today-side .zen-art::before { display: none; }
  .today-side .zen-art svg { width: 120px; height: 120px; }
  .today-side .zen h2 { font-size: 21px; margin-top: 12px; }
  .row-wrap { position: relative; display: flex; align-items: center; gap: 4px; }
  /* Reorder grip in the gutter left of the row, shown on hover. */
  .row-wrap > .grip { position: absolute; right: 100%; width: 28px; opacity: 0; }
  .row-wrap:hover > .grip, .row-wrap.dragging > .grip { opacity: .7; }
  .row-wrap > .grip:hover { opacity: 1; }
  /* Lifted: an opaque card (the rows themselves are see-through) that grows a little. */
  .row-wrap.dragging { z-index: 2; background: var(--mix); border-radius: 16px; box-shadow: 0 12px 32px rgba(0, 0, 0, .28); scale: 1.02; transition: scale .15s, box-shadow .15s; }
  .habits-list .row-wrap.dragging, .habits-list .row-wrap.dragging:hover { background: var(--mix); }
  .row-wrap > form { flex: 1; min-width: 0; }
  .habits-list .row-wrap { margin: 0 -12px; padding-right: 12px; border-radius: 14px; transition: background .15s; }
  .habits-list .row-wrap:hover { background: var(--seg); }
  .habits-list .row { border-bottom: none; padding: 16px 12px; cursor: pointer; }
  .row .habit-slot { font-size: 13.5px; }
  .week-head { margin-top: 32px; }
  .habits-stack .row-wrap { gap: 8px; }
  .peek { justify-content: flex-start; margin-top: 14px; }

  /* Overzicht: a grid of blocks, the wide ones across */
  /* Blocks side by side are equally tall; their bars grow into the extra height. */
  .ov-blocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; margin-top: 32px; align-items: stretch; }
  .ov-card { display: flex; flex-direction: column; }
  .ov-card > .bars { flex: 1; min-height: 130px; height: auto; }
  .ov-card.solo { grid-column: 1 / -1; }
  .ov-card.wide { grid-column: 1 / -1; }
  .ov-empty { grid-column: 1 / -1; }
  .ov-card .wk-cells { gap: 8px; }
  .ov-card .wk-cells > div { width: 34px; }
  .ov-card .wk-cell i { font-size: 14px; }
  .ov-card .year-months, .ov-card .year-grid { gap: 3px; }

  /* Detail */
  .detail > * { max-width: 760px; }
  .detail .page-head { margin: 0 0 28px; }
  .detail .page-head .back { display: none; }
  /* Breadcrumb: a muted trail on the title's line height, so the title below keeps its place. */
  .crumbs { display: flex; align-items: center; gap: 8px; height: 40px; font-size: 15px; color: var(--muted); min-width: 0; }
  .crumbs a { color: var(--muted); transition: color .15s; }
  .crumbs a:hover { color: var(--text); }
  .crumbs i { font-size: 11px; opacity: .7; }
  .crumbs span { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .detail .page-head .pill-btn { height: 40px; padding: 0 14px; border-radius: 20px; font-size: 14px; }
  .detail-head { margin-top: 0; }

  /* Gewoontes: a table */
  .habits-page .page-head { margin: 0; align-items: flex-start; flex-wrap: wrap; gap: 16px; }
  .habits-page .page-head .back, .habits-page .page-head .spacer { display: none; }
  .habits-page .page-head h1 { flex: 1; font-size: 34px; letter-spacing: -0.02em; line-height: 1.1; }
  .habits-page .page-head .pill-btn { order: 2; height: 44px; padding: 0 20px; border-radius: 22px; font-size: 14.5px; }
  .habits-page .page-intro { margin: 6px 0 28px; font-size: 15px; }
  .habit-cols { padding: 0 0 10px 98px; border-bottom: 1px solid var(--hair); font-size: 12.5px; color: var(--muted); }
  .habits-page .manage-list { margin: 0; }
  .habits-page .manage-row { height: 72px; }
  .habits-page .manage-main .habit-main { display: none; }
  .habit-cells { flex: 1; min-width: 0; font-size: 14.5px; }
  .habit-cells span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .habit-cells .name { font-size: 16px; color: var(--text); }
  .habit-cells .num { font-variant-numeric: tabular-nums; }
  .habit-cells .streak { color: var(--text); }
  .habits-empty { text-align: left; padding: 24px 0; }

  /* Instellingen: one card per group */
  .settings-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); grid-auto-rows: 4px; gap: 0 16px; align-items: start; grid-auto-flow: dense; background: none; box-shadow: none; padding: 0; margin-top: 28px; }
  .settings-group { display: block; background: var(--card); box-shadow: var(--cardShadow); border-radius: 22px; padding: 8px 22px; }
  /* No line under a card's last row (the phone's between-group line does not apply here). */
  .settings-groups .settings-group > :last-child, .settings-groups .settings-group:not(:last-child) > :last-child { border-bottom: none; }
  .group-title { display: block; }
  .settings-group .set-block > .set-head:first-child { margin-bottom: 12px; }
  .settings-card:not(.settings-groups) { padding: 4px 22px; }
  .themes:has(.swatch) { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }

  /* Sheets become centred dialogs */
  .sheet-layer { justify-content: center; padding: 24px; }
  .sheet { max-width: 460px; max-height: calc(100dvh - 48px); border-radius: 24px; padding: 24px 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, .3); animation: gl-pop .25s cubic-bezier(.2, .8, .2, 1) both; }
  .sheet-layer.closing .sheet { animation: gl-fade-out .18s ease both; }
  .sheet .grabber { display: none; }
  .sheet .name-input { padding: 14px 16px; border-radius: 14px; font-size: 16px; }
  .sheet-actions { flex-direction: row; align-items: center; gap: 10px; margin-top: 28px; }
  .sheet-actions .primary, .sheet-actions .secondary, .sheet-actions .danger-link, .sheet-actions form { width: auto; height: 46px; margin: 0; }
  .sheet-actions .primary { order: 3; padding: 0 24px; border-radius: 23px; font-size: 15px; }
  .sheet-actions .secondary { order: 2; display: block; padding: 0 20px; border: none; border-radius: 23px; background: var(--seg); color: var(--text); font-size: 15px; font-weight: 500; cursor: pointer; }
  .sheet-actions .danger-link { order: 1; margin-right: auto; padding: 0 16px 0 0; }
  .sheet-confirm { padding-top: 20px; }
  .sheet-confirm h3 { font-size: 20px; }
  .sheet-confirm .sheet-actions { justify-content: flex-end; margin-top: 26px; }
  .sheet-confirm .sheet-actions form { order: 3; }
  .sheet-confirm .sheet-delete .primary { margin: 0; padding: 0 22px; }
  .sheet-confirm .secondary { background: var(--seg); color: var(--text); font-weight: 500; }
  .new-dialog { max-width: 520px; padding: 26px 28px 24px; }
  .new-dialog .sheet-head h2 { font-size: 22px; }

  /* Overzicht aanpassen: a dialog too */
  .page-layer .sheet-backdrop { display: block; }
  .page-sheet { position: relative; inset: auto; max-width: 540px; max-height: calc(100dvh - 48px); background: var(--sheet); border-radius: 24px; padding: 24px 28px 20px; animation: gl-pop .25s cubic-bezier(.2, .8, .2, 1) both; }
  .page-sheet > * { max-width: none; }
  .page-sheet .page-head { margin: 0 0 10px; }
  .page-sheet .page-head .back { display: none; }
  .page-sheet .page-head .close { visibility: visible; color: var(--muted); }
  .page-sheet .page-head h2 { flex: 1; font-size: 22px; }
  .page-sheet .page-intro { margin: 0 0 8px; }
  .page-sheet .sheet-foot { justify-content: space-between; }
  .page-sheet .text-btn { margin-left: -18px; }

  /* Onboarding: text left, art right */
  .flow:has(.onb-body) { max-width: none; }
  .onb-top { justify-content: space-between; align-items: center; padding: 32px 48px 0; }
  .onb-body { align-items: center; justify-content: center; padding: 0 48px; }
  .onb-step { width: 100%; max-width: 1040px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 80px; align-items: center; justify-items: center; }
  .onb-step[hidden] { display: none; }
  .onb-step h2 { order: -1; font-size: 44px; line-height: 1.2; justify-self: stretch; }
  .onb-step > :not(h2) { width: 100%; max-width: 420px; }
  .onb-step .onb-enso { width: 132px; }
  .onb-foot { width: 100%; max-width: 1136px; margin: 0 auto; padding: 0 48px 48px; }
  .onb-next { width: auto; height: 56px; padding: 0 28px; border-radius: 28px; display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 500; }
  .onb-next[hidden] { display: none; }

  /* Sign in and sign up: brand panel and form panel */
  .auth-page { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); height: 100dvh; }
  .auth-brand { display: flex !important; flex-direction: column; justify-content: space-between; padding: 40px 56px; min-width: 0; }
  .auth-story { max-width: 520px; }
  .auth-glow { position: relative; width: 180px; height: 180px; display: flex; align-items: center; justify-content: center; margin-left: -24px; }
  .auth-glow::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--acc) 30%, transparent) 0%, transparent 68%); animation: glow-breathe 5s ease-in-out infinite; }
  .auth-glow svg { position: relative; width: 110px; height: 110px; }
  .auth-brand h1 { font-size: 44px; font-weight: 400; line-height: 1.2; letter-spacing: -0.02em; color: var(--muted); text-wrap: pretty; }

  /* The three stories share one grid cell and cross-fade on the form panel's mode. */
  .auth-modes { display: grid; margin-top: 24px; }
  .auth-mode { grid-area: 1 / 1; opacity: 0; transform: translateY(8px); transition: opacity .4s ease, transform .4s ease; pointer-events: none; }
  .auth-page[data-mode="login"] .auth-mode[data-for="login"],
  .auth-page[data-mode="signup"] .auth-mode[data-for="signup"],
  .auth-page[data-mode="reset"] .auth-mode[data-for="reset"] { opacity: 1; transform: none; }
  .auth-mode > :last-child { margin-top: 36px; }
  .auth-page[data-mode="signup"] .story-habit { animation: story-in .5s cubic-bezier(.2, .8, .2, 1) both; }
  .story-habit:nth-child(2) { animation-delay: .08s !important; }
  .story-habit:nth-child(3) { animation-delay: .16s !important; }

  .story-streak { max-width: 380px; padding: 18px 20px; border-radius: 22px; background: var(--card); box-shadow: var(--cardShadow); }
  .story-days { display: flex; justify-content: space-between; }
  .story-days > div { display: flex; flex-direction: column; align-items: center; gap: 6px; }
  .story-days span { font-size: 11.5px; color: var(--muted); }
  .story-days b { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-sizing: border-box; }
  .story-days b.full { background: var(--acc); color: #fff; }
  .story-days b.full i { font-size: 14px; }
  .story-days b.now { border: 1.5px dashed var(--acc); }
  .story-streak p { display: flex; align-items: center; gap: 6px; margin-top: 16px; font-size: 14px; color: var(--muted); }
  .story-streak p i { font-size: 16px; color: var(--acc); }

  .story-habits { display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
  .story-habit { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: color-mix(in srgb, var(--c) 14%, var(--mix)); }
  .story-habit .ic { width: 32px; height: 32px; border-radius: 50%; background: var(--c); display: flex; align-items: center; justify-content: center; flex: none; }
  .story-habit .ic i { font-size: 16px; color: #fff; }
  .story-habit .name { flex: 1; font-size: 15.5px; color: var(--text); }
  .story-habit .tick { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--c); display: flex; align-items: center; justify-content: center; box-sizing: border-box; }
  .story-habit .tick i { font-size: 13px; color: #fff; opacity: 0; }
  .story-habit.done .tick { background: var(--c); }
  .story-habit.done .tick i { opacity: 1; }

  .story-mail { display: flex; align-items: center; gap: 12px; font-size: 15px; color: var(--muted); }
  .story-mail i { width: 48px; height: 48px; border-radius: 50%; background: color-mix(in srgb, var(--acc) 18%, transparent); color: var(--acc); font-size: 24px; display: flex; align-items: center; justify-content: center; flex: none; }
  .auth-brand small { font-size: 13px; color: var(--muted); }
  .auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--card); overflow-y: auto; }
}
@keyframes glow-breathe { 0%, 100% { opacity: .75; transform: scale(.96); } 50% { opacity: 1; transform: scale(1.04); } }
@keyframes story-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes gl-pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Handmatig invullen (habit_entries/edit) ---------- */
.entry-amount { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 26px; }
.entry-amount .round-btn { width: 48px; height: 48px; flex: none; }
.entry-amount > div { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.entry-amount input { width: 150px; text-align: center; border: none; outline: none; background: transparent; color: var(--text); font-size: 56px; font-weight: 600; line-height: 1.05; font-variant-numeric: tabular-nums; padding: 0; -moz-appearance: textfield; appearance: textfield; }
.entry-amount input::-webkit-outer-spin-button, .entry-amount input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.entry-amount span { font-size: 14px; color: var(--muted); margin-top: 2px; }
.entry-track { height: 8px; border-radius: 4px; background: var(--track); margin-top: 24px; overflow: hidden; }
.entry-track i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--c); transition: width .3s cubic-bezier(.2, .8, .2, 1); }
.entry-status { font-size: 13.5px; color: var(--muted); margin-top: 8px; font-variant-numeric: tabular-nums; }
.entry-quick { display: flex; gap: 8px; margin-top: 20px; }
.entry-quick button { flex: 1; height: 40px; border-radius: 20px; border: none; background: var(--seg); color: var(--text); font-size: 14.5px; font-weight: 500; cursor: pointer; transition: transform .14s cubic-bezier(.3, .7, .4, 1), background-color .2s; }
.entry-quick button:active { transform: scale(.96); }
.entry-quick .goal { background: color-mix(in srgb, var(--c) 22%, var(--seg)); }
.entry-sheet .primary { margin-top: 22px; height: 54px; }
@media (min-width: 1024px) { .row-wrap > a.habit-btn { flex: 1; min-width: 0; } }
