/* Tâche — app employé D.Majin */
:root {
  --tt-bg: #0f1419;
  --tt-surface: #1a222c;
  --tt-border: rgba(255, 255, 255, 0.08);
  --tt-text: #f0f4f8;
  --tt-muted: rgba(240, 244, 248, 0.62);
  --tt-accent: #3b82f6;
  --tt-accent-glow: rgba(59, 130, 246, 0.35);
  --tt-success: #22c55e;
  --tt-danger: #ef4444;
  --tt-warn: #f59e0b;
  --tt-radius: 16px;
  --tt-font: 'DM Sans', system-ui, sans-serif;
}

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

body.tt-app {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--tt-font);
  background: var(--tt-bg);
  color: var(--tt-text);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.tt-header {
  padding: max(1.25rem, env(safe-area-inset-top)) 1.25rem 1rem;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.12), transparent);
  border-bottom: 1px solid var(--tt-border);
}

.tt-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.tt-brand-icon {
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--tt-accent);
  box-shadow: 0 0 24px var(--tt-accent-glow);
  font-weight: 700;
  font-size: 1.25rem;
}

.tt-brand-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tt-muted);
}

.tt-brand-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.tt-header-sub {
  margin: 0.65rem 0 0;
  font-size: 0.88rem;
  color: var(--tt-muted);
}

.tt-main {
  max-width: 520px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
}

.tt-card {
  background: var(--tt-surface);
  border: 1px solid var(--tt-border);
  border-radius: var(--tt-radius);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
}

.tt-card-title {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  font-weight: 600;
}

.tt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tt-chip {
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--tt-border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--tt-text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.tt-chip.is-selected {
  border-color: var(--tt-accent);
  background: rgba(59, 130, 246, 0.15);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.3);
}

.tt-list-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--tt-border);
  background: rgba(0, 0, 0, 0.2);
  color: var(--tt-text);
  font: inherit;
  cursor: pointer;
}

.tt-list-item.is-selected {
  border-color: var(--tt-accent);
  background: rgba(59, 130, 246, 0.1);
}

.tt-list-item strong { display: block; margin-bottom: 0.2rem; }
.tt-list-item small { color: var(--tt-muted); font-size: 0.82rem; }

.tt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  border: none;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}

.tt-btn:active { transform: scale(0.98); }
.tt-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.tt-btn-primary {
  background: var(--tt-accent);
  color: #fff;
  box-shadow: 0 8px 24px var(--tt-accent-glow);
}

.tt-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--tt-text);
  border: 1px solid var(--tt-border);
}

.tt-btn-block { width: 100%; }

.tt-session-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding: 1rem 1.15rem;
  background: var(--tt-surface);
  border-radius: var(--tt-radius);
  border: 1px solid var(--tt-border);
}

.tt-session-meta { margin: 0; font-size: 0.82rem; color: var(--tt-muted); }
.tt-session-sheet {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--tt-muted);
  line-height: 1.45;
}

.tt-custom-name { margin-top: 0.85rem; }

.tt-custom-label {
  display: block;
  font-size: 0.78rem;
  color: var(--tt-muted);
  margin-bottom: 0.35rem;
}

.tt-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--tt-border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--tt-text);
  font: inherit;
  font-size: 0.95rem;
}

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

.tt-chip-other { border-style: dashed; }

.tt-task.is-priority {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.06);
}

.tt-priority-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tt-warn);
  margin-bottom: 0.2rem;
}

