/* Zeitwerk web app — Clockify colors, iPhone first, light and dark. */

:root {
  --accent: #03a9f4;
  /* Buttons and active chips: text on them stays above 4.5:1 contrast. */
  --accent-strong: #0277bd;
  --on-accent: #ffffff;
  --header: #0277bd;
  --on-header: #ffffff;
  --stop: #f44336;
  --bg: #eeeeee;
  --card: #ffffff;
  --card-pressed: #f3f3f3;
  --text: #1f1f1f;
  --text-2: #6f6f6f;
  --text-3: #9b9b9b;
  --border: rgba(0, 0, 0, 0.08);
  --control: #ececec;
  --success: #558b2f;
  --error: #d32f2f;
  --warning: #ef6c00;
  --link: #0277bd;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  /* Aufgabenwerk (Todoist's colors): accent, priorities, due dates. */
  --todo: #dc4c3e;
  --todo-strong: #c3392c;
  --on-todo: #ffffff;
  --p1: #d1453b;
  --p2: #eb8909;
  --p3: #246fe0;
  --p4: #808080;
  --due-overdue: #d1453b;
  --due-today: #058527;
  --due-tomorrow: #ad6200;
  --due-week: #692fc2;
  --due-later: #808080;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #29b6f6;
    --accent-strong: #29b6f6;
    --on-accent: #06263a;
    --header: #1a1a1a;
    --bg: #121212;
    --card: #232323;
    --card-pressed: #2c2c2c;
    --text: #f2f2f2;
    --text-2: #a8a8a8;
    --text-3: #7c7c7c;
    --border: rgba(255, 255, 255, 0.09);
    --control: #333333;
    --success: #9ccc65;
    --error: #ef5350;
    --warning: #ffa726;
    --link: #4fc3f7;
    --shadow: none;
    --todo: #ff7066;
    --todo-strong: #ff7066;
    --on-todo: #2b0b07;
    --p1: #ff7066;
    --p2: #ff9a14;
    --p3: #5297ff;
    --p4: #8a8a8a;
    --due-overdue: #ff7066;
    --due-today: #25b84c;
    --due-tomorrow: #ff9a14;
    --due-week: #a970ff;
    --due-later: #a3a3a3;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  -webkit-user-select: none;
  user-select: none;
}

button:disabled {
  cursor: default;
  opacity: 0.45;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.icon {
  flex: none;
  display: block;
}

.muted {
  color: var(--text-2);
}

.small {
  font-size: 13px;
}

.center {
  text-align: center;
}

.block {
  display: block;
}

.pad {
  padding: 16px;
}

.spacer {
  flex: 1;
}

.boot {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-2);
}

/* ---- Buttons ------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  background: var(--control);
  font-weight: 600;
}

.button:active:not(:disabled) {
  filter: brightness(0.94);
}

.button.primary {
  background: var(--accent-strong);
  color: var(--on-accent);
}

.button.subtle {
  background: transparent;
  color: var(--link);
}

.button.danger {
  color: var(--error);
}

.button.danger-fill {
  background: var(--stop);
  color: #fff;
}

.button.wide {
  width: 100%;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: 22px;
}

.icon-button.small {
  min-width: 32px;
  min-height: 32px;
}

/* ---- Sign-in ------------------------------------------------------------- */

