:root {
  --suivi-bg: #f0f6ff;
  --suivi-card: #ffffff;
  --suivi-border: #e2e8f0;
  --suivi-text: #0f172a;
  --suivi-muted: #64748b;
  --suivi-primary: #0ea5e9;
  --suivi-primary-dark: #0369a1;
  --suivi-teal: #14b8a6;
  --suivi-teal-dark: #0d9488;
  --suivi-success: #16a34a;
  --suivi-warn: #ea580c;
}

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

body.suivi-body {
  font-family: 'Nunito', system-ui, sans-serif;
  background: var(--suivi-bg);
  color: var(--suivi-text);
  min-height: 100vh;
}

/* Barre applicative (alignée sur cadrage/index.html) — URLs absolues /accueil, /cadrage/… */
.tramea-topbar {
  position: relative;
  background: linear-gradient(135deg, #0369a1 0%, #0ea5e9 100%);
  color: #fff;
  padding: 1.2rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.tramea-topbar-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  z-index: 2;
}
.tramea-topbar-logo a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 12px;
  padding: 7px 13px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  text-decoration: none;
}
.tramea-topbar-logo img {
  height: 36px;
  display: block;
}
.tramea-topbar-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  max-width: min(480px, 42vw);
  z-index: 1;
}
.tramea-topbar-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}
.tramea-topbar-sub {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.88);
  margin-top: 4px;
  line-height: 1.35;
}
.suivi-badge {
  display: inline-block;
  background: #f97316;
  color: #fff;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.tramea-topbar-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
  z-index: 2;
}
.tramea-topbar-user {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.72);
  max-width: min(320px, 45vw);
  text-align: right;
  line-height: 1.2;
  word-break: break-word;
}
.tramea-topbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.tramea-topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.tramea-topbar-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}
.tramea-topbar-btn-orange {
  background: linear-gradient(135deg, #ea580c, #f97316) !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35);
}
.tramea-topbar-btn-teal {
  background: linear-gradient(135deg, var(--suivi-teal-dark), var(--suivi-teal)) !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
}
@media (max-width: 960px) {
  .tramea-topbar-center {
    position: static;
    transform: none;
    order: 3;
    width: 100%;
    max-width: none;
    text-align: center;
    pointer-events: none;
  }
  .tramea-topbar-actions {
    margin-left: 0;
    width: 100%;
    align-items: stretch;
  }
  .tramea-topbar-row {
    justify-content: center;
  }
  .tramea-topbar-user {
    text-align: center;
    max-width: none;
  }
}

.tramea-topbar-row--compact {
  gap: 8px;
}
.tramea-topbar-more {
  position: relative;
}
.tramea-topbar-more-summary {
  list-style: none;
  cursor: pointer;
}
.tramea-topbar-more-summary::-webkit-details-marker {
  display: none;
}
.tramea-topbar-more[open] .tramea-topbar-more-summary {
  background: rgba(255, 255, 255, 0.35);
}
.tramea-topbar-more-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  padding: 8px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.22);
  border: 1px solid var(--suivi-border);
  z-index: 100;
}
.tramea-topbar-more-panel a,
.tramea-topbar-more-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  margin: 2px 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--suivi-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.tramea-topbar-more-panel a:hover,
.tramea-topbar-more-btn:hover {
  background: #f1f5f9;
}
.clockify-client-search-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 6px;
}
.clockify-client-search {
  width: 100%;
  max-width: 100%;
}
.clockify-client-count {
  font-size: 12px;
  color: var(--suivi-muted);
  margin-top: 6px;
  min-height: 1.2em;
}

.suivi-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.12);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}
.suivi-btn:hover { background: rgba(255,255,255,0.2); }
.suivi-btn-primary {
  background: linear-gradient(135deg, var(--suivi-primary-dark), var(--suivi-primary));
  border: none;
  box-shadow: 0 4px 12px rgba(14,165,233,0.35);
}
.suivi-btn-teal {
  background: linear-gradient(135deg, var(--suivi-teal-dark), var(--suivi-teal));
  border: none;
  box-shadow: 0 4px 12px rgba(20,184,166,0.3);
}

.suivi-btn-pv-coming {
  margin-top: 8px;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  box-shadow: none;
}
.suivi-btn-pv-coming:disabled,
.suivi-btn-pv-coming[disabled] {
  color: #94a3b8;
  background: #e2e8f0;
  border-color: #cbd5e1;
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.85;
}

