/* Pass Starter — thème provisoire. Remplacer les variables ci-dessous par la charte AKT (couleurs, typographie)
   et ajouter les logos AKT / WE dans #brand (voir public/js/core.js, fonction brand()). */
:root {
  --primary: #0b3d6b;
  --primary-dark: #082c4e;
  --accent: #e8590c;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1c2733;
  --muted: #5d6b7a;
  --border: #d9e0e8;
  --ok: #1b7f4b;
  --ok-bg: #e3f5eb;
  --warn: #8a5a00;
  --warn-bg: #fff3d6;
  --bad: #b3261e;
  --bad-bg: #fde8e6;
  --info: #0b5cad;
  --info-bg: #e5f0fb;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
a { color: var(--info); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }

/* En-tête */
.topbar { background: var(--primary); color: #fff; }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.15rem; letter-spacing: .2px; margin-right: auto; }
.brand small { display: block; font-weight: 400; font-size: .75rem; opacity: .85; }
.user { font-size: .85rem; opacity: .95; }
.topbar .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); padding: .35rem .7rem; }
.nav { background: var(--primary-dark); overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
.nav-inner { max-width: 1100px; margin: 0 auto; padding: 0 .5rem; display: flex; }
.nav a { color: #cfe0f1; text-decoration: none; padding: .75rem .9rem; border-bottom: 3px solid transparent; font-size: .95rem; }
.nav a.active { color: #fff; border-bottom-color: var(--accent); font-weight: 600; }
.nav .count { background: var(--accent); color: #fff; border-radius: 99px; font-size: .72rem; padding: 0 .45rem; margin-left: .3rem; }

main { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.narrow { max-width: 460px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: .9rem; }
.card.compact { padding: .75rem 1rem; }

/* Formulaires */
label { display: block; font-weight: 600; font-size: .9rem; margin: .8rem 0 .25rem; }
input, select, textarea { width: 100%; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); font: inherit; }
input[type=checkbox], input[type=radio] { width: auto; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid #8ab8e6; outline-offset: 1px; }
textarea { min-height: 6rem; resize: vertical; }
.code-input { font-size: 1.8rem; letter-spacing: .5rem; text-align: center; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }
.row.nogrow > * { flex: 0 0 auto; }
.between { justify-content: space-between; align-items: center; }
.nomargin { margin: 0 !important; }
.mt-s { margin-top: .4rem; }
.lbl-title { margin: 0; font-size: 1.05rem; font-weight: 600; }
textarea.tall { min-height: 14rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; align-items: center; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: .9rem; }
.filters > * { flex: 1 1 150px; }
.filters label { margin: 0 0 .15rem; font-size: .8rem; color: var(--muted); font-weight: 500; }

.btn { display: inline-block; border: 1px solid var(--primary); background: var(--primary); color: #fff; padding: .6rem 1rem; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: #fff; color: var(--primary); }
.btn.secondary:hover { background: var(--info-bg); }
.btn.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.small { padding: .35rem .65rem; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--info); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

/* Onglets de connexion */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 1rem; }
.tabs button { flex: 1; background: none; border: 0; padding: .7rem; font: inherit; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--accent); }

/* Pastilles */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.b-envoyee { background: var(--info-bg); color: var(--info); }
.b-en_attente { background: var(--warn-bg); color: var(--warn); }
.b-acceptee, .b-publiee, .b-active { background: var(--ok-bg); color: var(--ok); }
.b-refusee, .b-annulee, .b-disabled { background: var(--bad-bg); color: var(--bad); }
.b-brouillon, .b-pending { background: #eceff3; color: #44505e; }
.b-regional { background: #fbe9dc; color: #a14000; }
.b-local { background: #e9edf8; color: #2c3e86; }

/* Messages */
.alert { padding: .7rem .9rem; border-radius: 8px; margin: .8rem 0; font-size: .95rem; }
.alert.error { background: var(--bad-bg); color: var(--bad); }
.alert.info { background: var(--info-bg); color: var(--info); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
#toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: .5rem; width: min(92vw, 440px); }
.toast { background: #1c2733; color: #fff; padding: .7rem 1rem; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.toast.error { background: var(--bad); }

/* Cartes d'activité */
.activity { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; }
.activity .pick { padding-top: .25rem; }
.activity.disabled { opacity: .7; }
.activity h3 { margin-bottom: .2rem; }
.meta { display: flex; gap: .4rem .9rem; flex-wrap: wrap; color: var(--muted); font-size: .9rem; margin: .2rem 0 .4rem; }
.activity p { margin: .4rem 0; white-space: pre-line; }
.places { font-weight: 600; }
.places.low { color: var(--warn); }
.places.none { color: var(--bad); }
.stickybar { position: sticky; bottom: 0; background: #fff; border-top: 2px solid var(--primary); padding: .7rem 1rem; margin: 0 -1rem -1rem; display: flex; justify-content: space-between; align-items: center; gap: .75rem; z-index: 5; }

/* Tableaux */
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .9rem; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: #f0f3f7; font-size: .8rem; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .btn { margin: 0 .2rem .2rem 0; }
.group-head { background: #eaf0f7; padding: .6rem .8rem; font-weight: 600; display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.bar { height: 10px; background: #e3e8ee; border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--ok); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: .9rem; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; }
.kpi b { display: block; font-size: 1.8rem; line-height: 1.1; color: var(--primary); }
.kpi span { color: var(--muted); font-size: .85rem; }

/* Fenêtres modales */
.overlay { position: fixed; inset: 0; background: rgba(10,20,30,.55); z-index: 50; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 1rem; }
.modal { background: #fff; border-radius: var(--radius); width: min(100%, 640px); padding: 1.1rem 1.2rem; margin: auto; }
.modal.wide { width: min(100%, 900px); }
.qr { display: block; margin: .6rem auto; border: 1px solid var(--border); border-radius: 8px; }
.secret { font-family: ui-monospace, Consolas, monospace; background: #f0f3f7; padding: .3rem .5rem; border-radius: 6px; word-break: break-all; font-size: .9rem; }
.vars code { background: #f0f3f7; padding: .05rem .35rem; border-radius: 4px; font-size: .85rem; cursor: pointer; }
pre.body { white-space: pre-wrap; font-family: inherit; margin: 0; }

@media (min-width: 720px) {
  main { padding: 1.5rem; }
  .stickybar { margin: 0; border-radius: 0 0 var(--radius) var(--radius); }
}
