/* =========================================================
   myClickUps - Feuille de style principale
   Inspirée de la charte Jolifish (voir CHARTE_GRAPHIQUE.md)
   ========================================================= */

:root {
  --c-bg:        #f6f8fb;
  --c-surface:   #ffffff;
  --c-ink:       #111827;
  --c-ink-soft:  #4b5563;
  --c-muted:     #8a94a6;
  --c-border:    #e5e9f2;

  --c-primary:       #0ea5b5;   /* teal Jolifish */
  --c-primary-dark:  #0b8a98;
  --c-primary-soft:  #e0f6f8;
  --c-accent:        #ff8a3d;   /* orange / amber */
  --c-navy:          #0f1a2b;
  --c-success:       #16a34a;
  --c-error:         #dc2626;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(15, 26, 43, 0.05);
  --shadow-lg: 0 10px 30px rgba(15, 26, 43, 0.12);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--c-ink);
  background: var(--c-bg);
  line-height: 1.5;
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-dark); }
h1, h2, h3 { color: var(--c-navy); margin-top: 0; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
.muted { color: var(--c-muted); }
.small { font-size: .9rem; } .xsmall { font-size: .8rem; }

/* Layout */
.container { max-width: 1180px; margin: 1.75rem auto; padding: 0 1.25rem; }
.footer { text-align: center; padding: 2rem 0; color: var(--c-muted); }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 1.25rem;
  padding: .9rem 1.5rem;
  background: var(--c-navy); color: #fff;
  box-shadow: var(--shadow);
}
.brand { color: #fff; font-weight: 700; font-size: 1.1rem; letter-spacing: .02em; }
.brand-mark { color: var(--c-primary); margin-right: .25rem; }
.nav { display: flex; gap: 1.25rem; margin-left: 1.5rem; flex: 1; }
.nav a { color: #d8e1ef; font-weight: 500; }
.nav a:hover { color: #fff; }
.user { display: flex; align-items: center; gap: .75rem; }
.user span { opacity: .85; }

/* Cards & grids */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.empty { text-align: center; padding: 2.5rem 1rem; }
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.25rem;
}
.grid { display: grid; gap: 1rem; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 1.5rem; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

/* Stats */
.stat-card {
  display: block;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
  color: var(--c-ink);
}
a.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-num { font-size: 2rem; font-weight: 700; color: var(--c-primary); }
.stat-lbl { color: var(--c-muted); text-transform: uppercase; font-size: .8rem; letter-spacing: .05em; }
.stat-primary { background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%); color: #fff; border-color: transparent; }
.stat-primary .stat-num, .stat-primary .stat-lbl { color: #fff; }

/* Forms / buttons */
label { display: block; margin: .6rem 0; font-weight: 500; color: var(--c-ink-soft); font-size: .95rem; }
input[type=text], input[type=password], input[type=email], input[type=search],
input[type=number], input[type=date], input[type=url], input[type=tel],
select, textarea {
  width: 100%;
  margin-top: .25rem;
  padding: .6rem .75rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font: inherit; color: var(--c-ink); background: #fff;
}
select { appearance: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--c-primary-soft); border-color: var(--c-primary); }

.btn {
  display: inline-block; cursor: pointer;
  padding: .55rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
  background: #fff; color: var(--c-ink);
  font: inherit; font-weight: 600;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.btn-primary { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.btn-primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); color: #fff; }
.btn-ghost { background: transparent; color: #d8e1ef; border-color: transparent; }
.btn-ghost:hover { color: #fff; border-color: rgba(255,255,255,.25); }

.inline-form { display: inline-flex; gap: .5rem; }
.search-bar { display: flex; gap: .5rem; margin-bottom: 1rem; }
.search-bar input[type=search] { flex: 1; }

/* Alerts & badges */
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid transparent; }
.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

.badge {
  display: inline-block; padding: .15rem .55rem;
  border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: var(--c-primary-soft); color: var(--c-primary-dark);
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-error   { background: #fee2e2; color: #991b1b; }
.badge-partial { background: #fef9c3; color: #854d0e; }
.badge-alias   { background: #fff0e3; color: #c2410c; margin-top: .25rem; }

/* Login */
.login-wrap { display: flex; justify-content: center; padding: 4rem 1rem; }
.login-card { width: 100%; max-width: 420px; }
.login-card h1 { margin-bottom: .25rem; }

/* Agents */
.agent-card { padding: 1rem 1.25rem; }
.agent-head { display: flex; gap: .85rem; align-items: center; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--c-border); background: var(--c-primary-soft);
}
.avatar-fallback {
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 1.25rem;
}
.agent-name { font-weight: 700; color: var(--c-navy); }
details summary { cursor: pointer; margin-top: .75rem; color: var(--c-primary); font-weight: 600; }
.agent-form { margin-top: .5rem; }

/* Welcome */
.welcome { margin-bottom: 1.25rem; }
.welcome h1 { margin-bottom: .25rem; }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--c-border); }
.tbl th { font-size: .8rem; text-transform: uppercase; color: var(--c-muted); letter-spacing: .04em; }

/* ============================================================
   Workspace view (espaces / projets / listes) — version moderne
   ============================================================ */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.kpi {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: .85rem 1rem;
  display: flex; flex-direction: column; align-items: flex-start; gap: .15rem;
  box-shadow: var(--shadow);
}
.kpi-num { font-size: 1.6rem; font-weight: 700; color: var(--c-navy); line-height: 1; }
.kpi-lbl { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--c-muted); }

.workspace {
  display: grid; grid-template-columns: 260px 1fr; gap: 1.25rem;
  align-items: start;
}

.ws-side {
  position: sticky; top: 1rem;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: .75rem; max-height: calc(100vh - 2rem); overflow: auto;
}
.ws-search input[type=search] {
  width: 100%; margin: 0 0 .5rem; padding: .55rem .75rem;
}
.ws-spaces { display: flex; flex-direction: column; gap: .15rem; }
.ws-space {
  display: flex; align-items: center; gap: .6rem;
  width: 100%; padding: .55rem .7rem;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; font: inherit; text-align: left; color: var(--c-ink);
  transition: background .15s ease, border-color .15s ease;
}
.ws-space:hover { background: var(--c-primary-soft); }
.ws-space.active {
  background: var(--c-primary-soft); border-color: var(--c-primary);
  color: var(--c-primary-dark); font-weight: 600;
}
.ws-space .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  flex: 0 0 auto;
}
.ws-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-count {
  font-size: .75rem; color: var(--c-muted);
  background: #f1f4fa; border-radius: 999px; padding: .1rem .5rem;
}
.ws-space.active .ws-count { background: #fff; color: var(--c-primary-dark); }

.ws-main { min-width: 0; display: flex; flex-direction: column; gap: 1.25rem; }
.space {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.25rem 1.25rem;
}
.space[hidden] { display: none; }
.space-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.space-head h2 { margin: 0; font-size: 1.15rem; }
.space-ico { margin-right: .35rem; }

.proj-grid {
  display: grid; gap: .9rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.proj-card {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 0; overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.proj-card:hover { border-color: var(--c-primary); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.proj-card[hidden] { display: none; }
.proj-card > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: .5rem;
  padding: .75rem 1rem;
  background: linear-gradient(180deg, #fafcff 0%, #ffffff 100%);
  border-bottom: 1px solid transparent;
  font-weight: 600; color: var(--c-navy);
}
.proj-card > summary::-webkit-details-marker { display: none; }
.proj-card[open] > summary { border-bottom-color: var(--c-border); }
.proj-card > summary::before {
  content: "▸"; color: var(--c-muted); font-size: .85rem;
  transition: transform .15s ease; display: inline-block;
}
.proj-card[open] > summary::before { transform: rotate(90deg); }
.proj-ico { font-size: 1.05rem; }
.proj-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip {
  font-size: .72rem; font-weight: 600;
  padding: .1rem .5rem; border-radius: 999px;
  background: var(--c-primary-soft); color: var(--c-primary-dark);
}
.chip-soft { background: #fff0e3; color: #c2410c; }

.lists { list-style: none; padding: .35rem 0; margin: 0; }
.list-row {
  display: flex; align-items: center; gap: .6rem;
  padding: .45rem 1rem;
  border-left: 3px solid transparent;
  transition: background .12s ease, border-color .12s ease;
}
.list-row:hover { background: var(--c-primary-soft); border-left-color: var(--c-primary); }
.list-row[hidden] { display: none; }
.list-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--c-primary); flex: 0 0 auto; opacity: .55;
}
.list-name { flex: 1; color: var(--c-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-count {
  font-size: .75rem; color: var(--c-muted);
  background: #f1f4fa; border-radius: 999px; padding: .05rem .55rem; min-width: 1.75rem; text-align: center;
}
.list-row:hover .list-count { background: #fff; color: var(--c-primary-dark); }

.proj-card.loose > summary { background: #fffaf2; }
.empty-inline { padding: .6rem 1rem; margin: 0; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .ws-side { position: static; max-height: none; }
  .ws-spaces { flex-direction: row; overflow-x: auto; }
  .ws-space { white-space: nowrap; }
}

/* ============================================================
   Triage : e-mail → drafts de tâches (vue kanban horizontale)
   ============================================================ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1.5rem; }
.form-grid label.check { grid-column: 1 / -1; display: flex; gap: .5rem; align-items: center; }
.form-actions { grid-column: 1 / -1; display: flex; gap: .5rem; margin-top: .5rem; }
.actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.btn-danger { background: var(--c-error); color: #fff; border-color: var(--c-error); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-ghost-dark { background: transparent; color: var(--c-muted); border-color: var(--c-border); }

.triage { display: flex; flex-direction: column; gap: 1.25rem; }
.mail-block {
  background: var(--c-surface);
  border: 1px solid var(--c-border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.mail-head {
  display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between;
  padding: 1rem 1.25rem;
  background: linear-gradient(180deg, #fafcff 0%, #ffffff 100%);
  border-bottom: 1px solid var(--c-border);
}
.mail-subject { font-weight: 700; color: var(--c-navy); font-size: 1.05rem; }
.mail-sub { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; font-size: .9rem; color: var(--c-ink-soft); margin-top: .25rem; }
.mail-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-start; }

.mail-preview { padding: .75rem 1.25rem 0; }
.mail-preview summary { cursor: pointer; color: var(--c-primary); font-weight: 600; }
.mail-body {
  padding: .75rem; margin: .5rem 0; max-height: 320px; overflow: auto;
  background: #f9fafc; border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  font-size: .92rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.atts { display: flex; gap: .4rem; flex-wrap: wrap; padding: 0 0 .75rem; }
.att { background: #f1f4fa; padding: .15rem .55rem; border-radius: 999px; font-size: .8rem; }

.mains-list { padding: 1rem 1.25rem 1.25rem; display: flex; flex-direction: column; gap: 1rem; background: linear-gradient(180deg, #f6f8fb 0%, #ffffff 100%); }

.task-card {
  background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem 1.15rem; display: flex; flex-direction: column; gap: .75rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.task-card.is-main { border-left: 4px solid var(--c-primary); }
.task-card.is-sub  { border-left: 4px solid var(--c-accent); background: #fffdfa; margin-left: 2rem; }
.task-card:hover { border-color: var(--c-primary); box-shadow: var(--shadow-lg); }
.task-card[data-status="created"] { border-color: #86efac; background: #f0fdf4; }
.task-card[data-status="created"].is-sub { background: #f0fdf4; }
.task-card[data-status="error"]   { border-color: #fecaca; background: #fef7f7; }

.task-top { display: flex; gap: .5rem; align-items: center; }
.sub-bullet { color: var(--c-accent); font-weight: 700; font-size: 1.1rem; }
.draft-title {
  flex: 1; font-weight: 700; border: 1px solid transparent; background: transparent;
  font-size: 1.08rem; padding: .3rem .5rem; color: var(--c-navy);
  border-radius: var(--radius-sm);
  text-overflow: clip; white-space: normal; overflow: visible;
}
.task-card.is-sub .draft-title { font-size: .98rem; font-weight: 600; }
.draft-title:focus, .draft-title:hover { outline: none; border-color: var(--c-border); background: #fafcff; }

.task-actions { display: flex; gap: .3rem; }

.draft-body {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1rem;
}
.task-card.is-sub .draft-body { grid-template-columns: 1fr 260px; }

.draft-desc-wrap { position: relative; min-width: 0; }
.draft-rendered {
  padding: .75rem 1rem; border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  background: #fcfdff; min-height: 90px; line-height: 1.55; font-size: .95rem;
}
.draft-desc-wrap textarea.draft-desc {
  display: none;
  width: 100%;
  border: 1px solid var(--c-primary); border-radius: var(--radius-sm);
  padding: .75rem 1rem; font: inherit; line-height: 1.5; background: #fff;
  min-height: 140px; resize: vertical;
}
.draft-desc-wrap.editing .draft-rendered { display: none; }
.draft-desc-wrap.editing textarea.draft-desc { display: block; }
.desc-toggle { position: absolute; top: .35rem; right: .35rem; }
.btn-link {
  background: transparent; border: 1px solid var(--c-border);
  color: var(--c-primary-dark); padding: .15rem .5rem; border-radius: 999px;
  font-size: .78rem; cursor: pointer; font-family: inherit;
}
.btn-link:hover { background: var(--c-primary-soft); border-color: var(--c-primary); }
.draft-desc-wrap.editing .desc-toggle .btn-link { background: var(--c-primary); color: #fff; }

/* Markdown content */
.md-content p { margin: 0 0 .5rem; }
.md-content p:last-child { margin-bottom: 0; }
.md-content h2 { font-size: 1.1rem; margin: .5rem 0 .4rem; }
.md-content h3 { font-size: 1rem; margin: .5rem 0 .3rem; color: var(--c-primary-dark); }
.md-content h4 { font-size: .92rem; margin: .4rem 0 .2rem; color: var(--c-primary-dark); }
.md-content ul { margin: .3rem 0 .5rem 1.1rem; padding: 0; }
.md-content li { margin: .15rem 0; }
.md-content code { background: #f1f4fa; padding: .05rem .35rem; border-radius: 4px; font-size: .88em; }
.md-content a { word-break: break-all; }

.draft-side { display: flex; flex-direction: column; gap: .75rem; }
.draft-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .6rem; }
.draft-fields label {
  margin: 0; font-size: .72rem; color: var(--c-muted);
  text-transform: uppercase; letter-spacing: .05em; font-weight: 600;
}
.draft-fields label.full { grid-column: 1 / -1; }
.draft-fields input, .draft-fields select { padding: .4rem .55rem; margin-top: .15rem; font-size: .9rem; }

.draft-atts .label, .draft-assignees .label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600;
  color: var(--c-muted); margin-bottom: .3rem;
}
.draft-atts .att { font-size: .85rem; padding: .15rem 0; }

.task-foot {
  display: flex; justify-content: space-between; align-items: center; gap: .75rem;
  padding-top: .5rem; border-top: 1px dashed var(--c-border);
}

.subs-block { display: flex; flex-direction: column; gap: .6rem; margin: -.25rem 0 .5rem; }
.add-sub { align-self: flex-start; margin-left: 2rem; margin-top: -.25rem; }

.page-head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.preset-actions {
  display: inline-flex; gap: .3rem; align-items: center;
  padding: .25rem .5rem; background: #f1f4fa;
  border-radius: 999px; margin-right: .35rem;
}
.preset-actions .muted { margin-right: .25rem; }
.preset-btn { padding: .25rem .6rem; font-size: .82rem; border-radius: 999px; }
.preset-btn[data-preset="maintenance"]:hover { background: #fff0e3; border-color: var(--c-accent); color: #c2410c; }
.preset-btn[data-preset="banque"]:hover       { background: #e0f6f8; border-color: var(--c-primary); color: var(--c-primary-dark); }

.tag-row { display: flex; flex-wrap: wrap; gap: .3rem; margin: .15rem 0 -.25rem; }
.tag-row[hidden] { display: none; }
.tag-chip {
  font-size: .75rem; font-weight: 600;
  padding: .1rem .55rem; border-radius: 999px;
  background: linear-gradient(135deg, var(--c-primary-soft), #fff0e3);
  color: var(--c-navy);
  border: 1px solid var(--c-border);
}

.nav-admin { margin-left: auto; }

/* ============================================================
   Dashboard : suivi des tâches créées via triage
   ============================================================ */
.dashboard-stack { display: flex; flex-direction: column; gap: 1.25rem; margin-top: 1rem; }
.dash-col { padding: 1rem 1.15rem; }
.dash-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.dash-head h2 { margin: 0; display: inline-flex; align-items: center; gap: .5rem; }
.count-badge {
  background: var(--c-primary-soft); color: var(--c-primary-dark);
  padding: .05rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700;
}

.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.task-row {
  padding: .7rem .9rem;
  background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.task-row:hover { border-color: var(--c-primary); box-shadow: var(--shadow); }

.task-line1 { display: flex; align-items: center; gap: .75rem; }
.task-avatars { display: flex; align-items: center; flex: 0 0 auto; }
.avatar-xs {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--c-border);
  margin-right: -8px;
}
.avatar-xs.avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .82rem;
}
.avatar-xs:last-child { margin-right: 0; }

.task-title {
  flex: 1; min-width: 0;
  font-weight: 700; color: var(--c-navy); font-size: 1rem;
  white-space: normal; overflow: visible;
  text-decoration: none;
}
.task-title:hover { color: var(--c-primary-dark); text-decoration: underline; }

.task-meta {
  display: flex; flex-wrap: wrap; gap: .35rem; align-items: center;
  margin-top: .4rem; font-size: .82rem;
}

.chip-status {
  background: #f1f4fa; color: var(--c-ink); border: 1px solid var(--c-border);
  padding: .1rem .6rem; border-radius: 999px; font-weight: 600; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .04em;
}
.chip-closed       { background: #dcfce7; color: #15803d; border-color: #a7f3d0; }
.chip-time         { background: #fef3c7; color: #854d0e; border: 1px solid #fde68a; padding: .1rem .6rem; border-radius: 999px; font-weight: 600; font-size: .72rem; }
.chip-no-time      { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; padding: .1rem .6rem; border-radius: 999px; font-weight: 600; font-size: .72rem; opacity: .7; }
.chip-date         { background: #e0f6f8; color: var(--c-primary-dark); border: 1px solid #bee6eb; padding: .1rem .6rem; border-radius: 999px; font-weight: 600; font-size: .72rem; }
.chip-date.chip-overdue { background: #fee2e2; color: var(--c-error); border-color: #fecaca; }
.chip-project      { background: #f3f0ff; color: #5b21b6; border: 1px solid #e0d4f7; padding: .1rem .6rem; border-radius: 999px; font-weight: 600; font-size: .72rem; }

.task-actions { display: flex; gap: .35rem; flex-wrap: wrap; flex: 0 0 auto; }
.task-actions .btn { padding: .35rem .7rem; font-size: .85rem; }
.btn-timing { background: #fff7ed; border-color: var(--c-accent); color: #c2410c; }
.btn-timing:hover { background: var(--c-accent); color: #fff; border-color: var(--c-accent); }

@media (max-width: 720px) {
  .task-line1 { flex-wrap: wrap; }
  .task-actions { width: 100%; justify-content: flex-end; }
}

/* ============================================================
   Vue Leader : 2 colonnes, tâches ClickUp + tâches perso
   ============================================================ */
.leader-title { display: flex; align-items: center; gap: 1rem; }
.leader-title .avatar { width: 52px; height: 52px; }
.leader-title h1 { margin: 0; }

.leader-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem;
}
.leader-col {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow); min-width: 0;
}
.leader-col h2 { margin: 0 0 .75rem; }
.closed-section { margin-top: 1rem; }
.closed-section summary { cursor: pointer; color: var(--c-muted); font-weight: 600; padding: .4rem 0; }

/* Items ClickUp */
.lt-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.lt-item {
  display: flex; gap: .75rem; align-items: center;
  padding: .6rem .75rem; border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  background: #fff; transition: border-color .15s ease, transform .12s ease;
}
.lt-item:hover { border-color: var(--c-primary); transform: translateX(2px); }
.lt-item.is-overdue { border-left: 4px solid var(--c-error); background: #fef7f7; }
.lt-item.is-closed  { opacity: .6; }
.lt-main { flex: 1; min-width: 0; }
.lt-title { font-weight: 600; color: var(--c-navy); display: block; }
.lt-title:hover { text-decoration: underline; }
.lt-meta { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .2rem; font-size: .82rem; }
.chip-date { background: #fef3c7; color: #854d0e; border: 1px solid #fde68a; }
.lt-item.is-overdue .chip-date { background: #fee2e2; color: var(--c-error); border-color: #fecaca; }
.lt-close { flex: 0 0 auto; }

/* Tâches perso — saisie ultra simple */
.perso-add { margin-bottom: .75rem; }
.perso-add input[type=text] {
  margin-top: 0; padding: .7rem .9rem; font-size: 1rem;
  border: 1px solid var(--c-border); border-radius: var(--radius);
  background: #fff; transition: border-color .15s ease, box-shadow .15s ease;
}
.perso-add input[type=text]:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-soft); outline: none;
}

.perso-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.perso-item {
  display: grid;
  grid-template-columns: 18px 20px 1fr auto;
  gap: .6rem; align-items: center;
  padding: .5rem .7rem;
  background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.perso-item:hover { border-color: var(--c-primary); box-shadow: var(--shadow); }
.perso-item.is-urgent {
  background: linear-gradient(90deg, #fff7ed 0%, #fff 60%);
  border-color: #fcd6ad;
}
.perso-item.is-urgent::before {
  content: '🔥'; position: absolute; transform: translateX(-38px); font-size: .95rem;
  opacity: .85;
}
.perso-item.dragging { opacity: .4; transform: scale(.99); }
.perso-item.is-done  { opacity: .55; }

.perso-item .perso-title {
  border: none; background: transparent; padding: .2rem 0;
  font: inherit; color: var(--c-ink); width: 100%; margin: 0;
}
.perso-item .perso-title:focus { outline: none; border-bottom: 2px solid var(--c-primary); }

.drag-handle {
  cursor: grab; text-align: center; user-select: none; height: 18px; position: relative;
  opacity: 0; transition: opacity .15s ease;
}
.drag-handle::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(circle, var(--c-muted) 1.2px, transparent 1.2px);
  background-size: 5px 5px;
  background-repeat: repeat;
  background-position: center;
  mask-image: linear-gradient(to bottom, #000 0 100%);
}
.perso-item:hover .drag-handle { opacity: .7; }
.drag-handle:active { cursor: grabbing; opacity: 1; }

.perso-tools {
  display: flex; align-items: center; gap: .3rem;
  opacity: .55; transition: opacity .15s ease;
}
.perso-item:hover .perso-tools,
.perso-item:focus-within .perso-tools,
.perso-item.is-urgent .perso-tools,
.perso-item .perso-date-btn.has-date { opacity: 1; }

/* Bouton date (wraps l'input) */
.perso-date-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  height: 28px; padding: 0 .5rem; border-radius: 999px;
  border: 1px solid var(--c-border); cursor: pointer;
  font-size: .8rem; color: var(--c-muted); background: #fafcff;
  transition: all .15s ease;
}
.perso-date-btn:hover { border-color: var(--c-primary); color: var(--c-primary-dark); }
.perso-date-btn.has-date {
  background: var(--c-primary-soft); color: var(--c-primary-dark);
  border-color: var(--c-primary);
}
.perso-date-btn input.perso-date {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
  padding: 0; margin: 0; border: 0; width: 100%; height: 100%;
}
.perso-date-label { pointer-events: none; font-weight: 600; }

/* Bouton urgent (flame, sans emoji fixe) */
.perso-urgent {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--c-border); background: #fff;
  position: relative; transition: all .15s ease;
}
.perso-urgent::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M8.5 14.5A2.5 2.5 0 0011 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 11-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 002.5 2.5z'/></svg>") center / 16px no-repeat;
}
.perso-urgent:hover { border-color: var(--c-accent); }
.perso-urgent:hover::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff8a3d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M8.5 14.5A2.5 2.5 0 0011 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 11-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 002.5 2.5z'/></svg>");
}
.perso-urgent.is-on {
  background: linear-gradient(135deg, #ff8a3d, #ff6b2b); border-color: transparent;
}
.perso-urgent.is-on::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M8.5 14.5A2.5 2.5 0 0011 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 11-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 002.5 2.5z'/></svg>");
}

/* Bouton supprimer */
.perso-del {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  border: 1px solid transparent; background: transparent;
  position: relative; transition: all .15s ease;
}
.perso-del::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 6h18M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2M19 6l-1 14a2 2 0 01-2 2H8a2 2 0 01-2-2L5 6'/></svg>") center / 14px no-repeat;
}
.perso-del:hover { background: #fef2f2; border-color: #fecaca; }
.perso-del:hover::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dc2626' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 6h18M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2M19 6l-1 14a2 2 0 01-2 2H8a2 2 0 01-2-2L5 6'/></svg>");
}

.perso-title-done { flex: 1; text-decoration: line-through; color: var(--c-muted); }

/* Checkbox plus propre */
.perso-done {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--c-border); background: #fff;
  cursor: pointer; margin: 0; transition: all .15s ease; position: relative;
}
.perso-done:hover { border-color: var(--c-primary); }
.perso-done:checked {
  background: var(--c-primary); border-color: var(--c-primary);
}
.perso-done:checked::after {
  content: ''; position: absolute; left: 4px; top: 1px;
  width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Card leader (liste) */
.leader-card { display: flex; gap: .85rem; align-items: center; text-decoration: none; color: var(--c-ink); }
.leader-card:hover { border-color: var(--c-primary); transform: translateY(-2px); }

/* Agent card — badges */
.agent-info { min-width: 0; }
.agent-badges { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .35rem; align-items: center; }
.leader-toggle {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .7rem; border-radius: 999px;
  border: 1px solid var(--c-border); background: #fff;
  color: var(--c-muted); cursor: pointer; font: inherit; font-size: .78rem; font-weight: 600;
  transition: all .15s ease;
}
.leader-toggle:hover { border-color: var(--c-accent); color: var(--c-accent); }
.leader-toggle .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--c-border);
}
.leader-toggle.on {
  background: linear-gradient(135deg, var(--c-accent), #ffae75);
  color: #fff; border-color: var(--c-accent);
}
.leader-toggle.on .dot { background: #fff; }

@media (max-width: 900px) {
  .leader-grid { grid-template-columns: 1fr; }
  .perso-add { grid-template-columns: 1fr auto; }
  .perso-add input[type=date] { grid-column: 1 / 2; }
}
.admin-panels { margin-top: 1rem; }
.admin-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.settings-form label { display: block; margin: .75rem 0; }
.settings-form input[type=text] { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .88rem; }
.space-id-list { list-style: none; padding-left: 0; margin: .5rem 0 0; max-height: 200px; overflow: auto; }
.space-id-list li { padding: .15rem 0; }
.space-id-list code { background: #f1f4fa; padding: .1rem .4rem; border-radius: 4px; font-size: .82rem; }

@media (max-width: 900px) {
  .draft-body { grid-template-columns: 1fr; }
  .task-card.is-sub { margin-left: 0; }
  .add-sub { margin-left: 0; }
}

/* ============================================================
   Overlay global de chargement
   ============================================================ */
.app-loader {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15, 26, 43, 0.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.app-loader.is-visible { opacity: 1; pointer-events: auto; }
.app-loader[hidden] { display: none; }

.loader-box {
  background: #fff; border-radius: var(--radius);
  padding: 2rem 2.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  text-align: center; max-width: 92vw;
  display: flex; flex-direction: column; align-items: center; gap: .75rem;
  animation: loader-pop .25s ease;
}
@keyframes loader-pop {
  from { transform: translateY(10px) scale(.95); opacity: 0; }
  to   { transform: translateY(0)    scale(1);   opacity: 1; }
}

.loader-spinner {
  width: 58px; height: 58px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 25%, var(--c-primary) 25% 100%);
  -webkit-mask: radial-gradient(circle 22px at center, transparent 98%, #000 100%);
          mask: radial-gradient(circle 22px at center, transparent 98%, #000 100%);
  animation: spin 1s linear infinite;
  position: relative;
}
.loader-spinner::after {
  content: ''; position: absolute; inset: -2px; border-radius: 50%;
  background: conic-gradient(from 180deg, transparent 0 50%, var(--c-accent) 50% 75%, transparent 75% 100%);
  -webkit-mask: radial-gradient(circle 24px at center, transparent 98%, #000 100%);
          mask: radial-gradient(circle 24px at center, transparent 98%, #000 100%);
  animation: spin 2s linear infinite reverse;
  opacity: .6;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loader-label { font-weight: 700; color: var(--c-navy); font-size: 1.05rem; }
.loader-sub { color: var(--c-muted); font-size: .88rem; max-width: 360px; line-height: 1.4; }

/* Petits points animés après le label (… qui sautent) */
.loader-label::after {
  content: '';
  display: inline-block; margin-left: .25rem; width: 1.2em; text-align: left;
  animation: loader-dots 1.4s steps(4, end) infinite;
}
@keyframes loader-dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}

.draft-assignees .label { font-size: .8rem; color: var(--c-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .25rem; }
.draft-assignees .chips { display: flex; flex-wrap: wrap; gap: .3rem; min-height: 1.5rem; }
.pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .55rem .2rem .3rem; border-radius: 999px;
  background: var(--c-primary-soft); color: var(--c-primary-dark);
  font-size: .82rem; font-weight: 500;
}
.pill img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.pill-x {
  background: transparent; border: 0; color: inherit; cursor: pointer;
  opacity: .6; font-size: 1rem; padding: 0 0 0 .1rem; line-height: 1;
}
.pill-x:hover { opacity: 1; color: var(--c-error); }

.assign-picker { margin-top: .4rem; }
.assign-picker summary { cursor: pointer; color: var(--c-primary); font-size: .85rem; }
.picker-list {
  margin-top: .4rem; display: flex; flex-direction: column; gap: .15rem;
  max-height: 220px; overflow: auto;
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  background: #fff; padding: .25rem;
}
.picker-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .3rem .5rem; border: 1px solid transparent; background: transparent;
  border-radius: var(--radius-sm); cursor: pointer; font: inherit; text-align: left;
}
.picker-item:hover { background: var(--c-primary-soft); border-color: var(--c-primary); }
.picker-item img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }

.draft-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: .4rem; border-top: 1px dashed var(--c-border);
}
.icon-btn {
  background: transparent; border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  cursor: pointer; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  font-size: .95rem; color: var(--c-ink-soft);
}
.icon-btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.icon-btn.icon-danger:hover { border-color: var(--c-error); color: var(--c-error); }
.draft-actions { display: flex; gap: .25rem; }

.empty-inline { padding: 1rem; border: 1px dashed var(--c-border); border-radius: var(--radius-sm); }

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .draft-card { flex: 0 0 85vw; }
}

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; }
  .nav { order: 3; width: 100%; margin-left: 0; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
