/* ═══════════════════════════════════════════════════════════════════════
   THMG Timesheet — Feuille de style
   Palette & typographie : The Honourable Merchants Group Brand Guidelines
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Google Fonts : Source Serif 4 + Source Sans 3 ─────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,500;0,8..60,600;0,8..60,700;1,8..60,400&family=Source+Sans+3:wght@300;400;500;600;700&display=swap');

/* ── Variables de marque THMG ───────────────────────────────────────────── */
:root {
  /* Couleurs primaires */
  --purple-deep:    #3D275C;
  --purple-mid:     #6E5690;
  --purple-light:   #AC9BC4;
  --beige-sand:     #D4C2AC;
  --beige-mid:      #FAE8D2;
  --beige-light:    #FFF4E6;
  --black-90:       #1A1A1A;
  --black-mid:      #4D4D4D;
  --black-light:    #8C8C8C;
  --green-olive:    #394537;
  --green-mid:      #5C6F57;
  --green-light:    #93A68D;

  /* Palette étendue */
  --white:          #FFFFFF;
  --white-off:      #FCFCFC;
  --white-grey:     #F4F4F4;
  --white-light:    #DEDEDE;
  --grey-pearl:     #74807D;
  --grey-pearl-mid: #A4B3AF;

  /* Couleurs secondaires (≤10 %) */
  --red-dark:       #76201B;
  --red-mid:        #B4372F;
  --red-light:      #FDECEA;
  --yellow-naples:  #FBDC70;
  --yellow-light:   #FBF8E0;

  /* Alias sémantiques */
  --primary:        var(--purple-deep);
  --primary-dark:   #2D1A45;
  --primary-mid:    var(--purple-mid);
  --primary-light:  var(--beige-light);
  --secondary:      var(--green-olive);
  --secondary-light: var(--beige-mid);
  --success:        var(--green-olive);
  --success-mid:    var(--green-mid);
  --success-light:  #E8F0E6;
  --danger:         var(--red-mid);
  --danger-light:   var(--red-light);
  --warning:        var(--yellow-naples);
  --warning-light:  var(--yellow-light);
  --text:           var(--black-90);
  --text-muted:     var(--black-mid);
  --text-light:     var(--black-light);
  --border:         var(--white-light);
  --bg:             var(--white-grey);
  --bg-hover:       var(--beige-light);
  --bg-warm:        var(--beige-mid);
  --weekend-bg:     var(--beige-light);
  --weekend-text:   var(--black-mid);

  /* Ombres */
  --shadow-sm:  0 2px 8px  rgba(26,26,26,.07);
  --shadow-md:  0 4px 16px rgba(26,26,26,.10);
  --shadow-lg:  0 16px 48px rgba(26,26,26,.15);

  /* Rayons (sobres, per brand) */
  --radius:     8px;
  --radius-sm:  4px;
}

/* ── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Source Sans 3', 'Source Sans Pro', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

/* Titres, labels de marque → Source Serif */
h1, h2, h3, h4,
.navbar-brand-label,
.modal-title,
.month-title,
.card-title,
.login-header h1,
.stat-value {
  font-family: 'Source Serif 4', 'Source Serif', Georgia, serif;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-mid); text-decoration: underline; }

/* ── Navbar ─────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--white);
  height: 68px;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 0 var(--border);
  border-bottom: 3px solid var(--primary);
  position: sticky;
  top: 0;
  z-index: 200;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
  cursor: pointer;
  text-decoration: none;
}
.navbar-brand img {
  height: 48px;
  width: auto;
  display: block;
}
.navbar-brand-sep {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
}
.navbar-brand-label {
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .15em;
  text-transform: uppercase;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.navbar-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
  margin-right: .25rem;
}
.navbar-user strong { font-size: .875rem; color: var(--text); }
#userEmail { font-size: .75rem; color: var(--text-muted); }

/* Bouton hamburger (mobile) */
.navbar-hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .4rem .5rem;
  cursor: pointer;
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}
.navbar-hamburger:hover { background: var(--bg-hover); }

