/* Tâche — admin dashboard */
:root {
  --tta-bg: #111827;
  --tta-sidebar: #0b1220;
  --tta-surface: #1f2937;
  --tta-border: rgba(255, 255, 255, 0.08);
  --tta-text: #f9fafb;
  --tta-muted: #9ca3af;
  --tta-accent: #6366f1;
  --tta-success: #22c55e;
  --tta-warn: #f59e0b;
  --tta-danger: #ef4444;
  --tta-font: 'DM Sans', system-ui, sans-serif;
}

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

body.tta-app {
  margin: 0;
  min-height: 100dvh;
  display: block;
  font-family: var(--tta-font);
  background: var(--tta-bg);
  color: var(--tta-text);
}

.tta-app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100dvh;
}

.hidden { display: none !important; }

.tta-sidebar {
  background: var(--tta-sidebar);
  border-right: 1px solid var(--tta-border);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tta-brand h1 { margin: 0.35rem 0 0; font-size: 1.35rem; }
.tta-brand p { margin: 0.25rem 0 0; font-size: 0.82rem; color: var(--tta-muted); }

.tta-brand-badge {
  display: inline-block;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tta-accent);
}

.tta-nav { display: flex; flex-direction: column; gap: 0.35rem; }

.tta-nav-btn {
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--tta-muted);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.tta-nav-btn.is-active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--tta-text);
}

.tta-auth {
  margin-top: auto;
  font-size: 0.78rem;
  color: var(--tta-muted);
}

.tta-main { padding: 1.25rem 1.5rem 2rem; overflow: auto; }

.tta-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.tta-topbar h2 { margin: 0; font-size: 1.35rem; }

.tta-btn {
  padding: 0.55rem 1rem;
  border-radius: 10px;
  border: none;
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.tta-btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--tta-text);
  border: 1px solid var(--tta-border);
}

.tta-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tta-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--tta-muted);
}

.tta-field select {
  min-width: 160px;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--tta-border);
  background: var(--tta-surface);
  color: var(--tta-text);
  font: inherit;
}

.tta-table-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--tta-border);
}

.tta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.tta-table th,
.tta-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--tta-border);
}

.tta-table th {
  background: rgba(0, 0, 0, 0.25);
  color: var(--tta-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tta-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }

.tta-empty {
  text-align: center;
  color: var(--tta-muted);
  padding: 2rem !important;
}

.tta-link-btn {
  background: none;
  border: none;
  color: var(--tta-accent);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
}

.tta-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.tta-badge-ok { background: rgba(34, 197, 94, 0.15); color: var(--tta-success); }
.tta-badge-warn { background: rgba(245, 158, 11, 0.15); color: var(--tta-warn); }
.tta-badge-progress { background: rgba(99, 102, 241, 0.15); color: var(--tta-accent); }

/* Alertes */
.tta-alert-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.tta-alert-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  background: var(--tta-surface);
  border: 1px solid var(--tta-border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.tta-alert-item:hover { border-color: rgba(99, 102, 241, 0.35); }
.tta-alert-item.is-unread { border-left: 3px solid var(--tta-warn); }

.tta-alert-icon { font-size: 1.25rem; flex-shrink: 0; }
.tta-alert-body strong { display: block; margin-bottom: 0.2rem; }
.tta-alert-body p { margin: 0; font-size: 0.85rem; color: var(--tta-muted); }
.tta-alert-meta { font-size: 0.75rem; color: var(--tta-muted); margin-top: 0.35rem; }

/* Stats */
.tta-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.tta-stat-card {
  background: var(--tta-surface);
  border: 1px solid var(--tta-border);
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
}

.tta-stat-card h3 { margin: 0 0 0.85rem; font-size: 1rem; }

.tta-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.tta-stat-row span:last-child { font-weight: 600; color: var(--tta-accent); }

/* Modal */
.tta-modal, .tta-lightbox {
  border: none;
  padding: 0;
  max-width: min(720px, 96vw);
  width: 100%;
  background: transparent;
}

.tta-modal::backdrop, .tta-lightbox::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.tta-modal-inner {
  background: var(--tta-surface);
  border: 1px solid var(--tta-border);
  border-radius: 16px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.tta-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--tta-border);
}

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

.tta-modal-head h3 { margin: 0.25rem 0 0; }

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

.tta-modal-body {
  padding: 1.15rem 1.25rem 1.5rem;
  overflow: auto;
}

.tta-timeline { display: flex; flex-direction: column; gap: 1rem; }

.tta-timeline-task h4 { margin: 0 0 0.65rem; font-size: 0.95rem; }

.tta-attempt {
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  border-left: 3px solid var(--tta-muted);
  margin-bottom: 0.5rem;
}

.tta-attempt.is-ok { border-left-color: var(--tta-success); }
.tta-attempt.is-ko { border-left-color: var(--tta-danger); }

.tta-attempt-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.tta-attempt p { margin: 0; font-size: 0.85rem; color: var(--tta-muted); }

.tta-photo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.tta-photo-row img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--tta-border);
}

.tta-session-photos {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--tta-border);
}

.tta-session-photos h4 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
}

.tta-session-photo-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.tta-session-photo {
  margin: 0;
  text-align: center;
}

.tta-session-photo img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 12px;
  cursor: pointer;
  border: 2px solid var(--tta-border);
}

.tta-session-photo figcaption {
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: var(--tta-muted);
  font-weight: 600;
}

.tta-session-photo.is-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--tta-border);
  color: var(--tta-muted);
  font-size: 0.82rem;
}

.tta-lightbox {
  max-width: 96vw;
  background: transparent;
}

.tta-lightbox img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 8px;
}

