/* ==========================================================================
   Routines — the "today" timeline you tick off.
   ========================================================================== */

/* ---------- Today card ---------- */
.today-card {
  position: relative; overflow: hidden;
  margin-bottom: 26px; padding: 22px 24px 8px;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, #2a1152 0%, #1b0d35 52%, #140a28 100%);
  border: 1px solid rgba(196, 181, 253, .16);
  box-shadow: 0 24px 60px -30px rgba(60, 20, 120, .8);
  color: #f4f0fc;
}
.tc-orbs { position: absolute; inset: 0; pointer-events: none; }
.tc-orbs i { position: absolute; border-radius: 50%; filter: blur(46px); opacity: .5; }
.tc-orbs i:nth-child(1) { width: 300px; height: 300px; left: -70px; top: -140px; background: radial-gradient(circle, #7c3aed, transparent 65%); animation: tcA 18s var(--ease) infinite alternate; }
.tc-orbs i:nth-child(2) { width: 230px; height: 230px; right: 6%; bottom: -150px; background: radial-gradient(circle, #c026d3, transparent 65%); animation: tcB 23s var(--ease) infinite alternate; }
@keyframes tcA { to { transform: translate(70px, 60px) scale(1.2); } }
@keyframes tcB { to { transform: translate(-60px, -50px) scale(1.15); } }

.tc-head { position: relative; z-index: 1; display: flex; align-items: center; gap: 26px; flex-wrap: wrap; padding-bottom: 18px; }
.tc-when .eyebrow { color: #a394c6; }
.tc-when h3 { font-size: 23px; font-weight: 730; letter-spacing: -.02em; margin-top: 2px; }
.tc-clock { font: 600 13.5px var(--mono); color: #c4b5fd; margin-top: 3px; font-variant-numeric: tabular-nums; }

.tc-ring .ring-label b { font-size: 19px; color: #f7f3ff; }
.tc-ring .ring-label b small { font-size: 12px; font-weight: 600; color: #a394c6; }
.tc-ring .ring-label span { font-size: 10px; color: #a394c6; }
.tc-ring .ring-track { stroke: rgba(255, 255, 255, .1); }

.tc-next { display: flex; flex-direction: column; gap: 2px; margin-left: auto; align-items: flex-start; min-width: 190px; }
.tc-next .eyebrow { color: #a394c6; }
.tc-next > b { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.tc-next-at { font-size: 12.5px; color: #b9aed3; }
.tc-bell {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 10px; cursor: pointer;
  height: 32px; padding: 0 13px; border-radius: 999px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(196, 181, 253, .26);
  color: #ddd6fe; font: 600 12px var(--font);
  transition: transform var(--t) var(--spring), background var(--t), border-color var(--t);
}
.tc-bell svg { width: 14px; height: 14px; }
.tc-bell:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .14); border-color: rgba(196, 181, 253, .5); }
.tc-bell.on { background: rgba(52, 211, 153, .16); border-color: rgba(52, 211, 153, .45); color: #86efac; }
.tc-bell.on svg { animation: bellRing 5s var(--ease) infinite; transform-origin: 50% 10%; }
@keyframes bellRing { 0%, 88%, 100% { transform: rotate(0); } 91% { transform: rotate(14deg); } 94% { transform: rotate(-11deg); } 97% { transform: rotate(5deg); } }

.tc-empty { position: relative; z-index: 1; display: grid; justify-items: center; gap: 4px; padding: 10px 0 30px; }
.tc-empty .empty { padding: 10px 0; }
.tc-empty .empty b, .tc-empty .empty { color: #d8d0ea; }

/* ---------- Timeline ---------- */
.tl { position: relative; z-index: 1; padding: 4px 0 20px 0; }
.tl-block { position: relative; margin-bottom: 18px; }
.tl-block-head {
  display: flex; align-items: center; gap: 10px;
  padding: 0 4px 9px 46px;
}
.tl-block-head b { font-size: 13px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: #e4ddf5; }
.tl-block-meta { font-size: 11.5px; color: #8d80ab; }
.tl-block-prog { flex: 0 0 72px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .1); overflow: hidden; margin-left: auto; }
.tl-block-prog i { display: block; height: 100%; border-radius: inherit; background: var(--grad-brand); transition: width 700ms var(--ease-out); }
.tl-block-count { font: 600 11.5px var(--mono); color: #a394c6; min-width: 30px; text-align: right; }

/* the rail */
.tl-block::before {
  content: ''; position: absolute; left: 21px; top: 26px; bottom: 6px; width: 2px;
  background: linear-gradient(180deg, rgba(196, 181, 253, .3), rgba(196, 181, 253, .06));
  border-radius: 2px;
}

.tl-row {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 11px 12px 11px 10px; margin-left: 34px; border-radius: 14px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(196, 181, 253, .1);
  margin-bottom: 7px; cursor: pointer;
  opacity: 0; animation: tlIn 520ms var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 45ms + 120ms);
  transition: transform var(--t) var(--ease-out), background var(--t), border-color var(--t), box-shadow var(--t);
}
@keyframes tlIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
.no-motion .tl-row, .content.quiet .tl-row { animation: none; opacity: 1; }
.tl-row:hover { transform: translateX(3px); background: rgba(255, 255, 255, .07); border-color: rgba(196, 181, 253, .26); }

/* dot on the rail */
.tl-row::before {
  content: ''; position: absolute; left: -17px; top: 50%; width: 9px; height: 9px; margin-top: -4.5px;
  border-radius: 50%; background: var(--c, #a78bfa);
  box-shadow: 0 0 0 3px #1b0d35, 0 0 12px var(--c, #a78bfa);
}

/* The card is dark in both themes, so the checkbox needs its own contrast. */
.tl-row .check {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 8px;
  border: 2px solid rgba(196, 181, 253, .55);
  background: rgba(255, 255, 255, .06);
}
.tl-row .check svg { width: 15px; height: 15px; stroke-width: 2.6; }
.tl-row .check:hover { border-color: #c4b5fd; background: rgba(167, 139, 250, .25); }
.tl-row .check.on { border-color: transparent; background: var(--grad-brand); box-shadow: 0 2px 10px -2px rgba(124, 58, 237, .9); }
.tl-row.done .check { opacity: .8; }
.tl-time { font: 600 12px var(--mono); color: #c4b5fd; min-width: 132px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tl-len { font-weight: 500; color: #9589b4; font-size: 12px; }
.tl-row.done .tl-len { color: #675d80; }
.tl-pip { display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; border-radius: 9px; background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--c); }
.tl-pip svg { width: 15px; height: 15px; }
.tl-main { min-width: 0; flex: 1; }
.tl-main > b { display: block; font-size: 13.5px; font-weight: 600; color: #f1ecfb; }
.tl-meta { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 11.5px; color: #9589b4; margin-top: 2px; }
.tl-meta svg { width: 12px; height: 12px; }
.tl-streak { display: inline-flex; align-items: center; gap: 3px; font-style: normal; color: #fbbf24; }
.tl-through { display: block; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .12); margin-top: 7px; overflow: hidden; }
.tl-through i { display: block; height: 100%; background: var(--c); border-radius: inherit; transition: width 900ms var(--ease-out); }
.tl-acts { display: flex; gap: 2px; flex-shrink: 0; }
.tl-act { opacity: .45; color: #b9aed3; transition: opacity var(--t), color var(--t), background var(--t); }
.tl-row:hover .tl-act { opacity: 1; }
.tl-act:hover { background: rgba(255, 255, 255, .12); color: #f1ecfb; }
.tl-del:hover { background: rgba(251, 113, 133, .2); color: #fda4af; }
/* Touch screens have no hover, so never hide the controls there. */
@media (hover: none) { .tl-act { opacity: .85; } }

.tl-badge {
  flex-shrink: 0; font: 700 10px var(--font); letter-spacing: .1em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px; color: #0b0617; background: var(--grad-brand);
  animation: nowPulse 2.4s var(--ease) infinite;
}
@keyframes nowPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(167, 139, 250, .55); } 60% { box-shadow: 0 0 0 9px rgba(167, 139, 250, 0); } }

/* in progress */
.tl-row.now { background: rgba(167, 139, 250, .13); border-color: rgba(167, 139, 250, .45); box-shadow: 0 0 28px -10px rgba(139, 92, 246, .8); }

/* done */
.tl-row.done { background: rgba(255, 255, 255, .02); border-color: rgba(196, 181, 253, .07); }
.tl-row.done .tl-main > b { text-decoration: line-through; color: #7a6f94; }
.tl-row.done .tl-time, .tl-row.done .tl-meta { color: #675d80; }
.tl-row.done .tl-pip { background: rgba(255, 255, 255, .05); color: #6f6490; }
.tl-row.done::before { background: #5b5278; box-shadow: 0 0 0 3px #1b0d35; }

/* missed */
.tl-row.past { opacity: .62; }
.tl-row.past::before { background: #6b6187; box-shadow: 0 0 0 3px #1b0d35; }

/* the "now" divider between rows */
.tl-now { position: relative; display: flex; align-items: center; gap: 9px; margin: 10px 0 10px 34px; height: 2px; }
.tl-now::after { content: ''; position: absolute; left: 0; right: 8px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--danger), transparent); }
.tl-now-dot { position: absolute; left: -21px; width: 11px; height: 11px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px #1b0d35; animation: nowBeat 2s var(--ease) infinite; }
@keyframes nowBeat { 0%, 100% { box-shadow: 0 0 0 3px #1b0d35, 0 0 0 0 rgba(251, 113, 133, .6); } 60% { box-shadow: 0 0 0 3px #1b0d35, 0 0 0 10px rgba(251, 113, 133, 0); } }
.tl-now-label { position: relative; z-index: 1; margin-left: auto; font: 700 10.5px var(--mono); color: var(--danger); background: #1b0d35; padding: 0 6px; }

/* ---------- Inline add ---------- */
.tl-add {
  display: flex; align-items: center; gap: 10px;
  margin: 2px 0 4px 34px; padding: 7px 12px 7px 10px;
  border-radius: 13px; border: 1px dashed rgba(196, 181, 253, .22);
  background: transparent;
  transition: border-color var(--t), background var(--t);
}
.tl-add:focus-within { border-style: solid; border-color: rgba(167, 139, 250, .6); background: rgba(255, 255, 255, .05); }
.tl-add-ic { display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; border-radius: 9px; background: rgba(255, 255, 255, .06); color: #a394c6; transition: color var(--t), background var(--t); }
.tl-add-ic svg { width: 15px; height: 15px; }
.tl-add:focus-within .tl-add-ic { background: var(--grad-brand); color: #fff; }
.tl-add input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none;
  color: #f1ecfb; font: 500 13.5px var(--font); padding: 4px 0;
}
.tl-add input::placeholder { color: #6f6490; }

/* how long the new line should be */
.tl-len-pick {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; cursor: pointer;
  height: 28px; padding: 0 7px 0 9px; border-radius: 9px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(196, 181, 253, .2);
  color: #ddd6fe; font: 600 12px var(--font); font-variant-numeric: tabular-nums;
  transition: border-color var(--t), background var(--t), transform var(--t) var(--spring);
}
.tl-len-pick:hover { border-color: rgba(167, 139, 250, .6); background: rgba(255, 255, 255, .13); transform: translateY(-1px); }
.tl-len-pick > svg:first-child { width: 13px; height: 13px; color: #a78bfa; }
.tl-len-pick > svg:last-child { width: 13px; height: 13px; color: #8d80ab; }
.tl-len-val { min-width: 34px; text-align: left; }

/* the length menu */
.popover.len-pop { width: 244px; padding: 8px; }
.len-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; padding: 2px; }
.len-opt {
  height: 30px; border-radius: 9px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); font: 600 11.5px var(--font); font-variant-numeric: tabular-nums;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.len-opt:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.len-opt.on { background: var(--grad-brand); border-color: transparent; color: #fff; box-shadow: 0 4px 12px -4px rgba(124, 58, 237, .8); }
.len-tip { padding: 9px 6px 3px; font-size: 11px; line-height: 1.5; color: var(--text-3); border-top: 1px solid var(--border); margin-top: 8px; }
.len-tip b { color: var(--text-2); font-weight: 650; }
.tl-add input.invalid { animation: shakeIn 400ms var(--ease); }
@keyframes shakeIn { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.tl-add kbd {
  flex-shrink: 0; opacity: 0; font: 600 10.5px var(--mono); color: #a394c6;
  padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, .07);
  transition: opacity var(--t);
}
.tl-add:focus-within kbd { opacity: 1; }

.tl-hint { position: relative; z-index: 1; padding: 0 0 20px 46px; font-size: 12px; color: #8d80ab; }

.tl-newblock { padding: 4px 0 2px 34px; }
.tl-addblock {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  height: 30px; padding: 0 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(196, 181, 253, .16);
  color: #b9aed3; font: 600 12px var(--font);
  transition: transform var(--t) var(--spring), background var(--t), border-color var(--t);
}
.tl-addblock svg { width: 14px; height: 14px; }
.tl-addblock:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .1); border-color: rgba(167, 139, 250, .45); color: #e9ddff; }

/* ---------- Privacy markers ---------- */
.priv-inline { display: inline-flex; align-items: center; gap: 5px; margin-left: 4px; font-size: 12.5px; color: var(--primary-strong); }
.priv-inline svg { width: 13px; height: 13px; }
.priv-tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 11px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-strong);
  font: 600 11.5px var(--font); white-space: nowrap;
}
.priv-tag svg { width: 13px; height: 13px; }
.priv-note {
  display: flex; gap: 10px; padding: 14px;
  border-radius: var(--r); background: var(--surface-2); border: 1px dashed var(--border-strong);
  font-size: 12.5px; line-height: 1.55; color: var(--text-2);
}
.priv-note svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--primary); margin-top: 1px; }
.priv-note b { color: var(--text); }

/* ---------- Week view toggle ---------- */
.cal-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; cursor: pointer;
  margin-bottom: 16px; padding: 12px 16px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font: 600 13.5px var(--font);
  transition: border-color var(--t), background var(--t);
}
.cal-toggle:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.cal-toggle > svg { width: 17px; height: 17px; color: var(--primary); }
.cal-toggle small { color: var(--text-3); font-weight: 500; font-size: 12px; }
.cal-chev { margin-left: auto; display: grid; place-items: center; color: var(--text-3); transition: transform var(--t) var(--ease); }
.cal-chev svg { width: 17px; height: 17px; }
.cal-chev.open { transform: rotate(180deg); }

/* an event already ticked off for that day */
.evt.ticked { opacity: .5; }
.evt.ticked b { text-decoration: line-through; }
.evt.spill::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 10px;
  background: repeating-linear-gradient(90deg, var(--c) 0 4px, transparent 4px 8px);
  opacity: .5; border-radius: 0 0 8px 8px;
}

@media (max-width: 760px) {
  .today-card { padding: 18px 14px 4px; }
  .tc-head { gap: 16px; }
  .tc-next { margin-left: 0; }
  .tl-row { margin-left: 28px; gap: 9px; padding-left: 8px; }
  .tl-add, .tl-newblock { margin-left: 28px; padding-left: 8px; }
  .tl-hint { padding-left: 38px; }
  .tl-block-head { padding-left: 38px; }
  .tl-block::before { left: 15px; }
  .tl-row::before { left: -15px; }
  .tl-time { min-width: 0; font-size: 11px; }
  .tl-pip, .tl-edit { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .today-card *, .tl-row { animation: none !important; }
  .tl-row { opacity: 1; }
}
.no-motion .today-card *, .no-motion .tl-row { animation: none !important; }
.no-motion .tl-row { opacity: 1; }
