*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #FCFBFB;
  --surface:  #FFFFFF;
  --border:   #D1D1D6;
  --text:     #1C1C1E;
  --dim:      #636366;
  --dimmer:   #8E8E93;
  --font:     -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --accent:   #007AFF;
  --green:    #34C759;
  --red:      #FF3B30;
  --sel:      #EBF3FF;
}

html[data-theme="dark"] {
  --bg:       #1C1C1E;
  --surface:  #2C2C2E;
  --border:   #3A3A3C;
  --text:     #F2F2F7;
  --dim:      #AEAEB2;
  --dimmer:   #8E8E93;
  --accent:   #0A84FF;
  --green:    #30D158;
  --red:      #FF453A;
  --sel:      #1A3A5C;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --bg:       #1C1C1E;
    --surface:  #2C2C2E;
    --border:   #3A3A3C;
    --text:     #F2F2F7;
    --dim:      #AEAEB2;
    --dimmer:   #8E8E93;
    --accent:   #0A84FF;
    --green:    #30D158;
    --red:      #FF453A;
    --sel:      #1A3A5C;
  }
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}

body {
  display: flex;
  justify-content: center;
  padding: 11px 24px 118px;
}

/* ── Auth Screen ── */
#auth-screen {
  position: fixed;
  inset: 0;
  background: rgba(242, 242, 247, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  justify-content: center;
  padding-top: 80px;
  z-index: 200;
}

html[data-theme="dark"] #auth-screen,
html[data-theme="system"] #auth-screen {
  background: rgba(28, 28, 30, 0.92);
}

@media (prefers-color-scheme: light) {
  html[data-theme="system"] #auth-screen {
    background: rgba(242, 242, 247, 0.92);
  }
}

.auth-inner {
  max-width: 400px;
  width: 100%;
  position: relative;
}

.auth-close-btn {
  position: absolute;
  top: -.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.5;
  line-height: 1;
  padding: 0;
}
.auth-close-btn:hover { opacity: 1; }

#guest-banner {
  display: none;
  font-size: 12px;
  color: var(--dim);
  border: 1px solid var(--border);
  padding: 8px 14px;
  margin-bottom: 20px;
}

#guest-banner button {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.auth-logo {
  color: var(--red);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.auth-pitch {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 6px;
}

.auth-pitch-sub {
  font-size: 13px;
  color: var(--dim);
  margin-bottom: 30px;
}

.auth-field {
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
  transition: border-color 0.15s;
}

.auth-field:focus-within { border-bottom-color: var(--accent); }

.auth-field input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  padding: 8px 0 10px;
  caret-color: var(--accent);
}

.auth-field input::placeholder { color: var(--dimmer); }

.auth-submit {
  margin-top: 24px;
  background: var(--accent);
  color: var(--surface);
  border: none;
  font-family: var(--font);
  font-size: 14px;
  padding: 10px 24px;
  cursor: pointer;
  width: 100%;
  transition: filter 0.15s;
}

.auth-submit:hover { filter: brightness(1.1); }

.auth-error {
  margin-top: 12px;
  font-size: 13px;
  color: var(--red);
  min-height: 20px;
}

.auth-toggle-btn {
  display: block;
  margin-top: 16px;
  background: none;
  border: none;
  color: var(--dim);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.auth-toggle-btn:hover { color: var(--text); }

.auth-divider { text-align: center; color: var(--dim); margin: 20px 0; font-size: 0.85em; }

#google-btn { display: flex; justify-content: center; }

/* ── App ── */
#app {
  position: relative;
  width: 100%;
  max-width: 760px;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 32px;
}

.header-logo {
  color: var(--red);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.header-sep { color: var(--dimmer); }

.header-date {
  color: var(--dim);
  font-size: 13px;
}

.header-about {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--dimmer);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}

.header-about:hover { color: var(--dim); }

.header-running {
  font-size: 13px;
  color: var(--green);
  display: none;
}

.header-running.visible { display: inline; }

.header-pomodoro {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  opacity: 0.35;
  transition: opacity 0.15s;
  line-height: 1;
}

.header-pomodoro.active { opacity: 1; }
.header-pomodoro:hover { opacity: 0.7; }
.header-pomodoro.active:hover { opacity: 0.85; }

