:root {
  --bg: #fbf6f1;
  --card: #ffffff;
  --primary: #f2762e;
  --primary-dark: #d8591a;
  --primary-light: #fff1e4;
  --primary-soft: #ffe3cc;
  --green: #21a366;
  --green-light: #e7f7ee;
  --red: #e04b4b;
  --red-light: #fdecec;
  --amber: #e0a020;
  --amber-light: #fdf3e0;
  --text: #2c241d;
  --muted: #8a7c70;
  --border: #efe1d3;
  --sidebar-bg: #241a12;
  --sidebar-bg-active: #382519;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 10px rgba(60, 40, 20, 0.06);
  --shadow-md: 0 10px 32px rgba(60, 40, 20, 0.10);
  --shadow-lg: 0 16px 48px rgba(60, 40, 20, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button {
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

button:active { transform: translateY(1px); }

a { transition: color 0.15s ease; }

/* ---------- KIOSKO ---------- */

.kiosk-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(720px circle at 12% -10%, var(--primary-light) 0%, transparent 55%),
    radial-gradient(600px circle at 100% 110%, var(--primary-soft) 0%, transparent 50%),
    var(--bg);
}

.kiosk-card {
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 480px;
  text-align: center;
  border: 1px solid var(--border);
}

.kiosk-brand {
  margin-bottom: 18px;
}

.brand-logo-kiosk {
  display: block;
  max-width: 190px;
  max-height: 60px;
  width: auto;
  height: auto;
  margin: 0 auto 6px;
}

.brand-app-tag {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.kiosk-clock {
  font-size: 2.6rem;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.kiosk-date {
  color: var(--muted);
  margin-bottom: 24px;
  text-transform: capitalize;
  font-weight: 600;
}

.pin-display {
  font-size: 2.2rem;
  letter-spacing: 0.6rem;
  height: 50px;
  margin-bottom: 20px;
  font-weight: 700;
  color: var(--primary-dark);
}

.pin-error {
  color: var(--red);
  min-height: 24px;
  margin-bottom: 8px;
  font-weight: 700;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 12px;
}

.keypad button {
  font-size: 1.6rem;
  font-weight: 700;
  padding: 22px 0;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fffaf5;
  color: var(--text);
}

.keypad button:hover { background: var(--primary-light); border-color: var(--primary-soft); }
.keypad button:active { background: var(--primary-soft); }

.keypad .wide { grid-column: span 1; }

.keypad button.action {
  background: linear-gradient(145deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  box-shadow: 0 6px 16px rgba(216, 89, 26, 0.35);
}
.keypad button.action:hover { filter: brightness(1.05); }

.keypad button.clear {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid #ffd9d9;
}

.employee-name {
  font-size: 1.9rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.status-pill {
  display: inline-block;
  padding: 7px 18px;
  border-radius: 999px;
  font-weight: 700;
  margin-bottom: 26px;
  letter-spacing: 0.01em;
}

.status-out { background: var(--red-light); color: var(--red); }
.status-in { background: var(--green-light); color: var(--green); }
.status-break { background: var(--amber-light); color: var(--amber); }

.big-actions { display: flex; flex-direction: column; gap: 14px; }

.big-actions button,
.big-actions a {
  display: block;
  padding: 22px;
  font-size: 1.3rem;
  font-weight: 700;
  border-radius: 16px;
  border: none;
  color: white;
  box-shadow: var(--shadow-sm);
  text-align: center;
  text-decoration: none;
}
.big-actions button:hover,
.big-actions a:hover { filter: brightness(1.06); box-shadow: var(--shadow-md); }

.btn-in { background: linear-gradient(145deg, #26b876, var(--green)); }
.btn-out { background: linear-gradient(145deg, #ea5f5f, var(--red)); }
.btn-break { background: linear-gradient(145deg, #eeb03e, var(--amber)); }
.btn-admin { background: linear-gradient(145deg, var(--primary), var(--primary-dark)); }

.home-tagline { margin-bottom: 20px; font-weight: 600; }

.secondary-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 24px;
  font-size: 0.95rem;
}

.secondary-links a {
  color: var(--primary-dark);
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}
.secondary-links a:hover { color: var(--primary); }

.msg-badge {
  background: var(--red);
  color: white;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 0.75rem;
  margin-left: 4px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 30, 18, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.overlay-card {
  background: white;
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 420px;
  text-align: left;
  box-shadow: var(--shadow-lg);
}

.overlay-card h3 { margin-top: 0; color: var(--text); }

.overlay-card label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  margin: 12px 0 4px;
  color: var(--muted);
}

.overlay-card input, .overlay-card select, .overlay-card textarea {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 1rem;
  font-family: inherit;
}
.overlay-card input:focus, .overlay-card select:focus, .overlay-card textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}

.overlay-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.overlay-actions button {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 700;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-plain { background: #f3ece4; color: var(--text); }
.btn-plain:hover { background: #ebe0d3; }

.msg-item {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 10px;
  background: #fffaf5;
}

.msg-item .meta { font-size: 0.78rem; color: var(--muted); }

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  font-size: 0.78rem;
}

.lang-btn {
  border: none;
  background: white;
  padding: 5px 12px;
  font-weight: 700;
  color: var(--muted);
}

.lang-btn.lang-active {
  background: var(--primary);
  color: white;
}

.kiosk-lang-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; }

/* ---------- ADMIN ---------- */

.admin-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 226px;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, #1a120c 100%);
  color: #e9dcce;
  padding: 22px 0;
  flex-shrink: 0;
}

.sidebar-brand {
  text-align: center;
  padding: 4px 16px 20px;
  margin: 0 0 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-logo-sidebar {
  display: block;
  max-width: 150px;
  width: 100%;
  height: auto;
  margin: 0 auto 8px;
}

.brand-app-name {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
}

.sidebar button {
  display: block;
  width: calc(100% - 20px);
  margin: 2px 10px;
  text-align: left;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  color: inherit;
  padding: 11px 14px;
  font-size: 0.93rem;
  font-weight: 600;
  border-radius: 10px;
}

.sidebar button.active {
  background: var(--sidebar-bg-active);
  color: white;
  border-left-color: var(--primary);
}
.sidebar button:hover { background: rgba(255,255,255,0.06); }

.nav-icon { display: inline-block; width: 22px; margin-right: 4px; }

.main {
  flex: 1;
  padding: 28px 34px;
  overflow-x: auto;
}

.main h2 { margin-top: 0; color: var(--text); }

.topbar {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  padding: 14px 24px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: white;
}

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

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: var(--primary-light); }

.pill { padding: 3px 12px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }
.pill-green { background: var(--green-light); color: var(--green); }
.pill-red { background: var(--red-light); color: var(--red); }
.pill-amber { background: var(--amber-light); color: var(--amber); }

.form-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.form-row > div { flex: 1; min-width: 140px; }
.form-row label { display: block; font-size: 0.82rem; font-weight: 700; margin-bottom: 4px; color: var(--muted); }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 9px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: 0.95rem; font-family: inherit;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}

.btn {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 700;
  font-size: 0.9rem;
}
.btn-primary { background: var(--primary); color: white; box-shadow: 0 3px 10px rgba(216, 89, 26, 0.25); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: white; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--primary-light); border-color: var(--primary-soft); }
.btn-danger { background: var(--red-light); color: var(--red); }
.btn-danger:hover { background: #fbdcdc; }
.btn-green { background: var(--green-light); color: var(--green); }
.btn-green:hover { background: #d8f2e3; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; border-radius: 8px; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(720px circle at 12% -10%, var(--primary-light) 0%, transparent 55%),
    radial-gradient(600px circle at 100% 110%, var(--primary-soft) 0%, transparent 50%),
    var(--bg);
}

.login-card {
  background: white;
  padding: 36px;
  border-radius: 20px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  text-align: center;
}

.brand-logo-login {
  display: block;
  max-width: 220px;
  width: 100%;
  height: auto;
  margin: 0 auto 8px;
}

.app-tag {
  margin: 0 0 14px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.muted { color: var(--muted); }
.hidden { display: none !important; }

.schedule-grid { display: grid; grid-template-columns: 110px repeat(7, 1fr); gap: 6px; align-items: center; }
.schedule-grid .day-label { font-weight: 700; font-size: 0.85rem; }
.schedule-grid input[type=time] { width: 100%; padding: 6px; border-radius: 6px; border: 1px solid var(--border); }

/* ---------- Planification hebdomadaire ---------- */
#planningTable th, #planningTable td { white-space: nowrap; vertical-align: top; }
.plan-cell { display: flex; flex-direction: column; gap: 3px; min-width: 108px; }
.plan-cell select, .plan-cell input {
  padding: 4px 5px; font-size: 0.78rem; border-radius: 6px; border: 1px solid var(--border); width: 100%; font-family: inherit;
}
.plan-cell select:focus, .plan-cell input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }
.plan-cell .plan-hours { font-size: 0.72rem; color: var(--muted); text-align: center; font-weight: 600; }
.plan-locked {
  min-width: 108px; font-size: 0.78rem; text-align: center; font-weight: 700;
  color: var(--amber); background: var(--amber-light); border-radius: 8px; padding: 10px 4px;
}
.plan-total-cell { font-weight: 700; font-size: 0.85rem; color: var(--primary-dark); }

.print-only { display: none; }
@media print {
  body * { visibility: hidden; }
  #planningPrintArea, #planningPrintArea * { visibility: visible; }
  #planningPrintArea { display: block !important; position: absolute; top: 0; left: 0; width: 100%; padding: 20px; }
  #planningPrintArea table { width: 100%; border-collapse: collapse; }
  #planningPrintArea th, #planningPrintArea td {
    border: 1px solid #999; padding: 6px 8px; font-size: 0.85rem; text-align: center; white-space: pre-line;
  }
  #planningPrintArea th:first-child, #planningPrintArea td:first-child { text-align: left; }
}

@media (max-width: 720px) {
  .admin-shell { flex-direction: column; }
  .sidebar { width: 100%; display: flex; overflow-x: auto; padding: 8px; }
  .sidebar-brand { display: none; }
  .sidebar button { white-space: nowrap; width: auto; }
  .main { padding: 16px; }
}
