/* ==========================================================
   03 - Zone principale, vue liste, grille de cards
   ========================================================== */

.main {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.main.main--list {
  overflow: hidden;
  padding: 10px 0 0 0;
}
.main.main--list #listView {
  height: 100%;
  align-items: stretch;
  padding: 0 0 0 22px;
  box-sizing: border-box;
}
.main.main--list #listSidebarWrapper {
  position: static;
  max-height: none;
  overflow: hidden;
  margin-bottom: 20px;
}
.main.main--list #listSidebar {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  max-height: calc(100vh - 280px);
}
.main.main--list #cardsGrid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 22px;
  padding-bottom: 40px;
}
.main::-webkit-scrollbar { width: 6px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: var(--r-full); }

/* --- Stats --- */
.stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 12px 20px;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 10px;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border-2); }
.stat-val {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--t1);
  line-height: 1;
}
.stat-val::after {
  content: '';
  display: inline-block;
  width: 3px; height: 3px;
  border-radius: 50%;
  vertical-align: middle;
  margin-left: 9px;
  background: var(--border-3);
}
.stat-lbl {
  font-size: 13.5px;
  color: var(--t2);
  font-weight: 500;
  letter-spacing: -0.012em;
}

/* --- Onglets --- */
.tabs-bar {
  display: flex;
  background: var(--surface-3);
  border-radius: var(--r-md);
  padding: 3px;
  width: fit-content;
  gap: 2px;
}
.tab-btn {
  padding: 7px 18px;
  border: none;
  background: transparent;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
  color: var(--t3);
  transition: all 0.2s var(--ease);
  letter-spacing: -0.012em;
}
.tab-btn:hover { color: var(--t1); }
.tab-btn.active {
  background: var(--surface);
  color: var(--t1);
  box-shadow: var(--shadow-sm);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

.gantt-empty {
  padding: 48px;
  text-align: center;
  color: var(--t4);
  font-size: 13px;
}

/* ==========================================================
   Vue Liste (sidebar mois + contenu)
   ========================================================== */
#listView {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  width: 100%;
}
#listView.lv-hidden { display: none !important; }

#listSidebarWrapper {
  width: 208px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 100vh;
  overflow: hidden;
}
/* Signature discrete, echo du trait diagonal de l'ecran de connexion */
#listSidebarWrapper::before {
  content: '';
  position: absolute;
  top: 4px; left: 14px;
  width: 46px; height: 2px;
  background: var(--brand-axxe);
  transform: rotate(-3.5deg);
  border-radius: var(--r-full);
  opacity: 0.8;
  pointer-events: none;
}
#listSidebarWrapper #yearTabs {
  justify-content: center;
  flex-wrap: nowrap;
  gap: 4px;
}
#listSidebarWrapper #yearTabs .year-tab {
  padding: 5px 10px;
  font-size: 12px;
  white-space: nowrap;
}
#listSidebar {
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: var(--shadow-sm);
  flex: 1;
  min-height: 0;
}

.lsb-month {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  border: none;
  border-left: 3px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.16s, border-color 0.16s;
  border-radius: 0;
  overflow: hidden;
  min-height:30px;
}
.lsb-month:not(:last-child) { border-bottom: 1px solid var(--border); }
.lsb-month:hover { background: var(--surface-2); }
.lsb-month.current .lsb-month-name { color: var(--blue); font-weight: 700; }
.lsb-month.active {
  background: var(--blue-soft);
  border-left-color: var(--blue);
}
.lsb-month-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.014em;
  color: var(--t1);
}
.lsb-month.active .lsb-month-name { color: var(--blue); font-weight: 700; }
.lsb-month-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}
.lsb-month-live {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--r-full);
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.lsb-month-live::before,
.lsb-month-live::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--r-full);
  border: 1px solid var(--red);
  animation: pulse-ring 1.5s ease-out infinite;
  pointer-events: none;
}
.lsb-month-live::after { animation-delay: 0.9s; }
@keyframes pulse-ring {
  0%   { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(2); opacity: 0; }
}