@keyframes pomodoro-ring {
  0%, 100% { transform: scale(1); }
  20%       { transform: scale(1.4); }
  40%       { transform: scale(0.9); }
  60%       { transform: scale(1.3); }
  80%       { transform: scale(0.95); }
}

.header-pomodoro.ringing { animation: pomodoro-ring 0.6s ease; }

.header-pomodoro-mins {
  width: 36px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--dim);
  font-family: var(--font);
  font-size: 12px;
  text-align: center;
  padding: 0 0 1px;
  outline: none;
  opacity: 0.25;
  pointer-events: none;
  transition: opacity 0.15s;
  appearance: textfield;
  -moz-appearance: textfield;
}

.header-pomodoro-mins::-webkit-inner-spin-button,
.header-pomodoro-mins::-webkit-outer-spin-button { -webkit-appearance: none; }

.header-pomodoro.active ~ .header-pomodoro-mins {
  opacity: 1;
  pointer-events: auto;
}

.header-logout {
  background: none;
  border: none;
  color: var(--dimmer);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.header-logout:hover { color: var(--dim); }

/* ── Search bar ── */
.search-row {
  position: relative;
  display: flex;
  align-items: center;
  overflow: visible;
  border-bottom: 2px solid var(--border);
  margin-bottom: 4px;
  transition: border-color 0.15s;
}

.search-row:focus-within { border-bottom-color: var(--accent); }

.search-prompt {
  position: relative;
  flex-shrink: 0;
  line-height: 0;
  padding: 6px 2px 6px 0;
  user-select: none;
  cursor: pointer;
  overflow: visible;
}

/* Speech bubble from the beaver — tail points down toward the mascot */
.tag-tip {
  display: block;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  z-index: 50;
  width: max-content;
  max-width: min(400px, calc(100vw - 20px));
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.97);
  transform-origin: 28px 100%;
  cursor: default;
  text-align: left;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.07));
}

.tag-tip.visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition:
    opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s;
  animation: tag-tip-breathe 3.2s ease-in-out 0.5s infinite;
}

.tag-tip:not(.visible) {
  transition:
    opacity 0.2s ease-out,
    transform 0.2s ease-out,
    visibility 0s linear 0.2s;
}

.tag-tip-inner {
  position: relative;
  box-sizing: border-box;
  max-width: inherit;
  padding: 12px 40px 12px 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Outer tail stroke */
.tag-tip-inner::before {
  content: '';
  position: absolute;
  bottom: -9px;
  left: 20px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid var(--border);
}

/* Inner tail fill */
.tag-tip-inner::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 21px;
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 9px solid var(--surface);
}

.tag-tip-text {
  margin: 0;
  font-style: normal;
  white-space: nowrap;
}

@media (max-width: 340px) {
  .tag-tip-text {
    white-space: normal;
  }
}

.tag-tip-close {
  position: absolute;
  top: 6px;
  right: 8px;
  border: none;
  background: none;
  color: var(--dim);
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 6px;
}

.tag-tip-close:hover {
  color: var(--text);
  background: var(--sel);
}

@keyframes tag-tip-breathe {
  0%,
  100% {
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.07));
  }
  50% {
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.1));
  }
}

@keyframes beaver-mascot-speak {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-1px) rotate(-2deg);
  }
  50% {
    transform: translateY(-2px) rotate(0deg);
  }
  75% {
    transform: translateY(-1px) rotate(2deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tag-tip {
    transform: none;
    filter: none;
  }

  .tag-tip.visible {
    animation: none;
    transform: none;
    transition: opacity 0.12s ease-out, visibility 0s;
  }

  .tag-tip:not(.visible) {
    transition: opacity 0.12s ease-out, visibility 0s linear 0.12s;
  }

  .search-prompt:has(#tag-tip.visible) .beaver-mascot {
    animation: none;
  }
}

.beaver-mascot {
  height: 28px;
  width: auto;
  display: block;
  transform-origin: 50% 100%;
}

/* Gentle bob while the tag tip is open (“speaking”) */
.search-prompt:has(#tag-tip.visible) .beaver-mascot {
  animation: beaver-mascot-speak 0.7s ease-in-out 2;
}

#search {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 22px;
  padding: 8px 0 10px 12px;
  caret-color: var(--accent);
}

