/* =========================================================
   Domaine Saint-Segond — Design tokens (toute l'application)
   Identité "blason" : terracotta, olive, or, bleu, fond lin
   Basé sur le logo fourni (monogramme DS)
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600&family=Inter:wght@400;500;600&display=swap');

:root{
  /* Fond / surfaces */
  --bg: #F3EEE2;              /* fond de page, lin */
  --paper: #FBF8EF;            /* cards, header */

  /* Texte */
  --ink: #2E2A22;               /* texte principal */
  --ink-soft: #75705F;          /* texte secondaire, labels */
  --ink-faint: #A69F8B;         /* placeholders, notes */

  /* Bordures */
  --border: #E1D8C1;
  --border-strong: #D2C5A3;

  /* Accent principal — terracotta (monogramme du logo) */
  --terracotta: #A2412E;
  --terracotta-dark: #7C3022;
  --terracotta-tint: #F3E4DF;   /* fond de focus ring */

  /* Accent secondaire — olive (feuillage du logo) */
  --olive: #7C7D3E;
  --olive-dark: #5E5F2C;

  /* Accent tertiaire — or (texte et baies du logo) */
  --gold: #B8862F;
  --gold-dark: #8F6822;

  /* Accent quaternaire — bleu (baies alternées du logo) */
  --blue: #3E6C8E;
  --blue-dark: #2E5470;

  /* États */
  --success-bg: #EBEDD9;
  --success-ink: #545934;
  --danger-bg: #F6E7E3;
  --danger-ink: #8C3A24;

  --radius: 4px;
  --font-display: 'Cormorant Garamond', serif;
  --font-body: 'Inter', sans-serif;
}

*{ box-sizing: border-box; }