.login {
  max-width: 400px;
  margin: 0 auto;
  padding: calc(48px + var(--safe-top)) 24px calc(32px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.login-logo {
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.login h1 {
  margin: 16px 0 4px;
  font-size: 28px;
}

.login-form {
  width: 100%;
  margin: 24px 0 16px;
  padding: 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-form label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-top: 6px;
}

.login-form input {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font-size: 16px;
}

.login-form .button {
  margin-top: 14px;
}

.form-error {
  margin: 8px 0 0;
  color: var(--error);
  font-size: 14px;
}

/* ---- Top bar + timer card ----------------------------------------------- */

.top {
  z-index: 20;
}

.top.sticky {
  position: sticky;
  top: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: calc(52px + var(--safe-top));
  padding: var(--safe-top) calc(6px + var(--safe-right)) 0 calc(10px + var(--safe-left));
  background: var(--header);
  color: var(--on-header);
}

.ws-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 6px;
  font-size: 17px;
  font-weight: 600;
  max-width: 60%;
}

.ws-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 13px;
  font-weight: 600;
}

.sync-pill.offline {
  background: #ffb74d;
  color: #3e2723;
}

.timer-card {
  position: relative;
  margin: 0;
  padding: 10px calc(12px + var(--safe-right)) 12px calc(12px + var(--safe-left));
  background: var(--card);
  box-shadow: 0 1px 0 var(--border), 0 4px 12px rgba(0, 0, 0, 0.05);
}

.mode-switch {
  display: flex;
  gap: 4px;
  padding: 3px;
  margin-bottom: 8px;
  border-radius: 9px;
  background: var(--control);
}

.mode-switch button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}

.mode-switch button.active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

@media (prefers-color-scheme: dark) {
  .mode-switch button.active {
    background: #5a5a5a;
  }
}

.tab-time {
  font-variant-numeric: tabular-nums;
  color: var(--stop);
}

.desc-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.desc-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.desc-input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font-size: 17px;
}

.desc-input::placeholder,
.editor-desc::placeholder {
  color: var(--text-3);
}

.desc-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--card);
}

.suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: min(50vh, 380px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.suggestion {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  min-height: 52px;
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.suggestion:last-child {
  border-bottom: 0;
}

.suggestion.highlight,
.suggestion:active {
  background: var(--card-pressed);
}

.suggestion-desc {
  font-weight: 600;
}

.suggestion .project-line {
  font-size: 13px;
}

.chip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  min-width: 0;
}

.chip {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  min-width: 40px;
  max-width: 55%;
  padding: 0 10px;
  border-radius: 20px;
  background: var(--control);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
}

.chip.set {
  color: var(--text);
}

.chip-icon {
  flex: none;
  justify-content: center;
  padding: 0;
}

.chip-icon.set {
  background: var(--accent-strong);
  color: var(--on-accent);
}

.chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.elapsed {
  flex: none;
  min-height: 44px;
  padding: 0 4px;
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}

.elapsed:disabled {
  opacity: 1;
}

.elapsed.running {
  color: var(--text);
}

.start-button {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 26px;
  background: var(--accent);
  color: #0b3b5c;
  box-shadow: 0 2px 6px rgba(3, 169, 244, 0.35);
  transition: transform 0.08s ease;
}

.start-button:active {
  transform: scale(0.94);
}

.start-button.stop {
  background: var(--stop);
  color: #fff;
  box-shadow: 0 2px 6px rgba(244, 67, 54, 0.35);
}

.manual {
  margin-top: 10px;
}

.manual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.field > span:first-child {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.field input {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}

.manual-duration {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---- List ---------------------------------------------------------------- */

.list {
  padding: 12px calc(12px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(12px + var(--safe-left));
  max-width: 720px;
  margin: 0 auto;
}

.summary {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.summary > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.summary .muted {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.summary strong {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 6px 10px 12px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 14%, var(--card));
  font-size: 14px;
}

.hint p {
  margin: 0;
  flex: 1;
}

.hint .icon {
  display: inline-block;
  vertical-align: -3px;
}

.day {
  margin-bottom: 16px;
}

.day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 4px 6px;
}

.day-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
}

.day-total {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.empty-day {
  padding: 14px;
  font-size: 14px;
}

.entry {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  padding: 10px 4px 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.entry:last-child {
  border-bottom: 0;
}

.entry:active {
  background: var(--card-pressed);
}

.entry-main {
  flex: 1;
  min-width: 0;
}

.entry-desc {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.entry-desc .icon {
  color: var(--text-3);
}

.unsynced {
  color: var(--warning);
  display: inline-flex;
}

.unsynced .icon {
  color: var(--warning);
}

.entry-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 2px;
  font-size: 13px;
  min-width: 0;
}

.project-line {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.project-name {
  flex: 0 1 auto;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Task and client give way first, so the project name stays readable. */
.project-line > .muted {
  flex: 0 100 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: var(--text-3);
}

.tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag-pill {
  padding: 1px 7px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--link);
  font-size: 12px;
  font-weight: 600;
}

.entry-side {
  flex: none;
  text-align: right;
}

.entry-duration {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.entry-range {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.billable {
  color: var(--accent-strong);
  font-weight: 700;
}

.entry-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  color: var(--text-3);
}

.entry-play:active {
  background: var(--control);
  color: var(--accent-strong);
}

.empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-2);
}

/* ---- Sheets -------------------------------------------------------------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.25s ease;
}

.sheet-backdrop.open {
  background: rgba(0, 0, 0, 0.35);
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: calc(100% - var(--safe-top) - 16px);
  display: flex;
  flex-direction: column;
  max-width: 640px;
  margin: 0 auto;
  background: var(--bg);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.2);
  transform: translateY(100%);
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sheet.tall {
  height: calc(100% - var(--safe-top) - 16px);
}

.sheet.open {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .sheet,
  .sheet-backdrop {
    transition: none;
  }
}

.sheet-grabber {
  width: 36px;
  height: 5px;
  margin: 6px auto 0;
  border-radius: 3px;
  background: var(--text-3);
  opacity: 0.5;
}

.sheet-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 2px 6px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
}

.sheet-btn {
  min-height: 44px;
  padding: 0 10px;
  color: var(--link);
  font-size: 17px;
}

.sheet-btn.left {
  justify-self: start;
}

.sheet-btn.right {
  justify-self: end;
}

.primary-text {
  font-weight: 600;
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 6px calc(12px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(12px + var(--safe-left));
}

.search {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 0 12px;
  min-height: 40px;
  border-radius: 10px;
  background: var(--control);
  color: var(--text-2);
}

.search input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  outline: none;
}

.picker-list,
.form-group {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
}

.form-group.padded {
  padding: 12px 14px 14px;
}

.form-group.padded p {
  margin: 4px 0 12px;
}

.form-group.padded .icon {
  display: inline-block;
  vertical-align: -3px;
}

.group-title {
  padding: 10px 14px 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
}

.form-group.padded .group-title {
  padding: 0 0 2px;
}

.picker-group {
  padding: 12px 14px 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
}

.picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 8px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.picker-row:last-child {
  border-bottom: 0;
}

.picker-row:active {
  background: var(--card-pressed);
}

.picker-row.indent {
  padding-left: 32px;
  color: var(--text-2);
}

.picker-row.active {
  color: var(--link);
}

.picker-row.active .icon-check {
  color: var(--link);
}

.picker-row.create {
  color: var(--link);
  font-weight: 600;
}

.picker-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--text-3);
}

.checkbox.on {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: var(--on-accent);
}

.form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 6px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.form-row:last-child {
  border-bottom: 0;
}

.form-row.link:active:not(:disabled) {
  background: var(--card-pressed);
}

.form-row .icon-chevron {
  color: var(--text-3);
}

.form-label {
  flex: none;
  min-width: 92px;
  color: var(--text);
}

.form-value {
  flex: 1;
  min-width: 0;
  text-align: right;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-value .project-line {
  justify-content: flex-end;
}

.form-row input[type='date'],
.form-row input[type='time'],
.form-row input[type='text'] {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  border: 0;
  background: transparent;
  text-align: right;
  font-size: 16px;
  color: var(--link);
  -webkit-appearance: none;
  appearance: none;
}

.form-row input::-webkit-date-and-time-value {
  text-align: right;
}

@media (prefers-color-scheme: dark) {
  .form-row input::-webkit-calendar-picker-indicator {
    filter: invert(1);
  }
}

.form-row input[type='checkbox'][role='switch'] {
  margin-left: auto;
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  width: 51px;
  height: 31px;
  border-radius: 16px;
  background: var(--control);
  transition: background 0.2s ease;
  cursor: pointer;
}

.form-row input[type='checkbox'][role='switch']::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.form-row input[type='checkbox'][role='switch']:checked {
  background: #34c759;
}

.form-row input[type='checkbox'][role='switch']:checked::after {
  transform: translateX(20px);
}

.editor-desc {
  display: block;
  width: 100%;
  min-height: 76px;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  font-size: 17px;
  resize: none;
  outline: none;
}

.editor-actions {
  display: flex;
  gap: 10px;
}

.editor-actions .button {
  flex: 1;
  background: var(--card);
}

.editor-actions .button.danger-fill {
  background: var(--stop);
}

.done-task {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0 !important;
}

.done-task .icon {
  color: var(--success);
}

.done-task span:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--warning) 18%, var(--card));
  font-size: 14px;
}

.banner.subtle {
  background: var(--card);
  color: var(--text-2);
}

/* ---- Toast --------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(16px + var(--safe-bottom));
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 520px;
  margin: 0 auto;
  min-height: 48px;
  padding: 10px 8px 10px 16px;
  border-radius: 12px;
  background: #323232;
  color: #fff;
  font-size: 15px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
  animation: toast-in 0.2s ease;
}

.toast span {
  flex: 1;
}

.toast.error {
  background: #b71c1c;
}

.toast-action {
  min-height: 36px;
  padding: 0 10px;
  color: #81d4fa;
  font-weight: 700;
}

@keyframes toast-in {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
}

/* ---- Tab bar ("Zeit | Aufgaben") --------------------------------------------- */

.with-tabs .list {
  padding-bottom: calc(100px + var(--safe-bottom));
}

.with-tabs .toast {
  bottom: calc(70px + var(--safe-bottom));
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}

.tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 54px;
  padding-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
}

.tabbar button[data-tab='time'].active {
  color: var(--accent-strong);
}

.tabbar button[data-tab='tasks'].active {
  color: var(--todo-strong);
}

.tab-icon {
  position: relative;
  display: inline-flex;
}

.tab-badge {
  position: absolute;
  top: -4px;
  left: 16px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--todo-strong);
  color: var(--on-todo);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.tab-label.running {
  color: var(--stop);
  font-variant-numeric: tabular-nums;
}

/* ---- Tasks ------------------------------------------------------------------ */

.tasks-head {
  padding: 8px calc(12px + var(--safe-right)) 8px calc(12px + var(--safe-left));
  background: var(--card);
  box-shadow: 0 1px 0 var(--border), 0 4px 12px rgba(0, 0, 0, 0.05);
}

.tasks-nav {
  margin: 0 auto;
  max-width: 696px;
}

/* Four views side by side: on a phone the words are enough. */
@media (max-width: 430px) {
  .tasks-nav .icon {
    display: none;
  }

  .tasks-nav button {
    gap: 4px;
  }
}

.nav-count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}

.tasks-nav button.active .nav-count {
  color: var(--todo-strong);
}

.tasks-title {
  padding: 2px 4px 12px;
}

.tasks-title h1 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
}

.tasks-title h1 > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tasks-title p {
  margin: 2px 0 0;
  font-size: 14px;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 36px;
  margin-left: -6px;
  padding-right: 8px;
  color: var(--link);
  font-size: 16px;
}

.hash {
  display: inline-flex;
  flex: none;
  color: var(--text-3);
}

.task-group {
  margin-top: 4px;
}

.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 10px 4px 4px;
}

.group-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.group-count {
  font-weight: 500;
}

/* "Alle": the place of a group opens it. */
.group-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 36px;
  font-size: 15px;
  font-weight: 700;
}

