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

:root {
  --bg:       #f8f5f2;
  --surface:  #fffffe;
  --border:   #ccc7c2;
  --text:     #232323;
  --dim:      #6e6e6e;
  --dimmer:   #9c9690;
  --font:     'IBM Plex Mono', monospace;
  --accent:   #0a9e9e;
  --green:    #0a9e9e;
  --red:      #f45d48;
  --sel:      #eeeae6;
}

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: 56px 24px 118px;
}

/* ── Auth Screen ── */
#auth-screen {
  width: 100%;
  max-width: 400px;
}

.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 {
  width: 100%;
  max-width: 760px;
}

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

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

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

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

.hd-running {
  margin-left: auto;
  font-size: 13px;
  color: var(--green);
  opacity: 0;
  transition: opacity 0.2s;
}

.hd-running.visible { opacity: 1; }

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

.hd-pomodoro.active { opacity: 1; }
.hd-pomodoro:hover { opacity: 0.7; }
.hd-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); }
}

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

.hd-pomodoro-mins {
  width: 30px;
  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;
  pointer-events: none;
  transition: opacity 0.15s;
  -moz-appearance: textfield;
}

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

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

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

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

/* ── Search bar ── */
.search-row {
  position: relative;
  display: flex;
  align-items: center;
  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 {
  color: var(--accent);
  font-weight: 700;
  font-size: 22px;
  flex-shrink: 0;
  padding-bottom: 10px;
  padding-top: 8px;
  user-select: none;
  pointer-events: none;
}

#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);
  margin-bottom: 28px;
  padding-top: 6px;
}

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

.search-hint kbd {
  font-family: var(--font);
  font-size: 12px;
  color: var(--dim);
  border: 1px solid var(--border);
  padding: 0 4px;
  line-height: 1.4;
}

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

.create-hint {
  font-size: 15px;
  color: var(--dim);
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.create-hint em {
  font-style: normal;
  color: var(--accent);
}

.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);
}

.task-row:last-child { border-bottom-width: 2px; }

.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 {
  display: flex;
  align-items: center;
  padding: 13px 0;
  gap: 14px;
  cursor: pointer;
  user-select: none;
}

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

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

.task-row.running .t-dot { visibility: visible; }

@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;
}

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

.t-time {
  font-size: 15px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  min-width: 84px;
  text-align: right;
  flex-shrink: 0;
}

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

.t-expand {
  font-size: 10px;
  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;
}

.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;
  transition: opacity 0.1s;
  line-height: 1;
}

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

/* ── Session log ── */
.session-log {
  display: none;
  padding: 0 0 14px 20px;
  border-top: 1px solid var(--border);
}

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

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

.sl-entry {
  position: relative;
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--dim);
  padding: 3px 60px 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: 0;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  background: none;
  border: none;
  color: var(--red);
  font-family: var(--font);
  font-size: 11px;
  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); }

/* 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-dash { color: var(--dim); }

/* ── Total ── */
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 60px 6px 22px;
}

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

.total-time {
  font-size: 13px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

/* ── History ── */
#history {
  margin-top: 40px;
}

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

.week-total-row { border-top: 2px solid var(--border); }

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

.day-chevron {
  font-size: 9px;
  color: var(--border);
  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;
}

.day-row:hover .day-chevron { color: var(--dimmer); }
.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;
  color: var(--dimmer);
  font-variant-numeric: tabular-nums;
  min-width: 84px;
  text-align: right;
  flex-shrink: 0;
}

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

.day-task-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 3px 10px 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-time {
  min-width: 84px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  margin-right: 42px; /* mirrors gap(14px) + chevron(28px) — aligns with day-total */
}

.dt-del {
  position: absolute;
  right: 0; /* sits just outside the table boundary */
  opacity: 0;
  background: none;
  border: none;
  color: var(--red);
  font-family: var(--font);
  font-size: 11px;
  cursor: pointer;
  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); }

/* ── 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;
  gap: 24px;
  z-index: 100;
}
.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); }
