/* ============================================================
   nico-today.css — the Today front door (desktop /app + Mac + web).
   Tokens only, so it adapts to dark / light / sierra automatically.
   #today-col spans the thread + canvas grid tracks and is revealed by
   body[data-session="today"]; the two working columns hide underneath.
   ============================================================ */

#today-col {
  display: none;
  grid-column: 2 / -1;
  grid-row: 1;
  min-height: 0;
  flex-direction: column;
  background: var(--bg);
}
body[data-session="today"] #today-col { display: flex; }
body[data-session="today"] #thread-col,
body[data-session="today"] #canvas-col { display: none; }
body[data-session="today"] #body {
  grid-template-columns: var(--sidebar-w, 280px) minmax(0, 1fr) 0;
}

#todayScroll { flex: 1; min-height: 0; overflow-y: auto; padding: 26px 26px 60px; }
#todayView { max-width: 880px; margin: 0 auto; }

/* ---- header ---- */
.today-head { margin-bottom: 22px; }
.today-hi {
  font-family: var(--sans); font-size: 22px; font-weight: 600;
  letter-spacing: -0.02em; color: var(--text);
}
.today-date {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-4); margin-top: 4px;
}
.today-meetings {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 12px;
  padding: 6px 11px; border-radius: 999px;
  background: var(--info-dim); border: 0.5px solid var(--line-soft);
  font-size: 12px; color: var(--text-2);
}
.today-meetings .tm-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--info); flex: none; }
.today-meetings b { color: var(--text); font-weight: 600; }

/* ---- section labels ---- */
.today-sec-label {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-4);
  margin: 26px 0 11px; display: flex; align-items: center; gap: 8px;
}
.today-sec-label:first-child { margin-top: 4px; }
.today-sec-label .tsl-line { flex: 1; height: 0.5px; background: var(--line-soft); }

/* ---- routines strip ---- */
.rt-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 12px; min-width: 0; }
.rt-card {
  background: var(--surface-1); border: 0.5px solid var(--line);
  border-radius: var(--r-lg); padding: 14px 15px 13px;
  display: flex; flex-direction: column; min-height: 0;
  transition: border-color 0.16s, background 0.16s;
}
.rt-card.on { border-color: var(--accent-line); background: var(--surface-2); }
.rt-card-top { display: flex; align-items: flex-start; gap: 11px; }
.rt-emoji {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-size: 18px; line-height: 1;
  background: var(--surface-3); border: 0.5px solid var(--line-soft);
}
.rt-card.on .rt-emoji { background: var(--accent-dim); border-color: var(--accent-line); }
.rt-head { flex: 1; min-width: 0; }
.rt-name { font-family: var(--sans); font-size: 13.5px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.rt-blurb { font-size: 12px; line-height: 1.45; color: var(--text-3); margin-top: 3px; }

/* toggle switch — pure tokens, works in all three themes */
.rt-toggle {
  width: 34px; height: 20px; border-radius: 999px; flex: none; margin-top: 1px;
  background: var(--surface-3); border: 0.5px solid var(--line);
  position: relative; cursor: pointer; transition: background 0.16s, border-color 0.16s;
}
.rt-toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 15px; height: 15px; border-radius: 50%; background: var(--text-3);
  transition: transform 0.16s, background 0.16s;
}
.rt-toggle.on { background: var(--accent); border-color: transparent; }
.rt-toggle.on::after { transform: translateX(14px); background: var(--on-accent); }
.rt-toggle.busy { opacity: 0.55; cursor: progress; }

/* edit gear on every routine card (curated → timing, custom → Builder) */
.rt-gear {
  width: 24px; height: 24px; border-radius: 7px; flex: none; margin-top: -1px;
  display: grid; place-items: center;
  background: transparent; border: 0.5px solid transparent;
  color: var(--text-4); cursor: pointer; transition: all 0.14s;
}
.rt-gear:hover { color: var(--text); background: var(--hover); border-color: var(--line); }

.rt-custom-tag {
  font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 6px; border-radius: 999px;
  background: var(--accent-dim); border: 0.5px solid var(--accent-line); color: var(--accent-text);
}

