/* ==========================================================================
   AIRH — Tâches · HUD plein écran (esthétique Cockpit)
   ========================================================================== */

#tk-hud {
  --bg: #EDF2F5;
  --bg-deep: #E2EAEF;
  --glass: rgba(255,255,255,.74);
  --glass-strong: rgba(255,255,255,.9);
  --line: rgba(22,60,90,.14);
  --line-soft: rgba(22,60,90,.07);
  --ink-1: #14222C;
  --ink-2: #4E6373;
  --ink-3: #8CA0AD;
  --hivis: #F4640A;
  --scan: rgba(10,166,201,.10);
  --panel-shadow: 0 30px 80px rgba(20,50,75,.22);
  --font-display: "Archivo", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(1200px 800px at 30% 20%, var(--bg), var(--bg-deep));
  color: var(--ink-1);
  font-family: var(--font-body);
  font-size: 15px;
}

#tk-hud[data-theme="dark"] {
  --bg: #0A1218;
  --bg-deep: #070D12;
  --glass: rgba(14,24,32,.78);
  --glass-strong: rgba(16,28,38,.92);
  --line: rgba(140,200,235,.22);
  --line-soft: rgba(140,200,235,.09);
  --ink-1: #E8F1F6;
  --ink-2: #93AAB9;
  --ink-3: #54707F;
  --scan: rgba(60,220,255,.07);
  --panel-shadow: 0 30px 80px rgba(0,0,0,.6);
}

#tk-hud *, #tk-hud *::before, #tk-hud *::after { box-sizing: border-box; }
#tk-hud button, #tk-hud select, #tk-hud input { font-family: inherit; }
#tk-hud button { cursor: pointer; }
#tk-hud :focus-visible { outline: 2px solid var(--hivis); outline-offset: 2px; border-radius: 4px; }

#tk-hud .tk-sweep {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 44%, var(--scan) 50%, transparent 56%);
  background-size: 300% 100%;
  animation: tk-sweep 12s linear infinite;
  mix-blend-mode: multiply;
}
#tk-hud[data-theme="dark"] .tk-sweep { mix-blend-mode: screen; }
@keyframes tk-sweep { from { background-position: 120% 0 } to { background-position: -120% 0 } }

/* ---------- BARRE SUPÉRIEURE ---------- */
#tk-hud .tk-header {
  position: relative; z-index: 20; flex: none;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px;
  background: linear-gradient(var(--glass), transparent);
  border-bottom: 1px solid var(--line-soft);
}
#tk-hud .tk-brand { display: flex; align-items: baseline; gap: 10px; }
#tk-hud .tk-rail { width: 34px; height: 8px; position: relative; top: -2px; }
#tk-hud .tk-rail::before, #tk-hud .tk-rail::after {
  content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--ink-3);
}
#tk-hud .tk-rail::before { top: 0 } #tk-hud .tk-rail::after { bottom: 0 }
#tk-hud .tk-name {
  font-family: var(--font-display); font-stretch: 125%; font-weight: 800;
  font-size: 18px; letter-spacing: .14em; text-transform: uppercase;
}
#tk-hud .tk-name em { font-style: normal; color: var(--hivis); }
#tk-hud .tk-mode {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .22em; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px;
  background: var(--glass); backdrop-filter: blur(10px); white-space: nowrap;
}
#tk-hud .tk-spacer { flex: 1 }

#tk-hud .tk-search {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 8px; padding: 0 11px;
  background: var(--glass); backdrop-filter: blur(10px); color: var(--ink-3);
  transition: border-color .18s;
}
#tk-hud .tk-search:focus-within { border-color: var(--hivis); }
#tk-hud .tk-search input {
  border: none; background: none; outline: none; padding: 9px 0;
  font-size: 13px; color: var(--ink-1); width: 190px;
}
#tk-hud .tk-search input::placeholder {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3);
}

#tk-hud .tk-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 12px; background: var(--glass); backdrop-filter: blur(10px);
  text-decoration: none; transition: border-color .18s, color .18s, transform .18s;
}
#tk-hud .tk-chip:hover { border-color: var(--hivis); color: var(--ink-1); transform: translateY(-1px); }
#tk-hud .tk-chip--primary { background: var(--hivis); border-color: var(--hivis); color: #fff; }
#tk-hud .tk-chip--primary:hover { color: #fff; filter: brightness(1.07); }
#tk-hud .tk-clock { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); letter-spacing: .08em; }
#tk-hud .tk-icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--glass); backdrop-filter: blur(10px); color: var(--ink-2);
  display: grid; place-items: center; font-size: 14px;
  transition: border-color .18s, color .18s, transform .18s;
}
#tk-hud .tk-icon-btn:hover { border-color: var(--hivis); color: var(--ink-1); transform: translateY(-1px); }