.group-link .place-label {
  color: var(--text);
}

.group-link .icon-chevron {
  flex: none;
  color: var(--text-3);
}

.link-button {
  min-height: 36px;
  padding: 0 4px;
  color: var(--todo-strong);
  font-size: 15px;
  font-weight: 600;
}

.add-in-section {
  color: var(--text-3);
}

.tasks-list > .card,
.task-group > .card {
  margin-bottom: 8px;
}

.tasks-empty {
  padding: 40px 24px;
  text-align: center;
}

.tasks-empty .icon {
  margin: 0 auto;
  color: var(--todo);
  opacity: 0.85;
}

.tasks-empty h2 {
  margin: 12px 0 4px;
  font-size: 18px;
}

.tasks-empty p {
  margin: 0;
  font-size: 14px;
}

.project-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 8px 8px 8px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.project-row:last-child {
  border-bottom: 0;
}

.project-row:active {
  background: var(--card-pressed);
}

.project-row.indent {
  padding-left: 40px;
}

.project-row .icon-chevron {
  color: var(--text-3);
}

.row-count {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.subprojects {
  margin-bottom: 12px;
}

/* A task row: round checkbox in the priority color, name, details, place. */
.task {
  display: flex;
  align-items: flex-start;
  min-height: 52px;
  padding: 2px 6px 8px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: opacity 0.25s ease;
}

.task:last-child {
  border-bottom: 0;
}

.task:active {
  background: var(--card-pressed);
}

.task.depth-1 {
  padding-left: 26px;
}

.task.depth-2 {
  padding-left: 52px;
}

.task.depth-3,
.task.depth-4 {
  padding-left: 78px;
}

.check {
  --prio: var(--p4);
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin: 10px 10px 0 12px;
  border-radius: 50%;
  border: 1px solid var(--prio);
  color: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

/* 44 pt hit area around the small circle. */
.check::after {
  content: '';
  position: absolute;
  inset: -11px;
}

.check.p1 {
  --prio: var(--p1);
}

.check.p2 {
  --prio: var(--p2);
}

.check.p3 {
  --prio: var(--p3);
}

.check.p1,
.check.p2,
.check.p3 {
  border-width: 2px;
  background: color-mix(in srgb, var(--prio) 12%, transparent);
}

.check:active,
.check:hover {
  color: var(--prio);
}

.check.on,
.task.completing .check {
  background: var(--prio);
  color: #fff;
}

.task.completing {
  opacity: 0.55;
}

.task.completing .task-content {
  text-decoration: line-through;
}

.task-main {
  flex: 1;
  min-width: 0;
  padding-top: 9px;
}

.task-content {
  font-size: 16px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.task-desc {
  margin-top: 1px;
  font-size: 13px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 10px;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-3);
}

.task-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.task-meta .spacer {
  flex: 1 1 0;
}

.due,
.deadline,
.label-chip,
.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.due {
  color: var(--due-later);
}

.due.overdue,
.deadline.overdue {
  color: var(--due-overdue);
}

.due.today {
  color: var(--due-today);
}

.due.tomorrow {
  color: var(--due-tomorrow);
}

.due.week,
.deadline {
  color: var(--due-week);
}

.due.none {
  color: var(--text-3);
}

.label-chip {
  color: var(--text-2);
}

.place-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  min-width: 0;
  color: var(--text-3);
}

.place-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.task-meta .place-label {
  max-width: 60%;
}

.task-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 40px;
  color: var(--text-3);
}

