:root {
  --bg: #000; --s1: #0b0b0d; --s2: #141417; --s3: #1c1c20; --s4: #2a2a30;
  --line: rgba(255, 255, 255, .065); --line2: rgba(255, 255, 255, .11); --line3: rgba(255, 255, 255, .2);
  --tx: #f5f5f7; --tx2: #b4b4bb; --mut: #82828a; --dim: #56565d;
  --red: #ff453a;
  --work: #7aa2ff; --workout: #ff7a59; --health: #3fd39b; --mind: #a78bfa; --learn: #f5c451; --personal: #f472b6;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --gut: 58px;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--tx); }
body {
  font: 14px/1.45 var(--font); font-feature-settings: "cv11"; letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
  overflow: hidden; overscroll-behavior: none;
}
button { font: inherit; color: inherit; letter-spacing: inherit; background: none; border: 0; cursor: pointer; -webkit-user-select: none; user-select: none; }
input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 1.5px solid rgba(255, 255, 255, .45); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
* { scrollbar-width: thin; scrollbar-color: #2a2a30 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #232328; border-radius: 10px; border: 3px solid #000; }
::-webkit-scrollbar-track { background: transparent; }
body.dragging-now, body.dragging-now * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }

/* ---------- sign in ---------- */
#login { height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 300px; text-align: center; }
.login-icon { width: 72px; height: 72px; border-radius: 18px; box-shadow: 0 0 0 1px var(--line2); margin-bottom: 18px; }
.mark { font-size: 12px; letter-spacing: .5em; text-indent: .5em; color: var(--mut); margin-bottom: 30px; font-weight: 700; }
.login-card input { width: 100%; height: 52px; border-radius: 14px; background: var(--s2); border: 1px solid var(--line2); padding: 0 16px; text-align: center; font-size: 17px; outline: none; }
.login-card input:focus { border-color: var(--line3); }
.login-card button { margin-top: 10px; width: 100%; height: 52px; border-radius: 14px; background: #fff; color: #000; font-weight: 650; font-size: 15px; }
.login-err { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 14px; }

/* ---------- frame ---------- */
#app { display: flex; height: 100vh; height: 100dvh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.side { display: none; }

.top { flex: none; padding: calc(8px + env(safe-area-inset-top)) 16px 10px; border-bottom: 1px solid var(--line); background: #000; z-index: 7; }
.top-r1 { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px; }
.top .tt { min-width: 0; }
.top h1 { font-size: 27px; font-weight: 700; letter-spacing: -.035em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top h1 span { color: var(--mut); font-weight: 500; letter-spacing: -.02em; }
.top .sub { font-size: 13px; color: var(--mut); margin-top: 2px; font-weight: 500; white-space: nowrap; }
.top .sub b { color: var(--red); font-weight: 600; }
.nav { display: flex; align-items: center; gap: 6px; flex: none; }
.ib { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--tx2); transition: background .15s, color .15s; }
.ib:hover { background: var(--s3); color: var(--tx); }
.ib.sm { width: 26px; height: 26px; border-radius: 8px; }
.ib.sm svg { width: 15px; height: 15px; }
.pill { height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line3); font-weight: 600; font-size: 13px; transition: opacity .15s, background .15s; }
.pill:hover { background: var(--s3); }
.pill.dim { opacity: .45; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--s2); border-radius: 10px; padding: 2px; margin-top: 10px; }
.seg button { height: 30px; padding: 0 14px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--mut); transition: background .15s, color .15s; }
.seg button.on { background: var(--s4); color: var(--tx); box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }

.tabbar {
  flex: none; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); background: #000;
  padding: 6px 10px calc(4px + env(safe-area-inset-bottom)); z-index: 7;
}
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 3px 0; color: var(--dim); font-size: 10.5px; font-weight: 600; transition: color .15s; }
.tabbar button.on { color: var(--tx); }
.tabbar svg { width: 24px; height: 24px; stroke-width: 1.7; }