#search::placeholder { color: var(--dimmer); }

.search-hint {
  font-size: 12px;
  color: var(--dimmer);
  padding-top: 6px;
}

.tag-autocomplete {
  margin-top: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.tag-row {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--border);
}

.tag-row:first-of-type {
  border-top: none;
}

.tag-row.selected {
  background: var(--sel);
}

.tag-option {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--dim);
  font-family: var(--font);
  font-size: 13px;
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
}

.tag-option:hover,
.tag-option.selected {
  background: var(--sel);
  color: var(--text);
}

.tag-delete-btn {
  border: none;
  background: none;
  color: var(--red);
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  padding: 0 10px;
  opacity: 0.7;
}

.tag-delete-btn:hover {
  opacity: 1;
  filter: brightness(1.1);
}

.po-hash {
  color: var(--dimmer);
  margin-right: 2px;
}

.po-create {
  color: var(--accent);
}

@media all and (max-width: 500px) {
  .search-hint {
    display: none;
  }
}

.char-up { position: relative; top: -2px; display: inline-block; }

.search-hint kbd {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  line-height: 1.4;
}

/* ── Task list ── */
#task-list { list-style: none; }

#search-create-hint {
  font-size: 13px;
  color: var(--dim);
  white-space: nowrap;
  flex-shrink: 0;
  display: none;
  padding-right: 2px;
  cursor: pointer;
}

#search-create-hint:hover { color: var(--accent); }

#search-create-hint.visible { display: block; }

.hint-return { position: relative; top: 2px; display: inline-block; }

.empty-state {
  font-size: 15px;
  color: var(--dim);
  font-style: italic;
  padding: 24px 0;
}

/* ── Task row ── */
.task-row {
  position: relative;
  border-bottom: 1px solid var(--border);
}

.t-play {
  position: absolute;
  left: -44px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--sel);
  color: var(--dim);
  font-size: 13px;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  padding-left: 2px; /* optical center for ▶ */
}

.task-main::after {
  content: '';
  position: absolute;
  left: -12px;
  top: 0;
  width: 12px;
  height: 100%;
}

.t-shortcut {
  position: absolute;
  left: -44px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  text-align: center;
  font-size: 11px;
  font-family: var(--font);
  color: var(--dimmer);
  pointer-events: none;
  transition: opacity 0.15s;
}
.task-row:hover .t-shortcut { opacity: 0; }
.task-row:hover .t-play { opacity: 1; }
.t-play.pausing { background: var(--border); color: var(--text); font-size: 15px; padding-left: 0; }
.task-main.not-expandable { cursor: default; }
.t-play:hover { background: var(--border); color: var(--text); }


.task-row.selected { background: var(--sel); }

.task-row.selected::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
}

.task-main {
  position: relative;
  display: flex;
  align-items: center;
  padding: 13px 0 13px 10px;
  gap: 14px;
  cursor: pointer;
  user-select: none;
}

.task-row.selected .task-main { padding-left: 13px; }

.nav-highlight {
  background: var(--sel);
  position: relative;
}

.nav-highlight::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

/* running indicator dot */
.t-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  background: var(--green);
  display: none;
}

.task-row.running { background: color-mix(in srgb, var(--green) 8%, transparent); }
.task-row.running .t-dot { display: block; }

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.15; }
}

.task-row.running .t-dot { animation: blink 1.2s step-start infinite; }

.t-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 16px;
}

.t-tag {
  font-size: 12px;
  color: var(--dimmer);
  white-space: nowrap;
}

.task-row.running .t-name { color: var(--text); font-weight: 500; }

.t-time {
  font-size: 14px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  min-width: 84px;
  text-align: right;
  flex-shrink: 0;
}

.task-row.running .t-time { color: var(--dim); }

.t-time-label {
  font-family: var(--font);
  font-size: 11px;
  color: var(--dimmer);
  font-variant-numeric: normal;
}
.t-time-sep {
  color: var(--dimmer);
  margin: 0 2px;
}

