/* Planner — monochrome, minimal, desktop only. Accent colour is reserved for urgent / overdue / "now". */
:root {
  --bg: #f6f6f4;
  --card: #ffffff;
  --sunk: #efefec;
  --fg: #0c0c0c;
  --muted: #6c6c68;
  --faint: #a6a6a1;
  --line: #e4e4e0;
  --line2: #d0d0cb;
  --accent: #ff3b1f;
  --ok: #1f9d55;
  --inv-bg: #0c0c0c;
  --inv-fg: #fafaf8;
  --toast-bg: #0c0c0c;
  --toast-fg: #fafaf8;
  --toast-line: transparent;
  --radius: 12px;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #090909;
  --card: #111111;
  --sunk: #161616;
  --fg: #f1f1ee;
  --muted: #8d8d88;
  --faint: #55554f;
  --line: #1e1e1c;
  --line2: #2d2d2a;
  --accent: #ff5a3d;
  --ok: #43c47a;
  --inv-bg: #f1f1ee;
  --inv-fg: #0a0a0a;
  --toast-bg: #1a1a18;   /* dark surface instead of a bright white card */
  --toast-fg: #dcdcd7;
  --toast-line: #2d2d2a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font: 14px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-width: 1100px; /* desktop; narrow screens switch to the mobile layout at the bottom of this file */
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); display: inline-flex; }
.sm { font-size: 12.5px; }
.grow { flex: 1; min-width: 0; }
.ic { flex: none; display: block; }

#app { display: grid; grid-template-columns: 236px 1fr; height: 100vh; }
#main { overflow-y: auto; padding: 34px 44px 60px; }
#main > * { max-width: 1180px; margin-left: auto; margin-right: auto; }

/* ------------------------------------------------------------------ sidebar */
#side {
  display: flex; flex-direction: column; gap: 6px;
  padding: 24px 16px 18px; border-right: 1px solid var(--line);
  background: var(--bg); height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 14px; font: 600 15px var(--mono); letter-spacing: .02em; }
.brand i { width: 14px; height: 14px; border: 2px solid var(--fg); border-radius: 3px; position: relative; }
.brand i::after { content: ""; position: absolute; right: -6px; top: -6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.clockbox { padding: 4px 10px 18px; }
.clock { font-size: 38px; font-weight: 500; letter-spacing: -.02em; line-height: 1; }
.cdate { margin-top: 8px; color: var(--muted); font-size: 12.5px; }
nav { display: flex; flex-direction: column; gap: 2px; }
.nav {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border: 0; background: none;
  border-radius: 8px; text-align: left; color: var(--muted); transition: background .12s, color .12s;
}
.nav:hover { background: var(--sunk); color: var(--fg); }
.nav.on { background: var(--sunk); color: var(--fg); font-weight: 600; }
.nav span { flex: 1; }
.nav em { font-style: normal; font-size: 11.5px; color: var(--muted); background: var(--bg); border: 1px solid var(--line2); border-radius: 99px; padding: 0 7px; line-height: 18px; }
.nav.on em { color: var(--fg); }
.minipill {
  display: flex; align-items: center; gap: 8px; margin: 10px 4px 0; padding: 8px 12px;
  border: 1px solid var(--line2); border-radius: 99px; background: var(--card); font-size: 12.5px;
}
.minipill .mono { flex: 1; text-align: left; }
.minipill[data-k="pomo"] .ic { color: var(--accent); }
.side-foot { display: flex; flex-direction: column; gap: 12px; padding: 0 6px; }
.foot-row { display: flex; align-items: center; justify-content: space-between; }
.status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.status[data-s="saving"] i { background: var(--faint); }
.status[data-s="error"] i { background: var(--accent); }
body.gate-mode nav, body.gate-mode .clockbox { display: none; }

/* ----------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line2); background: var(--card); color: var(--fg);
  font-weight: 500; transition: border-color .12s, background .12s, transform .05s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--fg); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--inv-bg); color: var(--inv-fg); border-color: var(--inv-bg); }
.btn.primary:hover { opacity: .88; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn.lg { height: 42px; padding: 0 20px; }
.btn.danger { color: var(--accent); }
.btn.danger:hover { border-color: var(--accent); }
.btn.armed, .icon-btn.armed { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex: none;
  border: 0; background: none; border-radius: 7px; color: var(--muted); transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--sunk); color: var(--fg); }
.icon-btn.danger:hover { color: var(--accent); }
.link { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--muted); padding: 4px 0; font-size: 12.5px; }
.link:hover { color: var(--fg); }
.link.danger:hover { color: var(--accent); }

.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 8px; padding: 2px; background: var(--card); gap: 2px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 11px; border-radius: 6px; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.seg button:hover { color: var(--fg); }
.seg button.on { background: var(--inv-bg); color: var(--inv-fg); }
.seg.mini button { padding: 3px 8px; font: 500 11.5px var(--mono); }
.pri-seg button .pri { box-shadow: none; }
.pri-seg button.on .pri.pri-2 { background: var(--inv-fg); }
.pri-seg button.on .pri.pri-3, .pri-seg button.on .pri.pri-4 { border-color: var(--inv-fg); }

input[type="text"], input[type="search"], input[type="date"], input[type="time"], input[type="number"], select, textarea {
  height: 34px; padding: 0 11px; border: 1px solid var(--line2); border-radius: 8px;
  background: var(--card); outline: none; transition: border-color .12s, box-shadow .12s; width: 100%;
}
textarea { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--fg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fg) 10%, transparent); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type="number"].num { width: 76px; }
input[type="date"], input[type="time"] { width: auto; min-width: 136px; font-family: var(--mono); font-size: 13px; }
select { appearance: none; padding-right: 30px; 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='%23888' 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 10px center; }
input:disabled, select:disabled { opacity: .45; }
.check { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--fg); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span:first-child { font-size: 12px; color: var(--muted); font-weight: 500; }
.row-inline { display: flex; align-items: center; gap: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 12px; line-height: 1.5; }
.hint.warn { color: var(--accent); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line2); color: var(--muted); line-height: 18px; }
.badge.overdue { color: var(--accent); border-color: var(--accent); }
.badge.ok { color: var(--ok); border-color: var(--ok); }
code { font-family: var(--mono); font-size: 12px; background: var(--sunk); padding: 2px 6px; border-radius: 5px; word-break: break-all; }

.switch { width: 36px; height: 20px; border-radius: 99px; border: 1px solid var(--line2); background: var(--sunk); position: relative; padding: 0; flex: none; transition: background .15s; }
.switch i { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--faint); transition: transform .15s, background .15s; }
.switch.on { background: var(--inv-bg); border-color: var(--inv-bg); }
.switch.on i { transform: translateX(16px); background: var(--inv-fg); }

/* ------------------------------------------------------------------- layout */
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.page-h h1 { margin: 0; font-size: 30px; font-weight: 650; letter-spacing: -.025em; line-height: 1.1; }
.page-h .sub { color: var(--muted); margin-top: 6px; }
.head-actions { display: flex; align-items: center; gap: 12px; }
.stats { display: flex; gap: 30px; }
.stats div { display: flex; flex-direction: column; align-items: flex-end; }
.stats b { font-size: 22px; font-weight: 500; line-height: 1.1; }
.stats span { font-size: 12px; color: var(--muted); }
.search { width: 240px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; min-height: 30px; }
.card-h h2 { margin: 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.empty { color: var(--faint); padding: 18px 4px; text-align: center; }
.empty.sm { padding: 10px; font-size: 12.5px; }
.empty.big { padding: 90px 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.banner { background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 8px; margin-bottom: 20px; font-weight: 500; }

/* -------------------------------------------------------------------- rows */
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); position: relative; }
.list > .row:last-child { border-bottom: 0; }
.row .grow { cursor: pointer; }
.row .title { font-weight: 500; overflow-wrap: anywhere; }
.row .sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { display: flex; gap: 6px; margin-top: 3px; }
.row.done .title { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--faint); }
.row.done .time { color: var(--faint); }
.row.overdue .time { color: var(--accent); }
.row .time { width: 54px; flex: none; color: var(--muted); font-size: 13px; }
.row-actions { display: flex; opacity: .35; transition: opacity .12s; }
.row:hover .row-actions { opacity: 1; }
.grip { color: var(--faint); cursor: grab; display: inline-flex; margin-left: -4px; margin-right: -6px; }
.row.dragging { opacity: .35; }
.row.drop-before::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--fg); }
.next-tag.done-tag { color: var(--muted); }
.next-tag { font-size: 10.5px; letter-spacing: .12em; color: var(--accent); padding: 8px 6px 0; }
.chk { width: 19px; height: 19px; flex: none; border: 1.5px solid var(--line2); border-radius: 6px; background: var(--card); display: inline-flex; align-items: center; justify-content: center; padding: 0; color: var(--inv-fg); transition: all .12s; }
.chk:hover { border-color: var(--fg); }
.chk.on { background: var(--inv-bg); border-color: var(--inv-bg); }
.pri { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.pri-1 { background: var(--accent); }
.pri-2 { background: var(--fg); }
.pri-3 { border: 1.5px solid var(--fg); }
.pri-4 { border: 1.5px solid var(--faint); }

.quick .qa-in { grid-area: in; }
.quick .qa-seg { grid-area: seg; }
.quick .qa-add { grid-area: add; }
.card > .quick:first-of-type { margin-top: 2px; }
.groups { display: flex; flex-direction: column; gap: 6px; margin-top: 22px; }
.group { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 20px 6px; }
.group.empty-g { background: transparent; padding-top: 8px; padding-bottom: 8px; }
.group-h { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); padding: 4px 0 6px; }
.group-h .count { margin-left: auto; font-weight: 400; letter-spacing: 0; }
.droplist { min-height: 6px; border-radius: 8px; }
.droplist.drop-over { background: var(--sunk); }
.done-block { margin-top: 22px; }
.done-block .list { margin-top: 8px; }

