/* ============================================================
   Relevé d'heures — design system
   Pastel dreamy · glass · Fraunces + Manrope
   ============================================================ */

:root {
  --ink: #1f1b2e;
  --ink-soft: #5a5570;
  --muted: #8a8399;
  --violet: #8b7bd8;
  --violet-deep: #6f5fc4;
  --pink: #ff6b9d;
  --coral: #ff8b6b;

  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-tint-violet: rgba(139, 123, 216, 0.08);

  --danger: #e05a5a;
  --success: #4fb87a;

  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;

  --shadow-card: 0 10px 40px -12px rgba(80, 60, 120, 0.18);
  --shadow-fab: 0 20px 50px -15px rgba(139, 123, 216, 0.45);
  --shadow-sheet: 0 -20px 60px -15px rgba(80, 60, 120, 0.25);
}

/* ---------------- Reset ---------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
input[type="date"], input[type="time"], input[type="text"] { -webkit-appearance: none; appearance: none; }
ul, ol { list-style: none; }
/* `hidden` doit toujours masquer, même si une classe impose un display.
   Les sheets sont exclues : elles restent rendues hors écran pour garder leur animation. */
[hidden]:not(.sheet) { display: none !important; }

/* ---------------- Body / ambient ---------------- */
body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(ellipse 90% 60% at 15% 0%, #ffe0d0 0%, transparent 55%),
    radial-gradient(ellipse 80% 55% at 90% 10%, #ffd0e0 0%, transparent 55%),
    radial-gradient(ellipse 100% 70% at 100% 60%, #d8ccf5 0%, transparent 55%),
    radial-gradient(ellipse 90% 60% at 0% 100%, #c9d8f2 0%, transparent 55%),
    linear-gradient(180deg, #fce9df 0%, #eadcf3 55%, #d8dcf0 100%);
  background-attachment: fixed;
  padding-bottom: env(safe-area-inset-bottom);
}

/* Floating ambient orbs */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
  animation: float 18s ease-in-out infinite;
}
.orb-1 { width: 280px; height: 280px; background: #ffb8a8; top: -60px; left: -70px; }
.orb-2 { width: 340px; height: 340px; background: #c8b6f0; top: 40%; right: -120px; animation-delay: -6s; }
.orb-3 { width: 260px; height: 260px; background: #ffc0d8; bottom: -80px; left: 30%; animation-delay: -12s; }
@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(20px, -30px, 0) scale(1.05); }
}

/* ---------------- App layout ---------------- */
.app {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 20px 12px;
  padding-top: calc(env(safe-area-inset-top) + 20px);
}
.scroll-spacer { height: 140px; }

/* ---------------- Header ---------------- */
.header { margin-bottom: 22px; }
.greeting {
  font-size: 15px;
  color: var(--ink-soft);
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.month-title {
  flex: 1;
  text-align: center;
  line-height: 1;
}
.month-name {
  font-family: 'Fraunces', 'Times New Roman', serif;
  font-variation-settings: 'opsz' 144, 'SOFT' 30;
  font-weight: 500;
  font-size: 52px;
  color: var(--ink);
  letter-spacing: -0.03em;
  text-transform: capitalize;
  line-height: 0.95;
}
.month-year {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 144;
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  color: var(--violet-deep);
  margin-top: 4px;
  letter-spacing: -0.01em;
}

.nav-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: var(--ink-soft);
  display: grid; place-items: center;
  transition: transform 0.15s ease, background 0.2s;
}
.nav-btn:active { transform: scale(0.94); background: var(--glass-strong); }

.today-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
}
.today-chip:active { transform: scale(0.96); }

/* ---------------- Glass primitive ---------------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.glass-strong {
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}

/* ---------------- Bandeaux de rappel ---------------- */
.banners {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px 10px 14px;
  border-radius: var(--radius-md);
  animation: cardIn 0.4s ease both;
}
.banner-icon { font-size: 18px; flex-shrink: 0; }
.banner-text {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}
.banner-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.banner-btn {
  padding: 8px 13px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #9b8be8 0%, #8b7bd8 50%, #ff6b9d 130%);
  color: white;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 8px 20px -10px rgba(139, 123, 216, 0.6);
  transition: transform 0.12s ease;
}
.banner-btn:active { transform: scale(0.95); }
.banner-x {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--muted);
  flex-shrink: 0;
}
.banner-x:hover { background: rgba(80, 60, 120, 0.06); }

/* ---------------- Total card ---------------- */
.card { padding: 22px 24px; }
.total-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: cardIn 0.5s ease both;
  position: relative;
  overflow: hidden;
}
.total-card::before {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 107, 157, 0.18), transparent 70%);
  pointer-events: none;
}
.total-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--violet-deep);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.total-value {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 144;
  font-weight: 500;
  font-size: 48px;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
  margin-top: 2px;
}
.total-sub {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.total-absence-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 139, 107, 0.14);
  color: var(--coral);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  align-self: flex-start;
}