.tt-btn-check {
  background: rgba(34, 197, 94, 0.15);
  color: var(--tt-success);
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.tt-task-hint {
  display: block;
  color: var(--tt-muted) !important;
  font-size: 0.75rem !important;
  margin-top: 0.25rem;
  line-height: 1.4;
}

.tt-session-timer { margin: 0.25rem 0 0; font-size: 1.75rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.tt-progress-ring {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  border: 3px solid rgba(59, 130, 246, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}

.tt-task {
  background: var(--tt-surface);
  border: 1px solid var(--tt-border);
  border-radius: var(--tt-radius);
  padding: 1rem 1.15rem;
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.tt-task.is-validated { border-color: rgba(34, 197, 94, 0.35); opacity: 0.75; }
.tt-task.is-current { border-color: var(--tt-accent); box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25); }

.tt-task-status {
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
  font-size: 1rem;
}

.tt-task-body { flex: 1; min-width: 0; }
.tt-task-body strong { display: block; font-size: 0.95rem; }
.tt-task-body small { color: var(--tt-muted); font-size: 0.78rem; }

.tt-task-action {
  flex-shrink: 0;
  padding: 0.5rem 0.85rem;
  font-size: 0.82rem;
}

.tt-complete-card { text-align: center; }
.tt-complete-icon { font-size: 2.5rem; display: block; margin-bottom: 0.5rem; }

/* Dialog */
.tt-dialog {
  border: none;
  padding: 0;
  max-width: min(480px, 96vw);
  width: 100%;
  background: transparent;
}

.tt-dialog::backdrop { background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(4px); }

.tt-dialog-inner {
  background: var(--tt-surface);
  border: 1px solid var(--tt-border);
  border-radius: var(--tt-radius);
  padding: 1.25rem;
  margin: 0;
}

.tt-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.tt-dialog-head h3 { margin: 0; font-size: 1.1rem; }

.tt-dialog-close {
  background: none;
  border: none;
  color: var(--tt-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.tt-dialog-desc {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--tt-muted);
  line-height: 1.5;
}

.tt-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  min-height: 44px;
}

.tt-photo-thumb {
  aspect-ratio: 1;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--tt-border);
}

.tt-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px dashed rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.06);
  cursor: pointer;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.tt-msg {
  min-height: 1.2rem;
  font-size: 0.85rem;
  margin: 0 0 0.65rem;
  color: var(--tt-accent);
}

.tt-msg.is-error { color: var(--tt-danger); }
.tt-msg.is-warn { color: var(--tt-warn); }

/* Bouton arrêt flottant */
.tt-stop-fab {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 40;
  width: 3rem;
  height: 3rem;
  border: none;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.92);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, opacity 0.2s;
}

.tt-stop-fab:active { transform: scale(0.94); }
.tt-stop-fab span { transform: translateY(-1px); }

/* Rapport de fermeture */
.tt-dialog-report .tt-dialog-inner { max-height: 90dvh; overflow-y: auto; }

.tt-report-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0;
  border: none;
}

.tt-report-field legend,
.tt-report-field > span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--tt-text);
}

.tt-report-field small { font-weight: 400; color: var(--tt-muted); }

.tt-radio {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--tt-muted);
  cursor: pointer;
}

.tt-radio input { accent-color: var(--tt-accent); }

.tt-textarea {
  width: 100%;
  padding: 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--tt-border);
  background: var(--tt-bg);
  color: var(--tt-text);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 120px;
}

.tt-word-count {
  font-size: 0.78rem;
  color: var(--tt-muted);
}

.tt-word-count.is-ok { color: var(--tt-success); }
.tt-word-count.is-low { color: var(--tt-warn); }

/* Top 3 rapidité */
.tt-leaderboard-card { margin-top: 1rem; }

.tt-leaderboard-hint {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.78rem;
  color: var(--tt-muted);
}

.tt-leaderboard { display: flex; flex-direction: column; gap: 0.85rem; }

.tt-lb-block {
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--tt-border);
}

.tt-lb-block.is-highlight {
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.12);
}

.tt-lb-title {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--tt-text);
}

.tt-lb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tt-lb-row {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
}

.tt-lb-rank { font-size: 1rem; line-height: 1; }

.tt-lb-name { color: var(--tt-text); font-weight: 500; }

.tt-lb-time {
  font-variant-numeric: tabular-nums;
  color: var(--tt-accent);
  font-weight: 600;
  font-size: 0.85rem;
}

.tt-lb-empty {
  font-size: 0.82rem;
  color: var(--tt-muted);
  list-style: none;
}
