:root {
  --paper: #fafaf6; --paper-2: #f2f1ea; --ink: #1c1c19; --ink-2: #55554d; --ink-3: #6b6b60;
  --line: #dcdbd2; --accent: #4a6b3a; --accent-ink: #fff; --warn: #8a5a1c; --danger: #a8432f;
  --s-3: #b04a33; --s-2: #d98a76; --s-1: #ecc3b8; --s0: #d5d6ce; --s1: #c4dbb1; --s2: #86b56a; --s3: #4a7d36;
  --none: #eceae2; --missed: #dedcd3; --shadow: 0 1px 0 rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.08);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151613; --paper-2: #1d1e1a; --ink: #ecebe3; --ink-2: #b2b1a6; --ink-3: #939389; --line: #33342e;
    --accent: #8fb877; --accent-ink: #11140e; --warn: #d9a45a; --danger: #e0806a;
    --s-3: #c65a40; --s-2: #9b5646; --s-1: #5c3a33; --s0: #4a4b47; --s1: #3c5530; --s2: #557f40; --s3: #7fb35f;
    --none: #22231e; --missed: #2e2f29; --shadow: 0 8px 24px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --paper: #151613; --paper-2: #1d1e1a; --ink: #ecebe3; --ink-2: #b2b1a6; --ink-3: #939389; --line: #33342e;
    --accent: #8fb877; --accent-ink: #11140e; --warn: #d9a45a; --danger: #e0806a;
    --s-3: #c65a40; --s-2: #9b5646; --s-1: #5c3a33; --s0: #4a4b47; --s1: #3c5530; --s2: #557f40; --s3: #7fb35f;
    --none: #22231e; --missed: #2e2f29; --shadow: 0 8px 24px rgba(0,0,0,.5);
    color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.4; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }

/* layout: one column on phones, two panes on wide screens */
.layout { height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); max-width: 1180px; margin: 0 auto; }
.pane { overflow-y: auto; overflow-x: hidden; position: relative; -webkit-overflow-scrolling: touch; }
#pane-main { max-width: 600px; width: 100%; margin: 0 auto; }
#pane-side { position: fixed; inset: 0; z-index: 20; background: var(--paper); display: none; }
body.sheet-open #pane-side { display: block; }
body.sheet-open { overflow: hidden; }
.sheet-inner { max-width: 600px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.placeholder { display: none; }
@media (min-width: 900px) {
  .layout { grid-template-columns: 460px minmax(0, 1fr); gap: 0; }
  #pane-main { max-width: none; margin: 0; border-right: 1px solid var(--line); }
  #pane-side { position: static; display: block; z-index: auto; }
  body.sheet-open { overflow: auto; }
  .placeholder { display: flex; }
  .sheet-inner { max-width: 640px; margin: 0; }
}

/* header + generic */
.top { display: flex; align-items: center; gap: 12px; padding: 18px 20px 6px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.01em; font-size: 18px; flex: 1; }
.mark { display: grid; grid-template-columns: repeat(3, 8px); gap: 2px; }
.mark i { width: 8px; height: 8px; border-radius: 2px; display: block; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-2); }
.icon-btn:hover { background: var(--paper-2); }
.icon-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.caption { padding: 0 20px 14px; font-size: 13px; color: var(--ink-2); display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.caption b { font-family: var(--mono); font-weight: 600; color: var(--ink); }

/* dashboard rows */
.rows { padding: 0 12px 150px; }
.row { display: block; padding: 10px 8px 12px; border-top: 1px solid var(--line); background: var(--paper); position: relative; }
.row.dragging { z-index: 5; box-shadow: var(--shadow); background: var(--paper); border-radius: 10px; border-top-color: transparent; }
.row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.grip { width: 28px; height: 28px; display: grid; place-items: center; color: var(--ink-3); touch-action: none; cursor: grab; border-radius: 6px; }
.grip:hover, .grip:focus-visible { background: var(--paper-2); color: var(--ink); }
.grip svg { width: 14px; height: 14px; fill: currentColor; }
.row-title { flex: 1; text-align: left; font-weight: 600; font-size: 15px; display: flex; align-items: baseline; gap: 8px; min-height: 28px; align-items: center; }
.row-title .n { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--ink-3); }
.pin { width: 28px; }
.strip { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 3px; padding-left: 36px; }
.cell { aspect-ratio: 1 / 1; border-radius: 4px; background: var(--none); position: relative; min-width: 0; }
.cell:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.cell.pend::after { content: ""; position: absolute; right: 3px; top: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--warn); }
.s-3 { background: var(--s-3); } .s-2 { background: var(--s-2); } .s-1 { background: var(--s-1); }
.s0 { background: var(--s0); } .s1 { background: var(--s1); } .s2 { background: var(--s2); } .s3 { background: var(--s3); }
.sn { background: var(--none); }
.ck { background: var(--accent); } .ms { background: var(--missed); }
.axis { display: flex; justify-content: space-between; padding: 0 0 0 36px; margin-top: 4px; font-size: 11px; color: var(--ink-3); font-family: var(--mono); }
.row.honest { border-top: 0; padding-top: 4px; }

/* dock */
.dock { position: sticky; bottom: 0; margin-top: auto; padding: 18px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--paper) 62%, transparent); display: flex; flex-direction: column; align-items: center; gap: 12px; pointer-events: none; }
.dock > * { pointer-events: auto; }
.dock-row { display: flex; align-items: center; justify-content: center; gap: 18px; }
.fab { width: 56px; height: 56px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; box-shadow: var(--shadow); font-size: 28px; line-height: 1; }
.fab.mic { width: 76px; height: 76px; background: var(--accent); color: var(--accent-ink); }
.fab.mic.on { animation: pulse 1.2s infinite; }
.fab svg { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.fab.mic svg { width: 34px; height: 34px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(74,107,58,.5); } 100% { box-shadow: 0 0 0 22px rgba(74,107,58,0); } }
.pair { display: flex; gap: 10px; width: 100%; max-width: 420px; }
.btn { flex: 1; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); font-weight: 600; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { background: var(--paper-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); }
.btn[disabled] { opacity: .4; cursor: not-allowed; filter: none; }
.btn.small { height: 36px; font-size: 14px; flex: none; }
.btn.block { width: 100%; flex: none; }