.fab {
  position: fixed; right: 18px; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 20; width: 56px; height: 56px; border-radius: 50%;
  background: #fff; color: #000; display: grid; place-items: center; box-shadow: 0 12px 30px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, .1); transition: transform .15s;
}
.fab:active { transform: scale(.93); }
.fab svg { width: 24px; height: 24px; stroke-width: 2.2; }
body.tab-habits .fab { display: none; }

/* ---------- week strip (phone day view) ---------- */
.strip { flex: none; display: grid; grid-template-columns: repeat(7, 1fr); padding: 6px 8px 2px; }
.sd { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 2px 0 4px; }
.sd span { font-size: 11px; font-weight: 600; color: var(--dim); }
.sd b { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; transition: background .15s; }
.sd.today b { color: var(--red); }
.sd.sel b { background: #fff; color: #000; }
.sd.sel.today b { background: var(--red); color: #fff; }
.sd i { width: 4px; height: 4px; border-radius: 50%; }
.sd i.has { background: var(--dim); }
.strip-date { flex: none; text-align: center; font-size: 13px; color: var(--tx2); padding: 2px 0 9px; border-bottom: 1px solid var(--line); font-weight: 500; }
.strip-date b { color: var(--red); font-weight: 600; }

/* ---------- time grid (day + week) ---------- */
.gscroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; position: relative; }
.g-sticky { position: sticky; top: 0; z-index: 6; background: #000; }
.g-head, .g-all, .grid { display: grid; }
.g-head { border-bottom: 1px solid var(--line); }
.g-day { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 0; font-size: 12px; color: var(--mut); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; min-width: 0; }
.g-day b { font-size: 20px; font-weight: 600; color: var(--tx); letter-spacing: -.02em; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 17px; display: grid; place-items: center; transition: background .15s; font-variant-numeric: tabular-nums; }
.g-day:hover b { background: var(--s3); }
.g-day.today { color: var(--red); }
.g-day.today b, .g-day.today:hover b { background: var(--red); color: #fff; }
.g-all { border-bottom: 1px solid var(--line); }
.g-all-l { font-size: 10.5px; color: var(--dim); display: flex; align-items: center; justify-content: flex-end; padding-right: 9px; font-weight: 500; }
.g-all-c { padding: 4px 2px; display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--line); min-width: 0; }
.grid { position: relative; z-index: 0; }
.gutter { position: relative; }
.gutter span { position: absolute; right: 9px; transform: translateY(-50%); font-size: 10.5px; color: var(--dim); font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.col { position: relative; border-left: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px var(--hh)); min-width: 0; }
.col.today { background-color: rgba(255, 255, 255, .014); }
.col.wkend { background-color: rgba(255, 255, 255, .008); }
.grid-end { height: 1px; }

.ev {
  position: absolute; display: flex; flex-direction: column; text-align: left; border-radius: 6px; padding: 3px 6px 3px 9px; overflow: hidden;
  background: color-mix(in srgb, var(--c) 22%, #0c0c0e); box-shadow: inset 3px 0 0 var(--c); color: #fff; z-index: 2; cursor: pointer;
  font-size: 12px; line-height: 1.28; transition: filter .12s, opacity .12s;
}
.ev:hover { filter: brightness(1.18); }
.ev .et { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev .em { color: color-mix(in srgb, var(--c) 50%, #fff); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; opacity: .9; }
.ev.tall .et { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.ev.short { flex-direction: row; align-items: center; gap: 6px; padding-top: 0; padding-bottom: 0; }
.ev.short .em { flex: none; }
.ev.past { opacity: .5; }
.ev.dragging { opacity: .22; }
.ev.ghost { pointer-events: none; z-index: 9; opacity: .95; box-shadow: inset 3px 0 0 var(--c), 0 10px 28px rgba(0, 0, 0, .65); outline: 1px solid color-mix(in srgb, var(--c) 55%, transparent); }
.ev .rz { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; cursor: ns-resize; }
.now { position: absolute; left: -1px; right: 0; height: 0; border-top: 2px solid var(--red); z-index: 5; pointer-events: none; }
.now::before { content: ""; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.now-lbl { position: absolute; right: 5px; transform: translateY(-50%); font-size: 10.5px; font-weight: 700; color: #fff; background: var(--red); padding: 1px 5px; border-radius: 6px; z-index: 6; font-variant-numeric: tabular-nums; white-space: nowrap; }

.chip { display: flex; align-items: center; gap: 6px; height: 22px; padding: 0 7px; border-radius: 5px; font-size: 12px; font-weight: 600; background: color-mix(in srgb, var(--c) 24%, #0c0c0e); box-shadow: inset 3px 0 0 var(--c); text-align: left; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip:hover { filter: brightness(1.18); }

/* ---------- month: big screens ---------- */
.mfull { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.m-dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); flex: none; }
.m-dow span { padding: 8px 10px; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--dim); text-align: right; }
.m-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.m-cell { position: relative; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 5px 5px 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0; min-height: 0; overflow: hidden; cursor: pointer; transition: background .12s; }
.m-cell:nth-child(7n) { border-right: 0; }
.m-cell:hover { background: rgba(255, 255, 255, .02); }
.m-cell.wkend { background: rgba(255, 255, 255, .01); }
.m-cell.out .m-num { color: var(--dim); }
.m-cell.out .mc-t, .m-cell.out .mc-a { opacity: .5; }
.m-num { align-self: flex-end; font-size: 12.5px; font-weight: 600; height: 24px; min-width: 24px; padding: 0 7px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 1px; font-variant-numeric: tabular-nums; flex: none; transition: background .12s; }
.m-num:hover { background: var(--s3); }
.m-cell.today .m-num { background: var(--red); color: #fff; }
.mc-t { display: flex; align-items: center; gap: 6px; height: 20px; padding: 0 6px; border-radius: 5px; font-size: 12px; min-width: 0; text-align: left; flex: none; }
.mc-t:hover { background: var(--s3); }
.mc-t i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex: none; }
.mc-t .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; flex: 1; min-width: 0; }
.mc-t .tm { color: var(--mut); font-size: 11px; flex: none; font-variant-numeric: tabular-nums; }
.mc-a { flex: none; }
.m-more { font-size: 11.5px; color: var(--mut); text-align: left; padding: 0 6px; height: 18px; font-weight: 600; flex: none; }
.m-more:hover { color: var(--tx); }

/* ---------- month: phone ---------- */
.mm-wrap { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.mm-dow { display: grid; grid-template-columns: repeat(7, 1fr); padding: 8px 8px 4px; position: sticky; top: 0; background: #000; z-index: 2; }
.mm-dow span { text-align: center; font-size: 11px; font-weight: 600; color: var(--dim); }
.mm-grid { display: grid; grid-template-columns: repeat(7, 1fr); padding: 0 8px; }
.mmc { height: 56px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding-top: 5px; border-top: 1px solid var(--line); }
.mmc b { width: 33px; height: 33px; border-radius: 50%; display: grid; place-items: center; font-size: 16.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.mmc.out b { color: var(--dim); }
.mmc.today b { color: var(--red); font-weight: 700; }
.mmc.sel b { background: #fff; color: #000; font-weight: 700; }
.mmc.sel.today b { background: var(--red); color: #fff; }
.dots { display: flex; gap: 3px; height: 5px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--c); }
.dl { padding: 12px 16px calc(150px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.dl-h { font-size: 13px; font-weight: 600; color: var(--tx2); margin: 4px 0 6px; }
.dl-h b { color: var(--red); }
.dl-ev { display: flex; gap: 12px; align-items: stretch; padding: 10px 0; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.dl-ev .tm2 { flex: none; width: 62px; font-size: 12.5px; color: var(--tx2); font-variant-numeric: tabular-nums; line-height: 1.35; }
.dl-ev .tm2 small { display: block; color: var(--dim); font-size: 12px; }
.dl-ev .bar { width: 3px; border-radius: 2px; background: var(--c); flex: none; }
.dl-ev .tx { flex: 1; min-width: 0; }
.dl-ev .tx b { display: block; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-ev .tx small { color: var(--mut); font-size: 12.5px; }
.dl-none { color: var(--dim); font-size: 14px; padding: 14px 0; }
.ghostbtn { margin-top: 10px; height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line2); color: var(--tx2); font-weight: 600; font-size: 13.5px; }

/* ---------- pages: to-do + habits ---------- */
.page { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px calc(150px + env(safe-area-inset-bottom)); }
.page-in { max-width: 760px; margin: 0 auto; }
.sec { margin-top: 22px; }
.sec:first-child { margin-top: 4px; }
.sec-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; min-height: 22px; }
.sec-h > span:first-child { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.sec-h > span.late { color: var(--red); }
.sec-r { display: flex; align-items: center; gap: 12px; }
.sec-r em { font-style: normal; font-size: 12.5px; color: var(--mut); font-variant-numeric: tabular-nums; }
.sec-r button { font-size: 13px; color: var(--mut); font-weight: 600; }
.sec-r button:hover { color: var(--tx); }
.card { background: var(--s1); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }

.tadd { display: flex; align-items: center; gap: 10px; padding: 0 8px 0 14px; min-height: 52px; background: var(--s1); border: 1px solid var(--line2); border-radius: 16px; }
.tadd input { flex: 1; min-width: 0; background: none; border: 0; outline: none; height: 50px; font-size: 15px; }
.tadd input::placeholder { color: var(--dim); }
.tday { display: flex; gap: 4px; flex: none; }
.tday button { height: 30px; padding: 0 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--mut); }
.tday button.on { background: var(--s4); color: var(--tx); }
.plus { width: 22px; height: 22px; flex: none; display: grid; place-items: center; color: var(--dim); }
.plus::before { content: "+"; font-size: 21px; line-height: 1; font-weight: 300; }
.task { display: flex; align-items: center; gap: 12px; padding: 0 14px; border-bottom: 1px solid var(--line); min-height: 50px; }
.task:last-child { border-bottom: 0; }
.chk { width: 22px; height: 22px; border-radius: 50%; border: 1.6px solid var(--dim); flex: none; display: grid; place-items: center; transition: background .15s, border-color .15s; }
.chk:hover { border-color: var(--tx2); }
.task.done .chk { background: #fff; border-color: #fff; }
.task.done .chk::after, .habit.done .ring::after, .sh-r.done .ring::after { content: ""; width: 9px; height: 5px; border: 2px solid #000; border-top: 0; border-right: 0; transform: translate(0, -1px) rotate(-45deg); }
.task .tt { flex: 1; min-width: 0; text-align: left; padding: 14px 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.task .tt > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task.done .tt { color: var(--dim); text-decoration: line-through; text-decoration-color: var(--s4); }
.tag { flex: none; font-size: 11px; font-weight: 600; color: var(--mut); background: var(--s3); padding: 2px 7px; border-radius: 6px; }
.tag.late { color: var(--red); background: rgba(255, 69, 58, .13); }
.empty-big { text-align: center; padding: 50px 20px; color: var(--mut); }
.empty-big b { display: block; color: var(--tx); font-size: 17px; margin-bottom: 6px; font-weight: 650; }

.habits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.habit { display: flex; align-items: center; gap: 11px; padding: 12px; border-radius: 16px; background: var(--s1); border: 1px solid var(--line); text-align: left; min-height: 62px; transition: border-color .2s, background .2s; min-width: 0; }
.habit:hover { border-color: var(--line2); }
.ring { width: 26px; height: 26px; border-radius: 50%; border: 1.7px solid var(--dim); flex: none; display: grid; place-items: center; transition: background .2s, border-color .2s, transform .18s; }
.habit.done { border-color: color-mix(in srgb, var(--c) 40%, transparent); background: color-mix(in srgb, var(--c) 9%, var(--s1)); }
.habit.done .ring, .sh-r.done .ring { background: var(--c); border-color: var(--c); }
.pop .ring { transform: scale(1.18); }
.hx { display: flex; flex-direction: column; min-width: 0; }
.hn { font-size: 15px; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs { font-size: 12px; color: var(--dim); margin-top: 3px; }
.habit.done .hs { color: var(--c); }
.hcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.hcard { background: var(--s1); border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px 16px; }
.hcard-h { display: flex; align-items: center; gap: 9px; }
.hcard-h i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.hcard-h b { font-size: 15px; font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 14px; }
.hstat b { display: block; font-size: 21px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.hstat span { font-size: 11.5px; color: var(--mut); }
.heat { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.heat span { font-size: 10px; color: var(--dim); text-align: center; font-weight: 600; padding-bottom: 2px; }
.heat i { aspect-ratio: 1; border-radius: 5px; background: var(--s3); }
.heat i.on { background: var(--c); }
.heat i.fut { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.heat i.td { box-shadow: 0 0 0 1.5px var(--tx); }

/* ---------- sheet (event / to-do / habits) ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .64); opacity: 0; transition: opacity .22s; }
.scrim.open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 94vh; overflow: auto; overscroll-behavior: contain;
  background: #0f0f11; border-top: 1px solid var(--line2); border-radius: 20px 20px 0 0;
  padding: 8px 14px calc(18px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .32s cubic-bezier(.2, .85, .25, 1);
}
.sheet.open { transform: none; }
.grab { width: 38px; height: 5px; border-radius: 3px; background: var(--s4); margin: 0 auto 6px; }
.sh-bar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-bottom: 8px; }
.sh-bar b { font-size: 16px; font-weight: 650; }
.sh-bar button { font-size: 15.5px; font-weight: 500; color: var(--tx2); padding: 6px 4px; min-width: 60px; text-align: left; }
.sh-bar button.go { color: var(--tx); font-weight: 700; text-align: right; }
.sh-bar span { min-width: 60px; }
.kind { margin: 0 0 12px; }
.grp { background: var(--s2); border-radius: 13px; margin-bottom: 12px; overflow: hidden; }
.grp .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 6px 12px 6px 14px; border-bottom: 1px solid var(--line); }
.grp .row:last-child { border-bottom: 0; }
.grp .row > label { font-size: 15px; }
.grp input.t { width: 100%; background: none; border: 0; outline: none; font-size: 17px; font-weight: 600; padding: 14px; }
.grp input.t::placeholder { color: var(--dim); }
.row input[type=date], .row input[type=time], .row select { background: var(--s4); border: 0; border-radius: 8px; height: 34px; padding: 0 10px; color: var(--tx); font-size: 15px; color-scheme: dark; outline: none; font-variant-numeric: tabular-nums; min-width: 0; }
.row select { padding-right: 28px; -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center; background-size: 14px; }
.grp textarea { width: 100%; min-height: 84px; background: none; border: 0; padding: 13px 14px; outline: none; resize: vertical; font-size: 15px; display: block; }
.grp textarea::placeholder { color: var(--dim); }
.cats { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px; }
.cat { height: 32px; padding: 0 12px; border-radius: 16px; background: var(--s3); font-size: 13px; color: var(--tx2); display: inline-flex; align-items: center; gap: 7px; font-weight: 600; transition: background .15s, color .15s, box-shadow .15s; }
.cat i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.cat.on { color: #fff; background: color-mix(in srgb, var(--c) 26%, var(--s2)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 60%, transparent); }
.sw { position: relative; width: 51px; height: 31px; border-radius: 16px; background: var(--s4); transition: background .2s; flex: none; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; transition: transform .22s cubic-bezier(.3, .8, .3, 1); box-shadow: 0 2px 4px rgba(0, 0, 0, .3); }
.sw.on { background: var(--health); }
.sw.on::after { transform: translateX(20px); }
.days { display: flex; gap: 4px; }
.days button { width: 32px; height: 32px; border-radius: 50%; background: var(--s4); font-size: 12.5px; color: var(--tx2); font-weight: 600; }
.days button.on { background: #fff; color: #000; }
.hint { margin: -4px 4px 12px; font-size: 12.5px; color: var(--dim); }
.delrow, .rowbtn { width: 100%; height: 48px; border-radius: 13px; background: var(--s2); font-weight: 600; font-size: 15px; margin-bottom: 10px; }
.delrow { color: var(--red); }
.ask { background: var(--s2); border-radius: 13px; padding: 12px; margin-bottom: 10px; }
.ask p { font-size: 13.5px; color: var(--mut); margin: 2px 2px 10px; }
.ask .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ask button { height: 44px; border-radius: 11px; background: var(--s4); font-weight: 600; }
.ask button.red { color: var(--red); }
.hl .row input { flex: 1; min-width: 0; background: none; border: 0; outline: none; height: 44px; font-size: 15px; }
.hl-c { width: 22px; height: 22px; border-radius: 50%; background: var(--c); flex: none; box-shadow: inset 0 0 0 3px var(--s2); border: 1.5px solid var(--c); }
.hl-x { width: 32px; height: 32px; border-radius: 9px; color: var(--dim); font-size: 22px; line-height: 1; flex: none; }
.hl-x:hover { color: var(--red); }
.hl-add { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; }
.hl-add input { flex: 1; min-width: 0; background: none; border: 0; outline: none; height: 38px; font-size: 15px; }
.hl-add button { height: 36px; padding: 0 14px; border-radius: 9px; background: #fff; color: #000; font-weight: 650; }

.toast {
  position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); z-index: 60; transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  background: #fff; color: #000; font-size: 13.5px; font-weight: 600; padding: 10px 16px; border-radius: 12px; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- sidebar (big screens) ---------- */
.brand { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 0; }
.brand b { font-size: 12px; letter-spacing: .45em; font-weight: 700; }
.newbtn { display: flex; align-items: center; justify-content: center; gap: 8px; height: 40px; border-radius: 11px; background: #fff; color: #000; font-weight: 650; font-size: 14px; flex: none; transition: transform .12s; }
.newbtn:active { transform: scale(.98); }
.newbtn svg { width: 17px; height: 17px; stroke-width: 2.3; }
.snav { display: flex; flex-direction: column; gap: 2px; }
.snav button { display: flex; align-items: center; gap: 11px; height: 36px; padding: 0 10px; border-radius: 9px; color: var(--tx2); font-weight: 600; font-size: 14px; transition: background .12s, color .12s; }
.snav button:hover { background: var(--s2); color: var(--tx); }
.snav button.on { background: var(--s3); color: var(--tx); }
.snav em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.mini .mm-h { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 8px 6px; }
.mini .mm-h b { font-size: 14px; font-weight: 650; }
.mini .mm-h span { display: flex; gap: 2px; }
.mini-g { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; text-align: center; }
.mini-g > span { font-size: 10.5px; color: var(--dim); font-weight: 700; padding-bottom: 4px; }
.md { position: relative; height: 30px; margin: 0 auto; width: 30px; border-radius: 50%; font-size: 12.5px; font-variant-numeric: tabular-nums; font-weight: 500; transition: background .12s; }
.md:hover { background: var(--s3); }
.md.out { color: var(--dim); }
.md.inwk { background: var(--s2); border-radius: 8px; width: 100%; }
.md.sel { background: var(--s4); border-radius: 50%; width: 30px; }
.md.today { background: var(--red); color: #fff; font-weight: 700; border-radius: 50%; width: 30px; }
.s-sec .s-h { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--dim); text-transform: uppercase; padding: 0 6px; margin-bottom: 6px; }
.s-h button { font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--mut); font-weight: 600; }
.s-h button:hover { color: var(--tx); }
.sh-r { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 6px; border-radius: 9px; width: 100%; text-align: left; transition: background .12s; }
.sh-r:hover { background: var(--s2); }
.sh-r .ring { width: 18px; height: 18px; border-width: 1.6px; }
.sh-r.done .ring::after { width: 7px; height: 4px; border-width: 1.8px; }
.sh-r .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.sh-r em { font-style: normal; font-size: 11.5px; color: var(--dim); font-variant-numeric: tabular-nums; }
.sh-r.done em { color: var(--c); }
.sh-t { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 6px; border-radius: 9px; }
.sh-t:hover { background: var(--s2); }
.sh-t .chk { width: 17px; height: 17px; border-width: 1.6px; }
.sh-t.done .chk { background: #fff; border-color: #fff; }
.sh-t .tt { flex: 1; min-width: 0; text-align: left; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 7px 0; }
.sh-t.done .tt { color: var(--dim); text-decoration: line-through; }
.sh-t .tag { font-size: 10px; padding: 1px 5px; }
.s-add { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 6px; }
.s-add .plus { width: 17px; height: 17px; }
.s-add .plus::before { font-size: 18px; }
.s-add input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 13.5px; height: 32px; }
.s-add input::placeholder { color: var(--dim); }
.cal-i { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 6px; border-radius: 8px; width: 100%; font-size: 13.5px; text-align: left; transition: background .12s; }
.cal-i:hover { background: var(--s2); }
.cal-i .box { width: 15px; height: 15px; border-radius: 4.5px; background: var(--c); box-shadow: inset 0 0 0 1.5px var(--c); flex: none; display: grid; place-items: center; }
.cal-i .box::after { content: ""; width: 7px; height: 4px; border: 1.8px solid #000; border-top: 0; border-right: 0; transform: translate(0, -1px) rotate(-45deg); }
.cal-i.off { color: var(--mut); }
.cal-i.off .box { background: transparent; }
.cal-i.off .box::after { display: none; }
.cal-i em { margin-left: auto; font-style: normal; font-size: 11.5px; color: var(--dim); font-variant-numeric: tabular-nums; }

/* ---------- sizes ---------- */
@media (max-width: 699px) {
  :root { --gut: 44px; }
  .g-day { flex-direction: column; gap: 1px; padding: 6px 0; font-size: 10.5px; }
  .g-day b { font-size: 16px; min-width: 28px; height: 28px; }
  .ev { font-size: 10.5px; padding: 2px 3px 2px 6px; border-radius: 4px; box-shadow: inset 2px 0 0 var(--c); }
  .ev .em { font-size: 10px; }
  .week7 .ev .em { display: none; }
  .week7 .ev { padding: 2px 2px 2px 5px; }
  .week7 .ev .et { white-space: normal; overflow-wrap: normal; word-break: normal; text-overflow: clip; font-size: 10px; letter-spacing: -.15px; }
  .gutter span { font-size: 10px; right: 6px; }
  .g-all-l { font-size: 9.5px; padding-right: 4px; }
  .chip { font-size: 10.5px; padding: 0 4px; height: 19px; }
}
@media (min-width: 700px) {
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%; width: 470px; max-height: 88vh; border-radius: 20px; border: 1px solid var(--line2);
    padding: 10px 18px 18px; transform: translate(-50%, -47%) scale(.98); opacity: 0; transition: transform .2s, opacity .2s;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .8);
  }
  .sheet.open { transform: translate(-50%, -50%); opacity: 1; }
  .grab { display: none; }
  .habits { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
@media (min-width: 1000px) {
  .side { display: flex; flex-direction: column; width: 276px; flex: none; border-right: 1px solid var(--line); padding: 16px 12px 24px; gap: 20px; overflow-y: auto; height: 100%; }
  .tabbar, .fab { display: none; }
  .top { padding: 14px 22px 12px; }
  .top-r1 { min-height: 40px; }
  .top .seg { margin: 0 0 0 10px; }
  .page { padding: 20px 28px 60px; }
  .toast { bottom: 40px; }
}