/* ── Shared disclosure caret (macOS-style) ── */
.t-expand,
.day-chevron,
.dt-chevron,
.week-chevron,
.total-expand,
.later-chevron {
  font-size: 0;
  color: var(--dimmer);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.1s, background 0.1s;
}
.t-expand::before,
.day-chevron::before,
.dt-chevron::before,
.week-chevron::before,
.total-expand::before,
.later-chevron::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  margin-left: -1px;
}
.t-expand.expanded::before,
.day-chevron.expanded::before,
.dt-chevron.expanded::before,
.week-chevron.expanded::before,
.total-expand.expanded::before,
.later-chevron.expanded::before {
  transform: rotate(45deg);
  margin-left: 0;
  margin-top: -2px;
}

.task-row:hover .t-expand { color: var(--dim); }
.t-expand:hover { background: var(--sel); color: var(--text) !important; }

.t-del {
  opacity: 0;
  background: none;
  border: none;
  color: var(--red);
  font-family: var(--font);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
  margin-right: -33px;
  transition: opacity 0.1s;
  line-height: 1;
}

.task-row:hover .t-del { opacity: 1; }
.t-del:hover { filter: brightness(1.3); }

@media all and (max-width: 500px) {
  .task-main {
    flex-wrap: wrap;
    row-gap: 2px;
  }

  .t-tag {
    order: 6;
    flex-basis: 100%;
    margin-left: 0;
    line-height: 1.2;
  }

  .task-row .t-del,
  .sl-entry .sl-del {
    opacity: 1;
  }

  .task-row .t-del {
        margin-right: -20px;
  }
}

/* ── Session log ── */
.session-log {
  display: none;
  padding: 0 0 14px 10px;
}

.session-log.open { display: block; }

.sl-date {
  font-size: 12px;
  color: var(--dimmer);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 16px 0 4px;
}

.sl-entry {
  position: relative;
  display: flex;
  gap: 16px;
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--dim);
  padding: 3px 44px 3px 0;
}

.sl-entry.live { color: var(--accent); }

.sl-range { flex: 1; }

.sl-dur {
  font-variant-numeric: tabular-nums;
}

/* ── Editable session row ── */
.sl-entry.editable .sl-range {
  cursor: pointer;
  transition: color 0.1s;
}
.sl-entry.editable:hover .sl-range { color: var(--text); }

.sl-del {
  position: absolute;
  right: -30px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  background: none;
  border: none;
  color: var(--red);
  font-family: var(--font);
  font-size: 15px;
  cursor: pointer;
  padding: 0 2px;
  transition: opacity 0.1s;
  line-height: 1;
}
.sl-entry:hover .sl-del { opacity: 1; }
.sl-del:hover { filter: brightness(1.3); }

/* ── Move session dropdown ── */
.sl-move {
  opacity: 0;
  color: var(--dimmer);
  font-size: 11px;
  cursor: pointer;
  transition: opacity 0.1s, color 0.15s;
}
.sl-entry:hover .sl-move { opacity: 1; }
.sl-move:hover { color: var(--accent); }

.sl-move-sep {
  opacity: 0;
  color: var(--dimmer);
  font-size: 11px;
  transition: opacity 0.1s;
}
.sl-entry:hover .sl-move-sep { opacity: 1; }

.sl-move-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
}

.sl-move-dropdown {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 0;
  min-width: 160px;
  max-width: 240px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.sl-move-option {
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sl-move-option:hover { background: var(--sel); }

@media all and (max-width: 500px) {
  .sl-entry {
    padding-block: 15px;
  }
  .sl-move, .sl-move-sep { opacity: 1; }
}

/* Inline time inputs */
.sl-time-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font);
  font-size: 13px;
  width: 90px;
  padding: 0;
  outline: none;
}
.sl-date-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font);
  font-size: 13px;
  width: 120px;
  padding: 0;
  margin-right: 4px;
  outline: none;
}
html[data-theme="dark"] .sl-time-input,
html[data-theme="dark"] .sl-date-input { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] .sl-time-input,
  html[data-theme="system"] .sl-date-input { color-scheme: dark; }
}
.sl-dash { color: var(--dim); }

/* ── Total ── */
.total-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 0 6px 10px;
  border-bottom: 2px solid var(--border);
  margin-top: 50px;
  cursor: pointer;
  user-select: none;
}