/* sheet chrome */
.sheet-top { display: flex; align-items: center; gap: 8px; padding: 14px 12px 4px; position: sticky; top: 0; background: var(--paper); z-index: 3; }
.sheet-title { flex: 1; min-width: 0; }
.sheet-title h1 { font-size: 22px; margin: 0; letter-spacing: -.02em; line-height: 1.15; }
.sheet-title .sub { font-size: 13px; color: var(--ink-2); }
.sheet-body { padding: 8px 20px 16px; flex: 1; }
.daynav { display: flex; gap: 8px; align-items: center; margin: 6px 0 14px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line); font-size: 13px; font-weight: 550; display: inline-flex; align-items: center; gap: 6px; background: var(--paper); }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip.warn { color: var(--warn); border-color: var(--warn); }
input[type="date"], input[type="time"], input[type="text"], input[type="number"], select, textarea { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; height: 38px; padding: 0 10px; max-width: 100%; }
textarea { height: auto; padding: 10px; width: 100%; resize: vertical; }

/* net line */
.netline { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--paper-2); font-size: 14px; margin-bottom: 14px; }
.netline .dotc { width: 14px; height: 14px; border-radius: 4px; }

/* items */
.items { border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); text-align: left; width: 100%; }
.item .cat { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 600; }
.item .desc { font-size: 16px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.item .body { flex: 1; min-width: 0; }
.item .note { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-size: 11px; font-weight: 650; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-3); white-space: nowrap; }
.badge.added { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.badge.edited { color: var(--warn); border-color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.badge.removed { color: var(--danger); border-color: var(--danger); }
.badge.need { color: var(--warn); border-color: var(--warn); }
.item.removed .desc, .item.removed .cat, .item.removed .note { text-decoration: line-through; opacity: .55; }
.mini { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); display: grid; place-items: center; font-size: 20px; line-height: 1; flex: none; }
.mini:hover { background: var(--paper-2); }
.empty { padding: 26px 0; text-align: center; color: var(--ink-2); }
.say { display: flex; gap: 8px; margin: 14px 0 4px; }
.say input { flex: 1; height: 44px; }
.hint { font-size: 12px; color: var(--ink-3); margin: 0 0 6px; }
.warnbox { font-size: 13px; color: var(--warn); border: 1px solid var(--warn); border-radius: 10px; padding: 8px 12px; margin: 10px 0; }

/* pickers and forms */
.picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.pick { border: 1px solid var(--line); border-radius: 12px; padding: 14px 14px; text-align: left; display: flex; flex-direction: column; gap: 2px; min-height: 64px; }
.pick:hover { background: var(--paper-2); }
.pick.logged { border-color: var(--accent); }
.pick .t { font-weight: 600; }
.pick .s { font-size: 12px; color: var(--ink-2); }
.pick .s.ok { color: var(--accent); }
.form { margin-top: 14px; border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: var(--paper-2); }
.form h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper .val { font-family: var(--mono); font-size: 26px; min-width: 120px; text-align: center; font-variant-numeric: tabular-nums; }
.stepper .mini { width: 44px; height: 44px; font-size: 24px; background: var(--paper); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { padding: 8px 14px; font-size: 14px; font-weight: 550; border-right: 1px solid var(--line); background: var(--paper); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--ink); color: var(--paper); }
.rate { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.rate button { border: 1px solid var(--line); border-radius: 10px; padding: 10px 0; background: var(--paper); font-family: var(--mono); font-size: 18px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rate button small { font-family: var(--sans); font-size: 10px; color: var(--ink-3); }
.rate button.on { background: var(--ink); color: var(--paper); } .rate button.on small { color: var(--paper); }
.calc { font-size: 13px; color: var(--ink-2); font-family: var(--mono); margin-top: 6px; }
.formbtns { display: flex; gap: 10px; }

/* detail grid */
.grid90 { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; }
.grid90 .cell { aspect-ratio: 1 / 1; }
.months { display: grid; gap: 3px; font-size: 11px; color: var(--ink-3); margin-bottom: 4px; font-family: var(--mono); }
.months span { white-space: nowrap; overflow: visible; }
.gridwrap { display: grid; grid-template-columns: 22px 1fr; gap: 6px; }
.dows { display: grid; grid-template-rows: repeat(7, 1fr); gap: 3px; font-size: 10px; color: var(--ink-3); font-family: var(--mono); padding-top: 0; }
.dows span { display: flex; align-items: center; }
.legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); margin-top: 14px; flex-wrap: wrap; }
.legend i { width: 16px; height: 16px; border-radius: 4px; display: inline-block; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.stat { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-family: var(--mono); font-size: 22px; font-weight: 600; }
.stat span { font-size: 12px; color: var(--ink-2); }
.imp { position: relative; }
.stars { display: inline-flex; gap: 2px; font-size: 20px; }
.stars button { color: var(--ink-3); line-height: 1; padding: 2px; }
.stars button.on { color: var(--warn); }
.insight { border-left: 3px solid var(--accent); padding: 8px 12px; background: var(--paper-2); border-radius: 0 10px 10px 0; font-size: 14px; margin: 14px 0; }
.section { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 650; margin: 22px 0 8px; }

/* onboarding + settings */
.page { padding: 28px 22px 40px; }
.hero h1 { font-size: 34px; line-height: 1.08; letter-spacing: -.03em; margin: 26px 0 10px; }
.hero p { color: var(--ink-2); font-size: 17px; margin: 0 0 26px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.check { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; text-align: left; width: 100%; }
.check .box { width: 22px; height: 22px; border: 1.5px solid var(--ink-3); border-radius: 6px; display: grid; place-items: center; flex: none; }
.check.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.check.on .box { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.check .t { font-weight: 600; } .check .s { font-size: 12px; color: var(--ink-2); }
.steps { display: flex; gap: 6px; margin-bottom: 6px; }
.steps i { height: 4px; flex: 1; border-radius: 2px; background: var(--line); } .steps i.on { background: var(--accent); }
.timeline { display: flex; align-items: center; gap: 10px; }
.settings-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.settings-row .grow { flex: 1; min-width: 0; }
.toggle { width: 46px; height: 28px; border-radius: 14px; background: var(--missed); position: relative; flex: none; transition: background .15s; }
.toggle::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--paper); transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.toggle.on { background: var(--accent); } .toggle.on::after { transform: translateX(18px); }
.placeholder { align-items: center; justify-content: center; text-align: center; color: var(--ink-3); height: 100%; padding: 40px; flex-direction: column; gap: 10px; }
.placeholder .mark i { width: 14px; height: 14px; } .placeholder .mark { grid-template-columns: repeat(3, 14px); gap: 4px; }
#toast { position: fixed; left: 50%; bottom: 150px; transform: translate(-50%, 20px); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 50; max-width: min(92vw, 440px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.daynav input[type="date"] { min-width: 0; flex: 1 1 130px; }
@media (max-width: 440px) { .daynav .icon-btn { display: none; } }

.nudge { margin: 0 20px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); display: flex; align-items: center; gap: 12px; justify-content: space-between; font-size: 14px; }
.nudge .btn { flex: none; }

/* accessibility */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fab:focus-visible, .chip.on:focus-visible, .btn.primary:focus-visible { outline-color: var(--ink); }
.cell:focus-visible { outline-color: var(--ink); }
.sheet-title h1:focus { outline: none; }
.grip { position: relative; }
.grip::after { content: ""; position: absolute; inset: -8px -4px; }
@media (pointer: coarse) {
  .mini, .chip, .icon-btn, .btn.small, .stars button, .seg button { min-height: 44px; min-width: 44px; }
  .chip { padding: 0 14px; }
  .mini { width: 44px; height: 44px; }
  .stepper .mini { width: 48px; height: 48px; }
  .stars button { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .fab.mic.on { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent); } }

/* Single column everywhere: the day log is a modal (full screen on phones), never a second column. */
.layout { display: block; max-width: 640px; margin: 0 auto; }
#pane-main { max-width: none; margin: 0; border-right: 0; }
#pane-side { position: fixed; inset: 0; z-index: 20; display: none; overflow: hidden; background: var(--paper); }
body.sheet-open #pane-side { display: block; }
body.sheet-open { overflow: hidden; }
.sheet-inner { max-width: none; margin: 0; height: 100%; overflow-y: auto; }
.placeholder { display: none !important; }
@media (min-width: 700px) {
  #pane-side { background: rgba(18, 18, 14, .55); }
  body.sheet-open #pane-side { display: grid; place-items: center; padding: 24px; }
  .sheet-inner { width: min(600px, 100%); height: auto; max-height: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
}

/* Column highlight: hover or focus a day to light the whole column; the date shows only then. */
.dayhint { position: relative; height: 18px; margin-top: 4px; padding-left: 36px; font-size: 12px; font-family: var(--mono); color: var(--ink); white-space: nowrap; }
.dayhint span { display: inline-block; }
#rows.scrub .cell:not(.hl) { opacity: .4; }
#rows .cell.hl { opacity: 1; box-shadow: 0 0 0 2px var(--ink); position: relative; z-index: 1; }
.cell { transition: opacity .08s; }

.toast-undo { margin-left: 10px; padding: 2px 10px; border-radius: 8px; border: 1px solid currentColor; font-weight: 650; pointer-events: auto; }
#toast:has(.toast-undo) { pointer-events: auto; }

/* numeric text fields */
.stepper .val.numtext { width: 150px; text-align: center; font-family: var(--mono); font-size: 24px; height: 48px; border-radius: 12px; }
@media (max-width: 400px) { .stepper .val.numtext { width: 120px; } }

/* notes and input log */
.daynote { margin: 14px 0 0; }
.daynote label, .field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.daynote textarea { width: 100%; }
.inputlog { margin: 10px 0 0; font-size: 13px; color: var(--ink-2); }
.inputlog summary { cursor: pointer; padding: 6px 0; }
.inputlog ul { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.inputlog li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.inputlog q { quotes: none; color: var(--ink); }
.inputlog time { font-family: var(--mono); font-size: 12px; }

/* voice */
.voicecard { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 12px 0; background: var(--paper-2); }
.voicecard.listening { border-color: var(--danger); }
.vstat { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-size: 14px; }
.vstat .rec { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); }
.voicecard.listening .rec { background: var(--danger); animation: pulse 1.2s infinite; }
.voicecard textarea { width: 100%; margin-bottom: 8px; }
.voicecard .pair { max-width: none; }
.fab.mic.on { background: var(--danger); color: #fff; animation: pulseRed 1.2s infinite; }
.fab.mic.paused { background: var(--paper); color: var(--danger); box-shadow: inset 0 0 0 3px var(--danger), var(--shadow); }
@keyframes pulseRed { 0% { box-shadow: 0 0 0 0 rgba(168, 67, 47, .55); } 100% { box-shadow: 0 0 0 24px rgba(168, 67, 47, 0); } }

/* stars */
.cell.star::after { content: "★"; position: absolute; right: -2px; top: -7px; font-size: 11px; line-height: 1; color: var(--warn); text-shadow: 0 0 2px var(--paper), 0 0 2px var(--paper); pointer-events: none; }
.chip[disabled] { opacity: .45; cursor: not-allowed; }
.chip.on[data-act="star"] { background: var(--warn); border-color: var(--warn); color: var(--paper); }
.nudge.sample { border-color: var(--warn); }

.rate button small { display: none; }
.rate-cap { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.rate-cap b { font-size: 14px; color: var(--ink); font-weight: 650; text-align: center; flex: 1; }
.netline { flex-wrap: wrap; }
.chip { white-space: nowrap; }
.voicecard .pair .btn { padding: 0 10px; white-space: nowrap; }
.voicecard .pair .btn.primary { flex: 1.4; }
.voicecard.listening .rec { animation: pulseDot 1.2s infinite; }
@keyframes pulseDot { 0% { box-shadow: 0 0 0 0 rgba(168, 67, 47, .6); } 100% { box-shadow: 0 0 0 9px rgba(168, 67, 47, 0); } }
.rate button { padding: 14px 0; }

/* ===================== v3: compact timelines, full pages, simple chrome ===================== */
:root { --star: #e0a526; }

/* pages instead of a modal: the day and every sub page replace the dashboard on all screen sizes */
.layout { display: block; max-width: none; margin: 0; height: 100dvh; }
#pane-main { max-width: 560px; margin: 0 auto; border-right: 0; }
#pane-side { position: static !important; inset: auto; z-index: auto; display: none; height: 100%; overflow-y: auto; overflow-x: hidden; background: var(--paper) !important; padding: 0 !important; place-items: normal; }
body.sheet-open #pane-main { display: none; }
body.sheet-open #pane-side { display: block !important; }
body.sheet-open { overflow: hidden; }
.sheet-inner { width: 100% !important; max-width: 560px !important; margin: 0 auto !important; height: auto !important; min-height: 100%; max-height: none !important; overflow: visible !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; background: transparent !important; display: flex; flex-direction: column; }
.sheet-top { padding: 8px 8px 2px; }
.sheet-title h1 { font-size: 19px; }
.sheet-body { padding: 4px 14px 16px; }

/* page tools: undo, redo, history stay quiet */
.tools { display: flex; align-items: center; margin-left: auto; flex: none; }
.tools .icon-btn { width: 32px; height: 32px; color: var(--ink-3); }
.tools .icon-btn svg { width: 17px; height: 17px; }
.tools .icon-btn:hover:not([disabled]), .tools .icon-btn:focus-visible { color: var(--ink); background: var(--paper-2); }
.tools .icon-btn[disabled] { opacity: .35; cursor: default; }
.tools .saved { font-size: 11px; color: var(--ink-3); margin-right: 4px; animation: savedfade 2s forwards; }
@keyframes savedfade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
.history { margin: 4px 12px 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); max-height: 260px; overflow-y: auto; }
.history ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.hist { width: 100%; display: flex; justify-content: space-between; gap: 10px; padding: 7px 8px; border-radius: 8px; font-size: 13px; text-align: left; }
.hist:hover { background: var(--paper); }
.hist.undone { opacity: .55; }

/* dashboard: small, calm, many rows */
.top { padding: 10px 12px 0 14px; }
.brand { font-size: 15px; gap: 8px; }
.mark { grid-template-columns: repeat(3, 6px); gap: 2px; }
.mark i { width: 6px; height: 6px; border-radius: 1.5px; }
.topbtns { display: flex; align-items: center; gap: 2px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); height: 30px; padding: 0 10px; font-size: 13px; }
.btn.ghost[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.caption { padding: 0 14px 8px; gap: 10px; font-size: 12px; color: var(--ink-3); }
.rows { padding: 0 10px 130px 12px; }
.row { display: flex; align-items: flex-start; gap: 8px; padding: 3px 0 3px 4px; border-top: 0; border-radius: 6px; background: transparent; }
.row.honest { padding-top: 0; margin-bottom: 2px; }
.row-head { width: 96px; flex: none; margin: 0; display: flex; align-items: center; gap: 0; min-height: 0; }
.row-title { flex: 1; min-width: 0; margin: 0; font-size: 12.5px; font-weight: 600; line-height: 18px; min-height: 0; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.row-title .n { font-size: 10.5px; color: var(--ink-3); font-weight: 500; }
.rowbody { flex: 1; min-width: 0; position: relative; }
.strip { display: flex; gap: 2px; padding: 0; grid-template-columns: none; }
.cell { flex: 1 1 0; min-width: 0; height: auto; aspect-ratio: 1 / 1; max-width: 26px; max-height: 26px; border-radius: 3px; }
.dayhint { position: relative; height: 14px; margin: 2px 0 0; padding: 0; font-size: 11px; font-family: var(--mono); color: var(--ink); white-space: nowrap; }
.today-tag { position: absolute; right: 0; top: 0; font-weight: 700; color: var(--ink); }
#rows.scrub .cell:not(.hl) { opacity: 1; }
#rows .cell.hl { box-shadow: 0 0 0 1.5px var(--ink); position: relative; z-index: 1; opacity: 1; }
.cell.star::after { content: "★"; position: absolute; right: -8px; top: -13px; font-size: 21px; line-height: 1; color: var(--star); text-shadow: 0 0 0 var(--ink), 0 0 2px var(--paper), 0 0 2px var(--paper); -webkit-text-stroke: .6px var(--ink); pointer-events: none; z-index: 2; }

/* needs attention */

/* edit mode */
.row-head.edit { gap: 2px; width: 150px; }
.row-head .grip { width: 26px; height: 24px; flex: none; }
.rename { width: 100%; min-width: 0; height: 26px; padding: 0 6px; font-size: 12.5px; border-radius: 6px; }
.mini.x { width: 24px; height: 24px; font-size: 16px; border-radius: 6px; flex: none; }
.editing .rowbody { opacity: .8; }
.editbox { margin: 10px 0 0 4px; padding: 10px; border: 1px dashed var(--line); border-radius: 12px; }
.advanced { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 10px; }
.advanced summary { cursor: pointer; color: var(--ink-3); font-size: 13px; }

/* smaller floating buttons */
.fab { width: 46px; height: 46px; }
.fab svg { width: 22px; height: 22px; }
.fab.mic { width: 60px; height: 60px; }
.fab.mic svg { width: 28px; height: 28px; }
.dock { padding-top: 10px; gap: 8px; }

/* colors for people with red-green color blindness: blue and orange, same lightness steps */
:root[data-palette="bluorange"] { --s-3: #a04a00; --s-2: #d9811a; --s-1: #f4cfa0; --s1: #b9d3ea; --s2: #5b9bd1; --s3: #1f5fa6; }
:root[data-palette="bluorange"] .ck { background: var(--s3); }
@media (prefers-color-scheme: dark) {
  :root[data-palette="bluorange"]:not([data-theme="light"]) { --s-3: #e08a2c; --s-2: #a8651b; --s-1: #5e4222; --s1: #27465f; --s2: #3f7fb3; --s3: #6fb0e6; }
}
:root[data-palette="bluorange"][data-theme="dark"] { --s-3: #e08a2c; --s-2: #a8651b; --s-1: #5e4222; --s1: #27465f; --s2: #3f7fb3; --s3: #6fb0e6; }

.row-head { width: 108px; }
#pane-main { display: flex; flex-direction: column; min-height: 100%; }
#pane-main > .dock { margin-top: auto; }

/* readable "needs attention" text in every theme and palette */
:root { --alert: #a43a26; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --alert: #f0907a; } }
:root[data-theme="dark"] { --alert: #f0907a; }
:root[data-palette="bluorange"] { --alert: #964300; }
@media (prefers-color-scheme: dark) { :root[data-palette="bluorange"]:not([data-theme="light"]) { --alert: #f2a95a; } }
:root[data-palette="bluorange"][data-theme="dark"] { --alert: #f2a95a; }

/* ===================== v4: quieter hover, star inside the day, inline editing ===================== */
.row-title.quiet { color: var(--ink-3); font-weight: 500; }
/* hover: a faint outline on the column, nothing else changes */
#rows .cell.hl { box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 35%, transparent); filter: brightness(1.08); z-index: 1; }
/* the star sits inside its day */
.cell { container-type: inline-size; }
.cell.star::after { content: "★"; position: absolute; inset: 0; right: auto; top: auto; display: grid; place-items: center; font-size: 72cqw; line-height: 1; color: #f7d463; -webkit-text-stroke: 0; text-shadow: 0 0 1.5px rgba(0, 0, 0, .75); pointer-events: none; z-index: 1; }

/* two-line habit rows */

/* edit mode inline controls */
.kindsel { height: 26px; border-radius: 6px; font-size: 11.5px; padding: 0 4px; flex: none; max-width: 92px; }
.row-head.edit { width: 100%; max-width: 270px; }
.addrow { width: 100%; padding: 11px 12px; border: 1px dashed var(--line); border-radius: 12px; color: var(--ink-2); font-weight: 600; font-size: 14px; text-align: left; margin-top: 10px; }
.addrow:hover { background: var(--paper-2); }
.chooser { margin-top: 10px; padding: 10px; border: 1px dashed var(--line); border-radius: 12px; }

/* inline entry editor */
.itemwrap { border-bottom: 1px solid var(--line); }
.itemwrap .item { border-bottom: 0; }
.itemwrap.open { background: var(--paper-2); border-radius: 12px; border-bottom-color: transparent; margin: 4px -8px; padding: 0 8px 12px; }
.editor { padding: 2px 4px 4px; }
.editor .field { margin-bottom: 14px; }
.items { border-top: 1px solid var(--line); }

/* the microphone: one button at the bottom, a labelled pill on larger screens */
.dock { align-items: center; }
.miclabel { display: none; font-weight: 650; font-size: 15px; white-space: nowrap; }
@media (min-width: 700px) {
  .fab.mic { width: auto; height: 54px; padding: 0 24px 0 18px; border-radius: 27px; display: inline-flex; align-items: center; gap: 10px; }
  .fab.mic svg { width: 24px; height: 24px; }
  .miclabel { display: inline; }
}
.fab.mic.on { background: var(--danger); color: #fff; }

/* newest-left timelines: week gap after the week's first day, Today tag at the left */
.strip .cell.ws { margin-left: 0; margin-right: 5px; }

/* first run */
.pitch { list-style: none; margin: 4px 0 24px; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: 17px; color: var(--ink-2); }
.pitch li { padding-left: 18px; position: relative; }
.pitch li::before { content: ""; position: absolute; left: 0; top: .6em; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
.pitch b { color: var(--ink); }
.privacy-note { margin: 22px 0 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); font-size: 14px; color: var(--ink-2); }
.privacy-note b { color: var(--ink); }
.tourcard { margin: 6px 12px 10px; padding: 12px; border: 1px solid var(--accent); border-radius: 12px; background: var(--paper-2); display: flex; gap: 12px; align-items: center; justify-content: space-between; font-size: 14px; flex-wrap: wrap; }
.tourbtns { display: flex; gap: 6px; flex: none; }
.tour-hl { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.fab.tour-hl { outline-offset: 5px; border-radius: 50%; }

/* microphone: unmistakable when it is live */
.fab.mic.on, .fab.mic.paused { width: auto; height: 58px; padding: 0 24px 0 18px; border-radius: 29px; display: inline-flex; align-items: center; gap: 12px; }
.fab.mic.on .miclabel, .fab.mic.paused .miclabel { display: inline; font-size: 15px; }
.fab.mic.on { background: #c9301b; color: #fff; box-shadow: 0 0 0 4px rgba(201, 48, 27, .25), var(--shadow); animation: pulseRed 1.4s infinite; }
.fab.mic.paused { background: #8a5a1c; color: #fff; box-shadow: var(--shadow); }
.eq { display: inline-flex; align-items: center; gap: 3px; height: 24px; }
.eq i { width: 4px; height: 8px; border-radius: 2px; background: currentColor; animation: eqbar .9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: .15s; } .eq i:nth-child(3) { animation-delay: .3s; } .eq i:nth-child(4) { animation-delay: .45s; }
@keyframes eqbar { 0%, 100% { height: 6px; } 50% { height: 22px; } }
body.listening::before { content: ""; position: fixed; left: 0; right: 0; top: 0; height: 4px; background: #c9301b; z-index: 60; }

/* prompt bar: type or talk, same bar everywhere */
.dock { pointer-events: none; }
.dock > * { pointer-events: auto; }
.promptbar { display: flex; align-items: center; gap: 6px; width: min(640px, calc(100vw - 24px)); padding: 6px 6px 6px 16px; border-radius: 30px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.promptbar .sayinput { flex: 1; min-width: 0; height: 42px; border: 0; background: transparent; padding: 0; font-size: 16px; outline: none; }
.promptbar .sayinput:focus-visible { outline: none; }
.promptbar:focus-within { border-color: var(--accent); }
.promptbar .send { width: 38px; height: 38px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; flex: none; opacity: .85; }
.promptbar .send svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.promptbar .fab.mic { width: 46px !important; height: 46px !important; padding: 0 !important; border-radius: 50% !important; box-shadow: none; flex: none; gap: 0; }
.promptbar .fab.mic .miclabel { display: none !important; }
.promptbar .fab.mic svg { width: 22px; height: 22px; }
.promptbar.live { padding: 6px; }
.promptbar.live .fab.mic { flex: 1; width: 100% !important; height: 54px !important; border-radius: 27px !important; padding: 0 22px !important; display: inline-flex; justify-content: center; gap: 12px; }
.promptbar.live .fab.mic .miclabel { display: inline !important; }
.barhint { display: none; font-size: 12px; color: var(--ink-3); margin-top: 6px; text-align: center; }
@media (min-width: 700px) { .barhint { display: block; } }

/* room above the prompt bar so nothing ends up hidden under it */
.sheet-body { padding-bottom: 120px; }

/* one design for viewing and editing: the habit name is a text field that looks like text */
.rows .row-head { width: 108px; position: relative; }
.row-title.rename { display: block; width: 100%; height: 20px; padding: 0 3px; margin: 0; border: 0; border-radius: 4px; background: transparent; color: inherit; font: inherit; font-size: 12.5px; font-weight: 600; line-height: 20px; text-overflow: ellipsis; box-shadow: none; }
.row-title.rename:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.row-title.rename:focus { outline: none; background: var(--paper-2); box-shadow: 0 0 0 1.5px var(--accent); text-overflow: clip; }
.row-head .grip, .row-head .rowtools { opacity: 0; pointer-events: none; transition: opacity .12s; }
.row:hover .grip, .row:hover .rowtools, .row:focus-within .grip, .row:focus-within .rowtools { opacity: 1; pointer-events: auto; }
.row-head .grip { position: absolute; left: -13px; top: 0; width: 14px; height: 20px; padding: 0; background: transparent; }
.row-head .grip svg { width: 10px; height: 10px; }
.row-head .rowtools { position: absolute; right: 0; top: -1px; display: flex; gap: 0; background: linear-gradient(to right, transparent, var(--paper) 18%); padding-left: 10px; }
.mini.ghost { width: 22px; height: 22px; border: 0; background: transparent; color: var(--ink-2); border-radius: 5px; }
.mini.ghost:hover { background: var(--paper-2); color: var(--ink); }
.mini.ghost svg { width: 14px; height: 14px; stroke: currentColor; fill: currentColor; stroke-width: 1.6; }
.row .confirm { position: absolute; left: 112px; right: 0; top: 0; bottom: 0; display: flex; align-items: center; gap: 8px; padding: 0 6px; background: var(--paper); border: 1px solid var(--s-3); border-radius: 8px; font-size: 12px; z-index: 3; }
.row .confirm span { flex: 1; min-width: 0; }
.row { position: relative; }
.addhabit { margin: 8px 0 0 4px; }
.addhabit .addrow { margin-top: 4px; padding: 7px 10px; font-size: 13px; width: auto; display: inline-block; }
.hiddenlist { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.hiddenlist .chip { height: 26px; font-size: 12px; }

/* hover tooltip on the timeline: entries and notes for that day */
.item .note { font-style: italic; color: var(--ink-2); font-size: 13px; }

/* star lives in the page header, as just a star */
.starbtn { font-size: 21px; line-height: 1; color: var(--ink-3); }
.starbtn.on { color: var(--star); }
.tools .starbtn:hover:not([disabled]) { color: var(--star); }
.starbtn[disabled] { opacity: .35; }
.chip.starchip { font-size: 18px; padding: 0 12px; }
.chip.starchip.on { background: transparent; border-color: var(--star); color: var(--star); }
.daynote { margin: 0 0 6px; }
.daynote textarea { min-height: 44px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* small, quiet row tools: the hit area grows without the look growing */
.row-head .rowtools .mini.ghost { width: 24px !important; height: 24px !important; min-width: 0 !important; min-height: 0 !important; position: relative; }
.row-head .rowtools .mini.ghost::after { content: ""; position: absolute; inset: -9px -3px; }
.row-title.quiet { padding-left: 3px; }
.row-head .grip { min-width: 0 !important; min-height: 0 !important; }

/* date line above the Check-ins row */
.row.hintrow { padding-top: 0; padding-bottom: 0; margin-bottom: 1px; }
.row.hintrow .row-head { height: 14px; }
.row.hintrow .dayhint { height: 14px; margin: 0; }
.row.honest { margin-bottom: 4px; }

/* compare with your past self: a label on the 8th day, a quiet dot for good news */
.week-tag { position: absolute; top: 0; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.cell.up::before { content: ""; position: absolute; left: 50%; bottom: -3px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1.5px var(--paper); z-index: 2; pointer-events: none; }
.vslast { flex-basis: 100%; font-size: 13px; color: var(--ink-2); margin-top: 2px; }

/* compare control above the second week */
.week-tag { display: none; }


/* stars: a clean white star drawn inside the day, no emoji */
.cell.star::after { content: ""; position: absolute; inset: 0; right: 0; top: 0; left: 0; bottom: 0; display: block; font-size: 0; color: transparent; text-shadow: none; -webkit-text-stroke: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.6l2.9 6.1 6.7.9-4.9 4.6 1.3 6.6L12 17.5 6 20.8l1.3-6.6-4.9-4.6 6.7-.9z' fill='white' stroke='rgba(0,0,0,.4)' stroke-width='1' stroke-linejoin='round'/%3E%3C/svg%3E") center / 68% no-repeat; z-index: 1; pointer-events: none; }

/* While hovering a day, the Today outline steps aside so only the hovered column stands out. */


/* Header: the focused weekday names both weeks, so nothing in it changes width or position while you move around. */

/* Two header lines: the compare control on top, each weekday label right above its own box. */

/* Weekday labels above the timeline open the all-Mondays page. */

/* One weekday across the last 14 weeks; months are separated by a gap. */
.wrows .row { align-items: center; }
.wstrip { display: grid; gap: 2px; }
.wstrip i { display: block; }
.wstrip .cell { max-width: none; max-height: none; width: 100%; }
.wmonths { display: grid; gap: 2px; font-size: 11px; font-family: var(--mono); color: var(--ink-3); white-space: nowrap; }
.row.hintrow .wmonths { height: 14px; }

/* The prompt bar fits its pane instead of the window, so nothing is cut off. */
.promptbar { width: 100%; max-width: 640px; }
.dock { width: 100%; }

/* One weekday label above the focused box, clickable to see every such weekday. */
.dayhint .today-tag { position: absolute; top: 0; right: auto; padding: 0; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; border-radius: 4px; }

/* Timeline navigation: older and newer days, for the whole timeline. */
.nav { display: flex; align-items: center; gap: 2px; margin: 0 auto; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.navrange { padding: 0 6px; white-space: nowrap; }
.navbtn { width: 28px; height: 28px; border-radius: 6px; font-size: 18px; line-height: 1; color: var(--ink-2); }
.navbtn:hover:not([disabled]) { background: var(--paper-2); color: var(--ink); }
.navbtn[disabled] { opacity: .3; cursor: default; }
@media (max-width: 380px) { .navrange { font-size: 11px; padding: 0 2px; } }
.row.hintrow .row-head, .row.hintrow .dayhint { height: 16px; }

/* Today: a solid inner border, kept inside the box so it never touches its neighbours. */

/* The weekday page header carries the same date controls as the timeline. */
.sheet-top .nav { margin: 0 8px 0 auto; }

/* Every page is the same width, with or without a scrollbar, so moving between pages never shifts the layout. */
.pane { scrollbar-gutter: stable; }
#pane-main { max-width: none; }
#pane-main > * { max-width: 560px; width: 100%; margin-left: auto; margin-right: auto; }
.sheet-inner { max-width: 560px; }

/* The mic button: its icon is centred in a round button, in the bar and while listening. */
.promptbar .fab.mic:not(.on):not(.paused) { display: grid; place-items: center; padding: 0 !important; }
.promptbar .fab.mic:not(.on):not(.paused) svg { margin: 0; }

/* Tight grid: gaps between rows match the gaps between columns; habit names sit right-aligned next to their boxes. */
.row, #rows .row { padding-top: 1px; padding-bottom: 1px; gap: 2px; }
.row-title, .row-title.rename { text-align: right; }
.row-title { padding-right: 8px; }
.row.honest { margin-bottom: 8px; }
.row.hintrow { margin-bottom: 0; }
/* Row tools now open on the left of the name, over its start, so the name keeps its place beside the boxes. */
.row-head .rowtools { right: auto; left: 0; padding-left: 0; padding-right: 10px; background: linear-gradient(to left, transparent, var(--paper) 22%); }
.addhabit { margin-top: 10px; }



/* One name box in view and edit mode, vertically centred on the day boxes, so toggling Edit moves nothing. */
.rows .row, .wrows .row { align-items: center; }
.rows .row-head { align-self: center; }
.rows .row-title, .rows .row-title.rename { display: block; width: 100%; height: 20px; line-height: 20px; margin: 0; padding: 0 8px 0 3px; border: 0; border-radius: 4px; background: transparent; color: inherit; font: inherit; font-size: 12.5px; font-weight: 600; text-align: right; box-sizing: border-box; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .row-title.quiet { color: var(--ink-3); font-weight: 500; }
.rows .row-head .grip { top: 0; }

/* The ready-made empty row for a new habit. */
.row.ghost { opacity: .5; cursor: pointer; transition: opacity .12s; }
.row.ghost:hover, .row.ghost:focus-within { opacity: .9; }
.row.ghost .row-title { font-size: 20px; font-weight: 400; color: var(--ink-2); }


/* The logo: the original grid turned left (red bottom-left, green top-right), with tighter gaps. */
.mark { grid-template-columns: repeat(3, 7px); gap: 1px; }
.mark i { width: 7px; height: 7px; border-radius: 1.5px; }
.placeholder .mark { grid-template-columns: repeat(3, 14px); gap: 2px; }
.placeholder .mark i { width: 14px; height: 14px; border-radius: 3px; }

/* Day page: one line per entry. Nothing expands; the number is always in front of you. */
.entries { border-top: 1px solid var(--line); }
.entry { padding: 10px 0; border-bottom: 1px solid var(--line); }
.eline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.eicon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 24px; line-height: 1; flex: none; background: var(--paper-2); }
button.eicon:hover { background: color-mix(in srgb, var(--ink) 10%, var(--paper-2)); }
.ename { flex: 1 1 96px; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ename b { font-size: 15px; font-weight: 650; }
.esub { font-size: 12px; color: var(--ink-3); font-family: var(--mono); }
.estep { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.estep .mini { width: 36px; height: 36px; font-size: 20px; }
.eval { width: 76px; height: 36px; text-align: center; font-family: var(--mono); font-size: 16px; padding: 0 4px; }
.ekm { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; }
.ekm .eval { width: 64px; }
.emore[aria-expanded="true"] { background: var(--paper-2); color: var(--ink); }
.ebelow { margin: 8px 0 0 48px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.erate { width: min(100%, 320px); }
.erate button { padding: 8px 0; }
.etypes, .enote { margin: 8px 0 0 48px; }
.enote { display: flex; gap: 8px; align-items: center; }
.enote input[type="text"] { flex: 1; min-width: 0; }
.entry.removed .ename b { text-decoration: line-through; opacity: .55; }
.entry.removed .eicon { opacity: .55; }

/* Emoji tiles, for picking a habit or a kind. */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-top: 8px; }
.tile { border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; background: var(--paper); min-height: 76px; }
.tile:hover { background: var(--paper-2); }
.tile.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.temoji { font-size: 26px; line-height: 1.1; }
.tname { font-size: 13px; font-weight: 600; }
.thint { font-size: 11px; color: var(--ink-3); }

/* Tighter entry line so icon, name, number and tools fit one line on a phone. */
.eline { gap: 6px; }
.eicon { width: 36px; height: 36px; font-size: 22px; }
.ename { flex: 1 1 84px; }
.estep { gap: 2px; }
.estep .mini { width: 32px; height: 32px; min-width: 0; min-height: 0; font-size: 18px; position: relative; }
.estep .mini::after { content: ""; position: absolute; inset: -6px -2px; }
.eval { height: 32px; font-size: 15px; padding: 0 4px; }
.eline > .mini.ghost { width: 26px; height: 32px; min-width: 0 !important; min-height: 0 !important; position: relative; }
.eline > .mini.ghost::after { content: ""; position: absolute; inset: -6px -3px; }
.eline > .mini.ghost svg { width: 16px; height: 16px; }
.ebelow, .etypes, .enote { margin-left: 42px; }
.ekm .eval { width: 64px !important; }

/* The date range is a button that opens a list of months. */
.nav { position: relative; }
button.navrange { padding: 4px 8px; border-radius: 8px; font: inherit; color: var(--ink-2); }
button.navrange:hover, button.navrange[aria-expanded="true"] { background: var(--paper-2); color: var(--ink); }
.monthpick { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 40; min-width: 200px; max-height: min(60vh, 420px); overflow-y: auto; padding: 6px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.monthpick button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 9px 12px; border-radius: 9px; text-align: left; font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--ink); }
.monthpick button:hover { background: var(--paper-2); }
.monthpick button.empty { color: var(--ink-3); font-weight: 500; }
.mdot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }

/* On a phone the top bar has to fit brand, dates, Edit and the gear. */
@media (max-width: 440px) {
  .top { gap: 2px; padding-right: 6px; }
  .brand { flex: 0 0 auto; font-size: 14px; gap: 6px; }
  .nav { gap: 0; }
  .navbtn { width: 24px; }
  button.navrange { padding: 4px 3px; font-size: 11.5px; }
  .topbtns .btn.ghost { padding: 0 6px; }
  .topbtns .icon-btn { width: 34px; }
}

/* Today has no special box effect; only the label above the first box says Today. */
.cell.today { box-shadow: none; }

/* The label above a day: only the weekday is a link; the age is quiet. */
.dayhint .today-tag { white-space: nowrap; cursor: default; }
.wdlink { padding: 0; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; position: relative; border-radius: 3px; }
.wdlink::after { content: ""; position: absolute; inset: -6px -6px; }
.wdlink:hover { text-decoration: underline; }
.tagdate { font-weight: 600; }
.tagage { font-weight: 500; color: var(--ink-3); font-size: .92em; }
.tagage { margin-left: .5em; }

/* Arriving from a habit's box: that habit's entries are quietly marked, and an unsaved draft is dashed. */
.entry.focus { background: var(--paper-2); border-radius: 12px; margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-bottom-color: transparent; }
.entry.draft { border: 1px dashed var(--line); border-radius: 12px; padding: 10px; margin: 8px 0 10px; }
.entry.draft .ebelow, .entry.draft .tiles { margin-left: 0; }


/* Day page: one quiet good-news line, a one-line note, a big card for the habit you came from, a quieter rest of the day. */
.goodnews { font-size: 13px; color: var(--ink-2); margin: 0 0 10px; }
.daynote { margin: 0 0 10px; }
.daynote textarea { min-height: 40px; height: 40px; resize: none; overflow: hidden; padding: 9px 10px; line-height: 20px; }
.focuscard { border: 1px solid var(--accent); border-radius: 16px; background: var(--paper-2); padding: 10px 12px 4px; margin: 4px 0 18px; }
.focushead { margin: 0 0 4px; font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.focuscard .entries { border-top: 0; }
.focuscard .entry { border-bottom: 0; }
.focuscard .entry.draft { background: var(--paper); margin: 6px 0 8px; }
.entry.focus { background: transparent; margin: 0; padding-left: 0; padding-right: 0; }
.resthead { margin: 6px 0 2px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }
.entries.rest .eicon { width: 32px; height: 32px; font-size: 19px; }
.entries.rest .ename b { font-weight: 600; font-size: 14px; }
.enamebtn { text-align: left; padding: 0; }
.enamebtn:hover b { text-decoration: underline; }

/* The handle on the left of an entry: shown on hover on a computer, always on a phone. */
.entry { position: relative; }
.egrip { position: absolute; left: -15px; top: 14px; width: 14px; height: 24px; display: grid; place-items: center; color: var(--ink-3); opacity: 0; transition: opacity .12s; touch-action: none; cursor: grab; padding: 0; }
.egrip svg { width: 10px; height: 10px; fill: currentColor; }
.egrip::after { content: ""; position: absolute; inset: -8px -4px; }
.entry:hover .egrip, .egrip:focus-visible { opacity: 1; }
@media (hover: none) { .egrip { opacity: .45; } }
.entry.dragging { z-index: 5; background: var(--paper); box-shadow: var(--shadow); border-radius: 12px; }
.entry.draft .egrip { display: none; }

.focuscard { padding: 8px 8px 2px; }
.estep .mini { width: 30px; height: 30px; }
.eline { gap: 4px; }

/* A star is a yellow star with a thin dark edge, readable on every box colour. */
.cell.star::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.6l2.9 6.1 6.7.9-4.9 4.6 1.3 6.6L12 17.5 6 20.8l1.3-6.6-4.9-4.6 6.7-.9z' fill='%23f5c542' stroke='%23463a10' stroke-width='1.3' stroke-linejoin='round'/%3E%3C/svg%3E"); background-position: center; background-repeat: no-repeat; background-size: 72%; }

/* The star sits small in the corner of its box, so the box colour stays readable. */
.cell.star::after { inset: auto; right: 1px; top: 1px; left: auto; bottom: auto; width: max(10px, 42%); height: max(10px, 42%); background-size: contain; }

/* Focus: the habit you came from is marked where it already sits; nothing moves. */
.entry.focus { border: 1px solid var(--accent); border-radius: 16px; background: var(--paper-2); margin: 6px -8px; padding: 10px 8px; }
.entry.draft { border: 1px dashed var(--accent); border-radius: 16px; background: var(--paper-2); margin: 6px -8px; padding: 10px 8px; }
.entry.draft .ebelow, .entry.draft .tiles { margin-left: 0; }
.entries .entry.focus + .entry, .entries .entry.draft + .entry { border-top: 0; }

/* A simple + opens the tiles. */
.addplus { display: grid; place-items: center; width: 100%; height: 44px; margin-top: 12px; border: 1px dashed var(--line); border-radius: 12px; font-size: 24px; line-height: 1; color: var(--ink-2); }
.addplus:hover { background: var(--paper-2); color: var(--ink); }

/* Rating words as chips that wrap, instead of five numbered boxes. */
.erate.words { display: flex; flex-wrap: wrap; gap: 6px; width: auto; grid-template-columns: none; }
.erate.words button { padding: 8px 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); font-family: var(--sans); font-size: 14px; font-weight: 600; display: block; }
.erate.words button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Choices carry the timeline's colour: a tint when idle, the full colour when chosen. */
.erate.words button, .eseg.colored button { border-color: color-mix(in srgb, var(--c) 60%, var(--line)); background: color-mix(in srgb, var(--c) 22%, var(--paper)); color: var(--ink); }
.erate.words button:hover, .eseg.colored button:hover { background: color-mix(in srgb, var(--c) 40%, var(--paper)); }
.erate.words button.on, .eseg.colored button.on { background: var(--c); color: var(--ink); border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); font-weight: 700; }
.eseg.colored { border: 0; gap: 6px; overflow: visible; }
.eseg.colored button { border: 1px solid; border-radius: 18px; border-right: 1px solid; }
.eseg.colored button:last-child { border-right: 1px solid; }

/* A toast that lists what was added. */
#toast.list { text-align: left; min-width: 220px; }
#toast .toast-title { font-weight: 700; margin-bottom: 4px; }
#toast .toast-line { font-size: 14px; line-height: 1.45; }

/* One habit only: nothing else on the page. */
.singlehead { margin: 4px 0 6px; font-size: 20px; letter-spacing: -.01em; }
.sheet-inner.single .egrip { display: none; }
.sheet-inner.single .entry.focus { margin: 6px 0; }
.anotherbtn { display: block; width: 100%; margin-top: 10px; padding: 11px 12px; border: 1px dashed var(--line); border-radius: 12px; color: var(--ink-2); font-weight: 600; font-size: 14px; text-align: left; }
.anotherbtn:hover { background: var(--paper-2); color: var(--ink); }
.wholeday { display: block; margin: 22px auto 0; padding: 6px 10px; color: var(--ink-3); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.wholeday:hover { color: var(--ink); }

/* The note is part of every entry: always there, one line, click and type. */
.enote { margin: 2px 0 0 0; padding-left: 4px; }
.enote input[type="text"] { height: 32px; border: 0; border-bottom: 1px dashed var(--line); border-radius: 0; background: transparent; padding: 0 4px; font-size: 14px; color: var(--ink-2); }
.enote input[type="text"]:focus { outline: none; border-bottom: 1px solid var(--accent); color: var(--ink); }
.enote .starchip { height: 28px; width: 28px; min-width: 0; min-height: 0; padding: 0; font-size: 16px; border-radius: 14px; }
.entry.draft .enote { display: none; }

/* One header for every page: the same height, the same left edge, the same title size and place. */
.top, .sheet-top { height: 54px; box-sizing: border-box; padding: 10px 6px 0 14px; display: flex; align-items: center; gap: 8px; margin: 0; }
.brand { font-size: 16px; font-weight: 650; gap: 8px; flex: 0 0 auto; }
.sheet-top > .icon-btn:first-child { width: 23px; min-width: 0 !important; height: 44px; margin: 0; flex: none; position: relative; }
.sheet-top > .icon-btn:first-child::after { content: ""; position: absolute; inset: 0 -9px; }
.sheet-top > .icon-btn:first-child svg { width: 20px; height: 20px; }
.sheet-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex: 1 1 auto; }
.sheet-title h1 { font-size: 16px; font-weight: 650; line-height: 22px; margin: 0; white-space: nowrap; letter-spacing: -.01em; }
.sheet-title .sub { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 440px) { .top { gap: 8px; padding-right: 6px; } .brand { gap: 8px; font-size: 16px; } }

/* Needs attention: the habit's name turns red with a "!". Going well: it turns green with a seedling. No background, no bar. */
.rows .row.attn .row-title { color: var(--alert); }
.rows .row.good .row-title { color: var(--accent); }
