/* DateKeeper — Apple-inspired monochrome design system */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, "Helvetica Neue", Arial, sans-serif;
  --font-np: "Kohinoor Devanagari", "Noto Sans Devanagari", "Mukta", "Nirmala UI", var(--font);
  --bg: #F5F5F7;
  --bg-elev: #FFFFFF;
  --bg-side: #FBFBFD;
  --bg-sunk: #F2F2F5;
  --bg-hover: #EFEFF2;
  --bg-active: #E8E8ED;
  --fg: #1D1D1F;
  --fg-2: #3A3A3C;
  --fg-3: #6E6E73;
  --fg-4: #8E8E93;
  --line: #E5E5EA;
  --line-2: #F0F0F3;
  --field: #D2D2D7;
  --ink: #1D1D1F;
  --ink-fg: #FFFFFF;
  --hero: #1D1D1F;
  --hero-row: #2C2C2E;
  --hero-sub: #C7C7CC;
  --soon-bg: #FFF1E0; --soon-fg: #9A4A00;
  --exp-bg: #FDE9E8;  --exp-fg: #B3261E;
  --ok-bg: #EFEFF2;   --ok-fg: #3A3A3C;
  --good-bg: #E7F5EC; --good-fg: #1E6B3A;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.18);
  --r-card: 20px;
  --r-ctl: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #000000; --bg-elev: #1C1C1E; --bg-side: #111113; --bg-sunk: #232326; --bg-hover: #2C2C2E; --bg-active: #3A3A3C;
  --fg: #F5F5F7; --fg-2: #D1D1D6; --fg-3: #98989D; --fg-4: #7C7C80;
  --line: #2C2C2E; --line-2: #232326; --field: #3A3A3C;
  --ink: #F5F5F7; --ink-fg: #000000; --hero: #2C2C2E; --hero-row: #3A3A3C; --hero-sub: #AEAEB2;
  --soon-bg: #3D2A12; --soon-fg: #FFB561; --exp-bg: #3B1715; --exp-fg: #FF8A80; --ok-bg: #2C2C2E; --ok-fg: #D1D1D6;
  --good-bg: #13301F; --good-fg: #7BD99B;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--fg); background: var(--bg); font-size: 15px; line-height: 1.4;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; text-rendering: optimizeLegibility;
}
.np, [lang="ne"] { font-family: var(--font-np); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, p { margin: 0; }
svg { flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: 248px; flex: none; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
  padding: 24px 14px 20px; background: var(--bg-side); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: var(--ink-fg); display: flex; align-items: center; justify-content: center; }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.switcher {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: var(--r-ctl); text-align: left;
}
.switcher .grow { display: flex; flex-direction: column; min-width: 0; }
.switcher b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switcher small { font-size: 12px; color: var(--fg-3); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 10px; border-radius: 9px;
  font-size: 14px; font-weight: 500; color: var(--fg);
}
.nav a:hover { background: var(--bg-hover); }
.nav a[aria-current="page"] { background: var(--bg-active); font-weight: 600; }
.nav .count { margin-left: auto; font-size: 12px; color: var(--fg-3); font-weight: 500; }
.nav .badge { margin-left: auto; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--ink); color: var(--ink-fg); font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.side-foot { margin-top: auto; padding: 12px; border-radius: 12px; background: var(--bg-sunk); display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--fg-3); }
.side-foot b { color: var(--fg); display: flex; align-items: center; gap: 8px; font-weight: 600; }
.dot { width: 7px; height: 7px; border-radius: 4px; background: var(--fg); display: inline-block; }
.dot.off { background: var(--fg-4); }

.main { flex: 1; min-width: 0; padding: 32px 40px 64px; max-width: 1240px; }
.page { display: flex; flex-direction: column; gap: 22px; }

.tabbar, .fab, .mtop { display: none; }

/* ---------- Headings ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.eyebrow { font-size: 13px; color: var(--fg-3); margin-bottom: 4px; }
.title { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.back { font-size: 13px; color: var(--fg-3); display: inline-flex; align-items: center; gap: 2px; }
.back:hover { color: var(--fg); }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
h2.h { font-size: 17px; font-weight: 600; }
.sub { font-size: 13px; color: var(--fg-3); }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px;
  border-radius: var(--r-ctl); border: 1px solid var(--field); background: var(--bg-elev); font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--bg-hover); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--ink); color: var(--ink-fg); border-color: var(--ink); }
.btn.primary:hover { opacity: .9; }
.btn.danger { color: var(--exp-fg); }
.btn.danger.solid { background: var(--exp-fg); border-color: var(--exp-fg); color: #fff; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.icon { width: 40px; padding: 0; }
.btn.sm.icon { width: 32px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.block { width: 100%; }
.link { font-size: 13px; color: var(--fg-3); background: none; border: 0; padding: 0; }
.link:hover { color: var(--fg); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--fg-2); min-width: 0; }
.field .opt { font-weight: 400; color: var(--fg-3); }
.input, select.input, textarea.input {
  height: 42px; padding: 0 12px; border: 1px solid var(--field); border-radius: 10px; font-size: 15px; background: var(--bg-elev); color: var(--fg);
  width: 100%; min-width: 0; -webkit-appearance: none; appearance: none;
}
select.input { padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238E8E93' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.input:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 3px rgba(128,128,128,.15); }
.input.invalid { border-color: var(--exp-fg); }
.input[type="date"], .input[type="time"] { min-height: 42px; }
.err { color: var(--exp-fg); font-size: 12px; font-weight: 500; }
.hint { font-size: 12px; color: var(--fg-3); font-weight: 400; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.searchbox { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-ctl); width: 300px; max-width: 100%; color: var(--fg-3); }
.searchbox input { border: 0; outline: 0; background: transparent; font-size: 14px; flex: 1; min-width: 0; color: var(--fg); }
.kbd { font-size: 12px; color: var(--fg-4); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  height: 32px; padding: 0 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--bg-elev);
  font-size: 13px; font-weight: 500; color: var(--fg); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.chip:hover { background: var(--bg-hover); }
.chip[aria-pressed="true"], .chip.on { background: var(--ink); color: var(--ink-fg); border-color: var(--ink); }
.chip.dashed { border-style: dashed; border-color: var(--field); }
.chip .x { opacity: .7; margin-left: 2px; }

.seg { display: inline-flex; padding: 3px; background: var(--bg-active); border-radius: 10px; gap: 2px; }
.seg button { height: 30px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; font-size: 13px; font-weight: 500; color: var(--fg); }
.seg button[aria-pressed="true"] { background: var(--bg-elev); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.12); }

.switch { width: 51px; height: 31px; border-radius: 16px; border: 0; padding: 2px; background: var(--field); display: inline-flex; transition: background .2s; flex: none; }
.switch::after { content: ""; width: 27px; height: 27px; border-radius: 14px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--ink); }
[data-theme="dark"] .switch[aria-checked="true"] { background: #30D158; }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* ---------- Cards & lists ---------- */
.card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-card); padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card.tight { gap: 4px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card.hero { background: var(--hero); color: #fff; border-color: transparent; }
.card.hero .sub { color: var(--hero-sub); }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.col-main { flex: 2 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.col-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.stat { background: var(--bg-elev); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; text-align: left; }
a.stat:hover { border-color: var(--field); }
.stat .k { font-size: 13px; color: var(--fg-3); font-weight: 500; }
.stat .v { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.stat .s { font-size: 12px; color: var(--fg-3); }
.stat.warn .v { color: var(--soon-fg); }
.stat.bad .v { color: var(--exp-fg); }

.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line-2); min-width: 0; }
.rows > .row:first-child { border-top: 0; }
a.row:hover .row-title { text-decoration: underline; text-underline-offset: 3px; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { font-size: 13px; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.datebox { width: 54px; flex: none; display: flex; flex-direction: column; align-items: center; padding: 6px 0; border-radius: 12px; background: var(--bg-sunk); }
.datebox .m { font-size: 10px; font-weight: 600; color: var(--fg-3); letter-spacing: .06em; text-transform: uppercase; }
.datebox .d { font-size: 20px; font-weight: 700; line-height: 1.1; }
.datebox .b { font-size: 10px; color: var(--fg-3); font-family: var(--font-np); }
.check { width: 22px; height: 22px; border-radius: 11px; border: 1.5px solid var(--fg-4); background: transparent; flex: none; display: inline-flex; align-items: center; justify-content: center; color: transparent; }
.check:hover { border-color: var(--fg); }
.check[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: var(--ink-fg); }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; flex: none; }
.pill i { width: 6px; height: 6px; border-radius: 3px; background: currentColor; }
.pill.soon, .pill.today { background: var(--soon-bg); color: var(--soon-fg); }
.pill.today.ink { background: var(--ink); color: var(--ink-fg); }
.pill.expired { background: var(--exp-bg); color: var(--exp-fg); }
.pill.active, .pill.past, .pill.archived, .pill.done { background: var(--ok-bg); color: var(--ok-fg); }
.pill.completed { background: var(--good-bg); color: var(--good-fg); }

.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-active); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex: none; overflow: hidden; color: var(--fg); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 52px; height: 52px; font-size: 17px; }
.avatar.xl { width: 72px; height: 72px; font-size: 24px; }

.strip { display: flex; align-items: flex-end; gap: 4px; height: 44px; }
.strip span { flex: 1; border-radius: 3px; background: var(--line); min-height: 6px; }
.strip span.on { background: var(--fg); }
.strip span.on.later { background: var(--fg-4); }
.strip-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--fg-3); margin-top: 6px; }

