/* MaKommune - feuille de style (polices système, aucune ressource externe) */
:root {
  --bleu: #1f5f8b; --bleu-f: #164766; --bleu-c: #e7f0f7;
  --fond: #f3f5f8; --carte: #fff; --texte: #1d2733; --gris: #66717d; --bord: #dde3ea;
  --rouge: #c62828; --orange: #e67e22; --vert: #2e7d32; --jaune: #f5b700;
  --rayon: 10px; --ombre: 0 1px 3px rgba(0,0,0,.08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif; font-size: 16px; line-height: 1.45; color: var(--texte); background: var(--fond); }
a { color: var(--bleu); }
h1 { font-size: 1.5rem; margin: .2em 0 .6em; }
h2 { font-size: 1.15rem; margin: .2em 0 .6em; }
h3 { font-size: 1rem; margin: .2em 0 .5em; }
code { background: #eef1f4; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
[hidden] { display: none !important; }
.muted { color: var(--gris); }
.small { font-size: .85rem; }
.center { text-align: center; }
.pre { white-space: pre-wrap; word-wrap: break-word; }
.warn { color: var(--orange); font-weight: 600; }
.late { color: var(--rouge); font-weight: 600; }

/* ---------- Mise en page ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--bleu); color: #fff; padding: 8px 20px; }
.topbar-platform { background: #2d3a46; }
/* ---------- Bandeau du haut (mairie + admin) ---------- */
.bandeau { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; min-height: 52px; padding: 6px 18px; color: #fff;
  background: linear-gradient(90deg, #172a6e 0%, #1e40af 24%, #2563eb 44%, #2b8fb0 60%, #2fa79a 72%, #8fd3c8 85%, #e9f6f4 93%, #fff 98%); }
.bd-left { display: flex; align-items: center; gap: 10px; min-width: 0; color: #fff; text-decoration: none; }
.bd-icon { width: 30px; height: 30px; border-radius: 7px; background: #fff; padding: 2px; box-shadow: 0 1px 3px rgba(0,0,0,.25); flex: none; }
.bd-title { text-transform: uppercase; letter-spacing: .04em; font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.bd-title b { font-weight: 800; }
.bd-sep { margin: 0 7px; opacity: .7; }
.bd-sub { font-weight: 600; }
.bd-ver { flex: none; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.3); }
.bd-clock { display: flex; align-items: baseline; gap: 12px; white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.bd-date { font-size: .95rem; }
.bd-time { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.bd-right { display: flex; justify-content: flex-end; align-items: center; }
.bd-logo { height: 40px; max-width: 140px; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0,0,0,.15)); }
.navbar { position: relative; display: flex; align-items: center; gap: 4px; padding: 6px 18px; background: #fff; border-bottom: 1px solid #e3e8ef; box-shadow: 0 2px 6px rgba(20,40,80,.06); overflow-x: auto; scrollbar-width: none; }
.navbar::-webkit-scrollbar { display: none; }
.navbar a, .nb-out { display: inline-flex; align-items: center; white-space: nowrap; padding: 7px 12px; border-radius: 8px; color: #1e3a6e; text-decoration: none; font-weight: 600; font-size: .95rem; }
.navbar a:hover { background: #eef3fb; }
.navbar a.on { background: #e8f0fe; color: #1e40af; box-shadow: inset 0 -3px 0 #2563eb; }
.navbar .ico { margin-right: 6px; }
.navbar .nb-action { background: #f5a623; color: #1d2733; box-shadow: 0 1px 3px rgba(0,0,0,.15); margin: 0 4px; }
.navbar .nb-action:hover, .navbar .nb-action.on { background: #ffc04d; color: #1d2733; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.navbar .badge { background: #e1001e; color: #fff; }
.nb-spacer { flex: 1; min-width: 8px; }
.nb-out { background: none; border: 0; cursor: pointer; font: inherit; font-weight: 500; color: #66717d; }
.nb-out:hover { color: var(--rouge); }
@media (max-width: 760px) {
  .bandeau { grid-template-columns: 1fr auto; padding: 6px 12px; padding-top: calc(6px + env(safe-area-inset-top));
    background: linear-gradient(90deg, #172a6e 0%, #1e40af 35%, #2563eb 60%, #2b8fb0 82%, #2fa79a 100%); }
  .bd-date, .bd-right, .bd-ver { display: none; }
  .bd-time { font-size: 1.15rem; }
  .bd-title { font-size: .85rem; }
  .navbar { padding: 6px 10px; }
  .nb-spacer { flex: 0 0 4px; }
}
@media print { .bandeau, .navbar { display: none !important; } }
.topbar a { color: #fff; text-decoration: none; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; }
.brand img { border-radius: 6px; }
.brand .commune { font-weight: 400; opacity: .85; border-left: 1px solid rgba(255,255,255,.4); padding-left: 8px; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a, .nav .linkbtn, .nav .who { padding: 6px 10px; border-radius: 6px; }
.nav a:hover, .nav a.on { background: rgba(255,255,255,.15); }
.nav .btn-nav { background: #fff; color: var(--bleu) !important; font-weight: 600; }
.linkbtn { background: none; border: 0; color: #fff; cursor: pointer; font: inherit; opacity: .85; }
.inline { display: inline; }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 10px; background: var(--jaune); color: #000; font-size: .8rem; font-weight: 700; text-align: center; }
.main { max-width: 1200px; margin: 0 auto; padding: 20px; }
.foot { text-align: center; color: var(--gris); font-size: .8rem; padding: 20px; }
.simple-main { max-width: 420px; margin: 0 auto; padding: 40px 16px 0; }

.card { background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 18px 20px; margin-bottom: 16px; }
.card.empty { text-align: center; color: var(--gris); padding: 30px; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.pagehead h1, .pagehead h2, .pagehead h3 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
@media (max-width: 800px) { .grid2, .row2 { grid-template-columns: 1fr; } .main { padding: 12px; } }

/* ---------- Messages ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; transition: opacity .6s; }
.flash-ok { background: #e6f4ea; color: #1e5e26; border: 1px solid #b7dfc0; }
.flash-err { background: #fdecea; color: #8e1c1c; border: 1px solid #f5c2bf; }
.flash.fade { opacity: 0; }

/* ---------- Formulaires ---------- */
.form label { display: block; margin-bottom: 14px; font-weight: 600; }
.form label small { display: block; font-weight: 400; margin-top: 3px; }
.form-narrow { max-width: 640px; }
input[type=text], input[type=password], input[type=date], input[type=tel], input[type=email], input[type=search], select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px; font: inherit; font-weight: 400; color: inherit;
  border: 1px solid var(--bord); border-radius: 8px; background: #fff;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--bleu-c); border-color: var(--bleu); }
fieldset { border: 1px solid var(--bord); border-radius: 8px; margin: 0 0 14px; padding: 10px 14px; }
legend { font-weight: 600; padding: 0 6px; }
.form label.check, label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 6px 0; cursor: pointer; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 12px; }
.input-suffix { display: flex; align-items: center; gap: 6px; }
.input-suffix span { color: var(--gris); font-weight: 400; margin-top: 5px; white-space: nowrap; }
.with-mic { display: flex; gap: 6px; align-items: flex-start; }
.with-mic input, .with-mic textarea { flex: 1; }
.mic { margin-top: 5px; flex: none; width: 46px; height: 44px; border-radius: 8px; border: 1px solid var(--bord); background: #fff; font-size: 1.2rem; cursor: pointer; }
.mic.rec { background: var(--rouge); color: #fff; border-color: var(--rouge); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.prio-choice { display: flex; gap: 8px; flex-wrap: wrap; }
.form label.prio-opt { display: flex; align-items: center; gap: 6px; margin: 0; padding: 8px 12px; border: 1px solid var(--bord); border-radius: 8px; cursor: pointer; font-weight: 600; }
.inline-form { display: flex; gap: 6px; }
.inline-form input { margin: 0; padding: 5px 8px; width: auto; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--bord); background: #fff; color: var(--texte); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--bleu); }
.btn-primary { background: var(--bleu); border-color: var(--bleu); color: #fff; }
.btn-primary:hover { background: var(--bleu-f); }
.btn-success { background: var(--vert); border-color: var(--vert); color: #fff; }
.btn-danger { color: var(--rouge); border-color: #f0c4c4; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--bleu); }
.btn-small { padding: 5px 10px; font-size: .9rem; }
.btn-block { display: flex; width: 100%; }
.btn-big { padding: 14px 16px; font-size: 1.05rem; margin-bottom: 10px; }
form.busy { opacity: .6; pointer-events: none; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre); margin-bottom: 16px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--bord); vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--gris); background: #fafbfc; }
.table tr:last-child td { border-bottom: 0; }
.table tr.unseen td { background: #fffbea; }
.table tr.inactive td { opacity: .55; }
.table a { text-decoration: none; }

/* ---------- Pastilles ---------- */
.prio, .statut { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.prio-1 { background: #fde2e1; color: var(--rouge); }
.prio-2 { background: #fdebd8; color: #a65400; }
.prio-3 { background: var(--bleu-c); color: var(--bleu); }
.prio-4 { background: #eceff1; color: #546e7a; }
.st-a_faire { background: #fff4d6; color: #7a5a00; }
.st-en_cours { background: #e3f2fd; color: #0d5ca8; }
.st-terminee { background: #e6f4ea; color: var(--vert); }
.st-annulee { background: #eceff1; color: #607d8b; }
.new { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 10px; background: var(--jaune); color: #000; font-size: .72rem; font-weight: 700; }

/* ---------- Liste des tâches (mairie) ---------- */
.counters { display: flex; gap: 16px; color: var(--gris); flex-wrap: wrap; }
.counters b { color: var(--texte); font-size: 1.1rem; }
.filters { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.filters select { width: auto; margin: 0; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { padding: 7px 12px; border-radius: 8px; text-decoration: none; color: var(--texte); background: #fff; border: 1px solid var(--bord); }
.tab.on { background: var(--bleu); color: #fff; border-color: var(--bleu); }
.alert-closed { border-left: 5px solid var(--jaune); }
.closed-list { margin: 0; padding-left: 20px; }
.closed-box { border-left: 5px solid var(--vert); }
.info { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; margin: 0 0 10px; }
.info dt { color: var(--gris); }
.info dd { margin: 0; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 4px 0; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.photos a { display: block; position: relative; text-decoration: none; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #e9edf1; display: block; }
.photos span { display: block; font-size: .75rem; color: var(--gris); margin-top: 2px; }
/* Recherche dans la liste des tâches */
.filters .search-row, .filters .quick-periods { flex-basis: 100%; }
.search-row input, .search-row select { margin: 0; }
.search-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.search-row .search-q { flex: 1 1 260px; min-width: 0; }
.search-row .period { display: flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--gris); white-space: nowrap; }
.search-row .period input { width: auto; }
.quick-periods { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.quick-periods a.on { font-weight: 700; text-decoration: none; color: var(--texte); }
/* Visionneuse de photos */
html.lb-on, html.lb-on body { overflow: hidden; }
.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(10,15,20,.96); display: flex; align-items: center; justify-content: center; padding: 56px 12px calc(56px + env(safe-area-inset-bottom)); }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 4px 30px rgba(0,0,0,.5); }
.lightbox button { position: absolute; border: 0; background: rgba(255,255,255,.15); color: #fff; cursor: pointer; font: inherit; line-height: 1; border-radius: 50%; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; }
.lightbox button:hover, .lightbox button:focus-visible { background: rgba(255,255,255,.3); outline: none; }
.lb-close { top: calc(10px + env(safe-area-inset-top)); right: 12px; font-size: 2rem; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); font-size: 2.4rem; padding-bottom: 4px; }
.lb-prev { left: 10px; } .lb-next { right: 10px; }
.lb-single .lb-prev, .lb-single .lb-next { display: none; }
.lb-bar { position: absolute; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom)); display: flex; justify-content: center; gap: 18px; color: #dfe6ec; font-size: .9rem; }
.lb-bar a { color: #dfe6ec; }
.timeline { list-style: none; padding: 0; margin: 0 0 14px; }
.timeline li { padding: 6px 0 6px 14px; border-left: 2px solid var(--bord); }

/* ---------- Application ouvriers (mobile) ---------- */
body.app { padding-bottom: env(safe-area-inset-bottom); }
.appbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; background: var(--bleu); color: #fff; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); }
.appbar .back { color: #fff; text-decoration: none; font-size: 2rem; line-height: 1; padding: 0 8px 4px 0; }
.appbar-title { flex: 1; font-weight: 700; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-me { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.2); color: #fff; display: flex; align-items: center; justify-content: center; text-decoration: none; font-weight: 700; font-size: .9rem; }
.push-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff8e1; padding: 10px 14px; border-bottom: 1px solid #f3e2a9; font-size: .9rem; }
.app-main { max-width: 640px; margin: 0 auto; padding: 12px; }
.group-title { font-size: 1rem; margin: 18px 4px 8px; }
.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-list.done { opacity: .7; }
.task-card { display: block; background: #fff; border-radius: var(--rayon); box-shadow: var(--ombre); padding: 12px 14px; color: var(--texte); text-decoration: none; border-left: 6px solid var(--bleu); }
.task-card.is-new { box-shadow: 0 0 0 2px var(--jaune), var(--ombre); }
.prio-border-1 { border-left-color: var(--rouge); }
.prio-border-2 { border-left-color: var(--orange); }
.prio-border-3 { border-left-color: var(--bleu); }
.prio-border-4 { border-left-color: #90a4ae; }
.task-card-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.task-card-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 2px; }
.task-detail h1 { font-size: 1.3rem; margin: .4em 0; }
.app .card h2 { font-size: 1.05rem; }
.app .photos { grid-template-columns: repeat(3, 1fr); gap: 6px; }

/* ---------- Connexion ---------- */
.login-card { padding: 26px; }
.login-head { text-align: center; margin-bottom: 16px; }
.login-head img { border-radius: 14px; }
.login-head h1 { margin: 8px 0 0; }

/* ---------- Emblème de la commune ---------- */
.brand-img { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; background: #fff; padding: 2px; }
.embleme-login { width: 120px; height: 120px; object-fit: contain; }
.embleme-preview { width: 96px; height: 96px; object-fit: contain; background: #f3f5f8; border-radius: 8px; padding: 4px; }
.appbar-embleme { width: 32px; height: 32px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px; }

/* ---------- Installation de l'application ---------- */
.install-box { margin-top: 14px; }
.install-help { margin-top: 10px; padding: 12px 14px; background: var(--bleu-c); border-radius: 8px; font-size: .92rem; }
.install-help ol { margin: 6px 0 0; padding-left: 20px; }
.install-banner { padding: 0 12px; max-width: 640px; margin: 0 auto; }
.install-banner .install-box { margin-top: 10px; }
.ios-share { display: inline-block; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; font-size: .8em; }

/* ---------- Nouveau mot de passe ---------- */
.reset-box { border-left: 5px solid var(--bleu); }
.pass-card .info { grid-template-columns: 120px 1fr; align-items: center; }
.big-code { font-size: 1.6rem; letter-spacing: .06em; padding: 4px 10px; }
@media print { .topbar, .foot, .actions, .warn { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }
/* Support */
.seg { border: 0; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.seg legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.seg-opt { display: inline-flex !important; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--bord); border-radius: 8px; background: #fff; cursor: pointer; font-weight: 400 !important; margin: 0 !important; }
.seg-opt:has(input:checked) { border-color: var(--bleu); background: var(--bleu-c); }
.support-mes li { padding: 8px 0; border-bottom: 1px solid var(--bord); }
.support-mes li:last-child { border-bottom: 0; }
.ok-txt { color: var(--vert); font-weight: 600; }
.support-grid { align-items: start; }
.support-msg { white-space: pre-wrap; padding: 12px; background: var(--fond); border-radius: 8px; }
.support-img { max-width: 100%; max-height: 420px; border-radius: 8px; border: 1px solid var(--bord); }
.kv { border-collapse: collapse; width: 100%; }
.kv td { padding: 5px 10px 5px 0; vertical-align: top; border-bottom: 1px solid var(--bord); }
.kv td:first-child { color: var(--gris); white-space: nowrap; width: 1%; }