.lsb-month-count {
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  background: var(--blue);
  border-radius: var(--r-full);
  padding: 1px 7px;
  min-width: 22px;
  text-align: center;
  line-height: 18px;
  overflow: hidden;
  transition: background 0.6s ease;
}
.lsb-month-count.count-add    { background: var(--green); }
.lsb-month-count.count-delete { background: var(--red); }
.lmc-inner { display: block; }
.lsb-month-count.zero { background: var(--surface-4); color: var(--t4); }
.lsb-month.past .lsb-month-count:not(.zero) { background: var(--surface-4); color: var(--t3); }

@keyframes lmcFlipOut {
  from { transform: translateY(0)     scale(1);   opacity: 1; }
  to   { transform: translateY(-130%) scale(0.6); opacity: 0; }
}
@keyframes lmcFlipIn {
  0%   { transform: translateY(130%) scale(0.6);  opacity: 0; }
  70%  { transform: translateY(-8%)  scale(1.35); opacity: 1; }
  100% { transform: translateY(0)    scale(1);    opacity: 1; }
}
@keyframes lmcFlipOutDown {
  from { transform: translateY(0)    scale(1);   opacity: 1; }
  to   { transform: translateY(130%) scale(0.6); opacity: 0; }
}
@keyframes lmcFlipInTop {
  0%   { transform: translateY(-130%) scale(0.6);  opacity: 0; }
  70%  { transform: translateY(8%)    scale(1.35); opacity: 1; }
  100% { transform: translateY(0)     scale(1);    opacity: 1; }
}
.lmc-inner.lmc-flip-out { animation: lmcFlipOut 0.18s ease-in forwards; }
.lmc-inner.lmc-flip-in  { animation: lmcFlipIn  0.32s var(--spring) forwards; }
.fab-inner.flip-out-up   { animation: lmcFlipOut     0.18s ease-in forwards; }
.fab-inner.flip-in-up    { animation: lmcFlipInTop   0.32s var(--spring) forwards; }
.fab-inner.flip-out-down { animation: lmcFlipOutDown 0.18s ease-in forwards; }
.fab-inner.flip-in-down  { animation: lmcFlipIn      0.32s var(--spring) forwards; }
.lsb-month.past .lsb-month-name { color: var(--t4); }

/* Charge relative par mois : colonne de chiffres -> motif scannable */
.lsb-month-load {
  position: absolute;
  left: 0; bottom: 0;
  height: 2px;
  background: var(--t4);
  border-radius: 0 2px 2px 0;
  transition: width 0.4s var(--ease-out), background 0.18s;
}
.lsb-month.current .lsb-month-load,
.lsb-month.active .lsb-month-load { background: var(--blue); }

.lsb-all-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--t3);
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: color 0.18s, background 0.18s;
}
.lsb-all-btn:hover { background: var(--surface-2); color: var(--blue); }
.lsb-all-btn.active { color: var(--blue); background: var(--blue-soft); }

.lsb-anim-links {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.lsb-anim-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  text-decoration: none;
  color: var(--t1);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.012em;
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.14s;
}
.lsb-anim-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--blue);
}
.lsb-anim-btn span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lsb-anim-btn:hover {
  background: var(--surface-2);
  border-color: color-mix(in srgb, var(--blue) 40%, transparent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.lsb-doc-link {
  display: block;
  text-align: center;
  padding: 7px 0 2px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--t3);
  text-decoration: none;
  transition: color .18s;
}
.lsb-doc-link:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }

/* --- Animations d'entree des cards --- */
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
.op-card.card-enter { animation: cardEnter 0.34s var(--ease-out) both; }
.op-card.card-hidden { opacity: 0; pointer-events: none; }

@keyframes cardNewFlash {
  0%   { box-shadow: 0 0 0 0px var(--green),                 var(--shadow-md); }
  30%  { box-shadow: 0 0 0 4px var(--green),                 var(--shadow-md); }
  70%  { box-shadow: 0 0 0 4px rgba(11,128,85,0.30),         var(--shadow-md); }
  100% { box-shadow: 0 0 0 0px rgba(11,128,85,0),            var(--shadow-md); }
}
.op-card.card-new-flash { animation: cardNewFlash 1.4s ease forwards; }

.lv-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 24px;
  color: var(--t4);
  text-align: center;
  flex: 1;
}
.lv-empty-state svg { width: 48px; height: 48px; opacity: 0.35; }
.lv-empty-state p { font-size: 14px; font-weight: 500; margin: 0; }

/* ==========================================================
   Grille de cards
   ========================================================== */
