:root {
  --bg: #0A0A0A;
  --s1: #121212;
  --s2: #1A1A1A;
  --s3: #232323;
  --s4: #2C2C2B;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #F2F2F0;
  --text-2: #A8A8A6;
  --text-3: #8A8A88;
  --text-dis: #5A5A58;
  --action: #FFFFFF;
  --on-action: #0A0A0A;
  --ok: #8FD19E;
  --warn: #E5B454;
  --err: #E87D74;
  --info: #8FA9CC;
  --r-panel: 24px;
  --r-card: 18px;
  --r-ctl: 14px;
  --r-chip: 10px;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --dots: radial-gradient(rgba(255, 255, 255, .075) 1px, transparent 1.3px);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 88px;
  min-height: 100vh;
  background-image: var(--dots);
  background-size: 18px 18px;
}

.ic { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.app { max-width: 1360px; margin: 0 auto; padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.sidebar { display: none; }
.content { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-panel); min-width: 0; }
main { padding: clamp(16px, 3vw, 28px); }

header.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px clamp(16px, 3vw, 24px);
  border-bottom: 1px solid var(--line);
  min-height: 56px;
}
.top-sp { flex: 1; }
.page-title { font-weight: 500; font-size: 15px; letter-spacing: -.005em; }
.top-date { color: var(--text-3); font: 500 12px var(--mono); }
.top-sep { width: 1px; height: 20px; background: var(--line-strong); }
.desktop-only { display: none !important; }
.mobile-only { display: inline-flex; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
.mk { width: 22px; height: 22px; position: relative; flex: none; }
.mk::before, .mk::after { content: ""; position: absolute; border-radius: 6px; }
.mk::before { inset: 0 4px 4px 0; background: var(--text); }
.mk::after { inset: 4px 0 0 4px; background: rgba(242, 242, 240, .25); z-index: -1; }
.tag { color: var(--text-3); font-size: 13px; }

.side-brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 2px; }
.side-brand .mk { width: 30px; height: 30px; }
.side-brand .mk::before { inset: 0 6px 6px 0; border-radius: 9px; }
.side-brand .mk::after { inset: 6px 0 0 6px; border-radius: 9px; }
.side-brand b { display: block; font-weight: 600; font-size: 16px; letter-spacing: -.01em; line-height: 1.2; }
.side-brand small { color: var(--text-3); font-size: 12px; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-group .cap { padding: 0 12px; margin: 4px 0 6px; }
.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 42px;
  padding: 0 12px;
  width: 100%;
  border-radius: var(--r-ctl);
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  font: 500 14px var(--font);
  text-align: left;
  transition: background .18s ease, color .18s ease;
}
.side-link:hover { background: var(--s2); color: var(--text); }
.side-link.active {
  background: var(--s3);
  color: var(--text);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 6px 14px rgba(0, 0, 0, .35);
}
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; }
.side-link.me { height: 52px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--s4); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; color: var(--text); }
.me-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.me-text b { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { color: var(--text-3); font-size: 12px; font-weight: 400; }

.view { display: none; }
.view.active { display: block; }

.row { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }

.fld { flex: 1; min-width: 0; }
.fld label { display: block; font: 500 11px var(--font); color: var(--text-2); margin-bottom: 6px; }
.cap { font: 500 11px var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); margin: 0 0 10px; }
input[type="text"], input[type="time"], input[type="date"] {
  color-scheme: dark;
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  color: var(--text);
  font: 400 15px var(--font);
  padding: 10px 2px;
  outline: none;
  font-variant-numeric: tabular-nums;
}
input[type="text"]::placeholder { color: var(--text-3); }
input[type="text"]:focus, input[type="time"]:focus, input[type="date"]:focus { border-bottom-color: #fff; }

select {
  background: var(--s2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--r-ctl);
  padding: 9px 12px;
  font: 400 14px var(--font);
}
select:focus { outline: 2px solid #fff; outline-offset: 2px; }

button { font-family: inherit; cursor: pointer; }
.btn-accent, .btn-ghost {
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: 500 14px var(--font);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
  white-space: nowrap;
}
.btn-accent:active, .btn-ghost:active { transform: scale(.98); }
.btn-accent { background: var(--action); color: var(--on-action); }
.btn-accent:hover { background: #e6e6e4; }
.btn-ghost { background: var(--s3); color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--s4); }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-3);
  padding: 6px;
  display: inline-flex;
  border-radius: 999px;
}
.icon-btn:hover { color: var(--err); background: rgba(232, 125, 116, .08); }