.tta-lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: #fff;
  font-size: 2rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
}

@media (max-width: 768px) {
  .tta-app-shell { grid-template-columns: 1fr; }
  .tta-sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .tta-nav { flex-direction: row; flex-wrap: wrap; }
  .tta-auth { margin-top: 0; width: 100%; }
}

.tta-login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(99, 102, 241, 0.12), transparent), var(--tta-bg);
}

.tta-login-box {
  width: 100%;
  max-width: 380px;
  padding: 1.75rem 1.5rem;
  background: var(--tta-surface);
  border: 1px solid var(--tta-border);
  border-radius: 16px;
}

.tta-login-box h1 { margin: 0.5rem 0 0.35rem; font-size: 1.5rem; }
.tta-login-lead { margin: 0 0 1.25rem; color: var(--tta-muted); font-size: 0.9rem; }

.tta-login-form { display: flex; flex-direction: column; gap: 0.85rem; }

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

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

.tta-btn-primary {
  background: var(--tta-accent);
  color: #fff;
  border: none;
}

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

.tta-login-error {
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
  color: var(--tta-danger, #ef4444);
}

/* Config — listes & équipe */
.tta-config-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 800px) {
  .tta-config-layout { grid-template-columns: 1fr; }
}

.tta-config-sidebar {
  background: var(--tta-surface);
  border: 1px solid var(--tta-border);
  border-radius: 12px;
  padding: 0.85rem;
}

.tta-config-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.tta-config-sidebar-head h3 { margin: 0; font-size: 0.95rem; }

.tta-btn-sm { padding: 0.4rem 0.65rem; font-size: 0.78rem; }

.tta-list-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tta-list-nav-btn {
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.65rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--tta-muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.tta-list-nav-btn.is-active {
  background: rgba(99, 102, 241, 0.18);
  color: var(--tta-text);
}

.tta-list-nav-btn small { opacity: 0.7; }

.tta-config-main {
  background: var(--tta-surface);
  border: 1px solid var(--tta-border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}

.tta-checklist-form {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tta-task-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.tta-task-head h3 { margin: 0; font-size: 0.95rem; }

.tta-task-list { display: flex; flex-direction: column; gap: 0.65rem; }

.tta-task-row {
  display: grid;
  grid-template-columns: 1.75rem 1fr auto;
  gap: 0.5rem;
  align-items: start;
  padding: 0.65rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  border: 1px solid var(--tta-border);
}

.tta-task-num {
  font-size: 0.78rem;
  color: var(--tta-muted);
  padding-top: 0.55rem;
  text-align: center;
}

.tta-task-fields { display: flex; flex-direction: column; gap: 0.4rem; }

.tta-task-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--tta-muted);
}

.tta-check {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.tta-check input { accent-color: var(--tta-accent); }

.tta-task-actions { display: flex; flex-direction: column; gap: 0.2rem; }

.tta-btn-icon {
  min-width: 2rem;
  padding: 0.25rem 0.35rem;
  font-size: 0.85rem;
}

.tta-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.tta-btn-danger-ghost {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

.tta-form-msg {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
}

.tta-form-msg.tta-msg-error { color: var(--tta-danger); }
.tta-form-msg.tta-msg-ok { color: var(--tta-success); }

.tta-card-block {
  max-width: 520px;
  background: var(--tta-surface);
  border: 1px solid var(--tta-border);
  border-radius: 12px;
  padding: 1.1rem;
}

.tta-card-block h3 { margin: 0 0 0.35rem; }

.tta-lead {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--tta-muted);
}

.tta-inline-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.tta-inline-form .tta-input { flex: 1; }

.tta-employee-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tta-employee-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.65rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  font-size: 0.9rem;
}

/* ── Onglet Live (SSE) ── */

.ttl-toolbar { display: flex; justify-content: flex-end; margin-bottom: 0.75rem; }

.ttl-status {
  font-size: 0.8rem;
  color: var(--tta-muted);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--tta-border);
}

.ttl-status.is-live {
  color: var(--tta-success);
  border-color: rgba(34, 197, 94, 0.4);
}

.ttl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.ttl-card {
  background: var(--tta-surface);
  border: 1px solid var(--tta-border);
  border-radius: 14px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ttl-card.is-done { opacity: 0.65; border-color: rgba(34, 197, 94, 0.35); }

.ttl-head { display: flex; justify-content: space-between; gap: 0.75rem; }
.ttl-who strong { display: block; font-size: 1.05rem; }
.ttl-checklist { font-size: 0.78rem; color: var(--tta-muted); }

.ttl-metrics { display: flex; gap: 0.9rem; text-align: right; }
.ttl-metric small { display: block; font-size: 0.65rem; text-transform: uppercase; color: var(--tta-muted); }
.ttl-metric b { font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.ttl-metric-cost b { color: var(--tta-warn); }

.ttl-progress {
  position: relative;
  height: 18px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 999px;
  overflow: hidden;
}

.ttl-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--tta-accent), var(--tta-success));
  transition: width 0.4s ease;
}

.ttl-progress-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 600;
}

.ttl-tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }

.ttl-task {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.ttl-check {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 1.5px solid var(--tta-muted);
}

.ttl-task.is-validated .ttl-check {
  border-color: var(--tta-success);
  background: var(--tta-success) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23052e16' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='m3.5 8.5 3 3 6-7'/%3E%3C/svg%3E") center/12px no-repeat;
}

.ttl-task.is-validated .ttl-label { color: var(--tta-muted); text-decoration: line-through; }

.ttl-attempts { margin-left: auto; font-size: 0.7rem; color: var(--tta-warn); }
