@font-face {
  font-family: 'ChronicaPro';
  src: local('ChronicaPro');
  font-display: swap;
}
@font-face {
  font-family: 'LemonMilk';
  src: local('LemonMilk'), local('LEMON MILK');
  font-display: swap;
}

:root {
  /* Charte SOP NABY FRANCE */
  --gold-light: #FFDA44;
  --gold-mid: #FDCA31;
  --orange: #E08604;
  --gold-gradient: linear-gradient(135deg, #E08604 0%, #FFDA44 100%);
  --black: #000000;
  --gray-light: #D9D9D9;

  --primary: #E08604;
  --primary-dark: #c26f02;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning-bg: #fef3c7;
  --bg: #f7f5f0;
  --card: #ffffff;
  --border: #ecdfc4;
  --text: #201a0d;
  --text-muted: #6b6455;
  --radius: 12px;

  --font-display: 'LemonMilk', 'ChronicaPro', 'Poppins', -apple-system, sans-serif;
  --font-body: 'ChronicaPro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
}

header.topbar {
  background: var(--black);
  border-bottom: 3px solid var(--gold-mid);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-center-title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.06em;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
  pointer-events: none;
}
@media (max-width: 780px) {
  .topbar-center-title { display: none; }
}

header.topbar .brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
header.topbar .brand img { height: 34px; width: auto; display: block; flex-shrink: 0; }

header.topbar .user-info {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.9rem;
  color: var(--gray-light);
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  header.topbar {
    padding: 10px 14px;
  }
  header.topbar .brand {
    font-size: 0.85rem;
    gap: 8px;
  }
  header.topbar .brand img { height: 26px; }
  header.topbar .user-info {
    font-size: 0.78rem;
    gap: 10px;
  }
  header.topbar .user-info button { padding: 7px 12px; font-size: 0.78rem; }
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

h1, h2, h3 {
  margin-top: 0;
  font-family: var(--font-display);
  color: var(--text);
}

.grid {
  display: grid;
  gap: 16px;
}
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 720px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .container { padding: 14px; }
  .card { padding: 14px; margin-bottom: 14px; }
  h1 { font-size: 1.3rem; }
  h2 { font-size: 1.1rem; }
  h3 { font-size: 1rem; }
}

.stat-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat-box .value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat-box .label { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }
.stat-box.alert .value {
  background: none;
  -webkit-text-fill-color: initial;
  color: var(--danger);
}

table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
th { color: var(--text-muted); font-weight: 700; background: #fbf6e9; }
tr:hover td { background: #fbf6e9; }

@media (max-width: 640px) {
  .card:has(table) { overflow-x: auto; }
  table { min-width: 460px; }
  th, td { padding: 8px 10px; font-size: 0.82rem; }
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}
.badge.present { background: var(--success-bg); color: var(--success); }
.badge.absent { background: var(--danger-bg); color: var(--danger); }
.badge.justifie { background: var(--warning-bg); color: #b45309; }
.badge.neutral { background: var(--gray-light); color: var(--text-muted); }

button, .btn {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: var(--font-body);
  background: var(--gold-gradient);
  color: #201200;
  transition: filter 0.15s, transform 0.05s;
}
button:hover, .btn:hover { filter: brightness(1.08); }
button:active, .btn:active { transform: translateY(1px); }

/* Boutons fond noir, écriture couleur (identité visuelle) */
button.secondary {
  background: var(--black);
  color: var(--gold-light);
  border: 1px solid var(--gold-mid);
}
button.secondary:hover { background: #1a1a1a; filter: none; }

button.danger { background: var(--black); color: #ff6b6b; border: 1px solid var(--danger); }
button.danger:hover { background: #1a1a1a; filter: none; }

button.success { background: var(--black); color: #4ade80; border: 1px solid var(--success); }
button.success:hover { background: #1a1a1a; filter: none; }

button:disabled { opacity: 0.5; cursor: not-allowed; }

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 12px;
  font-family: var(--font-body);
  background: #fffdf8;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(224, 134, 4, 0.15);
}
label { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); display: block; margin-bottom: 4px; }

.search-wrap { position: relative; max-width: 420px; }
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 20;
}
.search-results .result-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: default;
}
.search-results .result-item:last-child { border-bottom: none; }
.search-results .result-item .name { font-weight: 700; }
.search-results .result-item .meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 0%, rgba(224,134,4,0.25) 0%, rgba(0,0,0,0) 55%),
    var(--black);
}
.login-logo {
  width: 128px;
  height: auto;
  margin-bottom: 18px;
  filter: drop-shadow(0 4px 18px rgba(255, 218, 68, 0.35));
}
.login-card {
  background: #0c0c0c;
  border: 1px solid var(--gold-mid);
  border-radius: var(--radius);
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 12px 45px rgba(0,0,0,0.5);
}
.login-card h1 {
  text-align: center;
  margin-bottom: 6px;
  font-size: 1.3rem;
  font-family: var(--font-display);
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.login-subtitle {
  text-align: center;
  color: var(--gray-light);
  font-size: 0.82rem;
  margin-bottom: 24px;
  opacity: 0.8;
}
.login-card label { color: var(--gray-light); }
.login-card input {
  background: #161616;
  border: 1px solid #2b2b2b;
  color: #fff;
}
.login-card input:focus { border-color: var(--gold-mid); box-shadow: 0 0 0 3px rgba(253,202,49,0.15); }
.login-card button[type="submit"] {
  background: var(--gold-gradient);
  color: #1a1200;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
}
.error-msg { color: #ff6b6b; font-size: 0.85rem; margin-top: -6px; margin-bottom: 12px; }
.demo-accounts {
  font-size: 0.76rem;
  color: var(--gray-light);
  opacity: 0.65;
  margin-top: 20px;
  line-height: 1.6;
  text-align: center;
}

.app-footer {
  text-align: center;
  padding: 22px 16px 28px;
  font-size: 0.78rem;
  color: var(--text-muted);
  opacity: 0.8;
}
.login-wrap .app-footer { color: var(--gray-light); opacity: 0.55; }

.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 2px solid var(--border); flex-wrap: wrap; }
.tabs button {
  background: none; color: var(--text-muted); border-radius: 0;
  padding: 10px 16px; font-weight: 700; border-bottom: 3px solid transparent;
}
.tabs button.active { color: var(--orange); border-bottom-color: var(--orange); }
.tabs button:hover { background: none; color: var(--orange); filter: none; }
@media (max-width: 640px) {
  .tabs button { padding: 8px 10px; font-size: 0.82rem; }
}

.notif-bell { position: relative; cursor: pointer; font-size: 1.2rem; }
.notif-dot {
  position: absolute; top: -4px; right: -6px;
  background: var(--orange); color: var(--black); font-size: 0.65rem;
  border-radius: 999px; padding: 1px 5px; font-weight: 700;
}
#retour-haut-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gold-gradient);
  color: var(--black);
  border: none;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
  transition: transform 0.15s;
}
#retour-haut-btn:hover { transform: scale(1.08); }
@media (max-width: 640px) {
  #retour-haut-btn { bottom: 16px; right: 16px; width: 40px; height: 40px; font-size: 1.1rem; }
}
.notif-panel {
  position: absolute; right: 24px; top: 60px; width: 340px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0,0,0,0.15); max-height: 420px; overflow-y: auto; z-index: 30;
}
@media (max-width: 640px) {
  .notif-panel {
    position: fixed;
    right: 10px;
    left: 10px;
    top: 66px;
    width: auto;
  }
}
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 0.85rem; color: var(--text-muted); }
.notif-item.unread { background: #fff8e6; color: #000000; font-weight: 600; }
.notif-item .time { color: var(--text-muted); font-size: 0.75rem; margin-top: 4px; }
.notif-item.notif-cliquable { cursor: pointer; }
.notif-item.notif-cliquable:hover { background: #f3ead3; }

.empty-state { text-align: center; color: var(--text-muted); padding: 30px; }

.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }

/* Notifications toast (remplacent les alert() natives du navigateur) */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}
.toast {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  animation: toast-in 0.25s ease-out;
  border-left: 4px solid transparent;
}
.toast.success {
  background: var(--black);
  color: var(--gold-light);
  border-left-color: var(--gold-mid);
}
.toast.error {
  background: var(--black);
  color: #ff6b6b;
  border-left-color: var(--danger);
}
.toast.fade-out { animation: toast-out 0.25s ease-in forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(12px); }
}