/* ---------- CORPS ---------- */
#tk-hud .tk-body {
  position: relative; z-index: 10; flex: 1; min-height: 0;
  display: grid; grid-template-columns: 248px minmax(0, 1fr);
  gap: 16px; padding: 16px 20px 0;
}
#tk-hud .tk-side {
  display: flex; flex-direction: column; gap: 12px; min-height: 0;
  overflow: auto; padding-bottom: 16px; scrollbar-width: thin;
}
#tk-hud .tk-card {
  background: var(--glass); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  animation: tk-drop .6s ease both; flex: none;
}
@keyframes tk-drop { from { opacity: 0; transform: translateY(-10px) } to { opacity: 1; transform: none } }
#tk-hud .tk-card-head {
  padding: 10px 14px; border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .22em; color: var(--ink-3);
  display: flex; align-items: center; gap: 8px; text-transform: uppercase;
}
#tk-hud .tk-card-head i { width: 6px; height: 6px; border-radius: 50%; background: var(--hivis); animation: tk-blink 2s infinite; flex: none; }
@keyframes tk-blink { 50% { opacity: .25 } }

#tk-hud .tk-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line-soft); }
#tk-hud .tk-kpi { background: var(--glass-strong); padding: 12px 13px; }
#tk-hud .tk-kpi .v {
  font-family: var(--font-display); font-stretch: 125%; font-weight: 800;
  font-size: 25px; line-height: 1; color: var(--kc, var(--hivis)); font-variant-numeric: tabular-nums;
}
#tk-hud .tk-kpi .l {
  font-family: var(--font-mono); font-size: 8.5px; letter-spacing: .14em;
  color: var(--ink-3); margin-top: 6px; text-transform: uppercase;
}

/* filtres statut */
#tk-hud .tk-filters { padding: 8px; display: flex; flex-direction: column; gap: 4px; }
#tk-hud .tk-filter {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 9px 11px; border-radius: 8px; border: 1px solid transparent;
  background: none; color: var(--ink-2); font-size: 12.5px;
  transition: background .15s, border-color .15s, color .15s;
}
#tk-hud .tk-filter:hover { background: var(--line-soft); color: var(--ink-1); }
#tk-hud .tk-filter .sw { width: 8px; height: 8px; border-radius: 50%; background: var(--fc, var(--ink-3)); flex: none; }
#tk-hud .tk-filter .n { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }
#tk-hud .tk-filter.is-active {
  border-color: color-mix(in srgb, var(--fc, var(--hivis)) 55%, transparent);
  background: color-mix(in srgb, var(--fc, var(--hivis)) 12%, transparent);
  color: var(--ink-1); font-weight: 600;
}

/* répartition priorité */
#tk-hud .tk-prios { padding: 12px 13px; display: flex; flex-direction: column; gap: 10px; }
#tk-hud .tk-prio { display: flex; align-items: center; gap: 9px; font-size: 11.5px; color: var(--ink-2); }
#tk-hud .tk-prio .lbl { width: 52px; flex: none; }
#tk-hud .tk-prio .bar { flex: 1; height: 5px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
#tk-hud .tk-prio .bar b { display: block; height: 100%; border-radius: 99px; background: var(--pc); }
#tk-hud .tk-prio .n { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); width: 20px; text-align: right; }

/* ---------- PANNEAU LISTE ---------- */
#tk-hud .tk-main { display: flex; flex-direction: column; min-height: 0; }
#tk-hud .tk-panel {
  flex: 1; min-height: 0; position: relative;
  display: flex; flex-direction: column;
  background: var(--glass); backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--panel-shadow); overflow: hidden;
}
#tk-hud .tk-corners { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
#tk-hud .tk-corners::before, #tk-hud .tk-corners::after,
#tk-hud .tk-corners i::before, #tk-hud .tk-corners i::after {
  content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid var(--hivis);
}
#tk-hud .tk-corners::before { top: -1px; left: -1px; border-right: none; border-bottom: none; border-radius: 14px 0 0 0 }
#tk-hud .tk-corners::after { top: -1px; right: -1px; border-left: none; border-bottom: none; border-radius: 0 14px 0 0 }
#tk-hud .tk-corners i::before { bottom: -1px; left: -1px; border-right: none; border-top: none; border-radius: 0 0 0 14px }
#tk-hud .tk-corners i::after { bottom: -1px; right: -1px; border-left: none; border-top: none; border-radius: 0 0 14px 0 }

