/* Portail des services — Mairie de Crisenoy */
:root {
  --bg: #f4f6fb;
  --bg-2: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: #e3e7ef;
  --border-strong: #cfd6e3;
  --text: #121826;
  --text-2: #4a5468;
  --text-3: #7b8498;
  --primary: #2952d6;
  --primary-2: #1f43b8;
  --primary-soft: #e8eeff;
  --danger: #d93a32;
  --danger-soft: #fdecea;
  --success: #1c9a5c;
  --success-soft: #e5f6ed;
  --warning: #d97a06;
  --warning-soft: #fff3e0;
  --violet: #7c4ddf;
  --violet-soft: #f1ebff;
  --vert: #1c9a5c;
  --vert-soft: #e3f5ea;
  --bleu-soft: #e8eeff;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 3px rgba(16, 24, 40, .07), 0 8px 24px -12px rgba(16, 24, 40, .14);
  --shadow-lg: 0 24px 48px -16px rgba(16, 24, 40, .25);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar: 256px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c111b;
    --bg-2: #111827;
    --surface: #151c2b;
    --surface-2: #1a2234;
    --border: #253048;
    --border-strong: #33405e;
    --text: #e9edf5;
    --text-2: #aeb7c9;
    --text-3: #7e889d;
    --primary: #6d8cff;
    --primary-2: #8aa3ff;
    --primary-soft: #1d2a52;
    --danger: #ff6b63;
    --danger-soft: #3a1c1c;
    --success: #3fcf8e;
    --success-soft: #133325;
    --warning: #ffad42;
    --warning-soft: #3a2a12;
    --violet: #a98bff;
    --violet-soft: #2a2050;
    --vert: #3fcf8e;
    --vert-soft: #133325;
    --bleu-soft: #1d2a52;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -12px rgba(0, 0, 0, .6);
    --shadow-lg: 0 24px 60px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .8em; }