.total-label {
  flex: 1;
  font-size: 12px;
  color: var(--dimmer);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.total-time {
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

/* ── History ── */
#history:not(:empty) {
  margin-top: 40px;
}

.total-row:hover .total-expand { color: var(--dim); }
.total-expand:hover { background: var(--sel); color: var(--text) !important; }

.total-active-name {
  color: var(--text);
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
}

.total-time-running {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.week-total-row {
  border-bottom: 1px solid var(--border);
}

.week-total-row:hover .week-chevron { color: var(--dim); }
.week-chevron:hover { background: var(--sel); color: var(--text) !important; }

.day-row:first-child { border-top: none; }

.day-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0 8px 10px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.day-row:hover .day-chevron { color: var(--dim); }
.day-chevron:hover { background: var(--sel); color: var(--text) !important; }

.day-label { flex: 1; }

.day-name {
  font-size: 13px;
  color: var(--dimmer);
}

.day-date {
  font-size: 12px;
  color: var(--border);
  margin-left: 6px;
}

.day-row:hover .day-name { color: var(--dim); }
.day-row:hover .day-date { color: var(--dimmer); }

.day-total {
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--dimmer);
  font-variant-numeric: tabular-nums;
  min-width: 84px;
  text-align: right;
  flex-shrink: 0;
}

.day-tasks {
  padding: 2px 0 10px 10px;
}

.day-tasks .session-log {
  border-top: none;
  padding: 0 0 6px 0;
}

.day-tasks .sl-entry {
  padding-right: 42px; /* chevron(28px) + gap(14px) — aligns sl-dur with dt-time */
}

.day-task-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 3px 0 3px 0;
  font-size: 13px;
  color: var(--dimmer);
  cursor: pointer;
}
.day-task-row:hover .dt-name,
.day-task-row:hover .dt-time { color: var(--dim); }

.dt-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dt-tag {
  color: var(--dimmer);
}

.dt-time {
  min-width: 84px;
  text-align: right;
  flex-shrink: 0;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

.day-task-row:hover .dt-chevron { color: var(--dim); }
.dt-chevron:hover { background: var(--sel); color: var(--text) !important; }

.dt-del {
  position: absolute;
  right: 0;
  opacity: 0;
  background: none;
  border: none;
  color: var(--red);
  font-family: var(--font);
  font-size: 15px;
  cursor: pointer;
  margin-right: -24px;
  padding: 0 2px;
  transition: opacity 0.1s;
  line-height: 1;
}
.day-task-row:hover .dt-del { opacity: 1; }
.dt-del:hover { filter: brightness(1.3); }

/* ── Later list ── */
#later {
  margin-top: 40px;
}

#later-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 0 6px 10px;
  margin-bottom: 0;
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
  position: relative;
  min-height: 28px;
}

.later-label {
  flex: 1;
  font-size: 12px;
  color: var(--dimmer);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

#later-header:hover .later-chevron { color: var(--dim); }
.later-chevron:hover { background: var(--sel); color: var(--text) !important; }

#later-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 14px 0 14px 10px;
  caret-color: var(--accent);
  margin-bottom: 0;
  transition: border-color 0.15s;
}

#later-input:focus { border-bottom-color: var(--accent); }
#later-input.nav-highlight { background: var(--sel); box-shadow: inset 3px 0 0 var(--accent); }
#later-input::placeholder { color: var(--dimmer); }

#later-list { list-style: none; }

.later-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0 9px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  position: relative;
}

.later-drag {
  position: absolute;
  left: -44px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  text-align: center;
  font-size: 14px;
  color: var(--dimmer);
  cursor: grab;
  opacity: 0;
  transition: opacity 0.15s;
  user-select: none;
}
.later-item:hover .later-drag { opacity: 1; }
.later-item.later-dragging { opacity: 0.4; }
.later-item.later-drop-above { box-shadow: inset 0 2px 0 var(--accent); }
.later-item.later-drop-below { box-shadow: inset 0 -2px 0 var(--accent); }

.later-text {
  flex: 1;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.later-text a,
.t-name a,
.done-item-text a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.later-text a:hover,
.t-name a:hover,
.done-item-text a:hover {
  opacity: 0.7;
}

.later-promote,
.later-done,
.later-del {
  opacity: 0;
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
  line-height: 1;
  transition: opacity 0.1s;
}

.later-item:hover .later-promote,
.later-item:hover .later-done,
.later-item:hover .later-del { opacity: 1; }

.later-promote { color: var(--accent); }
.later-promote:hover { filter: brightness(1.2); }

.later-done { color: var(--green); }
.later-done:hover { filter: brightness(1.2); }

.later-del { color: var(--red); }
.later-del:hover { filter: brightness(1.3); }

#later-done-link {
  display: block;
  padding: 10px 0 10px 10px;
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
}
#later-done-link:hover { text-decoration: underline; }

