/* ================================================================
   STYLES — RHA Rapports (CSS original, sans Pico)
   ================================================================ */

:root {
  --bg:            #08111f;
  --surface:       #101c2e;
  --card:          rgba(17,27,45,.82);
  --border:        rgba(162,181,214,.16);
  --border-strong: rgba(177,193,222,.28);
  --text:          #eef4ff;
  --muted:         #8ea2c5;
  --primary:       #4f8cff;
  --primary-2:     #6ea5ff;
  --danger:        #f0677d;
  --success:       #3ecf8e;
  --warning:       #ffbf5f;
  --nc-red:        #ff5c7a;
  --nc-red-bg:     rgba(255,92,122,.14);
  --nc-red-bd:     rgba(255,92,122,.32);
  --ok-green:      #3ecf8e;
  --ok-green-bg:   rgba(62,207,142,.13);
  --ok-green-bd:   rgba(62,207,142,.30);
  --shadow:        0 16px 42px rgba(0,0,0,.32);
  --radius:        22px;
  --radius-sm:     14px;
  --topbar-h:      64px;
  --nav-h:         80px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: hidden; }
html, body {
  margin: 0;
  background: radial-gradient(circle at top, #102340 0%, #08111f 48%, #050b15 100%);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, select, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

#pinScreen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.pin-card {
  width: min(100%, 360px); padding: 36px 28px 32px;
  border-radius: var(--radius);
  background: var(--card);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.pin-logo     { font-size: 40px; margin-bottom: 12px; line-height: 1; }
.pin-title    { font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.pin-subtitle { font-size: 13px; color: var(--muted); margin-bottom: 24px; line-height: 1.5; }
.pin-input {
  width: 100%; text-align: center; font-size: 28px; font-weight: 800;
  letter-spacing: .3em; padding: 16px 18px; border-radius: var(--radius-sm);
  border: 1px solid rgba(110,165,255,.35); background: rgba(8,16,31,.80);
  color: var(--text); outline: none; margin-bottom: 10px;
  transition: border-color .18s, box-shadow .18s;
}
.pin-input:focus {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 4px rgba(79,140,255,.14);
}
.pin-input::placeholder { letter-spacing: .12em; font-size: 16px; color: var(--muted); font-weight: 600; }
.pin-error {
  min-height: 20px; font-size: 13px; font-weight: 700;
  color: var(--nc-red); margin-bottom: 10px; text-align: center; line-height: 1.4; width: 100%;
}

#appShell {
  padding-bottom: calc(var(--nav-h) + 32px + env(safe-area-inset-bottom));
}
.glass, .glass-card, .card, .control-card,
.calendar-card, .form-card, .soft-card, .planning-card, .dashboard-card {
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow);
}

.top-bar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  background: rgba(8,14,26,.88);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.top-title { font-size: 17px; font-weight: 800; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid rgba(177,193,222,.14); background: rgba(255,255,255,.04);
  color: var(--text); display: grid; place-items: center; transition: .15s background;
}
.icon-btn:active { background: rgba(255,255,255,.12); }

#mainContent {
  padding: 14px 14px calc(var(--nav-h) + 40px + env(safe-area-inset-bottom));
}
.view-section  { padding-bottom: 14px; }
.view-title    { margin: 12px 0 4px; font-size: 22px; font-weight: 800; }
.view-subtitle { margin: 0 0 14px; }

.card, .control-card, .calendar-card, .form-card, .soft-card,
.dashboard-card, .planning-card {
  border-radius: var(--radius); padding: 16px;
}
.soft-card {
  min-height: 88px; display: grid; place-items: center;
  text-align: center; color: var(--muted); font-size: 14px;
}
.section-title {
  margin: 20px 0 12px; padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border: 1px solid rgba(167,183,211,.14);
  font-size: 12px; font-weight: 800; letter-spacing: .10em;
  text-transform: uppercase; color: #dbe6fb;
}