/* Drawer mobile */
.mobile-drawer {
  display: none;
  position: fixed;
  top: 68px;
  right: 0;
  width: min(280px, 90vw);
  height: calc(100vh - 68px);
  background: var(--white);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 190;
  flex-direction: column;
  padding: 1.5rem 1.25rem;
  gap: .5rem;
  overflow-y: auto;
}
.mobile-drawer.open { display: flex; }
.mobile-drawer-user {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .5rem;
}
.mobile-drawer-user strong { display: block; font-size: .9375rem; }
.mobile-drawer-user span  { font-size: .8125rem; color: var(--text-muted); }
.mobile-drawer .btn { width: 100%; justify-content: flex-start; min-height: 44px; }

/* Scrim */
.drawer-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,26,26,.4);
  z-index: 180;
}
.drawer-scrim.open { display: block; }

/* ── Container ──────────────────────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: 'Source Sans 3', sans-serif;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease-out, color .15s ease-out, box-shadow .15s ease-out;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
  min-height: 36px;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-mid);
  border-color: var(--primary-mid);
}
.btn-primary:active:not(:disabled) {
  background: var(--black-90);
  border-color: var(--black-90);
}

.btn-outline {
  background: var(--white);
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover:not(:disabled) {
  background: var(--beige-light);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border-color: var(--white-light);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--beige-light);
  border-color: var(--beige-sand);
}

.btn-secondary {
  background: var(--white);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); }

.btn-danger {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: var(--red-dark); border-color: var(--red-dark); }

.btn-success {
  background: var(--success);
  color: var(--white);
  border-color: var(--success);
}
.btn-success:hover:not(:disabled) { background: var(--green-mid); }

.btn-sm   { padding: .3rem .7rem;  font-size: .8rem;   min-height: 32px; }
.btn-xs   { padding: .2rem .5rem;  font-size: .75rem;  min-height: 28px; }
.btn-lg   { padding: .7rem 1.4rem; font-size: 1rem;    min-height: 48px; }
.btn-icon { padding: .3rem .45rem; }
.btn-block { width: 100%; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: .375rem;
  color: var(--text);
}

.form-control {
  display: block;
  width: 100%;
  padding: .625rem .875rem;
  font-size: .9375rem;
  font-family: 'Source Sans 3', sans-serif;
  border: 1px solid var(--white-light);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  transition: border-color .15s ease-out, box-shadow .15s ease-out;
  min-height: 48px;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(61,39,92,.12);
}
.form-control::placeholder { color: var(--black-light); }
.form-control:disabled { background: var(--bg); cursor: not-allowed; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}
.alert-danger  { background: var(--danger-light);  color: var(--red-dark);   border: 1px solid #F5C2BF; }
.alert-success { background: var(--success-light); color: var(--green-olive); border: 1px solid #BDD4BA; }
.alert-warning { background: var(--warning-light); color: #5C4200;            border: 1px solid #F5DC8A; }
.alert-info    { background: var(--beige-light);   color: var(--primary);    border: 1px solid var(--beige-sand); }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .15rem .6rem;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: .02em;
}
.badge-success { background: var(--success-light); color: var(--green-olive); }
.badge-danger  { background: var(--danger-light);  color: var(--red-dark); }
.badge-warning { background: var(--warning-light); color: #5C4200; }
.badge-info    { background: var(--beige-light);   color: var(--primary); border: 1px solid var(--beige-sand); }
.badge-gray    { background: var(--white-grey);    color: var(--text-muted); }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-title { font-size: 1rem; font-weight: 600; }
.card-body  { padding: 1.5rem; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,26,26,.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  animation: modalIn .2s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: none; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .01em;
}
.modal-body   { padding: 1.5rem; overflow-y: auto; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.125rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: .35rem .45rem;
  border-radius: var(--radius-sm);
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-close:hover { background: var(--bg); color: var(--text); }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--primary);
  color: var(--white);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .75rem 1rem;
  text-align: left;
  white-space: nowrap;
}
tbody td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
  vertical-align: middle;
}
tbody tr:nth-child(even) td { background: var(--beige-light); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--beige-mid); }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: .75rem 1.25rem;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
  user-select: none;
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.tab:hover  { color: var(--text); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* ── Login Page ──────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  padding: 1.5rem;
}

/* Motif de fond subtil (compass géométrique) */
.login-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle at 70% 30%, rgba(172,155,196,.12) 0%, transparent 60%),
                    radial-gradient(circle at 20% 80%, rgba(57,69,55,.10) 0%, transparent 50%);
  pointer-events: none;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo {
  display: flex;
  justify-content: center;
  margin: 0 auto 1.5rem;
}
.login-logo img { height: 80px; width: auto; }