/* "+ New routine" card at the end of the strip */
.rt-new {
  border: 1px dashed var(--line); background: transparent; border-radius: var(--r-lg);
  min-height: 96px; padding: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-family: var(--sans); color: var(--text-3); cursor: pointer; transition: all 0.16s;
}
.rt-new:hover { border-color: var(--accent-line); color: var(--text); background: var(--surface-1); }
.rt-new-plus { font-size: 20px; line-height: 1; color: var(--text-4); }
.rt-new:hover .rt-new-plus { color: var(--accent-text); }
.rt-new-t { font-size: 12.5px; font-weight: 600; }
.rt-new-d { font-size: 11px; color: var(--text-4); }

.rt-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 11px; padding-top: 10px; border-top: 0.5px solid var(--line-soft);
  font-family: var(--mono); font-size: 10.5px; color: var(--text-4);
}
.rt-meta .rt-when { color: var(--text-3); }
.rt-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px; border-radius: 999px;
  background: var(--surface-2); border: 0.5px solid var(--line-soft); color: var(--text-3);
}
.rt-chip .rt-cd { width: 5px; height: 5px; border-radius: 50%; background: var(--text-4); }
.rt-card.on .rt-chip .rt-cd { background: var(--ok); }

/* ---- plan-gate upsell banner ---- */
.today-upsell {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 0 14px; padding: 12px 14px;
  background: var(--accent-dim); border: 0.5px solid var(--accent-line);
  border-radius: var(--r-md); font-size: 12.5px; color: var(--text-2);
}
.today-upsell b { color: var(--text); font-weight: 600; }
.today-upsell .sp { flex: 1; }

/* ---- shared small buttons ---- */
.today-btn {
  font-family: var(--mono); font-size: 11px; color: var(--text-2);
  background: var(--surface-2); border: 0.5px solid var(--line);
  border-radius: var(--r-sm); padding: 6px 11px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: all 0.14s;
}
.today-btn:hover { background: var(--hover); color: var(--text); border-color: var(--line-bright); }
.today-btn:disabled { opacity: 0.55; cursor: default; }
.today-btn.primary { color: var(--on-accent); background: var(--accent); border-color: transparent; }
.today-btn.primary:hover { filter: brightness(1.06); color: var(--on-accent); }

/* ---- latest output cards ---- */
.rt-out-list { display: flex; flex-direction: column; gap: 14px; }
.rt-out {
  background: var(--surface-1); border: 0.5px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
}
.rt-out-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 15px; border-bottom: 0.5px solid var(--line-soft);
}
.rt-out-emoji { font-size: 15px; line-height: 1; flex: none; }
.rt-out-title { flex: 1; min-width: 0; font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--text); }
.rt-out-when { font-family: var(--mono); font-size: 10.5px; color: var(--text-4); white-space: nowrap; }
.rt-out-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 10px; color: var(--text-4);
}
.rt-out-status .rt-sd { width: 6px; height: 6px; border-radius: 50%; background: var(--text-4); }
.rt-out-status.ok .rt-sd { background: var(--ok); }
.rt-out-status.error .rt-sd { background: var(--err); }
.rt-out-status.running { color: var(--text-3); }
.rt-out-status.running .rt-sd { background: var(--info); animation: rtPulse 1.6s ease-in-out infinite; }
@keyframes rtPulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.rt-out-body { padding: 4px 16px 14px; }
.rt-out-body .prose { font-size: 13px; }
.rt-out-actions {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 15px; border-top: 0.5px solid var(--line-soft); background: var(--surface-1);
}
.rt-out-actions .sp { flex: 1; }

/* honest empty state inside an enabled-but-never-run routine */
.rt-out-empty {
  padding: 16px; font-size: 12.5px; color: var(--text-3); line-height: 1.5;
  display: flex; align-items: center; gap: 9px;
}
.rt-out-empty .rt-clock { flex: none; color: var(--text-4); }

/* ---- surface-level empty / error / loading ---- */
.today-note {
  border: 0.5px dashed var(--line); border-radius: var(--r-md);
  padding: 18px; font-size: 12.5px; color: var(--text-3); line-height: 1.55;
  text-align: center;
}
.today-note .tn-emoji { font-size: 20px; display: block; margin-bottom: 8px; }
.today-loading { color: var(--text-4); font-family: var(--mono); font-size: 12px; padding: 8px 2px; }

/* ============================================================
   Routine Builder overlay (nico-routine-builder.js) — one dialog,
   three faces: create / edit-custom / curated timing. Tokens only,
   so dark / light / sierra come free. z-index sits with the app's
   drawer scrim tier (380/381 in nico.css).
   ============================================================ */
