/* ================= mini stat grid ================= */
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.stats.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.stats.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.stat {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 8px 9px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat.plain {
  background: transparent;
  padding: 0;
}
.stat .stat-label {
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat .stat-ico {
  color: var(--text-3);
}

/* ================= timer ================= */
.timer {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}
.timer-clock {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.timer-time {
  font-family: var(--font-num);
  font-size: 2.1rem;
  font-weight: 620;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.timer-time.sm {
  font-size: 1.6rem;
}
.timer-state {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-3);
}
.timer-state.is-running {
  color: var(--accent-ink);
}
.timer-state.is-paused {
  color: var(--warn);
}
.timer-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.timer-presets .chip {
  height: 22px;
  padding: 0 8px;
}
.timer-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--text-3);
  font-weight: 550;
  min-width: 0;
}
.timer-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.timer-controls .btn-lg {
  flex: 1 1 auto;
  min-width: 96px;
}
.timer-custom {
  display: flex;
  align-items: center;
  gap: 6px;
}
.timer-custom .inp {
  width: 62px;
  height: 24px;
  font-size: var(--fs-xs);
}
.timer-live-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 650;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 99px;
  padding: 1px 8px;
}
.timer-pulse {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.6s infinite ease-in-out;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.75);
  }
}

/* ================= mood ================= */
.mood-picker {
  display: flex;
  gap: 5px;
}
.mood-btn {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 0;
}
.mood-btn:hover {
  background: var(--surface-3);
}
.mood-btn.is-active {
  border-color: var(--accent-2);
  background: var(--accent-soft);
}
.mood-btn svg {
  width: 20px;
  height: 20px;
}
.mood-btn span {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-3);
}
.mood-btn.is-active span {
  color: var(--accent-ink);
}
.mood-strip {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 26px;
}
.mood-strip > i {
  flex: 1 1 0;
  border-radius: 3px;
  background: var(--surface-3);
  display: block;
}

/* ================= timeline ================= */
.tl {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}
.tl-item {
  display: flex;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
}
.tl-time {
  width: 44px;
  flex: 0 0 auto;
  text-align: right;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-2);
  font-family: var(--font-num);
  padding-top: 1px;
}
.tl-rail {
  width: 12px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}
.tl-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  margin-top: 4px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 3px var(--surface);
  z-index: 1;
}
.tl-rail::after {
  content: "";
  position: absolute;
  top: 11px;
  bottom: -4px;
  width: 1.5px;
  background: var(--line);
}
.tl-item:last-child .tl-rail::after {
  display: none;
}
.tl-body {
  flex: 1 1 auto;
  min-width: 0;
  padding-bottom: 9px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tl-title {
  font-size: var(--fs-sm);
  font-weight: 550;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tl-note {
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.tl-item.is-now .tl-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.tl-item.is-now .tl-title {
  color: var(--accent-ink);
  font-weight: 640;
}
.tl-item.is-past .tl-dot {
  background: var(--line);
}
.tl-now {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0 4px;
}
.tl-now-line {
  flex: 1 1 auto;
  height: 1px;
  background: var(--accent-2);
}
.tl-now-tag {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 99px;
  padding: 0 6px;
  line-height: 15px;
}
.tl-cat {
  width: 3px;
  border-radius: 99px;
  align-self: stretch;
  background: var(--accent-2);
  flex: 0 0 auto;
  margin: 2px 0;
}

/* ================= activity feed ================= */
.feed {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px 14px;
  min-width: 0;
}
.feed-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: var(--radius-xs);
  min-width: 0;
  cursor: pointer;
}
.feed-row:hover {
  background: var(--surface-2);
}
.feed-ico {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: var(--surface-2);
  color: var(--text-2);
}
.feed-ico.task {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.feed-ico.txn {
  background: var(--mint-soft);
  color: #4e8270;
}
.feed-ico.focus {
  background: var(--pink-soft);
  color: #a8617e;
}
.feed-ico.mood {
  background: var(--beige-soft);
  color: #8a7145;
}
.feed-ico.health {
  background: var(--info-soft);
  color: #5c659c;
}
.feed-ico.study {
  background: var(--warn-soft);
  color: #96683a;
}
.feed-ico.news {
  background: var(--surface-2);
  color: var(--text-2);
}
.feed-main {
  min-width: 0;
  flex: 1 1 auto;
}
.feed-title {
  font-size: var(--fs-sm);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.feed-when {
  font-size: 10.5px;
  color: var(--text-3);
  font-weight: 550;
  flex: 0 0 auto;
}

/* ================= quick add ================= */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.quick-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 570;
  text-align: left;
  transition: all 0.15s ease;
  min-width: 0;
  color: var(--text);
}
.quick-btn:hover {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-ink);
}
.quick-btn .ico {
  color: var(--accent);
}
.quick-btn small {
  display: block;
  font-size: 10px;
  font-weight: 550;
  color: var(--text-3);
}
.quick-btn:hover small {
  color: var(--accent-ink);
  opacity: 0.75;
}

/* ================= add row (inline) ================= */
.addrow {
  display: flex;
  gap: 6px;
  align-items: center;
}
.addrow .inp {
  height: 28px;
}

/* ================= detail page bits ================= */
.page-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: var(--gap);
}
.page-head .page-title {
  font-size: 1rem;
  font-weight: 650;
}
.page-head .spacer {
  margin-left: auto;
}
.page-head .desc {
  font-size: var(--fs-xs);
  color: var(--text-3);
  width: 100%;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: var(--pad);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.panel-h {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.panel-h h2 {
  font-size: var(--fs-sm);
  font-weight: 640;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  align-items: start;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  align-items: start;
}
.grid-side {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.date-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.date-nav .dn-label {
  font-size: var(--fs-sm);
  font-weight: 620;
  min-width: 118px;
  text-align: center;
}
@media (max-width: 900px) {
  .grid-2,
  .grid-3,
  .grid-side {
    grid-template-columns: minmax(0, 1fr);
  }
  .feed {
    grid-template-columns: minmax(0, 1fr);
  }
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stats.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .timer-time {
    font-size: 1.85rem;
  }
  .scroll-y,
  .scroll-y.tall {
    max-height: 320px;
  }
}

@media (max-width: 380px) {
  .quick-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