.login-divider {
  width: 40px;
  height: 2px;
  background: var(--beige-sand);
  margin: 1rem auto .875rem;
}
.login-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .01em;
}
.login-header p { color: var(--text-muted); font-size: .875rem; margin-top: .25rem; }

/* ── Timesheet Page ──────────────────────────────────────────────────────── */
.month-nav {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.month-title {
  font-size: 1.05rem;
  font-weight: 600;
  min-width: 180px;
  text-align: center;
  flex: 1;
  letter-spacing: .01em;
}

.summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  margin-bottom: 1.25rem;
  color: var(--white);
}
.summary-bar .label { font-size: .875rem; color: rgba(255,255,255,.8); font-weight: 500; }
.summary-bar .total { font-size: 1.5rem; font-weight: 700; font-family: 'Source Serif 4', serif; }

.locked-banner {
  display: flex;
  align-items: center;
  gap: .625rem;
  background: var(--danger-light);
  border: 1px solid #F5C2BF;
  color: var(--red-dark);
  border-radius: var(--radius);
  padding: .875rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: .875rem;
}
.locked-banner .icon { font-size: 1.1rem; flex-shrink: 0; }

/* ── Sélecteur de vue ────────────────────────────────────────────────────── */
.view-switcher {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
  overflow-x: auto;
}
.view-btn {
  padding: .3rem .65rem;
  border: none;
  border-radius: calc(var(--radius-sm) - 1px);
  font-size: .8125rem;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: all .15s ease-out;
  white-space: nowrap;
  min-height: 32px;
}
.view-btn:hover { color: var(--text); background: rgba(26,26,26,.04); }
.view-btn.active {
  background: var(--white);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ── Day Cards (vue liste) ───────────────────────────────────────────────── */
.day-list { display: flex; flex-direction: column; gap: .5rem; }

.day-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s ease-out;
}
.day-card:hover { box-shadow: var(--shadow-md); }

.day-header {
  display: flex;
  align-items: center;
  padding: .625rem 1rem;
  background: var(--white-grey);
  border-bottom: 1px solid var(--border);
  gap: .75rem;
}
.day-header.weekend { background: var(--beige-light); }

.day-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--beige-mid);
  color: var(--primary);
  font-weight: 700;
  font-size: .875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: 'Source Serif 4', serif;
}
.day-header.weekend .day-num { background: var(--beige-sand); color: var(--black-mid); }
.day-num.is-today { background: var(--primary); color: var(--white); }

.day-label { flex: 1; }
.day-name  { font-weight: 600; font-size: .875rem; }
.day-date  { font-size: .75rem; color: var(--text-muted); }

.day-hours { font-size: .875rem; font-weight: 600; color: var(--text-muted); margin-left: auto; }
.day-hours.has-hours { color: var(--primary); }

/* ── Entry rows inside day card ──────────────────────────────────────────── */
.entry-list { padding: .25rem 0; }

.entry-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background .1s ease-out;
}
.entry-row:last-child { border-bottom: none; }
.entry-row:hover { background: var(--bg-hover); }

.entry-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--beige-sand);
  border: 2px solid var(--primary);
  flex-shrink: 0;
}

.entry-task  { flex: 1; font-size: .875rem; color: var(--text); min-width: 0; }
.entry-hours {
  font-size: .875rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 48px;
  text-align: right;
  font-family: 'Source Serif 4', serif;
}
.entry-actions {
  display: flex;
  gap: .25rem;
  opacity: 0;
  transition: opacity .15s;
  flex-shrink: 0;
}
.entry-row:hover .entry-actions { opacity: 1; }