/* ── Share footer ── */
.share-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 38px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.footer-inner {
  width: 100%;
  max-width: 760px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}
.footer-contact {
  font-family: var(--font);
  font-size: 12px;
  color: var(--dimmer);
}
.footer-contact a {
  color: var(--dimmer);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.footer-contact a:hover { color: var(--dim); }
.footer-share {
  display: flex;
  align-items: center;
  gap: 16px;
}
.share-label {
  font-family: var(--font);
  font-size: 11px;
  color: var(--dimmer);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.share-link {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  color: var(--dim);
  text-decoration: none;
  transition: color 0.1s;
}
.share-link:hover { color: var(--accent); }

/* ── Upgrade header button ── */
.header-upgrade { color: var(--accent) !important; }
.header-manage  { color: var(--green)  !important; }
.theme-bar {
  position: static;
  top: 10px;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 0 0 40px;
  z-index: 50;
  pointer-events: none;
}

.header-share-live,
.header-logout-btn,
.header-signin-btn {
  background: none;
  border: none;
  color: var(--dimmer);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  pointer-events: auto;
  transition: color 0.15s;
}
.header-share-live:hover,
.header-logout-btn:hover,
.header-signin-btn:hover { color: var(--dim); }

.theme-bar-sep {
  color: var(--dimmer);
  pointer-events: auto;
}

.share-popover {
  position: relative;
  float: right;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: -32px;
  margin-bottom: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  z-index: 60;
  max-width: 340px;
  width: fit-content;
  margin-left: auto;
}

.share-popover-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.share-popover-label {
  font-size: 13px;
  color: var(--text);
}

.share-popover-toggle {
  background: var(--accent);
  color: #fff;
  border: none;
  font-family: var(--font);
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: filter 0.15s;
}
.share-popover-toggle:hover { filter: brightness(1.1); }
.share-popover-toggle.active {
  background: var(--red);
}

.share-popover-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.share-popover-url {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  padding: 5px 8px;
  outline: none;
  min-width: 0;
}

.share-popover-copy {
  background: var(--sel);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.share-popover-copy:hover { background: var(--border); }

.header-theme {
  background: none;
  border: none;
  color: var(--dimmer);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  transition: color 0.15s;
  pointer-events: auto;
}

.header-theme:hover { color: var(--dim); }
.header-theme svg { width: 16px; height: 16px; }

.theme-bar-sub {
  pointer-events: auto;
  justify-content: space-between;
}
.theme-bar-sub .done-back {
  pointer-events: auto;
}

.theme-system {
  display: flex;
  align-items: center;
  gap: 2px;
}

.theme-os-label {
  font-family: var(--font);
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1;
}

.header-vip {
  color: #b8860b;
  font-family: var(--font);
  font-size: 13px;
  cursor: default;
  user-select: none;
}

/* ── Billing success banner ── */
#billing-success-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: var(--green);
  color: #fff;
  font-size: 13px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 400;
}

#billing-success-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.8;
}

#billing-success-close:hover { opacity: 1; }

/* ── Upgrade modal ── */
#upgrade-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

.upgrade-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.upgrade-box {
  position: relative;
  background: var(--surface);
  padding: 32px;
  max-width: 340px;
  width: 90%;
  text-align: center;
  z-index: 1;
}

.upgrade-message {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 8px;
}

.upgrade-sub {
  font-size: 13px;
  color: var(--dim);
  margin-bottom: 24px;
}

.upgrade-cta {
  background: var(--accent);
  color: var(--surface);
  border: none;
  font-family: var(--font);
  font-size: 14px;
  padding: 10px 24px;
  cursor: pointer;
  width: 100%;
  transition: filter 0.15s;
  margin-bottom: 12px;
}

.upgrade-cta:hover { filter: brightness(1.1); }

.upgrade-dismiss {
  background: none;
  border: none;
  color: var(--dimmer);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.upgrade-dismiss:hover { color: var(--dim); }

/* ── About modal ── */
#about-modal {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  padding-top: 60px;
  z-index: 300;
}

.about-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.about-box {
  position: relative;
  background: var(--surface);
  padding: 32px;
  max-width: 480px;
  width: 90%;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  z-index: 1;
}

.about-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--dimmer);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.15s;
}