.suivi-main { max-width: 1100px; margin: 0 auto; padding: 28px 20px 48px; }

.suivi-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.suivi-search {
  flex: 1;
  min-width: 220px;
  padding: 11px 14px;
  border: 1.5px solid var(--suivi-border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
}
.suivi-search:focus {
  outline: none;
  border-color: var(--suivi-primary);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}

.suivi-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.suivi-chip {
  padding: 7px 12px;
  border-radius: 999px;
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  background: #e2e8f0;
  color: #475569;
}
.suivi-chip.active {
  background: linear-gradient(135deg, var(--suivi-primary-dark), var(--suivi-primary));
  color: #fff;
}

.suivi-hours-aggregate {
  margin-bottom: 16px;
  padding: 16px 18px;
  background: var(--suivi-card);
  border: 1.5px solid var(--suivi-border);
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}
.suivi-hours-aggregate-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--suivi-text);
  margin-bottom: 6px;
}
.suivi-hours-aggregate-meta {
  font-size: 13px;
  color: var(--suivi-muted);
  margin: 0 0 12px;
  line-height: 1.45;
}
.suivi-hours-aggregate-meta strong {
  color: #0f172a;
  font-weight: 800;
}
.suivi-hours-aggregate-meta--warn #aggRest {
  color: #c2410c;
}
.suivi-agg-track-wrap {
  max-width: 100%;
}
.suivi-agg-track {
  position: relative;
  height: 18px;
  border-radius: 9px;
  background: #e2e8f0;
  overflow: hidden;
}
.suivi-agg-spent-fill {
  height: 100%;
  width: 0%;
  border-radius: 9px;
  background: linear-gradient(90deg, var(--suivi-teal-dark), var(--suivi-teal));
  transition: width 0.28s ease;
  max-width: 100%;
}
.suivi-agg-sold-cap {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  margin-left: -2px;
  background: #1e293b;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85);
  z-index: 2;
  pointer-events: none;
}
.suivi-hours-aggregate-legend {
  font-size: 11px;
  color: #94a3b8;
  margin: 8px 0 0;
}

.suivi-panel {
  background: var(--suivi-card);
  border: 1.5px solid var(--suivi-border);
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(15,23,42,0.04);
  overflow: hidden;
}