#tk-hud .tk-panel-head {
  flex: none; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 13px 18px; border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .22em;
  color: var(--ink-3); text-transform: uppercase;
}
#tk-hud .tk-panel-head b { color: var(--ink-1); font-weight: 700; }
#tk-hud .tk-sort {
  border: 1px solid var(--line); border-radius: 7px; background: var(--glass-strong);
  color: var(--ink-2); font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: .12em; text-transform: uppercase; padding: 6px 9px; cursor: pointer;
}

#tk-hud .tk-list { flex: 1; min-height: 0; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; }

/* ---------- CARTE TÂCHE ---------- */
#tk-hud .tk-task {
  flex: 0 0 auto; /* jamais d'écrasement dans la liste scrollable */
  position: relative; display: flex; align-items: center; gap: 14px;
  min-height: 76px;
  padding: 13px 15px 13px 18px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--glass-strong); cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  animation: tk-in .4s ease both;
}
@keyframes tk-in { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }
#tk-hud .tk-task::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--pc, var(--ink-3));
}
#tk-hud .tk-task:hover {
  transform: translateY(-2px); border-color: var(--hivis);
  box-shadow: 0 14px 30px rgba(20,50,75,.16);
}
#tk-hud .tk-task.is-done { opacity: .62; }
#tk-hud .tk-thumb {
  width: 46px; height: 46px; border-radius: 10px; flex: none; object-fit: cover;
  display: grid; place-items: center; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--pc, var(--ink-3)) 14%, transparent);
  color: var(--pc, var(--ink-2));
}
#tk-hud .tk-task-main { flex: 1; min-width: 0; }
#tk-hud .tk-task-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#tk-hud .tk-title { font-weight: 700; font-size: 14px; color: var(--ink-1); }
#tk-hud .tk-badge {
  font-family: var(--font-mono); font-size: 8.5px; letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 5px;
  background: color-mix(in srgb, var(--bc) 18%, transparent);
  color: color-mix(in srgb, var(--bc) 74%, var(--ink-1));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bc) 40%, transparent);
}
#tk-hud[data-theme="dark"] .tk-badge { color: color-mix(in srgb, var(--bc) 80%, #fff); }
#tk-hud .tk-desc {
  font-size: 12px; color: var(--ink-2); margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#tk-hud .tk-meta {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 7px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; color: var(--ink-3);
}
#tk-hud .tk-meta span { display: inline-flex; align-items: center; gap: 5px; }
#tk-hud .tk-meta .late { color: #ef4444; font-weight: 600; }

#tk-hud .tk-task-right { display: flex; align-items: center; gap: 14px; flex: none; }
#tk-hud .tk-prog { display: flex; align-items: center; gap: 9px; min-width: 108px; }
#tk-hud .tk-prog .bar { flex: 1; min-width: 56px; height: 5px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
#tk-hud .tk-prog .bar b { display: block; height: 100%; border-radius: 99px; background: var(--gc); transition: width .5s cubic-bezier(.22,.9,.24,1); }
#tk-hud .tk-prog .pct { font-family: var(--font-mono); font-size: 11px; font-weight: 700; width: 34px; text-align: right; color: var(--ink-2); }
#tk-hud .tk-acts { display: flex; gap: 5px; opacity: 0; transition: opacity .15s; }
#tk-hud .tk-task:hover .tk-acts { opacity: 1; }
#tk-hud .tk-act {
  width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center;
  border: 1px solid var(--line); background: transparent; color: var(--ink-2);
  transition: border-color .15s, color .15s;
}
#tk-hud .tk-act:hover { border-color: var(--hivis); color: var(--ink-1); }
#tk-hud .tk-act--danger:hover { border-color: #ef4444; color: #ef4444; }

#tk-hud .tk-empty {
  margin: auto; padding: 60px 20px; text-align: center; color: var(--ink-3);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase;
}

/* ---------- BANDEAU BAS ---------- */
#tk-hud .tk-foot {
  flex: none; position: relative; z-index: 20;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em;
  color: var(--ink-3); text-transform: uppercase;
}
#tk-hud .tk-foot .dot { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; display: inline-block; margin-right: 7px; }
#tk-hud .tk-foot .sep { opacity: .35 }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1100px) {
  #tk-hud .tk-body { grid-template-columns: minmax(0, 1fr); }
  #tk-hud .tk-side { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding-bottom: 0; flex: none; }
  #tk-hud .tk-side .tk-card { min-width: 250px; }
}
@media (max-width: 720px) {
  #tk-hud .tk-header { padding: 10px 12px; gap: 8px; }
  #tk-hud .tk-body { padding: 10px 12px 0; }
  #tk-hud .tk-name { font-size: 15px }
  #tk-hud .tk-search input { width: 120px }
  #tk-hud .tk-task-right { flex-direction: column; align-items: flex-end; gap: 8px; }
  #tk-hud .tk-acts { opacity: 1 }
}
