/* =====================================================================
   YourDays — "Notebook" dark theme
   Pure black, warm ink, serif for writing, Inter for interface.
   ===================================================================== */

:root {
  color-scheme: dark;
  --bg: #000;
  --s1: #0c0c0c;
  --s2: #141414;
  --s3: #1b1b1b;
  --line: #1f1f1f;
  --line2: #2a2a2a;
  --tx: #ece6dc;
  --mu: #8f887d;
  --dim: #57524b;
  --acc: #ff9f5a;
  --acc-2: #ffb37d;
  --acc-ink: #1a0d02;
  --ok: #7fd49b;
  --part: #f2c46b;
  --red: #ff6a55;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r: 16px;
  --r-sm: 10px;

  /* The editor: text box and styled mirror share these exactly */
  --ed-size: 19px;
  --ed-line: 38px;
  --ed-margin: 128px;

  /* heatmap ramp (one warm hue, dark to light) */
  --h0: #2a1a0e; --h1: #4a2b12; --h2: #7a4316; --h3: #b3621d; --h4: #ff9f5a; --h5: #ffd4ad;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--tx); font: 14px/1.55 var(--sans); min-height: 100vh; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
[hidden] { display: none !important; }
code { font-family: var(--sans); font-size: .92em; background: var(--s3); padding: 1px 6px; border-radius: 5px; color: var(--tx); }
b, strong { font-weight: 600; }
::selection { background: rgba(255, 159, 90, .3); }

/* ---------------- Top bar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 26px;
  height: 58px; padding: 0 32px;
  background: rgba(0, 0, 0, .86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.logo { font-family: var(--serif); font-size: 21px; font-weight: 500; letter-spacing: -.01em; color: var(--tx); text-decoration: none; }
.logo i { color: var(--acc); }
.tabs { display: flex; gap: 2px; }
.tabs a { display: flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 9px; color: var(--mu); font-weight: 500; font-size: 13.5px; text-decoration: none; transition: color .15s, background .15s; }
.tabs a:hover { color: var(--tx); }
.tabs a.on { color: var(--tx); background: var(--s2); }
.tabs svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; display: none; }
.stats { margin-left: auto; display: flex; gap: 18px; align-items: center; font-size: 12.5px; color: var(--mu); white-space: nowrap; }
.stats b { color: var(--tx); font-weight: 600; font-variant-numeric: tabular-nums; }
.st-streak b { color: var(--acc); }
.dev-badge { color: var(--part); border: 1px dashed #4a3b19; padding: 2px 8px; border-radius: 6px; }

.view { max-width: 1440px; margin: 0 auto; padding: 30px 32px 80px; }

/* ---------------- Buttons & fields ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 12px; font-weight: 600; font-size: 13.5px; border: 1px solid var(--line); background: var(--s2); color: var(--tx); transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; }
.btn:hover { background: var(--s3); border-color: var(--line2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.btn-primary:hover { background: var(--acc-2); border-color: var(--acc-2); }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; color: var(--red); border-color: #3b1e17; }
.btn-danger:hover { background: #140806; border-color: #5a2a20; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
.link-btn { color: var(--acc); font-size: 12.5px; font-weight: 500; padding: 2px 4px; }
.link-btn:hover { color: var(--acc-2); text-decoration: underline; }
.icon-btn { width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 8px; color: var(--mu); font-size: 17px; }
.icon-btn:hover:not(:disabled) { background: var(--s2); color: var(--tx); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.sm { width: 24px; height: 24px; font-size: 13px; }
.field { width: 100%; background: var(--s1); border: 1px solid var(--line2); border-radius: var(--r-sm); padding: 9px 12px; outline: none; transition: border-color .15s; }
.field:focus { border-color: #5a3b22; box-shadow: 0 0 0 3px rgba(255, 159, 90, .12); }
.field.mono { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
input[type="date"] { color-scheme: dark; }
.mini { font-size: 11.5px; padding: 3px 9px; border-radius: 7px; border: 1px solid var(--line2); color: var(--mu); white-space: nowrap; }
.mini:hover { color: var(--tx); border-color: #3a3a3a; }
.mini.ok { color: var(--acc); border-color: #4a2c16; }
.mini-date { background: var(--s1); border: 1px solid var(--line2); border-radius: 7px; padding: 2px 6px; font-size: 12px; }
.pill { padding: 6px 15px; border-radius: 99px; border: 1px solid var(--line2); font-size: 13px; color: var(--mu); transition: all .15s; }
.pill:hover { color: var(--tx); }
.pill.on.r-yes { background: #12251a; border-color: #2d5a3c; color: var(--ok); }
.pill.on.r-partial { background: #231d10; border-color: #4a3b19; color: var(--part); }
.pill.on.r-no { background: #210d0a; border-color: #5a2a20; color: var(--red); }
.muted-p { color: var(--mu); font-size: 13px; line-height: 1.6; }
.grow { flex: 1; }

/* ---------------- Cards ---------------- */
.card { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.card h3 { font-family: var(--serif); font-weight: 500; font-size: 17px; letter-spacing: -.005em; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.card-note { font-size: 12px; color: var(--mu); }
.card.empty { color: var(--mu); text-align: center; padding: 40px; }

/* Goal badge */
.gbadge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 7px; font: 700 12px/1 var(--sans); color: var(--gc); background: var(--gt); flex: none; }
.gbadge.sm { min-width: 20px; height: 20px; font-size: 11.5px; border-radius: 6px; }
.gbadge.misc { color: var(--mu); background: #1e1e1e; }

/* Due pill */
.due { font-size: 11.5px; font-weight: 600; white-space: nowrap; padding: 2px 8px; border-radius: 99px; background: var(--s3); color: var(--mu); flex: none; font-variant-numeric: tabular-nums; }
.due.late { background: #230e0b; color: var(--red); }
.due.soon { background: #231d10; color: var(--part); }
.due.none { background: transparent; color: var(--dim); }

/* ---------------- Today ---------------- */
.today { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(320px, 1fr); gap: 36px; align-items: start; }
.day-top { display: flex; align-items: center; justify-content: space-between; }
.day-nav { display: flex; align-items: center; gap: 4px; margin-left: -8px; }
.day-meta { font-size: 12.5px; color: var(--mu); min-width: 64px; text-align: center; }
.day-title { font-family: var(--serif); font-weight: 400; font-size: 42px; letter-spacing: -.02em; line-height: 1.12; margin: 4px 0 10px; }
.day-title em { color: var(--mu); font-style: italic; }
.day-status { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--mu); margin-bottom: 16px; min-height: 20px; }
.day-status b { color: var(--tx); }
.day-status .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--dim); }
.day-status.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px #12251a; }
.day-status.amber .dot { background: var(--part); box-shadow: 0 0 0 3px #2a2211; }
.day-status.warn { color: #ffb4a6; }
.day-status.warn b { color: #fff; }
.day-status.warn .dot { background: var(--red); box-shadow: 0 0 0 3px #2a1210; animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px #2a121000; } }

.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; margin-bottom: 14px; border: 1px solid #2e2412; background: #0d0a05; border-radius: 12px; font-size: 13px; color: #f5d9a8; flex-wrap: wrap; }

.paper { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 0 12px; transition: border-color .2s; }
.paper:focus-within { border-color: #2a2420; }

/* The editor. Mirror (.ed-hl) and textarea (.ed-ta) must share every metric. */
.ed { position: relative; margin: 0 26px; }
.ed-hl, .ed-ta {
  font-family: var(--serif); font-size: var(--ed-size); line-height: var(--ed-line);
  font-weight: 400; font-style: normal; letter-spacing: 0; word-spacing: 0;
  font-variant-ligatures: none; font-kerning: normal; text-rendering: auto;
  white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; tab-size: 4;
  padding: 0 var(--ed-margin) 0 0; margin: 0; border: 0;
}
.ed-hl { color: var(--tx); pointer-events: none; min-height: calc(var(--ed-line) * 6); }
.ed-ta {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; resize: none; overflow: hidden; outline: none;
  background: transparent; color: transparent; caret-color: var(--acc);
  -webkit-appearance: none; appearance: none; border-radius: 0;
}
.ed-ta::selection { background: rgba(255, 159, 90, .28); color: transparent; }
.ed-ta::placeholder { color: var(--dim); font-style: italic; opacity: 1; }
.ed.readonly .ed-ta { caret-color: transparent; }
.ln { min-height: var(--ed-line); border-radius: 6px; }
.ln.cur { background: rgba(255, 255, 255, .028); box-shadow: -10px 0 0 rgba(255, 255, 255, .028), 10px 0 0 rgba(255, 255, 255, .028); }
.pfx { color: var(--gc); background: var(--gt); box-shadow: 0 0 0 3px var(--gt); border-radius: 5px; }
.nt { color: var(--mu); }
.ln.st-done .bd { color: var(--mu); text-decoration: line-through; text-decoration-color: #4a7a5a; text-decoration-thickness: 1.5px; }
.ln.st-not-done .bd { color: var(--mu); }
.ed-marks { position: absolute; top: 0; right: 0; width: var(--ed-margin); pointer-events: none; }
.mk { position: absolute; right: 0; height: var(--ed-line); display: flex; align-items: center; gap: 3px; pointer-events: auto; }
.mk button { width: 30px; height: 28px; border-radius: 8px; border: 1px solid transparent; color: #45413b; font: 500 13px/1 var(--sans); transition: all .12s; }
.mk button:hover { color: var(--mu); border-color: var(--line2); }
.mk button.on[data-s="done"] { background: #12251a; color: var(--ok); border-color: #24422f; }
.mk button.on[data-s="partial"] { background: #231d10; color: var(--part); border-color: #4a3b19; }
.mk button.on[data-s="not-done"] { background: #210d0a; color: var(--red); border-color: #4a211b; }
.mk .carry { font: 500 11px/1 var(--sans); color: var(--dim); margin-right: 3px; cursor: default; }
.ed-marks.disabled .mk button { pointer-events: none; opacity: .35; }

.ctx { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 26px 0; padding-top: 11px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--mu); min-height: 34px; }
.ctx-goal { display: inline-flex; align-items: center; gap: 8px; }
.ctx-goal b { font-weight: 600; }
.ctx-ms { color: var(--tx); }
.ctx-list { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.ctx-g { display: inline-flex; align-items: center; gap: 6px; }
.ctx-hint { margin-left: auto; color: var(--dim); font-size: 11.5px; }

.special { border: 1px dashed var(--line2); border-radius: var(--r); padding: 18px 20px; margin-bottom: 14px; }
.special h3 { font-family: var(--serif); font-weight: 500; font-size: 20px; margin-bottom: 4px; }
.special p { color: var(--mu); font-size: 13.5px; margin-bottom: 10px; }

.lock, .locked { margin-top: 14px; }
.lock-row, .locked-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lock-q { font-family: var(--serif); font-size: 17px; color: var(--mu); margin-right: 4px; }
.reflect { width: 100%; margin-top: 10px; background: var(--s1); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-family: var(--serif); font-size: 16px; line-height: 1.6; resize: vertical; outline: none; }
.reflect:focus { border-color: #2a2420; }
.rating-tag { font-size: 12.5px; font-weight: 600; padding: 4px 12px; border-radius: 99px; background: var(--s3); color: var(--mu); }
.rating-tag.r-yes { background: #12251a; color: var(--ok); }
.rating-tag.r-partial { background: #231d10; color: var(--part); }
.rating-tag.r-no { background: #210d0a; color: var(--red); }
.locked-head { justify-content: space-between; }

.chips-row { display: flex; flex-wrap: wrap; gap: 12px 22px; margin-top: 20px; align-items: flex-start; }
.chip-group { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.chip-group.end { margin-left: auto; }
.chip-lb { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin-right: 2px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 99px; border: 1px dashed #2c2c2c; color: var(--mu); font-size: 12.5px; transition: all .15s; cursor: pointer; }
.chip:hover { color: var(--tx); border-color: #444; border-style: solid; }
.cdot { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.chip-n { font-size: 11px; color: var(--dim); }
.chip-x { color: var(--dim); font-size: 14px; line-height: 1; margin: 0 -4px 0 2px; opacity: 0; transition: opacity .15s; }
.chip:hover .chip-x { opacity: 1; }
.chip-x:hover { color: var(--red); }
.chip-input { background: transparent; border: 1px dashed #2c2c2c; border-radius: 99px; padding: 5px 12px; font-size: 12.5px; outline: none; width: 190px; color: var(--tx); }
.chip-input:focus { border-color: #5a3b22; border-style: solid; }
.chip-input::placeholder { color: var(--dim); }

/* ---------------- Rail ---------------- */
.rail { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 88px; }
.rail > div:empty { display: none; }
.overdue { border-color: #3b1e17; background: #0b0504; }
.overdue h3 { color: #ffb4a6; }
.od-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid #1f1210; }
.card:not(.overdue) .od-row { border-top-color: var(--line); }
.od-text { flex: 1; min-width: 0; font-size: 13px; }
.od-text span { display: block; }
.od-text small { display: block; color: var(--mu); font-size: 11.5px; }
.od-actions { display: flex; gap: 4px; align-items: center; }
.more { margin-top: 4px; padding-left: 0; }
.flag { border-color: #2e2412; background: #0a0804; }
.flag h3 { color: #f5d9a8; font-size: 15.5px; }
.flag-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.flag-text { flex: 1; min-width: 0; }
.review-card { display: flex; align-items: center; gap: 14px; border-color: #3a2a18; background: linear-gradient(135deg, #140d06, #0c0c0c); }
.review-card p { color: var(--mu); font-size: 12.5px; margin-top: 2px; }
.review-card > div { flex: 1; }
.goals-card { padding-bottom: 8px; }
.g-row { width: 100%; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 3px 11px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); text-align: left; }
.g-row:first-of-type { border-top: 0; }
.g-row:hover .g-title { color: var(--acc-2); }
.g-title { font-weight: 600; font-size: 13.5px; transition: color .15s; }
.g-strip { display: flex; gap: 2px; }
.g-strip i { width: 5px; height: 12px; border-radius: 2px; }
.g-idle { font-size: 11.5px; color: var(--part); }
.g-ms { grid-column: 2 / 4; display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--mu); font-size: 12.5px; }
.g-ms-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-ms-text.none { color: var(--dim); font-style: italic; }

/* ---------------- Pages ---------------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-family: var(--serif); font-weight: 400; font-size: 38px; letter-spacing: -.02em; line-height: 1.1; }
.page-sub { color: var(--mu); margin-top: 4px; }
.head-actions { display: flex; gap: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }

/* Goals */
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; align-items: start; }
.goal-card { position: relative; overflow: hidden; padding: 18px 20px 16px; }
.goal-card::before { content: ''; position: absolute; left: 0; top: 0; right: 0; height: 2px; background: var(--gc); opacity: .8; }
.gc-head { display: flex; align-items: center; gap: 10px; }
.gc-head h2 { font-family: var(--serif); font-weight: 500; font-size: 21px; flex: 1; letter-spacing: -.01em; }
.gc-stats { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--mu); margin: 6px 0 12px; }
.gc-stats b { color: var(--tx); }
.ms-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.ms-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--s2); }
.ms-row.editing { background: transparent; padding: 4px 0; }
.ms-check { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid #3a3a3a; color: transparent; font-size: 12px; font-weight: 700; flex: none; transition: all .15s; }
.ms-check:hover { border-color: var(--ok); color: var(--ok); }
.ms-text { flex: 1; min-width: 0; font-family: var(--serif); font-size: 16px; overflow-wrap: anywhere; }
.ms-tools { display: flex; opacity: 0; transition: opacity .15s; }
.ms-row:hover .ms-tools { opacity: 1; }
.ms-empty { color: var(--dim); font-size: 13px; font-style: italic; padding: 6px 0; }
.ms-add { margin-top: 8px; width: 100%; padding: 8px; border: 1px dashed var(--line2); border-radius: 10px; color: var(--mu); font-size: 12.5px; }
.ms-add:hover { color: var(--tx); border-color: #5a3b22; }
.ms-form { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; }
.ms-form .field { padding: 7px 10px; }
.ms-form .field[name="t"] { flex: 1; min-width: 160px; }
.ms-form .field[type="date"] { width: auto; }
.ms-archive { margin-top: 12px; font-size: 12.5px; color: var(--mu); }
.ms-archive summary { cursor: pointer; color: var(--dim); }
.ms-archive ul { list-style: none; margin-top: 6px; }
.ms-archive li { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
.ms-archive li span { flex: 1; text-decoration: line-through; color: var(--dim); }
.ms-archive li small { color: var(--dim); }

/* Forms / modal */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label, .lbl { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--mu); font-weight: 500; }
.form-row { display: grid; grid-template-columns: 110px 1fr; gap: 12px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.sw input { position: absolute; opacity: 0; pointer-events: none; }
.sw i { display: block; width: 26px; height: 26px; border-radius: 8px; cursor: pointer; box-shadow: 0 0 0 2px transparent; transition: box-shadow .15s; }
.sw input:checked + i { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--tx); }
.day-picks { display: flex; gap: 6px; }
.day-picks button { width: 38px; height: 34px; border-radius: 9px; border: 1px solid var(--line2); color: var(--dim); font-size: 12px; font-weight: 600; }
.day-picks button.on { color: var(--acc); border-color: #5a3b22; background: #140d06; }
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .72); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; background: #0e0e0e; border: 1px solid var(--line2); border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .7); animation: rise .18s; }
.modal.wide { max-width: 640px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 6px 22px; }
.modal-head h3 { font-family: var(--serif); font-weight: 500; font-size: 21px; }
.modal-body { padding: 6px 22px 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }
.modal-foot .btn-danger { margin-right: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.99); } }

/* Toast & tooltip */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; z-index: 200; background: #1a1a1a; border: 1px solid var(--line2); border-radius: 99px; padding: 9px 18px; font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, .6); transition: all .2s; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.tip { position: fixed; z-index: 150; pointer-events: none; opacity: 0; background: #1a1a1a; border: 1px solid var(--line2); border-radius: 9px; padding: 7px 10px; font-size: 12px; white-space: pre-line; transition: opacity .08s; max-width: 260px; }
.tip.show { opacity: 1; }

/* Insights */
.seg { display: inline-flex; background: var(--s1); border: 1px solid var(--line); border-radius: 11px; padding: 3px; }
.seg button { padding: 6px 13px; border-radius: 8px; color: var(--mu); font-size: 12.5px; font-weight: 600; }
.seg button.on { background: var(--s3); color: var(--tx); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tiles.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 12px 0 16px; }
.tile { display: flex; flex-direction: column; background: var(--s1); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.tiles.compact .tile { background: var(--s2); }
.tile-l { font-size: 12px; color: var(--mu); }
.tile-v { font-family: var(--serif); font-size: 32px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile-v small { font-size: 15px; color: var(--mu); }
.tile-s { font-size: 11.5px; color: var(--dim); }
.heat-wrap { overflow-x: auto; padding-bottom: 4px; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: 16px repeat(7, 16px); grid-template-columns: 32px; grid-auto-columns: 16px; gap: 3px; width: max-content; }
.hm-lab, .hm-month { font-size: 10px; color: var(--dim); line-height: 16px; white-space: nowrap; }
.hm { display: inline-block; width: 16px; height: 16px; border-radius: 4px; background: #161616; position: relative; }
.hm.future { background: transparent; border: 1px dashed #1a1a1a; }
.hm.l0 { background: var(--h0); } .hm.l1 { background: var(--h1); } .hm.l2 { background: var(--h2); }
.hm.l3 { background: var(--h3); } .hm.l4 { background: var(--h4); } .hm.l5 { background: var(--h5); }
.hm.busy { background: repeating-linear-gradient(135deg, #2e2638 0 2px, #17131d 2px 4px); }
.hm.hooky { background: transparent; box-shadow: inset 0 0 0 1.5px var(--red); }
.hm.now { outline: 1.5px solid var(--tx); outline-offset: 1px; }
.heat .hm:hover { outline: 1.5px solid #fff; outline-offset: 1px; }
.legend { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 12px; font-size: 11.5px; color: var(--mu); }
.legend.top { margin: 0 0 10px; gap: 14px; }
.legend .hm { width: 12px; height: 12px; }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; }
.legend.top .lg { margin-left: 0; }
.lsw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: minmax(100px, 170px) minmax(0, 1fr) 78px; gap: 12px; align-items: center; font-size: 12.5px; }
.bar-lab { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar-lab span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; position: relative; }
.bar-track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 5px 5px 0; min-width: 2px; }
.bar-val { text-align: right; color: var(--mu); font-variant-numeric: tabular-nums; }
.bar-val b { color: var(--tx); margin-right: 4px; }
.cols { display: flex; align-items: flex-end; gap: 4px; height: 140px; border-bottom: 1px solid var(--line); }
.col { flex: 1; height: 100%; display: flex; flex-direction: column-reverse; gap: 2px; min-width: 5px; }
.col i { display: block; width: 100%; border-radius: 3px; }
.axis { display: flex; gap: 4px; margin-top: 6px; font-size: 10px; color: var(--dim); }
.axis span { flex: 1; text-align: center; white-space: nowrap; min-width: 5px; }
.carry-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.carry-list li { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 7px 10px; background: var(--s2); border-radius: 10px; }
.cl-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--serif); font-size: 15px; }
.cl-n { font-size: 11.5px; color: var(--mu); }
.cl-s { font-size: 11.5px; color: var(--dim); }
.cl-s.done { color: var(--ok); }

/* History */
.search { width: 320px; }
.month { font-family: var(--serif); font-weight: 400; font-size: 22px; color: var(--mu); margin: 26px 0 12px; }
.month:first-child { margin-top: 0; }
.hday { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 20px; margin-bottom: 10px; }
.hday-side { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.hday-date { font-family: var(--serif); font-size: 17px; }
.hday-count { font-size: 12px; color: var(--mu); }
.tag { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--s3); color: var(--mu); }
.tag.r-yes { background: #12251a; color: var(--ok); }
.tag.r-partial { background: #231d10; color: var(--part); }
.tag.r-no, .tag.hooky { background: #210d0a; color: var(--red); }
.tag.busy { background: #1b1624; color: #c7b0ff; }
.tag.open { background: #0f1a24; color: #8fc7ff; }
.hlines { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.hlines li { display: flex; align-items: baseline; gap: 9px; }
.hlines .gbadge { transform: translateY(3px); }
.hmark { width: 14px; font-size: 12px; color: var(--dim); text-align: center; flex: none; }
.st-done .hmark { color: var(--ok); }
.st-partial .hmark { color: var(--part); }
.st-not-done .hmark { color: var(--red); }
.htext { font-family: var(--serif); font-size: 16px; }
.st-done .htext { color: var(--mu); }
.hnote { color: var(--dim); }
.hreflect { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--mu); font-family: var(--serif); font-style: italic; font-size: 15px; white-space: pre-wrap; }
.more-btn { display: block; margin: 16px auto; }

/* Settings */
.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.settings .card { display: flex; flex-direction: column; gap: 10px; }
.input-row { display: flex; gap: 8px; }
.input-row .field { flex: 1; min-width: 0; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row .field { width: auto; }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.check input { width: 16px; height: 16px; margin-top: 3px; accent-color: var(--acc); flex: none; }
.check b { display: block; font-size: 13.5px; }
.check small { display: block; color: var(--mu); font-size: 12px; }
.status-box { font-size: 12.5px; color: var(--mu); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; line-height: 1.7; }
.status-box b { color: var(--tx); }
.warn-t { color: var(--part); }
.quota-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dailies { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.dailies li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; background: var(--s2); border-radius: 10px; font-size: 13.5px; }
.d-title { flex: 1; min-width: 0; }
.d-days { display: flex; gap: 2px; }
.d-days i { font-style: normal; font-size: 10px; width: 18px; text-align: center; color: #3a3733; }
.d-days i.on { color: var(--acc); }

/* Weekly review */
.review { display: flex; flex-direction: column; gap: 16px; max-width: 860px; }
.review .card { position: relative; padding: 20px 22px 20px 64px; }
.review .card h3 { font-size: 20px; margin-bottom: 6px; }
.step { position: absolute; left: 20px; top: 20px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-size: 15px; color: var(--acc); border: 1px solid #4a2c16; }
.sub-h { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin: 16px 0 8px; font-weight: 600; }
.add-ms, .add-todo { display: flex; align-items: center; gap: 8px; padding: 6px 0; flex-wrap: wrap; }
.add-ms .field[name="t"], .add-todo .field { flex: 1; min-width: 160px; padding: 7px 10px; }
.add-ms .field[type="date"] { width: auto; padding: 7px 10px; }
.nt-title { font-weight: 600; font-size: 13px; min-width: 110px; }
.review-foot { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1100px) {
  .today { grid-template-columns: 1fr; }
  .rail { position: static; }
  .grid2, .settings { grid-template-columns: 1fr; }
  .st-roll { display: none; }
}

@media (max-width: 760px) {
  :root { --ed-size: 17px; --ed-line: 34px; --ed-margin: 96px; }
  .topbar { height: 52px; padding: 0 16px; gap: 12px; backdrop-filter: none; -webkit-backdrop-filter: none; background: #000; }
  .logo { font-size: 19px; }
  .stats { gap: 12px; font-size: 12px; }
  .st-streak span, .st-q { display: none; }
  .st-streak::before { content: '🔥 '; }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; justify-content: space-around; gap: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: rgba(0, 0, 0, .94); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
  .tabs a { flex: 1; flex-direction: column; gap: 3px; padding: 6px 0; font-size: 10.5px; border-radius: 10px; justify-content: center; }
  .tabs a.on { background: transparent; color: var(--acc); }
  .tabs svg { display: block; width: 21px; height: 21px; }
  .view { padding: 18px 14px 110px; }
  .day-title { font-size: 32px; }
  .paper { padding: 14px 0 10px; border-radius: 14px; }
  .ed { margin: 0 14px; }
  .ctx { margin: 10px 14px 0; }
  .ctx-hint { display: none; }
  .mk { gap: 1px; }
  .mk button { width: 29px; height: 28px; }
  .mk .carry { display: none; }
  .chip-input { width: 100%; }
  .chip-group.end { margin-left: 0; }
  .page-title { font-size: 30px; }
  .goal-grid { grid-template-columns: 1fr; }
  .hday { grid-template-columns: 1fr; gap: 8px; }
  .hday-side { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; }
  .search { width: 100%; }
  .bar-row { grid-template-columns: 110px minmax(0, 1fr) 64px; }
  .tiles.compact { grid-template-columns: 1fr 1fr; }
  .review .card { padding: 18px 16px 18px 16px; }
  .step { position: static; margin-bottom: 8px; }
  .toast { bottom: 90px; }
  .ms-tools { opacity: 1; }
  .chip-x { opacity: 1; }
}

/* ---------------- Sign in ---------------- */
.auth { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 24px 0; }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.auth-logo { font-family: var(--serif); font-size: 44px; font-weight: 500; letter-spacing: -.02em; text-align: center; }
.auth-logo i { color: var(--acc); }
.auth-quote { font-family: var(--serif); font-style: italic; color: var(--mu); text-align: center; font-size: 15.5px; line-height: 1.5; margin-top: -8px; }
.auth-seg { align-self: center; }
.auth .form { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.auth .form .btn { margin-top: 4px; }
.auth-error { color: #ffb4a6; font-size: 13px; }
.auth-note { text-align: center; }
.danger-link { color: var(--red); align-self: flex-start; padding-left: 0; }
.danger-link:hover { color: #ff8f7f; }
body[data-view="auth"] .view { padding-top: 0; }

/* ---------------- Help link ---------------- */
.help-link { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line2); color: var(--mu); font-weight: 600; font-size: 12.5px; text-decoration: none; }
.help-link:hover, .help-link.on { color: var(--acc); border-color: #5a3b22; }

/* ---------------- Welcome tour ---------------- */
.welcome { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.wel-top { display: flex; align-items: center; justify-content: space-between; }
.wel-dots { display: flex; gap: 6px; }
.wel-dots i { width: 22px; height: 4px; border-radius: 4px; background: var(--s3); }
.wel-dots i.past { background: #6b4422; }
.wel-dots i.on { background: var(--acc); }
.wel-card { padding: 30px 32px; display: flex; flex-direction: column; gap: 16px; }
.wel-title { font-family: var(--serif); font-weight: 400; font-size: 40px; letter-spacing: -.02em; line-height: 1.1; }
.wel-title em { color: var(--acc); font-style: italic; }
.wel-h { font-family: var(--serif); font-weight: 500; font-size: 26px; letter-spacing: -.01em; }
.wel-opt { font-family: var(--sans); font-size: 11px; font-weight: 600; color: var(--mu); border: 1px solid var(--line2); border-radius: 99px; padding: 2px 8px; vertical-align: middle; margin-left: 6px; }
.wel-lead { font-family: var(--serif); font-size: 17.5px; line-height: 1.6; color: var(--tx); }
.wel-points { display: grid; gap: 10px; }
.wel-points div { display: grid; grid-template-columns: 150px 1fr; gap: 14px; padding: 12px 14px; background: var(--s2); border-radius: 12px; font-size: 13.5px; }
.wel-points b { font-family: var(--serif); font-size: 16px; font-weight: 500; color: var(--acc-2); }
.wel-points span { color: var(--mu); line-height: 1.55; }
.wel-goals { display: flex; flex-direction: column; gap: 8px; }
.wel-goal { display: grid; grid-template-columns: 1.1fr 1.4fr auto; gap: 8px; }
.wel-existing { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--mu); }
.wel-paper { padding: 16px 0 12px; }
.wel-tips, .wel-steps { color: var(--mu); font-size: 13.5px; line-height: 1.6; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.wel-tips b, .wel-steps b { color: var(--tx); }
.wel-foot { display: flex; justify-content: space-between; }
.wel-foot .btn-primary { min-width: 160px; }

/* ---------------- Guide ---------------- */
.guide { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.guide-toc { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 2px; }
.guide-toc a { color: var(--mu); text-decoration: none; font-size: 13.5px; padding: 6px 10px; border-radius: 8px; }
.guide-toc a:hover { color: var(--tx); background: var(--s1); }
.guide-body { display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.guide-sec { padding: 22px 24px; scroll-margin-top: 80px; }
.guide-sec h2 { font-family: var(--serif); font-weight: 500; font-size: 22px; margin-bottom: 10px; }
.guide-sec p, .guide-sec li { color: #cfc8bd; font-size: 14.5px; line-height: 1.7; }
.guide-sec p + p, .guide-sec p + ul, .guide-sec ul + p, .guide-sec ol + p, .guide-sec p + ol { margin-top: 10px; }
.guide-sec ul, .guide-sec ol { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.guide-sec b { color: var(--tx); }
.guide-sec em { font-family: var(--serif); color: var(--acc-2); }

@media (max-width: 760px) {
  .wel-card { padding: 22px 18px; }
  .wel-title { font-size: 32px; }
  .wel-points div { grid-template-columns: 1fr; gap: 4px; }
  .wel-goal { grid-template-columns: 1fr; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .guide { grid-template-columns: 1fr; }
  .guide-toc { display: none; }
}

/* Tour: editable rules */
.wel-rules { display: grid; gap: 10px; }
.wel-rule { padding: 14px 16px; background: var(--s2); border-radius: 12px; display: flex; flex-direction: column; gap: 8px; }
.wel-rule p { color: var(--mu); font-size: 13.5px; line-height: 1.55; }
.wel-rule p b { color: var(--tx); font-weight: 600; }
.wel-field { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-family: var(--serif); font-size: 18px; color: var(--acc-2); }
.wel-field .field { width: auto; font-family: var(--sans); font-size: 14px; color: var(--tx); background: var(--bg); }
.wel-field select.field { min-width: 190px; }
.wel-field .field.num { width: 84px; text-align: center; font-variant-numeric: tabular-nums; }
.wel-err { color: #ffb4a6 !important; }