.suivi-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.suivi-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--suivi-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--suivi-border);
}
.suivi-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.suivi-table tr { cursor: pointer; }
.suivi-table tr:hover td { background: #f8fafc; }

.proj-name { font-weight: 800; color: var(--suivi-text); }
.proj-client { color: var(--suivi-muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.02em; }

.suivi-progress-wrap { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.suivi-progress-bar {
  flex: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}
.suivi-progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--suivi-teal-dark), var(--suivi-teal));
}

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: #e0f2fe;
  color: var(--suivi-primary-dark);
}
.status-pill.risque { background: #ffedd5; color: #c2410c; }
.status-pill.termine { background: #dcfce7; color: #15803d; }
.status-pill.pause { background: #f1f5f9; color: #475569; }
.status-pill.fil-eau { background: #e0e7ff; color: #3730a3; }

.hint-ok { font-size: 12px; color: var(--suivi-success); font-weight: 600; margin-top: 4px; }
.hint-warn { font-size: 12px; color: var(--suivi-warn); font-weight: 600; margin-top: 4px; }
.hint-neutral { font-size: 12px; color: #475569; font-weight: 600; margin-top: 4px; }

.suivi-hours-fil {
  font-size: 11px;
  font-weight: 600;
  color: #4338ca;
}

.suivi-empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--suivi-muted);
}
.suivi-empty .icon { font-size: 42px; margin-bottom: 12px; opacity: 0.5; }

.suivi-alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
}
.suivi-alert.error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.suivi-alert.info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* Fiche projet — en-tête sous la barre applicative */
.suivi-project-heading {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1.5px solid var(--suivi-border);
}
.suivi-back-link {
  display: inline-block;
  font-weight: 800;
  color: var(--suivi-primary-dark);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 8px;
}
.suivi-back-link:hover {
  text-decoration: underline;
}
.suivi-project-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--suivi-text);
  letter-spacing: -0.02em;
}
.suivi-project-sub {
  font-size: 0.95rem;
  color: var(--suivi-muted);
  margin-top: 6px;
}
.suivi-status-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.suivi-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.suivi-card {
  background: var(--suivi-card);
  border: 1.5px solid var(--suivi-border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.suivi-card h3 { font-size: 15px; font-weight: 800; margin-bottom: 12px; color: var(--suivi-text); }

.suivi-range { width: 100%; accent-color: var(--suivi-teal); }
.suivi-num-input {
  width: 72px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--suivi-border);
  font-family: inherit;
  font-weight: 700;
}

.big-progress {
  height: 14px;
  border-radius: 99px;
  background: #e2e8f0;
  overflow: hidden;
  margin-top: 12px;
}
.big-progress > div {
  height: 100%;
  background: linear-gradient(90deg, var(--suivi-teal-dark), var(--suivi-teal));
  border-radius: 99px;
  transition: width 0.25s ease;
}

.bar-compare { margin: 12px 0; }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; color: var(--suivi-muted); }
.bar-track { flex: 1; height: 10px; background: #f1f5f9; border-radius: 6px; overflow: hidden; }
.bar-sold { height: 100%; background: #94a3b8; border-radius: 6px; }
.bar-spent { height: 100%; background: linear-gradient(90deg, var(--suivi-teal-dark), var(--suivi-teal)); border-radius: 6px; }

.clockify-box {
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.clockify-box .label { font-size: 12px; color: var(--suivi-muted); font-weight: 600; }
.clockify-box .name { font-weight: 800; color: var(--suivi-teal-dark); }
.clockify-box .help { font-size: 12px; color: #0f766e; margin-top: 4px; max-width: 520px; }

.clockify-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.clockify-main-title {
  margin-bottom: 0 !important;
  flex: 1;
  min-width: 0;
}
.clockify-gear-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--suivi-border);
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.clockify-gear-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}
.clockify-gear-btn[aria-expanded="true"] {
  background: #ecfeff;
  border-color: #5eead4;
  color: #0f766e;
}
.clockify-client-setup {
  margin-top: 12px;
}
.clockify-client-setup[hidden] {
  display: none !important;
}
.clockify-setup-intro {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 12px;
}
.clockify-sync-hint {
  font-size: 12px;
  color: #64748b;
  margin: 12px 0 0;
}
#clockifySection.suivi-card-clockify-linked:not(.clockify-setup-open) .clockify-entries-wrap {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
#clockifySection.suivi-card-clockify-linked:not(.clockify-setup-open) .clockify-section-head {
  margin-bottom: 8px;
}

.suivi-sold-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 18px;
  margin-bottom: 12px;
}
.suivi-sold-field { display: flex; flex-direction: column; gap: 4px; }
.suivi-sold-field label {
  font-size: 11px;
  font-weight: 800;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.suivi-sold-field .suivi-num-input { width: 104px; }
.suivi-sold-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.suivi-compare-line {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  margin: 8px 0 4px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f8fafc;
}
.suivi-compare-line.warning {
  background: #fff7ed;
  color: #9a3412;
}
.suivi-compare-line.ok {
  background: #ecfdf5;
  color: #166534;
}

.clockify-entries-wrap {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--suivi-border);
}
.clockify-entries-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--suivi-text);
}
.clockify-entries-hint {
  font-size: 12px;
  color: var(--suivi-muted);
  margin-bottom: 8px;
}
.clockify-aggregated-panel {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f0fdfa 0%, #ecfeff 100%);
  border: 1px solid #99f6e4;
}
.clockify-aggregated-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.clockify-aggregated-label {
  font-size: 13px;
  font-weight: 700;
  color: #0f766e;
}
.clockify-aggregated-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #134e4a;
}
.clockify-aggregated-lines {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: #115e59;
}
.clockify-entries-msg {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  min-height: 1.3em;
}
.clockify-entries-msg.clockify-entries-msg--ok {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #166534;
}
.clockify-entries-scroll {
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--suivi-border);
  border-radius: 10px;
  background: #fff;
}
.clockify-entries-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.clockify-entries-table th,
.clockify-entries-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}
.clockify-entries-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--suivi-muted);
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 1;
}
.clockify-entries-table tbody tr:hover td {
  background: #f8fafc;
}
.clockify-entries-table td.num {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.suivi-select {
  width: 100%;
  max-width: 420px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--suivi-border);
  font-family: inherit;
  font-size: 14px;
  background: #fff;
}

.pv-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