.label { font-size: 12px; color: #9fb0cb; margin: 0 0 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.req   { color: #ff8fa0; }
.input, select, textarea {
  width: 100%; border-radius: var(--radius-sm);
  border: 1px solid rgba(168,184,211,.22);
  background: rgba(8,16,31,.76); color: var(--text);
  padding: 14px 15px; min-height: 52px; outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s; font-size: 15px;
}
.input:focus, select:focus, textarea:focus {
  border-color: rgba(110,165,255,.58);
  box-shadow: 0 0 0 4px rgba(79,140,255,.12);
  background: rgba(10,20,40,.88);
}
.field-row { display: grid; gap: 12px; margin-bottom: 16px; }

.btn {
  min-height: 52px; padding: 0 20px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-weight: 800; font-size: 15px;
  background: #253450; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: .18s transform, .18s box-shadow, .18s background;
}
.btn:active    { transform: scale(.97); }
.btn-primary   { background: linear-gradient(180deg, var(--primary-2), var(--primary)); color: #fff; box-shadow: 0 10px 22px rgba(79,140,255,.28); }
.btn-secondary { background: rgba(255,255,255,.06); border-color: rgba(174,191,220,.18); color: #e9f0ff; }
.btn-danger    { background: linear-gradient(180deg, #ff8398, #f0677d); color: #fff; }
.btn.compact   { min-height: 40px; padding: 0 14px; border-radius: 12px; font-size: 13px; }
.btn-logout    { width: 100%; background: rgba(240,103,125,.10); border: 1px solid rgba(240,103,125,.25); color: #ffb3be; font-size: 14px; min-height: 46px; }
.btn-logout:active { background: rgba(240,103,125,.22); }
.form-actions  { display: flex; gap: 12px; margin-top: 20px; position: static; }
.form-actions .btn { flex: 1; }

.choice {
  min-height: 48px; padding: 0 8px; border-radius: var(--radius-sm);
  border: 1px solid rgba(168,184,211,.2); background: rgba(255,255,255,.03);
  color: #dce8ff; font-weight: 700; font-size: 14px;
  transition: .16s background, .16s border-color, .16s color, .16s box-shadow;
}
.choice.active {
  background: linear-gradient(180deg, rgba(79,140,255,.36), rgba(79,140,255,.20));
  border-color: rgba(123,163,255,.50); color: #fff;
  box-shadow: 0 6px 16px rgba(79,140,255,.18);
}
.choice:active { transform: scale(.97); }

.gravity-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }

.nc-badge {
  display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 900; letter-spacing: .06em;
  text-transform: uppercase; white-space: nowrap;
}
.nc-badge.ok   { background: var(--ok-green-bg); border: 1px solid var(--ok-green-bd); color: var(--ok-green); }
.nc-badge.ko   { background: var(--nc-red-bg);   border: 1px solid var(--nc-red-bd);   color: var(--nc-red); }

.calendar-nav  { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; }
.calendar-weekday, .calendar-day {
  min-height: 40px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid rgba(177,193,222,.12);
  background: rgba(255,255,255,.03); font-size: 13px;
}
.calendar-weekday  { font-size: 11px; color: var(--muted); font-weight: 800; border: none; background: none; }
.calendar-day      { color: var(--text); cursor: pointer; transition: .15s background; }
.calendar-day.empty    { opacity: .24; pointer-events: none; }
.calendar-day.has-data { background: rgba(62,207,142,.14); border-color: rgba(62,207,142,.32); }
.calendar-day.selected { box-shadow: 0 0 0 2px rgba(79,140,255,.50); border-color: transparent; }
.calendar-day.today    { border-color: rgba(110,165,255,.52); }

.bottom-nav {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 35;
  max-width: 780px; width: calc(100% - 28px);
  display: grid; grid-template-columns: repeat(2,1fr); gap: 8px;
  padding: 8px; border-radius: 22px;
  background: rgba(9,14,24,.88);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(177,193,222,.12); box-shadow: var(--shadow);
  grid-template-columns: repeat(auto-fit, minmax(80px, 120px));
justify-content: center;
}
.nav-btn {
  height: 56px; border-radius: 14px; border: 1px solid transparent; background: transparent;
  color: #aebdd9; display: grid; grid-template-rows: auto auto;
  place-items: center; gap: 3px; padding: 6px 0;
  transition: .16s background, .16s color, .16s border-color;
}
.nav-btn.active { background: linear-gradient(180deg, rgba(79,140,255,.32), rgba(79,140,255,.16)); border-color: rgba(123,163,255,.30); color: #fff; }
.nav-btn:active { transform: scale(.95); }
.nav-icon       { width: 22px; height: 22px; display: block; opacity: .88; }
.nav-label      { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; line-height: 1; }

#backdrop { position: fixed; inset: 0; background: rgba(4,9,18,.54); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
#backdrop.open { opacity: 1; pointer-events: auto; }
#drawer {
  position: fixed; top: 0; left: 0;
  width: min(86vw, 300px); height: 100%;
  display: flex; flex-direction: column;
  background: rgba(8,15,28,.96);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid rgba(177,193,222,.16);
  transform: translateX(-100%); transition: transform .22s; z-index: 41;
  overflow-y: auto;
}
#drawer.open { transform: translateX(0); }
.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 16px 12px; border-bottom: 1px solid rgba(177,193,222,.10); flex-shrink: 0;
}
.drawer-brand { font-size: 18px; font-weight: 800; }
.drawer-user  { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid rgba(177,193,222,.08); flex-shrink: 0; }
.drawer-user-name strong { color: var(--text); font-size: 14px; font-weight: 800; display: block; }
.drawer-user-name { font-size: 13px; color: var(--muted); line-height: 1.5; }
.drawer-menu  { list-style: none; margin: 0; padding: 8px 12px; flex: 1; }
.drawer-menu li { margin-bottom: 4px; }
.drawer-item  {
  width: 100%; text-align: left; height: 48px; padding: 0 14px;
  border-radius: 12px; border: 1px solid rgba(177,193,222,.10);
  background: rgba(255,255,255,.03); color: var(--text); font-size: 14px; font-weight: 700;
  transition: .15s background, .15s border-color;
}
.drawer-item:active { background: rgba(79,140,255,.18); border-color: rgba(123,163,255,.30); }
.drawer-footer { padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(177,193,222,.08); flex-shrink: 0; }

.persistent-status { margin: 10px 0 0; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; line-height: 1.4; }
.persistent-status.offline { border: 1px solid rgba(255,191,95,.28); background: rgba(255,191,95,.08); color: #ffe2a8; }
.persistent-status.pending { border: 1px solid rgba(79,140,255,.28); background: rgba(79,140,255,.10); color: #caddff; }

#toastStack { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 70; width: min(92vw, 420px); display: grid; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid rgba(177,193,222,.14); background: rgba(8,15,28,.96); box-shadow: var(--shadow); display: flex; gap: 12px; align-items: flex-start; animation: slideDown .22s ease; }
.toast-title   { font-size: 12px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.toast-message { font-size: 14px; line-height: 1.45; color: #dbe6fb; margin-top: 3px; }
.toast.success { border-color: rgba(62,207,142,.28); } .toast.success .toast-title { color: #96f1c4; }
.toast.error   { border-color: rgba(240,103,125,.30); } .toast.error   .toast-title { color: #ffbac6; }
.toast.info    { border-color: rgba(79,140,255,.30);  } .toast.info    .toast-title { color: #b8d0ff; }
.toast.warning { border-color: rgba(255,191,95,.30);  } .toast.warning .toast-title { color: #ffe0a0; }

#confirmLayer { position: fixed; inset: 0; z-index: 80; display: none; align-items: flex-end; justify-content: center; background: rgba(4,9,18,.58); padding: 18px; }
#confirmLayer.open { display: flex; }
.confirm-modal   { width: min(100%, 440px); padding: 20px; border-radius: 26px; }
.confirm-title   { font-size: 20px; font-weight: 800; margin-bottom: 10px; }
.confirm-message { color: #c8d7f2; line-height: 1.55; font-size: 14px; }
.confirm-actions { display: flex; gap: 10px; margin-top: 18px; }
.confirm-actions .btn { flex: 1; }

.report-card {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 16px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--border);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow); cursor: pointer; margin-bottom: 12px;
  transition: .18s border-color, .18s background;
}
.report-card:active { background: rgba(79,140,255,.12); border-color: rgba(123,163,255,.40); }
.report-card-icon  { font-size: 32px; flex-shrink: 0; }
.report-card-body  { flex: 1; min-width: 0; }
.report-card-label { font-size: 16px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.report-card-desc  { font-size: 13px; color: var(--muted); line-height: 1.4; }
.report-card-arrow { font-size: 20px; color: var(--muted); flex-shrink: 0; }

.report-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px; margin-bottom: 20px;
}
.report-type-btn {
  min-height: 52px; padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(168,184,211,.2);
  background: rgba(255,255,255,.03); color: #dce8ff;
  font-weight: 700; font-size: 13px; text-align: center;
  cursor: pointer; line-height: 1.3;
  transition: .16s background, .16s border-color, .16s color, .16s box-shadow;
}
.report-type-btn.active {
  background: linear-gradient(180deg, rgba(240,103,125,.32), rgba(240,103,125,.18));
  border-color: rgba(240,103,125,.60); color: #fff;
  box-shadow: 0 6px 16px rgba(240,103,125,.20);
}
.report-type-btn:active { transform: scale(.97); }
.report-type-btn.full-width { grid-column: 1 / -1; }

#reportModal {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column;
  background: #f1f5f9;
  overflow-y: auto;
}
.report-modal-bar {
  position: sticky; top: 0; z-index: 91;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 14px;
  background: rgba(8,14,26,.95);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(177,193,222,.14);
  flex-shrink: 0;
}
.report-modal-bar-title {
  font-size: 14px; font-weight: 800; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0;
}
#reportContent {
  flex: 1;
  overflow-y: auto;
}
#reportContent .paper {
  margin: 20px auto;
}

@media print {
  body > *                    { display: none !important; }
  #reportModal                { display: block !important; position: static !important; overflow: visible !important; background: white !important; }
  .report-modal-bar           { display: none !important; }
  #reportContent              { overflow: visible !important; }
  #reportContent .paper       { margin: 0 !important; width: 100% !important; box-shadow: none !important; }
  .no-print                   { display: none !important; }
  @page                       { size: A4; margin: 0; }
}

@keyframes slideDown { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.muted { color: var(--muted); font-size: 14px; line-height: 1.55; }
h2     { margin: 12px 0 8px; font-size: 21px; }

@media (min-width: 680px) {
  .report-type-grid { grid-template-columns: repeat(2, 1fr); }
  .section  { padding: 18px; }
}