svg.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--text-3); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------ Mise en page */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #3d6cf0, #1c3fae);
  color: #fff; font-weight: 800; font-size: 1.2rem;
  box-shadow: 0 4px 12px -4px rgba(41, 82, 214, .6);
  position: relative; overflow: hidden;
}
.brand-mark::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px;
  background: linear-gradient(90deg, #2952d6 0 33.3%, #ffffff 33.3% 66.6%, #e0413a 66.6%);
}
.brand-mark span { position: relative; margin-top: -3px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.2; }
.brand-txt strong { font-size: .95rem; }
.brand-txt small { color: var(--text-3); font-size: .78rem; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-titre { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 650; padding: 16px 10px 6px; }
.nav a, .nav .nav-off {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 10px;
  color: var(--text-2); font-weight: 550; font-size: .92rem;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.actif { background: var(--primary-soft); color: var(--primary); }
.nav .nav-off { opacity: .55; cursor: default; white-space: nowrap; }
.nav .tag { margin-left: auto; }

.user-card {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; padding: 10px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--primary); color: #fff; font-weight: 700; font-size: .8rem;
}
.user-card .who { flex: 1; min-width: 0; line-height: 1.25; }
.user-card .who strong { display: block; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .who small { color: var(--text-3); font-size: .76rem; }
.user-actions { display: flex; gap: 2px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar-mobile { display: none; }
.page { padding: 30px 36px 48px; max-width: 1280px; width: 100%; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header p { margin: 6px 0 0; color: var(--text-2); }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: .85rem; color: var(--text-3); margin-bottom: 8px; }
.crumbs a { color: var(--text-3); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------ Composants */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-body { padding: 18px 20px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.split { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
.split-fiche { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .split, .split-fiche { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 32px; padding: 0 11px; font-size: .84rem; border-radius: 8px; }
.btn-icon { width: 34px; height: 34px; padding: 0; }
.btn-block { width: 100%; }

.tag, .badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: 999px;
  font-size: .76rem; font-weight: 650; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.badge .pt { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.tag-bleu { background: var(--bleu-soft); color: var(--primary); border-color: transparent; }
.tag-vert { background: var(--success-soft); color: var(--success); border-color: transparent; }
.tag-rouge { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.tag-orange { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.tag-violet { background: var(--violet-soft); color: var(--violet); border-color: transparent; }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); margin-bottom: 14px; }
.alert-success { background: var(--success-soft); border-color: transparent; color: var(--success); }
.alert-error { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.alert-info { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.alert-warning { background: var(--warning-soft); border-color: transparent; color: var(--warning); }
.alert > div { color: var(--text); }
.messages { position: fixed; top: 18px; right: 18px; z-index: 100; width: min(420px, calc(100vw - 36px)); }
.messages .alert { box-shadow: var(--shadow-lg); animation: glisse .3s ease-out; }
@keyframes glisse { from { opacity: 0; transform: translateY(-8px); } }

/* Formulaires */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .plein { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-weight: 600; font-size: .88rem; color: var(--text); }
.field .aide { font-size: .8rem; color: var(--text-3); }
.field .err { font-size: .82rem; color: var(--danger); font-weight: 550; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 9px 12px; min-height: 40px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
.field.has-err input, .field.has-err select, .field.has-err textarea { border-color: var(--danger); }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); }
.check strong { display: block; font-size: .9rem; }
.check small { color: var(--text-3); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; flex-wrap: wrap; }
.input-ic { position: relative; }
.input-ic svg.ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-ic input { padding-left: 36px; }

/* Choix segmentés (niveaux d'accès) */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--bg-2); border: 1px solid var(--border); flex-wrap: wrap; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 6px 12px; border-radius: 8px; font-size: .84rem; font-weight: 600; color: var(--text-2); }
.seg input:checked + span { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.seg input:focus-visible + span { outline: 2px solid var(--primary); }
.seg input:disabled + span { opacity: .5; }
.acces-ligne { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.acces-ligne:last-child { border-bottom: 0; }
.acces-mod { display: flex; align-items: center; gap: 12px; }

/* Tableaux */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 650; padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .cell-user { display: flex; align-items: center; gap: 11px; }
.table a.ligne { color: inherit; font-weight: 600; }
.vide { padding: 40px 20px; text-align: center; color: var(--text-3); }

.filtres { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.filtres .input-ic { flex: 1; min-width: 220px; }
.filtres select { width: auto; min-width: 150px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { padding: 6px 12px; border-radius: 999px; font-size: .84rem; font-weight: 600; color: var(--text-2); border: 1px solid var(--border); background: var(--surface); }
.pill:hover { text-decoration: none; background: var(--surface-2); }
.pill.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.pagination { display: flex; gap: 6px; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); font-size: .88rem; color: var(--text-3); }

/* Statistiques */
.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.stat .val { font-size: 1.75rem; font-weight: 750; letter-spacing: -.02em; }
.stat .lib { color: var(--text-2); font-size: .86rem; font-weight: 550; }
.stat .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 8px; }

/* ------------------------------------------------------------ Accueil */
.hero {
  position: relative; overflow: hidden;
  padding: 28px 30px; border-radius: 20px; margin-bottom: 26px;
  background: radial-gradient(1200px 300px at 100% 0%, rgba(255,255,255,.18), transparent 60%),
              linear-gradient(120deg, #1c3fae 0%, #2952d6 55%, #3d6cf0 100%);
  color: #fff; box-shadow: var(--shadow);
}
.hero h1 { font-size: 1.75rem; }
.hero p { color: rgba(255,255,255,.82); margin: 8px 0 0; }
.hero .date::first-letter { text-transform: uppercase; }
.hero .date { font-size: .88rem; color: rgba(255,255,255,.75); font-weight: 550; }
.hero-deco { position: absolute; right: -40px; top: -40px; width: 260px; height: 260px; border-radius: 50%; border: 40px solid rgba(255,255,255,.06); }
.hero-deco.d2 { right: 120px; top: 70px; width: 140px; height: 140px; border-width: 22px; }

.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.module {
  position: relative; display: flex; flex-direction: column; gap: 14px;
  padding: 22px; border-radius: 18px; min-height: 190px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  color: var(--text); transition: transform .18s, box-shadow .18s, border-color .18s;
}
a.module:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); text-decoration: none; }
.module .m-ico { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; color: #fff; }
.module .m-ico svg.ic { width: 26px; height: 26px; stroke-width: 1.7; }
.module h3 { font-size: 1.12rem; }
.module p { color: var(--text-2); font-size: .9rem; margin: 4px 0 0; }
.module .m-pied { margin-top: auto; display: flex; align-items: center; justify-content: space-between; font-size: .85rem; font-weight: 600; color: var(--text-3); }
a.module .m-pied .go { color: var(--primary); display: inline-flex; align-items: center; gap: 4px; }
.module.off { opacity: .72; }
.module.ajout { border-style: dashed; background: transparent; box-shadow: none; align-items: center; justify-content: center; text-align: center; color: var(--text-3); }
.c-vert { background: linear-gradient(135deg, #17a067, #0f7a4e); }
.c-violet { background: linear-gradient(135deg, #8b5cf6, #6235d9); }
.c-bleu { background: linear-gradient(135deg, #3d6cf0, #1f43b8); }
.c-orange { background: linear-gradient(135deg, #f59e0b, #d9620b); }
.c-rose { background: linear-gradient(135deg, #ec4899, #be185d); }

.activite { list-style: none; margin: 0; padding: 0; }
.activite li { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); font-size: .88rem; }
.activite li:last-child { border-bottom: 0; }
.activite .pt { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 7px; flex: none; }
.activite time { color: var(--text-3); font-size: .8rem; white-space: nowrap; margin-left: auto; }

/* ------------------------------------------------------------ Connexion */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-visuel {
  position: relative; overflow: hidden; color: #fff;
  padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(900px 500px at 0% 100%, rgba(224,65,58,.35), transparent 60%),
              radial-gradient(700px 500px at 100% 0%, rgba(255,255,255,.14), transparent 60%),
              linear-gradient(140deg, #13296f 0%, #1f43b8 50%, #2f5fe6 100%);
}
.login-visuel .grille {
  position: absolute; inset: 0; opacity: .14;
  background-image: linear-gradient(rgba(255,255,255,.6) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.6) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 30% 60%, #000 20%, transparent 75%);
}
.login-visuel > * { position: relative; }
.login-visuel h1 { font-size: 2.5rem; line-height: 1.1; max-width: 520px; letter-spacing: -.02em; }
.login-visuel p { color: rgba(255,255,255,.8); max-width: 460px; font-size: 1.02rem; margin-top: 16px; }
.login-puces { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.login-puces span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); font-size: .88rem; font-weight: 550; backdrop-filter: blur(6px); }
.login-form { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.login-box { width: 100%; max-width: 380px; }
.login-box h2 { font-size: 1.55rem; margin-bottom: 6px; }
.login-box .sous { color: var(--text-2); margin-bottom: 26px; }
.login-box .field { margin-bottom: 16px; }
.login-box .btn { height: 46px; font-size: .98rem; margin-top: 6px; }
.login-pied { margin-top: 28px; font-size: .8rem; color: var(--text-3); text-align: center; }

/* ------------------------------------------------------------ Fiche (cimetière) */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; font-size: .9rem; margin: 0; }
.kv dt { color: var(--text-3); font-weight: 550; }
.kv dd { margin: 0; font-weight: 550; }
.defunt { display: flex; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.defunt:last-child { border-bottom: 0; }
.defunt .croix { width: 38px; height: 38px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-3); flex: none; }
.defunt .info { flex: 1; min-width: 0; }
.defunt .info strong { display: block; }
.defunt .info small { color: var(--text-2); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 20px 16px 40px; }
.timeline li::before { content: ""; position: absolute; left: 24px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); }
.timeline li::after { content: ""; position: absolute; left: 28px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li.on::before { background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.bandeau-demo { display: flex; align-items: center; gap: 10px; padding: 8px 14px; font-size: .84rem; font-weight: 600; background: var(--warning-soft); color: var(--warning); border-bottom: 1px solid var(--border); }

/* ------------------------------------------------------------ Responsive */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login { grid-template-columns: 1fr; }
  .login-visuel { min-height: 300px; padding: 32px 24px; }
  .login-visuel h1 { font-size: 1.9rem; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  body.menu-ouvert .sidebar { transform: none; }
  body.menu-ouvert::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
  .topbar-mobile { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 20; }
  .page { padding: 20px 16px 40px; }
  .g2, .g3, .g4, .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .hero { padding: 22px; }
  .login-visuel .login-puces { display: none; }
}
