/* ═══════════════════════════════════════════════════════════════════════
   Deuspiratus — module Plannings & Compétences
   Écran : dark manga (hérite de deuspiratus.css)
   Impression : grille A4 paysage claire, DM Sans, noir et blanc
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Onglets ──────────────────────────────────────────────────────────── */

.pln-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 22px 0;
}

.pln-tab {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--txt-2);
  cursor: pointer;
  font-family: var(--f-ui);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 9px 18px;
  transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.pln-tab:hover { border-color: var(--neon); color: var(--txt); }

.pln-tab.is-active {
  border-color: var(--neon);
  box-shadow: 0 0 14px rgba(0, 245, 212, 0.22);
  color: var(--neon);
}

/* ── Panneaux ─────────────────────────────────────────────────────────── */

.pln-panel { padding: 18px 22px 40px; }

.pln-toolbar {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.pln-lead {
  color: var(--txt-2);
  flex: 1 1 320px;
  font-family: var(--f-ui);
  font-size: 0.85rem;
  max-width: 560px;
}

.pln-field-inline { min-width: 210px; }

.pln-sub-title {
  color: var(--txt);
  font-family: var(--f-title);
  font-size: 1.35rem;
  letter-spacing: 0.05em;
  margin: 26px 0 12px;
}

/* ── Tables ───────────────────────────────────────────────────────────── */

.pln-table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow-x: auto;
}

.pln-table {
  border-collapse: collapse;
  font-family: var(--f-ui);
  font-size: 0.85rem;
  min-width: 640px;
  width: 100%;
}

.pln-table th {
  background: var(--panel-2);
  color: var(--txt-2);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 10px 12px;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.pln-table td {
  border-top: 1px solid var(--line);
  padding: 9px 12px;
  vertical-align: middle;
}

.pln-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

.pln-cell-strong { font-weight: 600; }
.pln-cell-dim { color: var(--txt-3); font-size: 0.78rem; }
.pln-cell-off { color: var(--txt-3); opacity: 0.6; }

.pln-row-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }

.pln-mini-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--txt-2);
  cursor: pointer;
  font-family: var(--f-ui);
  font-size: 0.75rem;
  padding: 5px 10px;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.pln-mini-btn:hover { border-color: var(--neon); color: var(--neon); }
.pln-mini-btn.is-danger:hover { border-color: var(--red); color: var(--red); }

/* ── Matrice compétences ──────────────────────────────────────────────── */

.pln-matrix-wrap { max-height: 480px; overflow: auto; }

.pln-matrix th:first-child,
.pln-matrix td:first-child {
  background: var(--panel-2);
  left: 0;
  position: sticky;
  z-index: 1;
}

.pln-matrix thead th { position: sticky; top: 0; z-index: 2; }

.pln-matrix select {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--txt);
  font-family: var(--f-ui);
  font-size: 0.82rem;
  padding: 5px 8px;
}

.pln-matrix select.has-level { border-color: var(--neon); color: var(--neon); }

/* ── Formulaires dialogs ──────────────────────────────────────────────── */

.pln-form-row { display: flex; flex-wrap: wrap; gap: 10px; }
.pln-form-row .dp-field { flex: 1 1 120px; }

.dp-field select,
.dp-field textarea {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--txt);
  font-family: var(--f-ui);
  font-size: 0.92rem;
  padding: 10px 12px;
}

.dp-field select:focus,
.dp-field textarea:focus { border-color: var(--neon); outline: none; }

.pln-check {
  align-items: center;
  color: var(--txt-2);
  display: flex;
  font-family: var(--f-ui);
  font-size: 0.85rem;
  gap: 8px;
}

.pln-rate-history {
  border-top: 1px solid var(--line);
  color: var(--txt-2);
  font-family: var(--f-ui);
  font-size: 0.8rem;
  margin-top: 4px;
  max-height: 140px;
  overflow-y: auto;
  padding-top: 8px;
}

.pln-rate-history p { padding: 3px 0; }
.pln-rate-history b { color: var(--gold); }

/* ── Notices génération (warnings / postes non pourvus) ───────────────── */

.pln-notices {
  background: var(--panel);
  border: 1px solid rgba(254, 228, 64, 0.35);
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--f-ui);
  font-size: 0.83rem;
  margin-bottom: 16px;
  padding: 12px 16px;
}