.sub { color: var(--text-2); font-size: 13px; margin: 2px 0 14px; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item {
  background: var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  padding: 12px 10px 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.item.done { background: var(--s2); border-color: var(--line); }
.item.done .title { color: var(--text-3); text-decoration: line-through; }
.check { display: flex; align-items: center; gap: 12px; cursor: pointer; flex: 1; min-width: 0; }
.check input { width: 18px; height: 18px; accent-color: var(--text); flex: none; }
.pr { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex: none; }
.pr-high { background: var(--err); }
.pr-medium { background: var(--warn); }
.pr-low { background: var(--text-3); }
.title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.habits { display: flex; flex-direction: column; gap: 10px; }
.habit-row { background: var(--s2); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px; }
.habit-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.habit-head .title { flex: 1; font-weight: 500; }
.habit-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.hday {
  background: var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  padding: 8px 0;
  color: var(--text-3);
  font-size: 12px;
}
.hday.today { border-color: var(--line-strong); }
.hday.on {
  background: var(--s4);
  color: var(--text);
  font-weight: 500;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
  border-color: var(--line-strong);
}

.focus-box { text-align: center; padding: 28px 0; }
.focus-clock { font-size: 56px; font-weight: 400; letter-spacing: -.02em; margin: 10px 0; font-variant-numeric: tabular-nums; }
.focus-box .row { justify-content: center; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day-col {
  background: var(--s2);
  background-image: var(--dots);
  background-size: 14px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 10px;
  min-height: 160px;
  display: flex;
  flex-direction: column;
}
.day-col.today { border-color: var(--line-strong); }
.day-head { margin: 0 0 8px; font-size: 13px; font-weight: 500; }
.day-events { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.ev {
  background: var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r-chip);
  padding: 7px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  color: var(--text);
  font-family: inherit;
}
.ev:hover { background: var(--s4); }
.ev-time { font: 500 11px var(--mono); color: var(--text-3); }
.add-ev {
  margin-top: 8px;
  background: transparent;
  border: 1px dashed var(--line-strong);
  color: var(--text-3);
  border-radius: var(--r-ctl);
  padding: 6px;
  font-size: 12px;
}

nav.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  gap: 6px;
  justify-content: center;
  background: rgba(24, 24, 24, .92);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px;
  max-width: 420px;
  margin: 0 auto calc(14px + env(safe-area-inset-bottom));
  left: 14px; right: 14px;
  z-index: 10;
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, .8);
}
.nav-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-3);
  font: 500 11px var(--font);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: 999px;
}
.nav-btn .ic { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.nav-btn.active { color: var(--text); background: var(--s4); }

@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .app { grid-template-columns: 264px minmax(0, 1fr); padding: 16px; align-items: start; transition: grid-template-columns .2s ease; }
  .app.collapsed { grid-template-columns: 72px minmax(0, 1fr); }
  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 16px;
    height: calc(100vh - 32px);
    background: var(--s1);
    border: 1px solid var(--line);
    border-radius: var(--r-panel);
    padding: 14px;
    overflow: hidden;
  }
  .content { min-height: calc(100vh - 32px); }
  nav.tabbar { display: none; }
  .desktop-only { display: inline-flex !important; }
  .mobile-only { display: none !important; }
  .app.collapsed .sidebar { padding: 14px 10px; }
  .app.collapsed .side-brand div,
  .app.collapsed .side-group .cap,
  .app.collapsed .side-link .lbl,
  .app.collapsed .me-text { display: none; }
  .app.collapsed .side-link { justify-content: center; padding: 0; }
  .app.collapsed .side-brand { justify-content: center; padding: 4px 0 2px; }
  #view-tasks, #view-habits, #view-focus, #view-settings { max-width: 860px; }
}

@media (max-width: 700px) {
  .week { grid-template-columns: repeat(7, minmax(120px, 1fr)); overflow-x: auto; padding-bottom: 4px; }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal {
  width: min(100%, 380px);
  background: var(--s1);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-panel);
  padding: 20px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .8);
  max-height: 86vh;
  overflow-y: auto;
}
.modal .row:last-child { margin-bottom: 0; }