.about-close:hover { color: var(--text); }

.about-logo {
  color: var(--red);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.about-tagline {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 24px;
}

.about-body {
  font-size: 13px;
  color: var(--dim);
  line-height: 1.6;
}

.about-body p { margin-bottom: 14px; }

.about-body code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

.about-section-label {
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px !important;
}

.about-body ul {
  list-style: none;
  margin-bottom: 14px;
  padding-left: 0;
}

.about-body li {
  padding: 2px 0 2px 14px;
  position: relative;
}

.about-body li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: var(--dimmer);
}

.about-inspiration {
  font-size: 12px;
  color: var(--dimmer);
  font-style: italic;
}

.about-inspiration a {
  color: var(--dimmer);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.about-inspiration a:hover { color: var(--dim); }

/* ── Done page ── */
.done-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 80px;
  font-family: var(--font);
}

.done-back {
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
}
.done-back:hover { text-decoration: underline; }

.done-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 24px;
}

.done-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 28px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.done-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 80px;
}

.done-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.done-stat-label {
  font-size: 12px;
  color: var(--dimmer);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
}

.done-stat-sub {
  display: block;
  font-size: 10px;
  color: var(--dimmer);
  text-transform: none;
  letter-spacing: 0;
}

.done-stat-spark {
  justify-content: center;
  min-width: auto;
}

.done-sparkline {
  display: block;
}

.done-list {
  list-style: none;
}

.done-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.done-item-check {
  color: var(--green);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.done-item-text {
  flex: 1;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.done-item-date {
  font-size: 12px;
  color: var(--dimmer);
  flex-shrink: 0;
}

.done-loading {
  text-align: center;
  padding: 20px 0;
  font-size: 13px;
  color: var(--dimmer);
}

.done-empty {
  text-align: center;
  padding: 40px 0;
  font-size: 14px;
  color: var(--dimmer);
}

.report-link {
  display: block;
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  padding: 10px 0 10px 10px;
  margin: 0;
}
.report-link:hover { text-decoration: underline; }

/* ── Report page ── */
.report-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px;
}

.report-header {
  display: flex;
  align-items: center;
  gap: 12px;
}


.report-period {
  font-size: 14px;
  color: var(--dimmer);
  margin-bottom: 8px;
}

.report-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.report-total-label {
  font-size: 14px;
  color: var(--dimmer);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.report-total-time {
  font-size: 28px;
  font-weight: 700;
  color: var(--fg);
}

.report-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.report-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
  gap: 12px;
}

.report-task-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.report-task-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-task-meta {
  font-size: 11px;
  color: var(--dimmer);
}

.report-bar-wrap {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.report-bar {
  height: 100%;
  border-radius: 4px;
  min-width: 4px;
}

.report-task-time {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  min-width: 60px;
  text-align: right;
}

/* ── Shared view ───────────────────────────────────────────────────────────── */

.shared-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

.shared-cta-link {
  color: #fff;
  font-weight: 700;
  text-decoration: underline;
}

.shared-view .search-row,
.shared-view #search-create-hint,
.shared-view #later-input,
.shared-view #later-header,
.shared-view .search-hint,
.shared-view #project-autocomplete,
.shared-view #header-logout,
.shared-view #header-signin,
.shared-view #header-upgrade,
.shared-view #header-manage,
.shared-view .header-share-live,
.shared-view .share-popover,
.shared-view .header-logout-btn,
.shared-view .header-signin-btn,
.shared-view #header-share,
.shared-view #header-vip,
.shared-view #header-pomodoro,
.shared-view #header-pomodoro-mins,
.shared-view #guest-banner,
.shared-view .task-del,
.shared-view .sl-del,
.shared-view .dtd-del,
.shared-view .later-del,
.shared-view .later-done,
.shared-view .later-promote,
.shared-view .header-about,
.shared-view #billing-success-banner,
.shared-view .share-footer {
  display: none !important;
}