/* ---------------- Sites list ---------------- */
.sites {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.site-card {
  padding: 18px 20px;
  animation: cardIn 0.5s ease both;
}
.site-card:nth-child(2) { animation-delay: 0.05s; }
.site-card:nth-child(3) { animation-delay: 0.1s; }
.site-card:nth-child(4) { animation-delay: 0.15s; }
.site-card:nth-child(5) { animation-delay: 0.2s; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.site-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.site-badge {
  width: 40px; height: 40px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 20px;
  color: white;
  background: linear-gradient(135deg, var(--violet) 0%, var(--pink) 100%);
  letter-spacing: -0.02em;
  box-shadow: 0 6px 16px -6px rgba(139, 123, 216, 0.45);
  flex-shrink: 0;
}
.site-info { flex: 1; min-width: 0; }
.site-name {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 144;
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.site-total {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 20px;
  color: var(--violet-deep);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.entries {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.5);
  transition: background 0.15s;
}
.entry-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 42px;
  line-height: 1;
}
.entry-day {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.entry-month {
  font-size: 10px;
  font-weight: 700;
  color: var(--violet-deep);
  letter-spacing: 0.1em;
  margin-top: 2px;
}
.entry-body { flex: 1; min-width: 0; }
.entry-hours {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.entry-loc {
  font-size: 12px;
  color: var(--violet-deep);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entry-dur {
  font-size: 14px;
  font-weight: 700;
  color: var(--violet-deep);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.entry-note {
  margin-top: 3px;
  font-size: 12px;
  font-style: italic;
  line-height: 1.35;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
  /* 2 lignes max, la note complète reste lisible dans la sheet d'édition */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.entry-note-icon { margin-right: 4px; opacity: 0.75; }
.entry-note-icon svg { vertical-align: -1px; }

/* Absence entries */
.entry.entry-absence {
  background: rgba(255, 245, 235, 0.55);
  border: 1px solid rgba(255, 180, 140, 0.35);
}
.entry.entry-absence:hover { background: rgba(255, 200, 160, 0.22); }
.entry-absence-main {
  color: var(--ink-soft) !important;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.entry-motif-tag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--coral);
  background: rgba(255, 139, 107, 0.14);
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  white-space: nowrap;
}
.entry {
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.entry:hover { background: rgba(139, 123, 216, 0.09); }
.entry:active { transform: scale(0.98); }

.entry-edit,
.entry-del {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-soft);
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.entry-edit:hover, .entry-edit:active {
  color: var(--violet-deep);
  background: rgba(139, 123, 216, 0.12);
}
.entry-del { color: var(--muted); }
.entry-del:hover, .entry-del:active { color: var(--danger); background: rgba(224, 90, 90, 0.08); }

/* ---------------- Empty state ---------------- */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
}
.empty-emoji {
  font-family: 'Fraunces', serif;
  font-size: 60px;
  color: var(--violet);
  opacity: 0.6;
  margin-bottom: 8px;
}
.empty-title {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.empty-sub { font-size: 14px; color: var(--muted); }
.empty-sub b { color: var(--violet-deep); font-weight: 700; }

/* ---------------- Bottom bar ---------------- */
.bottom-bar {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-radius: 40px;
  box-shadow: 0 20px 50px -15px rgba(80, 60, 120, 0.3);
}
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  transition: transform 0.12s ease, background 0.2s;
  white-space: nowrap;
}
.pill-btn:active { transform: scale(0.95); }
.pill-btn:hover { background: rgba(139, 123, 216, 0.08); }

.primary-pill {
  background: linear-gradient(135deg, #9b8be8 0%, #8b7bd8 50%, #ff6b9d 130%);
  color: white;
  box-shadow: 0 12px 30px -10px rgba(139, 123, 216, 0.55);
}
.primary-pill:hover { background: linear-gradient(135deg, #a597ed 0%, #9282dd 50%, #ff7ba7 130%); }

.fab {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #9b8be8 0%, #8b7bd8 50%, #ff6b9d 130%);
  color: white;
  display: grid; place-items: center;
  box-shadow: var(--shadow-fab);
  transition: transform 0.15s ease;
}
.fab:active { transform: scale(0.92); }

/* ---------------- Scrim + sheets ---------------- */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(30, 20, 50, 0.32);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.scrim.show { opacity: 1; }

.sheet {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 100;
  background: linear-gradient(180deg, rgba(255,255,255,0.94) 0%, rgba(253,247,255,0.94) 100%);
  border-top-left-radius: 32px;
  border-top-right-radius: 32px;
  box-shadow: var(--shadow-sheet);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-top: 1px solid rgba(255, 255, 255, 0.7);
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0.24, 1);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.show { transform: translateY(0); }

.sheet-handle {
  width: 44px; height: 5px;
  background: rgba(80, 60, 120, 0.22);
  border-radius: 3px;
  margin: 10px auto 6px;
  flex-shrink: 0;
}
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px 6px;
  flex-shrink: 0;
}
.sheet-header h2 {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 144;
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.sheet-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(80, 60, 120, 0.06);
  color: var(--ink-soft);
  display: grid; place-items: center;
}
.sheet-close:active { transform: scale(0.92); }

.sheet-body {
  padding: 8px 24px 28px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---------------- Form ---------------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--violet-deep);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.field label .opt {
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0.02em;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.field-row .field { margin-bottom: 0; }

.field input[type="date"],
.field input[type="time"],
.field input[type="text"] {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(139, 123, 216, 0.22);
  background: rgba(255, 255, 255, 0.7);
  font-size: 15px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, background 0.15s;
}
.field textarea {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(139, 123, 216, 0.22);
  background: rgba(255, 255, 255, 0.7);
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  resize: none;
  transition: border-color 0.15s, background 0.15s;
}
.field textarea::placeholder { color: var(--muted); }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--violet);
  background: white;
}

/* Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.chip {
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(139, 123, 216, 0.2);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  transition: transform 0.12s, background 0.2s, color 0.2s, border-color 0.2s;
}
.chip:active { transform: scale(0.94); }
.chip.active {
  background: linear-gradient(135deg, var(--violet) 0%, var(--violet-deep) 100%);
  color: white;
  border-color: transparent;
  box-shadow: 0 6px 16px -6px rgba(139, 123, 216, 0.55);
}
.chip.active::before { content: '✓  '; }

/* Type toggle (Prestation / Absence) — segmented layout */
.chips-type {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 0;
}
.chips-type .chip {
  text-align: center;
  padding: 11px 12px;
}

/* Mode retrait des sites */
.link-btn {
  display: inline-block;
  margin: -2px 0 12px 2px;
  padding: 2px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--violet-deep);
  text-decoration: underline;
  text-decoration-color: rgba(111, 95, 196, 0.35);
  text-underline-offset: 3px;
}
.link-btn:active { opacity: 0.7; }
.chip-removable {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 14px;
  border-style: dashed;
  cursor: default;
}
.chip-removable:active { transform: none; }
.chip-x {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(224, 90, 90, 0.12);
  color: var(--danger);
  flex-shrink: 0;
  transition: background 0.15s, transform 0.12s;
}
.chip-x:hover { background: rgba(224, 90, 90, 0.2); }
.chip-x:active { transform: scale(0.9); }

.sites-empty {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(139, 123, 216, 0.08);
  border: 1px dashed rgba(139, 123, 216, 0.3);
  color: var(--ink-soft);
  font-size: 13px;
  margin-bottom: 10px;
}

.add-site-row {
  display: flex;
  gap: 8px;
}
.add-site-row input {
  flex: 1;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(139, 123, 216, 0.22);
  background: rgba(255, 255, 255, 0.7);
  font-size: 14px;
}
.add-site-row input:focus { outline: none; border-color: var(--violet); background: white; }
.mini-btn {
  padding: 11px 16px;
  border-radius: var(--radius-md);
  background: rgba(139, 123, 216, 0.14);
  color: var(--violet-deep);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s;
}
.mini-btn:active { transform: scale(0.96); }
.mini-btn:hover { background: rgba(139, 123, 216, 0.22); }

.duration-preview {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(139, 123, 216, 0.1);
  color: var(--violet-deep);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}

.form-error {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(224, 90, 90, 0.1);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 12px;
}

/* ---------------- Buttons ---------------- */
.primary-btn {
  width: 100%;
  padding: 15px 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #9b8be8 0%, #8b7bd8 50%, #ff6b9d 130%);
  color: white;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 20px 50px -15px rgba(139, 123, 216, 0.45);
  transition: transform 0.15s ease, box-shadow 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.primary-btn:active { transform: scale(0.98); }

.secondary-btn {
  padding: 15px 20px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(139, 123, 216, 0.22);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, background 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.secondary-btn:active { transform: scale(0.98); }
.secondary-btn.strong {
  background: rgba(139, 123, 216, 0.12);
  border-color: transparent;
  color: var(--violet-deep);
}

.danger-btn {
  padding: 15px 20px;
  border-radius: var(--radius-md);
  background: var(--danger);
  color: white;
  font-size: 15px;
  font-weight: 700;
  transition: transform 0.15s ease;
}
.danger-btn:active { transform: scale(0.98); }

.danger-soft-btn {
  padding: 15px 20px;
  border-radius: var(--radius-md);
  background: rgba(224, 90, 90, 0.1);
  color: var(--danger);
  font-size: 15px;
  font-weight: 700;
  transition: transform 0.15s ease, background 0.2s;
}
.danger-soft-btn:hover { background: rgba(224, 90, 90, 0.16); }
.danger-soft-btn:active { transform: scale(0.98); }

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}
.btn-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}
.btn-col > * { width: 100%; }

/* Sheet de choix empilée au-dessus des autres sheets */
.scrim-top { z-index: 110; }
.sheet-top { z-index: 120; }
.choice-text { white-space: pre-line; line-height: 1.45; }
.confirm-text {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(139, 123, 216, 0.08);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 16px;
}

/* ---------------- Tabs / preview ---------------- */
.sheet-lg { max-height: 90vh; }
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(139, 123, 216, 0.08);
  border-radius: var(--radius-pill);
  margin-bottom: 14px;
}
.tab {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: all 0.2s;
}
.tab.active {
  background: white;
  color: var(--violet-deep);
  box-shadow: 0 2px 8px -2px rgba(80, 60, 120, 0.15);
}

/* Interrupteur (switch) */
.switch-row {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.switch-row input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
  pointer-events: none;
}
.switch {
  position: relative;
  width: 38px; height: 22px;
  border-radius: var(--radius-pill);
  background: rgba(139, 123, 216, 0.22);
  flex-shrink: 0;
  transition: background 0.2s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(80, 60, 120, 0.3);
  transition: transform 0.2s ease;
}
.switch-row input:checked + .switch {
  background: linear-gradient(135deg, var(--violet) 0%, var(--violet-deep) 100%);
}
.switch-row input:checked + .switch::after { transform: translateX(16px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--violet); outline-offset: 2px; }

.preview {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(139, 123, 216, 0.18);
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 45vh;
  overflow-y: auto;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  background: var(--success);
  color: white;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 12px 30px -8px rgba(79, 184, 122, 0.5);
  animation: toastIn 0.3s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------------- History ---------------- */
.hint {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 16px;
  line-height: 1.5;
}
.backup-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: rgba(79, 184, 122, 0.12);
  color: #2f8a57;
  font-size: 13px;
  font-weight: 700;
}
.backup-status::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.backup-status.stale {
  background: rgba(255, 139, 107, 0.14);
  color: #d0603f;
}
.history { margin: 22px 0 4px; }
.history-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--violet-deep);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.6);
  font-size: 14px;
}
.history-month {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  font-size: 16px;
  text-transform: capitalize;
}
.history-total { color: var(--violet-deep); font-weight: 700; }

/* ---------------- Save toast (global) ---------------- */
.save-toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 96px);
  transform: translateX(-50%);
  z-index: 200;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  background: var(--success);
  color: white;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 15px 40px -10px rgba(79, 184, 122, 0.5);
  pointer-events: none;
  animation: saveToastIn 0.35s cubic-bezier(0.32, 0.72, 0.24, 1);
}
@keyframes saveToastIn {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Edit-mode badge next to sheet title */
.edit-badge {
  display: inline-grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(139, 123, 216, 0.15);
  color: var(--violet-deep);
  margin-right: 6px;
  vertical-align: -6px;
}

/* ---------------- Responsive tweaks ---------------- */
@media (min-width: 620px) {
  .month-name { font-size: 64px; }
  .total-value { font-size: 56px; }
}