.btn-add-entry {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .625rem 1rem;
  color: var(--text-muted);
  font-size: .8125rem;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: color .15s, background .15s;
  min-height: 44px;
  font-family: 'Source Sans 3', sans-serif;
}
.btn-add-entry:hover { color: var(--primary); background: var(--beige-light); }

/* ── Loading / Empty states ──────────────────────────────────────────────── */
.spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem;
  color: var(--text-muted);
  font-size: .875rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.empty-state h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .375rem;
  font-family: 'Source Serif 4', serif;
}

/* ── Admin Page ──────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.toolbar-left { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}
.stat-card .stat-label { font-size: .8125rem; color: var(--text-muted); margin-top: .25rem; }

.timesheet-grid {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.timesheet-row {
  display: flex;
  align-items: center;
  padding: .875rem 1rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  gap: 1rem;
  font-size: .875rem;
  flex-wrap: wrap;
}
.timesheet-row .user-info { flex: 1; min-width: 120px; }
.timesheet-row .user-name { font-weight: 600; }
.timesheet-row .user-email { color: var(--text-muted); font-size: .8125rem; }
.timesheet-row .ts-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Utilities ───────────────────────────────────────────────────────────── */
.text-muted   { color: var(--text-muted); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-primary { color: var(--primary); }
.text-small   { font-size: .8125rem; }
.fw-600       { font-weight: 600; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.flex-1 { flex: 1; }

/* ── Divider ─────────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* ── Toast notifications ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .75rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: .875rem;
  min-width: 260px;
  max-width: 360px;
  animation: toastIn .2s ease-out;
  pointer-events: all;
}
.toast-success { background: var(--green-olive); color: var(--white); }
.toast-error   { background: var(--red-dark);    color: var(--white); }
.toast-warning { background: #5C4200;             color: var(--white); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(1.5rem); }
  to   { opacity: 1; transform: none; }
}

/* ── Password hint ───────────────────────────────────────────────────────── */
.pwd-hint { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; display: block; }

/* ═════════════════════════════════════════════════════════════════════════
   VUE SEMAINE
═════════════════════════════════════════════════════════════════════════ */
.week-wrapper { overflow-x: auto; }

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: .5rem;
  min-width: 560px;
}
.week-col {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 200px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .15s ease-out;
}
.week-col:hover { box-shadow: var(--shadow-md); }

.week-col-header {
  padding: .5rem .4rem;
  text-align: center;
  background: var(--white-grey);
  border-bottom: 1px solid var(--border);
}
.week-col-header.weekend { background: var(--beige-light); }
.week-col-header.today   { background: var(--primary); }
.week-col-header.today .week-col-day-name,
.week-col-header.today .week-col-day-num { color: var(--white); }

.week-col-day-name {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  font-weight: 600;
}
.week-col-day-num {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  margin: .1rem 0;
  font-family: 'Source Serif 4', serif;
}

.week-col-body {
  flex: 1;
  padding: .375rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  overflow-y: auto;
  max-height: 260px;
}
.week-entry-pill {
  font-size: .7rem;
  padding: .25rem .4rem;
  background: var(--beige-light);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer;
  transition: background .1s;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .25rem;
  line-height: 1.3;
}
.week-entry-pill:hover { background: var(--beige-mid); }
.week-entry-pill.locked { background: var(--white-grey); border-left-color: var(--grey-pearl-mid); cursor: default; }
.week-entry-text  { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-entry-hours { font-weight: 700; color: var(--primary); flex-shrink: 0; font-size: .65rem; font-family: 'Source Serif 4', serif; }
.week-entry-pill.locked .week-entry-hours { color: var(--text-muted); }

.week-col-footer {
  padding: .375rem .5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white-grey);
  gap: .25rem;
}
.week-day-total { font-size: .75rem; font-weight: 700; color: var(--text-muted); }
.week-day-total.has-hours { color: var(--primary); }
.week-add-btn {
  font-size: .7rem;
  padding: .25rem .4rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: all .1s;
  white-space: nowrap;
  min-height: 28px;
  font-family: 'Source Sans 3', sans-serif;
}
.week-add-btn:hover { background: var(--beige-light); border-color: var(--beige-sand); color: var(--primary); }

/* ═════════════════════════════════════════════════════════════════════════
   VUE MENSUELLE
═════════════════════════════════════════════════════════════════════════ */
.month-cal-grid {
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  box-shadow: var(--shadow-sm);
}
.month-cal-header {
  background: var(--primary);
  color: var(--white);
  text-align: center;
  padding: .5rem .25rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.month-cal-cell {
  background: var(--white);
  min-height: 88px;
  padding: .375rem .4rem;
  cursor: pointer;
  transition: background .12s;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.month-cal-cell:hover { background: var(--beige-light); }
.month-cal-cell.other-month { background: var(--white-grey); cursor: default; }
.month-cal-cell.other-month:hover { background: var(--white-grey); }
.month-cal-cell.weekend { background: var(--beige-light); }
.month-cal-cell.weekend:hover { background: var(--beige-mid); }
.month-cal-cell.today { background: #FFF0D6; }
.month-cal-cell.locked { cursor: default; }

.month-cal-num {
  font-size: .8125rem;
  font-weight: 700;
  color: var(--text);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  font-family: 'Source Serif 4', serif;
}
.month-cal-num.is-today {
  background: var(--primary);
  color: var(--white);
}
.month-cal-cell.other-month .month-cal-num { color: var(--grey-pearl-mid); font-weight: 400; }

.month-cal-hours {
  font-size: .7rem;
  font-weight: 700;
  color: var(--primary);
  padding: 0 .15rem;
  font-family: 'Source Serif 4', serif;
}
.month-cal-cell.other-month .month-cal-hours { display: none; }

.month-entry-pill {
  font-size: .65rem;
  padding: .15rem .3rem;
  background: var(--beige-mid);
  color: var(--black-mid);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.3;
}
.month-entry-more {
  font-size: .65rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 0 .15rem;
}

/* ── Modale détail du jour ────────────────────────────────────────────────── */
.day-detail-header {
  display: flex;
  align-items: baseline;
  gap: .75rem;
}
.day-detail-date  { font-weight: 700; font-size: 1rem; font-family: 'Source Serif 4', serif; }
.day-detail-total { font-size: .875rem; color: var(--text-muted); }

.day-detail-entries { display: flex; flex-direction: column; gap: .375rem; margin: .75rem 0; }
.day-detail-entry {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .625rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
}
.day-detail-entry-task    { flex: 1; min-width: 0; }
.day-detail-entry-hours   { font-weight: 700; color: var(--primary); font-family: 'Source Serif 4', serif; }
.day-detail-entry-actions { display: flex; gap: .25rem; flex-shrink: 0; }

.day-empty { text-align: center; padding: 1.25rem; color: var(--text-muted); font-size: .875rem; }

/* ═════════════════════════════════════════════════════════════════════════
   VUE PAR TÂCHE
═════════════════════════════════════════════════════════════════════════ */
.task-view-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: var(--white);
  border: 1px solid var(--border);
}
.task-view-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  min-width: 420px;
}
.task-view-table thead tr { background: var(--primary); color: var(--white); }
.task-view-table thead th {
  padding: .625rem .875rem;
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  border-right: 1px solid rgba(255,255,255,.15);
  white-space: nowrap;
}
.task-view-table thead th:last-child { border-right: none; }
.tv-col-task  { text-align: left; width: 99%; }
.tv-col-week  { text-align: center; min-width: 90px; }
.tv-col-total { text-align: right;  min-width: 90px; }

.task-view-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.task-view-table tbody tr:hover { background: var(--beige-light); }
.task-view-table tbody tr.tv-alt { background: var(--white-grey); }
.task-view-table tbody tr.tv-alt:hover { background: var(--beige-light); }

.tv-task-desc {
  padding: .625rem .875rem;
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tv-hours {
  padding: .625rem .875rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  white-space: nowrap;
}
.tv-total {
  padding: .625rem .875rem;
  text-align: right;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-family: 'Source Serif 4', serif;
}
.task-view-table tfoot tr.tv-footer-row {
  background: var(--beige-mid);
  border-top: 2px solid var(--beige-sand);
}
.tv-footer-label {
  font-weight: 700;
  font-size: .8125rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--primary);
}
.tv-footer-h {
  font-weight: 700;
  color: var(--primary);
  font-family: 'Source Serif 4', serif;
}

/* ═════════════════════════════════════════════════════════════════════════
   LISTES DE TÂCHES (bibliothèque, clients)
═════════════════════════════════════════════════════════════════════════ */
.task-list { display: flex; flex-direction: column; gap: .375rem; }

.task-item {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .625rem .875rem;
  background: var(--white-grey);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background .1s;
  min-height: 48px;
}
.task-item:hover { background: var(--beige-light); border-color: var(--beige-sand); }
.task-item-icon  { font-size: 1rem; flex-shrink: 0; }
.task-item-info  { flex: 1; min-width: 0; }
.task-item-desc  {
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-item-hours  { font-size: .75rem; color: var(--text-muted); }
.task-item-actions { display: flex; gap: .25rem; flex-shrink: 0; }
.task-edit-row { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.task-edit-row .form-control { flex: 1; min-width: 0; }
.empty-tasks { text-align: center; padding: 2rem 1rem; color: var(--text-muted); font-size: .875rem; }
.empty-tasks .empty-icon { font-size: 2rem; margin-bottom: .5rem; }

/* ═════════════════════════════════════════════════════════════════════════
   TOGGLE SWITCH (paramètres admin)
═════════════════════════════════════════════════════════════════════════ */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .875rem 1rem;
  background: var(--white-grey);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.toggle-info { flex: 1; min-width: 0; }
.toggle-label { font-size: .875rem; font-weight: 600; color: var(--text); }
.toggle-sub   { font-size: .8rem; margin-top: .2rem; color: var(--text-muted); }

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--grey-pearl-mid);
  border-radius: 24px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(26,26,26,.25);
}
.toggle-switch input:checked + .toggle-slider             { background: var(--green-olive); }
.toggle-switch input:checked + .toggle-slider::before     { transform: translateX(20px); }
.toggle-switch input:focus  + .toggle-slider              { box-shadow: 0 0 0 3px rgba(57,69,55,.2); }

/* ═════════════════════════════════════════════════════════════════════════
   ENTRÉES ENRICHIES (type tâche + client + description)
═════════════════════════════════════════════════════════════════════════ */
.entry-task-wrap {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.entry-task-type {
  font-weight: 600;
  color: var(--text);
  font-size: .875rem;
}
.entry-client-badge {
  display: inline-flex;
  align-items: center;
  padding: .1rem .5rem;
  background: var(--beige-mid);
  color: var(--black-mid);
  border-radius: var(--radius-sm);
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid var(--beige-sand);
}
.entry-desc-text {
  font-size: .8125rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}
.week-entry-client {
  font-size: .6rem;
  font-weight: 600;
  color: var(--black-mid);
  background: var(--beige-sand);
  border-radius: 2px;
  padding: 0 .3rem;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Overflow horizontal pour vue semaine */
.week-wrapper { overflow-x: auto; }

/* ── Dropdown tâches enregistrées ─────────────────────────────────────── */
.task-select-wrap {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--border);
}
.task-select-label {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .4rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
#templateSelect {
  width: 100%;
  padding: .5rem .875rem;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  background: var(--beige-light);
  color: var(--primary);
  cursor: pointer;
  font-weight: 500;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%233D275C' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .875rem center;
  padding-right: 2.25rem;
  min-height: 44px;
}
#templateSelect:focus { outline: none; box-shadow: 0 0 0 3px rgba(61,39,92,.12); }
.task-select-footer { display: flex; justify-content: flex-end; margin-top: .375rem; }
.task-manage-link {
  font-size: .75rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: 'Source Sans 3', sans-serif;
}
.task-manage-link:hover { color: var(--primary); }

.save-task-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .625rem .875rem;
  background: var(--white-grey);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: .5rem;
  cursor: pointer;
  user-select: none;
  transition: background .1s;
}
.save-task-row:hover { background: var(--beige-light); border-color: var(--beige-sand); }
.save-task-row input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }
.save-task-row label { font-size: .8125rem; color: var(--text-muted); cursor: pointer; flex: 1; }
.save-task-row:has(input:checked) { background: var(--beige-light); border-color: var(--beige-sand); }
.save-task-row:has(input:checked) label { color: var(--primary); font-weight: 500; }

/* ── Bannière verrouillé ─────────────────────────────────────────────────── */
.locked-banner {
  display: flex;
  align-items: center;
  gap: .625rem;
  background: var(--danger-light);
  border: 1px solid #F5C2BF;
  color: var(--red-dark);
  border-radius: var(--radius);
  padding: .875rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: .875rem;
}

/* ═════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile first
═════════════════════════════════════════════════════════════════════════ */

/* Masquer actions d'entrée sur mobile (toujours visibles) */
@media (hover: none) {
  .entry-actions { opacity: 1; }
}

@media (max-width: 768px) {
  /* Container */
  .container { padding: 0 1rem; margin: 1rem auto; }

  /* Navbar */
  .navbar { padding: 0 1rem; height: 60px; }
  .navbar-brand img { height: 40px; }
  .navbar-brand-label { display: none; }
  .navbar-brand-sep   { display: none; }

  /* Masquer les actions desktop, afficher hamburger */
  .navbar-actions > *:not(.navbar-hamburger) { display: none; }
  .navbar-hamburger { display: flex; }

  /* Mobile drawer décalé pour la hauteur du navbar */
  .mobile-drawer { top: 60px; height: calc(100vh - 60px); }

  /* Mois nav */
  .month-nav {
    padding: .625rem .875rem;
    gap: .5rem;
  }
  .month-title { min-width: unset; font-size: .95rem; }

  /* Summary bar */
  .summary-bar { padding: .875rem 1rem; }
  .summary-bar .total { font-size: 1.25rem; }

  /* Vues */
  .view-switcher { flex-shrink: 1; }
  .view-btn { padding: .3rem .45rem; font-size: .75rem; }

  /* Day cards */
  .day-header { padding: .5rem .875rem; }
  .entry-row  { padding: .5rem .875rem; }
  .btn-add-entry { padding: .5rem .875rem; }

  /* Modales — bottom sheet sur mobile */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 92vh;
    animation: modalUp .25s ease-out;
  }
  @keyframes modalUp {
    from { opacity: 0; transform: translateY(2rem); }
    to   { opacity: 1; transform: none; }
  }

  /* Tables */
  .form-row       { grid-template-columns: 1fr; }
  .form-row.three { grid-template-columns: 1fr; }

  /* Tabs scrollables */
  .tabs { gap: 0; }
  .tab  { padding: .625rem 1rem; font-size: .8125rem; }

  /* Stat cards */
  .stat-cards { grid-template-columns: repeat(2, 1fr); }

  /* Admin timesheet rows */
  .timesheet-row { flex-direction: column; align-items: flex-start; gap: .625rem; }

  /* Toast */
  #toast-container { left: 1rem; right: 1rem; bottom: 1rem; }
  .toast { min-width: unset; max-width: 100%; }

  /* Week grid min-width pour scroll */
  .week-grid { grid-template-columns: repeat(7, minmax(80px, 1fr)); }

  /* Vue mensuelle */
  .month-cal-cell { min-height: 60px; padding: .25rem; }
  .month-entry-pill { display: none; }
  .month-cal-header { font-size: .65rem; padding: .4rem .1rem; letter-spacing: .04em; }
}

@media (max-width: 480px) {
  .login-card { padding: 2rem 1.25rem; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .view-btn   { font-size: .7rem; padding: .25rem .35rem; }
  .week-grid  { grid-template-columns: repeat(7, 76px); }
  .month-cal-cell { min-height: 48px; }
}

/* Gros écrans */
@media (min-width: 1200px) {
  .week-col-body { max-height: 320px; }
}