.task-toggle.collapsed .icon {
  transform: rotate(-90deg);
}

.fab {
  position: fixed;
  right: calc(18px + var(--safe-right));
  bottom: calc(72px + var(--safe-bottom));
  z-index: 35;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: var(--todo-strong);
  color: var(--on-todo);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}

.fab:active {
  transform: scale(0.94);
}

/* Make room for the "Rückgängig" toast. */
body:has(.toast) .fab {
  transform: translateY(-60px);
}

/* ---- Task editor ------------------------------------------------------------ */

.task-head {
  display: flex;
  align-items: flex-start;
}

.task-head .check {
  margin-top: 14px;
}

.task-head-fields {
  flex: 1;
  min-width: 0;
}

.editor-desc.task-title-input {
  min-height: 0;
  padding: 12px 14px 4px 0;
  font-weight: 600;
  overflow: hidden;
}

.editor-desc.task-notes {
  min-height: 0;
  padding: 2px 14px 12px 0;
  font-size: 15px;
  color: var(--text-2);
  overflow: hidden;
}

.prio-picker {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.prio-button {
  --prio: var(--p4);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 36px;
  padding: 0 7px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--prio);
}

.prio-button.p1 {
  --prio: var(--p1);
}

.prio-button.p2 {
  --prio: var(--p2);
}

.prio-button.p3 {
  --prio: var(--p3);
}

