/* ══════════════════════════════════════════════════════════════
   ECW Admin — design system v3
   ══════════════════════════════════════════════════════════════ */

:root {
  --ink:        #15110d;
  --ink-soft:   #2a241d;
  --ink-muted:  rgba(21, 17, 13, 0.62);

  --paper:      #f5efe3;
  --paper-warm: #ece3d0;
  --paper-card: #fbf7ee;

  --coral:      #e0532f;
  --sage:       #2f6b58;
  --sage-soft:  #d6eae1;
  --butter:     #eab94a;
  --butter-soft:#fbf0d2;
  --blush:      #f0c5b8;
  --mint:       #bcd8ca;

  --danger:     #d14a3a;
  --danger-soft:#f7d9d4;
  --success:    #2f6b58;
  --success-soft:#d4e9e1;

  --f-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-serif:   "Fraunces", "Iowan Old Style", Georgia, serif;
  --f-body:    "Inter", "Helvetica Neue", Arial, sans-serif;

  --ease:  cubic-bezier(0.22, 1, 0.36, 1);
  --rad:   6px;
  --rad-lg:14px;
  --rad-xl:22px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--f-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; background: none; border: 0; cursor: pointer; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--coral); color: var(--paper); }

/* ══════════════════════════════════════════════════════════════
   LOGIN
   ══════════════════════════════════════════════════════════════ */
.login {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--ink);
  overflow: hidden;
}
.login__bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.login__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.22;
}
.login__blob--1 {
  top: -20%; left: -10%;
  width: 560px; height: 560px;
  background: var(--coral);
}
.login__blob--2 {
  bottom: -25%; right: -15%;
  width: 620px; height: 620px;
  background: var(--sage);
}

.login__card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--paper);
  border-radius: var(--rad-xl);
  padding: clamp(2rem, 5vw, 3rem);
  box-shadow: 0 60px 120px -30px rgba(0, 0, 0, 0.5);
}

.login__home {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink-muted);
  padding: 0.4rem 0.8rem;
  border: 1px solid rgba(21, 17, 13, 0.1);
  border-radius: 999px;
  transition: background 0.3s, color 0.3s;
  margin-bottom: 1.75rem;
}
.login__home:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.login__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 2.5rem;
}
.login__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  background: var(--ink);
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}
.login__mark::after {
  content: '';
  position: absolute;
  top: -2px; right: -2px;
  width: 9px; height: 9px;
  background: var(--coral);
  border: 2px solid var(--paper);
  border-radius: 50%;
}
.login__mark-img {
  width: 22px; height: 22px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}
.login__brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  line-height: 1;
}
.login__brand-name {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}
.login__brand-name em {
  font-family: var(--f-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--coral);
}
.login__brand-sub {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.login__title {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: clamp(2.2rem, 5vw, 2.8rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin-bottom: 0.75rem;
}
.login__title em {
  font-family: var(--f-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--coral);
}
.login__desc {
  font-size: 0.95rem;
  color: var(--ink-muted);
  margin-bottom: 2rem;
}

.login__group { margin-bottom: 1rem; }
.login__label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink-muted);
  margin-bottom: 0.4rem;
}
.login__input {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(21, 17, 13, 0.15);
  border-radius: var(--rad);
  background: var(--paper-card);
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.3s, background 0.3s;
}
.login__input:focus { border-color: var(--ink); background: var(--paper); }

.login__error {
  font-size: 0.82rem;
  color: var(--danger);
  margin-bottom: 0.75rem;
  min-height: 1.2em;
}

.login__btn {
  width: 100%;
  padding: 1rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 0.3s, transform 0.3s var(--ease);
}
.login__btn:hover { background: var(--coral); transform: translateY(-1px); }
.login__btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.login__btn svg { transition: transform 0.3s var(--ease); }
.login__btn:hover svg { transform: translateX(3px); }

/* ══════════════════════════════════════════════════════════════
   DASHBOARD — HEADER
   ══════════════════════════════════════════════════════════════ */
.dash {
  min-height: 100vh;
  background: var(--paper);
}

.dash__header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 239, 227, 0.85);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-bottom: 1px solid rgba(21, 17, 13, 0.08);
}

.dash__header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.dash__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
  transition: transform 0.3s var(--ease);
}
.dash__brand:hover { transform: translateX(-2px); }
.dash__mark {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: var(--ink);
  border-radius: 50%;
  flex-shrink: 0;
}
.dash__mark::after {
  content: '';
  position: absolute;
  top: -2px; right: -2px;
  width: 7px; height: 7px;
  background: var(--coral);
  border: 2px solid var(--paper);
  border-radius: 50%;
}
.dash__mark-img {
  width: 20px; height: 20px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}