.today-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--hero-row); }
.today-row .t { font-size: 13px; font-weight: 600; width: 60px; flex: none; }
.today-row .check { border-color: #8E8E93; }

.empty { padding: 36px 16px; text-align: center; color: var(--fg-3); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty svg { color: var(--fg-4); }
.empty b { color: var(--fg); font-size: 16px; }

dl.info { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); column-gap: 28px; }
dl.info div { padding: 12px 0; border-top: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
dl.info dt { font-size: 12px; color: var(--fg-3); font-weight: 500; }
dl.info dd { margin: 0; font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }

.timeline .tl { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; }
.tl-dot { margin-top: 4px; width: 10px; height: 10px; border-radius: 5px; border: 2px solid var(--fg); flex: none; }
.tl-dot.full { background: var(--fg); }
.tl-dot.dim { border-color: var(--fg-4); }

.countdown { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; }
.countdown .n { font-size: 64px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.progress { height: 8px; border-radius: 4px; background: var(--bg-hover); overflow: hidden; }
.progress > div { height: 100%; background: var(--fg); border-radius: 4px; }

.thumb { border-radius: 12px; background: var(--bg-sunk); border: 1px solid var(--line); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.filetile { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.filetile .ft { width: 40px; height: 48px; border-radius: 6px; background: var(--bg-sunk); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--fg-3); flex: none; overflow: hidden; }
.filetile .ft img { width: 100%; height: 100%; object-fit: cover; }
.drop { border: 1.5px dashed var(--field); border-radius: 12px; padding: 18px; text-align: center; color: var(--fg-3); font-size: 13px; }
.drop.over { border-color: var(--fg); color: var(--fg); background: var(--bg-sunk); }

/* ---------- Calendar ---------- */
.cal { overflow: hidden; padding: 0; gap: 0; }
.cal-wd { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.cal-wd span { padding: 10px 12px; font-size: 12px; font-weight: 600; color: var(--fg-3); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-cell {
  min-height: 112px; padding: 8px; border: 0; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2);
  background: var(--bg-elev); display: flex; flex-direction: column; gap: 4px; text-align: left; min-width: 0;
}
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.out { opacity: .45; }
.cal-cell[aria-selected="true"] { background: var(--bg-sunk); box-shadow: inset 0 0 0 2px var(--fg); }
.cal-cell:hover { background: var(--bg-sunk); }
.cal-num { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.cal-num b { width: 26px; height: 26px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; }
.cal-num small { font-size: 11px; color: var(--fg-3); font-family: var(--font-np); }
.cal-cell.today .cal-num b { background: var(--ink); color: var(--ink-fg); }
.ev { display: block; width: 100%; font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.soon, .ev.today { background: var(--soon-bg); color: var(--soon-fg); }
.ev.expired { background: var(--exp-bg); color: var(--exp-fg); }
.ev.active, .ev.past, .ev.done { background: var(--ok-bg); color: var(--ok-fg); }
.ev.completed { background: var(--good-bg); color: var(--good-fg); }
.ev.more { background: transparent; color: var(--fg-3); padding-left: 2px; }
.dots { display: flex; gap: 3px; justify-content: center; min-height: 5px; }
.dots i { width: 5px; height: 5px; border-radius: 3px; background: var(--fg); }
.dots i.soon, .dots i.today { background: var(--soon-fg); }
.dots i.expired { background: var(--exp-fg); }
.dots i.active, .dots i.past, .dots i.done { background: var(--fg-4); }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; }
.week-col { border-right: 1px solid var(--line-2); min-height: 340px; padding: 10px 8px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.week-col:last-child { border-right: 0; }
.week-col.today .wd-num { background: var(--ink); color: var(--ink-fg); }
.wd-head { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--line-2); }
.wd-num { width: 30px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.agenda-day { padding: 14px 0 6px; font-size: 13px; font-weight: 600; color: var(--fg-3); display: flex; justify-content: space-between; border-bottom: 1px solid var(--line-2); }

/* ---------- Overlays ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.32); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s; }
.sheet {
  background: var(--bg-elev); border-radius: 22px; width: 100%; max-width: 480px; max-height: calc(100dvh - 40px); overflow: auto;
  box-shadow: var(--shadow-lg); padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; animation: pop .18s ease-out;
}
.sheet.wide { max-width: 760px; }
.sheet h3 { font-size: 19px; font-weight: 700; }
.sheet .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.toasts { position: fixed; top: calc(12px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 24px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px;
  background: rgba(250,250,252,.92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: 0 10px 30px rgba(0,0,0,.16);
  border: 1px solid var(--line); animation: drop .25s ease-out; color: var(--fg);
}
[data-theme="dark"] .toast { background: rgba(44,44,46,.92); }
.toast .ic { width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: var(--ink-fg); display: flex; align-items: center; justify-content: center; flex: none; }
.toast.error .ic { background: var(--exp-fg); color: #fff; }
.toast b { font-size: 14px; display: block; }
.toast span { font-size: 13px; color: var(--fg-3); }
@keyframes drop { from { transform: translateY(-16px); opacity: 0; } }
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--bg-sunk); font-size: 13px; color: var(--fg-2); }
.banner.warn { background: var(--soon-bg); color: var(--soon-fg); }
.banner.bad { background: var(--exp-bg); color: var(--exp-fg); }
.offline-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + var(--safe-b)); z-index: 40; background: var(--ink); color: var(--ink-fg); padding: 8px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow); }
@media (min-width: 900px) { .offline-bar { bottom: 20px; } }

.menu { position: absolute; z-index: 60; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 220px; }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; border: 0; background: none; font-size: 14px; text-align: left; }
.menu button:hover, .menu a:hover { background: var(--bg-hover); }
.menu .sep { height: 1px; background: var(--line); margin: 4px 0; }

/* ---------- Auth ---------- */
.auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth .sheet { box-shadow: var(--shadow); border: 1px solid var(--line); max-width: 420px; padding: 32px; }
.auth .brand { padding: 0; margin-bottom: 6px; }

/* ---------- Settings ---------- */
.set-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); min-height: 56px; flex-wrap: wrap; }
.set-row:first-of-type { border-top: 0; }
.set-row .grow { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 2px; }
.set-row .grow b { font-size: 15px; font-weight: 500; }
.set-row select.input, .set-row .input { width: auto; min-width: 140px; max-width: 100%; height: 36px; font-size: 14px; }
.toc { display: flex; gap: 8px; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; padding: 8px 0; background: var(--bg); }

.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.icon-grid button { height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-elev); display: flex; align-items: center; justify-content: center; }
.icon-grid button[aria-pressed="true"] { background: var(--ink); color: var(--ink-fg); border-color: var(--ink); }

.import-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.import-table th, .import-table td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line-2); vertical-align: top; }
.import-table th { color: var(--fg-3); font-weight: 600; font-size: 12px; }
.scroll-x { overflow-x: auto; }

/* ---------- Mobile ---------- */
.seg button { white-space: nowrap; }
.scroll-seg { overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.scroll-seg::-webkit-scrollbar { display: none; }

@media (max-width: 899px) {
  .sidebar { display: none; }
  .main { padding: 14px 16px calc(110px + var(--safe-b)); }
  .title { font-size: 30px; }
  .card { padding: 18px; border-radius: 18px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 14px 16px; }
  .stat .v { font-size: 28px; }
  .page-head .searchbox { display: none; }
  .head-actions .btn.hide-m { display: none; }
  .mtop { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: var(--safe-t); }
  .mtop .switcher { width: auto; max-width: 70%; border-radius: 18px; padding: 4px 12px 4px 4px; }
  .mtop .bell { position: relative; width: 40px; height: 40px; border-radius: 20px; border: 1px solid var(--line); background: var(--bg-elev); display: flex; align-items: center; justify-content: center; }
  .mtop .bell .badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; font-size: 10px; padding: 0 5px; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; justify-content: space-around; align-items: flex-start;
    padding: 8px 8px calc(8px + var(--safe-b)); background: rgba(250,250,252,.94); border-top: 1px solid var(--line);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  }
  [data-theme="dark"] .tabbar { background: rgba(28,28,30,.92); }
  .tabbar a { width: 68px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; font-weight: 600; color: var(--fg-3); position: relative; }
  .tabbar a[aria-current="page"] { color: var(--fg); }
  .tabbar .badge { position: absolute; top: -4px; right: 12px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
  .fab {
    display: flex; position: fixed; right: 20px; bottom: calc(80px + var(--safe-b)); z-index: 31; width: 56px; height: 56px; border-radius: 28px;
    background: var(--ink); color: var(--ink-fg); align-items: center; justify-content: center; box-shadow: 0 6px 20px rgba(0,0,0,.22);
  }
  .cal-cell { min-height: 54px; padding: 4px 2px; align-items: center; }
  .cal-cell .ev { display: none; }
  .cal-num { flex-direction: column; gap: 0; }
  .cal-num b { width: 30px; height: 30px; font-size: 15px; }
  .cal-num small { font-size: 9px; }
  .cal-wd span { text-align: center; padding: 8px 0; }
  .week { grid-template-columns: 1fr; }
  .week-col { border-right: 0; border-bottom: 1px solid var(--line-2); min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .week-col .wd-head { flex-direction: row; border-bottom: 0; width: 100%; justify-content: flex-start; gap: 10px; padding-bottom: 4px; }
  .scrim { align-items: flex-end; padding: 0; }
  .sheet { max-width: none; border-radius: 22px 22px 0 0; max-height: 92dvh; padding: 20px 18px calc(20px + var(--safe-b)); animation: up .22s ease-out; }
  .countdown .n { font-size: 48px; }
  .datebox { width: 46px; }
  .datebox .d { font-size: 17px; }
  .hide-m { display: none !important; }
  .filters { display: none !important; }
  .filters.open { display: flex !important; flex-wrap: wrap; gap: 10px; width: 100%; }
  .filters.open > * { flex: 1 1 140px; }
}
@media (min-width: 900px) { .show-m { display: none !important; } }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

@media print {
  .sidebar, .tabbar, .fab, .mtop, .head-actions, .toc { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; }
}

/* =====================================================================
   iOS-style phone layout (below 900 px). Desktop is unchanged.
   ===================================================================== */
.navbar { display: none; }
.sheet-grab { display: none; }
@media (max-width: 899px) {
  :root {
    --bg: #F2F2F7; --bg-elev: #FFFFFF; --line: #C6C6C8; --line-2: rgba(60,60,67,.18); --fg-3: #8A8A8E; --field: #D1D1D6;
    --soon-bg: rgba(255,149,0,.14); --soon-fg: #C25E00; --exp-bg: rgba(255,59,48,.12); --exp-fg: #D70015; --good-bg: rgba(52,199,89,.14); --good-fg: #1E7B34;
    --ios-switch: #34C759;
  }
  [data-theme="dark"] {
    --bg: #000000; --bg-elev: #1C1C1E; --bg-sunk: #2C2C2E; --line: #38383A; --line-2: rgba(84,84,88,.6); --fg-3: #8D8D93;
    --soon-fg: #FF9F0A; --exp-fg: #FF453A; --good-fg: #30D158; --ios-switch: #30D158;
  }
  body { font-size: 17px; letter-spacing: -0.01em; }
  .main { padding: 0 16px calc(96px + var(--safe-b)); }
  .page { gap: 18px; padding-top: 8px; }

  /* Navigation bar: translucent, back button left, small title appears when the large title scrolls away */
  .navbar {
    display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; position: sticky; top: 0; z-index: 25;
    min-height: calc(44px + var(--safe-t)); padding: var(--safe-t) 8px 0; margin: 0 -16px;
    background: rgba(242,242,247,.82); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: .5px solid transparent; transition: border-color .2s, background .2s;
  }
  [data-theme="dark"] .navbar { background: rgba(0,0,0,.78); }
  .navbar.scrolled { border-bottom-color: var(--line); }
  .navbar .nb-left, .navbar .nb-right { display: flex; align-items: center; gap: 2px; min-width: 0; }
  .navbar .nb-right { justify-content: flex-end; }
  .navbar .nb-title { font-size: 17px; font-weight: 600; opacity: 0; transition: opacity .15s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 44vw; text-align: center; padding: 0 4px; }
  .navbar.scrolled .nb-title { opacity: 1; }
  .nb-btn { display: inline-flex; align-items: center; gap: 0; height: 44px; padding: 0 8px; border: 0; background: none; font-size: 17px; color: var(--fg); white-space: nowrap; min-width: 0; max-width: 100%; }
  .nb-btn span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .nb-btn svg { margin-left: -6px; }
  .navbar.scrolled .nb-left .nb-btn span { display: none; }
  .nb-add { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; color: var(--fg); }
  .nb-add:active, .navbar .bell:active { opacity: .4; }
  .fab { display: none !important; }
  .nb-btn b { font-weight: 600; }
  .nb-btn:active { opacity: .4; }
  .nb-btn[disabled] { opacity: .35; }
  .page-head .back, .page-head .head-actions .ios-moved { display: none !important; }
  .navbar ~ .page .page-head { padding-top: 0; }

  /* Large titles */
  .title { font-size: 34px; font-weight: 700; letter-spacing: -0.022em; line-height: 1.12; }
  .page-head { gap: 10px; align-items: flex-start; flex-direction: column; }
  .head-actions { width: 100%; }
  .head-actions:empty { display: none; }
  .eyebrow { font-size: 13px; text-transform: none; }
  .mtop { padding-top: calc(6px + var(--safe-t)); }

  /* Cards become inset grouped lists */
  .card { border: 0; border-radius: 12px; padding: 14px 16px; box-shadow: none; }
  .card.hero { border-radius: 14px; }
  .card.grouped { position: relative; margin-top: 30px; padding-top: 6px; padding-bottom: 6px; gap: 12px; }
  .card.grouped > h2.h:first-child {
    position: absolute; top: -26px; left: 16px; font-size: 13px; font-weight: 400; color: var(--fg-3); text-transform: uppercase; letter-spacing: .02em; margin: 0 !important;
  }
  .card.grouped > .field:first-of-type, .card.grouped > .grid2:first-of-type { margin-top: 8px; }
  .row { border-top: .5px solid var(--line-2); min-height: 44px; }
  .row:active, a.row:active, button.row:active { background: var(--bg-hover); }
  .set-row { border-top: .5px solid var(--line-2); min-height: 44px; padding: 10px 0; }
  .set-row .grow b { font-size: 17px; font-weight: 400; }
  .set-row .hint, .hint { font-size: 13px; }
  .set-row select.input, .set-row .input { border: 0; background-color: transparent; color: var(--fg-3); font-size: 17px; text-align: right; padding-right: 22px; height: 32px; box-shadow: none; }
  .set-row select.input { background-position: right 2px center; text-align-last: right; }
  .toc { display: none; }
  h2.h { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
  .card-head .link { font-size: 15px; }

  /* Controls at iOS sizes (16 px+ text stops Safari zooming into fields) */
  .input, select.input, textarea.input { height: 44px; font-size: 17px; border-radius: 10px; border: 0; background-color: var(--bg-sunk); }
  [data-theme="light"] .input, [data-theme="light"] select.input, [data-theme="light"] textarea.input { background-color: #EFEFF4; }
  .input:focus { box-shadow: 0 0 0 2px var(--fg); }
  .field { font-size: 13px; color: var(--fg-3); font-weight: 400; }
  .field .opt { color: var(--fg-4); }
  .btn { height: 44px; border-radius: 12px; font-size: 17px; font-weight: 600; border: 0; background: var(--bg-sunk); }
  [data-theme="light"] .btn { background: #E9E9EE; }
  .btn.primary { background: var(--ink); color: var(--ink-fg); }
  .btn.sm { height: 34px; font-size: 15px; border-radius: 17px; padding: 0 14px; }
  .btn.sm.icon { width: 34px; }
  .btn.ghost { background: transparent; }
  .btn.danger:not(.solid) { color: var(--exp-fg); }
  .chip { height: 34px; border-radius: 17px; font-size: 15px; border: 0; background: var(--bg-elev); }
  [data-theme="light"] .card .chip { background: #EFEFF4; }
  .chip.dashed { border: 1px dashed var(--field); background: transparent; }
  .seg { padding: 2px; border-radius: 9px; background: rgba(118,118,128,.12); }
  [data-theme="dark"] .seg { background: rgba(118,118,128,.24); }
  .seg button { height: 30px; border-radius: 7px; font-size: 13px; }
  [data-theme="dark"] .seg button[aria-pressed="true"] { background: #636366; }
  .switch { background: rgba(120,120,128,.16); }
  .switch[aria-checked="true"], [data-theme="dark"] .switch[aria-checked="true"] { background: var(--ios-switch); }
  .check[aria-checked="true"] { background: var(--ios-switch); border-color: var(--ios-switch); color: #fff; }
  .searchbox { height: 36px; border: 0; border-radius: 10px; background: rgba(118,118,128,.12); }
  .searchbox input { font-size: 17px; }
  .pill { height: 22px; font-size: 12px; padding: 0 8px; }
  .stat { border: 0; border-radius: 14px; }
  .stat .k { font-size: 13px; }
  .datebox { background: var(--bg); }

  /* Tab bar */
  .tabbar { padding: 6px 4px calc(4px + var(--safe-b)); border-top: .5px solid var(--line); background: rgba(249,249,249,.86); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
  [data-theme="dark"] .tabbar { background: rgba(22,22,22,.86); }
  .tabbar a { font-size: 10px; font-weight: 500; color: var(--fg-4); gap: 2px; }
  .tabbar a svg { width: 26px; height: 26px; }
  .tabbar a[aria-current="page"] { color: var(--fg); }
  .tabbar a[aria-current="page"] svg { stroke-width: 2.2; }
  .fab { bottom: calc(70px + var(--safe-b)); width: 52px; height: 52px; }

  /* Bottom sheets with a grab handle; swipe down to close */
  .scrim { background: rgba(0,0,0,.4); }
  .sheet { border-radius: 14px 14px 0 0; padding: 8px 16px calc(16px + var(--safe-b)); background: var(--bg); gap: 12px; }
  .sheet .sheet-grab { display: block; width: 36px; height: 5px; border-radius: 3px; background: rgba(120,120,128,.4); margin: 0 auto 6px; flex: none; touch-action: none; }
  .sheet h3 { font-size: 20px; text-align: center; }
  .sheet .actions { flex-direction: column-reverse; align-items: stretch; }
  .sheet .actions .btn { width: 100%; }
  .sheet .rows { background: var(--bg-elev); border-radius: 12px; padding: 0 14px; }

  /* Action sheet (menus) */
  .action-sheet { position: fixed; left: 8px; right: 8px; bottom: calc(8px + var(--safe-b)); z-index: 70; display: flex; flex-direction: column; gap: 8px; animation: up .22s ease-out; }
  .action-sheet .grp { background: rgba(249,249,249,.94); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: 14px; overflow: hidden; }
  [data-theme="dark"] .action-sheet .grp { background: rgba(44,44,46,.94); }
  .action-sheet button { display: block; width: 100%; height: 57px; border: 0; background: none; font-size: 20px; color: var(--fg); border-top: .5px solid var(--line-2); }
  .action-sheet .grp button:first-child { border-top: 0; }
  .action-sheet button.danger { color: var(--exp-fg); }
  .action-sheet button.cancel { font-weight: 600; }
  .action-sheet button:active { background: rgba(120,120,128,.2); }
  .menu-scrim { position: fixed; inset: 0; z-index: 69; background: rgba(0,0,0,.4); animation: fade .15s; }

  .toast { border-radius: 18px; }
  .empty b { font-size: 20px; }
  * { -webkit-touch-callout: none; }
  input, textarea, [contenteditable] { -webkit-touch-callout: default; }
}
@media (max-width: 899px) {
  .navbar .switcher { width: auto; max-width: 100%; border: 0; background: none; padding: 4px 6px; gap: 6px; border-radius: 18px; }
  .navbar .switcher b { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
  .navbar .switcher .avatar { width: 28px; height: 28px; font-size: 11px; }
  .navbar .switcher:active { opacity: .5; }
  .navbar .bell { position: relative; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--fg); }
  .navbar .bell svg { width: 24px; height: 24px; }
  .navbar .bell .badge { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; background: #FF3B30; color: #fff; }
  .tabbar .badge { background: #FF3B30; color: #fff; }
}
@media (max-width: 899px) {
  .set-row { flex-wrap: nowrap; gap: 10px; }
  .set-row .grow { min-width: 0; flex: 1 1 auto; }
  .set-row > select.input, .set-row > .input { min-width: 0; max-width: 58%; flex: 0 1 auto; }
  .set-row > .seg { flex: none; }
  .set-row[style*="column"] { flex-wrap: wrap; }
  .set-row .chips { width: 100%; }
}

/* ================= Colour ================= */
:root {
  --c-blue: #007AFF; --c-purple: #AF52DE; --c-pink: #FF2D55; --c-orange: #FF9500; --c-teal: #30B0C7;
  --c-green: #34C759; --c-indigo: #5856D6; --c-red: #FF3B30; --c-yellow: #FFCC00; --c-mint: #00C7BE;
  --accent: #007AFF; --accent-soft: rgba(0,122,255,.12);
  --ink: var(--accent); --ink-fg: #FFFFFF;
  --hero: linear-gradient(135deg, #5856D6 0%, #007AFF 55%, #30B0C7 100%);
  --hero-row: rgba(255,255,255,.16); --hero-sub: rgba(255,255,255,.82);
}
[data-theme="dark"] {
  --c-blue: #0A84FF; --c-purple: #BF5AF2; --c-pink: #FF375F; --c-orange: #FF9F0A; --c-teal: #40C8E0;
  --c-green: #30D158; --c-indigo: #5E5CE6; --c-red: #FF453A; --c-yellow: #FFD60A; --c-mint: #63E6E2;
  --accent: #0A84FF; --accent-soft: rgba(10,132,255,.2);
  --ink: var(--accent); --ink-fg: #FFFFFF;
  --hero: linear-gradient(135deg, #3634A3 0%, #0A5BC4 55%, #1E7F91 100%);
  --hero-row: rgba(255,255,255,.12); --hero-sub: rgba(255,255,255,.75);
}
.t-blue { --t: var(--c-blue); } .t-purple { --t: var(--c-purple); } .t-pink { --t: var(--c-pink); } .t-orange { --t: var(--c-orange); }
.t-teal { --t: var(--c-teal); } .t-green { --t: var(--c-green); } .t-indigo { --t: var(--c-indigo); } .t-red { --t: var(--c-red); }
.t-yellow { --t: var(--c-yellow); } .t-mint { --t: var(--c-mint); }

/* Coloured avatars and icon tiles (iOS Settings style) */
.avatar[class*="t-"] { background: var(--t); color: #fff; }
.tile { width: 32px; height: 32px; border-radius: 9px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--t, var(--accent)); color: #fff; }
.tile.t-yellow { color: #5C4300; }

/* Hero card */
.card.hero { background: var(--hero); box-shadow: 0 10px 30px rgba(0,90,200,.25); }
.card.hero .btn.primary, .today-row .btn.primary { background: #fff; color: var(--c-blue); border-color: #fff; }

/* Summary tiles */
.stat { position: relative; overflow: hidden; }
.stat .st-ic { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; margin-bottom: 2px; }
.stat.c-blue .st-ic { background: var(--c-blue); } .stat.c-orange .st-ic { background: var(--c-orange); }
.stat.c-red .st-ic { background: var(--c-red); } .stat.c-green .st-ic { background: var(--c-green); }
.stat.c-blue .v { color: var(--c-blue); } .stat.c-green .v { color: var(--c-green); }
.stat.c-orange.warn .v { color: var(--c-orange); } .stat.c-red.bad .v { color: var(--c-red); }

/* Date boxes coloured by status */
.datebox { background: var(--accent-soft) !important; }
.datebox .m { color: var(--accent); }
.datebox.s-soon, .datebox.s-today { background: rgba(255,149,0,.15) !important; }
.datebox.s-soon .m, .datebox.s-today .m { color: var(--c-orange); }
.datebox.s-expired { background: rgba(255,59,48,.13) !important; }
.datebox.s-expired .m { color: var(--c-red); }
.datebox.s-completed, .datebox.s-done { background: rgba(52,199,89,.15) !important; }
.datebox.s-completed .m, .datebox.s-done .m { color: var(--c-green); }
.datebox.s-archived, .datebox.s-past { background: var(--bg-sunk) !important; }
.datebox.s-archived .m, .datebox.s-past .m { color: var(--fg-3); }

/* Navigation and controls in the accent colour */
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav a[aria-current="page"] svg { color: var(--accent); }
.tabbar a[aria-current="page"], .tabbar a[aria-current="page"] svg { color: var(--accent) !important; }
.badge { background: var(--c-red); color: #fff; }
.switch[aria-checked="true"] { background: var(--c-green); }
.brand-mark { background: var(--hero); color: #fff; }
.cal-cell[aria-selected="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
a.link, .link { color: var(--accent); }
@media (max-width: 899px) {
  .nb-btn, .nb-add, .navbar .bell { color: var(--accent); }
  .nb-btn b { color: var(--accent); }
  .btn.primary { background: var(--accent); color: #fff; }
  .card.hero .btn.primary { background: #fff; color: var(--c-blue); }
}

.strip span.on { background: var(--c-orange); }
.strip span.on.later { background: var(--accent); opacity: .7; }
.avatar.av-all { background: var(--hero); color: #fff; }
.tile.t-red, .tile.t-pink, .tile.t-orange { color: #fff; }

/* =====================================================================================
   Liquid Glass (iOS 26 / 27 style): floating translucent bars, glass buttons and sheets,
   a lens that slides under the selected tab, filled icons for the current page.
   ===================================================================================== */
:root {
  --glass-tint: rgba(255,255,255,.56);
  --glass-tint-strong: rgba(250,250,252,.80);
  --glass-filter: blur(22px) saturate(185%) brightness(1.03);
  --glass-rim: inset 0 .5px 0 rgba(255,255,255,.95), inset 0 -.5px 0 rgba(255,255,255,.5), inset 0 0 0 .5px rgba(0,0,0,.05);
  --glass-shadow: 0 10px 30px rgba(0,0,0,.10), 0 1px 3px rgba(0,0,0,.06);
  --glass-sheen: linear-gradient(180deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,.08) 42%, rgba(255,255,255,0) 60%, rgba(255,255,255,.18) 100%);
  --lens: rgba(120,120,128,.16);
  --spring: cubic-bezier(.32, 1.35, .5, 1);
}
[data-theme="dark"] {
  --glass-tint: rgba(44,44,48,.48);
  --glass-tint-strong: rgba(30,30,32,.80);
  --glass-filter: blur(22px) saturate(170%) brightness(.95);
  --glass-rim: inset 0 .5px 0 rgba(255,255,255,.26), inset 0 -.5px 0 rgba(255,255,255,.08), inset 0 0 0 .5px rgba(255,255,255,.08);
  --glass-shadow: 0 10px 30px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.3);
  --glass-sheen: linear-gradient(180deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,0) 45%, rgba(255,255,255,0) 70%, rgba(255,255,255,.06) 100%);
  --lens: rgba(255,255,255,.13);
}

/* A soft wash behind everything, so the glass has colour to bend */
body {
  background:
    radial-gradient(1100px 700px at -10% -10%, color-mix(in srgb, var(--accent, #007AFF) 9%, transparent), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(175,82,222,.07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

.glass, .tabbar, .sidebar, .toast, .action-sheet .grp {
  background: var(--glass-tint) !important;
  -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
  box-shadow: var(--glass-rim), var(--glass-shadow);
  border: 0 !important;
  isolation: isolate;
}
.glass::before, .tabbar::before, .sidebar::before, .toast::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: var(--glass-sheen);
}
.toast { position: relative; }

/* Two-state icons: line normally, filled for the current page */
.nic { display: inline-grid; flex: none; }
.nic > svg { grid-area: 1 / 1; transition: opacity .18s, transform .25s var(--spring); }
.nic-f { opacity: 0; }
[aria-current="page"] .nic-o { opacity: 0; }
[aria-current="page"] .nic-f { opacity: 1; }
a:active .nic > svg { transform: scale(.86); }

/* Default-profile tag */
.def-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; margin-left: 8px; border-radius: 9px; font-size: 11px; font-weight: 600; vertical-align: 2px;
  background: color-mix(in srgb, var(--accent, #007AFF) 14%, transparent); color: var(--accent, #007AFF); }

/* ---- Desktop: floating glass sidebar ---- */
@media (min-width: 900px) {
  .sidebar {
    position: sticky; top: 12px; margin: 12px 0 12px 12px; height: calc(100vh - 24px); height: calc(100dvh - 24px);
    border-radius: 26px; padding: 22px 12px 14px;
  }
  .sidebar .switcher { background: var(--lens); border: 0; border-radius: 14px; }
  .nav a { height: 38px; border-radius: 12px; transition: background .2s; }
  .nav a:hover { background: var(--lens); }
  .nav a[aria-current="page"] { background: color-mix(in srgb, var(--accent, #007AFF) 15%, transparent); }
  .side-foot { background: var(--lens); border-radius: 16px; }
}

/* ---- Phone: floating tab bar, glass buttons, soft scroll edge, floating sheets ---- */
@media (max-width: 899px) {
  .main { padding-bottom: calc(108px + var(--safe-b)); }

  .tabbar {
    position: fixed; left: 14px; right: 14px; bottom: max(10px, calc(var(--safe-b) - 4px)); top: auto;
    height: 64px; padding: 4px; border-radius: 32px;
    display: grid; grid-template-columns: repeat(var(--tabs, 5), minmax(0, 1fr)); align-items: stretch; justify-content: stretch;
  }
  .tabbar .tb-lens {
    position: absolute; top: 4px; bottom: 4px; z-index: 0;
    width: calc((100% - 8px) / var(--tabs, 5));
    left: calc(4px + (100% - 8px) / var(--tabs, 5) * var(--tab, 0));
    border-radius: 28px; background: var(--lens);
    box-shadow: inset 0 .5px 0 rgba(255,255,255,.5);
    transition: left .42s var(--spring), opacity .2s;
  }
  .tabbar.no-lens .tb-lens { opacity: 0; }
  .tabbar a {
    width: auto; position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    font-size: 10px; font-weight: 600; letter-spacing: .01em; color: var(--fg-2) !important; border-radius: 28px;
  }
  [data-theme="dark"] .tabbar a { color: var(--fg-2) !important; }
  .tabbar a[aria-current="page"], .tabbar a[aria-current="page"] svg { color: var(--accent, var(--fg)) !important; }
  .tabbar a svg, .tabbar a[aria-current="page"] svg { width: 25px; height: 25px; stroke-width: 1.7; }
  .tabbar .tl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar .badge { top: 2px; right: calc(50% - 22px); }

  /* Navigation bar: no slab — content fades under a soft blur, controls are glass */
  .navbar { background: transparent !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; border-bottom: 0 !important; padding: var(--safe-t) 12px 6px; isolation: isolate; }
  .navbar::before {
    content: ''; position: absolute; inset: 0 0 -22px 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .25s;
    background: linear-gradient(to bottom, var(--bg) 0%, color-mix(in srgb, var(--bg) 72%, transparent) 60%, transparent 100%);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent); mask-image: linear-gradient(to bottom, #000 60%, transparent);
  }
  .navbar.scrolled::before { opacity: 1; }
  .navbar .nb-left, .navbar .nb-right { gap: 8px; }
  .navbar .nb-btn, .navbar .nb-add, .navbar .bell, .navbar .switcher {
    position: relative; height: 44px; min-width: 44px; border-radius: 22px; border: 0 !important;
    background: var(--glass-tint) !important; -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
    box-shadow: var(--glass-rim), 0 4px 14px rgba(0,0,0,.08);
    display: inline-flex; align-items: center; justify-content: center; color: var(--fg) !important;
    transition: transform .3s var(--spring);
  }
  .navbar .nb-btn { padding: 0 16px; font-size: 16px; }
  .navbar .nb-btn b { color: inherit !important; }
  .navbar .nb-left .nb-btn:has(svg) { width: 44px; padding: 0; }
  .navbar .nb-left .nb-btn:has(svg) span { display: none; }
  .navbar .nb-left .nb-btn svg { margin: 0 2px 0 0; }
  .navbar .nb-right button.nb-btn { background: var(--accent, var(--ink)) !important; color: #fff !important; }
  .navbar .nb-add, .navbar .bell { width: 44px; padding: 0; }
  .navbar .switcher { padding: 0 14px 0 5px; gap: 8px; }
  .navbar .bell .badge { position: absolute; top: -2px; right: -2px; }
  .navbar .nb-btn:active, .navbar .nb-add:active, .navbar .bell:active, .navbar .switcher:active { transform: scale(.92); opacity: 1; }

  /* Sheets float above the screen edge as glass panels */
  .scrim { background: rgba(0,0,0,.28); }
  .scrim .sheet {
    margin: 0 8px max(8px, var(--safe-b)); border-radius: 34px; padding-bottom: 18px;
    background: var(--glass-tint-strong) !important; -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
    box-shadow: var(--glass-rim), 0 20px 60px rgba(0,0,0,.25);
  }
  .sheet .rows { background: var(--lens); }
  [data-theme="light"] .sheet .rows { background: rgba(255,255,255,.7); }
  .action-sheet .grp { border-radius: 26px; }

  .offline-bar { bottom: calc(84px + max(10px, calc(var(--safe-b) - 4px))); }
}

.offline-bar { background: var(--glass-tint-strong); color: var(--fg); -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter); box-shadow: var(--glass-rim), var(--glass-shadow); }

/* Browsers without backdrop blur: keep text readable */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass-tint: rgba(250,250,252,.96); --glass-tint-strong: rgba(250,250,252,.98); }
  [data-theme="dark"] { --glass-tint: rgba(36,36,38,.96); --glass-tint-strong: rgba(30,30,32,.98); }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --glass-tint: rgba(250,250,252,.97); --glass-tint-strong: rgba(250,250,252,.98); }
  [data-theme="dark"] { --glass-tint: rgba(36,36,38,.97); --glass-tint-strong: rgba(30,30,32,.98); }
}
@media (max-width: 899px) {
  /* until the small title appears, the profile switcher may use its space */
  .navbar:not(.scrolled) { grid-template-columns: minmax(0, 1fr) 0 auto; }
  .navbar:not(.scrolled) .nb-title { padding: 0; }
  .navbar .switcher { max-width: 100%; min-width: 0; }
  .navbar .switcher b { max-width: none; min-width: 0; }
}


/* =====================================================================================
   DateKeeper 1.3.8 — refined iOS-inspired experience
   Visual-only layer: no routes, event handlers, data contracts or business rules changed.
   ===================================================================================== */
:root {
  --bg: #F4F6FA;
  --bg-elev: #FFFFFF;
  --bg-side: rgba(255,255,255,.72);
  --line: rgba(26,48,79,.09);
  --line-2: rgba(26,48,79,.055);
  --field: #D6DCE6;
  --fg: #172235;
  --fg-2: #34445C;
  --fg-3: #748197;
  --fg-4: #9AA5B5;
  --accent: #0878F9;
  --accent-soft: rgba(8,120,249,.10);
  --r-card: 24px;
  --r-ctl: 14px;
  --shadow: 0 2px 8px rgba(25,48,80,.035), 0 12px 32px rgba(25,48,80,.055);
  --shadow-lg: 0 24px 70px rgba(8,24,48,.22);
  --glass-tint: rgba(255,255,255,.68);
  --glass-tint-strong: rgba(250,252,255,.88);
  --glass-filter: blur(26px) saturate(185%);
  --glass-rim: inset 0 .7px 0 rgba(255,255,255,.95), inset 0 0 0 .7px rgba(28,55,90,.07);
  --glass-shadow: 0 12px 34px rgba(20,44,78,.12), 0 2px 7px rgba(20,44,78,.05);
  --lens: rgba(8,120,249,.095);
}
[data-theme="dark"] {
  --bg: #090D14;
  --bg-elev: #151C27;
  --bg-side: rgba(19,27,39,.78);
  --line: rgba(220,232,250,.10);
  --line-2: rgba(220,232,250,.06);
  --field: #3A4658;
  --fg: #F1F5FB;
  --fg-2: #D2DCEB;
  --fg-3: #98A6B9;
  --fg-4: #738197;
  --accent: #3995FF;
  --accent-soft: rgba(57,149,255,.16);
  --shadow: 0 2px 8px rgba(0,0,0,.2), 0 14px 36px rgba(0,0,0,.22);
  --glass-tint: rgba(27,37,52,.68);
  --glass-tint-strong: rgba(20,29,42,.90);
  --glass-rim: inset 0 .7px 0 rgba(255,255,255,.17), inset 0 0 0 .7px rgba(255,255,255,.07);
  --glass-shadow: 0 14px 38px rgba(0,0,0,.38), 0 2px 8px rgba(0,0,0,.24);
  --lens: rgba(100,170,255,.16);
}
body {
  background:
    radial-gradient(1000px 650px at -12% -12%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 64%),
    radial-gradient(760px 560px at 112% 100%, rgba(88,86,214,.055), transparent 66%),
    var(--bg);
  background-attachment: fixed;
}
.main { max-width: 1320px; padding-top: 30px; }
.page { gap: 24px; }
.title { letter-spacing: -.035em; font-size: 36px; }
.eyebrow { letter-spacing: .012em; }
.card, .stat {
  border-color: var(--line);
  box-shadow: var(--shadow);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.card { border-radius: 24px; padding: 24px; }
.card.tight { padding: 20px 22px; }
.card-head .h, h2.h { letter-spacing: -.015em; }
.stat { border-radius: 22px; padding: 20px; background: var(--bg-elev); }
.stat .v { font-size: 36px; letter-spacing: -.045em; }
.stat .st-ic { width: 36px; height: 36px; border-radius: 13px; margin-bottom: 6px; }
.stat.c-blue .st-ic { background: rgba(8,120,249,.12); color: #0878F9; }
.stat.c-orange .st-ic { background: rgba(255,159,10,.15); color: #C77900; }
.stat.c-red .st-ic { background: rgba(255,59,48,.12); color: #E33B32; }
.stat.c-green .st-ic { background: rgba(48,209,88,.14); color: #159447; }
.stat.c-blue .v, .stat.c-green .v, .stat.c-orange.warn .v, .stat.c-red.bad .v { color: var(--fg); }
.stat .k { color: var(--fg-2); font-weight: 600; }
.stat .s { color: var(--fg-3); line-height: 1.35; }
.btn { border-radius: 14px; transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s, background .18s; }
.btn.primary { background: var(--accent); border-color: var(--accent); box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 20%, transparent); }
.btn.primary:active, .fab:active { transform: scale(.96); }
.input, select.input, textarea.input { border-radius: 13px; border-color: var(--line); background: var(--bg-elev); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.chip { border-radius: 18px; }
.row { padding-top: 14px; padding-bottom: 14px; }
.row-title { letter-spacing: -.01em; }
.datebox { border-radius: 15px; }
.pill { border-radius: 10px; }
.cal { border-radius: 22px; }
.cal-cell { transition: background .16s ease; }
.cal-cell[aria-selected="true"] { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 12px; }
.scrim { backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.sheet { border-radius: 26px; }
.sidebar { border-radius: 26px; }

/* Dashboard: clear hierarchy, generous spacing, restrained colour. */
.dk-dashboard { gap: 22px; }
.dk-dashboard-heading { display: flex; flex-direction: column; gap: 3px; }
.dk-greeting { color: var(--fg-2); font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.dk-dashboard .page-head { align-items: flex-end; }
.dk-dashboard .eyebrow { margin-top: 3px; margin-bottom: 5px; }
.dk-dashboard .stats { gap: 14px; }
.dk-dashboard .card.hero {
  background: linear-gradient(145deg, #102744 0%, #123F78 58%, #0878F9 125%);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 16px 38px rgba(10,54,108,.20);
}
.dk-dashboard .card.hero .h { font-size: 18px; }
.dk-dashboard .today-row { border: 1px solid rgba(255,255,255,.09); border-radius: 15px; padding: 12px; background: rgba(255,255,255,.105); }
.dk-dashboard .today-row .row-title { font-size: 15px; }
.dk-dashboard .today-row .check { border-color: rgba(255,255,255,.7); }
.dk-dashboard .dk-upcoming-card .strip { height: 50px; gap: 5px; }
.dk-dashboard .dk-upcoming-card .strip span { border-radius: 5px; }
.dk-dashboard .dk-upcoming-card .rows { margin-top: 2px; }
.dk-dashboard .dk-upcoming-card .row:first-child { padding-top: 4px; }
.dk-dashboard .col-side .card { gap: 12px; }
.dk-dashboard .col-side .card.tight { padding: 20px; }
.dk-dashboard .profile-row { border-radius: 12px; }

/* More native-feeling floating navigation and safe-area behaviour. */
.tabbar { border: 1px solid rgba(255,255,255,.52) !important; }
.fab {
  border-radius: 19px;
  background: linear-gradient(145deg, #2991FF, #0067E8);
  box-shadow: 0 10px 24px rgba(0,103,232,.28), inset 0 .7px 0 rgba(255,255,255,.35);
  transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s;
}
.fab:active { box-shadow: 0 5px 14px rgba(0,103,232,.22); }
.navbar .nb-add { background: linear-gradient(145deg, #2991FF, #0067E8) !important; color: white !important; }
.navbar .bell, .navbar .switcher { border: 1px solid rgba(255,255,255,.28) !important; }

@media (min-width: 900px) {
  .shell { gap: 10px; }
  .main { padding-left: 34px; padding-right: 36px; }
  .sidebar { margin-left: 12px; }
  .stat:hover, .card:not(.hero):hover { box-shadow: 0 4px 14px rgba(25,48,80,.055), 0 16px 38px rgba(25,48,80,.075); }
}
@media (max-width: 899px) {
  .main { padding: 10px 16px calc(118px + var(--safe-b)); }
  .page { gap: 19px; }
  .title { font-size: 32px; }
  .dk-dashboard { gap: 18px; }
  .dk-dashboard .page-head { align-items: flex-start; }
  .dk-dashboard .dk-greeting { font-size: 14px; }
  .dk-dashboard .stats { gap: 10px; }
  .dk-dashboard .stat { min-height: 126px; padding: 15px; border-radius: 19px; }
  .dk-dashboard .stat .v { font-size: 32px; }
  .dk-dashboard .stat .st-ic { width: 33px; height: 33px; border-radius: 12px; }
  .card { padding: 18px; border-radius: 21px; }
  .dk-dashboard .card.hero { border-radius: 23px; }
  .dk-dashboard .today-row { gap: 9px; }
  .dk-dashboard .today-row .t { width: 56px; font-size: 12px; }
  .tabbar {
    left: 16px; right: 16px; bottom: max(12px, calc(var(--safe-b) + 6px));
    height: 68px; border-radius: 25px;
    background: var(--glass-tint-strong) !important;
    border: 1px solid rgba(255,255,255,.52) !important;
    box-shadow: var(--glass-rim), 0 12px 36px rgba(15,35,65,.17);
  }
  .tabbar .tb-lens { border-radius: 20px; }
  .tabbar a { gap: 2px; font-size: 10px; }
  .tabbar a svg { width: 23px; height: 23px; }
  .fab { right: 19px; bottom: calc(94px + var(--safe-b)); width: 54px; height: 54px; border-radius: 18px; }
  .scrim .sheet { border-radius: 28px; }
  .sheet h3 { text-align: left; }
  .cal-cell { min-height: 52px; }
}
@media (max-width: 380px) {
  .main { padding-left: 12px; padding-right: 12px; }
  .dk-dashboard .stat { padding: 12px; min-height: 118px; }
  .dk-dashboard .stat .v { font-size: 29px; }
  .tabbar { left: 10px; right: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


/* DateKeeper 1.3.9 — compact, balanced iPhone top toolbar */
@media (max-width: 899px) {
  .navbar {
    grid-template-columns: minmax(0, 1fr) 0 auto !important;
    min-height: calc(54px + var(--safe-t)) !important;
    padding: var(--safe-t) 14px 7px !important;
    margin-left: -16px !important;
    margin-right: -16px !important;
    align-items: center !important;
  }
  .navbar .nb-left { min-width: 0; overflow: hidden; }
  .navbar .nb-right { flex: none; gap: 9px !important; margin-left: 10px; }
  .navbar .switcher {
    height: 42px !important;
    min-height: 42px !important;
    max-width: min(100%, calc(100vw - 142px)) !important;
    min-width: 0 !important;
    padding: 0 12px 0 5px !important;
    gap: 8px !important;
    border-radius: 21px !important;
    background: rgba(255,255,255,.72) !important;
    border: 1px solid rgba(255,255,255,.76) !important;
    box-shadow: 0 3px 12px rgba(25,45,75,.07), inset 0 .6px 0 rgba(255,255,255,.95) !important;
    justify-content: flex-start !important;
  }
  [data-theme="dark"] .navbar .switcher {
    background: rgba(45,45,48,.78) !important;
    border-color: rgba(255,255,255,.12) !important;
  }
  .navbar .switcher .avatar { width: 29px !important; height: 29px !important; font-size: 11px !important; }
  .navbar .switcher b {
    display: block !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 14px !important;
    line-height: 1 !important;
    font-weight: 650 !important;
  }
  .navbar .switcher > svg { width: 13px; height: 13px; flex: none; opacity: .7; }
  .navbar .nb-add, .navbar .bell {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    flex: none !important;
  }
  .navbar .nb-add {
    background: linear-gradient(145deg, #2991FF, #0067E8) !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,.35) !important;
    box-shadow: 0 5px 14px rgba(0,103,232,.22), inset 0 .7px 0 rgba(255,255,255,.35) !important;
  }
  .navbar .nb-add svg { width: 20px; height: 20px; }
  .navbar .bell {
    background: rgba(255,255,255,.70) !important;
    color: var(--fg) !important;
    border: 1px solid rgba(255,255,255,.76) !important;
    box-shadow: 0 3px 12px rgba(25,45,75,.07), inset 0 .6px 0 rgba(255,255,255,.95) !important;
  }
  [data-theme="dark"] .navbar .bell {
    background: rgba(45,45,48,.78) !important;
    border-color: rgba(255,255,255,.12) !important;
  }
  .navbar .bell svg { width: 20px !important; height: 20px !important; }
  .navbar .bell .badge { top: -3px !important; right: -3px !important; }
  .navbar.scrolled .switcher b, .navbar.scrolled .switcher > svg { display: none !important; }
  .navbar.scrolled .switcher { width: 42px !important; padding: 0 !important; justify-content: center !important; }
  .navbar.scrolled .nb-title { max-width: 42vw !important; }
}

/* DateKeeper 1.3.10 — stable iPhone profile toolbar layout.
   Keep the selected profile visible while scrolling; reserve fixed space for actions. */
@media (max-width: 899px) {
  .navbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    column-gap: 10px !important;
    min-height: calc(58px + var(--safe-t)) !important;
    padding: var(--safe-t) 12px 8px !important;
    align-items: center !important;
    background: rgba(244,246,250,.96) !important;
    -webkit-backdrop-filter: saturate(180%) blur(22px) !important;
    backdrop-filter: saturate(180%) blur(22px) !important;
    border-bottom: 1px solid rgba(25,42,68,.07) !important;
    overflow: visible !important;
  }
  [data-theme="dark"] .navbar {
    background: rgba(20,22,26,.96) !important;
    border-bottom-color: rgba(255,255,255,.09) !important;
  }
  .navbar .nb-left {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
  }
  .navbar .nb-title { display: none !important; }
  .navbar .nb-right {
    display: flex !important;
    flex: none !important;
    width: auto !important;
    min-width: max-content !important;
    gap: 8px !important;
    margin: 0 !important;
    justify-content: flex-end !important;
  }
  .navbar .switcher {
    box-sizing: border-box !important;
    display: flex !important;
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 12px 0 6px !important;
    gap: 9px !important;
    justify-content: flex-start !important;
    overflow: hidden !important;
    border-radius: 23px !important;
  }
  .navbar .switcher .avatar {
    display: inline-flex !important;
    flex: 0 0 30px !important;
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
  }
  .navbar .switcher b {
    display: block !important;
    flex: 1 1 auto !important;
    width: 1px !important;
    min-width: 0 !important;
    max-width: none !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
  }
  .navbar .switcher > svg {
    display: block !important;
    flex: 0 0 13px !important;
    width: 13px !important;
    height: 13px !important;
    margin: 0 !important;
  }
  .navbar .nb-add, .navbar .bell {
    box-sizing: border-box !important;
    display: inline-flex !important;
    flex: 0 0 42px !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    margin: 0 !important;
    padding: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
  }
  .navbar.scrolled .switcher,
  .navbar.scrolled .switcher b,
  .navbar.scrolled .switcher > svg {
    display: flex !important;
    width: 100% !important;
    padding-right: 12px !important;
  }
  .navbar.scrolled .switcher b { display: block !important; }
  .navbar.scrolled .nb-title { display: none !important; }
}

@media (max-width: 360px) {
  .navbar { column-gap: 7px !important; padding-left: 9px !important; padding-right: 9px !important; }
  .navbar .nb-right { gap: 6px !important; }
  .navbar .nb-add, .navbar .bell { flex-basis: 40px !important; width: 40px !important; min-width: 40px !important; height: 40px !important; min-height: 40px !important; }
  .navbar .switcher b { font-size: 13px !important; }
}


/* DateKeeper 1.3.11 — identical profile control in normal and sticky states.
   Keep width/flex rules on the switcher itself; never stretch its label or chevron to 100%. */
@media (max-width: 899px) {
  .navbar .nb-left { min-width: 0 !important; overflow: visible !important; }
  .navbar .switcher,
  .navbar.scrolled .switcher {
    box-sizing: border-box !important;
    display: flex !important;
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 56px !important;
    min-height: 56px !important;
    padding: 0 14px 0 6px !important;
    gap: 10px !important;
    align-items: center !important;
    justify-content: flex-start !important;
    overflow: hidden !important;
    border-radius: 28px !important;
  }
  .navbar .switcher .avatar,
  .navbar.scrolled .switcher .avatar {
    box-sizing: border-box !important;
    display: inline-flex !important;
    flex: 0 0 42px !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    border: 3px solid rgba(255,255,255,.96) !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    font-size: 13px !important;
    line-height: 1 !important;
    box-shadow: 0 1px 4px rgba(20,35,60,.12) !important;
  }
  .navbar .switcher .avatar img { display: block !important; width: 100% !important; height: 100% !important; object-fit: cover !important; border-radius: 50% !important; }
  .navbar .switcher b,
  .navbar.scrolled .switcher b {
    display: block !important;
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 15px !important;
    line-height: 1.2 !important;
    font-weight: 650 !important;
  }
  .navbar .switcher > svg,
  .navbar.scrolled .switcher > svg {
    display: block !important;
    flex: 0 0 14px !important;
    width: 14px !important;
    min-width: 14px !important;
    height: 14px !important;
    margin: 0 !important;
    opacity: .72 !important;
  }
  /* Scrolling must not collapse the profile name, avatar ring or dropdown. */
  .navbar.scrolled .switcher { padding-right: 14px !important; }
  .navbar.scrolled .switcher b { display: block !important; }
  .navbar.scrolled .switcher > svg { display: block !important; }
}
@media (max-width: 360px) {
  .navbar .switcher, .navbar.scrolled .switcher { gap: 7px !important; padding-right: 10px !important; }
  .navbar .switcher .avatar, .navbar.scrolled .switcher .avatar { flex-basis: 38px !important; width: 38px !important; min-width: 38px !important; height: 38px !important; min-height: 38px !important; }
  .navbar .switcher b, .navbar.scrolled .switcher b { font-size: 14px !important; }
}


/* DateKeeper 1.3.13 — airy, cyan-accented reminder dashboard inspired by the supplied reference. */
.dk-reference-style { gap: 20px; }
.dk-reference-head { align-items: flex-end; }
.dk-reference-head .title { letter-spacing: -.035em; }
.dk-reference-style .dk-greeting { font-size: 17px; font-weight: 650; color: var(--fg-2); }
.dk-reference-style .eyebrow { font-size: 14px; }
.dk-head-tools { flex: 1 1 300px; justify-content: flex-end; }
.dk-search { width: min(100%, 360px); height: 48px; border-radius: 17px; background: var(--bg-elev); box-shadow: 0 5px 18px rgba(31,69,110,.045); }
.dk-filter-chips { display:flex; gap:9px; overflow-x:auto; padding:2px 1px 5px; scrollbar-width:none; }
.dk-filter-chips::-webkit-scrollbar { display:none; }
.dk-filter-chips .chip { height:38px; border:0; background:var(--bg-elev); box-shadow:0 3px 12px rgba(31,69,110,.055); padding:0 17px; border-radius:20px; }
.dk-filter-chips .chip[aria-pressed="true"] { background:linear-gradient(135deg,#65c9e8,#39a9d5); color:#fff; box-shadow:0 6px 16px rgba(57,169,213,.2); }
.dk-next-card { display:flex; align-items:center; gap:15px; min-width:0; padding:17px 20px; border-radius:23px; color:#16324a; background:linear-gradient(112deg,#e5f7fc 0%,#d9f0f9 55%,#edf8fc 100%); border:1px solid rgba(93,185,218,.17); box-shadow:0 9px 26px rgba(34,110,150,.08); }
.dk-next-card:active { transform:scale(.995); }
.dk-next-icon { width:48px; height:48px; flex:0 0 48px; border-radius:16px; display:flex; align-items:center; justify-content:center; color:#1689ba; background:rgba(255,255,255,.72); box-shadow:inset 0 1px 0 rgba(255,255,255,.8); }
.dk-next-copy { display:flex; flex-direction:column; gap:3px; min-width:0; flex:1; }
.dk-next-label,.dk-section-kicker { font-size:10px; line-height:1.2; letter-spacing:.105em; text-transform:uppercase; font-weight:750; color:#3986a5; }
.dk-next-copy strong { font-size:17px; line-height:1.25; font-weight:750; color:#17334c; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dk-next-copy small { font-size:12px; color:#5f8094; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dk-next-side { display:flex; flex-direction:column; align-items:flex-end; gap:5px; flex:none; }
.dk-next-side b { font-size:13px; color:#267da6; }
.dk-next-side .pill { height:23px; font-size:11px; }
.dk-next-empty { background:linear-gradient(112deg,#eaf8f4,#e5f5fb); }
.dk-next-empty .dk-next-icon { color:#27a47d; }
.dk-dashboard .stat { border:0; border-radius:21px; box-shadow:0 8px 24px rgba(31,69,110,.055); padding:19px 20px; }
.dk-dashboard .stat .st-ic { width:38px; height:38px; border-radius:13px; }
.dk-dashboard .stat .k { font-size:14px; }
.dk-dashboard .stat .v { font-size:35px; }
.dk-dashboard .card:not(.hero) { border:0; box-shadow:0 9px 28px rgba(31,69,110,.055); border-radius:23px; }
.dk-dashboard .dk-upcoming-card { gap:17px; }
.dk-dashboard .dk-upcoming-card .card-head { align-items:center; }
.dk-dashboard .dk-upcoming-card .h { font-size:21px; letter-spacing:-.025em; }
.dk-dashboard .dk-upcoming-card .dk-section-kicker { margin-bottom:4px; }
.dk-dashboard .dk-upcoming-card .row { padding:14px 0; }
.dk-dashboard .dk-upcoming-card .datebox { background:#e8f2ff; color:#1678cf; border-radius:14px; }
.dk-dashboard .dk-upcoming-card .datebox .m { color:#2588d4; }
.dk-dashboard .dk-upcoming-card .datebox .d { color:#1b2d42; }
.dk-dashboard .dk-expired-card { gap:12px !important; }
.dk-dashboard .dk-expired-card .h { font-size:18px; }
.dk-dashboard .dk-today-card { background:linear-gradient(115deg,#143557,#1766a9) !important; }
.dk-dashboard .card.hero .sub { color:rgba(255,255,255,.78); }
.dk-dashboard .today-row { background:rgba(255,255,255,.11); }
[data-theme="dark"] .dk-next-card { background:linear-gradient(112deg,#18374a,#1c4256); border-color:rgba(90,180,220,.15); color:#eaf7ff; }
[data-theme="dark"] .dk-next-copy strong { color:#f3f9ff; }
[data-theme="dark"] .dk-next-copy small, [data-theme="dark"] .dk-next-label { color:#a9cddd; }
[data-theme="dark"] .dk-next-side b { color:#8fd8f4; }
[data-theme="dark"] .dk-next-icon { background:rgba(255,255,255,.09); color:#82d6f3; }
@media (max-width:899px) {
  .dk-reference-style { gap:17px; }
  .dk-reference-head { gap:12px; }
  .dk-reference-head .title { font-size:31px; }
  .dk-reference-style .dk-greeting { font-size:15px; }
  .dk-reference-style .eyebrow { font-size:12px; }
  .dk-head-tools { display:block; width:100%; flex:1 1 100%; }
  .dk-search { display:flex !important; width:100%; height:49px; border-radius:17px; padding:0 16px; }
  .dk-filter-chips { margin-right:-16px; padding-right:16px; }
  .dk-next-card { padding:15px; gap:11px; border-radius:20px; }
  .dk-next-icon { width:43px; height:43px; flex-basis:43px; border-radius:14px; }
  .dk-next-copy strong { font-size:15px; }
  .dk-next-copy small { font-size:11px; }
  .dk-next-side .pill { max-width:90px; overflow:hidden; }
  .dk-dashboard .stats { gap:10px; }
  .dk-dashboard .stat { min-height:116px; padding:14px; border-radius:19px; }
  .dk-dashboard .stat .st-ic { width:34px; height:34px; }
  .dk-dashboard .stat .v { font-size:30px; }
  .dk-dashboard .stat .k { font-size:12px; }
  .dk-dashboard .stat .s { font-size:11px; }
  .dk-dashboard .dk-upcoming-card .h { font-size:19px; }
}
@media (max-width:380px) {
  .dk-next-card { padding:12px; gap:8px; }
  .dk-next-icon { width:38px; height:38px; flex-basis:38px; }
  .dk-next-copy strong { font-size:14px; }
  .dk-next-side b { font-size:11px; }
}

/* DateKeeper 1.3.14 — glassmorphism system inspired by the supplied visual reference.
   Translucent surfaces, backdrop blur, fine light rims and layered depth. */
:root {
  --glass-panel: rgba(255,255,255,.58);
  --glass-panel-strong: rgba(255,255,255,.76);
  --glass-panel-soft: rgba(255,255,255,.38);
  --glass-line: rgba(255,255,255,.72);
  --glass-blur: blur(24px) saturate(175%);
  --glass-card-shadow: 0 12px 34px rgba(35,73,120,.09), 0 2px 8px rgba(35,73,120,.045), inset 0 1px 0 rgba(255,255,255,.78);
  --glass-control-shadow: 0 7px 22px rgba(35,73,120,.085), inset 0 1px 0 rgba(255,255,255,.86);
  --glass-accent: rgba(66,169,224,.14);
}
[data-theme="dark"] {
  --glass-panel: rgba(31,39,56,.62);
  --glass-panel-strong: rgba(24,30,44,.82);
  --glass-panel-soft: rgba(37,49,69,.48);
  --glass-line: rgba(255,255,255,.15);
  --glass-card-shadow: 0 14px 38px rgba(0,0,0,.28), 0 2px 8px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.12);
  --glass-control-shadow: 0 8px 24px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.12);
  --glass-accent: rgba(70,160,245,.18);
}

html { background: var(--bg); }
body {
  background:
    radial-gradient(ellipse 78% 48% at 4% 0%, rgba(95,190,235,.22), transparent 72%),
    radial-gradient(ellipse 62% 45% at 96% 12%, rgba(151,133,229,.16), transparent 72%),
    radial-gradient(ellipse 70% 50% at 52% 100%, rgba(92,177,218,.13), transparent 75%),
    linear-gradient(145deg, #f7fbff 0%, #edf4fb 48%, #f5f2fb 100%);
  background-attachment: fixed;
}
[data-theme="dark"] body {
  background:
    radial-gradient(ellipse 78% 48% at 4% 0%, rgba(37,103,151,.24), transparent 72%),
    radial-gradient(ellipse 62% 45% at 96% 12%, rgba(91,68,151,.19), transparent 72%),
    linear-gradient(145deg, #101827 0%, #111b2c 48%, #171629 100%);
  background-attachment: fixed;
}

/* Main reusable glass surfaces */
.card, .stat, .searchbox, .input, select.input, textarea.input,
.chip, .seg, .side-foot, .switcher, .navbar .switcher,
.navbar .bell, .navbar .nb-btn, .navbar .nb-add,
.scrim .sheet, .modal, .dialog, .action-sheet .grp,
.toast, .profile-row, .dk-next-card {
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}
.card, .stat {
  background: var(--glass-panel) !important;
  border: 1px solid var(--glass-line) !important;
  box-shadow: var(--glass-card-shadow);
}
.card.hero, .dk-dashboard .card.hero, .dk-dashboard .dk-today-card {
  background:
    linear-gradient(128deg, rgba(47,116,190,.78), rgba(69,103,190,.66) 52%, rgba(94,155,207,.68)),
    var(--glass-panel) !important;
  border: 1px solid rgba(255,255,255,.48) !important;
  box-shadow: 0 18px 42px rgba(37,91,153,.20), inset 0 1px 0 rgba(255,255,255,.35);
  color: #fff;
}
.card.hero .sub, .dk-dashboard .card.hero .sub { color: rgba(255,255,255,.86); }
.card.hero .today-row, .dk-dashboard .today-row { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.2); }
.stat { background: var(--glass-panel-strong) !important; }
.dk-dashboard .stat { background: var(--glass-panel-strong) !important; box-shadow: var(--glass-card-shadow); }
.dk-dashboard .card:not(.hero) { background: var(--glass-panel) !important; box-shadow: var(--glass-card-shadow); }

/* Frosted controls and filters */
.searchbox, .dk-search {
  background: var(--glass-panel-strong) !important;
  border: 1px solid var(--glass-line) !important;
  box-shadow: var(--glass-control-shadow);
}
.input, select.input, textarea.input {
  background: var(--glass-panel-strong) !important;
  border-color: var(--glass-line) !important;
  box-shadow: inset 0 1px 2px rgba(40,70,110,.035);
}
.chip { background: var(--glass-panel) !important; border: 1px solid var(--glass-line) !important; box-shadow: 0 4px 14px rgba(35,73,120,.055); }
.chip[aria-pressed="true"], .chip.on {
  background: linear-gradient(135deg, rgba(72,180,225,.92), rgba(62,133,213,.94)) !important;
  color: #fff !important; border-color: rgba(255,255,255,.58) !important;
  box-shadow: 0 7px 20px rgba(47,137,202,.22), inset 0 1px 0 rgba(255,255,255,.38);
}
.seg { background: var(--glass-panel-soft); border: 1px solid var(--glass-line); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
.seg button[aria-pressed="true"] { background: var(--glass-panel-strong); box-shadow: var(--glass-control-shadow); }
.btn:not(.primary):not(.danger) { background: var(--glass-panel-strong); border-color: var(--glass-line); box-shadow: 0 3px 12px rgba(35,73,120,.045); }
.btn.primary, .navbar .nb-add, .fab { box-shadow: 0 9px 24px rgba(34,128,216,.25), inset 0 1px 0 rgba(255,255,255,.4); }

/* App chrome: floating translucent sidebar, header and bottom navigation */
.sidebar, .tabbar, .navbar {
  background: var(--glass-panel-strong) !important;
  border: 1px solid var(--glass-line) !important;
  -webkit-backdrop-filter: var(--glass-blur) !important;
  backdrop-filter: var(--glass-blur) !important;
  box-shadow: var(--glass-card-shadow);
}
.sidebar { border-radius: 26px; }
.sidebar .switcher { background: var(--glass-panel-soft); border: 1px solid var(--glass-line); }
.side-foot { background: var(--glass-panel-soft); border: 1px solid var(--glass-line); }
.nav a[aria-current="page"] { background: linear-gradient(120deg, rgba(72,180,225,.20), rgba(82,142,221,.13)); box-shadow: inset 0 1px 0 rgba(255,255,255,.58); }
.navbar .switcher, .navbar .bell, .navbar .nb-btn {
  background: var(--glass-panel-strong) !important; border: 1px solid var(--glass-line) !important;
  box-shadow: var(--glass-control-shadow);
}
.navbar .nb-add { border: 1px solid rgba(255,255,255,.5) !important; }
.tabbar { border-radius: 26px !important; }
.tabbar .tb-lens { background: linear-gradient(135deg, rgba(106,198,235,.25), rgba(112,157,232,.2)); border: 1px solid rgba(255,255,255,.52); box-shadow: inset 0 1px 0 rgba(255,255,255,.65); }

/* Floating next-date feature gets a proper frosted-glass lens */
.dk-next-card {
  background: linear-gradient(118deg, rgba(220,245,255,.76), rgba(224,231,255,.60) 58%, rgba(247,231,255,.58)) !important;
  border: 1px solid rgba(255,255,255,.82) !important;
  box-shadow: 0 14px 34px rgba(49,111,165,.12), inset 0 1px 0 rgba(255,255,255,.9);
}
.dk-next-icon { background: rgba(255,255,255,.58) !important; border: 1px solid rgba(255,255,255,.7); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
[data-theme="dark"] .dk-next-card { background: linear-gradient(118deg, rgba(35,82,108,.78), rgba(55,65,115,.72) 58%, rgba(84,55,105,.62)) !important; border-color: rgba(255,255,255,.18) !important; }

/* Frosted modal sheets, notifications and list separators */
.scrim .sheet, .modal, .dialog { background: var(--glass-panel-strong) !important; border: 1px solid var(--glass-line) !important; box-shadow: 0 24px 70px rgba(16,40,75,.24), inset 0 1px 0 rgba(255,255,255,.7); }
.row { border-color: rgba(115,145,180,.14); }
.datebox { background: rgba(255,255,255,.48); border: 1px solid rgba(255,255,255,.62); }
.pill { box-shadow: inset 0 1px 0 rgba(255,255,255,.45); }

[data-theme="dark"] .card, [data-theme="dark"] .stat,
[data-theme="dark"] .searchbox, [data-theme="dark"] .dk-search,
[data-theme="dark"] .input, [data-theme="dark"] select.input,
[data-theme="dark"] textarea.input, [data-theme="dark"] .chip,
[data-theme="dark"] .sidebar, [data-theme="dark"] .tabbar,
[data-theme="dark"] .navbar, [data-theme="dark"] .scrim .sheet {
  border-color: var(--glass-line) !important;
}

@media (max-width: 899px) {
  .navbar { background: var(--glass-panel-strong) !important; border-left: 0 !important; border-right: 0 !important; border-top: 0 !important; border-radius: 0 0 22px 22px; box-shadow: 0 8px 24px rgba(35,73,120,.075); }
  .tabbar { background: var(--glass-panel-strong) !important; }
  .card, .stat { box-shadow: 0 9px 26px rgba(35,73,120,.075), inset 0 1px 0 rgba(255,255,255,.78); }
}
@media (prefers-reduced-transparency: reduce) {
  .card, .stat, .searchbox, .dk-search, .input, select.input, textarea.input,
  .chip, .sidebar, .tabbar, .navbar, .scrim .sheet, .modal, .dialog {
    -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
    background: var(--bg-elev) !important;
  }
}

/* DateKeeper 1.3.15 — stronger glass.
   Glass only reads as glass when there is colour behind it to blur, so a fixed field of soft
   colour orbs now sits under the app, panels are more transparent, and every glass surface gets
   a specular sheen plus a light-catching gradient rim. */
:root {
  --glass-panel: rgba(255,255,255,.36);
  --glass-panel-strong: rgba(255,255,255,.50);
  --glass-panel-soft: rgba(255,255,255,.28);
  --glass-line: rgba(255,255,255,.62);
  --glass-blur: blur(30px) saturate(200%) brightness(1.04);
  --glass-card-shadow: 0 18px 44px rgba(31,64,112,.13), 0 3px 10px rgba(31,64,112,.06), inset 0 1px 0 rgba(255,255,255,.9), inset 0 -1px 0 rgba(255,255,255,.22);
  --glass-control-shadow: 0 10px 26px rgba(31,64,112,.11), inset 0 1px 0 rgba(255,255,255,.92);
  --glass-sheen-2: linear-gradient(155deg, rgba(255,255,255,.62) 0%, rgba(255,255,255,.18) 26%, rgba(255,255,255,0) 48%, rgba(255,255,255,0) 72%, rgba(255,255,255,.16) 100%);
  --glass-rim-2: linear-gradient(150deg, rgba(255,255,255,.98), rgba(255,255,255,.28) 38%, rgba(255,255,255,.08) 62%, rgba(255,255,255,.55));
  --orb-1: rgba(64,165,255,.58);
  --orb-2: rgba(150,110,255,.46);
  --orb-3: rgba(50,210,220,.42);
  --orb-4: rgba(255,130,185,.32);
  --orb-5: rgba(110,140,255,.34);
}
[data-theme="dark"] {
  --glass-panel: rgba(28,36,54,.46);
  --glass-panel-strong: rgba(22,29,45,.62);
  --glass-panel-soft: rgba(40,52,74,.34);
  --glass-line: rgba(255,255,255,.14);
  --glass-blur: blur(30px) saturate(180%) brightness(.96);
  --glass-card-shadow: 0 18px 46px rgba(0,0,0,.38), 0 3px 10px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.14);
  --glass-control-shadow: 0 10px 26px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.14);
  --glass-sheen-2: linear-gradient(155deg, rgba(255,255,255,.13) 0%, rgba(255,255,255,.03) 30%, rgba(255,255,255,0) 55%, rgba(255,255,255,.04) 100%);
  --glass-rim-2: linear-gradient(150deg, rgba(255,255,255,.34), rgba(255,255,255,.06) 40%, rgba(255,255,255,.02) 62%, rgba(255,255,255,.16));
  --orb-1: rgba(40,110,230,.42);
  --orb-2: rgba(120,70,220,.36);
  --orb-3: rgba(20,150,170,.30);
  --orb-4: rgba(200,70,140,.20);
  --orb-5: rgba(70,90,220,.26);
}

/* Colour field behind the glass (body isolates so the field paints above its own background) */
body { isolation: isolate; }
body::before {
  content: ""; position: fixed; inset: -10vmax; z-index: -1; pointer-events: none;
  background:
    radial-gradient(circle at 12% 14%, var(--orb-1) 0, transparent 30vmax),
    radial-gradient(circle at 92% 22%, var(--orb-2) 0, transparent 28vmax),
    radial-gradient(circle at 70% 78%, var(--orb-3) 0, transparent 30vmax),
    radial-gradient(circle at 8% 88%, var(--orb-4) 0, transparent 26vmax),
    radial-gradient(circle at 20% 50%, var(--orb-5) 0, transparent 22vmax);
  filter: blur(18px);
}

/* Specular sheen + gradient rim on every glass panel */
.card, .stat, .searchbox, .dk-search, .dk-next-card { position: relative; isolation: isolate; }
.navbar, .tabbar, .sidebar { isolation: isolate; }
.card::before, .stat::before, .searchbox::before, .dk-next-card::before, .navbar::after, .tabbar::after, .sidebar::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: var(--glass-sheen-2);
}
.card::after, .stat::after, .searchbox::after, .dk-next-card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 0;
  padding: 1px; background: var(--glass-rim-2);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.card, .stat, .searchbox, .dk-search, .dk-next-card { border-color: transparent !important; }
.card.hero::before, .dk-dashboard .card.hero::before { background: linear-gradient(155deg, rgba(255,255,255,.30), rgba(255,255,255,0) 45%); }

/* Chrome floats over the colour with a stronger lens */
.navbar, .tabbar, .sidebar {
  background: var(--glass-panel) !important;
  -webkit-backdrop-filter: blur(34px) saturate(210%) !important; backdrop-filter: blur(34px) saturate(210%) !important;
  box-shadow: var(--glass-card-shadow) !important;
}
.chip { background: var(--glass-panel-soft) !important; box-shadow: var(--glass-control-shadow); }
.btn:not(.primary):not(.danger) { background: var(--glass-panel) !important; -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: var(--glass-control-shadow); }
.navbar .switcher, .navbar .bell, .navbar .nb-btn, .mtop .bell, .mtop .switcher { background: var(--glass-panel) !important; box-shadow: var(--glass-control-shadow) !important; }
.dk-next-card { background: linear-gradient(118deg, rgba(215,242,255,.52), rgba(222,228,255,.38) 58%, rgba(248,228,255,.36)) !important; }
.stat .st-ic, .dk-next-icon { box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 4px 10px rgba(31,64,112,.08); }

.scrim .sheet, .modal, .dialog { background: rgba(255,255,255,.74) !important; -webkit-backdrop-filter: blur(34px) saturate(200%); backdrop-filter: blur(34px) saturate(200%); }
[data-theme="dark"] .scrim .sheet, [data-theme="dark"] .modal, [data-theme="dark"] .dialog { background: rgba(22,29,45,.80) !important; }

@media (max-width: 899px) {
  .navbar { background: var(--glass-panel) !important; }
  .tabbar { background: var(--glass-panel) !important; }
  .card, .stat { box-shadow: 0 14px 34px rgba(31,64,112,.11), inset 0 1px 0 rgba(255,255,255,.88); }
  [data-theme="dark"] .card, [data-theme="dark"] .stat { box-shadow: 0 14px 34px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.12); }
}
@media (prefers-reduced-transparency: reduce) {
  body::before { display: none; }
  .card::before, .stat::before, .searchbox::before, .dk-next-card::before, .navbar::after, .tabbar::after, .sidebar::after,
  .card::after, .stat::after, .searchbox::after, .dk-next-card::after { display: none; }
  .btn:not(.primary):not(.danger) { background: var(--bg-elev) !important; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