.prio-button.p4 {
  color: var(--text-2);
}

.prio-button.active {
  background: color-mix(in srgb, var(--prio) 18%, transparent);
  box-shadow: inset 0 0 0 1.5px var(--prio);
}

.form-row .icon-button.small {
  flex: none;
  color: var(--text-3);
}

.form-value .due,
.form-value .place-label {
  justify-content: flex-end;
}

.subtasks .subtask {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.subtask .check {
  margin: 10px 12px 10px 2px;
}

.subtask-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.subtask.done .subtask-text {
  text-decoration: line-through;
  color: var(--text-3);
}

.subtask-input {
  width: 100%;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 16px;
  outline: none;
}

.subtask-input::placeholder,
.qa-input::placeholder,
.qa-description::placeholder,
.date-text::placeholder {
  color: var(--text-3);
}

.pad-x {
  padding: 0 14px;
}

.date-entry {
  padding: 4px 14px 10px;
}

.date-text {
  width: 100%;
  min-height: 44px;
  border: 0;
  background: transparent;
  font-size: 17px;
  outline: none;
}

.date-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.quick-date .due {
  display: inline-flex;
}

/* ---- Quick Add ---------------------------------------------------------------- */

.qa-box {
  margin-bottom: 10px;
}

.qa-field {
  position: relative;
}

/* The mirror paints the recognized parts behind the (transparent) textarea, in exactly the same text layout. */
.qa-input,
.qa-mirror {
  display: block;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 0;
  font-family: inherit;
  font-size: 17px;
  line-height: 1.4;
  letter-spacing: normal;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
}

.qa-mirror {
  position: absolute;
  inset: 0;
  color: transparent;
  pointer-events: none;
  overflow: hidden;
}

.qa-input {
  position: relative;
  min-height: 48px;
  background: transparent;
  resize: none;
  outline: none;
  overflow: hidden;
}

.qa-token {
  color: transparent;
  border-radius: 4px;
  background: color-mix(in srgb, var(--todo) 20%, transparent);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.qa-token.date {
  background: color-mix(in srgb, var(--due-today) 22%, transparent);
}

/* A client/project found without "#": tinted and underlined, the words stay in the name. */
.qa-token.auto {
  background: color-mix(in srgb, var(--p3) 16%, transparent);
  text-decoration: underline dotted var(--p3);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.qa-chip.qa-place.auto {
  box-shadow: inset 0 0 0 1.5px var(--p3);
}

.qa-auto {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 12px;
  padding: 6px 6px 6px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--p3) 12%, var(--card));
  font-size: 14px;
}

.qa-auto-text {
  flex: 1;
  min-width: 0;
}

.qa-auto-text .place-label {
  display: inline-flex;
  vertical-align: bottom;
  color: var(--text);
  font-weight: 600;
}

.qa-auto-off {
  flex: none;
  font-size: 14px;
}

.qa-description {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
  font-size: 15px;
  outline: none;
}

.qa-suggest {
  border-top: 1px solid var(--border);
}

.qa-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.qa-chips .chip {
  max-width: 100%;
  background: var(--card);
}

.qa-chip.due.overdue {
  color: var(--due-overdue);
}

.qa-chip.due.today {
  color: var(--due-today);
}

.qa-chip.due.tomorrow {
  color: var(--due-tomorrow);
}

.qa-chip.due.week {
  color: var(--due-week);
}

.qa-chip.prio.p1.set {
  color: var(--p1);
}

.qa-chip.prio.p2.set {
  color: var(--p2);
}

.qa-chip.prio.p3.set {
  color: var(--p3);
}

.button.qa-submit {
  width: 100%;
  background: var(--todo-strong);
  color: var(--on-todo);
}

.qa-confirm {
  min-height: 18px;
  margin: 10px 4px 0;
}

.qa-help {
  margin: 6px 4px 0;
}

/* Wider screens (iPad, desktop browser): keep the card readable. */
@media (min-width: 720px) {
  .timer-card {
    padding-left: max(12px, calc((100% - 696px) / 2));
    padding-right: max(12px, calc((100% - 696px) / 2));
  }
}