.dash__brand-text {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1;
}
.dash__brand-name {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 0.88rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.dash__brand-name em {
  font-family: var(--f-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--coral);
}
.dash__brand-tag {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.dash__tabs {
  display: flex;
  gap: 0.2rem;
  flex: 1;
  margin-left: 1rem;
}
.dash__tab {
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink-muted);
  border-radius: 999px;
  transition: background 0.3s, color 0.3s;
}
.dash__tab:hover { color: var(--ink); background: rgba(21, 17, 13, 0.04); }
.dash__tab.is-active {
  background: var(--ink);
  color: var(--paper);
}

.dash__logout {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  border: 1px solid rgba(21, 17, 13, 0.15);
  border-radius: 999px;
  transition: all 0.3s;
  flex-shrink: 0;
}
.dash__logout:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ══════════════════════════════════════════════════════════════
   DASHBOARD — MAIN
   ══════════════════════════════════════════════════════════════ */
.dash__main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.dash__heading {
  margin-bottom: 2rem;
}
.dash__kicker {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.5rem;
}
.dash__title {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.dash__title em {
  font-family: var(--f-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--coral);
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat {
  padding: 1.5rem 1.75rem;
  background: var(--paper-card);
  border: 1px solid rgba(21, 17, 13, 0.08);
  border-radius: var(--rad-lg);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.stat__val {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat__lbl {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.stat--accent {
  background: var(--butter-soft);
  border-color: var(--butter);
}
.stat--accent .stat__val {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  font-weight: 700;
}

/* Toolbar */
.toolbar {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.toolbar__left, .toolbar__right {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.input {
  padding: 0.6rem 0.95rem;
  border: 1px solid rgba(21, 17, 13, 0.15);
  border-radius: var(--rad);
  background: var(--paper-card);
  font-size: 0.88rem;
  color: var(--ink);
  outline: none;
  cursor: pointer;
  transition: border-color 0.3s, background 0.3s;
}
.input:focus { border-color: var(--ink); background: var(--paper); }
.input--num {
  width: 80px;
  text-align: center;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1rem;
  cursor: text;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  border-radius: 999px;
  transition: all 0.3s var(--ease);
}
.btn--primary {
  background: var(--ink);
  color: var(--paper);
}
.btn--primary:hover { background: var(--coral); }
.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(21, 17, 13, 0.15);
}
.btn--ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Table */
.table-wrap {
  background: var(--paper-card);
  border: 1px solid rgba(21, 17, 13, 0.08);
  border-radius: var(--rad-lg);
  overflow: hidden;
  position: relative;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.table thead th {
  background: var(--paper-warm);
  color: var(--ink-muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.9rem 1rem;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid rgba(21, 17, 13, 0.1);
}
.table thead th.text-center { text-align: center; }

.table tbody tr {
  border-bottom: 1px solid rgba(21, 17, 13, 0.05);
  transition: background 0.15s;
}
.table tbody tr:last-child { border-bottom: 0; }
.table tbody tr:hover { background: rgba(21, 17, 13, 0.025); }

.table tbody td {
  padding: 0.85rem 1rem;
  color: var(--ink);
  vertical-align: middle;
}
.table tbody td.text-center { text-align: center; }

.td-name { font-weight: 600; white-space: nowrap; }
.td-muted { color: var(--ink-muted); font-size: 0.85rem; }

/* Statut badges */
.statut-badge {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.statut-badge--confirme { background: var(--butter-soft); color: #7a5b00; }
.statut-badge--rappel   { background: #d9eaf0; color: #1f5566; }
.statut-badge--present  { background: var(--success-soft); color: var(--success); }
.statut-badge--absent   { background: var(--danger-soft); color: var(--danger); }

/* Action buttons */
.action-btns {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
}
.action-btn {
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  transition: all 0.2s;
  font-family: inherit;
}
.action-btn--present {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(47, 107, 88, 0.3);
}
.action-btn--present:hover { background: var(--success); color: var(--paper); border-color: var(--success); }

.action-btn--absent {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(209, 74, 58, 0.3);
}
.action-btn--absent:hover { background: var(--danger); color: var(--paper); border-color: var(--danger); }

/* Lutins : checkboxes + notes inline */
.toggle-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1.5px solid rgba(21, 17, 13, 0.18);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
  color: transparent;
  padding: 0;
}
.toggle-cell:hover {
  border-color: rgba(21, 17, 13, 0.35);
  background: rgba(21, 17, 13, 0.03);
}
.toggle-cell.is-on {
  background: var(--success);
  border-color: var(--success);
  color: var(--paper);
}
.toggle-cell.is-on:hover {
  background: var(--success);
  filter: brightness(1.08);
}
.toggle-cell svg { display: block; }

.note-input {
  width: 100%;
  min-width: 180px;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--ink);
  transition: all 0.15s;
}
.note-input:hover { background: rgba(21, 17, 13, 0.03); }
.note-input:focus {
  outline: none;
  background: var(--paper);
  border-color: rgba(21, 17, 13, 0.15);
}
.note-input.is-saving { opacity: 0.5; }

.td-contact {
  font-size: 0.8rem;
  line-height: 1.4;
  white-space: nowrap;
}
.td-contact a { color: inherit; display: block; }
.td-contact a:hover { color: var(--coral); }
.td-contact .td-contact__wa {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: #128c7e;
  margin-left: 0.3rem;
}

/* Empty + loading */
.empty {
  padding: 4rem 2rem;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.95rem;
}
.loading {
  position: absolute;
  inset: 0;
  background: rgba(251, 247, 238, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(21, 17, 13, 0.12);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════
   SETTINGS
   ══════════════════════════════════════════════════════════════ */
.settings {
  background: var(--paper-card);
  border: 1px solid rgba(21, 17, 13, 0.08);
  border-radius: var(--rad-lg);
  padding: clamp(1.75rem, 3vw, 2.5rem);
  max-width: 620px;
}
.settings__title {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 0.6rem;
}
.settings__desc {
  font-size: 0.92rem;
  color: var(--ink-muted);
  line-height: 1.6;
  margin-bottom: 1.75rem;
}
.settings__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.settings__unit {
  font-size: 0.92rem;
  color: var(--ink-soft);
  flex: 1;
  min-width: 8rem;
}
.settings__feedback {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--success);
  min-height: 1.2em;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .dash__header-inner { gap: 0.75rem; padding: 0.75rem 1rem; }
  .dash__tabs { order: 3; width: 100%; margin-left: 0; }
  .dash__brand-tag { display: none; }
  .stats { grid-template-columns: 1fr; }
  .table { font-size: 0.82rem; }
  .table thead th,
  .table tbody td { padding: 0.7rem 0.75rem; }
}
@media (max-width: 560px) {
  .dash__logout span { display: none; }
  .dash__brand-text { display: none; }
}