/* Texture de fond "lin" — grain SVG léger en overlay */
body{
  margin:0;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.18 0 0 0 0 0.16 0 0 0 0 0.12 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Typographie ---------- */
h1, h2, .font-display{
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
}

/* ---------- Header / bandeau ---------- */
.app-header{
  background: var(--paper);
  border-bottom: 1px solid var(--border);
}
.app-header .header-inner{
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 32px 0 32px;
  display:flex;
  flex-direction:column;
  align-items:center;
}
.app-header .brand{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  margin-bottom:6px;
}
.app-header .brand img{
  width: 120px;
  height: 120px;
  object-fit: contain;
}
.app-header .brand-text{ text-align:center; }
.app-header .brand-text h1{
  margin:0;
  font-size:30px;
  letter-spacing:0.3px;
}
.app-header .brand-text p{
  margin:3px 0 0 0;
  font-size:13px;
  color: var(--gold-dark);
  letter-spacing:2px;
  text-transform:uppercase;
  font-weight:500;
}

.app-nav{
  display:flex;
  gap:26px;
  justify-content:center;
  padding-bottom:15px;
  position:relative;
  width:100%;
}
.app-nav a{
  font-size:15px;
  color: var(--ink-soft);
  text-decoration:none;
  padding-bottom:13px;
  border-bottom:2px solid transparent;
}
.app-nav a.active{
  color: var(--terracotta);
  font-weight:500;
  border-bottom:2px solid var(--terracotta);
}
.app-nav .logout-form{
  position:absolute;
  right:32px;
}
.app-nav .logout-btn{
  font-size:15px;
  color: var(--ink-faint);
  background:none;
  border:none;
  cursor:pointer;
  font-family: var(--font-body);
  padding-bottom:13px;
}
.app-nav .logout-btn:hover{ color: var(--terracotta); }

.deco-rule{
  height:6px;
  background-image:
    linear-gradient(90deg, var(--gold) 0 100%),
    repeating-linear-gradient(90deg, var(--blue) 0 3px, transparent 3px 26px);
  background-size:100% 1px, 100% 3px;
  background-position:center 1px, center 4.5px;
  background-repeat:no-repeat, repeat-x;
  opacity:0.6;
}

/* ---------- Mise en page ---------- */
main{
  max-width: 1040px;
  margin: 0 auto;
  padding: 34px 32px 60px 32px;
  display:flex;
  flex-direction:column;
  gap:24px;
}

/* ---------- Cards ---------- */
.card{
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 30px 32px;
  box-shadow: 0 1px 2px rgba(46,42,34,0.05);
}
.card h2{ font-size:23px; margin:0 0 20px 0; }

/* ---------- Champs de formulaire ---------- */
label{
  display:block;
  font-size:13.5px;
  font-weight:500;
  color: var(--ink-soft);
  margin-bottom:7px;
}
label .hint{ font-weight:400; color: var(--ink-faint); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
select{
  width:100%;
  height:42px;
  padding:0 12px;
  border:1px solid var(--border-strong);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size:16px;
  color: var(--ink);
  background: var(--paper);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder{ color: var(--ink-faint); }
input:focus, select:focus{
  outline:none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px var(--terracotta-tint);
}

/* ---------- Boutons (aussi utilisable sur <a>, ex. liens de téléchargement) ---------- */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:42px;
  padding:0 22px;
  border-radius: var(--radius);
  border:none;
  font-family: var(--font-body);
  font-size:15px;
  font-weight:500;
  cursor:pointer;
  text-decoration:none;
}
.btn-primary{ background: var(--terracotta); color:#fff; }
.btn-primary:hover{ background: var(--terracotta-dark); }
.btn-ghost{
  background:transparent;
  border:1px solid var(--border-strong);
  color: var(--ink-soft);
  height:36px;
  padding:0 12px;
  font-size:13.5px;
}
.btn-ghost:hover{ border-color: var(--blue); color: var(--blue-dark); }
.btn-danger{ background: var(--terracotta-dark); color:#fff; height:36px; padding:0 12px; font-size:13.5px; }
.btn-danger:hover{ background:#5E2419; }

/* ---------- Tableaux ---------- */
table{ width:100%; border-collapse:collapse; }
thead th{
  text-align:left;
  font-size:12px;
  font-weight:600;
  letter-spacing:0.8px;
  text-transform:uppercase;
  color: var(--gold-dark);
  padding:0 10px 12px 10px;
  border-bottom:1px solid var(--border);
}
tbody td{
  padding:14px 10px;
  font-size:15.5px;
  border-bottom:1px solid var(--border);
  vertical-align:middle;
}
tbody tr:last-child td{ border-bottom:none; }
tr.holiday{ background: var(--terracotta-tint); }

.cell-input{
  height:38px;
  padding:0 10px;
  border:1px solid var(--border-strong);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size:15px;
  width:100%;
  background: var(--paper);
}
.cell-with-action{
  display:flex;
  gap:8px;
  align-items:center;
}

/* ---------- Badges ---------- */
.badge{
  display:inline-block;
  padding:4px 11px;
  border-radius:3px;
  font-size:12.5px;
  font-weight:500;
}
.badge-success{ background: var(--success-bg); color: var(--success-ink); }
.badge-danger{ background: var(--danger-bg); color: var(--danger-ink); }
.badge-muted{ background: var(--border); color: var(--ink-soft); }

/* ---------- Liens d'action ---------- */
.actions-link{
  font-size:15px;
  color: var(--blue-dark);
  text-decoration:none;
}
.actions-link:hover{ text-decoration:underline; }

.footnote{
  font-size:13px;
  color: var(--ink-faint);
  margin-top:8px;
}

/* ---------- Alertes (messages flash) ---------- */
.alert{
  padding:12px 16px;
  border-radius: var(--radius);
  font-size:15px;
  margin:0;
}
.alert.success{ background: var(--success-bg); color: var(--success-ink); }
.alert.error{ background: var(--danger-bg); color: var(--danger-ink); }

/* ---------- Formulaires empilés ---------- */
.form-grid{ display:grid; gap:16px; max-width:460px; }
.form-grid > div{ display:flex; flex-direction:column; }

/* ---------- Filtres en ligne ---------- */
.filters{ display:flex; gap:16px; flex-wrap:wrap; align-items:flex-end; }
.filters > div{ display:flex; flex-direction:column; min-width:160px; }

/* ---------- Détails / actions repliables ---------- */
details{ position:relative; }
details summary{
  cursor:pointer;
  font-size:15px;
  color: var(--blue-dark);
  list-style:none;
}
details summary::-webkit-details-marker{ display:none; }
details[open] summary{ margin-bottom:8px; }
details form{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin:6px 0; }

/* ---------- Écran kiosque (page pointage : pas de bandeau, logo/nom et
   horloge encadrent la carte de pointage) ---------- */
.kiosk-screen{
  display:flex;
  flex-direction:row;
  align-items:center;
  justify-content:center;
  gap:40px;
  min-height:100vh;
  width:100%;
  max-width:none;
  margin:0;
  padding:32px;
  box-sizing:border-box;
}
.kiosk-side{
  display:flex;
  flex-direction:column;
  align-items:center;
  text-align:center;
  gap:12px;
}
.kiosk-screen .kiosk-wrap{ margin:0; } /* neutralise le margin:0 auto de
  .kiosk-wrap (prévu hors contexte flex) qui absorberait l'espace libre
  et écraserait le gap ci-dessus */
.kiosk-brand-logo{ width:230px; height:230px; object-fit:contain; }
.kiosk-brand-text h1{
  font-family: var(--font-display);
  font-weight:600;
  font-size:32px;
  color: var(--ink);
  margin:0;
}
.kiosk-clock-time{
  font-family: var(--font-display);
  font-weight:600;
  font-size:92px;
  color: var(--ink);
  line-height:1;
}
.kiosk-clock-date{
  font-size:23px;
  color: var(--ink-soft);
  text-transform:capitalize;
  white-space:nowrap;
}

@media (max-width: 900px){
  .kiosk-screen{ flex-direction:column; min-height:auto; padding:24px 16px; gap:20px; }
  .kiosk-brand{ order:-1; }
  .kiosk-brand-logo{ width:96px; height:96px; }
  .kiosk-brand-text h1{ font-size:26px; white-space:normal; }
  .kiosk-clock{ order:2; margin-top:8px; }
  .kiosk-clock-time{ font-size:48px; }
  .kiosk-clock-date{ font-size:16px; white-space:normal; }
}

/* ---------- Kiosque (pointage tactile) ---------- */
.kiosk-wrap{ max-width:420px; margin:0 auto; text-align:center; }
.kiosk-wrap .subtitle{ color: var(--ink-soft); margin-top:0; font-size:15.5px; }

.pin-dots{ display:flex; justify-content:center; gap:0.8rem; margin:1.5rem 0; }
.pin-dots span{ width:20px; height:20px; border-radius:50%; border:2px solid var(--terracotta); display:inline-block; }
.pin-dots span.filled{ background: var(--terracotta); }

.keypad{ display:grid; grid-template-columns:repeat(3,1fr); gap:0.8rem; margin-bottom:1.5rem; }
.keypad button{
  font-size:1.6rem;
  padding:1.1rem 0;
  border-radius:10px;
  border:1px solid var(--border-strong);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  cursor:pointer;
}
.keypad button:active{ background: var(--terracotta-tint); }

.actions{ display:grid; grid-template-columns:1fr 1fr; gap:1rem; }
.actions button{
  font-size:1.2rem;
  padding:1.1rem 0;
  border-radius:10px;
  border:none;
  color:#fff;
  font-family: var(--font-body);
  font-weight:500;
  cursor:pointer;
}
.btn-in{ background: var(--olive); }
.btn-in:hover{ background: var(--olive-dark); }
.btn-out{ background: var(--terracotta); }
.btn-out:hover{ background: var(--terracotta-dark); }
.btn-in:disabled, .btn-out:disabled{ opacity:0.5; cursor:not-allowed; }

.feedback{ margin-top:1.5rem; padding:1rem; border-radius:10px; font-size:1.15rem; min-height:1.5em; }
.feedback.success{ background: var(--success-bg); color: var(--success-ink); }
.feedback.error{ background: var(--danger-bg); color: var(--danger-ink); }

.pin-form{ display:flex; gap:0.6rem; max-width:340px; margin:0 auto; }
.pin-form input{
  flex:1;
  font-size:1.2rem;
  padding:0.6rem;
  border-radius:8px;
  border:1px solid var(--border-strong);
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
}

/* ---------- Responsive ---------- */
@media (max-width: 480px){
  .app-header .header-inner{ padding:20px 16px 0 16px; }
  .app-header .brand img{ width:64px; height:64px; }
  .app-nav{ flex-wrap:wrap; gap:14px; row-gap:8px; padding-bottom:12px; }
  .app-nav .logout-form{ position:static; margin-left:auto; }
  main{ padding:20px 16px 40px 16px; }
  .card{ padding:20px; }
}