.pln-notices .is-warn { color: var(--gold); }
.pln-notices .is-gap { color: var(--red); }
.pln-notices .is-okay { color: var(--neon); }

/* ── Grille planning (affichage écran) ────────────────────────────────── */

#plnPrintArea {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 20px;
}

.pln-print-head {
  align-items: baseline;
  border-bottom: 2px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
}

.pln-print-brand {
  color: var(--neon);
  font-family: var(--f-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.pln-print-title {
  font-family: var(--f-title);
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.pln-print-week { color: var(--txt-2); font-family: var(--f-ui); font-size: 0.9rem; }

.pln-grid-table {
  border-collapse: collapse;
  font-family: var(--f-ui);
  table-layout: fixed;
  width: 100%;
}

.pln-grid-table th, .pln-grid-table td {
  border: 1px solid var(--line);
  padding: 0;
  vertical-align: top;
}

.pln-grid-table thead th {
  background: var(--panel-2);
  color: var(--txt);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 9px 6px;
  text-align: center;
  text-transform: uppercase;
}

.pln-grid-table thead th small { color: var(--txt-2); display: block; font-weight: 500; text-transform: none; }

.pln-day-cell { min-height: 120px; padding: 6px; }

.pln-shift {
  background: var(--bg-2);
  border-left: 3px solid var(--neon);
  border-radius: 0 6px 6px 0;
  break-inside: avoid;
  margin-bottom: 6px;
  padding: 6px 8px;
}

.pln-shift-time { color: var(--neon); font-size: 0.72rem; font-variant-numeric: tabular-nums; font-weight: 700; }
.pln-shift-label { color: var(--txt-3); font-size: 0.72rem; }
.pln-shift-name { font-size: 0.9rem; font-weight: 600; margin-top: 1px; }

.pln-shift.is-gap { border-left-color: var(--red); }
.pln-shift.is-gap .pln-shift-name { color: var(--red); font-weight: 700; }

.pln-print-foot {
  color: var(--txt-3);
  display: flex;
  font-family: var(--f-ui);
  font-size: 0.72rem;
  justify-content: space-between;
  margin-top: 12px;
}

/* ── Impression : A4 paysage, clair, DM Sans ──────────────────────────── */

@media print {
  @page { size: A4 landscape; margin: 10mm; }

  body { background: #fff !important; }

  /* Seule la grille sort de l'imprimante. */
  .dp-sidebar, .dp-topbar, .pln-tabs, .pln-toolbar, .pln-notices,
  .dp-scrim, .dp-login { display: none !important; }
  .pln-panel:not([data-panel="schedule"]) { display: none !important; }
  .dp-shell { display: block !important; }
  .dp-main { padding: 0 !important; }
  .pln-panel { padding: 0 !important; }

  #plnPrintArea {
    background: #fff;
    border: none;
    border-radius: 0;
    color: #111827;
    padding: 0;
  }

  .pln-print-head { border-bottom: 3px solid #111827; }
  .pln-print-brand { color: #374151; }
  .pln-print-title { color: #111827; font-size: 22px; }
  .pln-print-week { color: #6b7280; }

  .pln-grid-table th, .pln-grid-table td { border-color: #9ca3af; }

  .pln-grid-table thead th {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    background: #111827 !important;
    color: #fff !important;
  }

  .pln-grid-table thead th small { color: #d1d5db !important; }

  .pln-shift {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    background: #f9fafb !important;
    border-left-color: #374151 !important;
  }

  .pln-shift-time { color: #111827 !important; }
  .pln-shift-label { color: #6b7280 !important; }
  .pln-shift-name { color: #111827 !important; }

  .pln-shift.is-gap { background: #f3f4f6 !important; border-left-color: #111827 !important; }
  .pln-shift.is-gap .pln-shift-name { color: #111827 !important; text-decoration: underline; }

  .pln-print-foot { color: #6b7280; }
}

/* ── Responsive ───────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .pln-tabs { padding: 12px 14px 0; }
  .pln-panel { padding: 14px 14px 32px; }
  .pln-toolbar { align-items: stretch; flex-direction: column; }
  .pln-print-head { flex-direction: column; gap: 4px; }
}