/* ---- today dashboard ---- */
.today-grid { display: flex; flex-direction: column; gap: 14px; }
.tile {
  background: var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 16px;
}
.tile .cap { margin-bottom: 8px; }
.tile .big { font-size: 28px; font-weight: 400; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mini-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.mini-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.mini-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-row .when { color: var(--text-3); font: 11.5px var(--mono); flex: none; }
.habit-mini { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.habit-mini:first-child { border-top: none; }
.habit-mini input { width: 20px; height: 20px; accent-color: var(--text); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 56px; margin-top: 10px; }
.bars i { flex: 1; background: var(--s4); border-radius: 3px 3px 0 0; display: block; min-height: 3px; }
.bars i.on { background: var(--text); }
.bar-labels { display: flex; gap: 6px; margin-top: 4px; }
.bar-labels span { flex: 1; text-align: center; font-size: 10.5px; color: var(--text-3); }
.data-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- tasks: lanes, meta, plan 1-3-5, carry-over ---- */
.lane { margin-bottom: 18px; }
.lane .cap { display: flex; align-items: center; gap: 10px; }
.lane .add-ev.wide { width: 100%; margin-top: 8px; }
.ttl { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.meta { display: flex; gap: 10px; flex-wrap: wrap; }
.due { font: 500 11px var(--mono); color: var(--text-3); }
.due.over { color: var(--err); }
.item-acts { display: flex; align-items: center; flex: none; }
.link {
  background: none;
  border: 0;
  padding: 0;
  font: 500 11px var(--mono);
  letter-spacing: .04em;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-transform: none;
}
.seg {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--s2);
  border: 1px solid var(--line);
  border-radius: 999px;
  margin: 2px 0 16px;
}
.seg button {
  background: transparent;
  border: 0;
  color: var(--text-3);
  font: 500 13px var(--font);
  padding: 7px 16px;
  border-radius: 999px;
}
.seg button[aria-pressed="true"] { background: var(--s4); color: var(--text); }
.btn-ghost.sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.err-text { color: var(--err); font-size: 13px; margin: 10px 0 0; }
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.pick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  color: var(--text);
  padding: 10px 12px;
  font: 400 14px var(--font);
}
.pick-row:hover { background: var(--s3); }
.carry-row { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.carry-row:first-child { border-top: 0; }
.carry-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.carry-acts { display: flex; align-items: center; gap: 8px; }

@media (min-width: 900px) {
  .today-grid { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
}

/* ---- settings ---- */
.set-section { background: var(--s2); border: 1px solid var(--line); border-radius: var(--r-card); padding: 4px 18px; margin-bottom: 14px; }
.set-section > .cap { padding-top: 16px; margin-bottom: 4px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.set-section > .cap + .set-row { border-top: 0; }
.set-lbl b { display: block; font-weight: 500; font-size: 14.5px; }
.set-lbl span { display: block; color: var(--text-2); font-size: 13px; margin-top: 2px; }
.set-ctl { flex: none; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.set-ctl input[type="text"] { width: 220px; }
.set-section select { background: var(--s3); }
.switch { width: 46px; height: 26px; border-radius: 999px; background: var(--s4); border: 1px solid var(--line-strong); position: relative; padding: 0; transition: background .18s ease; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--text-3); transition: transform .18s ease, background .18s ease; }
.switch[aria-checked="true"] { background: var(--action); border-color: var(--action); }
.switch[aria-checked="true"]::after { transform: translateX(20px); background: var(--on-action); }
.switch:focus-visible, .seg button:focus-visible, .side-link:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.btn-danger {
  height: 40px; padding: 0 18px; border-radius: 999px; background: transparent; color: var(--err);
  border: 1px solid rgba(232, 125, 116, .35); font: 500 14px var(--font);
}
.btn-danger:hover { background: rgba(232, 125, 116, .08); }
.stat-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-chip { font: 500 12px var(--mono); color: var(--text-2); background: var(--s3); border: 1px solid var(--line); border-radius: var(--r-chip); padding: 4px 10px; }
.toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%);
  background: var(--s4); border: 1px solid var(--line-strong); color: var(--text);
  padding: 10px 18px; border-radius: 999px; font-size: 13px; z-index: 60;
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, .8);
}
@media (min-width: 900px) { .toast { bottom: 28px; } }
.set-lbl { flex: 1; min-width: 0; }
@media (max-width: 560px) {
  .set-row.wide { flex-direction: column; align-items: stretch; gap: 10px; }
  .set-row.wide .set-ctl { justify-content: flex-start; }
  .set-row.wide .set-ctl input[type="text"] { width: 100%; }
  .top-date { display: none; }
}

.progress { height: 6px; border-radius: 999px; background: var(--s4); overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; background: var(--text); border-radius: 999px; }