/* ----------------------------------------------------------------- schedule */
.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.cal-title { margin: 0 0 0 10px; font-size: 18px; font-weight: 600; letter-spacing: -.01em; text-transform: none; color: var(--fg); }
.sched-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.month { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.dows { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); }
.dow { padding: 9px 10px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 600; }
.cells { display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(var(--weeks), minmax(112px, auto)); gap: 1px; background: var(--line); }
.cell { background: var(--card); padding: 8px 8px 6px; cursor: pointer; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cell:hover { background: var(--sunk); }
.cell.other { background: var(--bg); }
.cell.other .cell-n { color: var(--faint); }
.cell-n { font-size: 12.5px; color: var(--muted); width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; margin-bottom: 2px; }
.cell.today .cell-n { background: var(--accent); color: #fff; font-weight: 600; }
.cell.sel { box-shadow: inset 0 0 0 1.5px var(--fg); }
.chip { font-size: 11.5px; line-height: 1.35; padding: 2px 6px; border-radius: 5px; background: var(--sunk); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .mono { color: var(--muted); font-size: 10.5px; }
.chip.done { text-decoration: line-through; color: var(--faint); }
.chip.more { background: none; color: var(--muted); }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.wcol { background: var(--card); min-height: 420px; padding: 10px 8px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.wcol:hover { background: var(--sunk); }
.wcol.sel { box-shadow: inset 0 0 0 1.5px var(--fg); }
.wh { display: flex; align-items: baseline; gap: 8px; padding: 0 2px 8px; border-bottom: 1px solid var(--line); margin-bottom: 2px; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.wh b { font-size: 18px; font-weight: 500; color: var(--fg); letter-spacing: 0; }
.wcol.today .wh b { color: var(--accent); }
.wev { padding: 6px 8px; border-radius: 7px; background: var(--sunk); font-size: 12.5px; }
.wev .mono { font-size: 11px; color: var(--muted); display: block; }
.wev.done { opacity: .5; text-decoration: line-through; }
.wempty { color: var(--faint); text-align: center; padding-top: 10px; }
.table-card { padding: 4px 8px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 12px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.off td { opacity: .45; }
.tbl .tr { text-align: right; white-space: nowrap; }
.tbl .tr > * { vertical-align: middle; margin-left: 6px; }
.tl { cursor: pointer; font-weight: 500; }
.tl:hover { text-decoration: underline; }

/* -------------------------------------------------------------------- timer */
.bigtime { font-size: 96px; font-weight: 400; letter-spacing: -.04em; line-height: 1; text-align: center; padding: 26px 0 22px; }
.bigtime.sm { font-size: 40px; padding: 0; text-align: left; letter-spacing: -.03em; }
.progress { height: 3px; border-radius: 3px; background: var(--sunk); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--fg); transition: width .4s linear; }
.progress.thin { height: 2px; margin-top: 10px; }
.focus-card .progress { margin-top: 14px; }
.focus-card .card-h { margin-bottom: 14px; }
.focus-card .presets { margin-bottom: 10px; }
.focus-card .inline-form { margin-bottom: 4px; }
.phase-line { margin-top: 8px; }
.focus-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.btns { display: flex; align-items: center; gap: 8px; }
.btns.center { justify-content: center; margin: 22px 0 26px; }
.dots { display: flex; justify-content: center; gap: 8px; margin-top: 20px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--line2); }
.dots i.on { background: var(--fg); border-color: var(--fg); }
.pomo .field { max-width: 380px; margin: 0 auto 6px; }
.pomo .hint { text-align: center; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input[type="text"] { flex: 1; min-width: 0; }
.tlist { margin-top: 14px; }
.titem { padding: 12px 0; border-top: 1px solid var(--line); }
.trow { display: flex; align-items: center; gap: 8px; }
.tdisp { font-size: 22px; margin-right: 6px; }
.titem.fin .tdisp { color: var(--accent); }
.titem.fin .progress i { background: var(--accent); }

/* -------------------------------------------------------------------- notes */
.notes-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: stretch; height: calc(100vh - 190px); min-height: 480px; }
.nlist { display: flex; flex-direction: column; gap: 10px; overflow: hidden; padding: 14px; }
.n-actions .btn { width: 100%; }
.nfilter { height: 30px !important; font-size: 12.5px; }
.nitems { overflow-y: auto; flex: 1; margin: 0 -6px; padding: 0 6px; }
.nh { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; padding: 12px 6px 6px; }
.nitem { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 6px 8px; border-radius: 6px; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nitem:hover { background: var(--sunk); color: var(--fg); }
.nitem.on { background: var(--inv-bg); color: var(--inv-fg); }
.editor { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.ed-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ed-title { font-weight: 600; font-size: 13px; }
textarea.ed { flex: 1; border: 0; border-radius: 0; padding: 20px 24px; resize: none; font: 13.5px/1.7 var(--mono); height: auto; background: transparent; box-shadow: none !important; }
.md { flex: 1; overflow-y: auto; padding: 20px 28px 40px; line-height: 1.7; }
.md h1, .md h2, .md h3 { letter-spacing: -.01em; margin: 1.2em 0 .4em; }
.md h1 { font-size: 24px; margin-top: 0; } .md h2 { font-size: 18px; } .md h3 { font-size: 15px; }
.md p { margin: .5em 0; } .md ul, .md ol { padding-left: 22px; margin: .4em 0; }
.md li.task { list-style: none; margin-left: -20px; }
.md li.task input { accent-color: var(--fg); margin-right: 6px; }
.md pre { background: var(--sunk); padding: 12px 14px; border-radius: 8px; overflow-x: auto; font: 12.5px var(--mono); }
.md blockquote { margin: .6em 0; padding-left: 14px; border-left: 2px solid var(--line2); color: var(--muted); }
.md a { color: var(--fg); text-decoration: underline; }
.md .wl { border-bottom: 1px dashed var(--faint); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }

/* ----------------------------------------------------------------- settings */
.settings { display: flex; flex-direction: column; gap: 18px; max-width: 720px; }
.settings .card { margin: 0; }
.srow { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.srow:last-of-type { border-bottom: 0; }
.srow.col-s { flex-direction: column; align-items: flex-start; gap: 6px; }
.settings .inline-form { margin-top: 10px; }
.settings .btns { gap: 10px; }
label.btn { cursor: pointer; }

/* -------------------------------------------------------------------- modal */
.overlay { position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(6px); display: flex; align-items: flex-start; justify-content: center; padding: 20px; z-index: 50; overflow-y: auto; animation: fade .12s; }
.modal { margin: auto; width: 480px; max-width: 100%; background: var(--card); border: 1px solid var(--line2); border-radius: 14px; padding: 24px; box-shadow: 0 24px 60px rgba(0, 0, 0, .18); animation: rise .14s; }
.modal.wide { width: 560px; }
.modal h2 { margin: 0 0 18px; font-size: 18px; letter-spacing: -.01em; }
.modal-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.daychips { display: flex; gap: 6px; }
.daychip { cursor: pointer; }
.daychip input { position: absolute; opacity: 0; pointer-events: none; }
.daychip span { display: inline-flex; width: 40px; height: 32px; align-items: center; justify-content: center; border: 1px solid var(--line2); border-radius: 8px; font-size: 12.5px; color: var(--muted); transition: all .12s; text-transform: capitalize; }
.daychip input:checked + span { background: var(--inv-bg); color: var(--inv-fg); border-color: var(--inv-bg); }
.daychip input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--fg) 20%, transparent); }
.preview { font-size: 12.5px; color: var(--muted); background: var(--sunk); border-radius: 8px; padding: 9px 12px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* -------------------------------------------------------------------- toasts */
#toasts { position: fixed; right: 24px; top: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 80; width: 360px; }
.toast { background: var(--toast-bg); color: var(--toast-fg); border: 1px solid var(--toast-line); border-radius: 12px; padding: 13px 14px 13px 16px; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 10px; box-shadow: 0 14px 40px rgba(0, 0, 0, .25); animation: rise .18s; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .18s; }
.toast.alert { border-left: 4px solid var(--accent); }
.toast.warn { border-left: 4px solid var(--accent); }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; overflow-wrap: anywhere; }
.toast-text { opacity: .7; font-size: 12.5px; margin-top: 2px; }
.toast-x { color: inherit; opacity: .6; width: 24px; height: 24px; }
.toast-x:hover { background: rgba(127, 127, 127, .25); color: inherit; opacity: 1; }
.toast-actions { width: 100%; display: flex; gap: 8px; order: 3; }
.toast .btn { background: transparent; color: inherit; border-color: rgba(127, 127, 127, .5); }
.toast .btn:hover { border-color: currentColor; }

/* --------------------------------------------------------------------- gate */
.gate { max-width: 520px !important; margin: 14vh auto 0 !important; }
.gate h1 { font-size: 26px; letter-spacing: -.02em; margin: 0 0 12px; }
.gate p { color: var(--muted); line-height: 1.6; margin: 0 0 22px; }
.gate .hint { margin-top: 26px; }
.err { background: var(--sunk); padding: 14px; border-radius: 8px; font: 12.5px var(--mono); white-space: pre-wrap; color: var(--accent); }

::selection { background: var(--fg); color: var(--bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* --------------------------------------------------------- custom pickers */
input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pk { display: inline-flex; max-width: 100%; }
.field > .pk { display: flex; }
.field > .pk .pk-btn { width: 100%; }
.pk-btn { display: inline-flex; align-items: center; gap: 9px; height: 34px; padding: 0 11px; min-width: 140px; border: 1px solid var(--line2); border-radius: 8px; background: var(--card); color: var(--fg); text-align: left; transition: border-color .12s, box-shadow .12s; }
.pk-btn:hover { border-color: var(--fg); }
.pk-btn.open { border-color: var(--fg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fg) 10%, transparent); }
.pk-btn:disabled { opacity: .45; cursor: default; border-color: var(--line2); }
.pk-btn .ic, .pk-btn .chev { color: var(--muted); }
.pk-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-label.ph { color: var(--faint); }
.pk-btn.mono .pk-label { font-family: var(--mono); font-size: 13px; }
.pk-select { display: flex; width: 100%; }
.pk-select .pk-btn { width: 100%; }
.pk.compact .pk-btn { min-width: 0; padding: 0 10px; }
.pk.compact .pk-label.ph { display: none; }
.pop { position: fixed; z-index: 90; background: var(--card); color: var(--fg); border: 1px solid var(--line2); border-radius: 12px; padding: 10px; box-shadow: 0 18px 50px rgba(0, 0, 0, .3); animation: rise .12s; outline: none; }
.pop-date { width: 292px; }
.pop-time { width: 276px; }
.pop-tt { width: 304px; }
.pop-select { padding: 6px; max-height: 300px; overflow-y: auto; }
.pk-head { display: flex; align-items: center; gap: 2px; margin-bottom: 6px; }
.pk-head .icon-btn { width: 28px; height: 28px; }
.pk-title { flex: 1; text-align: center; font-weight: 600; font-size: 13px; }
.pk-dows { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.pk-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.pk-day { height: 34px; border: 0; background: none; border-radius: 8px; color: var(--fg); font: 13px var(--mono); }
.pk-day:hover, .pk-day.cur { background: var(--sunk); }
.pk-day.other { color: var(--faint); }
.pk-day.today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.pk-day.sel { background: var(--inv-bg); color: var(--inv-fg); }
.pk-foot { display: flex; justify-content: space-between; margin-top: 8px; padding: 0 4px; }
.pk-time-in { text-align: center; font-size: 20px !important; height: 42px !important; margin-bottom: 4px; letter-spacing: .06em; }
.pk-lab { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 600; margin: 10px 2px 6px; }
.pk-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.pk-cell { height: 32px; border: 1px solid var(--line); background: none; border-radius: 7px; font: 13px var(--mono); color: var(--fg); }
.pk-cell:hover { border-color: var(--fg); }
.pk-cell.sel { background: var(--inv-bg); color: var(--inv-fg); border-color: var(--inv-bg); }
.pk-opt { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; text-align: left; color: var(--fg); white-space: nowrap; }
.pk-opt:hover, .pk-opt.hi { background: var(--sunk); }
.pk-opt.sel { font-weight: 600; }
.pk-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.pk-tt-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop .inline-form input { height: 30px; }

/* ----------------------------------------------------------------- streak */
.streak { display: flex; align-items: center; gap: 12px; margin: 0 4px 16px; padding: 11px 12px; border: 1px solid var(--line2); border-radius: 10px; color: var(--muted); }
.streak .ic { flex: none; }
.streak-n b { font-size: 21px; font-weight: 600; color: var(--fg); }
.streak-n span { font-size: 12px; }
.streak-h { font-size: 11.5px; line-height: 1.3; margin-top: 2px; }
.streak.on { border-color: color-mix(in srgb, var(--accent) 55%, var(--line2)); }
.streak.on .ic { color: var(--accent); fill: color-mix(in srgb, var(--accent) 35%, transparent); }
.streak.risk .ic { color: var(--accent); animation: flick 2.6s ease-in-out infinite; }
.streak.off .ic { color: var(--faint); }
@keyframes flick { 50% { opacity: .3; } }

/* ------------------------------------------------- links, focus task, mini timers */
.lnk { color: var(--fg); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; cursor: pointer; }
.lnk:hover { text-decoration-color: var(--fg); }
.hint-s { color: var(--faint); font-size: 12px; }
.focus-task { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--muted); min-width: 0; }
.focus-task b { color: var(--fg); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pomo .focus-task { justify-content: center; margin: 16px 0 0; }
.mini-timers { margin-top: 14px; border-top: 1px solid var(--line); }
.mt { padding: 10px 0 2px; border-bottom: 1px solid var(--line); }
.mt:last-child { border-bottom: 0; }
.mt-top { display: flex; align-items: center; gap: 6px; }
.mt-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.mt .mono { font-size: 17px; margin-right: 4px; }
.mt .progress.thin { margin: 6px 0 8px; }
.mt.fin .mono { color: var(--accent); }
.mt.fin .progress i { background: var(--accent); }

/* priority on the Today list: a thin edge instead of a dot */
.row.task.p1 { box-shadow: inset 3px 0 0 var(--accent); }
.row.task.p2 { box-shadow: inset 3px 0 0 var(--fg); }

/* quick-add (tasks without time): title, priority, Add. No date; priority fills the width */
.quick { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; grid-template-areas: "in seg more add"; gap: 10px; align-items: stretch; margin-bottom: 8px; }
.quick .qa-in { grid-area: in; }
.quick .qa-seg { grid-area: seg; min-width: 0; display: flex; }
.quick .qa-add { grid-area: add; }
.col .quick { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "in more add" "seg seg seg"; }
.quick .qa-seg .seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; box-sizing: border-box; }
.quick .qa-seg .seg button { min-width: 0; justify-content: center; padding: 6px 8px; }
/* title link + hover popup */
.title-link { font-weight: 500; }
.tip { position: fixed; z-index: 120; max-width: 460px; max-height: 60vh; overflow: auto; padding: 10px 12px; border-radius: 10px; background: var(--toast-bg); color: var(--toast-fg); border: 1px solid var(--toast-line); box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; pointer-events: none; }

/* streak widget is a button; flame grows with the level */
.streak[data-act] { cursor: pointer; transition: border-color .12s, background .12s; }
.streak[data-act]:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.streak.lvl3 .ic, .streak.lvl4 .ic, .streak.lvl5 .ic, .streak.lvl6 .ic { filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent) 60%, transparent)); }
.streak.lvl5 .ic, .streak.lvl6 .ic { filter: drop-shadow(0 0 8px var(--accent)); }
.streak-modal { max-width: 640px; }
.sk-top { display: flex; align-items: center; gap: 16px; }
.sk-flame { border: 0 !important; margin: 0 !important; padding: 0 !important; }
.sk-num b { font-size: 34px; font-weight: 600; } .sk-num span { color: var(--muted); }
.sk-lvl { font-weight: 500; margin-top: 2px; }
.sk-prog { margin: 14px 0 4px; display: flex; flex-direction: column; gap: 6px; }
.sk-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0; }
.sk-stats > div { border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.sk-stats b { font-size: 20px; font-weight: 600; } .sk-stats span { font-size: 11.5px; color: var(--muted); }
.sk-map { display: flex; gap: 8px; overflow-x: auto; padding: 4px; margin: -4px; }
.sk-months { display: grid; grid-auto-columns: 14px; grid-template-columns: repeat(26, 14px); gap: 4px; height: 14px; margin-bottom: 4px; font-size: 10px; line-height: 14px; color: var(--faint); }
.sk-months span { white-space: nowrap; }
.sk-help { margin-top: 12px; line-height: 1.45; }
.sk-dow { margin-top: 18px; display: grid; grid-template-rows: repeat(7, 14px); gap: 4px; font-size: 10px; color: var(--faint); line-height: 14px; }
.sk-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 14px); grid-auto-columns: 14px; gap: 4px; }
.sk-cell { width: 14px; height: 14px; border-radius: 4px; border: 0; padding: 0; background: var(--line); display: inline-block; vertical-align: middle; }
button.sk-cell { cursor: pointer; }
button.sk-cell:hover { outline: 1.5px solid var(--fg); }
.sk-cell.fut { background: transparent; }
.sk-cell.l1 { background: color-mix(in srgb, var(--accent) 28%, var(--line)); }
.sk-cell.l2 { background: color-mix(in srgb, var(--accent) 52%, var(--line)); }
.sk-cell.l3 { background: color-mix(in srgb, var(--accent) 76%, var(--line)); }
.sk-cell.l4 { background: var(--accent); }
.sk-cell.today { box-shadow: 0 0 0 1.5px var(--faint); }
.sk-cell.sel { outline: 1.5px solid var(--fg); outline-offset: 1px; }
.sk-legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin: 6px 0 4px; }
.sk-detail { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; }
.sk-dh { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.sk-it { display: flex; align-items: center; gap: 10px; }
/* Today list: more room between the priority edge and the checkbox */

.pk-hint { font-size: 11px; color: var(--faint); text-align: center; margin: 2px 0 8px; }
.pk-chips { grid-template-columns: repeat(4, 1fr); }
.quick .qa-more { grid-area: more; padding: 0 12px; }
.pk-time-in.bad { border-color: var(--accent) !important; color: var(--accent); }

.card-h-r { display: flex; align-items: center; gap: 14px; }
.row.task.plain .grow { cursor: pointer; }

/* chain step line, checklist, tags, counters */
.step { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.step .ic { color: var(--faint); } .step .mono { font-size: 11px; color: var(--faint); }
.badge-btn { background: none; cursor: pointer; font-family: inherit; }
.badge-btn:hover { color: var(--fg); border-color: var(--fg); }
.subs { margin: 8px 0 2px; display: flex; flex-direction: column; gap: 5px; }
.sub-it { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.sub-it .chk { width: 16px; height: 16px; border-radius: 5px; }
.sub-it.done > span { color: var(--faint); text-decoration: line-through; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.tag { border: 0; background: var(--sunk); color: var(--muted); border-radius: 99px; padding: 1px 8px; font-size: 11.5px; cursor: pointer; }
.tag:hover, .tag.on { color: var(--inv-fg); background: var(--inv-bg); }
.counter { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line2); border-radius: 99px; padding: 1px 3px; }
.counter b { font-size: 12px; min-width: 34px; text-align: center; font-weight: 500; }
.counter.done { border-color: var(--ok); color: var(--ok); }
.counter .icon-btn { width: 22px; height: 22px; }
.counter .icon-btn:disabled { opacity: .3; cursor: default; }
.tagbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 -10px; }
.tagbar .tag { padding: 3px 11px; font-size: 12.5px; }

.missed { margin-bottom: 18px; border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.missed-act { display: flex; gap: 6px; }
.missed-act .danger-h:hover { color: var(--accent); border-color: var(--accent); }

.nl { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.nl[hidden] { display: none; }
.nl .ic { color: var(--accent); }

/* command palette */
.pal { width: 600px; padding: 0; margin: 12vh auto auto; overflow: hidden; }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--muted); }
.pal-in input { flex: 1; border: 0 !important; background: none !important; box-shadow: none !important; font-size: 15px; padding: 0; height: 28px; color: var(--fg); outline: none; }
.pal-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.pal-it { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: none; border-radius: 8px; padding: 9px 12px; color: var(--fg); font-size: 13.5px; }
.pal-it .ic { color: var(--muted); flex: none; }
.pal-it.hi { background: var(--sunk); }
.pal-it .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-foot { display: flex; gap: 16px; padding: 9px 18px; border-top: 1px solid var(--line); }
kbd { font-size: 10.5px; border: 1px solid var(--line2); border-radius: 5px; padding: 0 5px; color: var(--muted); background: none; }
.side-search { display: flex; align-items: center; gap: 9px; width: calc(100% - 8px); margin: 0 4px 12px; padding: 8px 11px; border: 1px solid var(--line2); border-radius: 9px; background: none; color: var(--muted); font-size: 13px; }
.side-search:hover { border-color: var(--fg); color: var(--fg); }
.side-search span { flex: 1; text-align: left; }

/* recurring tasks have no single "done" state: show the repeat icon where the checkbox would be */
.chk-rec { width: 20px; height: 20px; flex: none; display: inline-flex; align-items: center; justify-content: center; }
/* schedule block inside the task dialog */

/* steps editor (one field per step, a new empty one appears below) */
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; justify-content: center; padding: 7px 11px; }
.steps-ed { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.step-row { display: flex; align-items: center; gap: 10px; }
.step-dot { width: 9px; height: 9px; flex: none; border: 1.5px solid var(--line2); border-radius: 50%; }
.step-in { flex: 1; min-width: 0; }
/* delayed hover note: soft fade-in */
.tip { animation: tipin .18s ease-out; }
@keyframes tipin { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
/* sidebar "new task" button */
.side-add { display: flex; align-items: center; gap: 9px; width: calc(100% - 8px); margin: 0 4px 12px; padding: 8px 11px; border: 0; border-radius: 9px; background: var(--inv-bg); color: var(--inv-fg); font-size: 13px; font-weight: 500; }
.side-add span { flex: 1; text-align: left; }
.side-add kbd { opacity: .55; font-size: 11px; }
.side-add:hover { opacity: .88; }
/* time-budget dialog */
.budget .bud-task { font-size: 16px; font-weight: 500; margin: 2px 0 4px; }

.group.drop-over { background: var(--sunk); border-radius: 10px; }

/* step grips */
.step-grip { width: 16px; flex: none; display: inline-flex; justify-content: center; color: var(--faint); cursor: grab; touch-action: none; }
.step-grip:hover { color: var(--fg); }
.step-row:last-child .step-grip { opacity: .25; cursor: default; pointer-events: none; }
.step-row.moving { opacity: .6; }
.step-row.moving .step-in { border-color: var(--fg); }

/* row layout: title wraps, badges and priority sit on the right of the same line */
.row-side { display: flex; align-items: center; gap: 6px; flex: none; }
.row .grow { min-width: 0; }
.step-chip .mono { font-size: 11.5px; }
.step { align-items: flex-start; } .step > span { overflow-wrap: anywhere; } .step .ic { margin-top: 3px; flex: none; }
.step-back { width: 22px; height: 22px; }
.badge-btn.bud { color: var(--fg); }
.badge-btn.bud.live { background: var(--inv-bg); color: var(--inv-fg); border-color: var(--inv-bg); }
/* ringing alarm */
#alarm-bar { position: fixed; z-index: 300; top: 18px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 16px; min-width: 340px; max-width: 90vw; background: var(--card); border: 1px solid var(--accent); border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.45); animation: alarmpulse 1.2s ease-in-out infinite; }
.alarm-ic { color: var(--accent); display: inline-flex; animation: ringshake .5s ease-in-out infinite; }
.alarm-tx { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.alarm-tx b { font-weight: 600; } .alarm-tx span { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes alarmpulse { 50% { box-shadow: 0 18px 50px rgba(0,0,0,.45), 0 0 0 4px color-mix(in srgb, var(--accent) 28%, transparent); } }
@keyframes ringshake { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }
/* time-is-up dialog */
.budget { width: 440px; }
.bud-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.bud-head h2 { margin: 0 0 2px; }
.bud-ic { width: 40px; height: 40px; flex: none; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.budget .bud-task { font-size: 17px; font-weight: 500; margin: 0 0 18px; overflow-wrap: anywhere; }
.bud-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bud-pair .btn { justify-content: center; }
.bud-sep { display: flex; align-items: center; gap: 12px; margin: 22px 0 12px; color: var(--muted); font-size: 12.5px; }
.bud-sep::before, .bud-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.bud-more { display: flex; flex-direction: column; gap: 10px; }
.bud-chips { display: flex; } .bud-chips button { flex: 1; justify-content: center; }
.bud-line { display: flex; align-items: center; gap: 10px; }
.bud-line .num { width: 84px; }
.bud-line .btn { margin-left: auto; }

.vol { width: 140px; accent-color: var(--fg); }

.nsnip { display: block; margin-top: 2px; font: 400 11.5px var(--sans, inherit); color: var(--muted); white-space: normal; overflow-wrap: anywhere; }
.nitem { text-align: left; }

/* "Do now" ahead of schedule */
.early-btn { color: var(--fg); }
.early-opts { display: grid; gap: 8px; }
.early-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 11px 14px; border: 1px solid var(--line2); border-radius: 10px; background: none; color: var(--fg); font: inherit; cursor: pointer; }
.early-opt:hover { border-color: var(--fg); }
.early-opt b { font-weight: 600; }
.early .modal-actions { margin-top: 16px; }

/* ----------------------------------------------------------- work shifts and task streaks */
:root { --shift: #2f6fe0; --shift-bg: rgba(47, 111, 224, .10); --shift-bg2: rgba(47, 111, 224, .06); }
:root[data-theme="dark"] { --shift: #6a9bff; --shift-bg: rgba(106, 155, 255, .16); --shift-bg2: rgba(106, 155, 255, .09); }
.cell.shift { background: var(--shift-bg); box-shadow: inset 3px 0 0 var(--shift); }
.cell.shift:hover { background: var(--shift-bg); filter: brightness(.97); }
.cell.shift.other { background: var(--shift-bg2); }
.cell.shift.sel { box-shadow: inset 3px 0 0 var(--shift), inset 0 0 0 1.5px var(--fg); }
.chip.shift { background: var(--shift-bg); color: var(--shift); font-weight: 600; }
.chip.shift .mono { color: var(--shift); }
.wcol.shift { background: var(--shift-bg2); }
.wcol.shift .wh { background: var(--shift-bg); box-shadow: inset 0 3px 0 var(--shift); border-radius: 6px; padding: 4px 6px; }
.badge.shift { color: var(--shift); border-color: var(--shift); background: var(--shift-bg); }
.badge.streakb { color: var(--fg); }
.badge.streakb.risk { color: var(--muted); }
.sk-tasks { margin: 14px 0 6px; }
.sk-tasks h3 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.sk-trow { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); }
/* the day panel is narrow: badges (shift, streak, steps...) drop under the title instead of squeezing it */
.daypanel .row { flex-wrap: wrap; }
.daypanel .row .grow { flex: 1 1 110px; }
.daypanel .row .row-side { order: 10; flex: 1 0 100%; flex-wrap: wrap; padding-left: 28px; }

/* the Recurring block sits outside .groups: keep the same gap as between the priority groups */
.groups + .group { margin-top: 6px; }
/* dialog buttons: wrap instead of overflowing; destructive/extra buttons first, Cancel/Save stay together on the right */
.modal-actions .btn { white-space: nowrap; }
.modal-actions .grow { flex: 1 1 8px; min-width: 0; }

/* ------------------------------------------------------------------ mobile (phones, Telegram Mini App) */
@media (max-width: 860px) {
  body { min-width: 0; }
  #app { display: block; height: auto; }
  #main { overflow: visible; padding: 18px 14px 96px; }
  #main > * { max-width: none; }
  #side {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 40; height: auto; flex-direction: row; align-items: stretch;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 0; border-right: 0; border-top: 1px solid var(--line); background: var(--card);
  }
  #side > :not(nav) { display: none !important; }
  #side nav { flex-direction: row; width: 100%; gap: 2px; }
  .nav { flex: 1; flex-direction: column; justify-content: center; gap: 3px; padding: 6px 2px; font-size: 10.5px; text-align: center; position: relative; min-width: 0; }
  .nav span { flex: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav em { position: absolute; top: 1px; right: 18%; font-size: 10px; padding: 0 5px; line-height: 15px; }
  .page-h { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 18px; }
  .page-h h1 { font-size: 24px; }
  .grid-2, .sched-grid, .two { grid-template-columns: minmax(0, 1fr); }
  .quick { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "in in" "seg seg" "more add"; }
  .group { padding: 8px 12px 4px; }
  .row-actions { opacity: 1; }
  .cells { grid-template-rows: repeat(var(--weeks), minmax(64px, auto)); }
  .cell { padding: 4px; }
  .cell .chip:nth-of-type(n+2) { display: none; }
  .cell .chip { font-size: 10.5px; padding: 1px 3px; }
  .week { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .wcol { min-height: 200px; padding: 6px 2px; }
  .wev { font-size: 10.5px; }
  .dow { padding: 6px 2px; font-size: 10px; text-align: center; letter-spacing: 0; }
  .overlay { padding: 8px; }
  .modal, .modal.wide { width: 100%; padding: 18px 16px; }
  .modal-actions .btn { flex: 1 1 auto; justify-content: center; }
  .modal-actions .grow { display: none; }
  .daychips { flex-wrap: wrap; }
  .toast, #toasts { max-width: calc(100vw - 20px); }
  table { display: block; overflow-x: auto; }
  /* badges drop under the title instead of squeezing it */
  .row { flex-wrap: wrap; }
  .row .grow { flex: 1 1 120px; }
  .row .row-side { order: 10; flex: 1 0 100%; flex-wrap: wrap; padding-left: 28px; }
  .search, .search input { width: 100%; }
  .tagbar { flex-wrap: wrap; }
}
@media (max-width: 860px) {
  .row-inline { flex-wrap: wrap; }
  .seg { max-width: 100%; overflow-x: auto; }
  .seg button { flex: 0 0 auto; }
}
@media (max-width: 860px) {
  .card-h, .btns { flex-wrap: wrap; gap: 8px; }
  .quick .qa-seg .seg button { padding: 6px 2px; font-size: 11px; }
}
@media (max-width: 860px) {
  .quick .qa-seg .seg { overflow: visible; }
  .quick .qa-seg .seg button { padding: 7px 4px; font-size: 12px; }
}

/* phone header (clock + streak); hidden on desktop where the sidebar has them */
.mhead { display: none; }
body.no-notes [data-act="task-note"] { display: none; }
@media (max-width: 860px) {
  .mhead { display: flex; align-items: center; justify-content: space-between; margin: -4px 0 16px; }
  .mclock { font-size: 30px; font-weight: 500; letter-spacing: -.02em; line-height: 1; }
  .mdate { margin-top: 4px; color: var(--muted); font-size: 12.5px; }
  .mstreak { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line2); border-radius: 99px; background: var(--card); color: var(--faint); font-size: 15px; }
  .mstreak.on { color: var(--accent); border-color: var(--accent); }
  .mstreak.risk { color: var(--muted); }
  .settings { max-width: none; }
  .srow code { word-break: break-all; }
}

/* Telegram Mini App: keep content clear of the notch and of Telegram's own header buttons in full screen */
@media (max-width: 860px) {
  .in-tg #main { padding-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px) + 14px); }
  /* big touch targets for the bottom navigation */
  #side { padding: 4px 4px calc(8px + env(safe-area-inset-bottom)); }
  .nav { min-height: 62px; gap: 5px; padding: 8px 2px; font-size: 12px; border-radius: 12px; }
  .nav .ic { width: 26px; height: 26px; }
  .nav em { top: 4px; right: 14%; font-size: 11px; line-height: 17px; padding: 0 6px; }
  #main { padding-bottom: 110px; }
}

/* phone: toasts at the top below the Telegram header, nothing covers the bottom navigation */
@media (max-width: 860px) {
  #toasts { left: 10px; right: 10px; width: auto; top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px) + 8px + env(safe-area-inset-top)); }
  .mdate, .kbd-hint { display: none; }
  .stats { width: 100%; gap: 0; justify-content: space-around; }
  .stats div { flex: 1; align-items: center; text-align: center; }
  /* calendar: square cells with status dots instead of text chips */
  .cells { grid-template-rows: none; grid-auto-rows: auto; }
  .cell { aspect-ratio: 1 / 1; padding: 4px 2px 3px; align-items: center; justify-content: space-between; gap: 2px; }
  .cell .chip { display: none; }
  .cell-n { margin: 0; }
  .dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 100%; min-height: 8px; }
  .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
  .dot.done { background: var(--ok); }
  .dot.late { background: var(--accent); }
  .dot.open { background: var(--fg); }
  .grip { touch-action: none; padding: 10px 8px; margin: -10px -4px -10px -8px; }
  .drag-ghost { position: fixed; z-index: 120; pointer-events: none; opacity: .92; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); background: var(--card); border-radius: 10px; margin: 0; }
}
.dots { display: none; }
@media (max-width: 860px) { .dots { display: flex; } }
@media (max-width: 860px) {
  .cell { padding: 3px 1px 3px; justify-content: flex-start; }
  .cell-n { width: 22px; height: 22px; font-size: 12px; }
  .dots { gap: 2px; margin-top: auto; }
  .dot { width: 6px; height: 6px; }
  .seg { overflow: visible; }
  .page-h .seg button { padding: 6px 9px; }
}
@media (max-width: 860px) {
  .cell { align-items: flex-start; padding-left: 4px; }
  .cell-n { justify-content: flex-start; }
  .dots { justify-content: flex-start; }
}

/* polish: today circle keeps its number centred, settings numbers centred */
.cell.today .cell-n { justify-content: center; }
.settings input.num, .srow input.num { text-align: center; }

/* polish: today circle keeps its number centred, settings numbers centred */
.cell.today .cell-n { justify-content: center; }
.settings input.num, .srow input.num { text-align: center; }
.page-links { display: flex; flex-wrap: wrap; gap: 8px; }
.page-links .btn { flex: 1 1 120px; justify-content: center; min-height: 44px; }
.srow input.txt { min-width: 0; flex: 1 1 140px; max-width: 260px; text-align: right; background: none; border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; }

/* ------------------------------------------------------------ task dialog (sections, sticky footer, full-height sheet on phones) */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.overlay.sheet { align-items: center; }
.task-dlg { padding: 0; display: flex; flex-direction: column; max-height: calc(100dvh - 40px); overflow: hidden; }
.task-dlg [hidden] { display: none !important; }
.td-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 6px; flex: none; }
.td-head h2 { margin: 0; }
.td-x { width: 36px; height: 36px; }
.td-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 22px 14px; }
.td-foot { flex: none; display: flex; justify-content: flex-end; gap: 10px; padding: 12px 22px; border-top: 1px solid var(--line); background: var(--card); }
.td-foot .btn { min-width: 110px; justify-content: center; }
.td-title { font-size: 16px; font-weight: 500; height: 42px; }
.task-dlg .seg.full { display: flex; width: 100%; }
.task-dlg .pri-seg { display: flex; width: 100%; }
.task-dlg .seg.full button, .task-dlg .pri-seg button { flex: 1 1 0; min-width: 0; justify-content: center; }
.task-dlg .pri-seg button { flex-direction: column; gap: 4px; padding: 8px 2px 7px; font-size: 12.5px; }
.task-dlg .pri-seg button span:last-child { overflow: hidden; text-overflow: ellipsis; }
.tsecs { border-top: 1px solid var(--line); margin-top: 4px; }
.tsec { border-bottom: 1px solid var(--line); }
.tsec > summary { list-style: none; display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; }
.tsec > summary::-webkit-details-marker { display: none; }
.tsec > summary:focus-visible { outline: 2px solid var(--fg); outline-offset: -2px; border-radius: 6px; }
.ts-t { flex: none; font-weight: 600; font-size: 14px; }
.ts-sum { flex: 1 1 0; min-width: 0; text-align: right; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tsec[open] .ts-sum { visibility: hidden; }
.tsec > summary .ic { flex: none; color: var(--faint); transition: transform .15s; }
.tsec[open] > summary .ic { transform: rotate(180deg); }
.ts-body { display: flex; flex-direction: column; gap: 12px; padding: 2px 0 16px; min-width: 0; }
.ts-body .field, .ts-stack .field { margin-bottom: 0; min-width: 0; }
.ts-stack { display: flex; flex-direction: column; gap: 12px; }
.ts-body .two { gap: 12px; }
.ts-on { font-weight: 500; color: var(--fg); }
.pg-panel { display: flex; flex-direction: column; gap: 8px; }
.warn-s { color: var(--accent); font-size: 12.5px; line-height: 1.4; }
.cyc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cyc-i { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cyc-i .muted { font-size: 13px; line-height: 1.2; }
.td-more { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.td-more .btn { white-space: nowrap; }
.chk.rem { border-radius: 50%; color: var(--accent); border-color: var(--accent); }
.chk.rem.on { color: var(--inv-fg); background: var(--inv-bg); border-color: var(--inv-bg); }

/* ---------------------------------------------------------------- slider (src/ui-slider.js) */
.sl { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; user-select: none; -webkit-user-select: none; }
.sl-track { position: relative; flex: 1 1 auto; min-width: 0; height: 44px; cursor: pointer; touch-action: none; outline: none; border-radius: 10px; -webkit-tap-highlight-color: transparent; }
.sl.compact .sl-track { touch-action: pan-y; }
.sl-lane { position: absolute; left: 11px; right: 11px; top: 0; bottom: 0; }
.sl-rail { position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; overflow: hidden; background: color-mix(in srgb, var(--muted) 28%, var(--card)); }
.sl-fill { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.sl-thumb { position: absolute; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; box-sizing: border-box; background: var(--card); border: 2px solid var(--accent); box-shadow: 0 1px 4px rgba(0, 0, 0, .28); transition: transform .1s, box-shadow .1s; pointer-events: none; }
.sl.drag .sl-thumb, .sl-track:focus-visible .sl-thumb { transform: scale(1.14); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 20%, transparent), 0 1px 4px rgba(0, 0, 0, .28); }
.sl-val { flex: none; min-width: 42px; text-align: right; font-size: 13px; color: var(--fg); }
.sl.compact { width: 190px; gap: 4px; }
.sl.compact .sl-lane { left: 9px; right: 9px; }
.sl.compact .sl-rail { height: 3px; margin-top: -1.5px; }
.sl.compact .sl-thumb { width: 18px; height: 18px; margin: -9px 0 0 -9px; }
.sl.compact .sl-val { min-width: 38px; font-size: 12px; color: var(--muted); }
.sl-wrap { display: inline-flex; margin: -8px 0; flex: 0 1 auto; }
@media (prefers-reduced-motion: reduce) { .sl-thumb { transition: none; } }

@media (max-width: 860px) {
  .overlay.sheet { padding: 0; align-items: stretch; overflow: hidden; background: var(--card); backdrop-filter: none; }
  .task-dlg { --sat: env(safe-area-inset-top, 0px); width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .in-tg .task-dlg { --sat: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)); }
  .td-head { padding: calc(10px + var(--sat)) 16px 4px; }
  .td-body { padding: 8px 16px 14px; }
  .td-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .td-foot .btn { flex: 1 1 0; min-height: 48px; }
  .td-x { width: 44px; height: 44px; margin-right: -8px; }
  .task-dlg input[type="text"], .task-dlg input[type="number"], .task-dlg textarea { font-size: 16px; height: 44px; }
  .task-dlg textarea { height: auto; min-height: 88px; }
  .task-dlg .td-title { height: 48px; }
  .task-dlg .pk-btn { height: 44px; min-width: 0; font-size: 15px; }
  .task-dlg .seg.full button, .task-dlg .pri-seg button { min-height: 44px; font-size: 13.5px; }
  .task-dlg .pri-seg button { min-height: 52px; }
  .task-dlg .check { min-height: 44px; font-size: 14px; }
  .task-dlg .check input { width: 20px; height: 20px; }
  .task-dlg .daychips { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
  .task-dlg .daychip span { width: 100%; height: 44px; }
  .task-dlg input[type="number"].num { width: 72px; }
  .task-dlg .step-in { height: 44px; }
  .td-more .btn { flex: 1 1 auto; min-height: 44px; justify-content: center; }
  .sl.compact { width: 100%; }
  .sl-wrap { flex: 1 1 100%; }
}

/* phone: ONE header on Today (clock + weekday and date + streak); other pages keep clock + flame above their own title */
@media (max-width: 860px) {
  .mhead.today .mdate { display: block; font-size: 14px; }
  .today-title { display: none; }
  /* settings rows: the label takes the free space, buttons and controls stay on the right even when the label wraps */
  .srow > span:first-child { flex: 1 1 140px; min-width: 0; }
  .srow > .btn, .srow > .row-inline, .srow > .seg, .srow > .switch { margin-left: auto; flex: none; }
}
.srow > .btn { margin-left: auto; }

/* QA pass (2026-10-22): see docs/qa-2026-10-22.md */
@media (max-width: 860px) {
  .srow > .row-inline { flex: 0 1 auto; min-width: 0; max-width: 100%; }
  .srow > span:first-child { flex: 1 1 72px; }
  .srow.col-s > span:first-child { flex: 0 0 auto; }   /* column rows: the 140px basis became a 140px height */
  .row .grow { flex-basis: 80px; }
}
/* a time column never wraps (phone and desktop): "Весь день", "20 окт. 12:00" stay on one line */
.row .time { width: auto; min-width: 54px; white-space: nowrap; }
.row .time.allday { min-width: 76px; }
.missed .row .time { min-width: 0; }
@media (max-width: 860px) {
  /* iOS zooms into inputs below 16px; fields are phone-sized (44px) */
  #main input[type="text"], #main input[type="search"], #main input[type="number"], #main input[type="date"], #main input[type="time"], #main select,
  .overlay input[type="text"], .overlay input[type="search"], .overlay input[type="number"], .overlay input[type="date"], .overlay input[type="time"], .overlay select { font-size: 16px; min-height: 44px; }
  /* tap targets: bigger hit area without changing the look of checkboxes, row icons and tag chips */
  .chk, .counter .icon-btn { position: relative; }
  .chk::after, .counter .icon-btn::after { content: ""; position: absolute; inset: -12px -10px; }
  .row-actions .icon-btn { width: 40px; height: 40px; margin: -6px 0; }
  .row-actions .icon-btn.danger { margin-left: -4px; }
  .tagbar .tag { padding: 8px 14px; font-size: 13px; }
  .quick .qa-seg .seg button { min-height: 44px; }
  .quick .qa-more, .quick .qa-add { min-height: 44px; }
  .step-chip, .badge-btn { min-height: 32px; }
}
@media (max-width: 860px) {
  #main .btn, .overlay .btn { min-height: 44px; }
  #main .btn.sm, .overlay .btn.sm { min-height: 40px; }
  #main .seg button, .overlay .seg button { min-height: 40px; }
  .cal-nav .icon-btn, .head-actions .icon-btn { width: 40px; height: 40px; }
  .cal-nav { gap: 6px; }
}
@media (max-width: 860px) {
  /* week view: seven columns do not fit a phone, so the days stack as an agenda */
  .week { grid-template-columns: minmax(0, 1fr); }
  .wcol { min-height: 0; padding: 10px 12px; }
  .wev { display: flex; align-items: baseline; gap: 10px; font-size: 14px; padding: 8px 10px; }
  .wev .mono { display: block; flex: none; width: 92px; font-size: 12px; white-space: nowrap; }
  .wev > div { min-width: 0; overflow-wrap: anywhere; }
}
@media (max-width: 860px) {
  /* schedule list: each entry is a small card instead of a six-column table that clips its right side */
  .tbl { display: block; overflow: visible; }
  .tbl thead { display: none; }
  .tbl tbody { display: block; }
  .tbl tr { display: grid; grid-template-columns: 22px auto minmax(0, 1fr) auto; column-gap: 8px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line); }
  .tbl tr:last-child { border-bottom: 0; }
  .tbl td { padding: 0; border: 0; min-width: 0; }
  .tbl td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .tbl td:nth-child(2) { grid-column: 2 / 4; grid-row: 1; font-weight: 500; overflow-wrap: anywhere; }
  .tbl td:nth-child(3) { grid-column: 2 / 4; grid-row: 2; font-size: 12.5px; }
  .tbl td:nth-child(4) { grid-column: 2; grid-row: 3; font-size: 12.5px; color: var(--muted); }
  .tbl td:nth-child(5) { grid-column: 3; grid-row: 3; font-size: 12.5px; color: var(--muted); }
  .tbl td:nth-child(6) { grid-column: 4; grid-row: 1 / span 3; align-self: center; display: flex; align-items: center; gap: 4px; }
  .tbl .tr > * { margin-left: 0; }
  .tbl td .switch { margin: 0 4px; }
}
.cyc-i .muted { white-space: nowrap; }
@media (max-width: 860px) { .task-dlg .cyc-i input[type="number"].num { width: 56px; flex: none; } }
:root[data-theme="light"] input::placeholder, :root[data-theme="light"] textarea::placeholder { color: #85857f; }   /* --faint is 2.5:1 on white */
@media (max-width: 860px) {
  /* no keyboard on a phone: the palette hides its key hints and keeps tappable rows */
  .pal .pal-foot, .pal .pal-it kbd, .side-search kbd, .side-add kbd { display: none; }
  .pal { margin: 8px auto auto; }
  .pal-it { min-height: 44px; }
  .pal-list { max-height: calc(100dvh - 140px); }
}
@media (max-width: 860px) { .sk-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .toast button { min-width: 40px; min-height: 40px; } }
.empty { color: var(--muted); }

/* phone time field: native wheel over the button */
.pk-nat { position: relative; }
.pk-nat .pk-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; min-width: 0; max-width: 100%; box-sizing: border-box; -webkit-appearance: none; appearance: none; font-size: 16px; z-index: 1; }
.pk-nat .pk-nclear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); z-index: 2; width: 36px; height: 36px; border: 0; background: none; color: var(--muted); font-size: 20px; }
.add-big { display: flex; width: 100%; justify-content: center; min-height: 48px; font-size: 16px; margin: 0 auto 14px; }

/* no sideways scroll inside dialogs; settings controls share one width, name centred */
.overlay .modal, .overlay form { overflow-x: hidden; max-width: 100%; }
.settings .srow > .seg, .settings .srow input.txt { width: 250px; max-width: 62%; box-sizing: border-box; margin-left: auto; }
.settings .srow > .seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; overflow: hidden; }
.settings .srow > .seg button { justify-content: center; padding-left: 4px; padding-right: 4px; }
.settings .srow input.txt { text-align: center; }
#ms-times.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.settings .srow input.txt { flex: none; }

/* phone: the bottom bar would float above the on-screen keyboard; hide it while a field is focused */
@media (max-width: 860px) { .kbd-open #side { display: none !important; } .kbd-open #main { padding-bottom: 24px; } }