#cardsGrid {
  display: flex;
  flex-direction: column;
  gap: 46px;
  width: 100%;
  min-width: 0;
}
.month-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  min-width: 0;
}

/* Titre de mois : moment editorial */
.month-heading {
  font-family: var(--display);
  font-size: 38px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.045em;
  color: var(--t1);
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: default;
  user-select: none;
  line-height: 1;
  padding-bottom: 4px;
}
.month-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-2), transparent);
}
.month-toggle-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--t4);
  transition: transform 0.24s var(--ease), color 0.18s;
}
.month-heading:hover .month-toggle-icon { color: var(--t2); }
.month-heading-current {
  font-size: 42px;
  font-weight: 800;
  color: var(--t1);
}
.month-heading-current::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
  flex-shrink: 0;
}
.month-heading-past { color: var(--t4); }

/* Avancement du mois en cours : vocabulaire du mini-Gantt des cartes, a l'echelle du mois */
.month-progress {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.month-progress-track {
  width: 100px;
  height: 4px;
  background: var(--surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
}
.month-progress-fill {
  height: 100%;
  background: var(--blue);
  border-radius: var(--r-full);
}
.month-progress-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--t3);
  font-variant-numeric: tabular-nums;
  text-transform: none;
  letter-spacing: 0;
}
.month-section.collapsed .month-toggle-icon { transform: rotate(-90deg); }
.month-section.collapsed .cards-grid { display: none; }

.cards-grid {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  width: 100%;
}
.cards-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Layout rangee-par-rangee (vue liste avec sidebar) */
.cards-rows-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
}
.cards-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  width: 100%;
}
.cards-row-cell {
  flex: 1;
  min-width: 0;
}
.cards-row-cell--empty { visibility: hidden; }
.cards-row-sep {
  height: 1px;
  background: var(--border);
  margin: 22px 0;
}

/* ==========================================================
   Card operation
   ========================================================== */
.op-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  cursor: default;
  transition: box-shadow 0.24s var(--ease), transform 0.24s var(--ease), border-color 0.24s;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  width: 100%;
  min-width: 0;
}
.op-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: var(--border-2);
  z-index: 1;
}
.op-card.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft), var(--shadow-md);
}

.op-card-editing-badge {
  background: color-mix(in srgb, var(--orange) 10%, #fff);
  border-bottom: 1px solid color-mix(in srgb, var(--orange) 28%, transparent);
  color: var(--orange);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 6px 12px;
  text-align: center;
  animation: pulse-badge 2s ease-in-out infinite;
}
.op-card-accent {
  height: 3px;
  flex-shrink: 0;
}
.op-card-image {
  width: 100%;
  aspect-ratio: 450 / 250;
  overflow: hidden;
  background: #000;
  flex-shrink: 0;
}
.op-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  min-width: 0;
  background: #000;
}
.op-card-image video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  min-width: 0;
  background: #000;
}
.op-card-image-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--t4);
  background:
    repeating-linear-gradient(-45deg, rgba(28,25,20,0.028) 0 1px, transparent 1px 9px),
    var(--surface-2);
}
.op-card-image-empty svg { width: 28px; height: 28px; opacity: 0.5; }
.op-card-image-empty span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.op-card-body {
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.op-card-edit-btn {
  position: absolute;
  top: 12px;
  right: 11px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.2s, transform 0.2s var(--ease), background 0.18s, color 0.18s, border-color 0.18s;
  box-shadow: var(--shadow-sm);
  color: var(--t2);
  cursor: pointer;
  z-index: 2;
}
.op-card:hover .op-card-edit-btn { opacity: 1; transform: scale(1); }
.op-card-edit-btn:focus-visible { opacity: 1; transform: scale(1); }
.op-card-edit-btn:hover {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.op-card-edit-btn svg { width: 12px; height: 12px; pointer-events: none; }

.op-card-name {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 800;
  color: var(--t1);
  text-transform: uppercase;
  letter-spacing: -0.032em;
  line-height: 1.12;
  text-align: center;
  margin-top: 0;
  text-wrap: balance;
}
.op-card-name-clickable {
  cursor: pointer;
  transition: color .18s;
}
.op-card-name-clickable:hover { color: var(--blue); }
.op-card.selected .op-card-name { color: var(--blue); }