.rb-scrim { position: fixed; inset: 0; z-index: 380; background: oklch(0 0 0 / 0.4); }
.rb-panel {
  position: fixed; z-index: 381; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(560px, 94vw); max-height: min(88vh, 760px); overflow-y: auto;
  background: var(--surface-1); border: 0.5px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 24px 60px oklch(0 0 0 / 0.35);
  overscroll-behavior: contain;
}
.rb-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 0.5px solid var(--line-soft);
  position: sticky; top: 0; background: var(--surface-1); z-index: 1;
}
.rb-title { flex: 1; min-width: 0; font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--text); }
.rb-x {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: grid; place-items: center; font-size: 13px;
  background: transparent; border: 0.5px solid transparent; color: var(--text-4); cursor: pointer;
}
.rb-x:hover { color: var(--text); background: var(--hover); border-color: var(--line); }

.rb-body { padding: 14px 16px 4px; }
.rb-field { margin-bottom: 15px; }
.rb-label {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-4); margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}
.rb-label .rb-tz { margin-left: auto; text-transform: none; letter-spacing: 0; }

.rb-input, .rb-select, .rb-textarea {
  width: 100%; font-family: var(--sans); font-size: 13px; color: var(--text);
  background: var(--surface-2); border: 0.5px solid var(--line); border-radius: var(--r-sm);
  padding: 8px 10px; outline: none; transition: border-color 0.14s, box-shadow 0.14s;
}
.rb-input:focus, .rb-select:focus, .rb-textarea:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-dim); }
.rb-input::placeholder, .rb-textarea::placeholder { color: var(--text-4); }
.rb-textarea { resize: vertical; min-height: 74px; line-height: 1.5; }
.rb-textarea:disabled { opacity: 0.6; }
.rb-select { cursor: pointer; }

.rb-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rb-row .rb-input, .rb-row .rb-select { width: auto; flex: none; }
.rb-row .rb-num { width: 72px; }
.rb-inline { font-size: 12.5px; color: var(--text-3); }

.rb-emojis { display: flex; gap: 6px; flex-wrap: wrap; }
.rb-em {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: grid; place-items: center; font-size: 16px; line-height: 1;
  background: var(--surface-2); border: 0.5px solid var(--line); cursor: pointer; transition: all 0.14s;
}
.rb-em:hover { border-color: var(--line-bright); }
.rb-em.on { background: var(--accent-dim); border-color: var(--accent-line); }

.rb-allsrc { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.rb-allsrc input { accent-color: var(--accent); margin: 0; }
.rb-srcs { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; margin-top: 8px; }
.rb-src {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px;
  border-radius: var(--r-sm); background: var(--surface-2); border: 0.5px solid var(--line-soft);
  font-size: 12.5px; color: var(--text-2); cursor: pointer;
}
.rb-src input { accent-color: var(--accent); margin: 0; flex: none; }
.rb-src.dead { opacity: 0.6; }
.rb-src .rb-src-sub { font-family: var(--mono); font-size: 9.5px; color: var(--text-4); margin-left: auto; }

.rb-note { font-size: 11.5px; color: var(--text-4); margin-top: 6px; line-height: 1.45; width: 100%; }
.rb-note.warn { color: var(--text-3); }
.rb-loading { font-family: var(--mono); font-size: 11.5px; color: var(--text-4); padding: 4px 0; }
.rb-loading.err { color: var(--err); }

.rb-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 16px 14px; border-top: 0.5px solid var(--line-soft);
  position: sticky; bottom: 0; background: var(--surface-1);
}
.rb-foot .sp { flex: 1; }
.rb-err { flex-basis: 100%; font-size: 12px; color: var(--err); line-height: 1.45; }
.rb-danger { color: var(--err); }
.rb-danger:hover { color: var(--err); border-color: var(--err); }

@media (max-width: 700px) {
  body[data-session="today"] #body {
    grid-template-columns: var(--sidebar-w, 200px) minmax(0, 1fr) 0;
  }
  body[data-session="today"].sidebar-collapsed #body {
    grid-template-columns: 0 minmax(0, 1fr) 0;
  }
  #todayScroll { padding: 18px 14px 44px; }
  .rt-strip { grid-template-columns: minmax(0, 1fr); }
}
